/* Best Appliances and Cell — light blue, dark blue and white */
:root {
  --navy: #0f2744;        /* drawer */
  --navy-2: #173761;
  --navy-ink: #c9d6e8;
  --blue: #1d4fa8;        /* primary actions, profit series */
  --blue-2: #3f84e5;      /* revenue series */
  --sky: #e8f1fd;         /* light blue washes */
  --sky-2: #d3e4fb;
  --bg: #f3f7fc;
  --surface: #ffffff;
  --ink: #12233a;
  --ink-2: #44556c;
  --muted: #6b7a8f;
  --line: #e1e8f1;
  --good: #15803d; --good-bg: #e7f6ec;
  --warn: #a35a00; --warn-bg: #fff3df;
  --bad: #b42318;  --bad-bg: #fdecea;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 39, 68, .05), 0 2px 10px rgba(16, 39, 68, .04);
  --drawer-w: 248px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--ink); line-height: 1.45; font-size: 15px;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
svg { display: block; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--blue-2); outline-offset: 2px; }

.screen.center { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--sky-2); border-top-color: var(--blue); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Buttons */
.btn { white-space: nowrap; font-weight: 600; border-radius: 9px; border: 1px solid transparent; padding: 9px 16px; cursor: pointer; display: inline-flex; align-items: center; gap: 10px; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: #18438f; }
.btn-google { width: 100%; justify-content: center; background: #fff; color: #1f1f1f; border-color: #cfd8e5; padding: 12px 16px; }
.btn-google:hover { background: #f5f8fc; }
.btn-google svg { width: 20px; height: 20px; }
.btn-google:disabled { opacity: .6; cursor: progress; }
.link-btn { background: none; border: 0; padding: 4px 2px; color: var(--blue); font-weight: 600; font-size: 13.5px; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.icon-btn { background: none; border: 0; padding: 8px; border-radius: 8px; cursor: pointer; }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.icon-btn:hover { background: var(--sky); }

/* Login */
.login-bg { background: linear-gradient(160deg, #173761 0%, #0f2744 60%); }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border-radius: 16px; padding: 32px 28px 24px; box-shadow: 0 20px 60px rgba(0,0,0,.3); text-align: center; }
.brand-mark { width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 14px; background: var(--sky); color: var(--blue); display: grid; place-items: center; font-weight: 800; font-size: 26px; }
.login-card h1 { font-size: 21px; margin: 0 0 4px; }
.muted { color: var(--muted); margin: 0 0 22px; }
.fine { color: var(--muted); font-size: 12.5px; margin: 16px 0 0; }
.error { color: var(--bad); background: var(--bad-bg); border: 1px solid #f6c9c4; border-radius: 9px; padding: 10px 12px; font-size: 14px; margin: 14px 0 0; text-align: left; }

/* ── Layout ─────────────────────────────── */
.app { min-height: 100vh; }
.drawer {
  position: fixed; inset: 0 auto 0 0; width: var(--drawer-w); z-index: 40;
  background: var(--navy); color: var(--navy-ink); display: flex; flex-direction: column;
}
.main-col { margin-left: var(--drawer-w); min-width: 0; }

.drawer-head { display: flex; align-items: center; gap: 10px; padding: 16px 16px 14px; border-bottom: 1px solid rgba(255,255,255,.08); }
.drawer-mark { width: 34px; height: 34px; border-radius: 9px; background: var(--sky); color: var(--blue); display: grid; place-items: center; font-weight: 800; font-size: 17px; flex: none; }
.drawer-name { color: #fff; font-weight: 700; font-size: 14.5px; line-height: 1.15; }
.drawer-name small { font-weight: 500; color: var(--navy-ink); font-size: 12.5px; }

.nav { flex: 1; overflow-y: auto; padding: 10px 10px; }
.nav-group { margin-bottom: 2px; }
.nav-link {
  width: 100%; display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 8px;
  background: none; border: 0; color: #e6edf6; font-weight: 600; font-size: 14px; text-align: left; cursor: pointer;
}
.nav-link svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; opacity: .9; }
.nav-link span { flex: 1; }
.nav-link .chev { width: 15px; height: 15px; opacity: .6; transition: transform .15s; }
.nav-link[aria-expanded="true"] .chev { transform: rotate(90deg); }
.nav-link:hover { background: rgba(255,255,255,.06); }
.nav-group.current > .nav-link, .nav-link.active { background: var(--navy-2); color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); }
.nav-sub { margin: 2px 0 6px 19px; padding-left: 12px; border-left: 1px solid rgba(255,255,255,.14); }
.nav-sub a { display: block; padding: 7px 10px; border-radius: 7px; font-size: 13.5px; color: var(--navy-ink); }
.nav-sub a:hover { color: #fff; background: rgba(255,255,255,.05); }
.nav-sub a.active { color: #fff; font-weight: 600; background: rgba(63,132,229,.22); }
.drawer-foot { padding: 10px; border-top: 1px solid rgba(255,255,255,.08); }
.nav-plain { color: var(--navy-ink); font-weight: 500; }

.scrim { position: fixed; inset: 0; background: rgba(10, 22, 40, .45); z-index: 35; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 20; height: 56px; display: flex; align-items: center; gap: 12px;
  padding: 0 24px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.menu-btn { display: none; margin-left: -8px; }
.crumb { font-size: 14px; color: var(--ink-2); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

/* Who's working */
.worker { position: relative; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 4px 8px 4px 4px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 13.5px; font-weight: 600; }
.chip:hover { background: var(--sky); }
.chip-avatar { width: 24px; height: 24px; border-radius: 50%; background: var(--sky-2); color: var(--blue); display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.chip .chev { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; opacity: .6; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 190px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(16,39,68,.14); padding: 6px; z-index: 30; }
.menu-label { margin: 4px 8px 6px; font-size: 12px; color: var(--muted); font-weight: 600; }
.menu-item { display: flex; width: 100%; align-items: center; gap: 8px; text-align: left; padding: 8px 10px; border: 0; background: none; border-radius: 7px; cursor: pointer; font-size: 14px; }
.menu-item:hover { background: var(--sky); }
.menu-item[aria-checked="true"]::after { content: "✓"; margin-left: auto; color: var(--blue); font-weight: 700; }
.menu-sub { color: var(--blue); font-size: 13px; border-top: 1px solid var(--line); border-radius: 0 0 7px 7px; margin-top: 4px; }

/* Connection status light */
.status { position: relative; display: inline-flex; align-items: center; gap: 7px; padding: 5px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; cursor: default; background: var(--sky); color: var(--ink); }
.status-dot { width: 9px; height: 9px; border-radius: 50%; }
.status.on .status-dot { background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.2); }
.status.off { background: var(--bad-bg); color: var(--bad); }
.status.off .status-dot { background: #dc2626; box-shadow: 0 0 0 3px rgba(220,38,38,.2); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px rgba(220,38,38,.08); } }
.status-tip {
  position: absolute; right: 0; top: calc(100% + 8px); width: 300px; z-index: 30;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(16,39,68,.16); padding: 12px 14px; font-weight: 400; font-size: 13px;
  opacity: 0; visibility: hidden; transform: translateY(-4px); transition: opacity .12s, transform .12s, visibility .12s;
}
.status:hover .status-tip, .status:focus .status-tip, .status:focus-within .status-tip { opacity: 1; visibility: visible; transform: none; }
.status-tip strong { display: block; font-size: 14px; margin-bottom: 3px; }
.status-tip > span { display: block; color: var(--ink-2); }
.tip-grid { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 10px 0 0; padding-top: 10px; border-top: 1px solid var(--line); }
.tip-grid dt { color: var(--muted); }
.tip-grid dd { margin: 0; font-weight: 600; text-align: right; overflow-wrap: anywhere; }

/* ── Page ───────────────────────────────── */
.view { max-width: 1840px; margin: 0 auto; padding: 22px 24px 48px; outline: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.eyebrow { margin: 0; color: var(--muted); font-size: 13.5px; font-weight: 600; }
.page-head h1 { margin: 2px 0 0; font-size: 24px; letter-spacing: -.015em; }

/* Segmented control (time span) */
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; padding: 7px 14px; border-radius: 7px; font-size: 13.5px; font-weight: 600; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.seg button:hover { background: var(--sky); }
.seg button[aria-selected="true"] { background: var(--blue); color: #fff; }
.seg-sm button { padding: 5px 10px; font-size: 13px; }

.note { display: flex; gap: 10px; align-items: flex-start; background: var(--sky); border: 1px solid var(--sky-2); color: var(--ink-2); border-radius: 10px; padding: 10px 14px; font-size: 13.5px; margin-bottom: 16px; }
.note svg { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--blue); stroke-width: 2; stroke-linecap: round; margin-top: 1px; }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.kpi-label { margin: 0; font-size: 13px; color: var(--muted); font-weight: 600; }
.kpi-value { margin: 4px 0 6px; font-size: 26px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi-foot { margin: 0; font-size: 12.5px; color: var(--ink-2); }
.delta { font-weight: 700; }
.delta.up { color: var(--good); }
.delta.down { color: var(--bad); }
.delta.flat, .delta-vs { color: var(--muted); font-weight: 500; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card h2 { margin: 0; font-size: 15.5px; display: flex; align-items: center; gap: 8px; }
.card-sub { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.card-tools { display: flex; align-items: center; gap: 12px; }
.card-link { display: inline-block; margin-top: 8px; font-size: 13.5px; font-weight: 600; color: var(--blue); }
.card-link:hover { text-decoration: underline; }
.count { background: var(--sky); color: var(--blue); font-size: 12px; border-radius: 999px; padding: 1px 8px; font-weight: 700; }
.count:empty { display: none; }

/* Chart */
.chart-card { margin-bottom: 16px; }
.legend { display: flex; gap: 16px; margin: 12px 0 2px; font-size: 13px; color: var(--ink-2); min-height: 18px; }
.key { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.sw.s1, .bar.s1, .ln.s1 { background: var(--blue-2); fill: var(--blue-2); }
.sw.s2, .bar.s2, .ln.s2 { background: var(--blue); fill: var(--blue); }
.chart { position: relative; margin-top: 6px; transition: opacity .15s; }
.chart.refreshing { opacity: .55; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .grid.base { stroke: #c4cfdd; }
.chart text { font-size: 11.5px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.chart .xtick.future { fill: #b3bfce; }
.chart .hit { fill: transparent; cursor: default; outline: none; }
.chart .hit.on { fill: rgba(63, 132, 229, .08); }
.tip { position: absolute; top: 0; pointer-events: none; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; box-shadow: 0 8px 24px rgba(16,39,68,.14); padding: 8px 12px; font-size: 13px; min-width: 150px; }
.tip-title { font-weight: 700; margin-bottom: 4px; }
.tip-row { display: flex; align-items: center; gap: 8px; }
.tip-row strong { font-variant-numeric: tabular-nums; }
.tip-row span { color: var(--muted); }
.ln { width: 12px; height: 3px; border-radius: 2px; display: inline-block; }
.ln.none { background: transparent; }
.chart-table { margin-top: 10px; max-height: 300px; overflow: auto; border: 1px solid var(--line); border-radius: 9px; }
.chart-table table { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.chart-table th, .chart-table td { padding: 7px 12px; text-align: right; border-bottom: 1px solid var(--line); }
.chart-table th:first-child, .chart-table td:first-child { text-align: left; }
.chart-table th { position: sticky; top: 0; background: var(--sky); font-weight: 600; color: var(--ink-2); }

/* Lists */
.lists { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.list-card { min-width: 0; }
.rows { list-style: none; margin: 10px 0 0; padding: 0; }
.rows li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); }
.rows li:first-child { border-top: 0; }
.r-main { min-width: 0; }
.r-main strong { display: block; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r-main span { display: block; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rows .empty { color: var(--muted); font-size: 13.5px; justify-content: flex-start; }
.badge { flex: none; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.badge.good { background: var(--good-bg); color: var(--good); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.info { background: var(--sky); color: var(--blue); }

/* Coming-soon page */
.soon { text-align: center; padding: 48px 24px; max-width: 560px; }
.soon-icon { width: 52px; height: 52px; margin: 0 auto 12px; border-radius: 14px; background: var(--sky); color: var(--blue); display: grid; place-items: center; }
.soon-icon svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.soon h2 { justify-content: center; font-size: 18px; margin-bottom: 6px; }
.soon p { color: var(--ink-2); margin: 0 0 18px; }

/* ── Forms, tables & shared bits ─────────── */
.btn-ghost { background: var(--surface); color: var(--blue); border-color: var(--sky-2); }
.btn-ghost:hover { background: var(--sky); }
.btn-sm { padding: 6px 12px; font-size: 13.5px; }
.btn-danger-ghost { background: none; color: var(--bad); border-color: #f3c7c2; }
.btn-danger-ghost:hover { background: var(--bad-bg); }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--blue); font-weight: 600; font-size: 13.5px; margin-bottom: 8px; }
.back svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.back:hover { text-decoration: underline; }
.lnk { color: var(--blue); font-weight: 500; }
.lnk:hover { text-decoration: underline; }
.muted-sm { color: var(--muted); font-size: 13px; }
.mono { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 12.5px; }
.sub-note { margin: 4px 0 0; color: var(--ink-2); font-size: 14px; max-width: 70ch; }

.input { width: 100%; font: inherit; font-size: 14px; color: var(--ink); background: #fff; border: 1px solid #cfd9e6; border-radius: 8px; padding: 8px 10px; transition: border-color .12s, box-shadow .12s; }
.input:focus { outline: none; border-color: var(--blue-2); box-shadow: 0 0 0 3px rgba(63,132,229,.18); }
.input.num { text-align: right; font-variant-numeric: tabular-nums; }
textarea.input { resize: vertical; min-height: 38px; }
select.input { appearance: none; padding-right: 30px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7a8f' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; background-size: 16px; }
.input.xs { width: 72px; padding: 5px 8px; text-align: right; }
.input.search { max-width: 380px; padding-left: 34px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7a8f' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E") no-repeat 10px center / 16px; }
.input.search.sm { max-width: 260px; padding-top: 6px; padding-bottom: 6px; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; color: var(--ink-2); min-width: 0; }
.req { color: var(--bad); }
.lbl { display: block; }
.input::placeholder { color: #a7b3c2; }
.rec .table { min-width: 900px; }
.items-table .mono { white-space: nowrap; }
.opt { color: var(--muted); font-weight: 400; }
.inline-field { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.with-btn { display: flex; gap: 8px; }
.with-btn .btn { flex: none; }
.form { display: flex; flex-direction: column; gap: 16px; }
.form-title { font-size: 15px; margin: 0 0 12px; }
.form-title.mt { margin-top: 20px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.span-2 { grid-column: span 2; }
.form-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.form-actions .spacer { flex: 1; }
.sticky-actions { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 30%); padding: 14px 0 10px; z-index: 5; }

.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #f8fafd; }
.table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table tr.click { cursor: pointer; }
.table tr.click:hover td, .table tr.click:focus td { background: var(--sky); outline: none; }
.table.tight td { padding: 7px 10px; font-size: 13.5px; }
.table tfoot td { border-bottom: 0; color: var(--ink-2); font-size: 13px; }
.table .serials { line-height: 1.6; }
.empty-cell, .empty-block { text-align: center; color: var(--muted); padding: 28px 12px !important; }

/* Supplier form contacts */
.contacts { display: flex; flex-direction: column; gap: 10px; }
.contact-row { display: grid; grid-template-columns: 1.2fr 1fr 1.3fr 1.2fr auto; gap: 10px; align-items: end; padding: 12px; background: #f8fafd; border: 1px solid var(--line); border-radius: 10px; }
.icon-btn.remove, .item-actions .icon-btn { color: var(--muted); }
.icon-btn.remove:hover, .item-actions [data-act="del"]:hover { color: var(--bad); background: var(--bad-bg); }

/* Supplier page */
.sup-top { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; margin-bottom: 16px; align-items: start; }
.info-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 20px; margin: 0; }
.info-grid dt { font-size: 12.5px; color: var(--muted); }
.info-grid dd { margin: 2px 0 0; font-weight: 600; overflow-wrap: anywhere; }
.contact-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.contact-card { display: flex; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #f8fafd; min-width: 0; }
.contact-card > div:last-child { min-width: 0; }
.cc-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--sky-2); color: var(--blue); display: grid; place-items: center; font-weight: 700; flex: none; }
.cc-role { display: block; font-size: 12.5px; color: var(--muted); }
.cc-lines { font-size: 13px; margin-top: 2px; overflow-wrap: anywhere; }
.mini-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.mini-kpis .kpi-value { font-size: 22px; }
.mini-kpis .kv-sm { font-size: 17px; margin-top: 8px; }
.day { margin-top: 18px; }
.day-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-bottom: 6px; border-bottom: 2px solid var(--sky-2); }
.day-head h3 { margin: 0; font-size: 15px; }
.day-total { font-weight: 700; font-variant-numeric: tabular-nums; }
.rec { margin-top: 10px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.rec-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; background: #f8fafd; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.rec .table th { background: #fff; }
.rec-note { margin: 0; padding: 8px 12px; font-size: 13px; color: var(--ink-2); border-top: 1px solid var(--line); background: #fffdf5; }

/* Receive stock items */
.items { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.item { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #f8fafd; }
.item-num { width: 24px; height: 24px; border-radius: 50%; background: var(--sky-2); color: var(--blue); font-size: 12px; font-weight: 700; display: grid; place-items: center; margin-top: 22px; }
.item-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 10px; }
.item-grid > .field { grid-column: span 3; }
.item-grid > .f-title { grid-column: span 3; }
.item-body { min-width: 0; }
.item-grid > .f-notes { grid-column: span 4; }
.item-grid > .f-qty { grid-column: span 1; }
.item-grid > .f-cost { grid-column: span 2; }
.item-grid > .f-tax { grid-column: span 1; }
.item-grid > .f-out { grid-column: span 2; }
.f-tax.check { flex-direction: row; align-items: center; gap: 6px; margin-top: 22px; white-space: nowrap; }
.f-tax input { width: 16px; height: 16px; accent-color: var(--blue); }
.f-out output { display: block; padding: 8px 0; font-size: 14px; font-weight: 700; color: var(--ink); text-align: right; font-variant-numeric: tabular-nums; }
.f-out span { text-align: right; }
.serial-warn { color: var(--warn); font-weight: 500; font-size: 12px; }
.item-actions { display: flex; flex-direction: column; gap: 2px; margin-top: 18px; }
.item-actions .icon-btn { padding: 6px; }
.item-actions .icon-btn svg { width: 18px; height: 18px; stroke-width: 1.8; }
.add-item { margin-top: 12px; width: 100%; justify-content: center; border-style: dashed; }
.totals-card { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 24px; align-items: start; }
.totals { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.totals div { display: flex; justify-content: space-between; font-size: 14px; }
.totals dt { color: var(--ink-2); }
.totals dd { margin: 0; font-variant-numeric: tabular-nums; font-weight: 600; }
.totals .grand { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 2px; font-size: 17px; }
.totals .grand dd { font-weight: 800; }

/* Who did it / history */
.byline { margin: 4px 0 0; font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.byline strong { color: var(--ink-2); }
.history { list-style: none; margin: 0; padding: 0; font-size: 13.5px; }
.history li { padding: 7px 0; border-top: 1px solid var(--line); }
.history li:first-child { border-top: 0; }
.history li span { color: var(--muted); margin-left: 4px; }
.history-card { margin-top: 16px; }
.who-saves { white-space: nowrap; }
.note-info { background: #fff8e8; border-color: #f3dfb3; }

/* Lists & tables extras */
.sub { display: block; font-size: 12.5px; color: var(--muted); font-weight: 400; }
.nowrap { white-space: nowrap; }
.late { color: var(--bad); font-weight: 600; }
.badge.muted { background: #eef1f5; color: var(--muted); }
.seg-n { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 999px; background: rgba(29,79,168,.1); font-size: 11.5px; margin-left: 2px; }
.seg button[aria-selected="true"] .seg-n { background: rgba(255,255,255,.25); }
.toolbar.wrap { flex-wrap: wrap; justify-content: space-between; }
.toolbar .seg { max-width: 100%; overflow-x: auto; min-width: 0; flex-shrink: 1; }
.toolbar > * { min-width: 0; }
.comments { font-size: 12.5px; color: var(--ink-2); min-width: 120px; }
.rec-foot { text-align: right; padding: 8px 12px; font-size: 13px; color: var(--ink-2); border-top: 1px solid var(--line); }
.rec-foot strong { color: var(--ink); margin-left: 6px; }
.rec-links { display: flex; gap: 14px; }
.span-all { grid-column: 1 / -1; }
.sample-tag { font-size: 11px; font-weight: 600; color: var(--muted); background: #eef1f5; border-radius: 999px; padding: 1px 7px; }
a.r-main { display: block; color: inherit; }
a.r-main:hover strong { color: var(--blue); text-decoration: underline; }
.activity .r-main a { color: inherit; }
.activity .r-main a:hover { color: var(--blue); }
.act-label { color: var(--ink-2); font-weight: 400; }
.activity strong { display: inline !important; }
.activity .r-main > a, .activity .r-main > div { white-space: normal; font-size: 14px; }

/* All purchases */
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 12px; }
.filters .field { min-width: 150px; }
.filters .field.grow { flex: 1; min-width: 220px; }
.filters .input.search { max-width: none; }
.summary { display: flex; flex-wrap: wrap; gap: 6px 20px; font-size: 13.5px; color: var(--ink-2); padding: 10px 12px; background: var(--sky); border-radius: 9px; margin-bottom: 12px; }
.summary:empty { display: none; }
.sheet-wrap { border: 1px solid var(--line); border-radius: 10px; max-height: 70vh; overflow: auto; }
.table.sheet { font-size: 13px; min-width: 1200px; }
.table.sheet th { position: sticky; top: 0; z-index: 1; }
.table.sheet td { padding: 6px 10px; border-bottom: 0; }
.table.sheet tr.first td { border-top: 1px solid #d6dfeb; }
.table.sheet tr.band td { background: #fafcff; }
.table.sheet tr.click:hover td { background: var(--sky); }
.more { text-align: center; margin-top: 12px; }

/* Serial numbers / IMEI per unit */
.units-box { margin-top: 10px; }
.units-toggle { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 4px 0; color: var(--blue); font-weight: 600; font-size: 13.5px; cursor: pointer; }
.units-toggle svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.4; transition: transform .15s; }
.units-toggle[aria-expanded="true"] svg { transform: rotate(90deg); }
.units-count { color: var(--muted); font-weight: 500; }
.units { margin-top: 6px; display: flex; flex-direction: column; gap: 6px; max-width: 640px; max-height: 340px; overflow-y: auto; padding-right: 4px; }
.units-head, .unit { display: grid; grid-template-columns: 26px minmax(0, 1fr) minmax(0, 1fr); gap: 8px; align-items: center; }
.units-head { font-size: 12px; font-weight: 600; color: var(--muted); }
.unit-n { font-size: 12px; color: var(--muted); text-align: right; }
.unit .input { padding: 6px 9px; font-size: 13px; }

/* Delivery document + printing */
.doc-head { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; padding-bottom: 14px; border-bottom: 2px solid var(--navy); }
.doc-store { font-size: 20px; font-weight: 800; color: var(--navy); }
.doc-type { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; margin-top: 2px; }
.doc-meta { display: grid; grid-template-columns: auto auto; gap: 4px 18px; margin: 0; font-size: 13.5px; }
.doc-meta div { display: contents; }
.doc-meta dt { color: var(--muted); }
.doc-meta dd { margin: 0; font-weight: 600; text-align: right; }
.doc-party { padding: 14px 0; }
.doc-label { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.doc-party-name { font-size: 16px; font-weight: 700; margin-top: 2px; }
.doc-party-lines { font-size: 13.5px; color: var(--ink-2); }
.print-table { border: 1px solid var(--line); border-radius: 8px; }
.doc-bottom { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 24px; margin-top: 16px; }
.doc-notes p { margin: 4px 0 0; font-size: 14px; }
.sign { margin-top: 28px; font-size: 13.5px; color: var(--ink-2); }
.doc-foot { margin-top: 18px; font-size: 11.5px; color: var(--muted); text-align: center; }

/* Serial lookup */
.lookup-card { margin-bottom: 16px; }
.lookup { display: flex; gap: 10px; margin-bottom: 6px; }
.lookup-input { font-size: 18px; padding: 12px 14px; }
.unit-card { margin-bottom: 14px; }
.unit-top { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.card .unit-title { font-size: 21px; margin: 2px 0 4px; }
.cost-box { background: var(--sky); border: 1px solid var(--sky-2); border-radius: 12px; padding: 12px 18px; text-align: right; min-width: 180px; }
.cost-box span { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.cost-box strong { display: block; font-size: 28px; color: var(--blue); letter-spacing: -.02em; }
.cost-box small { color: var(--muted); }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px 20px; margin: 14px 0 0; }
.facts dt { font-size: 12.5px; color: var(--muted); }
.facts dd { margin: 2px 0 0; font-weight: 600; overflow-wrap: anywhere; }
.unit-actions { margin-top: 14px; }

/* Repairs */
.mt16 { margin-top: 16px; }
.span-4 { grid-column: 1 / -1; }
.radio-row { display: flex; gap: 16px; flex-wrap: wrap; padding-top: 8px; font-weight: 500; color: var(--ink); }
.radio-row label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.radio-row input { accent-color: var(--blue); width: 16px; height: 16px; }
.tech-box { margin-top: 14px; padding: 14px; border-radius: 10px; background: #f8fafd; border: 1px solid var(--line); }
.edit-hint { align-self: end; }
.money-sum { display: flex; flex-wrap: wrap; gap: 10px 28px; margin: 16px 0 0; padding-top: 12px; border-top: 1px solid var(--line); }
.money-sum dt { font-size: 12.5px; color: var(--muted); }
.money-sum dd { margin: 2px 0 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.money-sum .strong dd { color: var(--blue); }
.money-sum .internal { padding-left: 16px; border-left: 1px dashed var(--line); }
.money-sum .internal dt::after { content: " (ours)"; }
.issue-cell { max-width: 260px; }
.owing { color: var(--bad); }
.warn-t { color: var(--warn); font-weight: 600; font-size: 12.5px; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.pager-btns { display: flex; align-items: center; gap: 10px; }
.btn:disabled { opacity: .45; cursor: default; }
.menu-wrap { position: relative; }
.menu-wrap .menu { min-width: 280px; }
.status-card { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.status-steps { display: flex; flex-wrap: wrap; gap: 6px; }
.step { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 14px; font-weight: 600; font-size: 13.5px; color: var(--ink-2); cursor: pointer; }
.step:hover { background: var(--sky); }
.step.on { background: var(--blue); border-color: var(--blue); color: #fff; }
.quick { display: flex; gap: 8px; flex-wrap: wrap; }
.ticket-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.big-name { font-size: 17px; font-weight: 700; margin: 0 0 4px; }
.issue { white-space: pre-wrap; margin: 0; }
.money { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.money div { display: flex; justify-content: space-between; gap: 12px; font-size: 14.5px; }
.money dt { color: var(--ink-2); }
.money dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.money .grand { border-top: 1px solid var(--line); padding-top: 8px; font-size: 18px; }
.money .grand dd { font-weight: 800; }
.money.sm div { font-size: 13.5px; }
.internal-box { margin-top: 14px; padding: 10px 12px; border: 1px dashed #c9d4e3; border-radius: 10px; background: #fbfcfe; }
.internal-box .doc-label { margin-bottom: 6px; }
.sub-title { font-size: 14px; margin: 16px 0 4px; }
.inline-form { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.inline-form .num { width: 110px; flex: none; }
.inline-form .input:not(.num) { flex: 1; min-width: 120px; }
.icon-btn.sm { padding: 4px; color: var(--muted); }
.icon-btn.sm svg { width: 16px; height: 16px; }
.icon-btn.sm:hover { color: var(--bad); background: var(--bad-bg); }
.row-actions { display: flex; align-items: center; gap: 10px; flex: none; }
.link-btn.danger { color: var(--bad); }
.part-form { margin-top: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: #f8fafd; }
.part-form .form-actions { margin-top: 12px; }
.check-line { grid-column: span 1; display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: var(--ink-2); padding-top: 20px; }
.check-line input { accent-color: var(--blue); width: 16px; height: 16px; flex: none; }
.cmt-form { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; margin-bottom: 10px; }
.comments-list { list-style: none; margin: 0; padding: 0; }
.comments-list li { padding: 10px 0; border-top: 1px solid var(--line); }
.comments-list p { margin: 4px 0 0; white-space: pre-wrap; font-size: 14px; }
.c-head { display: flex; gap: 8px; align-items: baseline; font-size: 13px; flex-wrap: wrap; }
.c-head span { color: var(--muted); }
.c-head .link-btn { font-size: 12.5px; padding: 0; }
.c-head .link-btn:first-of-type { margin-left: auto; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--sky-2); }
.timeline li { position: relative; padding: 0 0 14px 14px; display: grid; grid-template-columns: 110px minmax(0, 1fr) auto; gap: 10px; font-size: 14px; }
.timeline li::before { content: ""; position: absolute; left: -21px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 3px #fff; }
.t-date { color: var(--muted); font-size: 13px; white-space: nowrap; }
.t-by { color: var(--muted); font-size: 12.5px; }
.rep-tabs { margin: 10px 0 0; max-width: 100%; overflow-x: auto; }

/* Customer suggestions */
.field { position: relative; }
.suggest { position: absolute; top: 100%; left: 0; z-index: 25; margin-top: 4px; min-width: 100%; width: max-content; max-width: min(460px, 90vw); background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 30px rgba(16,39,68,.16); padding: 4px; }
.suggest-h { font-size: 11.5px; color: var(--muted); padding: 4px 8px; font-weight: 600; }
.suggest-item { display: block; width: 100%; text-align: left; border: 0; background: none; border-radius: 7px; padding: 7px 9px; cursor: pointer; font-weight: 400; }
.suggest-item strong { display: block; font-size: 14px; color: var(--ink); }
.suggest-item span { display: block; font-size: 12.5px; color: var(--muted); }
.suggest-item:hover, .suggest-item.on { background: var(--sky); }
.check-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.check-inline input { width: 16px; height: 16px; accent-color: var(--blue); }
.tax-chip { font-size: 12px; font-weight: 600; color: var(--muted); background: #eef1f5; border-radius: 999px; padding: 1px 7px; margin-left: 4px; }
.pay-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.pay-form .num { width: 110px; }
.pay-form select { width: 140px; }
.pay-form input[name=note] { flex: 1; min-width: 120px; }
.pay-form #pay-tax { flex-basis: 100%; }
.order-hint { grid-column: span 1; align-self: end; margin: 0; }
.radio-row.big { gap: 24px; font-size: 14.5px; padding-top: 0; }
.span-3 { grid-column: span 3; }
.kpis.three { grid-template-columns: repeat(3, 1fr); }

/* IPTV */
.mt8 { margin-top: 8px; }
.owe-banner { display: flex; align-items: center; gap: 10px; background: var(--bad-bg); border: 1px solid #f3c7c2; color: var(--bad); border-radius: 10px; padding: 10px 14px; margin-bottom: 16px; font-size: 14.5px; }
.add-months { margin-bottom: 16px; border-color: var(--sky-2); box-shadow: 0 0 0 3px rgba(63,132,229,.1); }
.months-sum { margin: 10px 0 0; font-size: 13.5px; }
.dev-hist { margin-top: 10px; font-size: 13px; }
.dev-hist summary { cursor: pointer; color: var(--blue); font-weight: 600; }
.dev-hist ul { margin: 6px 0 0; padding-left: 18px; }
.table td.details { font-size: 12.5px; color: var(--ink-2); min-width: 160px; }

.acct-tag { display: inline-block; font-size: 12px; font-weight: 600; color: var(--blue); background: var(--sky); border-radius: 999px; padding: 1px 8px; margin-left: 4px; }
.siblings { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.sib { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; padding: 3px 4px 3px 10px; font-size: 13px; background: #f8fafd; }
.sib:hover { border-color: var(--blue-2); }

.kpis.four { grid-template-columns: repeat(4, 1fr); margin: 10px 0 14px; }
.kpis.four .kpi { box-shadow: none; background: #f8fafd; }
.kpi-value.profit { color: var(--good); }
.kpi-value.owing { color: var(--bad); }
.months-sum .ours { color: var(--muted); }

/* Marketplace orders */
.sale-items { display: flex; flex-direction: column; gap: 8px; }
.sale-item { display: grid; grid-template-columns: minmax(0, 3fr) 70px repeat(5, minmax(0, 1fr)) auto; gap: 10px; align-items: end; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #f8fafd; }
.sale-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.money .sub-total { border-bottom: 1px dashed var(--line); padding-bottom: 8px; margin-bottom: 2px; font-weight: 600; }
.money small { font-weight: 600; color: var(--muted); font-size: 12px; }
.money .opt { font-size: 12px; }
.input.prog { padding: 4px 26px 4px 8px; font-size: 13px; min-width: 150px; }
.input.xs-sel { width: auto; display: inline-block; padding: 3px 24px 3px 8px; font-size: 13px; }
.kpis.four .kpi-foot { font-size: 12px; }

.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.grid-3 .span-3 { grid-column: 1 / -1; }
.table tr.age-yellow td { background: #fff9db; }
.table tr.age-orange td { background: #ffe8cc; }
.table tr.age-red td { background: #ffdede; }
.table tr.click.age-yellow:hover td { background: #fff3bf; }
.table tr.click.age-orange:hover td { background: #ffd8a8; }
.table tr.click.age-red:hover td { background: #ffc9c9; }
.age-key { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-bottom: 10px; }
.age-key i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: 4px; border: 1px solid rgba(0,0,0,.08); }
.age-key .age-yellow { background: #fff9db; } .age-key .age-orange { background: #ffe8cc; } .age-key .age-red { background: #ffdede; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 11px 18px; border-radius: 10px; font-size: 14px; box-shadow: 0 8px 30px rgba(0,0,0,.25); z-index: 60; max-width: calc(100vw - 32px); }

/* ── Responsive ─────────────────────────── */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .kpis.three { grid-template-columns: repeat(3, 1fr); }
  .item-grid > .field, .item-grid > .f-title { grid-column: span 6; }
  .item-grid > .f-notes { grid-column: span 12; }
  .item-grid > .f-qty, .item-grid > .f-tax { grid-column: span 2; }
  .item-grid > .f-cost, .item-grid > .f-out { grid-column: span 3; }
  .sup-top { grid-template-columns: minmax(0, 1fr); }
  .mini-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 1100px) { .sale-grid { grid-template-columns: minmax(0, 1fr); } .sale-item { grid-template-columns: repeat(6, minmax(0, 1fr)) auto; } .sale-item .f-prod { grid-column: 1 / -1; } }
@media (max-width: 900px) {
  .ticket-grid { grid-template-columns: minmax(0, 1fr); }
  .drawer { transform: translateX(-100%); transition: transform .2s ease; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  body.drawer-open .drawer { transform: none; }
  .main-col { margin-left: 0; }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 0 16px; }
  .view { padding: 18px 16px 40px; }
  .lists { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .crumb { display: none; }
  #worker-name { display: none; }
  .chip { padding: 4px 6px 4px 4px; }
  .page-head h1 { font-size: 21px; }
  .page-head .seg { width: 100%; }
  .page-head .seg button { flex: 1; padding: 7px 4px; }
  .kpi-value { font-size: 22px; }
  .kpi { padding: 14px; }
  .card-tools { width: 100%; justify-content: space-between; flex-wrap: wrap; }
  .grid-2, .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .span-2, .span-3 { grid-column: auto; }
  .kpis.three { grid-template-columns: 1fr; }
  .who-saves { display: none; }
  .check-inline { white-space: normal; align-items: flex-start; }
  .check-inline input { flex: none; margin-top: 2px; }
  .kpis.four { grid-template-columns: repeat(2, 1fr); }
  .sale-item { grid-template-columns: repeat(3, minmax(0, 1fr)) auto; }
  .sale-item .remove { grid-column: 4; grid-row: 1; }
  .sale-item .f-prod { grid-column: 1 / 4 !important; }
  .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .sale-item .f-prod { grid-column: 1 / -1; }
  .contact-row { grid-template-columns: minmax(0, 1fr) auto; }
  .contact-row .field { grid-column: 1; }
  .contact-row .remove { grid-column: 2; grid-row: 1; }
  .info-grid { grid-template-columns: minmax(0, 1fr); }
  .mini-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .item { grid-template-columns: minmax(0, 1fr) auto; }
  .item-num { display: none; }
  .item-grid > .field, .item-grid > .f-title { grid-column: span 12; }
  .item-grid > .f-qty { grid-column: span 4; }
  .item-grid > .f-cost { grid-column: span 8; }
  .item-grid > .f-tax { grid-column: span 4; }
  .item-grid > .f-out { grid-column: span 4; }
  .totals-card, .doc-bottom, .ticket-grid { grid-template-columns: minmax(0, 1fr); }
  .timeline li { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .lookup { flex-direction: column; }
  .cost-box { text-align: left; width: 100%; }
  .units-head, .unit { grid-template-columns: 20px minmax(0, 1fr) minmax(0, 1fr); gap: 6px; }
  .filters .field { min-width: 0; flex: 1 1 100%; }
  .filters select.input { min-width: 0; max-width: 100%; }
  .filters .field.grow { min-width: 0; flex-basis: 100%; }
  .head-actions { width: 100%; }
  .head-actions .btn { flex: 1; justify-content: center; }
  .input.search, .input.search.sm { max-width: none; }
  .status-tip { width: min(300px, calc(100vw - 32px)); }
}

/* Printing: invoices will mark their printable area with .print-area */
@media print {
  @page { margin: 12mm; }
  .drawer, .topbar, .toast, .scrim, .no-print, .note { display: none !important; }
  .main-col { margin: 0; }
  body { background: #fff; font-size: 12px; }
  .view { padding: 0; max-width: none; }
  .card { box-shadow: none; border: 0; padding: 0; }
  .table-wrap { overflow: visible; }
  .table { font-size: 11px; }
  .table th { background: #f1f4f8 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .table td, .table th { padding: 5px 6px; }
  .print-table { border: 1px solid #ccc; }
  a { color: inherit !important; text-decoration: none !important; }
}
.r-main .tax-chip { display: inline-block; }
