/* CRU admin design system — professional refined dark-sidebar theme */
:root {
  /* brand */
  --brand: #7c3aed;
  --brand-600: #6d28d9;
  --brand-700: #5b21b6;
  --brand-soft: #f3effe;
  /* surfaces */
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --border: #e6e8ec;
  --border-strong: #d3d7de;
  /* text */
  --text: #1d2330;
  --muted: #6b7280;
  --faint: #9aa1ad;
  /* sidebar */
  --side-bg: #14161d;
  --side-bg-2: #1b1e27;
  --side-fg: #c5cbd6;
  --side-muted: #7a8395;
  --side-active: #ffffff;
  /* status */
  --ok: #16a34a; --ok-bg: #e7f6ec;
  --warn: #b45309; --warn-bg: #fdf3e3;
  --danger: #dc2626; --danger-bg: #fdeaea;
  --info: #3730a3; --info-bg: #e8e9fb;
  /* shape */
  --radius: 10px;
  --radius-sm: 7px;
  --shadow-sm: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.05);
  --shadow: 0 4px 12px rgba(16,24,40,.08);
  --ring: 0 0 0 3px rgba(124,58,237,.25);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-600); text-decoration: none; }
a:hover { color: var(--brand-700); }
h1, h2, h3, h4 { color: var(--text); line-height: 1.25; }
.muted { color: var(--muted); }
code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 5px;
  padding: .05rem .35rem; font-size: .82em; }

/* ---- shell ---- */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }

.sidebar { background: var(--side-bg); color: var(--side-fg); padding: .9rem .75rem 2rem;
  display: flex; flex-direction: column; gap: .1rem; position: sticky; top: 0; height: 100vh;
  overflow-y: auto; }
.sidebar .brand { display: flex; align-items: center; gap: .55rem; color: #fff; font-weight: 700;
  font-size: 1.15rem; letter-spacing: .01em; padding: .5rem .55rem 1rem; }
.sidebar .brand::before { content: ""; width: 24px; height: 24px; border-radius: 7px;
  background: linear-gradient(135deg, var(--brand) 0%, #a855f7 100%);
  box-shadow: 0 2px 6px rgba(124,58,237,.5); }
.sidebar .navgroup { color: var(--side-muted); font-size: .66rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em; margin: 1rem .6rem .3rem; }
.sidebar a { display: flex; align-items: center; gap: .55rem; color: var(--side-fg);
  padding: .5rem .6rem; border-radius: var(--radius-sm); font-size: .9rem; font-weight: 500;
  position: relative; transition: background .12s, color .12s; }
.sidebar a svg { width: 17px; height: 17px; flex: 0 0 17px; opacity: .82; }
.sidebar a:hover svg, .sidebar a.active svg { opacity: 1; }
.sidebar a:hover { background: var(--side-bg-2); color: #fff; text-decoration: none; }
.sidebar a.active { background: var(--side-bg-2); color: var(--side-active); font-weight: 600; }
.sidebar a.active::before { content: ""; position: absolute; left: -.75rem; top: 8px; bottom: 8px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--brand); }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: .8rem;
  height: 56px; padding: 0 1.4rem; background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20; }
.topbar .crumb { font-weight: 650; color: var(--text); font-size: .95rem; }
.topbar .user { display: flex; align-items: center; gap: .5rem; font-size: .9rem; color: var(--text);
  margin-left: auto; }
.content { padding: 1.5rem; max-width: 1240px; width: 100%; margin: 0 auto; }

/* ---- page header ---- */
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  margin-bottom: 1.25rem; }
.page-header h1 { font-size: 1.4rem; font-weight: 680; margin: 0; }

/* ---- cards ---- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 1.15rem 1.25rem; margin-bottom: 1.1rem; }
.card h3 { margin: 0 0 .8rem; font-size: 1rem; font-weight: 650; }
/* Plain-English "what is this page for" blurb — the brand rule marks it as guidance, not data. */
.card--note { border-left: 4px solid var(--brand); font-size: .9rem; line-height: 1.55; }
/* Orders table: header + data both centered so columns read as aligned, not floating. The
   left-most (checkbox) and product-thumbnail cells stay left so they don't drift. */
.orders-table th, .orders-table td { text-align: center; vertical-align: middle; }
.orders-table th:first-child, .orders-table td:first-child,
.orders-table th:nth-child(2), .orders-table td:nth-child(2) { text-align: left; }
.orders-table .bin-chips { justify-content: center; }
/* Products table: same treatment; the checkbox column and the Product (name/thumb) cell stay
   left, everything else centered. */
.ptable th, .ptable td { text-align: center; vertical-align: middle; }
.ptable td:first-child, .ptable th:first-child { text-align: left; }  /* checkbox */
.ptable .prod-cell, .ptable td.prod-cell { text-align: left; }
.ptable .chips { justify-content: center; }
/* Amazon Listings table: centered, but SKU (1st) and Title (3rd) stay left. Center the numeric
   Price/Qty here too so the table reads consistently with Orders and Products. */
.listings-table th, .listings-table td { text-align: center; vertical-align: middle; }
.listings-table th:nth-child(1), .listings-table td:nth-child(1),
.listings-table th:nth-child(3), .listings-table td:nth-child(3) { text-align: left; }
.listings-table .num { text-align: center; }
/* Shared utility for the remaining admin data tables: center every column, keep the first
   (the name/identifier) left. Override .num so numeric columns center too, for consistency. */
.tbl-center th, .tbl-center td { text-align: center; vertical-align: middle; }
.tbl-center th:first-child, .tbl-center td:first-child { text-align: left; }
.tbl-center td.num, .tbl-center th.num { text-align: center; }
/* Expedited (non-economy) Amazon orders — flag them so they're picked first. */
.order-row--rush td { background: #fffbeb; }
.order-row--rush td:first-child { box-shadow: inset 3px 0 0 #f59e0b; }
@media (prefers-color-scheme: dark) {
  .order-row--rush td { background: rgba(245, 158, 11, 0.10); }
}
/* Form on the left, its history table on the right; stacks on narrow screens. */
.layout-split { display: grid; grid-template-columns: minmax(0, 22rem) minmax(0, 1fr); gap: 1.1rem;
  align-items: start; }
@media (max-width: 900px) { .layout-split { grid-template-columns: minmax(0, 1fr); } }
.card h4 { margin: .2rem 0 .5rem; font-size: .9rem; font-weight: 650; }

/* ---- buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .5rem .9rem; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font-size: .88rem; font-weight: 550;
  cursor: pointer; transition: background .12s, border-color .12s, box-shadow .12s; white-space: nowrap; }
.btn:hover { background: var(--surface-2); border-color: #b9bfc9; text-decoration: none; }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; color: #fff; }
.btn-sm { padding: .3rem .6rem; font-size: .8rem; }

/* ---- forms ---- */
label { display: block; margin: .7rem 0 .25rem; font-size: .82rem; font-weight: 600; color: #374151; }
label.check { display: flex; align-items: center; gap: .45rem; font-weight: 500; margin: .4rem 0; }
.input, input[type=text], input[type=password], input[type=email], input[type=number],
input[type=file], select, textarea {
  width: 100%; padding: .5rem .65rem; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); font-size: .9rem; font-family: inherit; background: #fff;
  color: var(--text); transition: border-color .12s, box-shadow .12s; }
.input:focus, input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand);
  box-shadow: var(--ring); }
.field-error { color: var(--danger); font-size: .8rem; margin-top: .25rem; }
/* compact label+field rows; tighten the default label top-margin inside cards */
.card label { margin-top: .55rem; }
.field-row { display: grid; gap: .6rem; }
.field-row.cols-2 { grid-template-columns: 1fr 1fr; }
.field-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.field-row > label { margin-top: .55rem; }
/* When labels in a row differ in height (one wraps), bottom-align so the controls still line up. */
.field-row--align-end > label { display: flex; flex-direction: column; height: 100%; }
.field-row--align-end > label > select,
.field-row--align-end > label > .input { margin-top: auto; }

/* two-pane editor: main content + fixed sidebar (collapses on narrow screens) */
.editor-grid { display: grid; grid-template-columns: minmax(0,1fr) 320px; gap: 1.1rem; align-items: start; }
.editor-grid .side { position: sticky; top: 1rem; }
.table-scroll { overflow-x: auto; }
/* dense variant grid — inputs fill their cell, no fixed-px sprawl */
.vtable th, .vtable td { padding: .4rem .45rem; vertical-align: middle; text-align: center; }
.vtable input, .vtable select { padding: .4rem .45rem; font-size: .85rem; }
/* ---- variant editor: a wrapping field grid, so every field stays visible (a 10-column
       table forced horizontal scrolling and hid the values being edited) ---- */
/* Variant editor: grouped rows (identity / pricing / shipping / options) rather than one long
   auto-fit grid — 11+ fields in a single flow wrapped raggedly and read as noise. */
.variant-card { display: flex; flex-direction: column; gap: .55rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: .5rem .9rem .9rem; margin: 0 0 .7rem; background: var(--surface); }
.variant-card > legend { font-size: .78rem; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em; padding: 0 .35rem; }
.vgroup { display: flex; flex-direction: column; gap: .3rem; }
.vgroup + .vgroup { border-top: 1px dashed var(--border); padding-top: .55rem; }
.vgroup-t { font-size: .68rem; font-weight: 700; color: var(--muted); text-transform: uppercase;
  letter-spacing: .06em; }
.vgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr));
  gap: .45rem .7rem; align-items: end; }
.vfield { display: flex; flex-direction: column; gap: .2rem; font-size: .78rem; font-weight: 600;
  color: var(--muted); margin: 0; min-width: 0; }
.vfield .input { width: 100%; font-size: .88rem; font-weight: 400; color: var(--text); }
.vfield--wide { grid-column: span 2; }
@media (max-width: 640px) { .vfield--wide { grid-column: span 1; } }
/* dimensions read as one measurement: [L] × [W] × [H] */
.vdims { display: flex; align-items: end; gap: .35rem; grid-column: span 2; }
.vdims .vfield { flex: 1 1 0; }
.vdims .x { font-size: .8rem; color: var(--muted); padding-bottom: .5rem; }
@media (max-width: 640px) { .vdims { grid-column: span 1; } }
.v-margin { white-space: nowrap; font-variant-numeric: tabular-nums; font-size: .88rem; font-weight: 400; }
.variant-card.row-removing { background: #fef2f2; border-color: #fecaca; }
.variant-card.row-removing .input { opacity: .55; }
/* image picker: highlight the selected thumbnails */
label.check input:checked + img { outline: 2px solid var(--brand); outline-offset: 1px; }
@media (max-width: 980px) { .editor-grid { grid-template-columns: 1fr; }
  .editor-grid .side { position: static; }
  .field-row.cols-2, .field-row.cols-3 { grid-template-columns: 1fr; } }

/* ---- tables ---- */
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th { text-align: left; padding: .55rem .7rem; font-size: .7rem; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--border-strong);
  white-space: nowrap; }
td { padding: .6rem .7rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface-2); }

/* ---- badges ---- */
.badge { display: inline-flex; align-items: center; padding: .12rem .5rem; border-radius: 999px;
  font-size: .72rem; font-weight: 600; line-height: 1.4; }
.badge-admin { background: #ede9fe; color: #5b21b6; }
.badge-manager { background: #dbeafe; color: #1e40af; }
.badge-staff { background: #eef1f5; color: #475569; }
.badge-on { background: var(--ok-bg); color: var(--ok); }
.badge-off { background: var(--danger-bg); color: var(--danger); }

/* ---- alerts ---- */
.alert { padding: .65rem .85rem; border-radius: var(--radius-sm); margin: 0 0 .8rem;
  font-size: .9rem; border-left: 3px solid transparent; }
.alert-danger  { background: var(--danger-bg); color: #991b1b; border-left-color: var(--danger); }
.alert-success { background: var(--ok-bg); color: #166534; border-left-color: var(--ok); }
.alert-warning { background: var(--warn-bg); color: #92400e; border-left-color: var(--warn); }
.alert-info    { background: var(--info-bg); color: var(--info); border-left-color: var(--info); }

/* ---- login ---- */
.login-page { display: grid; place-items: center; min-height: 100vh;
  background: radial-gradient(1200px 600px at 50% -10%, #eee9fb 0%, var(--bg) 55%); }
.login-card { background: var(--surface); padding: 2rem 2rem 1.75rem; border-radius: 14px;
  box-shadow: var(--shadow); width: 340px; border: 1px solid var(--border); }
.login-card h1 { margin: 0; color: var(--brand-600); font-size: 1.6rem; }
.login-card .btn { width: 100%; margin-top: 1.1rem; }
/* show/hide password toggle: input keeps room on the right for the button */
.pw-wrap { position: relative; display: block; }
.pw-wrap .input { width: 100%; padding-right: 3.6rem; }
.pw-toggle { position: absolute; top: 50%; right: .5rem; transform: translateY(-50%);
  background: none; border: none; padding: .25rem .4rem; cursor: pointer;
  font-size: .8rem; font-weight: 600; color: var(--brand-600); }
.pw-toggle:hover { color: var(--brand); text-decoration: underline; }
.pw-toggle:focus-visible { outline: 2px solid var(--brand); border-radius: 4px; }

/* ---- dashboard KPI tiles ---- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 1rem;
  margin-bottom: 1.2rem; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 1rem 1.1rem; }
.kpi .label { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .04em;
  font-weight: 700; }
.kpi .value { font-size: 1.75rem; font-weight: 700; margin-top: .3rem; line-height: 1.1; }
.kpi .sub { color: var(--faint); font-size: .78rem; margin-top: .1rem; }
/* KPI accent bar + emphasis, used on the Amazon dashboard */
.kpi--accent { border-top: 3px solid var(--brand); }
.kpi--good { border-top: 3px solid var(--ok); }
.kpi--warn { border-top: 3px solid var(--warn); }
.kpi--bad { border-top: 3px solid var(--danger); }
.kpi .value.good { color: var(--ok); } .kpi .value.warn { color: var(--warn); }
.kpi .value.bad { color: var(--danger); }
/* section header with a count badge */
.sec-head { display: flex; align-items: center; gap: .55rem; margin: 0 0 .2rem; }
.sec-head .count { font-size: .72rem; font-weight: 600; padding: .1rem .5rem; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); }
.sec-head .count.bad { background: var(--danger-bg); border-color: transparent; color: var(--danger); }
.sec-head .count.warn { background: var(--warn-bg); border-color: transparent; color: var(--warn); }
.sec-head .count.good { background: var(--ok-bg); border-color: transparent; color: var(--ok); }
.sec-sub { color: var(--muted); font-size: .8rem; margin: 0 0 .7rem; }
.dash-two { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; }
@media (max-width: 720px) { .dash-two { grid-template-columns: 1fr; } }
.pager-row { display: flex; align-items: center; gap: .6rem; justify-content: flex-end;
  margin-top: .7rem; font-size: .82rem; color: var(--muted); }
.btn.is-disabled { opacity: .45; pointer-events: none; cursor: default; }
/* dashboard tables: labels left, numbers right + tabular */
.dtable th.num, .dtable td.num { text-align: right; font-variant-numeric: tabular-nums;
  white-space: nowrap; }
.dtable td .pname { display: inline-block; max-width: 30ch; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.dtable td.neg { color: var(--danger); font-weight: 600; }
/* thin win-rate meter under a KPI */
.meter { height: 6px; border-radius: 999px; background: var(--surface-2);
  border: 1px solid var(--border); overflow: hidden; margin-top: .55rem; }
.meter > span { display: block; height: 100%; background: var(--ok); }
.quick-actions { display: flex; gap: .6rem; flex-wrap: wrap; }

/* ---- sticky page header (keeps the primary actions reachable on long pages) ---- */
.page-header--sticky { position: sticky; top: 56px; z-index: 15; background: var(--bg);
  padding: .7rem 0 .6rem; margin-bottom: 1rem; border-bottom: 1px solid var(--border); }
/* bleed the sticky bar's background over the content padding so nothing shows through behind it */
.page-header--sticky::before { content: ""; position: absolute; top: 0; bottom: 0; left: -1.5rem; right: -1.5rem;
  background: var(--bg); z-index: -1; }
@media (max-width: 860px) { .page-header--sticky::before { left: -1rem; right: -1rem; } }

/* ---- toggle switch (channel on/off) ---- */
label.switch { display: flex; align-items: center; gap: .6rem; font-weight: 500; margin: .1rem 0;
  padding: .42rem .1rem; cursor: pointer; user-select: none; }
label.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
label.switch .track { flex: 0 0 38px; width: 38px; height: 22px; border-radius: 999px;
  background: #cbd2dc; position: relative; transition: background .16s ease; }
label.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.28); transition: transform .16s ease; }
label.switch input:checked + .track { background: var(--brand); }
label.switch input:checked + .track::after { transform: translateX(16px); }
label.switch input:focus-visible + .track { box-shadow: var(--ring); }
label.switch input:disabled + .track { background: #e5e7eb; cursor: not-allowed; }
label.switch input:disabled ~ .switch-text { color: var(--muted); }
label.switch:has(input:disabled) { cursor: not-allowed; }
.switch-text { display: flex; align-items: center; gap: .4rem; }

/* Long lists: ONE scroll — the page. .table-scroll can't be used here because `overflow-x: auto`
   makes the element a scroll container on BOTH axes (the spec forces the `visible` axis to `auto`),
   which draws a second scrollbar inside the card and makes `position: sticky` stick to that box
   instead of the viewport. So only turn on sideways scrolling when the screen is actually narrow. */
.table-wide { }
@media (max-width: 1000px) { .table-wide { overflow-x: auto; } }

.sticky-head thead th, .sticky-head > table > tr:first-child th {
  position: sticky; top: 56px; z-index: 10; background: var(--surface);
  box-shadow: inset 0 -1px 0 var(--border); }

/* truncate to one line, with an instant tooltip carrying the full text.
   Put .has-tip on the CELL — .one-line has overflow:hidden and would clip the tooltip. */
.one-line { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.has-tip { position: relative; }
.has-tip::after {
  content: attr(data-tip); position: absolute; left: .5rem; top: calc(100% - .2rem); z-index: 60;
  background: #17131f; color: #fff; padding: .5rem .65rem; border-radius: 7px;
  font-size: .78rem; line-height: 1.4; font-weight: 400; white-space: normal;
  width: max-content; max-width: 22rem; box-shadow: 0 10px 24px rgba(0,0,0,.3);
  opacity: 0; visibility: hidden; transition: opacity .1s ease; pointer-events: none; }
.has-tip:hover::after { opacity: 1; visibility: visible; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* read-only until explicitly unlocked (ship-from address) */
.input.locked { background: var(--surface-2); color: var(--text); cursor: default;
  border-color: var(--border); box-shadow: none; }
.input.locked:focus { border-color: var(--border); box-shadow: none; }

/* ---- confirm dialog ---- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15,17,21,.55); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 1rem;
  animation: modal-fade .12s ease; }
.modal-backdrop[hidden] { display: none; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 24px 60px rgba(0,0,0,.30); max-width: 440px; width: 100%; padding: 1.3rem 1.4rem;
  animation: modal-rise .14s ease; }
.modal h3 { margin: 0 0 .5rem; font-size: 1.05rem; font-weight: 650; }
.modal p { margin: 0 0 1.25rem; color: var(--muted); line-height: 1.5; white-space: pre-line; }
.modal-actions { display: flex; justify-content: flex-end; gap: .5rem; flex-wrap: wrap; }
body.modal-open { overflow: hidden; }
@keyframes modal-fade { from { opacity: 0 } to { opacity: 1 } }
@keyframes modal-rise { from { opacity: 0; transform: translateY(8px) } to { opacity: 1; transform: none } }

/* ---- responsive ---- */
.nav-toggle { display: none; background: none; border: none; font-size: 1.5rem; line-height: 1;
  cursor: pointer; color: var(--text); padding: .1rem .45rem; margin: 0 .1rem 0 -.3rem; border-radius: 8px; }
.nav-toggle:hover { background: var(--surface-2); }
.nav-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 55; }

@media (max-width: 860px) {
  /* sidebar becomes an off-canvas drawer opened by the hamburger */
  .shell { grid-template-columns: 1fr; }
  .nav-toggle { display: inline-flex; }
  .sidebar { position: fixed; top: 0; left: 0; z-index: 60; width: 244px; height: 100vh;
    transform: translateX(-100%); transition: transform .2s ease; box-shadow: 2px 0 18px rgba(0,0,0,.35); }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .nav-backdrop { display: block; }

  .content { padding: 1rem; }
  .topbar { padding: 0 .8rem; }
  .page-header { flex-wrap: wrap; }
  .page-header .quick-actions, .page-header > div { flex-wrap: wrap; }
  /* wide tables scroll horizontally inside their card instead of overflowing the page */
  .card { overflow-x: auto; }
  .kpi-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .7rem; }
}

@media (max-width: 560px) {
  .content { padding: .8rem; }
  .card { padding: .95rem 1rem; }
  .page-header h1 { font-size: 1.2rem; }
  .topbar .user .uname { display: none; }  /* hide username text, keep role badge + logout */
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  table { font-size: .85rem; }
}

/* ---- products list (dense working table) ---- */
.ptable td { padding: .5rem .7rem; }
.ptable tbody tr { cursor: default; }
.prod-thumb { width: 42px; height: 42px; border-radius: 8px; object-fit: cover;
  border: 1px solid var(--border); background: var(--surface-2); display: block; }
.prod-thumb--empty { display: flex; align-items: center; justify-content: center;
  color: var(--faint); font-size: 1rem; }
.pname { font-weight: 550; color: var(--text); }
.pname:hover { color: var(--brand-600); }
.psku { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .8rem; }
/* on-hand pill */
.oh { display: inline-flex; min-width: 2.1rem; justify-content: center; font-weight: 650;
  font-variant-numeric: tabular-nums; padding: .1rem .45rem; border-radius: 7px; font-size: .82rem; }
.oh--zero { background: var(--danger-bg); color: var(--danger); }
.oh--low  { background: var(--warn-bg); color: var(--warn); }
.oh--ok   { background: var(--ok-bg); color: var(--ok); }
/* platform chips: single line, fixed row height regardless of count */
.chips { display: flex; align-items: center; gap: 4px; flex-wrap: nowrap; }
.chip { display: inline-flex; align-items: center; padding: .1rem .4rem; border-radius: 6px;
  font-size: .68rem; font-weight: 600; line-height: 1.35; white-space: nowrap;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.chip--amz-on  { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.chip--amz-off { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
.chip--more { background: transparent; border-style: dashed; color: var(--faint); }
/* Send-to-Clover: dim rows already in Clover */
.ptable tr.clover-sent td { opacity: .55; }
.ptable tr.clover-sent:hover td { opacity: 1; }

/* ---- stat tiles (product detail, dashboards) ---- */
.stat-strip { display: flex; gap: .8rem; flex-wrap: wrap; margin: 0 0 1.1rem; }
.stat-tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: .65rem .95rem; min-width: 108px; box-shadow: var(--shadow-sm); }
.stat-tile .lbl { color: var(--muted); font-size: .66rem; text-transform: uppercase;
  letter-spacing: .04em; font-weight: 700; }
.stat-tile .val { font-size: 1.4rem; font-weight: 650; line-height: 1.25; margin-top: 3px;
  font-variant-numeric: tabular-nums; }
