/* ==========================================================================
   components.css — shared across both surfaces
   ========================================================================== */

/* ---------- buttons ------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-8);
  padding: 9px 16px; border-radius: var(--radius-md);
  font-size: var(--app-body-m); font-weight: 600; line-height: 1;
  border: 1px solid transparent; background: var(--white); color: var(--text-dark);
  white-space: nowrap; transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { background: var(--grey-medium); }
.btn--ghost { background: none; }
.btn--ghost:hover { background: var(--black-7); }
.btn--outline { border-color: var(--black-15); }
.btn--outline:hover { background: var(--grey-light); }
.btn--primary { background: var(--wrc-rackman); color: var(--white); }
.btn--primary:hover { background: var(--wrc-rackman-dark); }
.btn--green { background: var(--wrc-green); color: var(--white); }
.btn--green:hover { background: var(--wrc-green-dark); }
.btn--orange { background: var(--wrc-orange); color: var(--white); }
.btn--orange:hover { filter: brightness(.94); }
.btn--danger { color: var(--status-red); }
/* Web CTA: Figma's storefront buttons are all 48 tall, r10, 16px Semi Bold
   with an 8px gap to an 18px arrow. Height, not padding — 16+16+19 != 48. */
.btn--web { height: 48px; padding: 0 31px; border-radius: var(--radius-lg); font-size: 16px; gap: var(--space-8); }
.btn--outlinewhite { background: none; color: #fff; border: 1.5px solid #fff; }
.btn--outlinewhite:hover { background: rgba(255,255,255,.12); }
.btn--sm { padding: 6px 12px; font-size: var(--app-caption); }
.btn--lg { padding: 13px 22px; font-size: var(--web-button); border-radius: var(--radius-lg); }
.btn--block { width: 100%; }
.btn[disabled], .btn--disabled {
  background: var(--grey-light); color: var(--black-25);
  border-color: transparent; cursor: not-allowed;
}
.btn-link {
  color: var(--wrc-rackman); font-size: var(--app-caption); font-weight: 600;
  background: none; padding: 0;
}
.btn-link:hover { text-decoration: underline; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: var(--radius-md);
  color: var(--text-medium); border: 1px solid var(--black-7); background: var(--white);
  box-shadow: var(--shadow-card);
}
.icon-btn:hover { background: var(--grey-light); color: var(--text-dark); }
.icon-btn--bare { border: 0; box-shadow: none; background: none; }

/* ---------- fields ------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > .t-label { display: block; }

.input, .select, .textarea {
  width: 100%; padding: 8px 11px;
  font-size: var(--app-body-m); color: var(--text-dark);
  background: var(--white); border: 1px solid var(--black-15);
  border-radius: var(--radius-md); outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.input::placeholder, .textarea::placeholder { color: var(--black-25); }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--wrc-rackman);
  box-shadow: 0 0 0 3px var(--wrc-rackman-7);
}
.textarea { min-height: 92px; resize: vertical; line-height: 1.5; }
.select {
  appearance: none; padding-right: 30px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23656772' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center;
}
.input--strong { font-weight: 600; }
.input--sm { padding: 6px 9px; font-size: var(--app-body-s); }

/* checkbox + toggle */
.check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; }
.check input { position: absolute; opacity: 0; width: 0; height: 0; }
.check__box {
  width: 15px; height: 15px; flex: 0 0 15px; border-radius: var(--radius-xs);
  border: 1.5px solid var(--black-25); background: var(--white);
  display: grid; place-items: center; transition: background .12s, border-color .12s;
}
.check input:checked + .check__box { background: var(--wrc-rackman); border-color: var(--wrc-rackman); }
.check input:checked + .check__box::after {
  content: ""; width: 8px; height: 4px; margin-top: -2px;
  border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(-45deg);
}
.check--indeterminate .check__box { background: var(--wrc-rackman); border-color: var(--wrc-rackman); }
.check--indeterminate .check__box::after {
  content: ""; width: 8px; height: 2px; background: #fff; border: 0; transform: none; margin: 0;
}

.toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle__track {
  width: 32px; height: 18px; flex: 0 0 32px; border-radius: var(--radius-full);
  background: var(--grey-strong); position: relative; transition: background .15s;
}
.toggle__track::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 14px; height: 14px; border-radius: 50%; background: #fff;
  transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.toggle input:checked + .toggle__track { background: var(--wrc-rackman); }
.toggle input:checked + .toggle__track::after { transform: translateX(14px); }

/* ---------- chips -------------------------------------------------------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 9px; border-radius: var(--radius-full);
  font-size: var(--app-caption); font-weight: 600; line-height: 1.2;
  background: var(--grey-light); color: var(--text-medium); white-space: nowrap;
}
.chip--neutral { background: var(--grey-light); color: var(--text-light); }
.chip--green   { background: var(--status-green-tint);  color: var(--status-green); }
.chip--blue    { background: var(--status-blue-tint);   color: var(--status-blue); }
.chip--orange  { background: var(--status-orange-tint); color: var(--status-orange); }
.chip--red     { background: var(--status-red-tint);    color: var(--status-red); }
.chip--gold    { background: var(--status-gold-tint);   color: var(--status-gold); }
.chip--cyan    { background: var(--status-cyan-tint);   color: var(--status-cyan); }
.chip--purple  { background: var(--status-purple-tint); color: var(--status-purple); }
.chip--stale   { background: var(--status-stale-tint);  color: var(--status-stale); }

/* warehouse / site chip — code + count */
.whse {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 9px; border-radius: var(--radius-sm);
  font-size: var(--app-body-s); line-height: 1.2; white-space: nowrap;
  border: 1px solid transparent;
}
.whse--stock { background: var(--wrc-green-7); border-color: var(--wrc-green-20); color: var(--wrc-green); }
.whse--none  { background: var(--wrc-orange-7); color: var(--wrc-orange); }
.whse--sel   { background: var(--wrc-rackman); color: var(--white); }
.whse b { font-weight: 600; }

/* ---------- card --------------------------------------------------------- */
.card {
  background: var(--white); border: 1px solid var(--black-7);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-card);
}
.card__pad { padding: var(--space-18); }
.card__head {
  display: flex; align-items: center; gap: var(--space-10);
  padding: var(--space-16) var(--space-18);
}
.card__head .rule { flex: 1 1 auto; }

/* group heading + trailing rule — the app's section voice */
.grp-head { display: flex; align-items: center; gap: var(--space-10); }
.grp-head .rule { flex: 1 1 auto; }

/* ---------- table -------------------------------------------------------- */
.tbl { width: 100%; }
.tbl th {
  font-size: var(--app-label-col); font-weight: 500; letter-spacing: var(--app-ls-label);
  color: var(--text-light); text-transform: uppercase; text-align: left;
  padding: 0 0 9px; vertical-align: middle; white-space: nowrap;
}
.tbl td {
  font-size: var(--app-body-s); padding: 11px 0; vertical-align: middle;
  border-top: 1px solid var(--black-7);
}
.tbl thead th { border-bottom: 1px solid var(--black-7); }
.tbl tbody tr:hover td { background: var(--grey-light); }
.tbl .tr, .tbl th.tr { text-align: right; }
.tbl__cell-pad-l { padding-left: var(--space-18); }
.tbl__cell-pad-r { padding-right: var(--space-18); }
.tbl--rows tbody tr { cursor: pointer; }

/* ---------- modal -------------------------------------------------------- */
.scrim {
  position: fixed; inset: 0; background: rgba(16,24,40,.45);
  display: grid; place-items: center; padding: 24px; z-index: 50;
  animation: fade .12s ease-out;
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
.modal {
  background: var(--white); border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-modal); width: min(720px, 100%);
  max-height: calc(100vh - 48px); display: flex; flex-direction: column;
}
.modal__head {
  display: flex; align-items: center; gap: var(--space-12);
  padding: 20px 20px 20px 24px; border-bottom: 1px solid var(--black-7);
}
.modal__body { padding: 18px 24px 20px; overflow: auto; }
.modal__foot {
  display: flex; align-items: center; gap: var(--space-10);
  padding: 16px 20px 16px 24px; border-top: 1px solid var(--black-7);
  background: var(--grey-light); border-radius: 0 0 var(--radius-2xl) var(--radius-2xl);
}

/* ---------- misc --------------------------------------------------------- */
.pill-count {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px;
  padding: 0 5px; border-radius: var(--radius-full);
  background: var(--wrc-orange); color: #fff;
  font-size: var(--app-micro); font-weight: 600;
}
.empty {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  padding: 56px 24px; text-align: center;
}
.skel { background: var(--grey-medium); border-radius: var(--radius-sm); }

.thumb {
  border-radius: var(--radius-sm); border: 1px solid var(--black-7);
  background: var(--grey-medium); display: grid; place-items: center;
  color: var(--black-25); font-weight: 600; overflow: hidden; flex: none;
}

/* ==========================================================================
   Column filter popover — MEASURED off Data/Column Filter Menu 16072:320
   ========================================================================== */
.cfm {
  position: fixed; z-index: 60; width: 270px;
  background: var(--white); border: 1px solid var(--black-15);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-pop);
  display: flex; flex-direction: column;
}
.cfm__tabs { display: flex; gap: 16px; padding: 12px 14px 0; }
.cfm__tab { font-size: 11px; font-weight: 600; color: var(--text-dark); }

.cfm__searchwrap { padding: 12px 14px 10px; }
.cfm__search {
  display: flex; align-items: center; gap: 8px; height: 27px;
  padding: 7px 10px; border-radius: var(--radius-md);
  background: var(--white); border: 1px solid var(--black-15);
}
.cfm__search input {
  flex: 1 1 auto; border: 0; outline: none; background: none;
  font-size: 11px; color: var(--text-dark); min-width: 0;
}
.cfm__search input::placeholder { color: var(--text-light); }

.cfm__listwrap { padding: 0 14px; }
.cfm__list {
  border: 1px solid var(--black-15); border-radius: var(--radius-md);
  max-height: 182px; overflow-y: auto;
}
.cfm__list::-webkit-scrollbar { width: 8px; }
.cfm__list::-webkit-scrollbar-thumb { background: var(--black-35); border-radius: 999px; border: 2px solid var(--white); }

.cfm__opt {
  display: flex; align-items: center; gap: 8px;
  height: 26px; padding: 6px 10px; cursor: pointer; font-size: 11.5px;}
.cfm__opt:hover { background: var(--grey-light); }
.cfm__opt input { position: absolute; opacity: 0; width: 0; height: 0; }
.cfm__label { font-size: 11px; color: var(--text-medium); }
.cfm__opt.is-on .cfm__label { color: var(--text-dark); font-weight: 600; }
.cfm__divider { height: 1px; background: var(--black-15); }
.cfm__empty { padding: 14px 10px; font-size: 11px; color: var(--text-light); text-align: center; }

.cfm__footwrap { padding-top: 12px; }
.cfm__foot { display: flex; align-items: center; gap: 8px; padding: 12px 14px; }
.cfm__clear { height: 29px; padding: 8px 12px; font-size: 11px; font-weight: 500; color: var(--text-medium);}
.cfm__close { height: 24px; padding: 8px 12px; font-size: 11px; font-weight: 600; }
