/* ==========================================================================
   WMS PRO — theme
   Indigo-ink chrome, cool paper background, and one colour per stage taken from
   textile dyes (madder, turmeric, indigo, leaf). Stage colours are the only loud
   thing in the UI and they always mean the same stage.
   ========================================================================== */

:root {
  --ink: #1d2433;
  --ink-2: #283147;
  --ink-text: #c9d1e3;
  --paper: #eef1f5;
  --surface: #ffffff;
  --surface-2: #f6f8fb;
  --line: #dde2ea;
  --text: #1d2433;
  --muted: #5d6779;
  --accent: #3546b8;
  --accent-soft: #e6e9fb;

  --st-cut: #c2410c;     --st-cut-soft: #fdebe2;
  --st-pack: #b45309;    --st-pack-soft: #fdf1dc;
  --st-disp: #1d4ed8;    --st-disp-soft: #e2eafd;
  --st-deliv: #15803d;   --st-deliv-soft: #dff3e6;
  --st-done: #475467;    --st-done-soft: #e9ecf1;
  --st-hold: #7c3aed;    --st-hold-soft: #efe7fe;
  --st-cancel: #9f1239;  --st-cancel-soft: #fbe4ea;
  --urgent: #dc2626;

  --radius: 10px;
  --radius-lg: 14px;
  --font: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-cond: "Barlow Semi Condensed", "Barlow", system-ui, sans-serif;
  --sidebar-w: 232px;
  --topbar-h: 58px;
  --bottom-h: 64px;

  --bs-body-font-family: var(--font);
  --bs-body-bg: var(--paper);
  --bs-body-color: var(--text);
  --bs-primary: var(--accent);
  --bs-primary-rgb: 53, 70, 184;
  --bs-border-color: var(--line);
  --bs-link-color: var(--accent);
  --bs-link-color-rgb: 53, 70, 184;
}

[data-bs-theme="dark"] {
  --ink: #0f1420;
  --ink-2: #1a2132;
  --paper: #141a26;
  --surface: #1c2333;
  --surface-2: #222a3c;
  --line: #2f3850;
  --text: #e6e9f0;
  --muted: #9aa4b8;
  --accent: #8b9bff;
  --accent-soft: #262e52;
  --st-cut: #fb8a5c;     --st-cut-soft: #3b2219;
  --st-pack: #f3b44c;    --st-pack-soft: #3a2c14;
  --st-disp: #7aa2ff;    --st-disp-soft: #1c2848;
  --st-deliv: #4ade80;   --st-deliv-soft: #163322;
  --st-done: #a4b0c4;    --st-done-soft: #2a3142;
  --st-hold: #b79cff;    --st-hold-soft: #2e2448;
  --st-cancel: #f47b9b;  --st-cancel-soft: #3a1b26;
  --urgent: #f87171;
  --bs-body-bg: var(--paper);
  --bs-body-color: var(--text);
  --bs-primary-rgb: 139, 155, 255;
  --bs-border-color: var(--line);
  --bs-link-color: var(--accent);
  --bs-link-color-rgb: 139, 155, 255;
}

html, body { height: 100%; }
body {
  background: var(--paper);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, .h4, .h5, .h6 { font-family: var(--font-cond); letter-spacing: .01em; }
.num { font-family: var(--font-cond); font-variant-numeric: tabular-nums; }
.inv { font-family: var(--font-cond); font-weight: 600; letter-spacing: .01em; }
a { text-decoration: none; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }

.btn { border-radius: var(--radius); font-weight: 600; }
.btn-primary { --bs-btn-bg: var(--accent); --bs-btn-border-color: var(--accent); --bs-btn-hover-bg: color-mix(in srgb, var(--accent) 88%, #000); --bs-btn-hover-border-color: transparent; --bs-btn-active-bg: color-mix(in srgb, var(--accent) 80%, #000); --bs-btn-disabled-bg: var(--accent); --bs-btn-disabled-border-color: var(--accent); }
[data-bs-theme="dark"] .btn-primary { --bs-btn-color: #10142a; --bs-btn-hover-color: #10142a; --bs-btn-active-color: #10142a; --bs-btn-disabled-color: #10142a; }
.form-control, .form-select { border-radius: var(--radius); border-color: var(--line); background-color: var(--surface); }
.form-label { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.modal-content, .offcanvas { background: var(--surface); border: 0; border-radius: var(--radius-lg); }
.dropdown-menu { border-color: var(--line); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(16, 24, 40, .14); }
.table { --bs-table-bg: transparent; --bs-table-border-color: var(--line); margin: 0; }

/* ------------------------------------------------------------ boot + brand */
.boot { position: fixed; inset: 0; display: grid; place-items: center; background: var(--ink); z-index: 2000; }
.boot-mark { width: 64px; height: 64px; border-radius: 16px; display: grid; place-items: center; font-size: 30px; color: #fff; background: var(--accent); animation: bootPulse 1.2s ease-in-out infinite; }
@keyframes bootPulse { 50% { transform: scale(.9); opacity: .7; } }

.brand { display: flex; align-items: center; gap: 10px; color: inherit; min-width: 0; }
.brand-mark { flex: 0 0 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--accent); color: #fff; font-size: 17px; }
.brand-name { font-family: var(--font-cond); font-weight: 700; font-size: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ------------------------------------------------------------ login */
.login { min-height: 100%; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { background: var(--ink); color: #fff; display: flex; flex-direction: column; justify-content: center; padding: 8vw; gap: 32px; }
.login-thread { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; max-width: 420px; }
.login-thread span { height: 10px; border-radius: 5px; background: var(--c); transform-origin: left; animation: threadIn .9s cubic-bezier(.2, .7, .2, 1) both; }
.login-thread span:nth-child(2) { animation-delay: .15s; } .login-thread span:nth-child(3) { animation-delay: .3s; } .login-thread span:nth-child(4) { animation-delay: .45s; }
@keyframes threadIn { from { transform: scaleX(0); } }
.login-art-text { font-family: var(--font-cond); font-size: clamp(28px, 3.2vw, 44px); line-height: 1.15; font-weight: 600; margin: 0; max-width: 16ch; }
.login-panel { display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 380px; }
.login-card .brand { color: var(--text); }
.otp-boxes { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.otp-box { text-align: center; font-family: var(--font-cond); font-size: 24px; font-weight: 700; padding: 10px 0; }
.seg { display: grid; grid-auto-flow: column; gap: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px; }
.seg-btn { border: 0; background: transparent; padding: 7px 10px; border-radius: 7px; font-weight: 600; color: var(--muted); font-size: 14px; }
.seg-btn.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(16, 24, 40, .12); }
@media (max-width: 860px) {
  .login { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .login-art { padding: 28px 20px; gap: 14px; }
  .login-art-text { font-size: 24px; }
}

/* ------------------------------------------------------------ shell */
.shell { display: flex; min-height: 100%; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); background: var(--ink); color: var(--ink-text);
  display: flex; flex-direction: column; z-index: 1030; transition: width .2s ease;
}
.sidebar .brand { color: #fff; }
.sidebar-top { height: var(--topbar-h); display: flex; align-items: center; justify-content: space-between; padding: 0 12px 0 16px; border-bottom: 1px solid rgba(255, 255, 255, .07); }
.side-nav { flex: 1; overflow-y: auto; padding: 12px 10px; }
.side-group { font-size: 12px; color: rgba(255, 255, 255, .42); padding: 14px 10px 6px; font-weight: 600; }
.side-link { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 8px; color: var(--ink-text); font-weight: 500; position: relative; white-space: nowrap; }
.side-link i { font-size: 18px; width: 20px; text-align: center; }
.side-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.side-link.active { background: rgba(255, 255, 255, .1); color: #fff; }
.side-link.active::before { content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--dot, var(--accent)); }
.side-link .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dot); margin-left: auto; }
.side-link .count { margin-left: auto; font-family: var(--font-cond); font-size: 13px; color: rgba(255, 255, 255, .6); }
.sidebar-foot { border-top: 1px solid rgba(255, 255, 255, .07); padding: 10px; }
.side-user { display: flex; align-items: center; gap: 10px; color: #fff; padding: 6px; border-radius: 8px; }
.side-user:hover { background: rgba(255, 255, 255, .06); }
.side-user-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.side-user-text b { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user-text small { color: rgba(255, 255, 255, .55); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar { flex: 0 0 34px; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #fff; font-weight: 700; font-family: var(--font-cond); }
.avatar-sm { width: 30px; height: 30px; flex-basis: 30px; font-size: 14px; }
.icon-btn { width: 38px; height: 38px; border: 0; border-radius: 9px; display: inline-grid; place-items: center; background: transparent; color: inherit; font-size: 18px; }
.icon-btn:hover { background: color-mix(in srgb, currentColor 8%, transparent); }
.sidebar .icon-btn { color: var(--ink-text); }

body.side-collapsed { --sidebar-w: 68px; }
body.side-collapsed .brand-name, body.side-collapsed .side-link span, body.side-collapsed .side-group,
body.side-collapsed .side-user-text, body.side-collapsed .side-link .count, body.side-collapsed .side-link .dot { display: none; }
body.side-collapsed .sidebar-top { flex-direction: column; justify-content: center; padding: 0; }
body.side-collapsed .sidebar-top .brand { display: none; }
body.side-collapsed .side-link { justify-content: center; }

.main-col { flex: 1; min-width: 0; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-height: 100vh; transition: margin-left .2s ease; }
.topbar {
  position: sticky; top: 0; z-index: 1020; height: var(--topbar-h); display: flex; align-items: center; gap: 8px;
  padding: 0 20px; background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.page-title { font-size: 21px; font-weight: 700; margin: 0; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; align-items: center; gap: 6px; }
.top-search { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0 10px; height: 38px; width: min(320px, 40vw); }
.top-search input { border: 0; outline: 0; background: transparent; width: 100%; color: var(--text); }
.view { padding: 20px; flex: 1; outline: 0; }
.view-narrow { max-width: 1100px; }

.bottom-nav { display: none; }
@media (max-width: 767.98px) {
  .sidebar { display: none; }
  .main-col { margin-left: 0; }
  .topbar { padding: 0 8px 0 12px; }
  .page-title { font-size: 19px; }
  .view { padding: 12px 12px calc(var(--bottom-h) + 20px + env(safe-area-inset-bottom)); }
  .bottom-nav {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030;
    height: calc(var(--bottom-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: var(--surface); border-top: 1px solid var(--line);
  }
  .bn-item { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); font-size: 11.5px; font-weight: 600; border: 0; background: transparent; position: relative; }
  .bn-item i { font-size: 21px; }
  .bn-item.active { color: var(--text); }
  .bn-item.active::after { content: ""; position: absolute; top: 0; left: 28%; right: 28%; height: 3px; border-radius: 0 0 3px 3px; background: var(--dot, var(--accent)); }
  .top-search { display: none !important; }
}
.sheet.offcanvas-bottom { height: auto; max-height: 85vh; border-radius: 18px 18px 0 0; }
.more-link { display: flex; align-items: center; gap: 14px; padding: 13px 4px; border-bottom: 1px solid var(--line); color: var(--text); font-weight: 600; }
.more-link i { font-size: 20px; color: var(--muted); }

/* ------------------------------------------------------------ surfaces */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-size: 17px; font-weight: 700; margin: 0; flex: 1; }
.panel-body { padding: 16px; }
.muted { color: var(--muted); }
.min-w-0 { min-width: 0; }
.small-label { font-size: 12.5px; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 40px 16px; }
.empty i { font-size: 34px; display: block; margin-bottom: 8px; opacity: .5; }
.skeleton { background: linear-gradient(90deg, var(--surface-2) 0%, var(--line) 50%, var(--surface-2) 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ------------------------------------------------------------ stage system */
.stage-chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px 2px 7px; border-radius: 99px; font-size: 12.5px; font-weight: 600; color: var(--sc); background: var(--sc-soft); white-space: nowrap; }
.stage-chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
[data-stage="Cutting"]   { --sc: var(--st-cut);    --sc-soft: var(--st-cut-soft); }
[data-stage="Packing"]   { --sc: var(--st-pack);   --sc-soft: var(--st-pack-soft); }
[data-stage="Dispatch"]  { --sc: var(--st-disp);   --sc-soft: var(--st-disp-soft); }
[data-stage="Delivery"]  { --sc: var(--st-deliv);  --sc-soft: var(--st-deliv-soft); }
[data-stage="Delivered"] { --sc: var(--st-done);   --sc-soft: var(--st-done-soft); }
[data-stage="On Hold"]   { --sc: var(--st-hold);   --sc-soft: var(--st-hold-soft); }
[data-stage="Cancelled"] { --sc: var(--st-cancel); --sc-soft: var(--st-cancel-soft); }
.urgent-tag { display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; font-weight: 700; color: var(--urgent); }
.urgent-tag i { font-size: 12px; }
.timer { display: inline-flex; align-items: center; gap: 4px; font-family: var(--font-cond); font-weight: 600; font-size: 13.5px; color: var(--muted); white-space: nowrap; }
.timer.warn { color: var(--st-pack); }
.timer.late { color: var(--urgent); }

/* The thread: an order's progress through the four stations. */
.thread { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; min-width: 90px; }
.thread > span { height: 6px; border-radius: 3px; background: var(--line); position: relative; overflow: hidden; }
.thread > span > i { position: absolute; inset: 0 auto 0 0; width: var(--p, 0%); background: var(--c); border-radius: 3px; }
.thread.lg > span { height: 10px; border-radius: 5px; }
.thread.held > span > i { background-image: repeating-linear-gradient(-45deg, transparent 0 4px, rgba(255, 255, 255, .45) 4px 7px); }
.thread-labels { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.thread-labels b { display: block; font-family: var(--font-cond); font-size: 16px; color: var(--text); }

/* ------------------------------------------------------------ station screens (cut / pack / dispatch / deliver) */
.station { --sc: var(--accent); }
.scanbar { position: sticky; top: calc(var(--topbar-h) + 8px); z-index: 10; display: flex; gap: 8px; padding: 10px; background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--sc); border-radius: var(--radius-lg); box-shadow: 0 6px 20px rgba(16, 24, 40, .06); margin-bottom: 14px; }
.scanbar input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-family: var(--font-cond); font-size: 19px; font-weight: 600; color: var(--text); padding: 0 6px; }
.scanbar input::placeholder { font-family: var(--font); font-weight: 400; font-size: 15px; color: var(--muted); }
.scanbar .btn-scan { background: var(--sc); color: #fff; border: 0; }
[data-bs-theme="dark"] .scanbar .btn-scan { color: #0f1420; }
.queue-head { display: flex; align-items: baseline; gap: 10px; margin: 4px 2px 10px; flex-wrap: wrap; }
.queue-head h2 { font-size: 18px; font-weight: 700; margin: 0; }
.queue-head .tot { color: var(--muted); font-size: 14px; }
.queue-tools { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.queue { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.q-card { text-align: left; width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px 12px 16px; position: relative; display: grid; gap: 4px; color: inherit; }
.q-card::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 4px; border-radius: 0 4px 4px 0; background: var(--sc); }
.q-card.is-urgent::before { background: var(--urgent); }
.q-card:hover { border-color: color-mix(in srgb, var(--sc) 45%, var(--line)); }
.q-card:active { transform: scale(.99); }
.q-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.q-row .grow { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-inv { font-size: 16.5px; }
.q-qty { margin-left: auto; font-family: var(--font-cond); font-weight: 700; font-size: 20px; line-height: 1; }
.q-qty small { font-size: 12px; color: var(--muted); font-weight: 600; margin-left: 2px; }
.q-meta { font-size: 13px; color: var(--muted); }
.q-card.in-manifest { opacity: .5; }
.hold-note { font-size: 12.5px; color: var(--st-hold); font-weight: 600; }

.action-head { padding: 18px 20px 6px; }
.action-head .inv { font-size: 24px; }
.qty-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0 16px; }
.qty-cell { background: var(--surface-2); border-radius: var(--radius); padding: 10px 12px; }
.qty-cell span { display: block; font-size: 12.5px; color: var(--muted); }
.qty-cell b { font-family: var(--font-cond); font-size: 22px; }
.qty-cell.hl { background: var(--sc-soft, var(--accent-soft)); }
.qty-cell.hl b { color: var(--sc, var(--accent)); }
.qty-input { font-family: var(--font-cond); font-size: 30px; font-weight: 700; text-align: center; height: 62px; }
.quick-qty { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }

/* dispatch manifest */
.disp-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(320px, 1fr); gap: 16px; align-items: start; }
.manifest { position: sticky; top: calc(var(--topbar-h) + 82px); }
.manifest-list { max-height: 48vh; overflow-y: auto; }
.m-item { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.m-item:last-child { border-bottom: 0; }
@media (max-width: 991.98px) {
  .disp-grid { grid-template-columns: 1fr; }
  .manifest { position: static; }
}
.disp-tabs { display: none; }
@media (max-width: 991.98px) {
  .disp-tabs { display: grid; margin-bottom: 12px; }
  .disp-grid[data-tab="pending"] .manifest { display: none; }
  .disp-grid[data-tab="manifest"] .pending-col { display: none; }
}

/* ------------------------------------------------------------ dashboard */
.dash { display: grid; gap: 16px; }
.pipeline { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.pipe-stage { padding: 16px 18px 18px; border-right: 1px solid var(--line); color: inherit; position: relative; display: block; }
.pipe-stage:last-child { border-right: 0; }
.pipe-stage::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 5px; background: var(--sc); }
.pipe-stage:hover { background: var(--surface-2); }
.pipe-name { font-weight: 600; color: var(--sc); display: flex; align-items: center; gap: 6px; }
.pipe-num { font-family: var(--font-cond); font-size: 46px; font-weight: 700; line-height: 1; margin: 8px 0 4px; }
.pipe-sub { font-size: 13.5px; color: var(--muted); }
.pipe-sub .u { color: var(--urgent); font-weight: 600; }
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; color: inherit; display: block; }
.stat span { font-size: 13px; color: var(--muted); }
.stat b { display: block; font-family: var(--font-cond); font-size: 26px; line-height: 1.1; }
.alert-line { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.alert-line:last-child { border-bottom: 0; }
.alert-line .bar { width: 4px; border-radius: 2px; background: var(--urgent); flex: 0 0 4px; }
.alert-line.warning .bar { background: var(--st-pack); }
.alert-line .chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.inv-link { font-family: var(--font-cond); font-weight: 600; font-size: 13px; padding: 1px 8px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); color: var(--text); }
.dash-cols { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.feed-item { display: flex; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); font-size: 14px; }
.feed-item:last-child { border-bottom: 0; }
.feed-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--sc, var(--muted)); margin-top: 6px; flex: 0 0 10px; }
@media (max-width: 991.98px) {
  .dash-cols { grid-template-columns: 1fr; }
  .pipeline { grid-template-columns: repeat(2, 1fr); }
  .pipe-stage:nth-child(2) { border-right: 0; }
  .pipe-stage:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .pipe-num { font-size: 38px; }
}

/* ------------------------------------------------------------ tables / lists */
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.tbl th { position: sticky; top: 0; background: var(--surface-2); font-weight: 600; color: var(--muted); font-size: 13px; padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; z-index: 1; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr.click { cursor: pointer; }
.tbl tbody tr.click:hover td { background: var(--surface-2); }
.tbl .r { text-align: right; }
.tbl-wrap { overflow: auto; }
.tbl tfoot td { font-weight: 700; background: var(--surface-2); border-top: 1px solid var(--line); }

.orders-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 16px; align-items: start; }
.filters { position: sticky; top: calc(var(--topbar-h) + 16px); }
.filters .panel-body { display: grid; gap: 12px; }
.filters .ms-btn { max-width: none; width: 100%; }
.stage-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; margin-bottom: 12px; scrollbar-width: none; }
.stage-tab { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 5px 12px; font-weight: 600; font-size: 13.5px; color: var(--text); white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.stage-tab .n { font-family: var(--font-cond); color: var(--muted); }
.stage-tab.active { background: var(--sc-soft, var(--accent-soft)); border-color: var(--sc, var(--accent)); color: var(--sc, var(--accent)); }
.order-cards { display: none; }
@media (max-width: 1399.98px) {
  .orders-layout { grid-template-columns: 1fr; }
  .filters { position: static; }
}
@media (max-width: 767.98px) {
  .orders-table { display: none; }
  .order-cards { display: grid; gap: 8px; }
}
.pager { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line); font-size: 14px; }

/* order journey */
.journey-head { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; }
.journey-head .inv { font-size: 28px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px 20px; }
.facts div span { display: block; font-size: 12.5px; color: var(--muted); }
.facts div b { font-weight: 600; }
.tl { list-style: none; margin: 0; padding: 0; position: relative; }
.tl::before { content: ""; position: absolute; left: 11px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.tl li { position: relative; padding: 0 0 18px 36px; }
.tl li::before { content: ""; position: absolute; left: 5px; top: 4px; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); border: 3px solid var(--sc, var(--muted)); }
.tl .when { font-size: 13px; color: var(--muted); }
.tl .gap { display: inline-block; font-size: 12px; font-weight: 600; color: var(--muted); background: var(--surface-2); border-radius: 6px; padding: 0 6px; margin-left: 6px; }

/* reports */
.rpt-filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; }
.rpt-filters .f { display: grid; gap: 2px; }
.rpt-filters .form-control, .rpt-filters .form-select, .rpt-filters .btn { height: 38px; }
.ms-btn { min-width: 130px; max-width: 200px; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-menu { min-width: 220px; max-height: 300px; overflow-y: auto; padding: 6px; }
.ms-menu label { display: flex; gap: 8px; align-items: center; padding: 5px 8px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.ms-menu label:hover { background: var(--surface-2); }
.cell-link { cursor: pointer; font-weight: 600; border-bottom: 1px dashed currentColor; }
.cell-link:hover { color: var(--accent); }
.heat { position: relative; }
.heat::after { content: ""; position: absolute; inset: 3px; border-radius: 6px; background: var(--hc, transparent); opacity: var(--ha, 0); z-index: -1; }
.tbl td.heat { z-index: 0; }

/* new order grid */
.no-grid input, .no-grid select { min-width: 90px; font-size: 13.5px; padding: 4px 6px; height: 32px; }
.no-grid td { padding: 4px; }
.no-grid input[type=checkbox] { min-width: 0; width: 1.1em; height: 1.1em; padding: 0; }
.no-grid tr.err td { background: var(--st-cancel-soft); }
.no-grid tr.ok td { background: var(--st-deliv-soft); }
.no-grid tr.dup td { background: var(--st-pack-soft); }
.wh-pick { display: flex; gap: 3px; flex-wrap: nowrap; }
.wh-pick button { border: 1px solid var(--line); background: var(--surface); border-radius: 6px; font-size: 12px; font-weight: 600; padding: 3px 6px; color: var(--muted); }
.wh-pick button.on { background: var(--accent); border-color: var(--accent); color: #fff; }

/* toasts */
.toast-stack { position: fixed; z-index: 3000; left: 50%; transform: translateX(-50%); bottom: 24px; display: grid; gap: 8px; width: min(440px, calc(100vw - 24px)); pointer-events: none; }
@media (max-width: 767.98px) { .toast-stack { bottom: calc(var(--bottom-h) + 14px + env(safe-area-inset-bottom)); } }
.t { pointer-events: auto; display: flex; gap: 10px; align-items: flex-start; background: var(--ink); color: #fff; border-radius: 12px; padding: 12px 14px; box-shadow: 0 12px 30px rgba(0, 0, 0, .25); font-size: 14.5px; animation: tIn .2s ease-out; }
.t i { font-size: 18px; line-height: 1.2; }
.t.success i { color: #4ade80; } .t.error i { color: #f87171; } .t.warning i { color: #fbbf24; } .t.info i { color: #93c5fd; }
@keyframes tIn { from { transform: translateY(10px); opacity: 0; } }

/* camera */
.cam-content { overflow: hidden; }
.cam-frame { position: relative; background: #000; aspect-ratio: 4 / 3; }
.cam-frame video { width: 100%; height: 100%; object-fit: cover; }
.cam-aim { position: absolute; left: 12%; right: 12%; top: 38%; bottom: 38%; border: 3px solid rgba(255, 255, 255, .85); border-radius: 10px; box-shadow: 0 0 0 999px rgba(0, 0, 0, .35); }

.flash-ok { animation: flashOk .6s ease-out; }
@keyframes flashOk { from { box-shadow: 0 0 0 4px var(--st-deliv); } }
