/* ==========================================================================
   Motor Mechanic Solutions, design system
   Solid colours, tokenised via CSS variables. Brand colours (--brand, --accent)
   are injected per platform / per workshop by inc/ui.php.
   ========================================================================== */

:root {
  --brand: #C2410C; --brand-600: #ab390b; --brand-700: #923109; --brand-50: #fdf1ec; --brand-100: #f9dccf; --brand-ink: #fff;
  --accent: #0F766E; --accent-50: #e7f2f1; --accent-ink: #fff;
  --brand-fg: #C2410C; --brand-tint-fg: #9a330a; --accent-fg: #0F766E;

  --bg: #F4F5F7;
  --surface: #FFFFFF;
  --surface-2: #F8F9FA;
  --surface-3: #EEF0F3;
  --border: #E1E4E8;
  --border-strong: #CBD0D6;
  --text: #16191F;
  --text-2: #3D434C;
  --muted: #687280;
  --faint: #9AA2AD;

  --ok: #15803D;   --ok-bg: #E8F5EC;   --ok-ink: #0F5A2B;
  --warn: #B45309; --warn-bg: #FDF3E1; --warn-ink: #7A3A06;
  --danger: #B91C1C; --danger-bg: #FCEBEB; --danger-ink: #8A1414;
  --info: #1D4ED8; --info-bg: #E9EFFD; --info-ink: #173A9E;
  --neutral-bg: #EEF0F3; --neutral-ink: #3D434C;

  --side-bg: #15171C;
  --side-bg-2: #1E2128;
  --side-text: #C9CDD4;
  --side-muted: #7E8590;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-pill: 999px;

  --shadow-1: 0 1px 2px rgba(16, 20, 26, .06), 0 1px 1px rgba(16, 20, 26, .04);
  --shadow-2: 0 4px 12px rgba(16, 20, 26, .08), 0 1px 3px rgba(16, 20, 26, .06);
  --shadow-3: 0 16px 40px rgba(16, 20, 26, .18), 0 4px 10px rgba(16, 20, 26, .08);

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s7: 32px; --s8: 40px; --s9: 56px;

  --font: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --fs-xs: 12px; --fs-sm: 13px; --fs: 14px; --fs-md: 15px; --fs-lg: 17px; --fs-xl: 20px; --fs-2xl: 26px; --fs-3xl: 34px;

  --focus: 0 0 0 3px color-mix(in srgb, var(--brand) 35%, transparent);
  --focus-solid: 2px solid var(--brand);
  --side-w: 256px;
  --top-h: 64px;
  --ease: .18s ease;
  --ease-slow: .32s cubic-bezier(.4, 0, .2, 1);
  --scroll-thumb: #C5CAD2; --scroll-thumb-hover: #9AA2AD;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0E1014; --surface: #171A20; --surface-2: #1C2027; --surface-3: #232831;
  --border: #2A3039; --border-strong: #3A414C; --text: #ECEEF1; --text-2: #C7CCD3; --muted: #959DA8; --faint: #6B7380;
  --ok: #4ADE80; --ok-bg: #12301E; --ok-ink: #8BF0AF;
  --warn: #FBBF24; --warn-bg: #362810; --warn-ink: #FCD58A;
  --danger: #F87171; --danger-bg: #3A1618; --danger-ink: #FCA5A5;
  --info: #93B4FD; --info-bg: #172446; --info-ink: #BFD2FE;
  --neutral-bg: #262B33; --neutral-ink: #C7CCD3;
  --side-bg: #0B0D10; --side-bg-2: #15181D;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .4); --shadow-2: 0 4px 14px rgba(0, 0, 0, .45); --shadow-3: 0 18px 44px rgba(0, 0, 0, .6);
  --scroll-thumb: #3A414C; --scroll-thumb-hover: #555E6B;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  [data-theme="system"] {
    --bg: #0E1014; --surface: #171A20; --surface-2: #1C2027; --surface-3: #232831;
    --border: #2A3039; --border-strong: #3A414C; --text: #ECEEF1; --text-2: #C7CCD3; --muted: #959DA8; --faint: #6B7380;
    --ok: #4ADE80; --ok-bg: #12301E; --ok-ink: #8BF0AF;
    --warn: #FBBF24; --warn-bg: #362810; --warn-ink: #FCD58A;
    --danger: #F87171; --danger-bg: #3A1618; --danger-ink: #FCA5A5;
    --info: #93B4FD; --info-bg: #172446; --info-ink: #BFD2FE;
    --neutral-bg: #262B33; --neutral-ink: #C7CCD3;
    --side-bg: #0B0D10; --side-bg-2: #15181D;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .4); --shadow-2: 0 4px 14px rgba(0, 0, 0, .45); --shadow-3: 0 18px 44px rgba(0, 0, 0, .6);
    --scroll-thumb: #3A414C; --scroll-thumb-hover: #555E6B;
    color-scheme: dark;
  }
}

/* -------------------------------------------------------------- base */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("../fonts/inter-latin-wght-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("../fonts/inter-latin-ext-wght-normal.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 88px; }
/* custom scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--scroll-thumb-hover); border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
::-webkit-scrollbar-corner { background: transparent; }
.no-scrollbar { scrollbar-width: none; } .no-scrollbar::-webkit-scrollbar { display: none; }
body { margin: 0; font-family: var(--font); font-size: var(--fs); line-height: 1.5; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
img, svg { display: block; max-width: 100%; }
a { color: var(--brand-fg); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3, h4 { margin: 0 0 var(--s3); line-height: 1.25; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: var(--fs-2xl); } h2 { font-size: var(--fs-xl); } h3 { font-size: var(--fs-lg); } h4 { font-size: var(--fs-md); }
p { margin: 0 0 var(--s3); }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--s5) 0; }
code, .mono { font-family: var(--mono); font-size: .92em; }
small, .small { font-size: var(--fs-sm); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.strong { font-weight: 600; }
.m0 { margin: 0 !important; }
.mt { margin-top: var(--s4); } .mt-lg { margin-top: var(--s6); } .mb { margin-bottom: var(--s4); } .mb-0 { margin-bottom: 0; }
.hidden, [hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
:focus-visible { outline: var(--focus-solid); outline-offset: 2px; }
.ic { width: 18px; height: 18px; flex: none; }
.skip-link { position: absolute; left: -9999px; top: 8px; z-index: 1000; background: var(--brand); color: var(--brand-ink); padding: 8px 14px; border-radius: var(--radius-sm); }
.skip-link:focus { left: 8px; }
::selection { background: var(--brand-100); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* -------------------------------------------------------------- app shell */
.shell { display: flex; min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--side-w); background: var(--side-bg); color: var(--side-text); display: flex; flex-direction: column; z-index: 40; transition: width var(--ease-slow), transform var(--ease-slow), box-shadow var(--ease-slow); overflow: hidden; }
.sidebar-head { min-height: var(--top-h); display: flex; align-items: center; padding: 10px 18px; border-bottom: 1px solid rgba(255,255,255,.06); flex: none; }
.sidebar .brand { color: #fff; }
.brand { display: flex; align-items: center; gap: 12px; font-weight: 700; color: var(--text); text-decoration: none !important; min-width: 0; }
.brand-name { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: var(--fs-md); line-height: 1.25; letter-spacing: -.01em; overflow-wrap: anywhere; transition: opacity var(--ease); }
.brand-logo { width: 36px; height: 36px; object-fit: contain; flex: none; border-radius: 9px; }
.brand-logo.brand-lg { width: 52px; height: 52px; border-radius: 12px; }
.brand-monogram { width: 36px; height: 36px; border-radius: 10px; background: var(--brand); color: var(--brand-ink); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px; flex: none; }
.brand-monogram.brand-lg { width: 52px; height: 52px; border-radius: 12px; font-size: 19px; }
.nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: var(--s3) var(--s3) var(--s5); scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav-group { margin-bottom: var(--s2); }
.nav-group-title { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--side-muted); padding: var(--s3) 12px var(--s1); font-weight: 600; white-space: nowrap; height: 32px; transition: opacity var(--ease); }
.nav-link { display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 12px; border-radius: 9px; color: var(--side-text); font-weight: 500; position: relative; text-decoration: none !important; white-space: nowrap; transition: background var(--ease), color var(--ease); }
.nav-link .ic { width: 19px; height: 19px; opacity: .85; flex: none; }
.nl-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; transition: opacity var(--ease); }
.nav-link:hover { background: var(--side-bg-2); color: #fff; }
.nav-link.active { background: color-mix(in srgb, var(--brand) 24%, var(--side-bg)); color: #fff; }
.nav-link.active::before { content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand); }
.nav-link.active .ic { opacity: 1; color: color-mix(in srgb, var(--brand) 55%, #fff); }
.nav-link.locked { color: var(--side-muted); }
.nav-lock { display: inline-flex; transition: opacity var(--ease); }
.nav-lock .ic { width: 14px; height: 14px; }
.nav-badge { background: var(--brand); color: var(--brand-ink); font-size: 11px; font-weight: 700; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; transition: all var(--ease); }
.sidebar-foot { padding: 14px 22px; border-top: 1px solid rgba(255,255,255,.06); font-size: var(--fs-xs); color: var(--side-muted); display: flex; align-items: center; gap: 10px; white-space: nowrap; min-height: 48px; }
.sidebar-foot .ic { width: 15px; height: 15px; flex: none; }
.sidebar-foot a { color: inherit; }
.sf-text { overflow: hidden; text-overflow: ellipsis; transition: opacity var(--ease); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.dot-ok { background: #22C55E; box-shadow: 0 0 0 3px rgba(34,197,94,.18); } .dot-warn { background: #F59E0B; } .dot-danger { background: #EF4444; }
.sidebar-scrim { position: fixed; inset: 0; background: rgba(8, 10, 14, .5); z-index: 35; opacity: 0; visibility: hidden; transition: opacity var(--ease-slow), visibility var(--ease-slow); backdrop-filter: blur(2px); }

.main-col { flex: 1; min-width: 0; margin-left: var(--side-w); display: flex; flex-direction: column; transition: margin-left var(--ease-slow); }
.topbar { position: sticky; top: 0; z-index: 30; min-height: var(--top-h); background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: saturate(160%) blur(10px); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: var(--s3); padding: 0 var(--s6) 0 var(--s4); }
.top-title { font-weight: 650; font-size: var(--fs-md); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-search { flex: 1; max-width: 520px; position: relative; display: flex; align-items: center; }
.top-search .ic { position: absolute; left: 13px; color: var(--faint); width: 17px; height: 17px; pointer-events: none; }
.top-search input { width: 100%; height: 40px; border: 1px solid var(--border); background: var(--surface-2); border-radius: var(--radius-pill); padding: 0 16px 0 40px; color: var(--text); font: inherit; transition: border-color var(--ease), box-shadow var(--ease), background var(--ease); }
.top-search input:focus { outline: none; border-color: var(--brand-fg); box-shadow: var(--focus); background: var(--surface); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.icon-btn { width: 40px; height: 40px; border-radius: var(--radius); border: 1px solid transparent; background: transparent; color: var(--text-2); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; position: relative; flex: none; padding: 0; transition: background var(--ease), color var(--ease); }
.icon-btn:hover { background: var(--surface-3); text-decoration: none; color: var(--text); }
.icon-btn.sm { width: 30px; height: 30px; }
.icon-btn.sm .ic { width: 15px; height: 15px; }
.theme-btn .ic { transition: transform .4s ease; }
.theme-btn:hover .ic { transform: rotate(25deg); }
.notif-count { position: absolute; top: 3px; right: 2px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; min-width: 18px; height: 18px; border-radius: 9px; display: flex; align-items: center; justify-content: center; padding: 0 4px; border: 2px solid var(--surface); animation: pop .35s ease; }
@keyframes pop { 0% { transform: scale(.4); } 70% { transform: scale(1.15); } 100% { transform: scale(1); } }
.only-dark { display: none; }
[data-theme="dark"] .only-dark { display: block; } [data-theme="dark"] .only-light { display: none; }
@media (prefers-color-scheme: dark) { [data-theme="system"] .only-dark { display: block; } [data-theme="system"] .only-light { display: none; } }

/* animated hamburger: three bars morph into a cross while the menu is open */
.hamburger { position: relative; width: 20px; height: 14px; display: block; }
.hamburger i { position: absolute; left: 0; width: 100%; height: 2px; border-radius: 2px; background: currentColor; transition: transform .32s cubic-bezier(.7,0,.3,1), opacity .2s ease, top .32s cubic-bezier(.7,0,.3,1); }
.hamburger i:nth-child(1) { top: 0; } .hamburger i:nth-child(2) { top: 6px; } .hamburger i:nth-child(3) { top: 12px; }
.menu-btn[aria-expanded="true"] .hamburger i:nth-child(1) { top: 6px; transform: rotate(45deg); }
.menu-btn[aria-expanded="true"] .hamburger i:nth-child(2) { opacity: 0; transform: scaleX(.2); }
.menu-btn[aria-expanded="true"] .hamburger i:nth-child(3) { top: 6px; transform: rotate(-45deg); }

/* desktop: collapsed sidebar shows icons only */
@media (min-width: 1025px) {
  html.side-collapsed { --side-w: 76px; }
  html.side-collapsed .brand-name, html.side-collapsed .nl-text, html.side-collapsed .nav-lock, html.side-collapsed .sf-text { opacity: 0; pointer-events: none; }
  html.side-collapsed .sidebar-head { padding: 10px 20px; }
  html.side-collapsed .nav-group-title { opacity: 0; height: 12px; padding: 0; }
  html.side-collapsed .nav-group + .nav-group { border-top: 1px solid rgba(255,255,255,.07); padding-top: 8px; }
  html.side-collapsed .nav-link { padding: 0 16px; }
  html.side-collapsed .nav-badge { position: absolute; top: 4px; left: 30px; min-width: 16px; height: 16px; font-size: 10px; padding: 0 4px; }
  html.side-collapsed .sidebar-foot { padding: 14px 0; justify-content: center; }
  html.side-collapsed .sidebar-foot .sf-text { display: none; }
  html.side-collapsed .realm-customer .sidebar-head, html.side-collapsed .sidebar-head { justify-content: flex-start; }
}
.side-tip { position: fixed; z-index: 500; background: var(--text); color: var(--surface); font-size: 12.5px; font-weight: 600; padding: 6px 10px; border-radius: 7px; pointer-events: none; white-space: nowrap; box-shadow: var(--shadow-2); opacity: 0; transform: translateX(-4px); transition: opacity .15s ease, transform .15s ease; }
.side-tip.show { opacity: 1; transform: none; }
html.no-anim .sidebar, html.no-anim .main-col, html.no-anim .brand-name, html.no-anim .nl-text { transition: none !important; }

.user-btn { display: flex; align-items: center; gap: 10px; background: transparent; border: 1px solid transparent; border-radius: var(--radius-pill); padding: 3px 10px 3px 3px; cursor: pointer; color: var(--text); font: inherit; transition: background var(--ease); }
.user-btn:hover { background: var(--surface-3); }
.user-chev { width: 16px; height: 16px; color: var(--muted); transition: transform var(--ease); }
.dropdown.open .user-chev { transform: rotate(180deg); }
.user-meta { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.2; text-align: left; }
.user-name { font-weight: 600; font-size: var(--fs-sm); max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role { font-size: 11px; color: var(--muted); }
.avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; flex: none; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: #fff; background: hsl(var(--av-h, 20) 45% 42%); }
.avatar.lg { width: 72px; height: 72px; font-size: 24px; }
.avatar.sm { width: 26px; height: 26px; font-size: 10px; }

.dropdown { position: relative; }
.dropdown-menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-3); padding: 6px; z-index: 60; opacity: 0; visibility: hidden; transform: translateY(-6px) scale(.98); transform-origin: top right; transition: opacity .18s ease, transform .18s ease, visibility .18s; }
.dropdown.open .dropdown-menu { opacity: 1; visibility: visible; transform: none; }
.dropdown-menu a, .dropdown-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 8px; color: var(--text); background: none; border: 0; font: inherit; cursor: pointer; text-align: left; text-decoration: none; transition: background var(--ease); }
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--surface-3); text-decoration: none; }
.dropdown-menu form { margin: 0; }
.dm-head { display: flex; align-items: center; gap: 10px; padding: 8px 10px 12px; margin-bottom: 6px; border-bottom: 1px solid var(--border); min-width: 0; }
.dm-head > div { min-width: 0; } .dm-head .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }

/* notifications dropdown */
.notif-menu { width: 380px; max-width: calc(100vw - 24px); padding: 0; overflow: hidden; }
.nm-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.nm-list { max-height: 380px; overflow-y: auto; padding: 6px; }
.dropdown-menu a.nm-item { align-items: flex-start; gap: 12px; padding: 10px; position: relative; }
.nm-item.unread { background: color-mix(in srgb, var(--brand) 6%, transparent); }
.nm-item.unread::after { content: ""; position: absolute; right: 12px; top: 16px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.nm-ic { width: 36px; height: 36px; border-radius: 10px; background: var(--brand-50); color: var(--brand-tint-fg); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.nm-ic .ic { width: 17px; height: 17px; }
.nm-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding-right: 14px; }
.nm-title { font-weight: 600; font-size: var(--fs-sm); line-height: 1.35; }
.nm-text { font-size: 12.5px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.4; }
.nm-time { font-size: 11.5px; color: var(--faint); }
.nm-empty { padding: 32px 16px; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.nm-empty .ic { width: 28px; height: 28px; color: var(--faint); }
.nm-foot { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; border-top: 1px solid var(--border); background: var(--surface-2); }
.dropdown-menu .nm-link, .nm-link { width: auto; padding: 4px 6px; color: var(--brand-fg); font-weight: 600; font-size: var(--fs-sm); background: none; border: 0; cursor: pointer; border-radius: 6px; }

.content { padding: var(--s6); max-width: 1560px; width: 100%; margin: 0 auto; outline: none; animation: pageIn .35s ease both; }
@keyframes pageIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.banner { display: flex; align-items: center; gap: 10px; padding: 10px var(--s6); font-size: var(--fs-sm); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.banner span { flex: 1; min-width: 200px; }
.banner-info { background: var(--info-bg); color: var(--info-ink); }
.banner-warn { background: var(--warn-bg); color: var(--warn-ink); }
.banner-danger { background: var(--danger-bg); color: var(--danger-ink); }

/* page loading bar + busy buttons */
#page-progress { position: fixed; top: 0; left: 0; height: 3px; width: 0; background: var(--brand); z-index: 1000; box-shadow: 0 0 10px color-mix(in srgb, var(--brand) 60%, transparent); transition: width .3s ease, opacity .3s ease; opacity: 0; pointer-events: none; }
#page-progress.run { opacity: 1; }
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading .ic { opacity: 0; }
.btn.is-loading::after { content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-color: var(--spin, #fff) var(--spin, #fff) transparent transparent; animation: spin .7s linear infinite; }
.btn-ghost.is-loading, .btn-quiet.is-loading, .btn-light.is-loading { --spin: var(--brand); }
@keyframes spin { to { transform: rotate(360deg); } }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--border); border-top-color: var(--brand-fg); animation: spin .7s linear infinite; display: inline-block; }
.skeleton { background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 37%, var(--surface-3) 63%); background-size: 400% 100%; animation: shimmer 1.3s ease infinite; border-radius: 8px; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* -------------------------------------------------------------- page header */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s4); margin-bottom: var(--s5); flex-wrap: wrap; }
.page-head-text { min-width: 0; }
.page-title { font-size: var(--fs-2xl); margin: 0; }
.page-sub { margin: 4px 0 0; color: var(--muted); }
.page-actions { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; }
.crumbs { display: flex; align-items: center; gap: 4px; font-size: var(--fs-sm); color: var(--muted); margin-bottom: 6px; flex-wrap: wrap; }
.crumbs a { color: var(--muted); }
.crumb-sep .ic { width: 14px; height: 14px; color: var(--faint); }

/* -------------------------------------------------------------- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: var(--radius); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; font-size: var(--fs); cursor: pointer; white-space: nowrap; text-decoration: none !important; line-height: 1; transition: background .12s, border-color .12s, box-shadow .12s; }
.btn .ic { width: 17px; height: 17px; }
.btn:hover { background: var(--surface-3); }
.btn:focus-visible { outline: none; box-shadow: var(--focus); }
.btn:disabled, .btn.disabled { opacity: .55; cursor: not-allowed; pointer-events: none; }
.btn-primary { background: var(--brand); border-color: var(--brand-fg); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand-600); border-color: var(--brand-600); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-accent:hover { filter: brightness(.94); }
.btn-ghost { background: var(--surface); }
.btn-quiet { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-quiet:hover { background: var(--surface-3); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.92); background: var(--danger); }
.btn-success { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-light { background: rgba(255,255,255,.85); border-color: transparent; color: #16191f; height: 30px; font-size: var(--fs-sm); }
.btn-sm { height: 32px; padding: 0 12px; font-size: var(--fs-sm); }
.btn-lg { height: 46px; padding: 0 22px; font-size: var(--fs-md); }
.btn-block { width: 100%; }
.btn-group { display: inline-flex; gap: var(--s2); flex-wrap: wrap; align-items: center; }
.inline-form { display: inline; margin: 0; }
[data-theme="dark"] .btn-danger, [data-theme="dark"] .btn-success { color: #0e1014; }

/* -------------------------------------------------------------- cards & layout */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-1); padding: var(--s5); min-width: 0; }
.card + .card { margin-top: var(--s4); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin: calc(-1 * var(--s5)) calc(-1 * var(--s5)) var(--s4); padding: var(--s4) var(--s5); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-title { font-size: var(--fs-md); font-weight: 650; margin: 0; display: flex; align-items: center; gap: 8px; }
.card-title .ic { color: var(--muted); }
.card-flush { padding: 0; }
.card-flush .card-head { margin: 0; }
.card-link { text-decoration: none !important; color: inherit; }
.card-foot { margin: var(--s4) calc(-1 * var(--s5)) calc(-1 * var(--s5)); padding: var(--s3) var(--s5); border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); display: flex; justify-content: flex-end; gap: var(--s2); flex-wrap: wrap; }
.grid { display: grid; gap: var(--s4); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s4); }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s4); }
.grid-main { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: var(--s4); align-items: start; }
.span-2 { grid-column: span 2; } .span-all { grid-column: 1 / -1; }
.stack > * + * { margin-top: var(--s4); }
.row { display: flex; gap: var(--s3); align-items: center; flex-wrap: wrap; }
.row-between { display: flex; justify-content: space-between; gap: var(--s3); align-items: center; flex-wrap: wrap; }
.divider { height: 1px; background: var(--border); margin: var(--s4) 0; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s4); margin-bottom: var(--s4); }
.stats:where(:has(> :nth-child(5):last-child)) { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.stats:where(:has(> :nth-child(5):last-child)) > * { grid-column: span 2; }
.stats:where(:has(> :nth-child(5):last-child)) > :nth-child(n+4) { grid-column: span 3; }
.stats:where(:has(> :nth-child(7):last-child)) { grid-template-columns: repeat(12, minmax(0, 1fr)); }
.stats:where(:has(> :nth-child(7):last-child)) > * { grid-column: span 3; }
.stats:where(:has(> :nth-child(7):last-child)) > :nth-child(n+5) { grid-column: span 4; }
.stats:where(:has(> :nth-child(3):last-child), :has(> :nth-child(6):last-child), :has(> :nth-child(9):last-child)) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stats:where(:has(> :nth-child(2):last-child)) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stats:where(:has(> :only-child)) { grid-template-columns: minmax(0, 1fr); max-width: 420px; }
@media (max-width: 1180px) { .stats:where(:not(:has(> :only-child))) { grid-template-columns: repeat(2, minmax(0, 1fr)); } .stats > * { grid-column: auto !important; } }
.grid-2 > .card, .grid-3 > .card, .grid-4 > .card, .grid-2 > .stack > .card:first-child, .grid-3 > .stack > .card:first-child { margin-top: 0; }
.grid-2, .grid-3, .grid-4 { align-items: stretch; }
.grid-2 > .card, .grid-3 > .card, .grid-4 > .card { display: flex; flex-direction: column; }
.grid-2 > .card > .card-body:last-child, .grid-3 > .card > .card-body:last-child { flex: 1; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--s4) var(--s5); display: flex; gap: var(--s4); align-items: center; box-shadow: var(--shadow-1); min-width: 0; }
a.stat:hover { border-color: var(--brand-tint-fg); box-shadow: var(--shadow-2); }
.stat-icon { width: 44px; height: 44px; border-radius: 12px; background: var(--brand-50); color: var(--brand-tint-fg); display: flex; align-items: center; justify-content: center; flex: none; }
.stat-icon .ic { width: 22px; height: 22px; }
.stat-body { min-width: 0; }
.stat-label { font-size: var(--fs-sm); color: var(--muted); font-weight: 500; }
.stat-value { font-size: clamp(18px, 1.6vw, 24px); font-weight: 700; letter-spacing: -.02em; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-sub { font-size: var(--fs-xs); color: var(--muted); }
.trend-up { color: var(--ok); } .trend-down { color: var(--danger); }

/* key/value lists */
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 18px; margin: 0; }
.kv dt { color: var(--muted); font-size: var(--fs-sm); }
.kv dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.kv-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: var(--s4); }
.kv-item .k { color: var(--muted); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.kv-item .v { font-weight: 600; margin-top: 2px; overflow-wrap: anywhere; }

/* -------------------------------------------------------------- badges & tags */
.badge { display: inline-flex; align-items: center; justify-content: center; height: 22px; padding: 0 9px; border-radius: var(--radius-pill); font-size: 12px; font-weight: 600; white-space: nowrap; line-height: 1; }
.badge-success { background: var(--ok-bg); color: var(--ok-ink); }
.badge-info { background: var(--info-bg); color: var(--info-ink); }
.badge-warn { background: var(--warn-bg); color: var(--warn-ink); }
.badge-danger { background: var(--danger-bg); color: var(--danger-ink); }
.badge-neutral { background: var(--neutral-bg); color: var(--neutral-ink); }
.badge-brand { background: var(--brand-50); color: var(--brand-tint-fg); }
[data-theme="dark"] .badge-brand { color: var(--text); }
@media (prefers-color-scheme: dark) { [data-theme="system"] .badge-brand { color: var(--text); } [data-theme="system"] .xs-chip, [data-theme="system"] .realm-customer .nav-link.active { color: var(--brand-tint-fg); } [data-theme="system"] .btn-danger, [data-theme="system"] .btn-success { color: #0e1014; } }
.badge-demo { background: repeating-linear-gradient(-45deg, var(--warn-bg), var(--warn-bg) 6px, transparent 6px, transparent 12px); color: var(--warn-ink); border: 1px solid var(--warn); }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 6px; background: var(--surface-3); color: var(--text-2); font-size: 12px; font-weight: 500; }
.tag .ic { width: 13px; height: 13px; }
.pill-list { display: flex; gap: 6px; flex-wrap: wrap; }

/* -------------------------------------------------------------- forms */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4) var(--s4); }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
.form-section { margin-top: var(--s6); }
.form-section-title { font-size: var(--fs-md); font-weight: 650; margin-bottom: var(--s3); padding-bottom: var(--s2); border-bottom: 1px solid var(--border); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; margin: 0; }
.field.m0 { gap: 0; }
.label { font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); }
.req { color: var(--danger); }
.help { font-size: var(--fs-xs); color: var(--muted); font-weight: 400; }
.input { width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); color: var(--text); font: inherit; font-size: var(--fs); transition: border-color .12s, box-shadow .12s; min-width: 0; }
textarea.input { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.input::placeholder { color: var(--faint); }
.input:hover { border-color: var(--muted); }
.input:focus { outline: none; border-color: var(--brand-fg); box-shadow: var(--focus); }
.input:disabled, .input[readonly] { background: var(--surface-2); color: var(--muted); }
.input:user-invalid { border-color: var(--danger); }
input[type="number"].input { -moz-appearance: textfield; appearance: textfield; }
input[type="number"].input::-webkit-inner-spin-button, input[type="number"].input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.input-group { display: flex; align-items: stretch; }
.input-group .input { border-radius: 0; flex: 1; }
.input-group .input:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.input-group .input:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.input-addon { display: flex; align-items: center; justify-content: center; padding: 0 12px; background: var(--surface-3); border: 1px solid var(--border-strong); color: var(--muted); font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; }
.input-group .input-addon:first-child { border-radius: var(--radius) 0 0 var(--radius); border-right: 0; }
.input-group .input-addon:last-child { border-radius: 0 var(--radius) var(--radius) 0; border-left: 0; }
.dt-pair { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: var(--s2); }
.form-actions { display: flex; gap: var(--s2); justify-content: flex-end; margin-top: var(--s5); flex-wrap: wrap; align-items: center; }
.form-actions.left { justify-content: flex-start; }
.form-inline { display: flex; gap: var(--s3); align-items: flex-end; flex-wrap: wrap; }
.form-inline .field { min-width: 170px; flex: 1; }
.form-inline .field.grow { flex: 3; }
.filters { display: flex; gap: var(--s3); flex-wrap: wrap; align-items: flex-end; margin-bottom: var(--s4); }
.filters .field { min-width: 160px; flex: 1; max-width: 260px; }
.filters .field.wide { max-width: 360px; flex: 2; }

/* checkbox */
.check { display: inline-flex; align-items: flex-start; gap: 10px; cursor: pointer; user-select: none; position: relative; min-height: 22px; }
.check input { position: absolute; opacity: 0; width: 20px; height: 20px; margin: 0; cursor: pointer; }
.check-box { width: 20px; height: 20px; border: 1.5px solid var(--border-strong); border-radius: 6px; background: var(--surface); display: inline-flex; align-items: center; justify-content: center; flex: none; margin-top: 1px; transition: background .12s, border-color .12s; }
.check-box .ic { width: 14px; height: 14px; color: var(--brand-ink); opacity: 0; stroke-width: 3; }
.check input:checked + .check-box { background: var(--brand); border-color: var(--brand-fg); }
.check input:checked + .check-box .ic { opacity: 1; }
.check input:focus-visible + .check-box { box-shadow: var(--focus); border-color: var(--brand-fg); }
.check input:disabled + .check-box { opacity: .5; }
.check-label { display: flex; flex-direction: column; gap: 2px; font-weight: 500; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--s3); }

/* dropzone */
.dropzone { position: relative; display: flex; align-items: center; gap: 10px; border: 1.5px dashed var(--border-strong); border-radius: var(--radius); padding: 14px 16px; background: var(--surface-2); cursor: pointer; color: var(--muted); flex-wrap: wrap; }
.dropzone:hover, .dropzone.drag { border-color: var(--brand-fg); background: var(--brand-50); color: var(--text); }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.dropzone .dz-files { width: 100%; font-size: var(--fs-xs); color: var(--text-2); }
.dropzone .dz-files:empty { display: none; }

/* colour */
.color-field { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.color-field .input { width: 120px; font-family: var(--mono); }
.color-swatch { width: 40px; height: 40px; border-radius: var(--radius); border: 1px solid var(--border-strong); flex: none; }
.color-presets { display: flex; gap: 6px; flex-wrap: wrap; }
.color-chip { width: 24px; height: 24px; border-radius: 6px; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border-strong); cursor: pointer; padding: 0; }
.color-chip:hover { transform: scale(1.1); }

/* rating */
.rating { display: inline-flex; flex-direction: row-reverse; gap: 4px; }
.rating input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.rating label { cursor: pointer; color: var(--border-strong); }
.rating label .ic { width: 30px; height: 30px; }
.rating input:checked ~ label, .rating label:hover, .rating label:hover ~ label { color: #F59E0B; }
.rating input:checked ~ label .ic, .rating label:hover .ic, .rating label:hover ~ label .ic { fill: #F59E0B; }
.rating input:focus-visible + label { outline: var(--focus-solid); border-radius: 4px; }
.stars { display: inline-flex; gap: 2px; color: #F59E0B; }
.stars .ic { width: 15px; height: 15px; fill: currentColor; }
.stars .off { color: var(--border-strong); fill: none; }

/* -------------------------------------------------------------- custom select */
select.x-select.enhanced { position: absolute !important; opacity: 0 !important; pointer-events: none !important; width: 1px !important; height: 1px !important; }
select.x-select:not(.enhanced) { width: 100%; height: 40px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); color: var(--text); padding: 0 10px; font: inherit; }
.xs { position: relative; min-width: 0; }
.xs-btn { width: 100%; min-height: 40px; display: flex; align-items: center; gap: 8px; padding: 6px 36px 6px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: pointer; position: relative; }
.xs-btn:hover { border-color: var(--muted); }
.xs-btn:focus { outline: none; border-color: var(--brand-fg); box-shadow: var(--focus); }
.xs-btn[aria-disabled="true"] { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }
.xs-value { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xs-value.placeholder { color: var(--faint); }
.xs-chev { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 18px; height: 18px; transition: transform .15s; }
.xs.open .xs-chev { transform: translateY(-50%) rotate(180deg); }
.xs-chips { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; min-width: 0; }
.xs-chip { display: inline-flex; align-items: center; gap: 4px; background: var(--brand-50); color: var(--brand-tint-fg); border-radius: 6px; padding: 2px 4px 2px 8px; font-size: 12px; font-weight: 600; }
[data-theme="dark"] .xs-chip { color: var(--brand-tint-fg); }
.xs-chip button { border: 0; background: none; color: inherit; cursor: pointer; padding: 0; width: 16px; height: 16px; display: inline-flex; align-items: center; justify-content: center; border-radius: 4px; }
.xs-chip button .ic { width: 12px; height: 12px; }
.xs-pop { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-3); z-index: 80; display: none; overflow: hidden; min-width: 220px; }
.xs.open .xs-pop { display: block; }
.xs.up .xs-pop { top: auto; bottom: calc(100% + 4px); }
.xs-search { padding: 8px; border-bottom: 1px solid var(--border); position: relative; }
.xs-search .ic { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--faint); }
.xs-search input { width: 100%; height: 34px; border: 1px solid var(--border); border-radius: 8px; padding: 0 10px 0 32px; font: inherit; background: var(--surface-2); color: var(--text); }
.xs-search input:focus { outline: none; border-color: var(--brand-fg); }
.xs-list { list-style: none; margin: 0; padding: 4px; max-height: 280px; overflow-y: auto; }
.xs-opt { padding: 8px 10px; border-radius: 7px; cursor: pointer; display: flex; align-items: center; gap: 10px; }
.xs-opt-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.xs-opt-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xs-opt-sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xs-opt .ic { width: 16px; height: 16px; color: var(--brand-fg); visibility: hidden; flex: none; }
.xs-opt[aria-selected="true"] { font-weight: 600; }
.xs-opt[aria-selected="true"] .ic { visibility: visible; }
.xs-opt.active { background: var(--surface-3); }
.xs-empty { padding: 14px; color: var(--muted); text-align: center; font-size: var(--fs-sm); }

/* -------------------------------------------------------------- date / time pickers */
.xd-wrap { position: relative; }
.xd-wrap .input { padding-right: 40px; }
.xd-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; border: 0; background: transparent; color: var(--muted); border-radius: 7px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.xd-toggle:hover { background: var(--surface-3); color: var(--text); }
.xd-pop { position: absolute; z-index: 90; top: calc(100% + 4px); left: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-3); padding: 12px; width: 300px; }
.xd-pop.up { top: auto; bottom: calc(100% + 4px); }
.xd-pop.align-right { left: auto; right: 0; }
.xd-head { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.xd-nav { width: 32px; height: 32px; border: 1px solid var(--border); background: var(--surface); border-radius: 8px; cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--text-2); flex: none; padding: 0; }
.xd-nav:hover { background: var(--surface-3); }
.xd-nav .ic { width: 16px; height: 16px; }
.xd-title { flex: 1; display: flex; gap: 6px; justify-content: center; }
.xd-title button { border: 1px solid transparent; background: transparent; font: inherit; font-weight: 650; color: var(--text); padding: 4px 8px; border-radius: 7px; cursor: pointer; }
.xd-title button:hover { background: var(--surface-3); }
.xd-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.xd-dow { font-size: 11px; color: var(--muted); text-align: center; font-weight: 600; padding: 4px 0; text-transform: uppercase; }
.xd-blank { height: 36px; }
.xd-day { height: 36px; border: 0; background: transparent; border-radius: 8px; font: inherit; font-size: var(--fs-sm); color: var(--text); cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; font-variant-numeric: tabular-nums; }
.xd-day:hover { background: var(--surface-3); }
.xd-day:focus-visible { outline: none; box-shadow: var(--focus); }
.xd-day.today { box-shadow: inset 0 0 0 1.5px var(--brand); font-weight: 700; }
.xd-day.selected { background: var(--brand); color: var(--brand-ink); font-weight: 700; }
.xd-day.in-range { background: var(--brand-50); border-radius: 0; }
.xd-day.range-start { background: var(--brand); color: var(--brand-ink); border-radius: 8px 0 0 8px; }
.xd-day.range-end { background: var(--brand); color: var(--brand-ink); border-radius: 0 8px 8px 0; }
.xd-day.range-start.range-end { border-radius: 8px; }
.xd-day:disabled { color: var(--faint); cursor: not-allowed; background: transparent; text-decoration: line-through; }
.xd-months, .xd-years { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.xd-months button, .xd-years button { height: 40px; border: 1px solid var(--border); background: var(--surface); border-radius: 8px; font: inherit; cursor: pointer; color: var(--text); }
.xd-months button:hover, .xd-years button:hover { background: var(--surface-3); }
.xd-months button.selected, .xd-years button.selected { background: var(--brand); border-color: var(--brand-fg); color: var(--brand-ink); font-weight: 700; }
.xd-foot { display: flex; justify-content: space-between; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); gap: 6px; }
.xd-foot button { border: 0; background: transparent; color: var(--brand-fg); font: inherit; font-weight: 600; cursor: pointer; padding: 6px 8px; border-radius: 6px; }
.xd-foot button:hover { background: var(--brand-50); }
.xd-hint { font-size: 11px; color: var(--muted); margin-top: 8px; text-align: center; }
.x-daterange { display: flex; align-items: center; gap: 6px; }
.x-daterange .xd-wrap { flex: 1; min-width: 0; }
.range-sep { color: var(--muted); flex: none; }

.xt-pop { position: absolute; z-index: 90; top: calc(100% + 4px); left: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-3); width: 100%; min-width: 150px; max-height: 260px; overflow-y: auto; padding: 4px; }
.xt-pop.up { top: auto; bottom: calc(100% + 4px); }
.xt-opt { display: flex; align-items: center; justify-content: center; width: 100%; height: 34px; border: 0; background: transparent; border-radius: 7px; font: inherit; color: var(--text); cursor: pointer; font-variant-numeric: tabular-nums; }
.xt-opt:hover, .xt-opt.active { background: var(--surface-3); }
.xt-opt.selected { background: var(--brand); color: var(--brand-ink); font-weight: 700; }

/* -------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); }
.card:not(.card-flush) > .table-wrap:first-child:last-child { margin: calc(-1 * var(--s5)); }
.card-flush .table-wrap { border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs); }
.table th, .table td { padding: 11px 14px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--border); }
.table th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 650; background: var(--surface-2); white-space: nowrap; position: sticky; top: 0; z-index: 1; }
.table tbody tr:hover td { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table td.actions { text-align: right; white-space: nowrap; }
.table td.actions .btn-group { justify-content: flex-end; flex-wrap: nowrap; }
.table .cell-main { font-weight: 600; color: var(--text); }
.table .cell-sub { font-size: 12px; color: var(--muted); }
.table tfoot td { font-weight: 700; background: var(--surface-2); }
.table-compact th, .table-compact td { padding: 7px 10px; }
th[data-sort] { cursor: pointer; user-select: none; }
th[data-sort]::after { content: "↕"; margin-left: 6px; color: var(--faint); font-size: 11px; }
th[data-sort][aria-sort="ascending"]::after { content: "↑"; color: var(--brand-fg); }
th[data-sort][aria-sort="descending"]::after { content: "↓"; color: var(--brand-fg); }
.row-link { cursor: pointer; }
.cell-flex { display: flex; align-items: center; gap: 12px; min-width: 0; }
.veh-thumb { width: 56px; height: 40px; border-radius: 8px; object-fit: cover; flex: none; background: var(--surface-3); }
.veh-thumb.placeholder { display: inline-flex; align-items: center; justify-content: center; color: var(--faint); }
.veh-thumb.lg { width: 100%; height: 220px; border-radius: var(--radius-lg); }
.veh-thumb.lg.placeholder .ic { width: 64px; height: 64px; }

@media (max-width: 760px) {
  .table.responsive thead { display: none; }
  .table.responsive, .table.responsive tbody, .table.responsive tr, .table.responsive td { display: block; width: 100%; }
  .table.responsive tr { border-bottom: 1px solid var(--border); padding: 10px 14px; }
  .table.responsive td { border: 0; padding: 4px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .table.responsive td::before { content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 600; text-align: left; flex: none; }
  .table.responsive td[data-label=""]::before { display: none; }
  .table.responsive td.actions { justify-content: flex-end; padding-top: 8px; }
  .table.responsive td .cell-flex { justify-content: flex-end; }
  .table.responsive tfoot { display: block; }
  .table.responsive tfoot tr { display: flex; justify-content: space-between; }
}

/* pager */
.pager { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: var(--s4); border-top: 1px solid var(--border); }
.pager-info { color: var(--muted); font-size: var(--fs-sm); padding: var(--s3) var(--s4); text-align: center; }
.pager .pager-info { padding: 0; order: 2; }
.pager-links { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.pg { min-width: 36px; height: 36px; padding: 0 8px; border-radius: 10px; border: 1px solid var(--border); display: inline-flex; align-items: center; justify-content: center; color: var(--text); font-weight: 600; font-size: var(--fs-sm); text-decoration: none !important; background: var(--surface); transition: background var(--ease), border-color var(--ease), transform var(--ease); }
a.pg:hover { transform: translateY(-1px); border-color: var(--border-strong); }
.pg .ic { width: 16px; height: 16px; }
.pg:hover { background: var(--surface-3); }
.pg.current { background: var(--brand); border-color: var(--brand-fg); color: var(--brand-ink); }
.pg.disabled { opacity: .45; }

/* -------------------------------------------------------------- tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: var(--s4); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { border: 0; background: transparent; padding: 10px 14px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; transition: color var(--ease), border-color var(--ease); }
.tab-panel:not([hidden]) { animation: pageIn .3s ease both; }
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--brand-fg); border-bottom-color: var(--brand-fg); }
.tab .count { background: var(--surface-3); color: var(--text-2); border-radius: 10px; padding: 0 7px; font-size: 11px; line-height: 18px; }
.tab-links { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: var(--s4); overflow-x: auto; scrollbar-width: none; }
.tab-links::-webkit-scrollbar { display: none; }
.tab-links a { padding: 10px 14px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; text-decoration: none !important; transition: color var(--ease), border-color var(--ease); }
.tab-links a.active { color: var(--brand-fg); border-bottom-color: var(--brand-fg); }
.tab-links a:hover { color: var(--text); }

/* -------------------------------------------------------------- toasts, modal, empty, locked */
.toasts { position: fixed; top: calc(var(--top-h) + 12px); right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; max-width: min(420px, calc(100vw - 32px)); pointer-events: none; }
.toast { display: flex; align-items: flex-start; gap: 10px; padding: 12px 12px 12px 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-3); pointer-events: auto; animation: toastIn .25s ease; border-left: 4px solid var(--info); }
.toast span { flex: 1; padding-top: 1px; }
.toast-success { border-left-color: var(--ok); } .toast-success > .ic { color: var(--ok); }
.toast-error { border-left-color: var(--danger); } .toast-error > .ic { color: var(--danger); }
.toast-warning { border-left-color: var(--warn); } .toast-warning > .ic { color: var(--warn); }
.toast-info > .ic { color: var(--info); }
.toast-close { border: 0; background: transparent; color: var(--muted); cursor: pointer; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; border-radius: 6px; padding: 0; }
.toast-close:hover { background: var(--surface-3); }
.toast-close .ic { width: 15px; height: 15px; }
.toast.hide { opacity: 0; transform: translateX(20px); transition: all .25s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

.modal { position: fixed; inset: 0; z-index: 300; background: rgba(10, 12, 16, .55); display: flex; align-items: center; justify-content: center; padding: 20px; opacity: 0; transition: opacity .2s ease; backdrop-filter: blur(3px); }
.modal.show { opacity: 1; }
.modal-card { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-3); width: 100%; max-width: 440px; padding: var(--s6); max-height: calc(100vh - 40px); overflow-y: auto; transform: translateY(10px) scale(.97); transition: transform .22s cubic-bezier(.4,0,.2,1); }
.modal.show .modal-card { transform: none; }
html.theme-fade, html.theme-fade *, html.theme-fade *::before, html.theme-fade *::after { transition: background-color .35s ease, border-color .35s ease, color .35s ease, fill .35s ease !important; }
.modal-card.wide { max-width: 720px; }
.modal-title { font-size: var(--fs-lg); margin-bottom: var(--s2); }
.modal-text { color: var(--text-2); }
.modal-actions { display: flex; justify-content: flex-end; gap: var(--s2); margin-top: var(--s5); }
body.modal-open { overflow: hidden; }

.empty { text-align: center; padding: var(--s8) var(--s5); color: var(--muted); }
.empty-icon { width: 56px; height: 56px; margin: 0 auto var(--s3); border-radius: 16px; background: var(--surface-3); display: flex; align-items: center; justify-content: center; color: var(--faint); }
.empty-icon .ic { width: 28px; height: 28px; }
.empty-title { font-weight: 650; color: var(--text); font-size: var(--fs-md); margin-bottom: 4px; }
.empty-text { max-width: 420px; margin: 0 auto; }
.empty-action { margin-top: var(--s4); display: flex; justify-content: center; gap: var(--s2); }

.locked-card { max-width: 640px; margin: var(--s8) auto; text-align: center; padding: var(--s8); }
.locked-icon { width: 64px; height: 64px; border-radius: 18px; background: var(--brand-50); color: var(--brand-tint-fg); margin: 0 auto var(--s4); display: flex; align-items: center; justify-content: center; }
.locked-icon .ic { width: 30px; height: 30px; }
.price-line { font-size: var(--fs-lg); }
.error-page { text-align: center; padding: var(--s6) 0; max-width: 520px; margin: 0 auto; animation: pageIn .4s ease both; }
.error-page h1 { font-size: var(--fs-2xl); }
.error-page p { color: var(--muted); }
.error-art { width: 280px; max-width: 80%; margin: 0 auto 10px; color: var(--text-2); }
.error-art .err-car { animation: bob 4s ease-in-out infinite; }
.error-art .err-steam circle { animation: steam 2.4s ease-in-out infinite; }
.error-art .err-steam circle:nth-child(2) { animation-delay: .4s; } .error-art .err-steam circle:nth-child(3) { animation-delay: .8s; }
@keyframes steam { 0%, 100% { opacity: .05; transform: translateY(4px); } 50% { opacity: .25; transform: none; } }
.error-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: radial-gradient(80% 60% at 50% 0%, var(--brand-50), var(--bg) 70%); }
.reauth-card { max-width: 460px; margin: 48px auto; text-align: center; padding: var(--s7); }
.reauth-card form { text-align: left; }
.reauth-icon { width: 64px; height: 64px; border-radius: 18px; margin: 0 auto 14px; background: var(--brand-50); color: var(--brand-tint-fg); display: flex; align-items: center; justify-content: center; }
.reauth-icon .ic { width: 30px; height: 30px; }
.reauth-title { font-size: var(--fs-xl); }
.error-code { font-size: 56px; font-weight: 800; color: var(--brand-fg); letter-spacing: -.04em; line-height: 1; margin-bottom: var(--s3); }
.error-actions { display: flex; justify-content: center; gap: var(--s2); margin-top: var(--s5); flex-wrap: wrap; }

.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius); font-size: var(--fs-sm); margin-bottom: var(--s4); }
.alert > .ic { margin-top: 1px; }
.alert-info { background: var(--info-bg); color: var(--info-ink); }
.alert-warn { background: var(--warn-bg); color: var(--warn-ink); }
.alert-danger { background: var(--danger-bg); color: var(--danger-ink); }
.alert-success { background: var(--ok-bg); color: var(--ok-ink); }
.alert strong { font-weight: 700; }

/* -------------------------------------------------------------- timeline */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 15px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.tl-item { position: relative; padding: 0 0 var(--s4) 44px; }
.tl-dot { position: absolute; left: 4px; top: 0; width: 24px; height: 24px; border-radius: 50%; background: var(--surface); border: 2px solid var(--border-strong); display: flex; align-items: center; justify-content: center; color: var(--muted); }
.tl-dot .ic { width: 12px; height: 12px; }
.tl-item.brand .tl-dot { border-color: var(--brand-fg); color: var(--brand-fg); background: var(--brand-50); }
.tl-item.ok .tl-dot { border-color: var(--ok); color: var(--ok); background: var(--ok-bg); }
.tl-item.warn .tl-dot { border-color: var(--warn); color: var(--warn); background: var(--warn-bg); }
.tl-title { font-weight: 600; }
.tl-meta { font-size: 12px; color: var(--muted); }
.tl-body { margin-top: 4px; color: var(--text-2); white-space: pre-line; }

/* progress steps */
.steps { display: flex; gap: 0; margin-bottom: var(--s5); }
.step { flex: 1; min-width: 0; text-align: center; position: relative; font-size: 12px; color: var(--muted); font-weight: 600; padding: 30px 2px 0; line-height: 1.3; }
.step::before { content: ""; position: absolute; top: 11px; left: 0; right: 0; height: 3px; background: transparent; transition: background .4s ease; }
.step:last-child::before { right: 50%; }
.step:first-child::before { left: 50%; } .step:last-child::before { right: 50%; }
.step::after { content: ""; position: absolute; top: 4px; left: 50%; transform: translateX(-50%); width: 17px; height: 17px; border-radius: 50%; background: var(--surface); border: 3px solid var(--border-strong); box-sizing: border-box; }
.step.done { color: var(--text-2); } .step.done::before { background: var(--brand); } .step.done::after { background: var(--brand); border-color: var(--brand-fg); }
.step.current { color: var(--brand-fg); } .step.current::before { background: var(--brand); right: 50%; } .step.current::after { border-color: var(--brand-fg); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 22%, transparent); }
.step:first-child.current::before { display: none; }
.step.cancelled::after { border-color: var(--danger); }

/* progress bar */
.bar { height: 8px; background: var(--surface-3); border-radius: 4px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--brand); border-radius: 4px; }
.bar.ok > span { background: var(--ok); } .bar.warn > span { background: var(--warn); } .bar.danger > span { background: var(--danger); }

/* -------------------------------------------------------------- kanban (jobs board) */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: var(--s3); overflow-x: auto; padding-bottom: var(--s3); align-items: start; }
.board-col { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--s3); min-height: 120px; }
.board-col-head { display: flex; align-items: center; justify-content: space-between; font-weight: 650; font-size: var(--fs-sm); margin-bottom: var(--s3); padding: 0 4px; }
.board-card { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 8px; color: var(--text); box-shadow: var(--shadow-1); text-decoration: none !important; border-left: 3px solid var(--border-strong); }
.board-card:hover { box-shadow: var(--shadow-2); border-color: var(--brand-tint-fg); }
.board-card.p-high { border-left-color: var(--warn); } .board-card.p-urgent { border-left-color: var(--danger); }
.board-card .bc-top { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); }
.board-card .bc-title { font-weight: 650; margin: 3px 0; }
.board-card .bc-meta { font-size: 12px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* -------------------------------------------------------------- appointment calendar */
.cal { border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; background: var(--surface); }
.cal-head { display: grid; grid-template-columns: repeat(7, 1fr); background: var(--surface-2); border-bottom: 1px solid var(--border); }
.cal-head div { padding: 8px; font-size: 12px; text-transform: uppercase; color: var(--muted); font-weight: 650; text-align: center; letter-spacing: .05em; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-cell { min-height: 112px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 6px; position: relative; min-width: 0; }
.cal-cell:nth-child(7n) { border-right: 0; }
.cal-cell.blank { background: repeating-linear-gradient(-45deg, var(--surface-2), var(--surface-2) 6px, var(--surface) 6px, var(--surface) 12px); }
.cal-daynum { font-size: 12px; font-weight: 700; color: var(--text-2); display: inline-flex; width: 24px; height: 24px; align-items: center; justify-content: center; border-radius: 50%; }
.cal-cell.today .cal-daynum { background: var(--brand); color: var(--brand-ink); }
.cal-ev { display: block; font-size: 11.5px; padding: 3px 6px; border-radius: 5px; margin-top: 3px; background: var(--brand-50); color: var(--text); border-left: 3px solid var(--brand); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-decoration: none !important; }
.cal-ev:hover { filter: brightness(.96); }
.cal-ev.st-requested { background: var(--warn-bg); border-left-color: var(--warn); }
.cal-ev.st-cancelled, .cal-ev.st-no_show { opacity: .55; text-decoration: line-through !important; }
.cal-ev.st-checked_in, .cal-ev.st-completed { background: var(--ok-bg); border-left-color: var(--ok); }
.cal-more { font-size: 11px; color: var(--muted); margin-top: 3px; display: block; }
.cal-add { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 6px; display: none; align-items: center; justify-content: center; color: var(--muted); }
.cal-add .ic { width: 14px; height: 14px; }
.cal-cell:hover .cal-add { display: flex; }
.cal-add:hover { background: var(--surface-3); color: var(--brand-fg); }
.cal-toolbar { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; margin-bottom: var(--s3); }
.cal-toolbar .cal-month { font-size: var(--fs-lg); font-weight: 700; min-width: 170px; text-align: center; }
.day-agenda .agenda-row { display: grid; grid-template-columns: 90px minmax(0, 1fr) auto; gap: var(--s3); padding: 10px 0; border-bottom: 1px solid var(--border); align-items: center; }

/* bay timeline (day view) */
.bay-day { overflow-x: auto; }
.bay-grid { display: grid; min-width: 760px; }
.bay-row { display: grid; grid-template-columns: 140px 1fr; border-bottom: 1px solid var(--border); min-height: 46px; }
.bay-name { padding: 10px; font-weight: 600; font-size: var(--fs-sm); background: var(--surface-2); border-right: 1px solid var(--border); }
.bay-track { position: relative; background-image: linear-gradient(90deg, var(--border) 1px, transparent 1px); background-size: calc(100% / var(--hours, 10)) 100%; }
.bay-block { position: absolute; top: 6px; bottom: 6px; border-radius: 6px; background: var(--brand); color: var(--brand-ink); font-size: 11px; padding: 3px 6px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; text-decoration: none !important; }
.bay-hours { display: grid; grid-template-columns: 140px 1fr; font-size: 11px; color: var(--muted); }
.bay-hours .hrs { display: grid; grid-template-columns: repeat(var(--hours, 10), 1fr); }

/* -------------------------------------------------------------- vehicle & media */
.vehicle-hero { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: var(--s5); margin-bottom: var(--s4); }
.vehicle-hero .hero-img { width: 100%; aspect-ratio: 16/10; object-fit: cover; border-radius: var(--radius-lg); background: var(--surface-3); display: flex; align-items: center; justify-content: center; color: var(--faint); }
.vehicle-hero .hero-img .ic { width: 72px; height: 72px; }
.plate { display: inline-flex; align-items: center; padding: 3px 10px; border: 2px solid var(--text); border-radius: 6px; font-family: var(--mono); font-weight: 800; letter-spacing: .08em; background: #FFD43B; color: #111; font-size: 14px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: var(--s3); }
.gallery-item { margin: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.gallery-item img, .gallery-item .file-tile { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 4px; background: var(--surface-3); color: var(--muted); font-weight: 700; font-size: 12px; text-decoration: none !important; }
.gallery-item .file-tile .ic { width: 30px; height: 30px; }
.gallery-item figcaption { display: flex; align-items: center; gap: 6px; padding: 6px 8px; font-size: 12px; }
.gallery-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gallery-item figcaption form { margin: 0; }
.lightbox { position: fixed; inset: 0; z-index: 400; background: rgba(0,0,0,.85); display: flex; align-items: center; justify-content: center; padding: 30px; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; box-shadow: var(--shadow-3); }

/* damage diagram */
.damage-map { position: relative; max-width: 420px; margin: 0 auto; user-select: none; }
.damage-map svg.car-diagram { width: 100%; height: auto; color: var(--text-2); }
.damage-map.editable svg.car-diagram { cursor: crosshair; }
.dmg-marker { position: absolute; width: 24px; height: 24px; margin: -12px 0 0 -12px; border-radius: 50%; background: var(--danger); color: #fff; font-size: 11px; font-weight: 800; display: flex; align-items: center; justify-content: center; border: 2px solid #fff; box-shadow: var(--shadow-2); cursor: pointer; }
.dmg-marker.t-scratch { background: #D97706; } .dmg-marker.t-dent { background: #B91C1C; } .dmg-marker.t-crack { background: #7C3AED; } .dmg-marker.t-chip { background: #0369A1; } .dmg-marker.t-missing { background: #111827; }
.dmg-legend { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; justify-content: center; margin-top: 8px; }
.dmg-legend span { display: inline-flex; align-items: center; gap: 5px; }
.dmg-legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dmg-list { font-size: var(--fs-sm); margin: 8px 0 0; padding-left: 18px; }
.dmg-tools { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-bottom: 8px; }
.dmg-tools button { border: 1px solid var(--border); background: var(--surface); padding: 5px 10px; border-radius: 7px; cursor: pointer; font: inherit; font-size: 12px; color: var(--text); }
.dmg-tools button.active { background: var(--text); color: var(--surface); border-color: var(--text); }

/* fuel gauge */
.fuel-gauge { display: inline-flex; gap: 2px; vertical-align: middle; }
.fuel-gauge i { width: 7px; height: 14px; border-radius: 2px; background: var(--surface-3); border: 1px solid var(--border); }
.fuel-gauge i.on { background: var(--ok); border-color: var(--ok); }

/* signature pad */
.sig-pad { border: 1.5px dashed var(--border-strong); border-radius: var(--radius); background: #fff; position: relative; touch-action: none; }
.sig-pad canvas { width: 100%; height: 180px; display: block; cursor: crosshair; border-radius: var(--radius); }
.sig-pad .sig-hint { position: absolute; bottom: 10px; left: 0; right: 0; text-align: center; color: #9aa2ad; font-size: 12px; pointer-events: none; }
.sig-pad .sig-line { position: absolute; left: 20px; right: 20px; bottom: 34px; border-bottom: 1px solid #d0d4da; pointer-events: none; }
.sig-actions { display: flex; justify-content: space-between; margin-top: 6px; gap: 8px; }
.sig-img { max-height: 90px; background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 4px; }

/* line editor */
.lines-table input.input { height: 36px; padding: 0 8px; }
.lines-table .x-select-wrap { min-width: 180px; }
.lines-table td { vertical-align: top; }
.totals { margin-left: auto; max-width: 340px; width: 100%; }
.totals .t-row { display: flex; justify-content: space-between; padding: 6px 0; font-variant-numeric: tabular-nums; }
.totals .t-row.grand { font-size: var(--fs-lg); font-weight: 800; border-top: 2px solid var(--text); margin-top: 6px; padding-top: 10px; }
.totals .t-row.due { color: var(--brand-fg); font-weight: 800; }

/* checklist (inspection) */
.inspect-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s3); align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.inspect-row .note { grid-column: 1 / -1; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius); overflow: hidden; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg label { padding: 6px 12px; font-size: 12px; font-weight: 650; cursor: pointer; border-right: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); display: inline-flex; align-items: center; justify-content: center; min-width: 52px; }
.seg label:last-of-type { border-right: 0; }
.seg input:checked + label.s-ok { background: var(--ok); color: #fff; }
.seg input:checked + label.s-attention { background: var(--warn); color: #fff; }
.seg input:checked + label.s-urgent { background: var(--danger); color: #fff; }
.seg input:checked + label.s-na { background: var(--muted); color: #fff; }
.seg input:focus-visible + label { box-shadow: inset 0 0 0 2px var(--brand); }

/* timer */
.timer { font-family: var(--mono); font-weight: 700; font-size: var(--fs-lg); font-variant-numeric: tabular-nums; }
.timer.running { color: var(--ok); }

/* -------------------------------------------------------------- charts */
.chart { position: relative; width: 100%; height: var(--chart-h, 240px); }
.chart svg { width: 100%; height: 100%; overflow: visible; }
.chart-loading { color: var(--faint); font-size: 12px; display: flex; align-items: center; justify-content: center; height: 100%; }
.chart .axis text { fill: var(--muted); font-size: 11px; }
.chart .grid line { stroke: var(--border); stroke-dasharray: 3 3; }
.chart .baseline { stroke: var(--border-strong); }
.chart-legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--text-2); margin-top: 8px; justify-content: center; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.chart-tip { position: absolute; pointer-events: none; background: var(--text); color: var(--surface); font-size: 12px; padding: 6px 9px; border-radius: 7px; white-space: nowrap; transform: translate(-50%, -110%); z-index: 5; box-shadow: var(--shadow-2); }
.chart-tip b { font-weight: 700; }
.donut-wrap { display: flex; align-items: center; gap: var(--s5); flex-wrap: wrap; justify-content: center; }
.donut-center { font-size: 22px; font-weight: 800; fill: var(--text); }
.donut-sub { font-size: 11px; fill: var(--muted); }

/* -------------------------------------------------------------- auth pages */
.realm-public, .realm-tenant_public { background: var(--bg); }
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); }
.auth-panel { position: sticky; top: 0; height: 100vh; min-height: 560px; overflow: hidden; color: #fff; display: flex; flex-direction: column; padding: 40px 48px; gap: 26px; background: radial-gradient(120% 90% at 0% 0%, color-mix(in srgb, var(--brand) 70%, #000) 0%, #11141a 55%, #0b0d10 100%); }
.auth-panel.has-cover { background: #0b0d10 var(--cover) center / cover no-repeat; }
.auth-panel.has-cover::before { content: ""; position: absolute; inset: 0; background: linear-gradient(160deg, color-mix(in srgb, var(--brand) 55%, transparent), rgba(10, 12, 16, .9) 70%); }
.auth-panel > * { position: relative; z-index: 1; }
.auth-panel::after { content: ""; position: absolute; width: 520px; height: 520px; border-radius: 50%; right: -180px; bottom: -220px; background: radial-gradient(circle, color-mix(in srgb, var(--accent) 45%, transparent), transparent 70%); opacity: .55; pointer-events: none; }
.auth-panel .brand { color: #fff; font-size: var(--fs-lg); }
.auth-hero { max-width: 520px; }
.auth-hero h2 { font-size: clamp(28px, 2.6vw, 38px); line-height: 1.12; letter-spacing: -.025em; margin: 0 0 12px; font-weight: 750; }
.auth-hero p { color: rgba(255,255,255,.72); font-size: var(--fs-md); margin: 0; max-width: 460px; }
.auth-art-wrap { position: relative; flex: 1; display: flex; align-items: center; justify-content: center; min-height: 240px; }
.auth-art { width: 100%; max-width: 560px; height: auto; filter: drop-shadow(0 30px 50px rgba(0,0,0,.35)); animation: artIn .8s cubic-bezier(.2,.8,.2,1) both; }
@keyframes artIn { from { opacity: 0; transform: translateY(18px) scale(.98); } to { opacity: 1; transform: none; } }
.auth-art .spin-slow { animation: spinG 16s linear infinite; transform-box: fill-box; transform-origin: center; }
.auth-art .spin-rev { animation: spinG 11s linear infinite reverse; transform-box: fill-box; transform-origin: center; }
.auth-art .lift-bob { animation: bob 5s ease-in-out infinite; }
@keyframes spinG { to { transform: rotate(360deg); } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.float-card { position: absolute; display: inline-flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 12px; background: rgba(255,255,255,.95); color: #16191f; font-size: 13px; font-weight: 650; box-shadow: 0 18px 40px rgba(0,0,0,.35); animation: floatY 6s ease-in-out infinite, artIn .9s .25s cubic-bezier(.2,.8,.2,1) both; }
.float-card .ic { width: 18px; height: 18px; padding: 6px; box-sizing: content-box; border-radius: 8px; background: var(--brand); color: #fff; }
.float-card.fc1 { top: 8%; left: 2%; }
.float-card.fc2 { bottom: 10%; right: 2%; animation-delay: -3s, .45s; }
.float-card.fc2 .ic { background: #15803D; }
@keyframes floatY { 0%, 100% { translate: 0 0; } 50% { translate: 0 -8px; } }
.auth-points { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.auth-points li { display: flex; align-items: center; gap: 10px; font-size: 13px; color: rgba(255,255,255,.85); font-weight: 500; line-height: 1.35; }
.auth-points li span { width: 34px; height: 34px; border-radius: 10px; background: rgba(255,255,255,.1); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.auth-points .ic { width: 17px; height: 17px; color: #fff; }
.auth-card { display: flex; flex-direction: column; background: var(--surface); min-height: 100vh; padding: 40px 56px 24px; }
.auth-card-inner { width: 100%; max-width: 420px; margin: auto; padding: 24px 0; animation: pageIn .45s ease both; }
.auth-brand-mobile { display: none !important; margin-bottom: 28px; }
.auth-title { font-size: 30px; letter-spacing: -.02em; margin-bottom: 6px; font-weight: 750; }
.auth-sub { color: var(--muted); margin-bottom: var(--s6); }
.auth-card form .field + .field { margin-top: var(--s4); }
.auth-card form .form-grid .field + .field { margin-top: 0; }
.auth-card .form-actions { margin-top: var(--s6); }
.auth-links { display: flex; justify-content: space-between; gap: var(--s3); margin-top: var(--s5); font-size: var(--fs-sm); flex-wrap: wrap; }
.auth-foot { text-align: center; color: var(--faint); font-size: var(--fs-xs); padding-top: 16px; }
.otp-input { font-family: var(--mono); font-size: 24px; letter-spacing: .4em; text-align: center; height: 54px; }
.recovery-codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; font-family: var(--mono); font-size: var(--fs-md); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--s4); }

/* -------------------------------------------------------------- public marketing site */
.site-header { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.site-header-inner { max-width: 1200px; margin: 0 auto; padding: 0 var(--s5); height: 68px; display: flex; align-items: center; gap: var(--s5); }
.site-nav { display: flex; gap: var(--s5); margin-left: var(--s5); }
.site-nav a { color: var(--text-2); font-weight: 600; transition: color var(--ease); }
.site-nav .site-nav-cta { display: none; }
.site-nav a:hover { color: var(--brand-fg); text-decoration: none; }
.site-cta { margin-left: auto; display: flex; gap: var(--s2); align-items: center; }
.site-menu-btn { display: none; margin-left: auto; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 var(--s5); }
.hero { padding: 80px 0 64px; background: var(--side-bg); color: #fff; position: relative; overflow: hidden; }
.hero::before { content: ""; position: absolute; width: 720px; height: 720px; right: -200px; top: -260px; border-radius: 50%; background: var(--brand); opacity: .28; }
.hero::after { content: ""; position: absolute; width: 420px; height: 420px; left: -160px; bottom: -260px; border-radius: 50%; background: var(--accent); opacity: .22; }
.hero .container { position: relative; z-index: 1; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: var(--s8); align-items: center; }
.hero h1 { font-size: 48px; line-height: 1.08; letter-spacing: -.03em; margin-bottom: var(--s4); }
.hero h1 em { font-style: normal; color: color-mix(in srgb, var(--brand) 60%, #fff); }
.hero p.lead { font-size: 19px; color: #C9CDD4; max-width: 560px; }
.hero-cta { display: flex; gap: var(--s3); margin-top: var(--s6); flex-wrap: wrap; }
.hero-cta .btn-ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.35); }
.hero-cta .btn-ghost:hover { background: rgba(255,255,255,.08); }
.hero-points { display: flex; gap: var(--s5); margin-top: var(--s6); flex-wrap: wrap; color: #C9CDD4; font-size: var(--fs-sm); }
.hero-points span { display: inline-flex; align-items: center; gap: 6px; }
.hero-points .ic { color: #4ADE80; width: 16px; height: 16px; }
.hero-mock { background: #fff; border-radius: 16px; box-shadow: 0 30px 80px rgba(0,0,0,.45); padding: 14px; color: #16191f; transform: rotate(-1.2deg); }
.mock-bar { display: flex; gap: 6px; margin-bottom: 12px; }
.mock-bar i { width: 10px; height: 10px; border-radius: 50%; background: #e1e4e8; }
.mock-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.mock-stat { background: #f4f5f7; border-radius: 10px; padding: 10px; }
.mock-stat b { display: block; font-size: 20px; }
.mock-stat small { color: #687280; font-size: 11px; }
.mock-row { display: flex; align-items: center; gap: 10px; padding: 8px; border-bottom: 1px solid #eef0f3; font-size: 13px; }
.mock-row .badge { margin-left: auto; }
.section { padding: 80px 0; }
.section-alt { background: var(--surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section-head { text-align: center; max-width: 720px; margin: 0 auto var(--s8); }
.section-head h2 { font-size: 34px; letter-spacing: -.02em; }
.section-head p { color: var(--muted); font-size: var(--fs-lg); }
.eyebrow { display: inline-block; font-size: 12px; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; color: var(--brand-fg); margin-bottom: var(--s2); }
.feature-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s5); }
.feature { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--s6); }
.feature-icon { width: 46px; height: 46px; border-radius: 12px; background: var(--brand-50); color: var(--brand-fg); display: flex; align-items: center; justify-content: center; margin-bottom: var(--s4); }
.feature-icon .ic { width: 22px; height: 22px; }
.feature h3 { font-size: var(--fs-lg); }
.feature p { color: var(--muted); margin: 0; }
.addon-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--s4); }
.addon-card { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--s5); background: var(--bg); position: relative; display: flex; flex-direction: column; }
.addon-card .feature-icon { background: var(--accent-50); color: var(--accent-fg); }
.addon-card .addon-price { margin-top: auto; padding-top: var(--s3); font-weight: 700; }
.addon-card.soon { opacity: .75; }
.pricing-toggle { display: inline-flex; background: var(--surface-3); border-radius: var(--radius-pill); padding: 4px; margin: 0 auto var(--s6); }
.pricing-toggle button { border: 0; background: transparent; padding: 8px 18px; border-radius: var(--radius-pill); font: inherit; font-weight: 650; cursor: pointer; color: var(--text-2); }
.pricing-toggle button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--s5); align-items: stretch; }
.plan { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--s6); display: flex; flex-direction: column; position: relative; }
.plan.featured { border: 2px solid var(--brand); box-shadow: var(--shadow-3); }
.plan-flag { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: var(--brand); color: var(--brand-ink); font-size: 12px; font-weight: 700; padding: 3px 12px; border-radius: var(--radius-pill); white-space: nowrap; }
.plan-name { font-size: var(--fs-lg); font-weight: 700; }
.plan-price { font-size: 40px; font-weight: 800; letter-spacing: -.03em; margin: var(--s3) 0 0; line-height: 1; }
.plan-price small { font-size: var(--fs); color: var(--muted); font-weight: 500; letter-spacing: 0; }
.plan-desc { color: var(--muted); margin: var(--s3) 0; }
.plan-list { list-style: none; padding: 0; margin: var(--s3) 0 var(--s5); display: flex; flex-direction: column; gap: 8px; }
.plan-list li { display: flex; gap: 8px; align-items: flex-start; }
.plan-list .ic { color: var(--ok); width: 17px; height: 17px; margin-top: 2px; }
.plan .btn { margin-top: auto; }
.cta-band { background: var(--brand); color: var(--brand-ink); border-radius: var(--radius-lg); padding: var(--s8); display: flex; align-items: center; justify-content: space-between; gap: var(--s5); flex-wrap: wrap; }
.cta-band h2 { margin: 0 0 6px; }
.cta-band p { margin: 0; opacity: .9; }
.cta-band .btn { background: #fff; color: #16191f; border-color: #fff; }
.site-footer { background: var(--side-bg); color: var(--side-text); padding: var(--s8) 0 var(--s6); margin-top: var(--s9); }
.site-footer a { color: var(--side-text); }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: var(--s6); }
.footer-grid h4 { color: #fff; font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: .08em; }
.footer-grid ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.08); margin-top: var(--s6); padding-top: var(--s4); font-size: var(--fs-sm); color: var(--side-muted); display: flex; justify-content: space-between; flex-wrap: wrap; gap: var(--s3); }
.workflow { display: grid; grid-template-columns: repeat(6, 1fr); gap: var(--s3); counter-reset: wf; }
.wf-step { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--s4); position: relative; counter-increment: wf; }
.wf-step::before { content: counter(wf); width: 26px; height: 26px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; margin-bottom: var(--s2); }
.wf-step b { display: block; margin-bottom: 4px; }
.wf-step span { color: var(--muted); font-size: var(--fs-sm); }
.faq { display: flex; flex-direction: column; gap: 10px; text-align: left; }
.faq details { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); padding: 0 var(--s5); transition: border-color var(--ease), box-shadow var(--ease); }
.faq details[open] { border-color: color-mix(in srgb, var(--brand) 35%, var(--border)); box-shadow: var(--shadow-2); }
.faq summary { font-weight: 650; cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: var(--s3); padding: 18px 0; font-size: var(--fs-md); }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: ""; width: 22px; height: 22px; flex: none; border-radius: 50%; background: var(--surface-3) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23687280' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") center / 14px no-repeat; transition: transform .3s ease, background-color .2s ease; }
.faq details[open] summary::after { transform: rotate(180deg); }
.faq p { margin: 0 0 18px; color: var(--text-2); }
details > summary { list-style: none; } details > summary::-webkit-details-marker { display: none; }
.social-links { display: flex; gap: 8px; flex-wrap: wrap; margin-top: var(--s3); }
.social-links a { padding: 6px 12px; border-radius: var(--radius-pill); border: 1px solid rgba(255,255,255,.14); font-size: var(--fs-sm); transition: background var(--ease); }
.social-links a:hover { background: rgba(255,255,255,.08); text-decoration: none; }
.footer-contact li { display: flex; gap: 10px; align-items: flex-start; }
.footer-contact .ic { width: 16px; height: 16px; margin-top: 3px; color: color-mix(in srgb, var(--brand) 60%, #fff); }
.contact-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: var(--s8); align-items: start; }
.contact-title { font-size: 40px; letter-spacing: -.02em; }
.contact-cards { display: grid; gap: 12px; margin-top: var(--s6); }
.contact-item { display: flex; gap: 14px; align-items: center; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); transition: transform var(--ease), box-shadow var(--ease); }
.contact-item:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.contact-ic { width: 42px; height: 42px; border-radius: 12px; background: var(--brand-50); color: var(--brand-fg); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.save-pill { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: var(--radius-pill); background: var(--ok-bg); color: var(--ok-ink); font-size: 11px; font-weight: 700; }
.plan-yearly-note { color: var(--muted); font-size: var(--fs-sm); margin-top: 6px; }
.price-swap { display: inline-block; animation: priceIn .35s ease; }
@keyframes priceIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* -------------------------------------------------------------- portal tweaks */
.realm-customer .sidebar { background: var(--surface); color: var(--text); border-right: 1px solid var(--border); }
.realm-customer .sidebar .brand { color: var(--text); }
.realm-customer .sidebar-head { border-bottom-color: var(--border); }
.realm-customer .nav-link { color: var(--text-2); }
.realm-customer .nav-link:hover { background: var(--surface-3); color: var(--text); }
.realm-customer .nav-link.active { background: var(--brand-50); color: var(--brand-tint-fg); }
[data-theme="dark"] .realm-customer .nav-link.active { color: var(--brand-tint-fg); }
.realm-customer .nav-link.active .ic { color: var(--brand-tint-fg); }
.realm-customer .sidebar-foot { border-top-color: var(--border); color: var(--muted); }
.welcome { background: var(--brand); color: var(--brand-ink); border-radius: var(--radius-lg); padding: var(--s6); margin-bottom: var(--s4); display: flex; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; align-items: center; }
.welcome h1 { margin: 0 0 4px; }
.welcome p { margin: 0; opacity: .9; }
.welcome .btn { background: var(--surface); color: var(--text); border-color: transparent; }
.vehicle-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--s4); }
.vehicle-card { border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; background: var(--surface); color: var(--text); text-decoration: none !important; display: flex; flex-direction: column; box-shadow: var(--shadow-1); }
.vehicle-card:hover { box-shadow: var(--shadow-2); border-color: var(--brand-tint-fg); }
.vehicle-card .vc-img { aspect-ratio: 16/9; background: var(--surface-3); display: flex; align-items: center; justify-content: center; color: var(--faint); overflow: hidden; }
.vehicle-card .vc-img img { width: 100%; height: 100%; object-fit: cover; }
.vehicle-card .vc-img .ic { width: 56px; height: 56px; }
.vehicle-card .vc-body { padding: var(--s4); }
.vehicle-card .vc-title { font-weight: 700; font-size: var(--fs-md); }
.vehicle-card .vc-meta { color: var(--muted); font-size: var(--fs-sm); display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; align-items: center; }

/* -------------------------------------------------------------- document / print */
.doc { background: #fff; color: #16191f; max-width: 880px; margin: 0 auto; padding: 48px; border-radius: var(--radius-lg); box-shadow: var(--shadow-2); border: 1px solid var(--border); }
.doc-head { display: flex; justify-content: space-between; gap: 24px; margin-bottom: 32px; flex-wrap: wrap; }
.doc-brand .brand-logo { height: 52px; max-width: 220px; }
.doc-title { font-size: 28px; font-weight: 800; letter-spacing: -.02em; text-align: right; }
.doc-meta { text-align: right; color: #50565f; font-size: 13px; }
.doc-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 24px; font-size: 13px; }
.doc-parties h4 { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #687280; margin-bottom: 6px; }
.doc table { width: 100%; border-collapse: collapse; font-size: 13px; }
.doc th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #687280; border-bottom: 2px solid #16191f; padding: 8px 6px; }
.doc td { padding: 9px 6px; border-bottom: 1px solid #e1e4e8; vertical-align: top; }
.doc td.num, .doc th.num { text-align: right; white-space: nowrap; }
.doc .totals { margin-top: 16px; }
.doc .doc-foot { margin-top: 32px; font-size: 12px; color: #50565f; border-top: 1px solid #e1e4e8; padding-top: 14px; white-space: pre-line; }
.doc .stamp { display: inline-block; border: 3px solid currentColor; padding: 4px 14px; border-radius: 8px; font-weight: 800; letter-spacing: .12em; transform: rotate(-6deg); font-size: 18px; }
.doc .stamp.paid { color: #15803D; } .doc .stamp.void { color: #B91C1C; }
.doc-toolbar { max-width: 880px; margin: 0 auto var(--s4); display: flex; justify-content: space-between; gap: var(--s2); flex-wrap: wrap; }

@media print {
  @page { margin: 14mm; }
  body { background: #fff !important; color: #000; }
  .sidebar, .topbar, .banner, .doc-toolbar, .no-print, .toasts, .page-head .page-actions, .skip-link { display: none !important; }
  .main-col { margin: 0 !important; }
  .content { padding: 0 !important; max-width: none; }
  .doc { box-shadow: none; border: 0; padding: 0; max-width: none; }
  .card { box-shadow: none; break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
}

/* -------------------------------------------------------------- responsive */
@media (max-width: 1200px) {
  .auth-points { grid-template-columns: 1fr; }
  .auth-panel { padding: 32px 36px; }
  .auth-card { padding: 32px 36px 20px; }
  .grid-main { grid-template-columns: minmax(0, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workflow { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 1024px) {
  :root { --side-w: 280px; }
  .sidebar { transform: translateX(-100%); }
  body.nav-open .sidebar { transform: none; box-shadow: var(--shadow-3); }
  body.nav-open .sidebar-scrim { opacity: 1; visibility: visible; }
  body.nav-open { overflow: hidden; }
  .main-col { margin-left: 0; }
  .vehicle-hero { grid-template-columns: 1fr; }
  .hero .container { grid-template-columns: 1fr; }
  .hero-mock { display: none; }
  .feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-panel { display: none; }
  .auth-card { padding: 28px 20px 20px; }
  .auth-brand-mobile { display: flex !important; }
  .auth-title { font-size: 26px; }
  .site-cta { display: none; }
  .site-nav { display: flex; flex-direction: column; position: absolute; top: 68px; left: 0; right: 0; background: var(--surface); padding: var(--s4) var(--s5) var(--s5); border-bottom: 1px solid var(--border); margin: 0; gap: 4px; box-shadow: var(--shadow-3);
    opacity: 0; visibility: hidden; transform: translateY(-10px); transition: opacity .25s ease, transform .25s ease, visibility .25s; }
  .site-nav a { padding: 10px 4px; border-bottom: 1px solid var(--border); }
  .site-nav .site-nav-cta { display: flex; margin-top: 10px; border: 0; color: var(--brand-ink); }
  .site-header.open .site-nav { opacity: 1; visibility: visible; transform: none; }
  .site-menu-btn { display: inline-flex; }
  .contact-grid { grid-template-columns: 1fr; gap: var(--s6); }
  .contact-title { font-size: 32px; }
}
@media (max-width: 760px) {
  .content { padding: var(--s4); }
  .topbar { padding: 0 var(--s3); gap: var(--s2); }
  .user-meta { display: none; }
  .top-search { max-width: none; }
  .top-search input { padding-right: 8px; }
  .grid-2, .grid-3, .grid-4, .form-grid, .form-grid.cols-3, .form-grid.cols-4 { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .page-title { font-size: var(--fs-xl); }
  .page-actions { width: 100%; }
  .page-actions > .btn, .page-actions > form { flex: 1; }
  .page-actions > form .btn { width: 100%; }
  .card { padding: var(--s4); }
  .card-head { margin: calc(-1 * var(--s4)) calc(-1 * var(--s4)) var(--s4); padding: var(--s3) var(--s4); }
  .card-foot { margin: var(--s4) calc(-1 * var(--s4)) calc(-1 * var(--s4)); }
  .card:not(.card-flush) > .table-wrap:first-child:last-child { margin: calc(-1 * var(--s4)); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); }
  .stat { padding: var(--s3); gap: var(--s3); }
  .stat-icon { width: 36px; height: 36px; }
  .stat-value { font-size: 19px; }
  .cal-cell { min-height: 64px; padding: 3px; }
  .cal-ev { font-size: 0; height: 6px; padding: 0; border-left-width: 0; border-radius: 3px; }
  .cal-head div { font-size: 10px; padding: 6px 2px; }
  .hero { padding: 56px 0 48px; }
  .hero h1 { font-size: 34px; }
  .section { padding: 56px 0; }
  .feature-grid { grid-template-columns: 1fr; }
  .workflow { grid-template-columns: 1fr 1fr; }
  .doc { padding: 20px; }
  .doc-parties { grid-template-columns: 1fr; }
  .doc-title, .doc-meta { text-align: left; }
  .xd-pop { width: min(300px, calc(100vw - 32px)); }
  .toasts { top: 66px; right: 12px; left: 12px; max-width: none; }
  .filters .field { max-width: none; min-width: 100%; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 8px; }
  .modal-card { padding: var(--s5); }
}
@media (max-width: 380px) {
  .stats { grid-template-columns: 1fr; }
  .xd-day, .xd-blank { height: 32px; }
}

/* -------------------------------------------------------------- refinements */
.auth-card-inner:has(.form-grid) { max-width: 560px; }
.price-input { max-width: 180px; }
.price-input .input { height: 38px; }
.price-table td { vertical-align: middle; }
.card { transition: box-shadow var(--ease), border-color var(--ease); }
a.stat, .vehicle-card, .board-card, .feature, .addon-card, .plan { transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; }
a.stat:hover, .vehicle-card:hover, .board-card:hover { transform: translateY(-2px); }
.feature:hover, .addon-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); }
.plan:hover { transform: translateY(-4px); box-shadow: var(--shadow-3); }
.btn { transition: background var(--ease), border-color var(--ease), box-shadow var(--ease), transform .12s ease, color var(--ease); }
.btn:active { transform: translateY(1px); }
.table tbody tr td { transition: background .12s ease; }
.xs-pop, .xd-pop, .xt-pop { animation: popIn .16s ease; transform-origin: top center; }
.xs.up .xs-pop, .xd-pop.up, .xt-pop.up { transform-origin: bottom center; }
@keyframes popIn { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
.chart-skel { position: absolute; inset: 0; border-radius: 10px; background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 37%, var(--surface-3) 63%); background-size: 400% 100%; animation: shimmer 1.3s ease infinite; }
.chart svg { animation: pageIn .45s ease both; }
@media (max-width: 760px) {
  .step { font-size: 0; padding-top: 24px; }
  .step[aria-current] { font-size: 11px; }
  .steps { margin-bottom: var(--s4); }
  .notif-menu { position: fixed; left: 12px; right: 12px; top: calc(var(--top-h) + 6px); width: auto; }
  .dropdown-menu { max-width: calc(100vw - 24px); }
}

@media (max-width: 1024px) {
  body.nav-open .menu-btn { position: fixed; top: 12px; left: calc(var(--side-w) + 12px); z-index: 46; color: #fff; background: rgba(255,255,255,.14); animation: pageIn .3s ease; }
}
.notif-list { padding: 6px 0; }
.notif-day { padding: 14px 20px 6px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.notif-row { display: flex; gap: 14px; align-items: flex-start; padding: 14px 20px; color: var(--text); text-decoration: none !important; position: relative; border-left: 3px solid transparent; transition: background var(--ease); }
.notif-row:hover { background: var(--surface-2); }
.notif-row.unread { background: color-mix(in srgb, var(--brand) 5%, transparent); border-left-color: var(--brand-fg); }
.notif-row.unread .nm-title::after { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--brand); margin-left: 8px; vertical-align: middle; }
.notif-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.notif-text { color: var(--text-2); font-size: var(--fs-sm); }
.notif-time { display: flex; flex-direction: column; align-items: flex-end; font-size: 12px; color: var(--text-2); font-weight: 600; white-space: nowrap; }
.notif-time span { color: var(--faint); font-weight: 400; }
.count-pill { display: inline-flex; min-width: 18px; height: 18px; padding: 0 6px; border-radius: 9px; background: var(--brand); color: var(--brand-ink); font-size: 11px; align-items: center; justify-content: center; margin-left: 4px; }
@media (max-width: 560px) { .notif-row { padding: 12px 14px; } .notif-time { display: none; } }

@media (max-width: 760px) {
  .doc table { display: block; overflow-x: auto; white-space: nowrap; }
  .doc table td:first-child { white-space: normal; min-width: 160px; }
  .doc-head { gap: 12px; }
}

/* compact vehicle hero inside cards */
.vehicle-hero.vh-compact { grid-template-columns: var(--vh-w, 220px) minmax(0, 1fr); margin: 0; }
@media (max-width: 720px) {
  .vehicle-hero.vh-compact { grid-template-columns: 1fr; }
  .vehicle-hero.vh-compact .hero-img { max-height: 220px; }
  .vehicle-hero.vh-compact .kv-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.vehicle-hero.vh-compact .kv-cols { grid-template-columns: repeat(auto-fill, minmax(min(170px, 100%), 1fr)); }
