/* ==========================================================================
   Divine Drive — design system
   Obsidian / graphite surfaces · silver hairlines · restrained accent
   Spacing rhythm 4/8/12/16/24/32 · radii 6/10/14
   ========================================================================== */

@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-var.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

/* ---------- Tokens: dark (default) ---------- */
:root,
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0c0e;
  --bg-elev: #111316;
  --surface: #15171b;
  --surface-2: #1b1e23;
  --surface-3: #22262c;
  --line: #262a31;
  --line-strong: #343942;
  --text: #eceef1;
  --text-2: #a6adb7;
  --text-3: #8a929d;
  --chart-muted: #5d6672;
  --silver: linear-gradient(180deg, #e9ecef 0%, #9aa3ad 100%);
  --hairline: linear-gradient(90deg, transparent, rgba(220, 226, 233, .22), transparent);
  --accent: #5b9bff;
  --accent-strong: #3d84f5;
  --accent-soft: rgba(91, 155, 255, .12);
  --on-accent: #fff;
  --success: #34c38f;
  --success-soft: rgba(52, 195, 143, .12);
  --warning: #f0b44c;
  --warning-soft: rgba(240, 180, 76, .13);
  --orange: #ff8a3d;
  --orange-soft: rgba(255, 138, 61, .14);
  --danger: #ff6b6b;
  --danger-soft: rgba(255, 107, 107, .12);
  --info: #8fb4ff;
  --info-soft: rgba(143, 180, 255, .12);
  --neutral-soft: rgba(166, 173, 183, .12);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-2: 0 12px 32px -12px rgba(0, 0, 0, .7), 0 2px 6px rgba(0, 0, 0, .4);
  --overlay: rgba(4, 5, 7, .66);
  --skeleton: linear-gradient(90deg, #1b1e23 0%, #252930 50%, #1b1e23 100%);
  --focus: 0 0 0 2px var(--bg), 0 0 0 4px rgba(91, 155, 255, .6);
  --chart-grid: rgba(255, 255, 255, .06);
}

/* ---------- Tokens: light (platinum) ---------- */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f4f6;
  --bg-elev: #ffffff;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --surface-3: #eef0f3;
  --line: #e3e6ea;
  --line-strong: #cfd4da;
  --text: #121417;
  --text-2: #4f5661;
  --text-3: #646c77;
  --chart-muted: #c3c9d1;
  --mark-a: #16181c;
  --mark-b: #4a5058;
  --silver: linear-gradient(180deg, #2b2f35 0%, #6b737e 100%);
  --hairline: linear-gradient(90deg, transparent, rgba(18, 20, 23, .14), transparent);
  --accent: #0a64c9;
  --accent-strong: #0855ab;
  --accent-soft: rgba(10, 100, 201, .08);
  --success: #12875d;
  --success-soft: rgba(18, 135, 93, .09);
  --warning: #a8670a;
  --warning-soft: rgba(217, 140, 20, .12);
  --orange: #c2540a;
  --orange-soft: rgba(234, 108, 20, .12);
  --danger: #c93a3a;
  --danger-soft: rgba(201, 58, 58, .08);
  --info: #2f62c4;
  --info-soft: rgba(47, 98, 196, .08);
  --neutral-soft: rgba(79, 86, 97, .08);
  --shadow-1: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow-2: 0 16px 32px -16px rgba(16, 24, 40, .22), 0 2px 6px rgba(16, 24, 40, .06);
  --overlay: rgba(18, 20, 23, .42);
  --skeleton: linear-gradient(90deg, #eef0f3 0%, #f7f8fa 50%, #eef0f3 100%);
  --focus: 0 0 0 2px var(--bg), 0 0 0 4px rgba(10, 100, 201, .45);
  --chart-grid: rgba(0, 0, 0, .06);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    color-scheme: light;
    --bg: #f3f4f6; --bg-elev: #fff; --surface: #fff; --surface-2: #f7f8fa; --surface-3: #eef0f3;
    --line: #e3e6ea; --line-strong: #cfd4da; --text: #121417; --text-2: #4f5661; --text-3: #646c77; --chart-muted: #c3c9d1; --mark-a: #16181c; --mark-b: #4a5058;
    --silver: linear-gradient(180deg, #2b2f35 0%, #6b737e 100%);
    --hairline: linear-gradient(90deg, transparent, rgba(18, 20, 23, .14), transparent);
    --accent: #0a64c9; --accent-strong: #0855ab; --accent-soft: rgba(10, 100, 201, .08);
    --success: #12875d; --success-soft: rgba(18, 135, 93, .09); --warning: #a8670a; --warning-soft: rgba(217, 140, 20, .12); --orange: #c2540a; --orange-soft: rgba(234, 108, 20, .12);
    --danger: #c93a3a; --danger-soft: rgba(201, 58, 58, .08); --info: #2f62c4; --info-soft: rgba(47, 98, 196, .08);
    --neutral-soft: rgba(79, 86, 97, .08); --shadow-1: 0 1px 2px rgba(16, 24, 40, .06);
    --shadow-2: 0 16px 32px -16px rgba(16, 24, 40, .22), 0 2px 6px rgba(16, 24, 40, .06);
    --overlay: rgba(18, 20, 23, .42); --skeleton: linear-gradient(90deg, #eef0f3 0%, #f7f8fa 50%, #eef0f3 100%);
    --focus: 0 0 0 2px var(--bg), 0 0 0 4px rgba(10, 100, 201, .45); --chart-grid: rgba(0, 0, 0, .06);
  }
}

:root {
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --sidebar-w: 248px;
  --topbar-h: 60px;
  --bottomnav-h: 64px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --t: 140ms;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar-h) + 16px); }
body {
  margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--text); background: var(--bg);
  font-feature-settings: "cv11", "ss01", "tnum" 0; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.015em; line-height: 1.25; }
h1 { font-size: 22px; } h2 { font-size: 17px; } h3 { font-size: 15px; } h4 { font-size: 13px; }
p { margin: 0 0 12px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
img { max-width: 100%; display: block; }
hr { border: 0; height: 1px; background: var(--line); margin: 16px 0; }
small, .small { font-size: 12px; }
code, kbd { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
kbd { padding: 1px 6px; border: 1px solid var(--line-strong); border-radius: 4px; color: var(--text-3); background: var(--surface-2); }
.num, .tabular, td.num, .money { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
.muted { color: var(--text-2); } .dim { color: var(--text-3); }
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); }
.text-success { color: var(--success); } .text-danger { color: var(--danger); } .text-warning { color: var(--warning); } .text-accent { color: var(--accent); }
.nowrap { white-space: nowrap; } .truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.right { text-align: right; } .center { text-align: center; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .02em; }
.icon { width: 18px; height: 18px; flex: none; }
.icon.sm { width: 16px; height: 16px; } .icon.lg { width: 22px; height: 22px; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-sm); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
.skip-link { position: absolute; left: 8px; top: -40px; z-index: 100; background: var(--accent); color: var(--on-accent); padding: 8px 12px; border-radius: var(--r-sm); }
.skip-link:focus { top: 8px; }
[hidden] { display: none !important; }
::selection { background: var(--accent-soft); }

/* ---------- Layout utilities ---------- */
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.row-sm { display: flex; align-items: center; gap: 8px; min-width: 0; }
.row.wrap, .row-sm.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; } .end { justify-content: flex-end; } .grow { flex: 1; min-width: 0; }
.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.mt-0 { margin-top: 0; } .mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; } .mb-0 { margin-bottom: 0; } .mb-16 { margin-bottom: 16px; }

/* ---------- App shell ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--bg-elev);
  border-right: 1px solid var(--line); z-index: 40;
}
.brand { height: var(--topbar-h); display: flex; align-items: center; gap: 12px; padding: 0 20px; border-bottom: 1px solid var(--line); color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark { height: 18px; width: auto; aspect-ratio: 540 / 176; flex: none; display: block; }
.brand-mark.lg { height: 34px; }
.brand-name { font-weight: 800; font-style: italic; letter-spacing: .13em; text-transform: uppercase; font-size: 12.5px; background: var(--silver); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-sub { display: block; font-size: 10px; letter-spacing: .12em; color: var(--text-3); text-transform: uppercase; font-weight: 500; }
.nav { flex: 1; overflow-y: auto; padding: 12px 10px 24px; scrollbar-width: thin; }
.nav-group { margin-top: 16px; }
.nav-label { padding: 0 10px 6px; font-size: 10.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); }
.nav a {
  display: flex; align-items: center; gap: 12px; height: 36px; padding: 0 10px; border-radius: var(--r-sm); color: var(--text-2);
  font-weight: 500; font-size: 13.5px; position: relative; transition: background var(--t), color var(--t);
}
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.active { color: var(--text); background: var(--surface-3); }
.nav a.active::before { content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 2px; border-radius: 2px; background: var(--accent); }
.nav a .icon { color: var(--text-3); }
.nav a.active .icon, .nav a:hover .icon { color: var(--text); }
.nav .count { margin-left: auto; font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.sidebar-foot { padding: 12px; border-top: 1px solid var(--line); }
.branch-chip { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: var(--r-sm); background: var(--surface-2); font-size: 12px; color: var(--text-2); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h); display: flex; align-items: center; gap: 12px; padding: 0 24px;
  background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: saturate(140%) blur(12px); -webkit-backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar .menu-btn { display: none; }
.search {
  position: relative; flex: 1; max-width: 520px;
}
.search input {
  width: 100%; height: 38px; padding: 0 64px 0 38px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface);
  color: var(--text); font: inherit;
}
.search input::placeholder { color: var(--text-3); }
.search > .icon { position: absolute; left: 12px; top: 10px; color: var(--text-3); }
.search kbd { position: absolute; right: 10px; top: 9px; }
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--shadow-2); max-height: min(70vh, 520px); overflow: auto; padding: 6px; z-index: 50;
}
.search-group { padding: 8px 10px 4px; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); font-weight: 600; }
.search-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-sm); color: var(--text); }
.search-item:hover, .search-item.active { background: var(--surface-2); text-decoration: none; }
.search-item small { color: var(--text-3); display: block; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.icon-btn {
  position: relative; width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: var(--r-md); border: 0;
  background: transparent; color: var(--text-2); cursor: pointer; transition: background var(--t), color var(--t);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn .dot { position: absolute; top: 8px; right: 8px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 600; display: grid; place-items: center; border: 2px solid var(--bg); }
.user-btn { display: flex; align-items: center; gap: 10px; padding: 4px 8px 4px 4px; border-radius: var(--r-md); border: 0; background: transparent; color: var(--text); cursor: pointer; font: inherit; }
.user-btn:hover { background: var(--surface-2); }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 11.5px; font-weight: 600; letter-spacing: .02em; background: var(--surface-3); color: var(--text); border: 1px solid var(--line-strong); flex: none; }
.avatar.lg { width: 44px; height: 44px; font-size: 14px; }
.user-meta { text-align: left; line-height: 1.2; }
.user-meta small { color: var(--text-3); display: block; font-size: 11px; }

.content { padding: 24px; width: 100%; max-width: 1640px; margin: 0 auto; flex: 1; }
.bottom-nav { display: none; }
.scrim { position: fixed; inset: 0; background: var(--overlay); z-index: 39; opacity: 0; pointer-events: none; transition: opacity 200ms var(--ease); }
.scrim.show { opacity: 1; pointer-events: auto; }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head .crumbs { font-size: 12px; color: var(--text-3); margin-bottom: 6px; display: flex; gap: 6px; flex-wrap: wrap; }
.page-head .crumbs a { color: var(--text-3); }
.page-head h1 { font-size: 24px; font-weight: 600; letter-spacing: -.02em; }
.page-head .sub { color: var(--text-2); margin-top: 4px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); position: relative; min-width: 0; }
.card::before { content: ""; position: absolute; left: 16px; right: 16px; top: 0; height: 1px; background: var(--hairline); pointer-events: none; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); min-height: 56px; }
.card-head h2, .card-head h3 { font-size: 14.5px; font-weight: 600; }
.card-head .sub { font-size: 12px; color: var(--text-3); }
.card-body { padding: 20px; }
.card-body.tight { padding: 12px 20px; }
.card-foot { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.card.flush .card-body { padding: 0; }

/* ---------- Stat cards ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.stat { padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; min-height: 112px; }
.stat .label { font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 8px; font-weight: 500; }
.stat .label .icon { width: 16px; height: 16px; color: var(--text-3); }
.stat .value { font-size: 26px; font-weight: 600; letter-spacing: -.025em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.stat .meta { font-size: 12px; color: var(--text-3); margin-top: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stat a.stretched::after { content: ""; position: absolute; inset: 0; }
.stat.hero { background: linear-gradient(160deg, var(--surface-2), var(--surface)); }
.delta { font-size: 11.5px; font-weight: 600; padding: 1px 6px; border-radius: 4px; }
.delta.up { color: var(--success); background: var(--success-soft); }
.delta.down { color: var(--danger); background: var(--danger-soft); }
.kpi-strip { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; }
.kpi-strip > div { padding: 14px 16px; border-right: 1px solid var(--line); min-width: 0; }
.kpi-strip > div:last-child { border-right: 0; }
.kpi-strip .k { font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-strip .v { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.02em; margin-top: 2px; }

/* ---------- Buttons ---------- */
.btn {
  --btn-bg: var(--surface-2); --btn-fg: var(--text); --btn-bd: var(--line-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: var(--r-md);
  border: 1px solid var(--btn-bd); background: var(--btn-bg); color: var(--btn-fg); font: inherit; font-weight: 550; font-size: 13.5px;
  cursor: pointer; white-space: nowrap; user-select: none; transition: background var(--t), border-color var(--t), color var(--t), transform 80ms;
  position: relative; text-decoration: none !important;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn-primary { --btn-bg: var(--accent); --btn-fg: var(--on-accent); --btn-bd: var(--accent); }
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn-light { --btn-bg: var(--text); --btn-fg: var(--bg); --btn-bd: var(--text); }
.btn-light:hover { background: var(--text-2); }
.btn-ghost { --btn-bg: transparent; --btn-bd: transparent; --btn-fg: var(--text-2); }
.btn-ghost:hover { color: var(--text); background: var(--surface-2); }
.btn-danger { --btn-bg: var(--danger-soft); --btn-fg: var(--danger); --btn-bd: transparent; }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-success { --btn-bg: var(--success); --btn-fg: #fff; --btn-bd: var(--success); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: var(--r-sm); gap: 6px; }
.btn-xs { height: 26px; padding: 0 8px; font-size: 12px; border-radius: var(--r-sm); gap: 4px; }
.btn-lg { height: 46px; padding: 0 22px; font-size: 14.5px; }
.btn-icon { width: 38px; padding: 0; }
.btn-sm.btn-icon { width: 32px; }
.btn-block { width: 100%; }
.btn[disabled], .btn.is-disabled { opacity: .5; pointer-events: none; }
.btn.is-loading { color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
  content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor;
  border-color: var(--btn-fg) transparent var(--btn-fg) transparent; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: var(--r-md) 0 0 var(--r-md); margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 var(--r-md) var(--r-md) 0; }
.btn-group .btn.active { background: var(--surface-3); color: var(--text); }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px 16px; }
.col-12 { grid-column: span 12; } .col-8 { grid-column: span 8; } .col-6 { grid-column: span 6; } .col-4 { grid-column: span 4; } .col-3 { grid-column: span 3; } .col-2 { grid-column: span 2; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: 12.5px; font-weight: 550; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.req::after { content: "*"; color: var(--danger); margin-left: 2px; }
.hint { font-size: 12px; color: var(--text-3); }
.error-text { font-size: 12px; color: var(--danger); display: flex; gap: 6px; align-items: flex-start; }
.input, .select, .textarea {
  width: 100%; height: 40px; padding: 0 12px; border-radius: var(--r-md); border: 1px solid var(--line-strong); background: var(--surface);
  color: var(--text); font: inherit; font-size: 14px; transition: border-color var(--t), box-shadow var(--t);
}
.textarea { height: auto; min-height: 92px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--text-3); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input[readonly] { background: var(--surface-2); color: var(--text-2); }
.input:disabled, .select:disabled { opacity: .6; }
.has-error .input, .has-error .select, .has-error .textarea { border-color: var(--danger); }
.select {
  appearance: none; -webkit-appearance: none; padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23888f99' stroke-width='1.6' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.input-group { display: flex; align-items: stretch; }
.input-group .addon { display: grid; place-items: center; padding: 0 12px; border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text-3); font-size: 13px; }
.input-group .addon:first-child { border-radius: var(--r-md) 0 0 var(--r-md); border-right: 0; }
.input-group .addon:last-child { border-radius: 0 var(--r-md) var(--r-md) 0; border-left: 0; }
.input-group .input { border-radius: 0; }
.input-group .input:first-child { border-radius: var(--r-md) 0 0 var(--r-md); }
.input-group .input:last-child { border-radius: 0 var(--r-md) var(--r-md) 0; }
input[type="date"].input, input[type="datetime-local"].input { min-height: 40px; }
input[type="number"].input { -moz-appearance: textfield; }
.check { display: inline-flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 13.5px; color: var(--text); line-height: 1.4; }
.check input { appearance: none; -webkit-appearance: none; width: 18px; height: 18px; margin: 1px 0 0; border-radius: 5px; border: 1.5px solid var(--line-strong); background: var(--surface); display: grid; place-items: center; flex: none; cursor: pointer; transition: background var(--t), border-color var(--t); }
.check input:checked { background: var(--accent); border-color: var(--accent); }
.check input:checked::after { content: ""; width: 9px; height: 5px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.check input[type="radio"] { border-radius: 50%; }
.check input[type="radio"]:checked::after { width: 8px; height: 8px; border: 0; background: #fff; border-radius: 50%; transform: none; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13.5px; }
.switch input { appearance: none; -webkit-appearance: none; width: 36px; height: 20px; border-radius: 20px; background: var(--line-strong); position: relative; cursor: pointer; transition: background var(--t); flex: none; margin: 0; }
.switch input::after { content: ""; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform var(--t) var(--ease); box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(16px); }
.fieldset { border: 0; padding: 0; margin: 0; }
.form-section { padding: 20px; border-bottom: 1px solid var(--line); }
.form-section:last-child { border-bottom: 0; }
.form-section-head { display: flex; gap: 16px; margin-bottom: 16px; align-items: baseline; justify-content: space-between; }
.form-section-head h3 { font-size: 14px; }
.form-section-head p { margin: 2px 0 0; color: var(--text-3); font-size: 12.5px; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; padding: 16px 20px; border-top: 1px solid var(--line); background: var(--surface); border-radius: 0 0 var(--r-lg) var(--r-lg); flex-wrap: wrap; }
.form-actions.sticky { position: sticky; bottom: 0; z-index: 5; box-shadow: 0 -8px 20px -16px rgba(0,0,0,.5); }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.choice span { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--r-md); font-size: 13px; font-weight: 550; transition: border-color var(--t), background var(--t); }
.choice span small { color: var(--text-3); font-weight: 400; }
.choice input:checked + span { border-color: var(--accent); background: var(--accent-soft); }
.choice input:focus-visible + span { box-shadow: var(--focus); }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  white-space: nowrap; background: var(--neutral-soft); color: var(--text-2); letter-spacing: .01em;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.badge.plain::before { display: none; }
.badge.success { background: var(--success-soft); color: var(--success); }
.badge.warning { background: var(--warning-soft); color: var(--warning); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.orange { background: var(--orange-soft); color: var(--orange); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.badge.outline { background: transparent; border: 1px solid var(--line-strong); }
.tag { display: inline-flex; align-items: center; gap: 4px; min-height: 22px; padding: 3px 8px; line-height: 1.3; border-radius: var(--r-sm); font-size: 11.5px; background: var(--surface-3); color: var(--text-2); font-weight: 500; }
.temp { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; padding: 2px 7px; border-radius: 4px; }
.temp.HOT { color: var(--danger); background: var(--danger-soft); }
.temp.WARM { color: var(--warning); background: var(--warning-soft); }
.temp.COLD { color: var(--info); background: var(--info-soft); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.table th {
  position: sticky; top: 0; z-index: 1; text-align: left; font-weight: 600; font-size: 11.5px; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-3); padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--surface); white-space: nowrap;
}
.table th a { color: inherit; display: inline-flex; gap: 4px; align-items: center; }
.table th a.sorted { color: var(--text); }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table td:first-child, .table th:first-child { padding-left: 20px; }
.table td:last-child, .table th:last-child { padding-right: 20px; }
.table tbody tr { transition: background var(--t); }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tr.clickable { cursor: pointer; }
.table .num, .table .right { text-align: right; white-space: nowrap; }
.table .actions { text-align: right; white-space: nowrap; width: 1%; }
.table tfoot td { font-weight: 600; border-top: 1px solid var(--line-strong); border-bottom: 0; background: var(--surface-2); }
.table.compact td { padding: 8px 16px; }
.table .primary { font-weight: 550; color: var(--text); }
.table .secondary { font-size: 12px; color: var(--text-3); }
.cell-vehicle { display: flex; align-items: center; gap: 12px; min-width: 220px; }
.thumb { width: 56px; height: 40px; border-radius: 6px; object-fit: cover; background: var(--surface-3); flex: none; display: grid; place-items: center; color: var(--text-3); overflow: hidden; }
.thumb .icon { width: 20px; height: 20px; }
.kv { display: grid; grid-template-columns: minmax(120px, 40%) 1fr; gap: 10px 16px; font-size: 13.5px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; color: var(--text); font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
.ledger-row { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px; }
.ledger-row:last-child { border-bottom: 0; }
.ledger-row > :first-child { min-width: 0; overflow-wrap: anywhere; }
.ledger-row > :last-child { flex: none; }
.ledger-row.total { border-top: 1px solid var(--line-strong); border-bottom: 0; font-weight: 600; padding-top: 12px; margin-top: 4px; }
.ledger-row .num { font-weight: 550; }

/* ---------- Toolbar / filters ---------- */
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.toolbar .search-inline { position: relative; flex: 1 1 280px; min-width: 240px; max-width: 420px; }
.toolbar .search-inline .icon { position: absolute; left: 10px; top: calc(50% - 8px); color: var(--text-3); width: 16px; height: 16px; }
.toolbar .search-inline .input { padding-left: 34px; height: 38px; }
.toolbar .select, .toolbar .input { height: 38px; width: auto; min-width: 140px; }
.toolbar .search-inline .input { width: 100%; min-width: 0; }
.filters-sheet, .filters-sheet .sheet-body { display: contents; }
.date-range { display: inline-flex; align-items: center; gap: 8px; }
.range-pair { display: inline-flex; align-items: center; gap: 6px; color: var(--text-3); }
.toolbar .range-pair .input { width: 110px; min-width: 0; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text-2); font-size: 12.5px; font-weight: 550; white-space: nowrap; }
.chip:hover { color: var(--text); text-decoration: none; border-color: var(--text-3); }
.chip.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip .count { font-size: 11px; opacity: .7; font-variant-numeric: tabular-nums; }
.scroll-x { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
.scroll-x::-webkit-scrollbar { display: none; }

/* ---------- Pagination ---------- */
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--text-3); flex-wrap: wrap; }
.pagination .pages { display: flex; gap: 4px; }
.pagination a, .pagination span.page { min-width: 32px; height: 32px; padding: 0 8px; display: inline-grid; place-items: center; border-radius: var(--r-sm); color: var(--text-2); border: 1px solid transparent; font-variant-numeric: tabular-nums; }
.pagination a:hover { background: var(--surface-2); text-decoration: none; }
.pagination .current { border-color: var(--line-strong); color: var(--text); background: var(--surface-2); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.tabs::-webkit-scrollbar { display: none; }
@media (max-width: 1024px) { .tabs { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); padding-right: 24px; } }
.tab { position: relative; padding: 12px 14px; color: var(--text-2); font-weight: 550; font-size: 13.5px; white-space: nowrap; border: 0; background: none; cursor: pointer; font-family: inherit; display: inline-flex; gap: 6px; align-items: center; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { color: var(--text); }
.tab.active::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; background: var(--accent); border-radius: 2px; }
.tab .count { font-size: 11px; color: var(--text-3); background: var(--surface-3); border-radius: 10px; padding: 0 6px; }
.tab-panel { padding-top: 20px; }

/* ---------- Dropdown ---------- */
.dropdown { position: relative; display: inline-block; }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; max-width: calc(100vw - 24px); background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--shadow-2); padding: 6px; z-index: 60; display: none; transform-origin: top right;
}
.dropdown.open > .menu { display: block; animation: pop 120ms var(--ease); }
.menu.left { left: 0; right: auto; }
.menu a, .menu button {
  display: flex; width: 100%; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-sm); color: var(--text); font: inherit; font-size: 13.5px;
  background: none; border: 0; cursor: pointer; text-align: left;
}
.menu a:hover, .menu button:hover { background: var(--surface-2); text-decoration: none; }
.menu .icon { color: var(--text-3); }
.menu .danger { color: var(--danger); }
.menu .danger .icon { color: var(--danger); }
.menu-sep { height: 1px; background: var(--line); margin: 6px 0; }
.menu-head { padding: 8px 10px; font-size: 12px; color: var(--text-3); }
@keyframes pop { from { opacity: 0; transform: scale(.97) translateY(-4px); } }

/* ---------- Notifications panel ---------- */
.notif-menu { width: 380px; max-width: calc(100vw - 24px); padding: 0; }
.notif-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.notif-list { max-height: 420px; overflow: auto; }
.notif { display: flex; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); color: var(--text); }
.notif:hover { background: var(--surface-2); text-decoration: none; }
.notif.unread { background: color-mix(in srgb, var(--accent-soft) 60%, transparent); }
.notif .sev { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex: none; background: var(--info); }
.notif .sev.warning { background: var(--warning); } .notif .sev.danger { background: var(--danger); } .notif .sev.success { background: var(--success); }
.notif strong { font-weight: 550; font-size: 13px; display: block; }
.notif p { margin: 2px 0 0; font-size: 12.5px; color: var(--text-2); }
.notif time { font-size: 11px; color: var(--text-3); }

/* ---------- Modal / drawer / sheet ---------- */
dialog.modal {
  border: 1px solid var(--line); border-radius: var(--r-lg); padding: 0; background: var(--bg-elev); color: var(--text); box-shadow: var(--shadow-2);
  width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); overflow: hidden; display: flex; flex-direction: column;
}
dialog.modal:not([open]) { display: none; }
dialog.modal.lg { width: min(820px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: var(--overlay); backdrop-filter: blur(2px); }
dialog.modal[open] { animation: modal-in 160ms var(--ease); }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.985); } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); gap: 12px; }
.modal-head h2 { font-size: 16px; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.modal form { display: contents; }

/* ---------- Toast / alerts ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-md); background: var(--bg-elev); border: 1px solid var(--line-strong); box-shadow: var(--shadow-2); font-size: 13.5px; animation: toast-in 200ms var(--ease); }
.toast .icon { margin-top: 1px; }
.toast.success .icon { color: var(--success); } .toast.danger .icon { color: var(--danger); } .toast.warning .icon { color: var(--warning); } .toast.info .icon { color: var(--info); }
.toast .close { margin-left: auto; color: var(--text-3); cursor: pointer; background: none; border: 0; padding: 0; }
.toast.hide { opacity: 0; transform: translateY(6px); transition: all 180ms; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
.alert { display: flex; flex-wrap: wrap; gap: 12px; padding: 12px 16px; border-radius: var(--r-md); font-size: 13.5px; border: 1px solid transparent; align-items: flex-start; }
.alert .icon { margin-top: 1px; }
.alert.info { background: var(--info-soft); color: var(--text); border-color: color-mix(in srgb, var(--info) 25%, transparent); }
.alert.info .icon { color: var(--info); }
.alert.warning { background: var(--warning-soft); border-color: color-mix(in srgb, var(--warning) 30%, transparent); }
.alert.warning .icon { color: var(--warning); }
.alert.danger { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.alert.danger .icon { color: var(--danger); }
.alert.success { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 30%, transparent); }
.alert.success .icon { color: var(--success); }
.alert strong { font-weight: 600; }
.alert > .grow { min-width: min(220px, 100%); }
.alert .grow p { margin: 2px 0 0; color: var(--text-2); }

/* ---------- Empty / skeleton ---------- */
.empty { text-align: center; padding: 48px 24px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty .glyph { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); color: var(--text-3); margin-bottom: 8px; }
.empty .glyph .icon { width: 26px; height: 26px; }
.empty h3 { font-size: 15px; }
.empty p { color: var(--text-3); max-width: 380px; margin: 0 0 8px; font-size: 13.5px; }
.skeleton { background: var(--skeleton); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; border-radius: var(--r-sm); min-height: 12px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Lifecycle stepper / timeline ---------- */
.lifecycle { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0; position: relative; }
.lifecycle .step { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 0 4px; }
.lifecycle .step::before { content: ""; position: absolute; top: 11px; left: -50%; right: 50%; height: 2px; background: var(--line-strong); }
.lifecycle .step:first-child::before { display: none; }
.lifecycle .step .node { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line-strong); background: var(--surface); position: relative; z-index: 1; display: grid; place-items: center; }
.lifecycle .step.done .node { background: var(--text); border-color: var(--text); color: var(--bg); }
.lifecycle .step.done::before, .lifecycle .step.current::before { background: var(--text); }
.lifecycle .step.current .node { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.lifecycle .step.current .node::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.lifecycle .step .node .icon { width: 12px; height: 12px; stroke-width: 3; }
.lifecycle .step.skipped::before { background: var(--text); }
.lifecycle .step.skipped .node { border-style: dashed; color: var(--text-3); font-size: 12px; line-height: 1; }
.lifecycle .step .name { font-size: 11.5px; font-weight: 550; color: var(--text-3); line-height: 1.3; }
.lifecycle .step.done .name, .lifecycle .step.current .name { color: var(--text); }
.lifecycle .step .when { font-size: 10.5px; color: var(--text-3); }
.lifecycle.cancelled .step .node { opacity: .5; }
.timeline { position: relative; padding-left: 24px; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 1px; background: var(--line-strong); }
.timeline .item { position: relative; padding-bottom: 18px; }
.timeline .item:last-child { padding-bottom: 0; }
.timeline .item::before { content: ""; position: absolute; left: -21px; top: 5px; width: 9px; height: 9px; border-radius: 50%; background: var(--surface); border: 2px solid var(--text-3); }
.timeline .item.accent::before { border-color: var(--accent); }
.timeline .item.success::before { border-color: var(--success); }
.timeline .item.danger::before { border-color: var(--danger); }
.timeline .item .t-title { font-weight: 550; font-size: 13.5px; }
.timeline .item .t-meta { font-size: 12px; color: var(--text-3); }
.timeline .item .t-body { font-size: 13px; color: var(--text-2); margin-top: 4px; white-space: pre-line; }

/* ---------- Vehicle cards ---------- */
.vehicle-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.vcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; display: flex; flex-direction: column; color: var(--text); transition: border-color var(--t), transform 200ms var(--ease), box-shadow 200ms var(--ease); position: relative; }
.vcard:hover { border-color: var(--line-strong); text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-2); }
.vcard .media { position: relative; aspect-ratio: 16 / 10; background: radial-gradient(120% 90% at 50% 100%, var(--surface-3), var(--surface-2)); overflow: hidden; }
.vcard .media img { width: 100%; height: 100%; object-fit: cover; transition: transform 500ms var(--ease); }
.vcard:hover .media img { transform: scale(1.03); }
.vcard .media::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, rgba(0,0,0,.55) 100%); pointer-events: none; }
.vcard .media .placeholder { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-3); }
.vcard .media .placeholder .icon { width: 48px; height: 48px; stroke-width: 1; }
.vcard .ribbon { position: absolute; top: 12px; left: 12px; z-index: 2; display: flex; gap: 6px; }
.vcard .ribbon .badge { backdrop-filter: blur(8px); background: rgba(10, 12, 14, .6); color: #fff; }
.vcard .price-tag { position: absolute; left: 14px; bottom: 12px; z-index: 2; color: #fff; }
.vcard .price-tag .p { font-size: 20px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.vcard .price-tag .emi { font-size: 11.5px; opacity: .85; }
.vcard .body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.vcard .title { font-weight: 600; font-size: 15px; letter-spacing: -.01em; }
.vcard .variant { color: var(--text-3); font-size: 12.5px; margin-top: 1px; }
.vcard .specs { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--text-2); }
.vcard .specs span { display: inline-flex; align-items: center; gap: 5px; }
.vcard .specs .icon { width: 14px; height: 14px; color: var(--text-3); }
.vcard .foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line); font-size: 12px; color: var(--text-3); }

/* ---------- Vehicle detail hero ---------- */
.v-hero { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 0; overflow: hidden; }
.v-hero .gallery { position: relative; background: radial-gradient(120% 100% at 50% 100%, var(--surface-3), var(--bg)); aspect-ratio: 16 / 10; min-height: 100%; }
.v-hero .gallery img { width: 100%; height: 100%; object-fit: cover; }
.v-hero .gallery.is-empty { min-height: 0; }
.v-hero .gallery .placeholder { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-3); text-align: center; }
.v-hero .thumbs { position: absolute; left: 12px; right: 12px; bottom: 12px; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.v-hero .thumbs button { width: 64px; height: 44px; border-radius: 6px; overflow: hidden; border: 2px solid transparent; padding: 0; cursor: pointer; flex: none; background: var(--surface-3); }
.v-hero .thumbs button.active { border-color: #fff; }
.v-hero .thumbs img { width: 100%; height: 100%; object-fit: cover; }
.v-hero > .info { padding: 24px; display: flex; flex-direction: column; gap: 16px; border-left: 1px solid var(--line); }
.v-hero .reg { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; letter-spacing: .08em; padding: 3px 8px; border: 1px solid var(--line-strong); border-radius: 4px; color: var(--text-2); }
.v-hero h1 { font-size: 26px; letter-spacing: -.025em; }
.v-hero .price { font-size: 30px; font-weight: 600; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.spec-pills { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.spec-pills > div { background: var(--surface); padding: 10px 12px; min-width: 0; }
.spec-pills .k { font-size: 11px; color: var(--text-3); }
.spec-pills .v { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Profit bar ---------- */
.cost-bar { display: flex; height: 10px; border-radius: 6px; overflow: hidden; background: var(--surface-3); }
.cost-bar > span { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--text-2); }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }

/* ---------- Upload ---------- */
.dropzone { border: 1.5px dashed var(--line-strong); border-radius: var(--r-lg); padding: 28px; text-align: center; color: var(--text-2); cursor: pointer; transition: border-color var(--t), background var(--t); position: relative; }
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone .icon { width: 28px; height: 28px; margin: 0 auto 8px; color: var(--text-3); }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.media-item { position: relative; border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); aspect-ratio: 4 / 3; cursor: grab; }
.media-item.dragging { opacity: .4; }
.media-item.over { outline: 2px solid var(--accent); }
.media-item img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.media-item .bar { position: absolute; left: 6px; right: 6px; bottom: 6px; display: flex; gap: 4px; justify-content: space-between; }
.media-item .bar .btn { background: rgba(10,12,14,.72); color: #fff; border: 0; backdrop-filter: blur(6px); }
.media-item .cover-flag { position: absolute; top: 6px; left: 6px; }
.file-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.file-row:last-child { border-bottom: 0; }
.file-ico { width: 38px; height: 38px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); flex: none; font-size: 10px; font-weight: 700; letter-spacing: .04em; }

/* ---------- Charts ---------- */
.chart-box { position: relative; height: 260px; }
.chart-box.sm { height: 200px; }
.chart-box canvas { position: absolute; inset: 0; }
.funnel { display: flex; flex-direction: column; gap: 8px; }
.funnel .f-row { display: grid; grid-template-columns: 110px 1fr 48px; gap: 12px; align-items: center; font-size: 12.5px; }
.funnel .f-bar { height: 22px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.funnel .f-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 55%, var(--text-3))); border-radius: 4px; }
.meter { height: 6px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.meter.success span { background: var(--success); } .meter.warning span { background: var(--warning); } .meter.danger span { background: var(--danger); }

/* ---------- Misc components ---------- */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line); color: var(--text); min-width: 0; }
.list-item:last-child { border-bottom: 0; }
a.list-item:hover { background: var(--surface-2); text-decoration: none; }
.list-item .meta { font-size: 12px; color: var(--text-3); }
.callout { padding: 16px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line); }
.quote-box { position: sticky; top: calc(var(--topbar-h) + 16px); }
.divider-label { display: flex; align-items: center; gap: 12px; color: var(--text-3); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; margin: 8px 0; }
.divider-label::before, .divider-label::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(260px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x mandatory; }
.kanban .col { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 10px; display: flex; flex-direction: column; gap: 8px; scroll-snap-align: start; min-height: 120px; }
.kanban .col-head { display: flex; justify-content: space-between; align-items: center; padding: 4px 6px 6px; font-size: 12px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .06em; }
.kanban .k-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px 12px; color: var(--text); display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.kanban .k-card:hover { border-color: var(--line-strong); text-decoration: none; }
.progress-steps { display: flex; gap: 8px; counter-reset: s; flex-wrap: wrap; }
.progress-steps li { list-style: none; display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-3); }
.progress-steps li::before { counter-increment: s; content: counter(s); width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line-strong); font-size: 11px; font-weight: 600; }
.progress-steps li.done::before { content: "✓"; background: var(--text); color: var(--bg); border-color: var(--text); }
.progress-steps li.current { color: var(--text); font-weight: 600; }
.progress-steps li.current::before { border-color: var(--accent); color: var(--accent); }
.flag-list { display: flex; flex-direction: column; gap: 6px; }

/* ---------- Auth / installer screens ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(380px, .85fr); background: var(--bg); }
.auth-art { position: relative; overflow: hidden; background: #050607; color: #e9ecef; display: flex; flex-direction: column; justify-content: space-between; padding: 40px; }
.auth-art::before { content: ""; position: absolute; inset: 0; background: radial-gradient(60% 50% at 70% 60%, rgba(91,155,255,.18), transparent 70%), radial-gradient(80% 60% at 20% 100%, rgba(200,210,220,.10), transparent 60%); }
.auth-art .lines { position: absolute; inset: 0; opacity: .5; }
.auth-art > * { position: relative; }
.auth-art, .pub-hero { --mark-a: #f1f3f5; --mark-b: #8a939e; }
.auth-art h2 { font-size: clamp(28px, 3.2vw, 44px); font-weight: 300; letter-spacing: -.03em; line-height: 1.1; max-width: 520px; }
.auth-art h2 strong { font-weight: 600; background: linear-gradient(180deg, #fff, #9aa3ad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-art p { color: #9aa3ad; max-width: 440px; }
.auth-panel { display: flex; flex-direction: column; justify-content: center; padding: 48px clamp(24px, 5vw, 72px); background: var(--bg-elev); border-left: 1px solid var(--line); }
.auth-panel form { width: 100%; max-width: 400px; margin: 0 auto; }
.auth-panel h1 { font-size: 26px; letter-spacing: -.03em; font-weight: 600; }
.install-wrap { max-width: 760px; margin: 0 auto; padding: 40px 16px; }

/* ---------- Public catalogue ---------- */
.pub-header { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.pub-header .inner { max-width: 1280px; margin: 0 auto; padding: 0 24px; height: 64px; display: flex; align-items: center; gap: 16px; }
.pub-wrap { max-width: 1280px; margin: 0 auto; padding: 24px; }
.pub-hero { position: relative; border-radius: var(--r-lg); overflow: hidden; padding: 56px 40px; background: #060708; color: #e9ecef; margin-bottom: 24px; border: 1px solid var(--line); }
.pub-hero::before { content: ""; position: absolute; inset: 0; background: radial-gradient(50% 80% at 85% 50%, rgba(91,155,255,.16), transparent 70%), linear-gradient(120deg, transparent 40%, rgba(255,255,255,.04) 50%, transparent 60%); }
.pub-hero > * { position: relative; }
.pub-hero h1 { font-size: clamp(28px, 4vw, 46px); font-weight: 300; letter-spacing: -.035em; line-height: 1.08; max-width: 640px; }
.pub-hero h1 strong { font-weight: 600; }
.pub-hero p { color: #a6adb7; max-width: 520px; margin-top: 12px; }
.pub-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 24px; align-items: start; }
.pub-filters { position: sticky; top: 88px; }
.pub-filters .filter-toggle { display: none; }
@media (max-width: 768px) { .pub-filters .filter-toggle { display: inline-flex; } }
.pub-footer { border-top: 1px solid var(--line); margin-top: 48px; padding: 32px 24px; color: var(--text-3); font-size: 13px; }
.cta-bar { display: none; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(320px, 1fr); gap: 24px; align-items: start; }

/* ---------- Auction ---------- */
.auction-clock { font-size: 28px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.bid-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.bid-row.top { font-weight: 600; color: var(--success); }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1366px) {
  .content { padding: 20px; }
  .kpi-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi-strip > div:nth-child(3n) { border-right: 0; }
  .kpi-strip > div:nth-child(-n+3) { border-bottom: 1px solid var(--line); }
}

@media (max-width: 1180px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-main { grid-template-columns: minmax(0, 1fr); }
  .v-hero { grid-template-columns: minmax(0, 1fr); }
  .v-hero > .info { border-left: 0; border-top: 1px solid var(--line); }
  .detail-grid { grid-template-columns: minmax(0, 1fr); }
  .quote-box { position: static; }
}

/* Tablet & below: off-canvas sidebar */
@media (max-width: 1024px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: min(300px, 86vw); transform: translateX(-102%); transition: transform 240ms var(--ease); box-shadow: var(--shadow-2); }
  .sidebar.open { transform: none; }
  .topbar .menu-btn { display: inline-grid; }
  .topbar { padding: 0 16px; }
  .g-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pub-layout { grid-template-columns: minmax(0, 1fr); }
  .pub-filters { position: static; }
  .user-meta { display: none; }
}

@media (max-width: 860px) {
  .col-8, .col-6, .col-4, .col-3 { grid-column: span 12; }
  .col-2 { grid-column: span 6; }
  .form-grid .col-md-6 { grid-column: span 6; }
  .lifecycle { grid-template-columns: repeat(7, 84px); overflow-x: auto; padding-bottom: 8px; scrollbar-width: none; }
}

/* Phones */
@media (max-width: 768px) {
  body { font-size: 14px; }
  .content { padding: 16px 16px calc(var(--bottomnav-h) + 24px + env(safe-area-inset-bottom)); }
  .topbar { gap: 8px; height: 56px; }
  :root { --topbar-h: 56px; }
  .search { max-width: none; }
  .search kbd { display: none; }
  .search input { padding-right: 12px; }
  .topbar-actions .hide-sm { display: none; }
  .page-head { margin-bottom: 16px; align-items: flex-start; }
  .page-head h1 { font-size: 20px; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
  .page-actions .dropdown { flex: none; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .stat { padding: 14px; min-height: 96px; }
  .stat .value { font-size: 20px; }
  .g-2, .g-3, .g-4 { grid-template-columns: minmax(0, 1fr); }
  .kpi-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-strip > div { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  .kpi-strip > div:nth-child(2n) { border-right: 0; }
  .card-head { padding: 14px 16px; }
  .card-body { padding: 16px; }
  .form-section { padding: 16px; }
  .form-actions { padding: 12px 16px; }
  .form-actions .btn { flex: 1; }
  /* Forms with a sticky action bar take over the bottom of the screen; the tab bar would hide the primary action. */
  body:has(.form-actions.sticky) .bottom-nav { display: none; }
  body:has(.form-actions.sticky) .content { padding-bottom: 24px; }
  .form-actions.sticky { margin: 0 -1px; padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .form-actions .btn-primary { flex-basis: 100%; order: 2; }
  .v-hero .gallery.is-empty { aspect-ratio: 16 / 7; }
  .table.responsive td.block { display: block; text-align: left; }
  .table.responsive td.block::before { display: block; margin-bottom: 2px; }
  .pub-filters .card-body { display: none; }
  .pub-filters.open .card-body { display: flex; }
  .pub-filters .card-head { cursor: pointer; }
  .btn { height: 42px; }
  .btn-sm { height: 36px; }
  .input, .select { height: 44px; font-size: 16px; } /* 16px prevents iOS zoom */
  .textarea { font-size: 16px; }
  .toolbar:has(> .sheet-toggle) { flex-wrap: nowrap; }
  .toolbar > .scroll-x { flex-basis: 100%; min-width: 0; }
  .date-range { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 10px; flex-basis: 100%; }
  .toolbar .date-range .input { width: 100%; min-width: 0; }
  .toolbar .search-inline { max-width: none; min-width: 0; flex: 1 1 auto; }
  .toolbar .sheet-toggle { flex: none; height: 38px; }
  .toolbar:not(:has(.search-inline)) .sheet-toggle { flex: 1; }
  .btn-group { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .btn-group .btn { flex: none; }
  .filters-sheet {
    display: block;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 70; background: var(--bg-elev); border-top: 1px solid var(--line);
    border-radius: 18px 18px 0 0; padding: 8px 16px calc(16px + env(safe-area-inset-bottom)); transform: translateY(105%);
    transition: transform 240ms var(--ease); max-height: 82dvh; overflow-y: auto; box-shadow: var(--shadow-2);
  }
  .filters-sheet.open { transform: none; }
  .filters-sheet::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 2px; background: var(--line-strong); margin: 4px auto 12px; }
  .filters-sheet .sheet-body { display: flex; flex-direction: column; gap: 12px; }
  .filters-sheet .check { padding: 4px 0; }
  .filters-sheet .select, .filters-sheet .input { width: 100%; }
  .filters-sheet .range-pair { display: flex; }
  .filters-sheet .range-pair .input { flex: 1; width: auto; }
  .toolbar .sheet-toggle { display: inline-flex; }
  /* Tables → cards */
  .table.responsive thead { display: none; }
  .table.responsive, .table.responsive tbody, .table.responsive tr, .table.responsive td { display: block; width: 100%; }
  .table.responsive tr { padding: 12px 16px; border-bottom: 1px solid var(--line); }
  .table.responsive tbody tr:hover { background: transparent; }
  .table.responsive td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; font-size: 13.5px; }
  .table.responsive td::before { content: attr(data-label); color: var(--text-3); font-size: 12px; text-align: left; flex: none; }
  .table.responsive td.lead-cell { display: block; text-align: left; padding-bottom: 8px; }
  .table.responsive td.lead-cell::before { display: none; }
  .table.responsive td.actions { justify-content: flex-end; padding-top: 8px; }
  .table.responsive td.actions::before { display: none; }
  .table.responsive td.hide-sm { display: none; }
  .table.responsive tfoot { display: block; }
  .table.responsive tfoot tr { display: flex; justify-content: space-between; padding: 12px 16px; }
  .table.responsive tfoot td { display: block; width: auto; padding: 0; }
  .cell-vehicle { min-width: 0; }
  .kv { grid-template-columns: minmax(110px, 42%) 1fr; }
  .v-hero > .info { padding: 16px; }
  .v-hero h1 { font-size: 21px; }
  .v-hero .price { font-size: 24px; }
  .spec-pills { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .vehicle-grid { grid-template-columns: minmax(0, 1fr); }
  dialog.modal { width: 100vw; max-width: 100vw; max-height: 92dvh; margin: auto 0 0; border-radius: 18px 18px 0 0; border-bottom: 0; }
  dialog.modal.lg { width: 100vw; }
  dialog.modal[open] { animation: sheet-in 220ms var(--ease); }
  .modal-foot .btn { flex: 1; }
  .toasts { left: 16px; right: 16px; bottom: calc(var(--bottomnav-h) + 16px + env(safe-area-inset-bottom)); width: auto; }
  .bottom-nav {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 35; height: calc(var(--bottomnav-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom); background: color-mix(in srgb, var(--bg-elev) 92%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line);
  }
  .bottom-nav a, .bottom-nav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--text-3); font-size: 10.5px; font-weight: 550; background: none; border: 0; font-family: inherit; cursor: pointer; }
  .bottom-nav a:hover { text-decoration: none; }
  .bottom-nav .active { color: var(--text); }
  .bottom-nav .active .icon { color: var(--accent); }
  .bottom-nav .icon { width: 22px; height: 22px; }
  .pub-header .inner { padding: 0 16px; }
  .pub-wrap { padding: 16px; }
  .pub-hero { padding: 32px 20px; }
  .cta-bar { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: var(--bg-elev); border-top: 1px solid var(--line); }
  .has-cta { padding-bottom: 88px; }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-art { display: none; }
  .auth-panel { border-left: 0; min-height: 100vh; padding: 32px 20px; }
  .tab { padding: 12px 12px; }
  .funnel .f-row { grid-template-columns: 90px 1fr 40px; }
}
@keyframes sheet-in { from { transform: translateY(40px); opacity: .4; } }

@media (min-width: 769px) {
  .sheet-toggle, .show-sm { display: none !important; }
}
@media (max-width: 768px) {
  .hide-sm { display: none !important; }
}
@media (max-width: 340px) {
  .stats { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 380px) {
  .content { padding-left: 12px; padding-right: 12px; }
  .stat .value { font-size: 18px; }
  .bottom-nav a, .bottom-nav button { font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ==========================================================================
   Print (documents use their own PDF stylesheet; this keeps screens printable)
   ========================================================================== */
@media print {
  .sidebar, .topbar, .bottom-nav, .page-actions, .toolbar, .pagination, .toasts, .btn { display: none !important; }
  .app { display: block; }
  .content { padding: 0; }
  .card { border: 1px solid #ccc; break-inside: avoid; }
  body { background: #fff; color: #000; }
}

details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details[open] > summary .icon { transform: rotate(180deg); }

/* ==========================================================================
   Density pass — tighter rhythm, use the full width
   ========================================================================== */
.content { max-width: none; padding: 16px 20px; }
.page-head { margin-bottom: 14px; gap: 10px; }
.page-head h1 { font-size: 21px; }
.page-head .crumbs { margin-bottom: 2px; }
.page-head .sub { margin-top: 2px; font-size: 13px; }
.stack { gap: 12px; } .grid { gap: 12px; } .stats { gap: 12px; }
.mb-16 { margin-bottom: 12px; } .mt-16 { margin-top: 12px; } .mt-24 { margin-top: 16px; }
.card-head { padding: 10px 16px; min-height: 46px; }
.card-body { padding: 14px 16px; }
.card-foot { padding: 10px 16px; }
.stat { padding: 12px 16px; min-height: 0; gap: 4px; }
.stat .value { font-size: 22px; }
.kpi-strip > div { padding: 10px 14px; }
.form-section { padding: 14px 16px; }
.form-section-head { margin-bottom: 10px; }
.form-grid { gap: 12px; }
.field { gap: 4px; }
.form-actions { padding: 10px 16px; }
.toolbar { padding: 10px 12px; }
.table th { padding: 8px 12px; }
.table td { padding: 8px 12px; }
.table td:first-child, .table th:first-child { padding-left: 16px; }
.table td:last-child, .table th:last-child { padding-right: 16px; }
.list-item { padding: 9px 16px; }
.file-row { padding: 9px 16px; }
.tab-panel { padding-top: 12px; }
.tab { padding: 10px 12px; }
.empty { padding: 24px 16px; }
.empty .glyph { width: 44px; height: 44px; margin-bottom: 4px; }
.v-hero > .info { padding: 16px 20px; gap: 12px; }
.chart-box { height: 230px; } .chart-box.sm { height: 180px; }
.timeline .item { padding-bottom: 12px; }
.ledger-row { padding: 7px 0; }
.alert { padding: 10px 14px; }
.vehicle-grid { gap: 12px; }
.pub-wrap { max-width: 1440px; padding: 16px 20px; }
.pub-header .inner { max-width: 1440px; }
.pub-hero { padding: 36px 32px; margin-bottom: 16px; }
.pub-layout { gap: 16px; }
@media (min-width: 1600px) {
  .vehicle-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
}
@media (max-width: 768px) {
  .content { padding: 10px 10px calc(var(--bottomnav-h) + 12px + env(safe-area-inset-bottom)); }
  .page-head { margin-bottom: 10px; gap: 8px; }
  .page-head h1 { font-size: 19px; }
  .stack, .grid, .stats { gap: 8px; }
  .card { border-radius: 12px; }
  .card-head { padding: 10px 12px; min-height: 42px; }
  .card-body { padding: 12px; }
  .stat { padding: 10px 12px; }
  .stat .value { font-size: 19px; }
  .stat .meta { font-size: 11.5px; }
  .form-section { padding: 12px; }
  .form-grid { gap: 10px; }
  .form-actions { padding: 10px 12px; }
  .toolbar { padding: 8px 10px; }
  .table.responsive tr { padding: 10px 12px; }
  .table.responsive td { padding: 2px 0; }
  .list-item { padding: 9px 12px; }
  .v-hero > .info { padding: 12px; }
  .pub-wrap { padding: 10px; }
  .pub-hero { padding: 22px 16px; }
  .btn { height: 40px; }
  .input, .select { height: 42px; }
}
@media (max-width: 768px) { .row.between { flex-wrap: wrap; row-gap: 8px; } .btn-group { flex: none; } }
@media (max-width: 380px) { .content { padding-left: 8px; padding-right: 8px; } }
@media (min-width: 360px) and (max-width: 860px) { .form-grid .col-3, .form-grid .col-2 { grid-column: span 6; } }
.kv { gap: 7px 14px; }
.mb-8 { margin-bottom: 8px; }
.swatch { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 8px; vertical-align: 1px; }

/* ==========================================================================
   Custom select & date picker (public/assets/js/controls.js)
   ========================================================================== */
:root { --ctl-h: 40px; }
.toolbar { --ctl-h: 38px; }
.cselect, .cdate { position: relative; width: 100%; min-width: 0; }
.cselect-native, .cdate-native { position: absolute !important; left: 0; bottom: 0; width: 100% !important; height: 1px !important; opacity: 0; pointer-events: none; border: 0 !important; padding: 0 !important; margin: 0 !important; }
.cselect-trigger, .cdate-trigger {
  width: 100%; height: var(--ctl-h); display: flex; align-items: center; gap: 8px; padding: 0 10px 0 12px; border-radius: var(--r-md);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font: inherit; font-size: 14px; text-align: left; cursor: pointer;
  transition: border-color var(--t), box-shadow var(--t);
}
.cselect-trigger:hover, .cdate-trigger:hover { border-color: var(--text-3); }
.cselect-trigger:focus-visible, .cdate-trigger:focus-visible, .cselect-trigger.is-open, .cdate-trigger.is-open { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.cselect-trigger:disabled, .cdate-trigger:disabled { opacity: .6; cursor: not-allowed; }
.cselect-value, .cdate-value { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.is-placeholder { color: var(--text-3); }
.cselect-chev { color: var(--text-3); transition: transform var(--t); flex: none; }
.cselect-trigger.is-open .cselect-chev { transform: rotate(180deg); }
.cdate-trigger > .icon { color: var(--text-3); flex: none; }
.cselect.has-error .cselect-trigger, .cdate.has-error .cdate-trigger, .has-error .cselect-trigger, .has-error .cdate-trigger { border-color: var(--danger); }
.toolbar .cselect, .toolbar .cdate { width: auto; min-width: 150px; }
.toolbar .cselect-trigger, .toolbar .cdate-trigger { font-size: 13.5px; }
.input-group .cselect-trigger { border-radius: 0 var(--r-md) var(--r-md) 0; }

.cpanel {
  position: fixed; z-index: 1000; background: var(--bg-elev); border: 1px solid var(--line-strong); border-radius: var(--r-md); box-shadow: var(--shadow-2);
  color: var(--text); animation: pop 120ms var(--ease); max-width: calc(100vw - 16px);
}
.cpanel.up { transform-origin: bottom left; }
.cpanel-title { font-weight: 600; font-size: 14px; padding: 4px 4px 10px; }
.cpanel-scrim { position: fixed; inset: 0; z-index: 999; background: var(--overlay); animation: fade-in 160ms var(--ease); }
@keyframes fade-in { from { opacity: 0; } }
.cselect-menu { padding: 6px; display: flex; flex-direction: column; }
.cselect-search { position: relative; margin-bottom: 6px; }
.cselect-search .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.cselect-search input { width: 100%; height: 36px; padding: 0 10px 0 32px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-size: 13.5px; }
.cselect-search input:focus { outline: none; border-color: var(--accent); }
.cselect-list { max-height: 280px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.cselect-option { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: var(--r-sm); font-size: 13.5px; cursor: pointer; }
.cselect-option.is-active { background: var(--surface-3); }
.cselect-option.is-selected { color: var(--accent); font-weight: 600; }
.cselect-option.is-placeholder { color: var(--text-3); }
.cselect-option[aria-disabled] { opacity: .45; cursor: not-allowed; }
.cselect-option .icon { flex: none; }
.cselect-group { padding: 8px 10px 4px; font-size: 10.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); }
.cselect-empty { padding: 14px 10px; color: var(--text-3); font-size: 13px; text-align: center; }

.cdate-panel { padding: 10px; width: 292px; }
.cdate-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 8px; }
.cdate-nav { width: 32px; height: 32px; display: grid; place-items: center; border-radius: var(--r-sm); border: 0; background: none; color: var(--text-2); cursor: pointer; }
.cdate-nav:hover { background: var(--surface-3); color: var(--text); }
.cdate-title { display: inline-flex; align-items: center; gap: 4px; font: inherit; font-weight: 600; font-size: 14px; color: var(--text); background: none; border: 0; padding: 6px 8px; border-radius: var(--r-sm); cursor: pointer; }
.cdate-title:hover { background: var(--surface-3); }
.cdate-title.is-static { cursor: default; }
.cdate-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cdate-dow { text-align: center; font-size: 11px; font-weight: 600; color: var(--text-3); padding: 4px 0 6px; }
.cdate-day { aspect-ratio: 1; border: 0; background: none; color: var(--text); font: inherit; font-size: 13px; border-radius: var(--r-sm); cursor: pointer; font-variant-numeric: tabular-nums; position: relative; }
.cdate-day:hover:not([disabled]) { background: var(--surface-3); }
.cdate-day.is-today { color: var(--accent); font-weight: 700; }
.cdate-day.is-today::after { content: ""; position: absolute; left: 50%; bottom: 4px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: currentColor; }
.cdate-day.is-selected { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.cdate-day.is-selected::after { background: var(--on-accent); }
.cdate-day[disabled], .cdate-cell[disabled] { opacity: .3; cursor: not-allowed; }
.cdate-months { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.cdate-cell { height: 44px; border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: var(--r-sm); font: inherit; font-size: 13px; cursor: pointer; }
.cdate-cell:hover:not([disabled]) { border-color: var(--text-3); }
.cdate-cell.is-selected { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.cdate-time { display: flex; align-items: center; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.cdate-time > .dim { margin-right: auto; }
.cdate-spin { display: inline-flex; align-items: center; border: 1px solid var(--line-strong); border-radius: var(--r-sm); }
.cdate-spin button { width: 26px; height: 32px; display: grid; place-items: center; border: 0; background: none; color: var(--text-2); cursor: pointer; }
.cdate-spin button:hover { color: var(--text); background: var(--surface-3); }
.cdate-spin output { min-width: 24px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.cdate-ampm { height: 34px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface-2); color: var(--text); font: inherit; font-weight: 600; font-size: 12.5px; cursor: pointer; }
.cdate-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }

/* Phones: both open as bottom sheets */
.cpanel.as-sheet { left: 0 !important; right: 0; bottom: 0; top: auto !important; width: 100% !important; max-width: none; border-radius: 18px 18px 0 0; border-bottom: 0;
  padding: 10px 12px calc(14px + env(safe-area-inset-bottom)); max-height: 80dvh; animation: sheet-in 220ms var(--ease); }
.cpanel.as-sheet::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 2px; background: var(--line-strong); margin: 0 auto 10px; }
.cpanel.as-sheet .cselect-list { max-height: 56dvh; }
.cpanel.as-sheet .cselect-option { padding: 12px; font-size: 15px; }
.cpanel.as-sheet .cselect-search input { height: 42px; font-size: 16px; }
.cpanel.as-sheet.cdate-panel { display: flex; flex-direction: column; }
.cpanel.as-sheet .cdate-day { font-size: 15px; }
@media (max-width: 768px) {
  :root { --ctl-h: 42px; }
  .toolbar { --ctl-h: 38px; }
  .cselect-trigger, .cdate-trigger { font-size: 16px; }
  .filters-sheet .cselect, .filters-sheet .cdate { width: 100%; }
}
.quota-alert .meter { max-width: 420px; }
.upload-blocked { opacity: .55; pointer-events: none; }
.upload-blocked-note { font-size: 12.5px; color: var(--danger); display: flex; gap: 6px; align-items: flex-start; margin-top: 6px; }

/* ---------- File upload fields (controls.js) ---------- */
.cfile { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.cfile-native { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.cfile-zone {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1.5px dashed var(--line-strong); border-radius: var(--r-md);
  background: var(--surface-2); color: var(--text); cursor: pointer; text-align: left; transition: border-color var(--t), background var(--t);
}
.cfile-zone:hover, .cfile.is-drag .cfile-zone, .dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.cfile-native:focus-visible + .cfile-zone, .cfile:focus-within .cfile-zone { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.cfile-ico { width: 40px; height: 40px; flex: none; border-radius: 10px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); color: var(--accent); }
.cfile-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 13.5px; }
.cfile-text strong { font-weight: 600; color: var(--text); }
.cfile-or { color: var(--text-2); }
.cfile-meta { font-size: 12px; color: var(--text-3); }
.cfile-btn { flex: none; pointer-events: none; }
.cfile.is-filled .cfile-zone { padding: 10px 14px; border-style: dashed; }
.cfile.is-filled .cfile-ico { width: 32px; height: 32px; }
.cfile.is-filled .cfile-meta { display: none; }
.cfile.is-disabled .cfile-zone, .cfile-zone.upload-blocked { opacity: .5; cursor: not-allowed; pointer-events: none; }
.cfile.has-error .cfile-zone { border-color: var(--danger); }
.cfile-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.cfile-list:empty { display: none; }
.cfile-item { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 10px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.cfile-thumb { width: 40px; height: 40px; flex: none; border-radius: 6px; overflow: hidden; background: var(--surface-3); display: grid; place-items: center; font-size: 10px; font-weight: 700; letter-spacing: .04em; color: var(--text-2); }
.cfile-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cfile-thumb.is-pdf { background: var(--danger-soft); color: var(--danger); }
.cfile-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cfile-name { font-size: 13.5px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cfile-size { font-size: 12px; color: var(--text-3); }
.cfile-remove { width: 32px; height: 32px; flex: none; display: grid; place-items: center; border: 0; border-radius: var(--r-sm); background: none; color: var(--text-3); cursor: pointer; }
.cfile-remove:hover { background: var(--danger-soft); color: var(--danger); }
.cfile-error { font-size: 12.5px; color: var(--danger); }
.cfile-error[hidden] { display: none; }
/* Large auto-submitting drop area (vehicle photos) */
.dropzone.cfile-zone.is-large { flex-direction: column; justify-content: center; text-align: center; padding: 28px 20px; gap: 8px; }
.dropzone.cfile-zone.is-large > .icon { width: 44px; height: 44px; padding: 10px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); color: var(--accent); margin: 0; box-sizing: border-box; }
.dropzone.is-uploading { pointer-events: none; border-style: solid; border-color: var(--accent); }
.dropzone.is-uploading > .icon { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
@media (max-width: 768px) {
  .cfile-zone { padding: 12px; gap: 12px; }
  .cfile-btn, .cfile-or { display: none; }
  .cfile-text { font-size: 14px; }
}

/* ---------- Sale entry ---------- */
[data-confirm-text] { white-space: pre-line; }
.step-head { display: flex; gap: 12px; align-items: flex-start; }
.step-no { width: 24px; height: 24px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--accent-soft); color: var(--accent); margin-top: 1px; }
.sale-vcard { display: flex; gap: 14px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); }
.sale-vthumb { width: 88px; height: 62px; flex: none; border-radius: 8px; overflow: hidden; background: var(--surface-3); display: grid; place-items: center; color: var(--text-3); }
.sale-vthumb img { width: 100%; height: 100%; object-fit: cover; }
.sale-vthumb .icon { width: 30px; height: 30px; }
.sale-vtitle { font-weight: 600; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sale-vprice { text-align: right; flex: none; }
.sale-vprice .num { font-size: 17px; font-weight: 600; }
.chips .chip { cursor: pointer; font-family: inherit; }
.more-section > summary { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; font-size: 14px; }
.more-section > summary > span:first-child { display: inline-flex; align-items: center; gap: 8px; flex: 1; }
.more-section > summary .icon { color: var(--text-3); transition: transform var(--t); }
.more-section[open] > summary > .icon:last-child { transform: rotate(180deg); }
.more-section > summary:hover { color: var(--accent); }
.inst-row .input[type=date], .inst-row .cdate { max-width: 190px; }
.inst-row .input[name="inst_amount[]"] { max-width: 160px; }
.inst-row .input[name="inst_label[]"] { flex: 1; min-width: 160px; }
.quote-empty { padding: 4px 0 10px; }
.quote-empty[hidden] { display: none; }
.sale-checklist { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; font-size: 12.5px; color: var(--text-3); }
.sale-checklist li { display: flex; align-items: center; gap: 6px; }
.sale-checklist li::before { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--line-strong); flex: none; }
.sale-checklist li.done { color: var(--text); }
.sale-checklist li.done::before { background: var(--success); border-color: var(--success); box-shadow: inset 0 0 0 3px var(--surface); }
.sale-checklist li[hidden] { display: none; }
.sale-bar { display: none; }
@media (max-width: 1180px) {
  .sale-form .quote-box .card-foot { display: none; }
  .sale-bar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; position: sticky; bottom: 0; z-index: 20; margin-top: 12px;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); background: var(--bg-elev); border: 1px solid var(--line-strong); border-radius: var(--r-lg); box-shadow: var(--shadow-2);
  }
  .sale-bar-total { font-size: 18px; font-weight: 700; }
  body:has(.sale-bar) .bottom-nav { display: none; }
  body:has(.sale-bar) .content { padding-bottom: 16px; }
}
@media (max-width: 768px) {
  .sale-vcard { flex-wrap: wrap; }
  .sale-vprice { text-align: left; width: 100%; display: flex; gap: 10px; align-items: baseline; }
  .step-no { display: none; }
}
[data-picker-selected]:not([hidden]) + .search { display: none; }
.brand-lockup { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.brand-lockup .brand-name { font-size: 15px; letter-spacing: .16em; }
.show-sm.brand-lockup { display: none; }
@media (max-width: 768px) { .show-sm.brand-lockup { display: inline-flex !important; } }

/* Inside the mobile app the app supplies navigation */
body.in-app .sidebar, body.in-app .topbar, body.in-app .sidebar-backdrop, body.in-app .bottom-nav { display: none !important; }
body.in-app .app { display: block; }
body.in-app .main, body.in-app .content { margin-left: 0 !important; width: 100%; }

/* ==========================================================================
   NAF additions — POS, line items, print. Uses the existing tokens only.
   ========================================================================== */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; align-items: start; }
.pos-cart { min-height: 320px; }
.pos-line { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.pos-line:last-child { border-bottom: 0; }
.pos-qty { display: flex; align-items: center; gap: 4px; }
.pos-qty .input { width: 64px; text-align: center; }
.pos-total { display: flex; justify-content: space-between; align-items: baseline; padding-top: 12px; margin-top: 8px; border-top: 1px solid var(--line); font-size: 15px; }
.pos-total strong { font-size: 26px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.pos-side { position: sticky; top: 76px; }
.pos .search .input { padding-left: 38px; }
.search-results .search-item.active { background: var(--surface-3); }
.line-table td { vertical-align: middle; }
.kbd-hints { display: flex; gap: 12px; flex-wrap: wrap; color: var(--text-3); font-size: 12px; }
.clock-face { font-size: 44px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.status-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 4px 16px; }
@media (max-width: 1080px) { .pos { grid-template-columns: 1fr; } .pos-side { position: static; } }
@media print {
  .sidebar, .topbar, .bottom-nav, .page-actions, .no-print, .toasts { display: none !important; }
  .main, .content { margin: 0 !important; padding: 0 !important; }
  body { background: #fff !important; color: #000 !important; }
  .card { box-shadow: none !important; border-color: #ccc !important; }
}

/* ---------- NAF pickers (product & customer dropdowns) ---------- */
.naf-dd { padding: 6px; }
.naf-dd .naf-dd-item, .naf-dd .naf-dd-add { width: 100%; border: 0; background: none; font: inherit; color: var(--text); text-align: left; cursor: pointer; min-height: 44px; }
.naf-dd .naf-dd-item small, .naf-dd .naf-dd-side small { display: block; color: var(--text-3); font-size: 12px; margin-top: 1px; }
.naf-dd-title { display: block; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.naf-dd-side { margin-left: auto; text-align: right; white-space: nowrap; padding-left: 12px; }
.naf-dd-side .text-danger { color: var(--danger) !important; }
.naf-dd-note { padding: 10px 12px; color: var(--text-3); font-size: 13px; }
.naf-dd .naf-dd-add { color: var(--accent); font-weight: 550; border-top: 1px solid var(--line); border-radius: 0 0 var(--r-sm) var(--r-sm); margin-top: 4px; }
.naf-dd .naf-dd-add:hover { background: var(--accent-soft); }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; flex: none; }
.naf-cp-chip { padding: 8px 12px; }
[data-customer-picker].has-error .search .input { border-color: var(--danger); }
.line-table tr.naf-flash td { background: var(--accent-soft); transition: background .6s; }

/* User form: branch/department checklists and permission overrides */
.check-list-title { display: block; margin-bottom: 10px; }
.check-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px 16px; }
.perm-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px 20px; }
.perm-item { display: flex; align-items: center; gap: 12px; min-width: 0; }
.perm-item > span { min-width: 0; }
.perm-item .perm-select, .perm-item .cselect { width: 104px; min-width: 104px; flex: none; }
