/* Books & Boosters — dashboard theme
   Palette: navy #17233F (ink/chrome) · cream #FAF3E4 (paper) · coral #E0623C (accent)
   Type: Poppins (falls back to the system stack offline). */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');

:root {
  --navy:      #17233F;
  --navy-soft: #2A3A5E;
  --cream:     #FAF3E4;
  --cream-dim: #F2E9D6;
  --coral:     #E0623C;
  --coral-dim: #C9502C;

  --paper:  #FFFFFF;
  --ink:    #17233F;
  --muted:  #6E7689;
  --line:   #E6DDC9;
  --line-2: #EFE7D6;

  --good: #2F9E6B;
  --bad:  #C8452A;
  --warn: #B5761F;
  --info: #3A6EA5;

  --radius: 12px;
  --shadow: 0 1px 2px rgba(23,35,63,.06), 0 6px 18px rgba(23,35,63,.06);
  --font: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--cream);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

.settings-group { grid-column: span 2; border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 16px 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  background: #FDFBF5; margin-bottom: 4px; }
.settings-group legend { color: var(--ink); font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; padding: 0 8px; }

.type-chips { display: flex; flex-direction: column; gap: 7px; padding: 0 0 12px; }
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chip-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); font-weight: 600; min-width: 40px; }
.tchip { background: var(--paper); border: 1px solid var(--line); border-radius: 999px;
  padding: 5px 12px; font-size: 12.5px; font-family: var(--font); color: var(--ink);
  cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.tchip span { font-size: 11px; color: var(--muted); }
.tchip:hover { background: var(--cream-dim); }
.tchip.on { background: var(--navy); border-color: var(--navy); color: var(--cream); }
.tchip.on span { color: rgba(250,243,228,.7); }

.scan-bar { background: var(--navy); color: var(--cream); border-radius: 12px; padding: 14px 16px; margin-bottom: 14px; }
.scan-bar-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.scan-bar-head b { font-size: 13.5px; }
.scan-bar-head .muted { color: rgba(250,243,228,.6); }
.scan-modes { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.smode { background: rgba(250,243,228,.12); border: 0; color: rgba(250,243,228,.8); border-radius: 999px;
  padding: 5px 12px; font-size: 12px; font-family: var(--font); font-weight: 500; cursor: pointer; }
.smode.on { background: var(--coral); color: #fff; }
.scan-input { width: 100%; background: rgba(0,0,0,.22); border: 1px solid rgba(250,243,228,.22);
  color: var(--cream); font-size: 14px; padding: 10px 12px; border-radius: 9px; font-family: var(--font); }
.scan-input::placeholder { color: rgba(250,243,228,.4); }
.scan-log { margin-top: 10px; max-height: 220px; overflow: auto; display: flex; flex-direction: column; gap: 5px; }
.scan-line { display: flex; gap: 10px; align-items: baseline; font-size: 12.5px;
  background: rgba(250,243,228,.07); padding: 6px 10px; border-radius: 7px; }
.scan-line .code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; color: rgba(250,243,228,.55); }
.scan-line.ok { border-left: 3px solid #7BE0AE; }
.scan-line.new { border-left: 3px solid #F3C07A; }
.scan-line.err { border-left: 3px solid #FF9A8A; }
.scan-line .grow { flex: 1; }

.scan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.scan-card { position: relative; border: 1px solid var(--line); border-radius: 12px; padding: 10px; background: var(--paper); }
.scan-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.scan-pair figure { margin: 0; }
.scan-pair img { width: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: 7px; background: var(--cream-dim); display: block; }
.scan-pair figcaption { font-size: 9.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); text-align: center; margin-top: 3px; }
.qty-badge { position: absolute; top: 6px; right: 6px; background: var(--coral); color: #fff;
  font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.scan-meta { margin-top: 8px; font-size: 12.5px; }
.scan-actions { display: flex; gap: 5px; margin-top: 8px; }

/* ---------- app shell ---------- */

.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }

.sidebar {
  background: var(--navy); color: var(--cream);
  display: flex; flex-direction: column; gap: 6px;
  padding: 18px 12px; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 16px; }
.brand svg { flex: none; display: block; }
.brand .wordmark { font-size: 16px; font-weight: 600; letter-spacing: -.01em; text-transform: lowercase; white-space: nowrap; }
.brand .wordmark .amp { color: var(--coral); }
.brand .sub { font-size: 9.5px; font-weight: 400; letter-spacing: .1em; text-transform: uppercase; color: rgba(250,243,228,.55); margin-top: 2px; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.navitem {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: none; border: 0; border-radius: 8px; cursor: pointer;
  font-family: var(--font); font-size: 13.5px; font-weight: 500;
  color: rgba(250,243,228,.72); padding: 9px 12px; text-align: left; width: 100%;
  transition: background .12s, color .12s;
}
.navitem:hover { background: rgba(250,243,228,.08); color: var(--cream); }
.navitem.active { background: var(--coral); color: #fff; }
.navitem .count { font-size: 11px; font-weight: 600; opacity: .8; }

.subnav { display: flex; flex-direction: column; gap: 1px; margin: 2px 0 6px 10px;
  padding-left: 10px; border-left: 1px solid rgba(250,243,228,.16); }
.subitem {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: none; border: 0; border-radius: 7px; cursor: pointer; width: 100%;
  font-family: var(--font); font-size: 12.5px; font-weight: 500; text-align: left;
  color: rgba(250,243,228,.58); padding: 6px 10px;
}
.subitem:hover { background: rgba(250,243,228,.07); color: var(--cream); }
.subitem.active { color: var(--cream); background: rgba(250,243,228,.13); }
.subitem .count { font-size: 10.5px; opacity: .75; }

.vendor-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start;
  padding-bottom: 12px; border-bottom: 1px solid var(--line-2); margin-bottom: 12px; }
.vendor-head h3 { margin: 0 0 3px; font-size: 17px; }
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi-row .kpi { padding: 10px 12px; }
.kpi-row .kpi .big { font-size: 17px; }
.chip { font-size: 10.5px; padding: 2px 8px; border-radius: 999px; background: var(--cream-dim); color: var(--muted); }
.chip.warn { background: #FBEAD5; color: #8A5A1B; }
.chip.bad { background: #F3E4DE; color: #9C3F22; }
.chip.good { background: #E2EFE6; color: #276B4B; }
.linkish { background: none; border: 0; padding: 0; color: var(--coral); cursor: pointer;
  font-family: var(--font); font-size: 12.5px; }

.sidebar-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid rgba(250,243,228,.14); }
.status-bar { font-size: 11px; color: rgba(250,243,228,.72); display: flex; flex-direction: column; gap: 5px; }
.status-bar .pill { background: rgba(250,243,228,.09); padding: 4px 9px; border-radius: 7px; }
.status-bar .pill b { color: var(--cream); font-weight: 600; }
.status-bar .live { color: #7BE0AE; font-weight: 600; }
.status-bar .mock { color: #F3C07A; font-weight: 600; }

.main { display: flex; flex-direction: column; min-width: 0; padding: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 18px 26px 14px; border-bottom: 1px solid var(--line);
  background: var(--paper); position: sticky; top: 0; z-index: 6;
}
.topbar h1 { font-size: 20px; margin: 0; font-weight: 600; }
.topsub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }

.viewport { padding: 20px 26px 40px; }
.view { min-width: 0; }

.toolbar {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  padding: 0 0 14px;
}
.toolbar .spacer { flex: 1 1 auto; }
.search { min-width: 260px; flex: 0 1 340px; }

h1 { font-size: 20px; margin: 0; font-weight: 600; }
h2 { font-size: 15px; margin: 0; font-weight: 600; }
th.num, td.num { text-align: right; }

/* row action overflow menu */
.menu-wrap { position: relative; display: inline-block; }
/*
 * Positioned against the window, not the row.
 *
 * It used to be absolute inside the cell, which meant `.panel { overflow:
 * hidden }` sliced it off wherever it reached past the panel edge — on the last
 * row of any list, and immediately on a short one like Sealed, where the panel
 * is only two rows tall. No amount of flipping fixes a clip. Anchored to the
 * viewport instead, nothing can crop it; app.js sets left/top when it opens.
 */
.menu {
  position: fixed; z-index: 60; overflow-y: auto;
  background: var(--paper); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 10px 28px rgba(23,35,63,.18); min-width: 152px; overflow: hidden;
}
.menu button {
  display: block; width: 100%; text-align: left; background: none; border: 0;
  padding: 8px 12px; font-size: 12.5px; font-family: var(--font); color: var(--ink); cursor: pointer;
}
.menu button:hover { background: var(--cream-dim); }
.menu button.danger { color: var(--bad); border-top: 1px solid var(--line-2); }

.subnav { display: flex; flex-direction: column; gap: 1px; margin: 2px 0 6px 10px;
  padding-left: 10px; border-left: 1px solid rgba(250,243,228,.16); }
.subitem {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: none; border: 0; border-radius: 7px; cursor: pointer; width: 100%;
  font-family: var(--font); font-size: 12.5px; font-weight: 500; text-align: left;
  color: rgba(250,243,228,.58); padding: 6px 10px;
}
.subitem:hover { background: rgba(250,243,228,.07); color: var(--cream); }
.subitem.active { color: var(--cream); background: rgba(250,243,228,.13); }
.subitem .count { font-size: 10.5px; opacity: .75; }

.vendor-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start;
  padding-bottom: 12px; border-bottom: 1px solid var(--line-2); margin-bottom: 12px; }
.vendor-head h3 { margin: 0 0 3px; font-size: 17px; }
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi-row .kpi { padding: 10px 12px; }
.kpi-row .kpi .big { font-size: 17px; }
.chip { font-size: 10.5px; padding: 2px 8px; border-radius: 999px; background: var(--cream-dim); color: var(--muted); }
.chip.warn { background: #FBEAD5; color: #8A5A1B; }
.chip.bad { background: #F3E4DE; color: #9C3F22; }
.chip.good { background: #E2EFE6; color: #276B4B; }
.linkish { background: none; border: 0; padding: 0; color: var(--coral); cursor: pointer;
  font-family: var(--font); font-size: 12.5px; }

/* ---------- panels & table ---------- */

.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 18px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line-2); }
th { color: var(--muted); font-weight: 600; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; background: var(--cream-dim); }
tr:hover td { background: #FDFBF5; }

.cat-tag { font-size: 11px; padding: 2px 9px; border-radius: 999px; font-weight: 500; }
.cat-sealed { background: #E3EAF6; color: #2A4A7C; }
.cat-slab   { background: #F3E4DE; color: #9C3F22; }
.cat-single { background: #E2EFE6; color: #276B4B; }
.cat-book    { background: #EDE6F4; color: #5B3F86; }
.cat-general { background: #FBEAD5; color: #8A5A1B; }

.price { font-weight: 700; color: var(--ink); }
.muted { color: var(--muted); font-size: 12px; }

/* ---------- controls ---------- */

.btn {
  background: var(--paper); color: var(--ink); border: 1px solid var(--line);
  border-radius: 9px; padding: 7px 12px; font-size: 13px; font-family: var(--font);
  font-weight: 500; cursor: pointer; transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--cream-dim); border-color: #DCD0B6; }
.btn.primary { background: var(--coral); border-color: var(--coral); color: #fff; }
.btn.primary:hover { background: var(--coral-dim); border-color: var(--coral-dim); }
.btn.small { padding: 4px 9px; font-size: 12px; }
.btn:disabled { opacity: .55; cursor: default; }

select, input, textarea {
  background: var(--paper); color: var(--ink); border: 1px solid var(--line);
  border-radius: 8px; padding: 7px 9px; font-size: 13px; font-family: var(--font);
}
select:focus, input:focus, textarea:focus { outline: 2px solid rgba(224,98,60,.35); outline-offset: 1px; border-color: var(--coral); }

.row-actions { display: flex; gap: 6px; }
.hidden { display: none !important; }
a.btn { text-decoration: none; display: inline-flex; align-items: center; }

/* ---------- modals & drawer ---------- */

.modal, .drawer { position: fixed; inset: 0; background: rgba(23,35,63,.45); display: flex; backdrop-filter: blur(2px); }
.modal { align-items: center; justify-content: center; z-index: 20; }
.modal-box {
  background: var(--paper); border: 1px solid var(--line); border-radius: 16px;
  padding: 22px; width: 640px; max-width: 94vw; max-height: 88vh; overflow-y: auto; overflow-x: hidden;
  box-shadow: 0 18px 50px rgba(23,35,63,.22);
}
.modal-box h3 { margin: 0 0 4px; font-weight: 600; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 16px 0; }
.form-grid label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); font-weight: 500; }
.form-grid label.wide, .form-grid > .wide { grid-column: span 2; }
.form-grid label.checkbox { flex-direction: row; align-items: center; gap: 8px; white-space: nowrap; }

/* Grid items default to min-width:auto, which lets a long input push the whole
   modal sideways. Let them shrink instead. */
.form-grid > label, fieldset > label { min-width: 0; }
.form-grid input, .form-grid select, fieldset input, fieldset select { min-width: 0; width: 100%; }
.form-grid label > span { display: flex; gap: 6px; min-width: 0; }
.form-grid label > span > input { flex: 1 1 auto; min-width: 0; }
.form-grid label > span > .btn { flex: 0 0 auto; white-space: nowrap; }
fieldset { grid-column: span 2; border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; background: #FDFBF5; }
legend { color: var(--muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; padding: 0 6px; font-weight: 600; }
.modal-actions, .drawer-head { display: flex; justify-content: flex-end; gap: 10px; }
.modal-actions { margin-top: 6px; }

.drawer { justify-content: flex-end; z-index: 25; }
.drawer-box { background: var(--paper); border-left: 1px solid var(--line); width: 460px; height: 100%; padding: 20px; overflow: auto; }
.drawer-head { justify-content: space-between; align-items: center; margin-bottom: 14px; }

.comp-source { margin: 14px 0; border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.comp-source h4 { margin: 0 0 8px; font-size: 13px; font-weight: 600; }
.stat-row { display: flex; gap: 16px; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.stat-row b { color: var(--ink); }
.sale { display: flex; justify-content: space-between; font-size: 12px; padding: 4px 0; border-top: 1px dashed var(--line); }

.rec { background: #EFF6F1; border: 1px solid #C6E0D0; border-radius: 12px; padding: 14px; margin-bottom: 14px; }
.rec .big { font-size: 26px; font-weight: 700; color: #226B4B; }

/* Connection status — one block per integration. */
.conn-row { padding: 8px 0; border-top: 1px solid var(--line); }
.conn-row:first-of-type { border-top: 0; }
.conn-row > div + div { margin-top: 2px; }

/* One figure per source, laid out so the comparison reads at a glance. */
.src-compare { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: 10px; margin: 0 0 12px; }
.src-compare > div { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  min-width: 0; }
.src-compare .big-sm { font-size: 19px; font-weight: 700; color: var(--ink); margin: 2px 0; }

/* ---------- reports ---------- */

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 8px 0 14px; }
.kpi { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 15px 16px; box-shadow: var(--shadow); transition: transform .12s ease, box-shadow .12s ease; }
.kpi:hover { transform: translateY(-1px); box-shadow: 0 2px 4px rgba(23,35,63,.06), 0 12px 26px rgba(23,35,63,.10); }
.kpi .big { font-size: 24px; font-weight: 700; color: var(--ink); margin-top: 5px; letter-spacing: -.01em; }
.pl-up { color: var(--good); } .pl-down { color: var(--bad); }
table.rpt { width: 100%; border-collapse: collapse; font-size: 12px; margin: 6px 0; }
table.rpt th, table.rpt td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line-2); }
table.rpt th { color: var(--muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; background: transparent; }
.rpt-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 10px; }
.rpt-cols h4 { margin: 8px 0 2px; font-size: 13px; font-weight: 600; }

/* ---------- catalog autocomplete ---------- */

.suggest { position: relative; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; margin-top: 4px; max-height: 240px; overflow: auto; z-index: 5; box-shadow: var(--shadow); }
.suggest .opt { display: flex; gap: 10px; align-items: center; padding: 7px 8px; cursor: pointer; border-bottom: 1px solid var(--line-2); }
.suggest .opt:hover { background: var(--cream-dim); }
.suggest .opt img { width: 30px; height: 42px; object-fit: contain; border-radius: 3px; background: var(--cream-dim); }
.suggest .opt .meta { font-size: 12px; }
.suggest .opt .meta b { color: var(--ink); }
.suggest .opt .meta span { color: var(--muted); }

.catalog-match { display: flex; gap: 10px; align-items: center; margin-top: 6px; padding: 8px; background: #EFF6F1; border: 1px solid #C6E0D0; border-radius: 10px; font-size: 12px; }
.catalog-match img { width: 36px; height: 50px; object-fit: contain; border-radius: 3px; }
.catalog-thumb { width: 34px; height: 47px; object-fit: contain; border-radius: 3px; background: var(--cream-dim); vertical-align: middle; }

.tabs { display: flex; align-items: center; gap: 6px; border-bottom: 1px solid var(--line-2); margin-bottom: 14px; }
.tab { background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 12px; font-size: 13px;
  font-weight: 500; font-family: var(--font); color: var(--muted); cursor: pointer; }
.tab.active { color: var(--ink); border-bottom-color: var(--coral); }
.tab-right { margin-left: auto; display: flex; gap: 6px; align-items: center; padding-bottom: 6px; }
.tab-right select { padding: 5px 8px; font-size: 12px; }

.stab { background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 12px; font-size: 13px;
  font-weight: 500; font-family: var(--font); color: var(--muted); cursor: pointer; }
.stab.active { color: var(--ink); border-bottom-color: var(--coral); }
.kind-picker { display: flex; gap: 6px; flex-wrap: wrap; }
.kind-picker label { display: inline-flex; align-items: center; gap: 4px; font-size: 12px;
  border: 1px solid var(--line); border-radius: 999px; padding: 3px 9px; cursor: pointer; color: var(--ink); }
.kind-picker label.on { background: var(--coral); border-color: var(--coral); color: #fff; }
.kind-picker input { display: none; }
.pline { display: grid; grid-template-columns: minmax(0,1fr) 110px 62px 92px 104px 26px;
  gap: 6px; align-items: center; margin-bottom: 6px; }
.pline input, .pline select { font-size: 12px; padding: 5px 7px; }
.pline .landed { font-size: 11px; color: var(--muted); text-align: right; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.pline .rm { background: none; border: 0; color: var(--bad); cursor: pointer; font-size: 14px; padding: 0 4px; }
.plines-head { display: grid; grid-template-columns: minmax(0,1fr) 110px 62px 92px 104px 26px; gap: 6px;
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 4px; }
#p_lines { overflow-x: auto; }
.src-card { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; cursor: pointer; }
.src-card:hover { background: var(--cream-dim); }
.src-card .row1 { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.src-card b { font-size: 13px; }
.badge-status { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; padding: 2px 8px; border-radius: 999px; }
.st-draft { background: var(--cream-dim); color: var(--muted); }
.st-ordered { background: #E3EAF6; color: #2A4A7C; }
.st-received { background: #E2EFE6; color: #276B4B; }
.st-cancelled { background: #F3E4DE; color: #9C3F22; }

/* ---------- item media gallery ---------- */

.media-block { grid-column: span 2; border-top: 1px solid var(--line-2); padding-top: 14px; margin-top: 4px; }
.media-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.media-head b { font-size: 13px; }
.media-actions { margin-left: auto; display: flex; gap: 6px; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.media-tile {
  position: relative; border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  background: var(--cream-dim); aspect-ratio: 3 / 4; display: flex; align-items: center; justify-content: center;
}
.media-tile.is-primary { border-color: var(--coral); box-shadow: 0 0 0 2px rgba(224,98,60,.25); }
.media-tile img, .media-tile video { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-tile .badge {
  position: absolute; top: 5px; left: 5px; background: var(--coral); color: #fff;
  font-size: 9.5px; font-weight: 600; padding: 2px 6px; border-radius: 999px; letter-spacing: .03em;
}
.media-tile .vbadge { position: absolute; top: 5px; left: 5px; background: rgba(23,35,63,.85); color: #fff;
  font-size: 9.5px; font-weight: 600; padding: 2px 6px; border-radius: 999px; }
.media-tile .warn { position: absolute; bottom: 26px; left: 5px; right: 5px; background: rgba(181,118,31,.92);
  color: #fff; font-size: 9px; padding: 2px 4px; border-radius: 4px; text-align: center; }
.media-tile .tools {
  position: absolute; bottom: 0; left: 0; right: 0; display: flex; justify-content: center; gap: 2px;
  background: rgba(23,35,63,.82); padding: 3px 2px;
}
.media-tile .tools button {
  background: none; border: 0; color: #fff; cursor: pointer; font-size: 11px; line-height: 1;
  padding: 3px 5px; border-radius: 4px; font-family: var(--font);
}
.media-tile .tools button:hover { background: rgba(255,255,255,.18); }
.media-tile .tools button:disabled { opacity: .35; cursor: default; }
.media-empty { grid-column: 1 / -1; color: var(--muted); font-size: 12px; padding: 14px; text-align: center;
  border: 1px dashed var(--line); border-radius: 10px; }
.thumb-wrap { position: relative; display: inline-block; }
.thumb-wrap .n { position: absolute; bottom: -2px; right: -4px; background: var(--navy); color: var(--cream);
  font-size: 9px; font-weight: 600; padding: 1px 4px; border-radius: 999px; }

/* ---------- scan ---------- */

.scan-stage { background: var(--cream-dim); border: 1px solid var(--line); border-radius: 12px; min-height: 220px; display: flex; align-items: center; justify-content: center; overflow: hidden; margin: 12px 0; }
.scan-stage video, .scan-stage img { max-width: 100%; max-height: 320px; }
.scan-controls { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
#scanResult h4 { margin: 16px 0 6px; font-size: 13px; font-weight: 600; }

@media (max-width: 720px) {
  .form-grid, .rpt-cols { grid-template-columns: 1fr; }
  .form-grid label.wide, fieldset { grid-column: span 1; }
  fieldset { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .modal-box { width: 94vw; }
}

/* ---------- accounts: sign-in gate ---------- */

.gate {
  position: fixed; inset: 0; z-index: 200; display: flex;
  align-items: center; justify-content: center; padding: 20px;
  background: var(--navy);
  background-image: radial-gradient(circle at 20% 15%, rgba(224,98,60,.22), transparent 55%),
                    radial-gradient(circle at 85% 80%, rgba(250,243,228,.10), transparent 50%);
}
.gate.hidden { display: none; }
.gate-card {
  width: 100%; max-width: 380px; background: var(--paper); border-radius: 16px;
  padding: 26px 26px 20px; box-shadow: 0 18px 50px rgba(0,0,0,.30);
}
.gate-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.gate-wordmark { font-weight: 700; font-size: 17px; letter-spacing: -.01em; line-height: 1.1; }
.gate-wordmark .amp { color: var(--coral); }
.gate-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.gate-field { display: block; font-size: 11px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .04em; margin-bottom: 12px; }
.gate-field input {
  display: block; width: 100%; margin-top: 5px; padding: 11px 12px; font-size: 15px;
  font-family: var(--font); color: var(--ink);
  border: 1px solid var(--line); border-radius: 9px; background: #FFFDF8;
}
.gate-field input:focus { outline: none; border-color: var(--coral); box-shadow: 0 0 0 3px rgba(224,98,60,.15); }
.gate-field.hidden { display: none; }
.gate-submit { width: 100%; justify-content: center; padding: 11px; font-size: 14px; margin-top: 4px; }
.gate-msg { font-size: 12.5px; min-height: 17px; margin-bottom: 8px; color: var(--bad); }
.gate-msg.ok { color: var(--good); }
.gate-foot { font-size: 11.5px; color: var(--muted); line-height: 1.5; margin: 16px 0 0;
  padding-top: 14px; border-top: 1px solid var(--line-2); }

/* ---------- accounts: who's signed in ---------- */

.whoami { display: flex; align-items: center; gap: 8px; padding: 8px 4px 10px; margin-bottom: 8px;
  border-bottom: 1px solid rgba(250,243,228,.12); }
.whoami.hidden { display: none; }
.who-avatar {
  width: 28px; height: 28px; flex: 0 0 28px; border-radius: 50%; background: var(--coral);
  color: #fff; font-size: 12px; font-weight: 600; display: flex; align-items: center;
  justify-content: center; text-transform: uppercase;
}
.who-text { min-width: 0; flex: 1; }
.who-name { font-size: 12.5px; font-weight: 600; color: var(--cream);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-role { font-size: 10px; color: rgba(250,243,228,.55); text-transform: uppercase; letter-spacing: .05em; }
.who-out { background: none; border: 0; color: rgba(250,243,228,.6); font-family: var(--font);
  font-size: 10.5px; cursor: pointer; padding: 3px 6px; border-radius: 6px; }
.who-out:hover { background: rgba(250,243,228,.12); color: var(--cream); }

/* Hidden for staff, shown for owners — app.js flips the body class. */
body.role-staff .owner-only { display: none !important; }

.user-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.user-form.hidden { display: none; }
.user-form label { display: block; font-size: 11px; color: var(--muted); min-width: 0; }
.user-form input, .user-form select { display: block; width: 100%; margin-top: 4px; padding: 8px 10px;
  font-family: var(--font); font-size: 13px; border: 1px solid var(--line); border-radius: 8px; background: #FFFDF8; }
.small-select { font-family: var(--font); font-size: 11.5px; padding: 4px 7px;
  border: 1px solid var(--line); border-radius: 7px; background: var(--paper); color: var(--ink); }

.people-row { display: flex; align-items: center; gap: 10px; padding: 9px 0;
  border-bottom: 1px solid var(--line-2); font-size: 12.5px; color: var(--ink); }
.people-row:last-child { border-bottom: 0; }
.people-row .grow { flex: 1; min-width: 0; }
.people-row .sub { font-size: 11px; color: var(--muted); }
.people-row.off { opacity: .5; }

.audit-row { display: grid; grid-template-columns: 130px 90px 1fr; gap: 10px; padding: 6px 0;
  border-bottom: 1px solid var(--line-2); font-size: 12px; align-items: baseline; }
.audit-row .when { color: var(--muted); font-size: 11px; white-space: nowrap; }
.audit-row .who { font-weight: 600; }
.audit-row .what code { font-size: 11px; color: var(--muted); font-family: ui-monospace, Menlo, monospace; }

/* ---------- phone ---------- */

@media (max-width: 900px) {
  /* minmax(0,1fr) rather than 1fr: a grid track sized `auto` refuses to go
     below its content's min-content width, and the nav strip alone is wider
     than a phone. Without this the whole page scrolls sideways. */
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar, .main, .view, .panel, .topbar { min-width: 0; max-width: 100%; }
  .nav, .subnav, .toolbar, .topbar-actions { min-width: 0; max-width: 100%; }
  .search { min-width: 0; flex: 1 1 100%; }
  .sidebar {
    position: sticky; top: 0; z-index: 30; height: auto; flex-direction: column;
    padding: 10px 12px; gap: 0;
  }
  .brand { margin-bottom: 8px; }
  .brand .sub { display: none; }
  /* Nav wraps to as many short rows as it needs; the category strip below it
     gets its own full-width line and swipes sideways. */
  .nav { flex-direction: row; flex-wrap: wrap; gap: 4px; padding-bottom: 2px; }
  .navitem { width: auto; white-space: nowrap; flex: 0 0 auto; padding: 7px 12px; font-size: 12.5px; }
  .navitem .count { display: none; }
  .subnav { flex-direction: row; flex-wrap: nowrap; overflow-x: auto; border-left: 0;
    flex: 0 0 100%; order: 9; -webkit-overflow-scrolling: touch;
    margin: 4px 0 0; padding-left: 0; gap: 4px; scrollbar-width: none; }
  .subnav::-webkit-scrollbar { display: none; }
  .subitem { width: auto; flex: 0 0 auto; white-space: nowrap; padding: 5px 10px; font-size: 12px; }
  .subitem .count { display: none; }
  .sidebar-foot { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
  .sidebar-foot .status-bar { display: none; }
  .whoami { border-bottom: 0; padding: 0; margin: 0; flex: 1; }

  .main { padding: 14px 12px 60px; }
  .topbar { flex-direction: column; align-items: stretch; gap: 10px; }
  .topbar h1 { font-size: 19px; }
  .topbar-actions { flex-wrap: wrap; }
  .topbar-actions .btn { flex: 1 1 auto; justify-content: center; }

  /* Tables reflow into cards — a 12-column grid is unreadable at 390px. */
  table, thead, tbody, tr, th, td { display: block; }
  thead { display: none; }
  tbody tr { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px;
    padding: 10px 12px; background: var(--paper); }
  tbody tr:hover td { background: transparent; }
  tbody td { border: 0; padding: 3px 0; display: flex; justify-content: space-between;
    gap: 12px; align-items: baseline; text-align: right; }
  tbody td::before { content: attr(data-label); color: var(--muted); font-size: 10.5px;
    text-transform: uppercase; letter-spacing: .04em; font-weight: 600; text-align: left; flex: 0 0 auto; }
  tbody td:empty { display: none; }
  tbody td.num { text-align: right; }

  .user-form { grid-template-columns: 1fr; }
  .audit-row { grid-template-columns: 1fr; gap: 1px; padding: 8px 0; }
  .gate-card { padding: 22px 20px 18px; }
}

/* ---------- returns ---------- */

tr.is-return td { background: #FFF7F4; }
tr.is-return td:first-child { box-shadow: inset 3px 0 0 var(--coral); }
.refund-total { margin: 14px 0 4px; padding-top: 12px; border-top: 1px solid var(--line-2);
  font-size: 14px; text-align: right; }
.refund-total b { font-size: 17px; }
.form-grid label.check { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px;
  font-size: 12.5px; color: var(--ink); }
.form-grid label.check input[type="checkbox"] { width: auto; margin: 0; flex: none; }
.form-grid label.check .muted { flex-basis: 100%; margin-left: 24px; font-size: 11.5px; }
.returns-strip { background: #FFF7F4; border: 1px solid #F2D9CF; border-radius: 10px;
  padding: 10px 13px; margin: 10px 0 14px; font-size: 12.5px; }
.returns-strip .muted { font-size: 11.5px; margin-top: 3px; }

/* ---------- shopify live link ---------- */

.link-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px;
  margin-bottom: 10px; font-size: 12.5px; }
.link-grid .muted { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.link-bad { background: #FDF2EE; border: 1px solid #F0D2C7; border-radius: 8px; padding: 8px 10px;
  font-size: 12px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
#linkState code { font-size: 11.5px; background: var(--cream-dim); padding: 1px 5px; border-radius: 4px; }

/* ---------- buy counter ---------- */

.btab, .ctab { background: none; border: 0; border-bottom: 2px solid transparent; cursor: pointer;
  font-family: var(--font); font-size: 13px; font-weight: 500; color: var(--muted);
  padding: 8px 2px; margin-right: 18px; }
.btab.active, .ctab.active { color: var(--ink); border-bottom-color: var(--coral); font-weight: 600; }
.btab .count, .ctab .count { font-size: 10.5px; margin-left: 5px; opacity: .8; }

.buy-head { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start;
  flex-wrap: wrap; padding-bottom: 14px; border-bottom: 1px solid var(--line-2); margin-bottom: 12px; }
.buy-who { flex: 1 1 280px; max-width: 340px; }
.buy-who .search { width: 100%; min-width: 0; }
.buy-who .muted { font-size: 11.5px; margin-top: 4px; }

.buy-table input, .buy-table select { font-family: var(--font); font-size: 13px; padding: 6px 8px;
  border: 1px solid var(--line); border-radius: 7px; background: #FFFDF8; width: 100%; }
.buy-table td { vertical-align: top; }

.buy-foot { display: flex; justify-content: space-between; gap: 18px; align-items: center;
  flex-wrap: wrap; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line-2); }
.buy-offer { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.buy-choice { display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px; font-size: 12.5px;
  background: var(--paper); }
.buy-choice input { margin: 0; }
.buy-choice:has(input:checked) { border-color: var(--coral); background: #FFF6F2; }
.buy-choice b { font-size: 14px; }
#buySplitFields { display: inline-flex; gap: 6px; }
#buySplitFields input { width: 92px; font-family: var(--font); font-size: 13px; padding: 7px 9px;
  border: 1px solid var(--line); border-radius: 8px; background: #FFFDF8; }
#buySplitFields.hidden { display: none; }
.buy-actions { display: flex; gap: 12px; align-items: center; }
#buyMsg { margin-top: 10px; font-size: 12.5px; }
.stabs { background: none; border: 0; border-bottom: 2px solid transparent; cursor: pointer;
  font-family: var(--font); font-size: 13px; font-weight: 500; color: var(--muted);
  padding: 8px 2px; margin-right: 18px; }
.stabs.active { color: var(--ink); border-bottom-color: var(--coral); font-weight: 600; }
.stabs .count { font-size: 10.5px; margin-left: 5px; color: var(--coral); }
.chip-row input { font-family: var(--font); font-size: 13px; padding: 7px 9px;
  border: 1px solid var(--line); border-radius: 8px; background: #FFFDF8; }
.chip-row label { display: inline-flex; align-items: center; }

/* ---------- connect wizard ---------- */

.connect-steps { display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; }
.connect-step { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0;
  border-bottom: 1px solid var(--line-2); font-size: 12.5px; }
.connect-step:last-child { border-bottom: 0; }
.connect-step .cs-mark { font-weight: 700; width: 16px; flex: none; text-align: center; }
.connect-step.ok .cs-mark { color: var(--good); }
.connect-step.bad .cs-mark { color: var(--bad); }
.connect-step .muted { font-size: 11.5px; margin-top: 2px; }
.cs-fix { margin-top: 5px; background: #FDF2EE; border: 1px solid #F0D2C7; border-radius: 7px;
  padding: 7px 9px; font-size: 11.5px; line-height: 1.5; }
.cs-good { background: #E9F4EE; border: 1px solid #C7E2D2; border-radius: 8px;
  padding: 9px 11px; font-size: 12.5px; color: #276B4B; }
.cs-blocked { background: #FDF2EE; border: 1px solid #F0D2C7; border-radius: 8px;
  padding: 9px 11px; font-size: 12.5px; }
.cs-notes { margin: 10px 0 0; padding-left: 18px; font-size: 11.5px; color: var(--muted); }
.cs-notes li { margin-bottom: 3px; }

/* ---------- help ---------- */

.help-btn { font-weight: 600; }
.help-panel { position: fixed; inset: 0; z-index: 150; background: rgba(23,35,63,.45);
  display: flex; justify-content: flex-end; }
.help-panel.hidden { display: none; }
.help-box { width: 460px; max-width: 94vw; background: var(--paper); height: 100%;
  display: flex; flex-direction: column; padding: 20px; box-shadow: -12px 0 40px rgba(23,35,63,.2); }
.help-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.help-head h3 { margin: 0 0 2px; font-size: 17px; }
.help-ask { width: 100%; padding: 11px 13px; font-size: 14px; font-family: var(--font);
  border: 1px solid var(--line); border-radius: 10px; background: #FFFDF8; color: var(--ink); }
.help-ask:focus { outline: none; border-color: var(--coral); box-shadow: 0 0 0 3px rgba(224,98,60,.15); }
.help-results { margin-top: 14px; overflow-y: auto; flex: 1; }
.help-group { margin-bottom: 16px; }
.help-section { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted); margin-bottom: 6px; }
.help-topic { border-bottom: 1px solid var(--line-2); }
.help-q { width: 100%; text-align: left; background: none; border: 0; cursor: pointer;
  font-family: var(--font); font-size: 13px; color: var(--ink); padding: 10px 0;
  display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.help-q:hover { color: var(--coral); }
.help-topic.open .help-q { font-weight: 600; }
.help-chev { color: var(--muted); font-size: 15px; flex: none; }
.help-a { padding: 0 0 14px; font-size: 12.5px; }
.help-a ol { margin: 0 0 10px; padding-left: 20px; }
.help-a li { margin-bottom: 5px; line-height: 1.5; }
.help-note { background: var(--cream-dim); border-radius: 8px; padding: 9px 11px;
  font-size: 11.5px; line-height: 1.55; color: #4A5468; margin-bottom: 10px; }
.help-empty { padding: 20px 0; font-size: 13px; }
.help-empty .muted { margin-top: 6px; font-size: 12px; }

@media (max-width: 900px) {
  .help-box { width: 100%; max-width: 100%; padding: 16px; }
}

/* ---------- today ---------- */

.today-kpis { margin-bottom: 14px; }
.today-kpis .kpi .muted { font-size: 11.5px; }
.today-jobs { margin-bottom: 14px; padding: 0 0 6px; }
.today-jobs .panel-head { padding: 14px 16px 8px; }
.today-jobs h2 { font-size: 14px; }
.today-job { display: flex; justify-content: space-between; align-items: center; gap: 12px;
  width: 100%; background: none; border: 0; border-top: 1px solid var(--line-2); cursor: pointer;
  font-family: var(--font); font-size: 13px; color: var(--ink); text-align: left; padding: 11px 16px; }
.today-job:hover { background: #FFF7F4; color: var(--coral); }
.today-job .tj-go { color: var(--muted); }
.today-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.health-rows { margin-top: 4px; font-size: 11px; }

@media (max-width: 900px) {
  .today-cols { grid-template-columns: 1fr; }
}

/* ---------- import ---------- */

.import-paste { width: 100%; margin: 10px 0 8px; padding: 10px 12px; font-family: ui-monospace, Menlo, monospace;
  font-size: 12px; border: 1px solid var(--line); border-radius: 9px; background: #FFFDF8; color: var(--ink); }
.import-map td { vertical-align: middle; font-size: 12.5px; }
.import-map .small-select { min-width: 170px; }

/* ---------- your price ----------
   The field, the numbers to judge it against, and the warning. Grouped so it
   reads as one decision rather than four unrelated inputs. */

.price-block { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
  background: #FFFDF8; display: grid; gap: 8px; }
.price-block > label { margin: 0; }
.price-context { display: flex; flex-wrap: wrap; gap: 8px; }
.price-chip { display: flex; flex-direction: column; align-items: flex-start; gap: 1px;
  border: 1px solid var(--line); border-radius: 9px; padding: 6px 10px; background: #fff;
  font: inherit; cursor: pointer; text-align: left; min-width: 96px; }
.price-chip:hover { border-color: var(--coral); }
.price-chip.empty { cursor: default; opacity: .6; }
.price-chip.empty:hover { border-color: var(--line); }
.price-chip .muted { font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; }
.price-chip b { font-size: 15px; color: var(--ink); }

.price-set { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; }
.price-set input { width: 120px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 8px;
  font: inherit; background: #fff; color: var(--ink); }

/* ---------- opening boxes, and grading ---------- */

.break-grid { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.break-grid th { text-align: left; padding: 6px 8px; color: var(--muted); font-size: 10.5px;
  text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--line); }
.break-grid td { padding: 5px 8px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.break-grid input, .break-grid select { width: 100%; padding: 5px 7px; border: 1px solid var(--line);
  border-radius: 7px; font: inherit; font-size: 12.5px; background: #fff; color: var(--ink); }
.break-grid input.num { text-align: right; }
.break-grid td.shrink { width: 1%; white-space: nowrap; }
.break-grid .drop { border: none; background: none; cursor: pointer; color: var(--muted);
  font-size: 15px; line-height: 1; padding: 2px 6px; }
.break-grid .drop:hover { color: var(--bad); }
.break-bar { display: flex; flex-wrap: wrap; gap: 14px; align-items: baseline;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--cream);
  margin: 10px 0; }
.break-bar .figure { font-size: 17px; font-weight: 700; color: var(--ink); }
.share-bar { height: 6px; border-radius: 3px; background: var(--coral); opacity: .7; min-width: 2px; }
.sub-state { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em;
  padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.sub-state.sent { color: #B5761F; border-color: #E8D2A8; }
.sub-state.returned { color: var(--good); border-color: #BEE3D0; }
.sub-state.cancelled { text-decoration: line-through; }

/* ---------- worth grading ---------- */

.worth-row { border-bottom: 1px solid var(--line-2); }
.worth-row:last-child { border-bottom: none; }
.worth-row > summary { display: grid; grid-template-columns: 1fr auto auto; gap: 14px;
  align-items: center; padding: 9px 10px; cursor: pointer; list-style: none; }
.worth-row > summary::-webkit-details-marker { display: none; }
.worth-row > summary:hover { background: var(--cream); }
.worth-row[open] > summary { background: var(--cream); }

/* ---------- bulk selection ---------- */

.bulk-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 9px 12px; margin-bottom: 10px; border: 1px solid var(--coral);
  border-radius: 10px; background: #FFF6EE; font-size: 13px;
  position: sticky; top: 8px; z-index: 20; }
.bulk-bar .spacer { flex: 1 1 auto; }
th.pick-col, td.pick-col { width: 1%; padding-right: 0; }
td.pick-col input, th.pick-col input { cursor: pointer; }

/* On a phone each row becomes a stacked card, where a lone checkbox with no
   label reads as a stray tick rather than a control. */
@media (max-width: 720px) {
  td.pick-col::before { content: 'Select'; color: var(--muted); font-size: 11px; margin-right: 6px; }
  td.pick-col { display: flex; align-items: center; }
}

/* ---------- polish pass: thumbnails, source label, warning banner ---------- */

/* Branded placeholder for cards with no art (and for images that fail to load),
   so every inventory row lines up instead of one row starting flush-left. */
.catalog-thumb.ph {
  display: inline-block;
  background-color: var(--cream-dim);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'%3E%3Ccircle cx='116' cy='118' r='52' fill='none' stroke='%2317233F' stroke-width='25' opacity='0.28'/%3E%3Cpath d='M64 34 V170' fill='none' stroke='%2317233F' stroke-width='25' stroke-linecap='round' opacity='0.28'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 66%;
}

/* The "synced but never sent" notices are warnings — make them read as one. */
.warn-banner {
  position: relative;
  background: #FBF3DF;
  border: 1px solid #EBD9A6;
  border-left: 4px solid var(--warn);
  border-radius: 10px;
  padding: 13px 15px 13px 42px;
}
.warn-banner::before {
  content: "\26A0";           /* ⚠ */
  position: absolute;
  left: 15px;
  top: 12px;
  color: var(--warn);
  font-size: 15px;
  line-height: 1.2;
}

/* Item column: thumb + text side by side, so names wrap as a block instead of
   splitting a two-word name across three lines beside the thumbnail. */
.item-cell { display: inline-flex; align-items: center; gap: 9px; }
.item-txt { display: inline-flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.item-txt .muted { font-size: 11.5px; margin-top: 1px; }
#table td:has(.item-cell) { min-width: 200px; }

/* ---------- barcode label printing ---------- */
#labelPrint { position: fixed; inset: 0; z-index: 9999; background: #fff; overflow: auto; color: #111; }
.lp-bar { position: sticky; top: 0; display: flex; align-items: center; gap: 16px; padding: 12px 18px;
  background: var(--cream-dim); border-bottom: 1px solid var(--line); font-size: 13px; }
.lp-bar label { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.lp-bar .spacer { flex: 1; }
.label-sheet { padding: 18px; }
.label-sheet.sheet { display: grid; grid-template-columns: repeat(3, 2.625in); grid-auto-rows: 1in;
  column-gap: 0.125in; row-gap: 0; justify-content: center; }
.label-sheet.roll { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.label-sheet.roll .plabel { width: 2.25in; height: 1.25in; }
.plabel { box-sizing: border-box; width: 2.625in; height: 1in; padding: 0.06in 0.1in;
  display: flex; flex-direction: column; justify-content: space-between; overflow: hidden;
  border: 1px dashed #d7d2c4; font-family: var(--font); color: #000; }
.pl-top { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.pl-name { font-weight: 600; font-size: 9pt; line-height: 1.05; max-height: 2.2em; overflow: hidden; }
.pl-price { font-weight: 700; font-size: 10pt; white-space: nowrap; }
.pl-meta { font-size: 6.5pt; color: #333; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-bc { text-align: center; margin-top: 1px; }
.pl-bc svg { height: 0.44in; width: auto; max-width: 100%; }
.pl-nobc { font-size: 7pt; color: #999; }

@media print {
  body > *:not(#labelPrint) { display: none !important; }
  #labelPrint { position: static; }
  .lp-bar { display: none !important; }
  .label-sheet { padding: 0 !important; }
  .plabel { border: 0 !important; }
  .label-sheet.roll .plabel { page-break-after: always; }
}

/* SKU shown under the item name in the table, and on the printed label. */
.item-sku { font-size: 10.5px; color: var(--muted); font-family: ui-monospace, Menlo, monospace; letter-spacing: .2px; margin-top: 1px; }
.pl-sku { font-size: 6.5pt; color: #555; font-family: ui-monospace, Menlo, monospace; letter-spacing: .3px; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-bc svg { height: 0.34in; }

/* Copy numbering on labels (e.g. "2 of 3"), and the SKU line laid out for it. */
.pl-sku { display: flex; justify-content: space-between; gap: 6px; }
.pl-sku > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-seq { color: #888; white-space: nowrap; }

/* ---------- Today: quick actions + stock snapshot ---------- */
.quick-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.qbtn { display: inline-flex; align-items: center; gap: 8px; background: var(--paper); border: 1px solid var(--line);
  border-radius: 12px; padding: 11px 16px; font-family: var(--font); font-size: 13.5px; font-weight: 600; color: var(--ink);
  cursor: pointer; box-shadow: var(--shadow); transition: transform .12s ease, border-color .12s ease; }
.qbtn:hover { transform: translateY(-1px); border-color: var(--coral); }
.qbtn .qic { font-size: 15px; color: var(--coral); line-height: 1; }
.stock-snap { padding: 16px 18px; margin-bottom: 14px; }
.snap-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.snap-big { font-size: 26px; font-weight: 700; color: var(--ink); letter-spacing: -.01em; margin-top: 2px; }
.snap-sub { font-size: 12.5px; }
.snap-cats { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.snap-cat { background: var(--cream-dim); border-radius: 999px; padding: 5px 12px; font-size: 12.5px; color: var(--muted); }
.snap-cat b { color: var(--ink); font-weight: 700; }
.snap-cat.snap-warn { background: #FBF3DF; color: var(--warn); }
