/* =====================================================================
   Scan2Pro — "Quiet precision" design system
   One stylesheet for the whole app. Tokens first, then base, shell,
   components, and page-specific pieces (POS last).
   ===================================================================== */

/* ---- Inter (variable), bundled locally — served from /vendor/inter ---- */
@font-face {
  font-family: 'Inter Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(/vendor/inter/files/inter-latin-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(/vendor/inter/files/inter-latin-ext-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF,
    U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  /* type */
  --font-sans: 'Inter Variable', Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;

  /* neutrals (zinc) */
  --bg: #f7f7f8;
  --surface: #ffffff;
  --subtle: #f4f4f5;
  --tint: #fafafa;
  --hover: #f1f1f3;
  --border: #e4e4e7;
  --border-soft: #ececef;
  --border-strong: #d4d4d8;
  --text: #18181b;
  --text-2: #52525b;
  --label: #3f3f46;
  --muted: #71717a;
  --faint: #a1a1aa;
  --placeholder: #76767f;

  /* accent — company brand blue */
  --accent: #2251b5;
  --accent-hover: #1d4499;
  --accent-active: #183a85;
  --accent-text: #1e48a3;
  --accent-soft: #eef3fd;
  --accent-soft-2: #dbe5f8;
  --ring: rgba(34, 81, 181, .35);

  /* semantic */
  --success: #16a34a;  --success-text: #15803d; --success-ink: #14532d; --success-soft: #ecfdf3; --success-line: #bbf7d0;
  --warning: #d97706;  --warning-text: #b45309; --warning-ink: #78350f; --warning-soft: #fff8eb; --warning-line: #fde3a7;
  --danger: #dc2626;   --danger-text: #b91c1c;  --danger-ink: #7f1d1d;  --danger-soft: #fef2f2;  --danger-line: #fecaca;

  /* shape & depth */
  --r-sm: 6px;
  --r: 8px;
  --r-lg: 12px;
  --shadow-xs: 0 1px 2px rgba(24, 24, 27, .04);
  --shadow-pop: 0 12px 32px -12px rgba(24, 24, 27, .22), 0 2px 6px rgba(24, 24, 27, .06);
  --shadow-modal: 0 24px 64px -16px rgba(24, 24, 27, .32), 0 4px 12px rgba(24, 24, 27, .06);

  /* layout */
  --sidebar-w: 232px;
  --head-h: 64px;
  --gutter: 32px;
  --content-max: 1280px;

  /* motion */
  --ease: cubic-bezier(.2, .8, .2, 1);
  --dur: 150ms;

  color-scheme: light;
}
@media (max-width: 1439px) { :root { --gutter: 24px; } }
@media (max-width: 640px)  { :root { --gutter: 16px; } }

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--head-h) + 16px); }
@media (max-width: 1023px) { html { scroll-padding-top: 68px; } }
html, body { margin: 0; }
body {
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3 { margin: 0 0 8px; line-height: 1.3; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 20px; }
h2 { font-size: 15px; }
h3 { font-size: 14px; }
p { margin: 0 0 12px; }
b, strong { font-weight: 600; }
svg { flex: none; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
::selection { background: var(--accent-soft-2); }

.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-family: var(--font-mono); font-size: .94em; letter-spacing: 0; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.num, .tnum { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stack > * + * { margin-top: 16px; }
.ico { width: 16px; height: 16px; }
kbd {
  display: inline-flex; align-items: center; height: 18px; padding: 0 5px; font: 500 11px/1 var(--font-sans);
  color: var(--text-2); background: var(--surface); border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px;
}

/* ================================================================ SHELL */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }

/* ---- sidebar ---- */
.sidebar {
  position: sticky; top: 0; z-index: 40;
  display: flex; flex-direction: column;
  height: 100vh; height: 100dvh;
  background: var(--tint);
  border-right: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; height: var(--head-h); padding: 0 16px; border-bottom: 1px solid var(--border); flex: none; }
.brand-mark {
  display: grid; place-items: center; flex: none;
  width: 28px; height: 28px; border-radius: 7px;
  background: var(--accent); color: #fff;
  font-size: 11.5px; font-weight: 700; letter-spacing: .02em;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .15);
}
.brand-mark.sm { width: 24px; height: 24px; border-radius: 6px; font-size: 10px; }
.brand-mark.lg { width: 40px; height: 40px; border-radius: 10px; font-size: 15px; }
.brand-logo { display: block; flex: none; height: 36px; width: auto; border-radius: 6px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .04); }
.brand-logo.sm { height: 26px; border-radius: 5px; }
.brand-text { min-width: 0; line-height: 1.25; }
.brand-title { font-size: 13.5px; font-weight: 600; line-height: 1.25; letter-spacing: -.01em; color: var(--text); }
.brand-sub { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: .01em; }

.nav { flex: 1; overflow-y: auto; padding: 12px 10px; }
.nav-group { padding: 18px 10px 6px; font-size: 11px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.nav a {
  display: flex; align-items: center; gap: 10px;
  height: 34px; padding: 0 10px; margin-bottom: 1px;
  border-radius: 7px;
  color: var(--text-2); font-size: 13.5px; font-weight: 500;
  transition: background-color var(--dur), color var(--dur);
}
.nav a svg { width: 16px; height: 16px; color: var(--muted); transition: color var(--dur); }
.nav a:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.nav a:hover svg { color: var(--text-2); }
.nav a.active { background: var(--accent-soft); color: var(--accent-text); }
.nav a.active svg { color: var(--accent); }
.nav-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.side-foot { position: relative; flex: none; padding: 10px; border-top: 1px solid var(--border); }
.user-btn {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 7px 8px; border: 0; border-radius: 8px; background: none;
  font: inherit; color: inherit; text-align: left; cursor: pointer;
  transition: background-color var(--dur);
}
.user-btn:hover, .user-btn[aria-expanded="true"] { background: var(--hover); }
.user-btn .chev { width: 14px; height: 14px; color: var(--faint); }
.avatar {
  display: grid; place-items: center; flex: none;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent-soft-2); color: var(--accent-text);
  font-size: 11.5px; font-weight: 600; letter-spacing: .02em;
}
.user-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.who { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.role { font-size: 12px; color: var(--muted); text-transform: capitalize; }
.user-menu {
  position: absolute; left: 10px; right: 10px; bottom: calc(100% - 2px); z-index: 60;
  padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-pop);
  animation: pop-up .14s var(--ease);
}
.user-menu[hidden] { display: none; }
.user-menu a { display: flex; align-items: center; gap: 9px; height: 34px; padding: 0 10px; border-radius: 6px; color: var(--text); font-size: 13px; }
.user-menu a svg { width: 16px; height: 16px; color: var(--muted); }
.user-menu a:hover, .user-menu a:focus-visible { background: var(--subtle); text-decoration: none; outline: none; }

.scrim { display: none; }

/* ---- main column ---- */
.main { min-width: 0; display: flex; flex-direction: column; }
.mobilebar { display: none; }
.view { flex: 1; min-width: 0; }

/* ---- page head (sticky top bar) ---- */
.page-head { position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--border); }
.page-head-inner {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  max-width: calc(var(--content-max) + 2 * var(--gutter)); min-height: var(--head-h);
  margin: 0 auto; padding: 0 var(--gutter);
}
.page-title { min-width: 0; padding: 10px 0; }
.title-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.title-row h1 { margin: 0; font-size: 20px; line-height: 28px; font-weight: 600; letter-spacing: -.018em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.title-row .badge { flex: none; }
.crumbs { display: flex; align-items: center; gap: 8px; flex: none; }
.crumb { font-size: 20px; line-height: 28px; font-weight: 500; letter-spacing: -.018em; color: var(--muted); white-space: nowrap; }
.crumb:hover { color: var(--text); text-decoration: none; }
.crumb-sep { width: 16px; height: 16px; color: var(--faint); }
.page-sub { margin: 1px 0 0; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.page-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.page-tabs { max-width: calc(var(--content-max) + 2 * var(--gutter)); margin: -4px auto 0; padding: 0 var(--gutter); }

.page-body { max-width: calc(var(--content-max) + 2 * var(--gutter)); margin: 0 auto; padding: 24px var(--gutter) 56px; }
.page-loading { animation: fade-in .2s ease .18s both; }

/* ---- rail: 1024–1279 ---- */
@media (min-width: 1024px) and (max-width: 1279px) {
  :root { --sidebar-w: 64px; }
  .brand { justify-content: center; padding: 0; }
  .brand-text { display: none; }
  .nav { padding: 10px; }
  .nav-group { height: 17px; padding: 8px 4px; font-size: 0; }
  .nav-group::before { content: ""; display: block; height: 1px; background: var(--border); }
  .nav a { justify-content: center; height: 40px; padding: 0; }
  .nav a svg { width: 18px; height: 18px; }
  .nav-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .user-btn { justify-content: center; padding: 6px 0; }
  .user-meta, .user-btn .chev { display: none; }
  .user-menu { right: auto; width: 210px; }
}

/* ---- drawer: < 1024 ---- */
@media (max-width: 1023px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: 272px;
    transform: translateX(-100%); visibility: hidden;
    transition: transform .22s var(--ease), visibility 0s linear .22s;
  }
  .sidebar.open { transform: none; visibility: visible; box-shadow: var(--shadow-modal); transition: transform .22s var(--ease); }
  .scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(24, 24, 27, .38); opacity: 0; pointer-events: none; transition: opacity .2s; }
  .sidebar.open + .scrim { opacity: 1; pointer-events: auto; }
  .mobilebar {
    display: flex; align-items: center; gap: 10px;
    position: sticky; top: 0; z-index: 30;
    height: 52px; padding: 0 var(--gutter) 0 calc(var(--gutter) - 8px);
    background: var(--surface); border-bottom: 1px solid var(--border);
  }
  .mobilebar-title { font-weight: 600; font-size: 14.5px; letter-spacing: -.01em; }
  .page-head { position: static; }
  .page-head-inner { flex-wrap: wrap; row-gap: 4px; padding-top: 6px; padding-bottom: 10px; min-height: 0; }
  .page-actions { flex-wrap: wrap; }
  .page-sub { white-space: normal; }
}
@media (max-width: 640px) {
  .title-row h1, .crumb { font-size: 18px; line-height: 26px; }
  .page-actions { width: 100%; }
  .page-actions > .btn { flex: 1; }
  .page-actions > .btn.ghost { display: none; }
  .page-actions:not(:has(> .btn:not(.ghost))) { display: none; }
  .page-body { padding-top: 16px; }
  table.data { min-width: 600px; }
  table.data.items-table { min-width: 720px; }
  table.data:has(> tbody > tr.empty-row) { min-width: 0; }
  table.data:has(> tbody > tr.empty-row) > thead { display: none; }
  .pick-code { width: 52px; }
  .pick-name { white-space: normal; line-height: 1.35; }
}

/* =========================================================== COMPONENTS */

/* ---- cards ---- */
.card { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-xs); }
.card-body { padding: 20px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  min-height: 56px; padding: 12px 20px; border-bottom: 1px solid var(--border);
}
.card-head h2 { margin: 0; font-size: 14.5px; font-weight: 600; letter-spacing: -.005em; }
.card-head .count { margin-left: 6px; font-size: 12.5px; font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; }
.card-desc { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.card-foot {
  display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap;
  padding: 12px 20px; border-top: 1px solid var(--border); background: var(--tint); border-radius: 0 0 var(--r-lg) var(--r-lg);
}
.card-foot .spacer { flex: 1; }
.card-note { padding: 10px 20px; font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--border-soft); font-variant-numeric: tabular-nums; }
.stack-lg > * + * { margin-top: 20px; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 900px) { .grid.cols-2, .grid.cols-3 { grid-template-columns: minmax(0, 1fr); } }

/* ---- stat tiles ---- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat { padding: 16px 18px 15px; }
.stat-label { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.stat-label .dot { width: 7px; height: 7px; }
.stat-value { margin-top: 8px; font-size: 26px; line-height: 1.15; font-weight: 600; letter-spacing: -.025em; font-variant-numeric: tabular-nums; }
.stat-value .cur { font-size: 18px; font-weight: 500; color: var(--muted); margin-right: 2px; letter-spacing: 0; }
.stat-hint { margin-top: 4px; font-size: 12px; color: var(--muted); }
@media (max-width: 1100px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 420px)  { .stats { gap: 10px; } .stat { padding: 14px; } .stat-value { font-size: 22px; } }

/* ---- buttons ---- */
.btn {
  --h: 34px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: var(--h); padding: 0 12px;
  font: inherit; font-size: 13.5px; font-weight: 500; line-height: 1;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--r);
  box-shadow: 0 1px 1px rgba(24, 24, 27, .04);
  cursor: pointer; white-space: nowrap; text-decoration: none; user-select: none;
  transition: background-color var(--dur), border-color var(--dur), color var(--dur), box-shadow var(--dur);
}
.btn svg { width: 16px; height: 16px; margin-left: -2px; }
.btn:hover { background: #f8f8f9; border-color: #c2c2c9; text-decoration: none; }
.btn:active { background: var(--subtle); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); border-color: var(--accent); }
.btn:disabled, .btn.is-disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.btn:disabled:hover { background: var(--surface); border-color: var(--border-strong); }

.btn.primary { color: #fff; background: var(--accent); border-color: var(--accent); box-shadow: 0 1px 2px rgba(24, 58, 133, .25), inset 0 1px 0 rgba(255, 255, 255, .1); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.primary:active { background: var(--accent-active); }
.btn.primary:focus-visible { box-shadow: 0 0 0 3px var(--ring); border-color: var(--accent-active); }
.btn.primary:disabled:hover, .btn.primary.is-disabled:hover { background: var(--accent); border-color: var(--accent); }
.btn.primary.is-disabled { opacity: 1; color: #fff; background: #a9b9dd; border-color: #a9b9dd; box-shadow: none; }

.btn.success { color: #fff; background: var(--success); border-color: var(--success); }
.btn.success:hover { background: var(--success-text); border-color: var(--success-text); }

.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn.ghost:hover { background: var(--hover); color: var(--text); }
.btn.ghost:focus-visible { border-color: transparent; }

.btn.danger { color: var(--danger-text); border-color: #efc6c6; }
.btn.danger:hover { background: var(--danger-soft); border-color: #e7a9a9; }
.btn.danger:focus-visible { box-shadow: 0 0 0 3px rgba(220, 38, 38, .25); border-color: var(--danger); }
.btn.danger.ghost { border-color: transparent; }
.btn.danger.ghost:hover { background: var(--danger-soft); }
.btn.danger-solid { color: #fff; background: var(--danger); border-color: var(--danger); box-shadow: 0 1px 2px rgba(127, 29, 29, .25); }
.btn.danger-solid:hover { background: var(--danger-text); border-color: var(--danger-text); }
.btn.danger-solid:focus-visible { box-shadow: 0 0 0 3px rgba(220, 38, 38, .3); }

.btn.sm { --h: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; gap: 5px; }
.btn.sm svg { width: 14px; height: 14px; }
.btn.lg { --h: 40px; padding: 0 16px; font-size: 14px; }
.btn.xl { --h: 48px; padding: 0 20px; font-size: 15px; font-weight: 600; border-radius: 10px; }
.btn.block { width: 100%; }
.btn.icon { width: var(--h); padding: 0; }
.btn.icon svg { margin: 0; }
.btn-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---- forms ---- */
label.field, .field { display: block; min-width: 0; margin: 0 0 14px; }
.field > span:first-child, .field > .field-label {
  display: block; margin-bottom: 6px;
  font-size: 13px; font-weight: 500; line-height: 1.35; color: var(--label);
}
.field > span:first-child .opt, .field-label .opt { font-weight: 400; color: var(--muted); }
.help, .field > .help { display: block; margin-top: 6px; font-size: 12px; line-height: 1.4; color: var(--muted); }
.field-error { display: none; }
.field.invalid .field-error { display: block; margin-top: 6px; font-size: 12px; font-weight: 500; color: var(--danger-text); }
.field.invalid input, .field.invalid textarea, .field.invalid select { border-color: var(--danger); }
.field.invalid input:focus, .field.invalid textarea:focus { box-shadow: 0 0 0 3px rgba(220, 38, 38, .2); }

input, select, textarea {
  width: 100%; height: 36px; padding: 0 10px;
  font: inherit; font-size: 14px; color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--r);
  box-shadow: 0 1px 1px rgba(24, 24, 27, .03);
  transition: border-color var(--dur), box-shadow var(--dur);
}
textarea { display: block; height: auto; min-height: 72px; padding: 8px 10px; line-height: 1.45; resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: #b8b8c0; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
input::placeholder, textarea::placeholder { color: var(--placeholder); opacity: 1; }
input:disabled, select:disabled, textarea:disabled { background: var(--subtle); color: var(--muted); cursor: not-allowed; }
input[type=number] { font-variant-numeric: tabular-nums; }
input.money, .money input { text-align: right; }
input[type=date] { padding-right: 8px; font-variant-numeric: tabular-nums; }
select {
  appearance: none; -webkit-appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 14px;
}
input[type=checkbox], input[type=radio] {
  width: 16px; height: 16px; margin: 0; padding: 0; flex: none;
  accent-color: var(--accent); box-shadow: none; cursor: pointer;
}
input[type=checkbox]:focus, input[type=radio]:focus { box-shadow: none; }
input[type=checkbox]:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
input[type=file] { height: auto; padding: 0; border: 0; box-shadow: none; background: none; }
.textarea-mono { font-family: var(--font-mono); font-size: 12.5px; }

.row { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1 1 0; min-width: 140px; }
.row > .shrink { flex: 0 0 auto; min-width: 0; }
.row > .w-sm { flex: 0 0 120px; min-width: 100px; }
.check { display: flex; align-items: center; gap: 9px; margin: 2px 0 14px; font-size: 13.5px; color: var(--text); cursor: pointer; line-height: 1.4; }
.check .help { margin: 0; }

.form-sec + .form-sec { margin-top: 6px; padding-top: 18px; border-top: 1px solid var(--border-soft); }
.form-sec-title { margin: 0 0 12px; font-size: 12px; font-weight: 500; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }

/* input with leading icon */
.input-icon { position: relative; display: block; }
.input-icon > svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.input-icon > input { padding-left: 34px; }
.input-wrap { position: relative; display: block; }
.input-wrap > input { padding-right: 42px; }
.input-wrap > .pw-toggle {
  position: absolute; right: 4px; top: 4px; width: 28px; height: 28px;
  display: grid; place-items: center; padding: 0; border: 0; border-radius: 6px;
  background: none; color: var(--muted); cursor: pointer;
}
.input-wrap > .pw-toggle:hover { background: var(--subtle); color: var(--text); }
.input-wrap > .pw-toggle svg { width: 16px; height: 16px; }

/* ---- toolbar above tables ---- */
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.toolbar .search { flex: 1 1 260px; min-width: 200px; max-width: 420px; }
.toolbar select, .toolbar input[type=date] { width: auto; height: 34px; font-size: 13.5px; }
.toolbar input { height: 34px; font-size: 13.5px; }
.toolbar .spacer { flex: 1; }
.toolbar .meta { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.toolbar .range { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.toolbar .range input { width: 148px; }
.toolbar-label { font-size: 12.5px; color: var(--muted); }
@media (max-width: 640px) {
  .toolbar .search { max-width: none; flex-basis: 100%; }
  .toolbar select { flex: 1; }
  .toolbar .range { flex-basis: 100%; }
  .toolbar .range input { flex: 1; width: auto; min-width: 0; }
}

/* ---- tables ---- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap:last-child { border-radius: 0 0 var(--r-lg) var(--r-lg); }
.card > .table-wrap:first-child { border-radius: var(--r-lg) var(--r-lg) 0 0; }
.card > .table-wrap:only-child { border-radius: var(--r-lg); }
.table-wrap.scroll-y {
  max-height: 560px; overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: #c4c4cc transparent; scrollbar-gutter: stable;
  /* bottom shadow while more rows are below; the 'local' white cover hides it at the end */
  background:
    linear-gradient(rgba(255, 255, 255, 0), var(--surface) 75%) center bottom / 100% 40px no-repeat local,
    radial-gradient(farthest-side at 50% 100%, rgba(24, 24, 27, .16), rgba(24, 24, 27, 0)) center bottom / 100% 16px no-repeat scroll;
}
.table-wrap.scroll-y::-webkit-scrollbar { width: 10px; height: 10px; }
.table-wrap.scroll-y::-webkit-scrollbar-thumb { background: #cfcfd6; border-radius: 10px; border: 2px solid var(--surface); }
.scroll-hint { display: flex; align-items: center; gap: 6px; }
.scroll-hint svg { width: 14px; height: 14px; }
table.data { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
table.data th {
  position: sticky; top: 0; z-index: 1;
  height: 36px; padding: 0 12px;
  font-size: 11.5px; font-weight: 500; letter-spacing: .045em; text-transform: uppercase; text-align: left; white-space: nowrap;
  color: var(--muted); background: var(--tint);
  border-bottom: 1px solid var(--border);
}
table.data td { height: 44px; padding: 9px 12px; vertical-align: middle; border-bottom: 1px solid var(--border-soft); }
table.data th:first-child, table.data td:first-child { padding-left: 20px; }
table.data th:last-child, table.data td:last-child { padding-right: 20px; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr { transition: background-color .1s; }
table.data tbody tr:hover > td { background: #fafafb; }
table.data tr.click { cursor: pointer; }
table.data tr.click:focus-visible { outline: none; }
table.data tr.click:focus-visible > td { background: var(--accent-soft); box-shadow: inset 0 1px 0 var(--ring), inset 0 -1px 0 var(--ring); }
table.data tr.click:hover > td { background: #f6f8fd; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data td.act { width: 1%; white-space: nowrap; text-align: right; padding-top: 6px; padding-bottom: 6px; }
table.data td.act .btn + .btn { margin-left: 4px; }
table.data td.idx { width: 1%; color: var(--muted); font-variant-numeric: tabular-nums; }
table.data .strong { font-weight: 500; color: var(--text); }
table.data .sub { display: block; margin-top: 1px; font-size: 12px; color: var(--muted); }
table.data .zero { color: var(--faint); }
table.data a.doc { color: var(--text); font-family: var(--font-mono); font-size: 13px; font-weight: 500; }
table.data a.doc:hover { color: var(--accent-text); }
table.data tfoot td { height: 44px; padding: 9px 12px; font-weight: 600; background: var(--tint); border-top: 1px solid var(--border); font-variant-numeric: tabular-nums; }
table.data tfoot td:first-child { padding-left: 20px; }
table.data tfoot td:last-child { padding-right: 20px; }
table.data tr.empty-row > td, table.data tr.empty-row:hover > td { height: auto; padding: 0; background: none; }
table.data.compact td { height: 40px; padding-top: 7px; padding-bottom: 7px; }
.cell-code { font-family: var(--font-mono); font-size: 12.5px; color: var(--text-2); }

/* ---- badges ---- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 8px 0 7px;
  font-size: 12px; font-weight: 500; line-height: 1; white-space: nowrap; letter-spacing: 0;
  color: var(--text-2); background: var(--subtle);
  border-radius: 999px; box-shadow: inset 0 0 0 1px rgba(24, 24, 27, .06);
  vertical-align: middle;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.badge.nodot { padding: 0 8px; }
.badge.nodot::before { display: none; }
.badge.ok   { color: var(--success-text); background: var(--success-soft); box-shadow: inset 0 0 0 1px rgba(22, 163, 74, .18); }
.badge.warn { color: var(--warning-text); background: var(--warning-soft); box-shadow: inset 0 0 0 1px rgba(217, 119, 6, .2); }
.badge.bad  { color: var(--danger-text);  background: var(--danger-soft);  box-shadow: inset 0 0 0 1px rgba(220, 38, 38, .16); }
.badge.info { color: var(--accent-text);  background: var(--accent-soft);  box-shadow: inset 0 0 0 1px rgba(34, 81, 181, .16); }
.badge.mute { color: var(--text-2); background: var(--subtle); }
.badge.mute::before { background: var(--faint); }
h1 .badge, .title-row .badge { height: 24px; font-size: 12.5px; }

/* ---- dots ---- */
.dot { position: relative; display: inline-block; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.dot.ok { background: var(--success); }
.dot.warn { background: var(--warning); }
.dot.info { background: var(--accent); }
.dot.bad { background: var(--danger); }

/* ---- tabs (underline) ---- */
.tabs { display: flex; gap: 20px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  position: relative; display: inline-flex; align-items: center; gap: 7px;
  height: 42px; padding: 0 1px;
  font-size: 13.5px; font-weight: 500; color: var(--muted); white-space: nowrap;
  transition: color var(--dur);
}
.tabs a svg { width: 15px; height: 15px; }
.tabs a::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; border-radius: 2px 2px 0 0; background: transparent; transition: background-color var(--dur); }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--text); }
.tabs a.active::after { background: var(--accent); }

/* ---- segmented control ---- */
.segmented { display: inline-flex; gap: 2px; padding: 3px; background: var(--subtle); border: 1px solid var(--border); border-radius: 10px; }
.segmented button {
  flex: 1; height: 32px; padding: 0 14px;
  font: inherit; font-size: 13px; font-weight: 500; color: var(--text-2);
  background: transparent; border: 0; border-radius: 7px; cursor: pointer; white-space: nowrap;
  transition: background-color var(--dur), color var(--dur), box-shadow var(--dur);
}
.segmented button:hover { color: var(--text); }
.segmented button.on { color: var(--text); background: var(--surface); box-shadow: 0 1px 2px rgba(24, 24, 27, .1), 0 0 0 1px rgba(24, 24, 27, .06); }
.segmented button:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--ring); }
.segmented.block { display: flex; width: 100%; }

/* ---- alerts / banners ---- */
.alert {
  position: relative; margin: 0 0 14px; padding: 10px 12px 10px 38px;
  font-size: 13px; line-height: 1.5; color: var(--text-2);
  background: var(--subtle); border: 1px solid var(--border); border-radius: var(--r);
}
.alert::before {
  content: ""; position: absolute; left: 12px; top: 12px; width: 16px; height: 16px; background: currentColor;
  -webkit-mask: var(--alert-ico) center / contain no-repeat; mask: var(--alert-ico) center / contain no-repeat;
  --alert-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 16v-4M12 8h.01'/%3E%3C/svg%3E");
}
.alert.info { color: #1b3f8f; background: var(--accent-soft); border-color: #d3dff6; }
.alert.ok { color: var(--success-ink); background: var(--success-soft); border-color: var(--success-line); }
.alert.ok::before { --alert-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='m8.5 12.5 2.5 2.5 5-5'/%3E%3C/svg%3E"); }
.alert.warn { color: var(--warning-ink); background: var(--warning-soft); border-color: var(--warning-line); }
.alert.warn::before { --alert-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3'/%3E%3Cpath d='M12 9v4M12 17h.01'/%3E%3C/svg%3E"); }
.alert.bad { color: var(--danger-ink); background: var(--danger-soft); border-color: var(--danger-line); }
.alert.bad::before { --alert-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 8v4M12 16h.01'/%3E%3C/svg%3E"); }
.alert b, .alert strong { color: inherit; }
.alert .alert-title { display: block; font-weight: 600; }
.banner { margin-bottom: 20px; }

/* ---- empty / loading states ---- */
.empty { padding: 32px 20px; text-align: center; color: var(--muted); }
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 40px 20px 44px; text-align: center; }
.empty-ico {
  display: grid; place-items: center; width: 40px; height: 40px; margin-bottom: 10px;
  color: var(--muted); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-xs);
}
.empty-ico svg { width: 18px; height: 18px; }
.empty-title { margin: 0; font-size: 14px; font-weight: 500; color: var(--text); }
.empty-text { margin: 0; max-width: 360px; font-size: 13px; color: var(--muted); }
.empty-state .btn { margin-top: 14px; }
.empty-state.sm { padding: 28px 16px; }
.empty-state.bad .empty-ico { color: var(--danger); background: var(--danger-soft); border-color: var(--danger-line); }

.skel { display: block; height: 10px; border-radius: 4px; background: #ececef; animation: pulse 1.4s ease-in-out infinite; }
.skel.lg { height: 14px; }
.skel-row td { height: 44px; }
.skel-card { padding: 20px; }
.skel-card .skel + .skel { margin-top: 14px; }

/* ---- definition lists ---- */
.kv { display: grid; grid-template-columns: 148px minmax(0, 1fr); margin: 0; }
.kv dt, .kv dd { padding: 9px 0; border-bottom: 1px solid var(--border-soft); }
.kv dt:last-of-type, .kv dd:last-of-type { border-bottom: 0; }
.kv dt { font-size: 13px; color: var(--muted); }
.kv dd { margin: 0; font-size: 13.5px; color: var(--text); min-width: 0; overflow-wrap: anywhere; }
.kv dd.mono { font-size: 13px; }
.kv .none { color: var(--faint); }
@media (max-width: 480px) { .kv { grid-template-columns: 112px minmax(0, 1fr); } }

/* ---- chips (barcode serials) ---- */
.serials { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 1px;
  height: 22px; padding: 0 7px;
  font-family: var(--font-mono); font-size: 11.5px; color: var(--text-2);
  background: var(--subtle); border: 1px solid var(--border); border-radius: 5px;
}
.chip.rm { padding-right: 2px; }
.chip button {
  display: grid; place-items: center; width: 18px; height: 18px; padding: 0; margin-left: 2px;
  color: var(--muted); background: none; border: 0; border-radius: 4px; cursor: pointer;
}
.chip button svg { width: 12px; height: 12px; }
.chip button:hover { color: var(--danger); background: var(--danger-soft); }
.chip button:focus-visible { outline: 2px solid var(--ring); outline-offset: 0; }

/* ---- modal ---- */
.modal-back {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 9vh 16px 24px; overflow-y: auto;
  background: rgba(24, 24, 27, .42); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
  animation: fade-in .16s ease-out;
}
.modal {
  width: 100%; max-width: 520px;
  background: var(--surface); border: 1px solid rgba(24, 24, 27, .08); border-radius: 14px; box-shadow: var(--shadow-modal);
  animation: modal-in .2s var(--ease);
}
.modal.wide { max-width: 640px; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 16px 16px 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h2 { flex: 1; margin: 0; font-size: 16px; font-weight: 600; letter-spacing: -.012em; }
.modal-ico { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; color: var(--danger); background: var(--danger-soft); flex: none; }
.modal-ico svg { width: 17px; height: 17px; }
.modal-ico.ok { color: var(--success); background: var(--success-soft); }
.x {
  display: grid; place-items: center; width: 30px; height: 30px; padding: 0; margin: -4px 0;
  color: var(--muted); background: none; border: 0; border-radius: 7px; cursor: pointer;
}
.x svg { width: 18px; height: 18px; }
.x:hover { color: var(--text); background: var(--subtle); }
.modal-body { padding: 20px; }
.modal-body > p:last-child, .modal-body > .field:last-child, .modal-body > .row:last-child .field, .modal-body > .check:last-child { margin-bottom: 0; }
.modal-body p { color: var(--text-2); }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--tint); border-radius: 0 0 14px 14px; }
@media (max-width: 520px) {
  .modal-back { padding: 16px 12px; align-items: flex-end; }
  .modal-foot .btn { flex: 1; }
}
.result-box { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; padding: 14px 16px; margin: 0 0 16px; background: var(--tint); border: 1px solid var(--border); border-radius: 10px; }
.result-box dt { font-size: 13px; color: var(--muted); }
.result-box dd { margin: 0; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.result-box dd.big { font-size: 18px; letter-spacing: -.015em; }

/* ---- toasts ---- */
#toasts { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; pointer-events: none; }
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  min-width: 260px; max-width: 400px; padding: 11px 14px 11px 12px;
  font-size: 13.5px; font-weight: 500; line-height: 1.45; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-pop);
  pointer-events: none; animation: toast-in .2s var(--ease);
}
body:has(.savebar) #toasts { bottom: 80px; }
.toast svg { width: 18px; height: 18px; margin-top: 1px; color: var(--accent); }
.toast.ok svg { color: var(--success); }
.toast.bad { border-color: var(--danger-line); }
.toast.bad svg { color: var(--danger); }
.toast.out { opacity: 0; transform: translateY(4px); transition: opacity .18s, transform .18s; }
@media (max-width: 520px) { #toasts { left: 12px; right: 12px; bottom: 12px; } .toast { min-width: 0; max-width: none; width: 100%; } }

/* ---- popover list (customer suggestions) ---- */
.suggest { position: relative; }
.suggest-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 25;
  max-height: 260px; overflow-y: auto; padding: 4px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-pop);
}
.suggest-list > div { padding: 8px 10px; border-radius: 6px; cursor: pointer; line-height: 1.35; }
.suggest-list > div + div { margin-top: 1px; }
.suggest-list > div:hover { background: var(--accent-soft); }
.suggest-list > div.muted { cursor: default; font-size: 13px; }
.suggest-list > div.muted:hover { background: none; }
.suggest-list strong { font-weight: 500; }

/* ============================================================== PAGES */

/* ---- dashboard ---- */
.dash-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.dash-grid.two { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
@media (max-width: 1100px) { .dash-grid.two { grid-template-columns: minmax(0, 1fr); } }
.link-more { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 500; }
.link-more svg { width: 14px; height: 14px; }
table.data.fixed { table-layout: fixed; }
.cell-clip { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- invoice detail ---- */
.doc-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.totals-wrap { display: flex; justify-content: flex-end; padding: 16px 20px 20px; border-top: 1px solid var(--border); background: var(--tint); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.totals-wrap .totals { max-width: 340px; }

/* ---- totals (shared: POS + detail) ---- */
.totals { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.totals td { padding: 3px 0; color: var(--text-2); }
.totals td:last-child { text-align: right; color: var(--text); }
.totals tr.grand td { padding-top: 12px; border-top: 1px dashed var(--border-strong); color: var(--text); font-weight: 600; vertical-align: baseline; }
.totals tr.grand td:first-child { font-size: 13.5px; }
.totals tr.grand td:last-child { font-size: 22px; font-weight: 650; letter-spacing: -.022em; }
.totals tr.grand + tr td { padding-top: 0; }
.totals tr:nth-last-child(2) td { padding-bottom: 10px; }
.words { margin-top: 6px; font-size: 12px; line-height: 1.45; color: var(--muted); }

/* ---- products / labels picker ---- */
.labels-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 16px; align-items: start; }
@media (max-width: 1100px) { .labels-grid { grid-template-columns: minmax(0, 1fr); } }
.picker { border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); overflow: hidden; transition: border-color var(--dur), box-shadow var(--dur); }
.picker:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.picker-search { position: relative; border-bottom: 1px solid var(--border); }
.picker-search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); }
.picker-search input { height: 40px; padding-left: 36px; border: 0; border-radius: 0; box-shadow: none; }
.picker-search input:focus { box-shadow: none; }
.picker-list { max-height: 288px; overflow-y: auto; padding: 4px; outline: none; }
.pick {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 7px 10px; margin: 0 0 1px;
  font: inherit; font-size: 13.5px; color: var(--text); text-align: left;
  background: none; border: 0; border-radius: 7px; cursor: pointer;
}
.pick:hover { background: var(--subtle); }
.pick:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--ring); }
.pick[aria-selected="true"] { background: var(--accent-soft); box-shadow: inset 0 0 0 1px #c9d7f3; }
.pick-code { flex: none; width: 70px; font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.pick-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-stock { flex: none; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pick-check { flex: none; width: 16px; height: 16px; color: var(--accent); visibility: hidden; }
.pick[aria-selected="true"] .pick-check { visibility: visible; }
.pick[aria-selected="true"] .pick-name { font-weight: 500; color: var(--accent-text); }
.pick-empty { padding: 20px 10px; text-align: center; font-size: 13px; color: var(--muted); }
.selection {
  display: flex; align-items: center; gap: 12px; margin: 14px 0 16px; padding: 12px 14px;
  background: var(--tint); border: 1px dashed var(--border-strong); border-radius: 10px;
}
.selection.on { background: var(--accent-soft); border: 1px solid #cddaf4; }
.selection-ico { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); color: var(--muted); flex: none; }
.selection.on .selection-ico { color: var(--accent); border-color: #cddaf4; }
.selection-ico svg { width: 16px; height: 16px; }
.selection-main { flex: 1; min-width: 0; }
.selection-name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.selection-meta { font-size: 12.5px; color: var(--muted); }
.selection-stock { text-align: right; font-size: 12px; color: var(--muted); line-height: 1.2; }
.selection-stock b { display: block; font-size: 18px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }

/* ---- stock trace ---- */
.trace-card .card-body { padding: 20px; }
.trace-bar { display: flex; gap: 10px; }
.trace-field { position: relative; flex: 1; }
.trace-field > svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; color: var(--muted); pointer-events: none; }
.trace-field input { height: 48px; padding-left: 44px; font-family: var(--font-mono); font-size: 17px; letter-spacing: .04em; }
.trace-field input::placeholder { font-family: var(--font-sans); font-size: 15px; letter-spacing: 0; }
.trace-bar .btn { --h: 48px; padding: 0 20px; }
#trace:empty { display: none; }
#trace { margin-top: 16px; }
.trace-result { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; animation: fade-up .2s var(--ease); }
.trace-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 16px; background: var(--tint); border-bottom: 1px solid var(--border); }
.trace-code { font-family: var(--font-mono); font-size: 18px; font-weight: 600; letter-spacing: .03em; }
.trace-prod { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.timeline { list-style: none; margin: 0; padding: 16px 16px 6px; }
.tl { position: relative; display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 12px; padding-bottom: 14px; }
.tl::before { content: ""; position: absolute; left: 9.5px; top: 18px; bottom: 0; width: 1px; background: var(--border); }
.tl:last-child::before { display: none; }
.tl-dot { position: relative; z-index: 1; display: grid; place-items: center; width: 20px; height: 20px; margin-top: 0; border-radius: 50%; background: var(--surface); border: 1.5px solid var(--border-strong); }
.tl-dot::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }
.tl.ok .tl-dot { border-color: var(--success); } .tl.ok .tl-dot::after { background: var(--success); }
.tl.warn .tl-dot { border-color: var(--warning); } .tl.warn .tl-dot::after { background: var(--warning); }
.tl.info .tl-dot { border-color: var(--accent); } .tl.info .tl-dot::after { background: var(--accent); }
.tl.bad .tl-dot { border-color: var(--danger); } .tl.bad .tl-dot::after { background: var(--danger); }
.tl-title { font-size: 13.5px; font-weight: 500; line-height: 20px; }
.tl-meta { font-size: 12.5px; color: var(--muted); }
.trace-error { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 10px; color: var(--danger-ink); background: var(--danger-soft); border: 1px solid var(--danger-line); font-weight: 500; animation: fade-up .2s var(--ease); }
.trace-error svg { width: 18px; height: 18px; color: var(--danger); }

/* ---- settings layout (admin) ---- */
.settings { display: grid; grid-template-columns: minmax(0, 1fr); }
.set-row { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 32px; padding: 28px 0; border-bottom: 1px solid var(--border); }
.set-row:first-child { padding-top: 4px; }
.set-row:last-of-type { border-bottom: 0; }
.set-intro h2 { margin: 0 0 4px; font-size: 14.5px; }
.set-intro p { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.55; }
.set-intro code, .placeholder-tag { font-family: var(--font-mono); font-size: 12px; padding: 1px 5px; background: var(--subtle); border: 1px solid var(--border); border-radius: 4px; color: var(--text-2); }
.set-card .card-body > .field:last-child, .set-card .card-body > .row:last-child > .field, .set-card .card-body > .check:last-child { margin-bottom: 0; }
@media (max-width: 960px) { .set-row { grid-template-columns: minmax(0, 1fr); gap: 14px; padding: 22px 0; } }
.savebar {
  position: sticky; bottom: 0; z-index: 15;
  display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap;
  margin: 8px calc(-1 * var(--gutter)) -56px; padding: 12px var(--gutter);
  background: var(--surface); border-top: 1px solid var(--border); box-shadow: 0 -4px 12px -8px rgba(24, 24, 27, .12);
}
.savebar .note { margin-right: auto; font-size: 12.5px; color: var(--muted); }
.upload-row { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--border-soft); }
.upload-row:first-child { padding-top: 0; }
.upload-prev {
  display: grid; place-items: center; flex: none; width: 132px; height: 60px; overflow: hidden;
  background: var(--tint); border: 1px dashed var(--border-strong); border-radius: 8px; color: var(--faint);
}
.upload-prev svg { width: 18px; height: 18px; }
.upload-prev img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.upload-prev .logo-prev.hidden + svg { display: block; }
.upload-prev .logo-prev:not(.hidden) + svg { display: none; }
.upload-main { flex: 1; min-width: 0; }
.upload-title { font-size: 13px; font-weight: 500; color: var(--label); }
.upload-help { font-size: 12px; color: var(--muted); line-height: 1.4; margin-top: 1px; }
.upload-actions { display: flex; gap: 6px; flex: none; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
.file-btn:focus-within { box-shadow: 0 0 0 3px var(--ring); border-color: var(--accent); }
@media (max-width: 560px) { .upload-row { flex-wrap: wrap; } .upload-actions { width: 100%; } }
.path-box { display: flex; align-items: center; gap: 8px; padding: 9px 12px; margin: 0 0 14px; font-family: var(--font-mono); font-size: 12.5px; color: var(--text-2); background: var(--tint); border: 1px solid var(--border); border-radius: 8px; overflow-wrap: anywhere; }
.path-box svg { width: 15px; height: 15px; color: var(--muted); flex: none; }
.next-nums { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; margin-bottom: 16px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.next-nums > div { padding: 12px 14px; background: var(--tint); }
.next-nums > div + div { border-left: 1px solid var(--border); }
.next-nums .lbl { font-size: 12px; color: var(--muted); }
.next-nums .val { margin-top: 2px; font-family: var(--font-mono); font-size: 14.5px; font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
@media (max-width: 640px) { .next-nums { grid-template-columns: minmax(0, 1fr); } .next-nums > div + div { border-left: 0; border-top: 1px solid var(--border); } }
.roles-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.roles-list > div { padding: 16px 20px; }
.roles-list > div + div { border-left: 1px solid var(--border-soft); }
.roles-list p { margin: 8px 0 0; font-size: 13px; color: var(--text-2); }
@media (max-width: 760px) { .roles-list { grid-template-columns: minmax(0, 1fr); } .roles-list > div + div { border-left: 0; border-top: 1px solid var(--border-soft); } }
.badge.role-admin { color: var(--accent-text); background: var(--accent-soft); box-shadow: inset 0 0 0 1px rgba(34, 81, 181, .16); }
.badge.role-factory { color: var(--warning-text); background: var(--warning-soft); box-shadow: inset 0 0 0 1px rgba(217, 119, 6, .2); }
.badge.role-sales { color: var(--success-text); background: var(--success-soft); box-shadow: inset 0 0 0 1px rgba(22, 163, 74, .18); }
.badge[class*="role-"] { text-transform: capitalize; }
.log-action { font-family: var(--font-mono); font-size: 12px; color: var(--text); background: var(--subtle); border: 1px solid var(--border); border-radius: 4px; padding: 1px 6px; white-space: nowrap; }
.log-details { font-family: var(--font-mono); font-size: 12px; color: var(--text-2); max-width: 560px; overflow-wrap: anywhere; }

/* ================================================================ POS */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 376px; gap: 20px; align-items: start; }
.pos-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

/* scan card */
.scan-card { padding: 18px 20px 20px; }
.scan-label { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.scan-label h2 { margin: 0; font-size: 14.5px; }
.scan-field {
  display: flex; align-items: center; gap: 12px;
  height: 64px; padding: 0 8px 0 18px;
  background: var(--surface);
  border: 1.5px solid var(--border-strong); border-radius: 12px;
  transition: border-color var(--dur), box-shadow var(--dur), background-color var(--dur);
  cursor: text;
}
.scan-field > svg { width: 24px; height: 24px; color: var(--faint); transition: color var(--dur); }
.scan-field input {
  flex: 1; min-width: 0; height: 100%; padding: 0;
  font-family: var(--font-mono); font-size: 22px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase;
  background: transparent; border: 0; box-shadow: none;
}
.scan-field input::placeholder { text-transform: none; letter-spacing: .01em; font-family: var(--font-sans); font-weight: 400; font-size: 17px; color: var(--placeholder); }
.scan-field input:focus { box-shadow: none; }
.scan-field .btn { --h: 46px; padding: 0 18px; border-radius: 9px; }
.scan-field:hover { border-color: #b8b8c0; }
.scan-field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(34, 81, 181, .14); }
.scan-field:focus-within > svg { color: var(--accent); }
.scan-hint { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 12.5px; color: var(--muted); min-height: 20px; }
.scan-hint .kbd-hint { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.scan-hint .dot.live { background: var(--success); }
.scan-hint .dot.live::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  border: 2px solid var(--success); opacity: 0; animation: ping 1.8s cubic-bezier(0, 0, .2, 1) infinite;
}
.scan-hint.live #scan-state { color: var(--success-text); font-weight: 500; }

/* scan feedback banner */
#scan-msg:empty { display: none; }
#scan-msg { margin-top: 14px; }
.scan-msg {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border: 1px solid; border-radius: 10px;
  animation: msg-in .22s var(--ease);
}
.scan-msg-ico { display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 50%; color: #fff; }
.scan-msg-ico svg { width: 18px; height: 18px; stroke-width: 2.25; }
.scan-msg-body { flex: 1; min-width: 0; }
.scan-msg-title { font-size: 15px; font-weight: 600; line-height: 1.35; letter-spacing: -.005em; }
.scan-msg-sub { margin-top: 1px; font-size: 13px; line-height: 1.45; }
.scan-msg-sub .mono { font-weight: 500; }
.scan-msg.ok { background: var(--success-soft); border-color: var(--success-line); color: var(--success-ink); }
.scan-msg.ok .scan-msg-ico { background: var(--success); }
.scan-msg.ok .scan-msg-sub { color: #166534; }
.scan-msg.bad { background: var(--danger-soft); border-color: var(--danger-line); color: var(--danger-ink); animation: msg-in .22s var(--ease), shake .32s ease-in-out .05s; }
.scan-msg.bad .scan-msg-ico { background: var(--danger); }
.scan-msg.bad .scan-msg-sub { color: #991b1b; }
.scan-msg.info { background: var(--tint); border-color: var(--border); color: var(--text); }
.scan-msg.info .scan-msg-ico { background: var(--subtle); color: var(--text-2); border: 1px solid var(--border); }
.scan-msg.info .scan-msg-sub { color: var(--muted); }

/* items */
.data.items-table td { vertical-align: top; padding-top: 12px; padding-bottom: 12px; }
.data.items-table td.price-cell { padding-top: 6px; }
.data.items-table td.act { padding-top: 8px; }
.data.items-table tr.empty-row > td { padding: 0; }
.rm-line { color: var(--faint); }
.rm-line:hover { color: var(--danger); background: var(--danger-soft); }
.items-table .p-name { font-weight: 500; }
.items-table .p-code { margin-left: 6px; font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.items-table .qty { font-weight: 600; font-size: 14px; }
.items-table .amt { font-weight: 500; }
.price-input { width: 112px; height: 32px; padding: 0 8px; text-align: right; font-variant-numeric: tabular-nums; font-size: 13.5px; }
tr.flash > td { animation: row-flash 1.6s ease-out; }
.chip.new { animation: chip-flash 1.8s ease-out; }

/* summary column */
.pos-side { align-self: stretch; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.panel-top { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.panel-sec { padding: 16px 20px 4px; }
.panel-sec + .panel-sec { border-top: 1px solid var(--border-soft); }
.panel-sec-title { display: flex; align-items: center; justify-content: space-between; margin: 0 0 12px; font-size: 12px; font-weight: 500; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.panel-sec .field { margin-bottom: 12px; }
.panel-sec .row { gap: 10px; }
.panel-sec .row > * { min-width: 120px; }
/* totals + CTA: docks to the bottom of the screen while the party / order form scrolls under it */
.card.receipt {
  position: sticky; bottom: 16px; z-index: 6; margin-top: auto;
  padding: 16px 20px 18px; background: var(--surface);
  transition: box-shadow .18s var(--ease), border-color .18s var(--ease);
}
/* docked = bottom sheet: page-coloured band hides content in the gap below, shadow falls upward onto the form */
.card.receipt.docked { border-color: #d4d4da; box-shadow: 0 -16px 32px -16px rgba(24, 24, 27, .3), 0 1px 3px rgba(24, 24, 27, .06); }
.card.receipt.docked::after { content: ""; position: absolute; left: -2px; right: -2px; top: calc(100% + 1px); height: 17px; background: var(--bg); }
.receipt .btn.xl { margin-top: 14px; }
.receipt-end { height: 1px; margin-top: -17px; }
@media (min-width: 1024px) { html:has(.pos-side) { scroll-padding-bottom: 360px; } }
#linked:not(.hidden) { display: flex; align-items: center; gap: 8px; margin: -4px 0 12px; }
#taxmode { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 0 0 14px; padding: 8px 10px; font-size: 12.5px; color: var(--text-2); background: var(--tint); border: 1px solid var(--border-soft); border-radius: 8px; }
#taxmode b { color: var(--text); }
#taxmode svg { width: 14px; height: 14px; color: var(--muted); }
.inline-select { width: auto; height: 28px; padding: 0 28px 0 8px; font-size: 12.5px; background-position: right 7px center; }
.items-empty-hint { display: inline-flex; align-items: center; gap: 6px; }

@media (min-width: 1024px) and (max-width: 1279px) {
  .pos { grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; }
  .pos .col-hsn { display: none; }
  .price-input { width: 96px; }
  .panel-sec, .receipt { padding-left: 16px; padding-right: 16px; }
}
@media (max-width: 1023px) {
  .pos { grid-template-columns: minmax(0, 1fr); }
  .pos-side { align-self: auto; }
  .card.receipt { position: static; margin-top: 0; }
  .receipt-end { display: none; }
}
@media (max-width: 640px) {
  .scan-field { height: 56px; padding-left: 14px; gap: 8px; }
  .scan-field input { font-size: 18px; }
  .scan-field input::placeholder { font-size: 15px; }
  .scan-field .btn { --h: 40px; padding: 0 14px; }
  .scan-hint .kbd-hint { display: none; }
}
@media (max-width: 480px) {
  #scan-add { width: 44px; padding: 0; }
  #scan-add .btn-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  #scan-add svg { margin: 0; width: 20px; height: 20px; }
  .scan-field { gap: 10px; padding-left: 12px; }
  .scan-field > svg { width: 20px; height: 20px; }
}

/* ============================================================== LOGIN */
.login-page { background: var(--bg); }
.login-wrap {
  position: relative; min-height: 100vh; min-height: 100dvh;
  display: grid; place-items: center; padding: 32px 16px;
  isolation: isolate;
}
.login-wrap::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background-image:
    linear-gradient(to right, rgba(24, 24, 27, .045) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(24, 24, 27, .045) 1px, transparent 1px);
  background-size: 32px 32px;
  -webkit-mask-image: radial-gradient(ellipse 60% 55% at 50% 45%, #000 30%, transparent 100%);
  mask-image: radial-gradient(ellipse 60% 55% at 50% 45%, #000 30%, transparent 100%);
}
.login-box { width: 100%; max-width: 380px; animation: fade-up .35s var(--ease); }
.login-brand { display: flex; flex-direction: column; align-items: center; text-align: center; margin-bottom: 24px; }
.login-logo { display: block; height: 56px; width: auto; border-radius: 10px; box-shadow: 0 1px 2px rgba(24, 24, 27, .08), 0 6px 16px -8px rgba(24, 58, 133, .35); }
.login-company { margin-top: 14px; font-size: 16px; font-weight: 600; letter-spacing: -.015em; color: var(--text); }
.login-tag { margin-top: 2px; font-size: 12.5px; color: var(--muted); }
.login-card { padding: 28px 28px 24px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 1px 2px rgba(24, 24, 27, .04), 0 12px 32px -16px rgba(24, 24, 27, .14); }
.login-card h1 { margin: 0; font-size: 20px; letter-spacing: -.02em; text-align: center; }
.login-sub { margin: 4px 0 22px; font-size: 13px; color: var(--muted); text-align: center; }
.login-card .btn { margin-top: 6px; }
.login-foot { margin: 16px 0 0; font-size: 12.5px; color: var(--muted); text-align: center; }

/* ============================================================ MOTION */
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-up { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes pop-up { from { opacity: 0; transform: translateY(4px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes msg-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 50% { transform: translateX(4px); } 75% { transform: translateX(-2px); } }
@keyframes ping { 0% { transform: scale(.6); opacity: .7; } 80%, 100% { transform: scale(1.6); opacity: 0; } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
@keyframes row-flash { 0%, 25% { background-color: #dcfce7; } 100% { background-color: transparent; } }
@keyframes chip-flash { 0%, 30% { background-color: #bbf7d0; border-color: #86efac; color: var(--success-ink); } 100% { background-color: var(--subtle); border-color: var(--border); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  tr.flash > td { animation: none !important; background-color: #ecfdf3; }
  .chip.new { animation: none !important; background-color: #dcfce7; }
}
.modal-body > :last-child > .field:last-child,
.modal-body > :last-child > .row:last-child > .field,
.modal-body > :last-child > .check:last-child { margin-bottom: 0; }
input[type=search]::-webkit-search-cancel-button {
  -webkit-appearance: none; appearance: none; width: 14px; height: 14px; margin-left: 6px; cursor: pointer; background: var(--muted);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.25' stroke-linecap='round'%3E%3Cpath d='M18 6 6 18M6 6l12 12'/%3E%3C/svg%3E") center / contain no-repeat;
}
