/* ===========================================================================
   SimpliInventory — dashboard redesign: sidebar + top-bar app shell.
   Apple-gallery tokens (single Action Blue, Inter/SF Pro tight tracking,
   parchment/white surfaces, pill CTAs, hairlines, quiet status tints) extended
   with the new shell, cards, charts, and a teal sidebar.

   This file is being migrated screen-by-screen. The "LEGACY (transitional)"
   block at the very bottom re-asserts the classes that not-yet-ported templates
   still use; it shrinks as each screen moves to the new component classes.
   =========================================================================== */
@font-face {
  font-family: "Inter";
  src: url("/static/vendor/Inter.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap;
}

:root {
  --blue: #0066cc;
  --blue-focus: color-mix(in srgb, var(--blue) 88%, white);
  --blue-soft: color-mix(in srgb, var(--blue) 8%, white);
  --blue-line: color-mix(in srgb, var(--blue) 26%, white);
  --blue-ink: color-mix(in srgb, var(--blue) 70%, black);
  --blue-2: color-mix(in srgb, var(--blue) 52%, white);
  --ink: #1d1d1f;
  --ink-80: #333333;
  --ink-60: #5b5b5f;
  --ink-48: #7a7a7a;
  --canvas: #ffffff;
  --parchment: #f5f5f7;
  --pearl: #fafafc;
  --tile-dark: #272729;
  --black: #000000;
  --hairline: #e0e0e0;
  --hairline-soft: #ececee;
  --divider: #f0f0f0;
  --red-bg: #fdecea;   --red-ink: #b3261e;   --red-line: #f3c4bf;
  --amber-bg: #fdf3da; --amber-ink: #8a6d1f; --amber-line: #ecd9a6;
  --green-bg: #e7f4ec; --green-ink: #1d7a46; --green-line: #bfe2cd;
  --zero-bg: #f0f0f2;  --zero-ink: #86868b;
  --r-sm: 8px; --r-md: 11px; --r-lg: 18px; --r-xl: 22px; --r-pill: 9999px;
  --font: -apple-system, BlinkMacSystemFont, "Inter", system-ui, "Segoe UI", Roboto, sans-serif;
  --sidebar-w: 248px;
  --density: 1;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  font-size: 17px; line-height: 1.47; letter-spacing: -0.014em;
  color: var(--ink); background: var(--parchment); margin: 0;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
a { color: var(--blue); text-decoration: none; }
a:active { opacity: 0.7; }
::selection { background: var(--blue-line); }

/* ---------- App shell ----------------------------------------------------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
  background: var(--canvas); border-right: 1px solid var(--hairline);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
  padding: 22px 14px;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 10px 22px; }
.brand .mark {
  width: 30px; height: 30px; border-radius: 8px; background: var(--blue);
  display: grid; place-items: center; color: #fff; flex: none; overflow: hidden;
}
.brand .mark img { width: 100%; height: 100%; object-fit: cover; display: block; }
.brand .name { font-size: 18px; font-weight: 600; letter-spacing: -0.02em; }
.brand .name b { font-weight: 600; }
.brand .name span { color: var(--ink-48); font-weight: 400; }

.navgroup { margin-top: 6px; }
.navgroup .gh {
  font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-48); padding: 16px 12px 7px;
}
.navitem {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 9px 12px; border-radius: var(--r-md); cursor: pointer;
  color: var(--ink-80); font-size: 15px; font-weight: 500; letter-spacing: -0.01em;
  border: none; background: transparent; text-align: left; position: relative;
}
.navitem svg { width: 19px; height: 19px; flex: none; color: var(--ink-48); }
.navitem:hover { background: var(--parchment); }
.navitem.active { background: var(--blue-soft); color: var(--blue); font-weight: 600; }
.navitem.active svg { color: var(--blue); }
.navitem .pillcount {
  margin-left: auto; font-size: 12px; font-weight: 700; color: var(--red-ink);
  background: var(--red-bg); border: 1px solid var(--red-line);
  border-radius: var(--r-pill); padding: 1px 8px; letter-spacing: 0;
}
.sidebar .spacer { flex: 1; }
.userchip {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; margin-top: 8px;
  border-top: 1px solid var(--divider);
}
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--blue);
  color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 600; flex: none;
}
.userchip .meta { line-height: 1.2; }
.userchip .meta .nm { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.userchip .meta .rl { font-size: 12px; color: var(--ink-48); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 18px;
  padding: 14px 34px; background: rgba(245,245,247,0.82);
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--hairline);
}
.topbar .crumb { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; }
.topbar .crumb .muted { color: var(--ink-48); font-weight: 400; }
.search {
  margin: 0 0 0 auto; display: flex; align-items: center; gap: 10px;
  background: var(--canvas); border: 1px solid var(--hairline);
  border-radius: var(--r-pill); padding: 0 18px; height: 42px; width: 340px; max-width: 40vw;
}
.search svg { width: 17px; height: 17px; color: var(--ink-48); flex: none; }
.search input { border: none; outline: none; background: transparent; font-size: 15px;
  width: 100%; color: var(--ink); letter-spacing: -0.01em; padding: 0; }
.search input::placeholder { color: var(--ink-48); }
.iconbtn {
  width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--hairline);
  background: var(--canvas); display: grid; place-items: center; cursor: pointer; position: relative;
  color: var(--ink-80); flex: none;
}
.iconbtn svg { width: 19px; height: 19px; }
.iconbtn:active { transform: scale(0.95); }
.iconbtn .dot { position: absolute; top: 9px; right: 10px; width: 7px; height: 7px;
  border-radius: 50%; background: var(--red-ink); border: 1.5px solid var(--canvas); }
.menubtn { display: none; }
.page { padding: 30px 34px 56px; max-width: 1480px; width: 100%; margin: 0 auto; }

/* ---------- Page head ----------------------------------------------------- */
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 26px; flex-wrap: wrap; }
.pagehead h1 { font-size: 34px; font-weight: 600; line-height: 1.08; letter-spacing: -0.025em; margin: 0; }
.pagehead .sub { color: var(--ink-48); font-size: 16px; margin-top: 7px; letter-spacing: -0.01em; }
.headactions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ---------- Buttons (new system; self-contained) -------------------------- */
.btn-primary, .btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: var(--r-pill); padding: 10px 20px;
  font-size: 15px; font-weight: 600; letter-spacing: -0.01em; cursor: pointer;
  font-family: var(--font); white-space: nowrap;
}
.btn-primary svg, .btn-ghost svg { width: 16px; height: 16px; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-ghost { background: var(--canvas); color: var(--ink); border-color: var(--hairline); }
.btn-primary:active, .btn-ghost:active { transform: scale(0.97); }
.btn-block { width: 100%; padding: 14px 22px; font-size: 16px; }
.btn-primary:focus-visible, .btn-ghost:focus-visible { outline: 2px solid var(--blue-focus); outline-offset: 2px; }

.minibtn { background: var(--canvas); color: var(--blue); border: 1px solid var(--hairline);
  border-radius: var(--r-pill); padding: 6px 13px; font-weight: 600; font-size: 13px;
  letter-spacing: -0.01em; cursor: pointer; font-family: var(--font); }
.minibtn:active { transform: scale(0.96); }
.minibtn.danger { color: var(--red-ink); }

/* ---------- Cards --------------------------------------------------------- */
.card { background: var(--canvas); border: 1px solid var(--hairline);
  border-radius: var(--r-lg); padding: calc(24px * var(--density)); }
.card.tight { padding: 20px; }
.cardhead { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.cardhead .t { font-size: 18px; font-weight: 600; letter-spacing: -0.015em; }
.cardhead .s { font-size: 13px; color: var(--ink-48); margin-top: 3px; letter-spacing: -0.01em; }
.cardhead .r { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.linkmore { color: var(--blue); font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap; }

/* ---------- KPI cards ----------------------------------------------------- */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 18px; }
.kpi { background: var(--canvas); border: 1px solid var(--hairline); border-radius: var(--r-lg);
  padding: 22px; display: flex; flex-direction: column; gap: 4px; }
.kpi .top { display: flex; align-items: center; justify-content: space-between; }
.kpi .l { font-size: 14px; color: var(--ink-60); letter-spacing: -0.01em; font-weight: 500; }
.kpi .ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; }
.kpi .ico svg { width: 16px; height: 16px; }
.kpi .ico.b { background: var(--blue-soft); color: var(--blue); }
.kpi .ico.g { background: var(--green-bg); color: var(--green-ink); }
.kpi .ico.a { background: var(--amber-bg); color: var(--amber-ink); }
.kpi .ico.r { background: var(--red-bg); color: var(--red-ink); }
.kpi .n { font-size: 36px; font-weight: 600; line-height: 1.05; letter-spacing: -0.025em; margin-top: 8px; }
.kpi .foot { font-size: 13px; color: var(--ink-48); letter-spacing: -0.01em; }
.kpi .foot.red { color: var(--red-ink); }
.kpi .foot.green { color: var(--green-ink); }

/* ---------- Layout grids -------------------------------------------------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-bottom: 18px; }
.grid-12 { display: grid; grid-template-columns: 1.35fr 1fr; gap: 18px; margin-bottom: 18px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 18px; }

/* ---------- Segmented control --------------------------------------------- */
.seg { display: inline-flex; background: var(--parchment); border: 1px solid var(--hairline);
  border-radius: var(--r-pill); padding: 3px; gap: 2px; }
.seg a, .seg button { border: none; background: transparent; font-family: var(--font); cursor: pointer;
  font-size: 13px; font-weight: 600; letter-spacing: -0.01em; color: var(--ink-60);
  padding: 6px 14px; border-radius: var(--r-pill); }
.seg a.on, .seg button.on { background: var(--canvas); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,0.06); }

.legend { display: flex; align-items: center; gap: 16px; }
.legend span { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-60); letter-spacing: -0.01em; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* ---------- Tables (new) -------------------------------------------------- */
.tablewrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14.5px; border: none; background: transparent; }
table.tbl th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--ink-48); font-weight: 600; padding: 8px 12px; border-bottom: 1px solid var(--hairline); background: transparent; }
table.tbl td { padding: 12px 12px; border-bottom: 1px solid var(--divider); letter-spacing: -0.01em; }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tbody tr.clickable { cursor: pointer; }
table.tbl tbody tr.clickable:hover { background: var(--pearl); }
.mono { font-variant-numeric: tabular-nums; color: var(--ink-60); }
.strong { font-weight: 600; color: var(--ink); }
.muted { color: var(--ink-48); }

/* ---------- Status tags (new) --------------------------------------------- */
.tag.in,  .tag.ok       { background: var(--green-bg); color: var(--green-ink); border-color: var(--green-line); }
.tag.out, .tag.red      { background: var(--red-bg);   color: var(--red-ink);   border-color: var(--red-line); }
.tag.adjust, .tag.amber { background: var(--amber-bg); color: var(--amber-ink); border-color: var(--amber-line); }
.tag.return             { background: var(--blue-soft); color: var(--blue-ink); border-color: var(--blue-line); }
.tag.opening            { background: #eceef2; color: #555; }
.tag.neutral            { background: var(--parchment); color: var(--ink-60); border-color: var(--hairline); }
.dotflag { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.dotflag.red { background: var(--red-ink); } .dotflag.amber { background: var(--amber-ink); }
.dotflag.green { background: var(--green-ink); } .dotflag.blue { background: var(--blue); }

/* ---------- Alerts list --------------------------------------------------- */
.alertlist { display: flex; flex-direction: column; }
.alertrow { display: flex; gap: 13px; padding: 14px 2px; border-bottom: 1px solid var(--divider); }
.alertrow:last-child { border-bottom: none; }
.alertrow .ad { margin-top: 6px; }
.alertrow .txt { font-size: 14.5px; line-height: 1.4; letter-spacing: -0.01em; }
.alertrow .txt .when { color: var(--ink-48); font-size: 12.5px; margin-top: 3px; }

/* ---------- Power grid (new) ---------------------------------------------- */
.gridscroll { overflow-x: auto; border: 1px solid var(--hairline); border-radius: var(--r-md); }
table.pgrid { border-collapse: collapse; font-size: 12.5px; width: 100%; border: none; }
table.pgrid th, table.pgrid td { padding: 7px 8px; text-align: center; white-space: nowrap;
  border-bottom: 1px solid var(--divider); border-right: 1px solid var(--divider); }
table.pgrid thead th { background: var(--canvas); color: var(--ink-48); font-weight: 600; font-size: 11px; position: sticky; top: 0; }
table.pgrid .rowhdr { text-align: left; position: sticky; left: 0; background: var(--canvas); font-weight: 600; color: var(--ink); z-index: 1; }
table.pgrid thead th.rowhdr { z-index: 2; }
.grouphdr td { background: var(--parchment) !important; font-weight: 600; text-align: left !important;
  color: var(--ink-60); font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; position: sticky; left: 0; }
.cell { font-weight: 600; }
.cell-OK { background: var(--green-bg); color: var(--green-ink); }
.cell-AMBER { background: var(--amber-bg); color: var(--amber-ink); }
.cell-RED { background: var(--red-bg); color: var(--red-ink); }
.cell-ZERO { background: var(--zero-bg); color: var(--zero-ink); }
.cell-none { background: var(--canvas); color: var(--hairline); }

/* ---------- Forms (new) --------------------------------------------------- */
.formgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.formgrid .field, .formgrid > .field { margin-bottom: 0; }
.field.full { grid-column: 1 / -1; }
label.lab { display: block; font-weight: 600; font-size: 13px; letter-spacing: -0.01em; margin-bottom: 7px; color: var(--ink-80); }
.inp, select.inp, textarea.inp {
  width: 100%; font-family: var(--font); font-size: 16px; padding: 11px 14px;
  border: 1px solid var(--hairline); border-radius: var(--r-md); background: var(--canvas);
  color: var(--ink); letter-spacing: -0.01em;
}
.inp:focus { outline: 2px solid var(--blue-focus); outline-offset: 1px; border-color: var(--blue-focus); }
.hint { font-size: 12.5px; color: var(--ink-48); margin-top: 6px; letter-spacing: -0.01em; }

.scanpanel { background: var(--blue-soft); border: 1px solid var(--blue-line); border-radius: var(--r-lg);
  padding: 18px; margin-bottom: 18px; }
.scanrow { display: flex; gap: 10px; }
.scanrow .inp { flex: 1; border-radius: var(--r-pill); padding: 11px 18px; background: var(--canvas); }
.scanlabel { font-size: 13px; font-weight: 600; color: var(--blue-ink); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.scanlabel svg { width: 16px; height: 16px; flex: none; }
.scanmsg { margin-top: 11px; font-size: 14px; font-weight: 600; min-height: 1.1em; }
.scanmsg.ok { color: var(--green-ink); } .scanmsg.warn { color: var(--amber-ink); } .scanmsg.err { color: var(--red-ink); }

.fefo { border: 1px solid var(--hairline); border-radius: var(--r-md); overflow: hidden; }
.fefo .fr { display: flex; align-items: center; justify-content: space-between; padding: 11px 14px;
  border-bottom: 1px solid var(--divider); font-size: 14px; }
.fefo .fr:last-child { border-bottom: none; }
.fefo .fr.head { background: var(--parchment); font-weight: 600; font-size: 12px; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--ink-48); }

.kv { display: flex; justify-content: space-between; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--divider); font-size: 14.5px; }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--ink-60); letter-spacing: -0.01em; }
.kv .v { font-weight: 600; letter-spacing: -0.01em; text-align: right; }

.banner { padding: 13px 16px; border-radius: var(--r-md); margin-bottom: 18px; font-size: 14.5px;
  border: 1px solid transparent; display: flex; gap: 10px; align-items: flex-start; }
.banner.info { background: var(--blue-soft); color: var(--blue-ink); border-color: var(--blue-line); }
.banner.ok { background: var(--green-bg); color: var(--green-ink); border-color: var(--green-line); }
.banner.err { background: var(--red-bg); color: var(--red-ink); border-color: var(--red-line); }

.toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 13px 22px; border-radius: var(--r-pill); font-size: 15px;
  font-weight: 500; letter-spacing: -0.01em; opacity: 0; pointer-events: none; transition: all .28s cubic-bezier(.4,0,.2,1); z-index: 100;
  display: flex; align-items: center; gap: 10px; box-shadow: 0 8px 30px rgba(0,0,0,0.22); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast svg { width: 18px; height: 18px; color: #4ad07d; }

/* ---------- Charts -------------------------------------------------------- */
.chart { width: 100%; display: block; }
.chart .grid-line { stroke: var(--divider); stroke-width: 1; }
.chart .axis-label { fill: var(--ink-48); font-size: 11px; font-family: var(--font); }
.chart .area { fill: var(--blue); fill-opacity: 0.10; }
.chart .line { fill: none; stroke: var(--blue); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .line.dim { stroke: var(--ink-48); stroke-dasharray: 4 4; stroke-width: 2; }
.chart .pt { fill: var(--blue); }
.chart .val-label { fill: var(--ink-60); font-size: 10.5px; font-family: var(--font); font-weight: 600; }
.bar-prim { fill: var(--blue); } .bar-sec { fill: var(--blue-2); }
.hbar-track { fill: var(--parchment); } .hbar-fill { fill: var(--blue); }
.hbar-label { fill: var(--ink); font-size: 12.5px; font-family: var(--font); letter-spacing: -0.01em; }
.hbar-val { fill: var(--ink-60); font-size: 12px; font-family: var(--font); font-weight: 600; }

/* ---------- Responsive ---------------------------------------------------- */
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-12, .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 920px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .25s ease; z-index: 90; width: 260px; box-shadow: 0 0 40px rgba(0,0,0,0.2); }
  .sidebar.open { transform: translateX(0); }
  .menubtn { display: grid !important; }
}
@media (max-width: 560px) {
  .formgrid { grid-template-columns: 1fr; }
  .page, .topbar { padding-left: 18px; padding-right: 18px; }
  .pagehead h1 { font-size: 27px; }
}

/* ---------- Sidebar themes ------------------------------------------------ */
body.sb-dark-text .brand .name { color: #f5f5f7; }
body.sb-dark-text .brand .name span { color: #93a0b5; }
body.sb-dark-text .navgroup .gh { color: #8a97ad; }
body.sb-dark-text .navitem { color: #cdd5e6; }
body.sb-dark-text .navitem svg { color: #8a97ad; }
body.sb-dark-text .navitem.active { background: color-mix(in srgb, var(--blue) 30%, transparent); color: #fff; }
body.sb-dark-text .navitem.active svg { color: #fff; }
body.sb-dark-text .userchip .meta .nm { color: #f5f5f7; }
body.sb-dark-text .userchip .meta .rl { color: #8a97ad; }
body.sb-teal .sidebar { background: #062a2b; border-right-color: #0e3c3d; }
body.sb-teal .navitem:hover { background: #0c3637; }
body.sb-teal .navitem.active { background: color-mix(in srgb, var(--blue) 26%, #062a2b); }
body.sb-teal .userchip { border-top-color: #0e3c3d; }

/* ===========================================================================
   LEGACY (transitional) — classes still used by not-yet-ported templates.
   Removed screen-by-screen as each template migrates to the new components.
   =========================================================================== */
h1 { font-size: 34px; font-weight: 600; line-height: 1.1; letter-spacing: -0.02em; margin: 8px 0 24px; }
h2 { font-size: 21px; font-weight: 600; letter-spacing: -0.012em; margin: 36px 0 14px; }

label { display: block; font-weight: 600; font-size: 14px; letter-spacing: -0.01em; margin-bottom: 8px; color: var(--ink); }
label.inline { display: inline; font-weight: 400; margin-left: 6px; font-size: 15px; }
input, select, textarea {
  width: 100%; font-family: var(--font); font-size: 17px; padding: 12px 14px;
  border: 1px solid var(--hairline); border-radius: var(--r-md);
  background: var(--canvas); color: var(--ink); letter-spacing: -0.01em;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue-focus); outline-offset: 1px; border-color: var(--blue-focus); }
.search input { width: 100%; border: none; padding: 0; }   /* keep top-bar search clean */
form .field { margin-bottom: 20px; }
.formgrid .field { margin-bottom: 0; }

table:not(.tbl):not(.pgrid) { width: 100%; border-collapse: collapse; font-size: 15px; background: var(--canvas);
  border: 1px solid var(--hairline); border-radius: var(--r-lg); }
table:not(.tbl):not(.pgrid) th, table:not(.tbl):not(.pgrid) td { padding: 12px 14px; text-align: left;
  border: none; border-bottom: 1px solid var(--divider); letter-spacing: -0.01em; }
table:not(.tbl):not(.pgrid) th { background: var(--canvas); color: var(--ink-48); font-weight: 600; font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.03em; position: sticky; top: 0; }
table:not(.tbl):not(.pgrid) tbody tr:last-child td { border-bottom: none; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

.btn { display: block; width: 100%; border: none; border-radius: var(--r-pill);
  padding: 14px 22px; font-size: 17px; font-weight: 600; letter-spacing: -0.01em;
  color: #fff; background: var(--blue); margin-top: 12px; cursor: pointer; }
.btn:active { transform: scale(0.97); }
.btn.in, .btn.out, .btn.adj, .btn.ret { background: var(--blue); }

.narrow { max-width: 620px; margin: 0 auto; }
.subhead { color: var(--ink-48); font-size: 19px; font-weight: 400; letter-spacing: -0.01em; margin: -14px 0 28px; }
.panel { background: var(--canvas); border: 1px solid var(--hairline); border-radius: var(--r-lg); padding: 28px; }
.panel .btn { margin-top: 8px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.linkrow { margin-top: 24px; text-align: center; }
.linkrow a { color: var(--blue); font-weight: 400; }

.tag { display: inline-block; padding: 2px 10px; border-radius: var(--r-pill); font-size: 12px; font-weight: 600; letter-spacing: -0.01em; }
.t-IN { background: var(--green-bg); color: var(--green-ink); }
.t-OUT { background: var(--red-bg); color: var(--red-ink); }
.t-OPENING { background: #eceef2; color: #555; }
.t-ADJUST { background: var(--amber-bg); color: var(--amber-ink); }
.t-RETURN { background: #e9eefb; color: #3b5bbf; }
.f-RED { background: var(--red-bg); } .f-AMBER { background: var(--amber-bg); } .f-ZERO { background: var(--zero-bg); }
.f-EXPIRED { background: var(--red-bg); } .f-EXPIRING { background: var(--amber-bg); }

.allclear { background: var(--green-bg); color: var(--green-ink); border: 1px solid var(--green-line);
  padding: 14px 16px; border-radius: var(--r-md); font-size: 15px; }
.gridtoggle { font-size: 14px; margin: 8px 0; color: var(--ink-48); }
.gridtoggle a { color: var(--blue); } .gridtoggle strong { color: var(--ink); }
.legend.pills span, p.legend span { display: inline-block; padding: 4px 12px; border-radius: var(--r-pill);
  margin: 2px 8px 2px 0; font-size: 12px; font-weight: 600; border: 1px solid var(--hairline); }

.scrollx { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--hairline); border-radius: var(--r-lg); background: var(--canvas); }
.scrollx > table { border: none; border-radius: 0; }
table.grid { font-size: 13px; border: none; border-radius: 0; width: 100%; }
table.grid td, table.grid th { padding: 8px 10px; text-align: center; white-space: nowrap;
  border-bottom: 1px solid var(--divider); border-right: 1px solid var(--divider); text-transform: none; letter-spacing: -0.01em; }
table.grid thead th { background: var(--canvas); color: var(--ink-48); font-size: 12px; }
table.grid .rowhdr { text-align: left; position: sticky; left: 0; background: var(--canvas); font-weight: 600; color: var(--ink); }
table.grid thead th.rowhdr { color: var(--ink-48); }
.grouprow td { background: var(--parchment) !important; font-weight: 600; text-align: left; color: var(--ink); }

.result-details { background: var(--canvas); border: 1px solid var(--hairline); border-radius: var(--r-lg); padding: 20px; font-size: 16px; }
.result-details li { margin: 8px 0; }
.lvl-input { width: 74px; padding: 8px 10px; display: inline-block; border-radius: var(--r-sm); }
.defaultbox { background: var(--parchment); border: 1px solid var(--hairline); border-radius: var(--r-lg); padding: 20px; margin-bottom: 20px; line-height: 2.2; }
.defaultbox .minibtn { margin-left: 8px; }
details summary { cursor: pointer; font-weight: 600; color: var(--blue); }

/* legacy scan markup (old in/out templates) */
.scanrow #scanbox { flex: 1; border-radius: var(--r-pill); padding: 12px 20px; }
.scanrow .minibtn { white-space: nowrap; }
#camvideo { width: 100%; max-height: 340px; margin-top: 12px; border-radius: var(--r-md); background: #000; }
.linkbox { margin-top: 12px; }

/* tall menus (admin) scroll inside the sidebar instead of spilling out */
.sidebar { overflow-y: auto; }
input[type="checkbox"], input[type="radio"] { width: auto; flex: none; padding: 0; margin: 0; accent-color: var(--blue); }
label.opt { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; margin-bottom: 10px; line-height: 1.4; }
label.opt input { margin-top: 3px; }
