/* ============================================================
   AutoCare — Manager Cabinet  ·  Design system
   Clean, neutral, Linear/Stripe-flavoured minimalism.
   Everything is token-driven so Tweaks (accent / style / theme)
   can remap the whole app by overriding CSS variables.
   ============================================================ */

:root {
  /* accent is injected at runtime by the Tweaks panel; this is the fallback */
  --accent: oklch(55% 0.17 256);
  --accent-press: oklch(48% 0.17 256);
  --accent-fg: #ffffff;
  --accent-soft: color-mix(in oklch, var(--accent) 14%, white);
  --accent-line: color-mix(in oklch, var(--accent) 30%, white);

  /* neutrals — cool, low-chroma */
  --bg:        oklch(98.6% 0.003 255);
  --surface:   #ffffff;
  --surface-2: oklch(97.6% 0.004 255);
  --surface-3: oklch(95.4% 0.006 255);
  --border:    oklch(92.4% 0.006 255);
  --border-2:  oklch(88% 0.008 255);
  --text:      oklch(26% 0.013 262);
  --text-2:    oklch(48% 0.012 262);
  --text-3:    oklch(62% 0.01 262);

  --success:   oklch(56% 0.12 156);
  --success-soft: oklch(95% 0.03 156);
  --warning:   oklch(70% 0.12 72);
  --warning-soft: oklch(95% 0.04 78);
  --danger:    oklch(57% 0.18 24);
  --danger-soft:  oklch(95% 0.035 24);
  --cash:      oklch(56% 0.1 165);
  --cash-soft: oklch(95% 0.03 165);

  --r-xs: 5px;
  --r-sm: 7px;
  --r:    9px;
  --r-lg: 13px;
  --r-xl: 18px;
  --r-pill: 999px;

  --shadow-xs: 0 1px 2px rgba(18,22,31,.05);
  --shadow-sm: 0 1px 2px rgba(18,22,31,.06), 0 1px 1px rgba(18,22,31,.03);
  --shadow:    0 4px 14px -4px rgba(18,22,31,.10), 0 1px 2px rgba(18,22,31,.05);
  --shadow-lg: 0 24px 60px -16px rgba(18,22,31,.28), 0 4px 12px rgba(18,22,31,.10);

  --font: "Hanken Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --sidebar-w: 248px;
  --maxw: 1280px;

  --ease: cubic-bezier(.22,.61,.36,1);
}

/* ---- visual style variants (data-style on root) ------------- */
[data-style="warm"] {
  --bg:        oklch(98% 0.006 78);
  --surface:   oklch(99.4% 0.004 78);
  --surface-2: oklch(97% 0.008 76);
  --surface-3: oklch(94.5% 0.011 74);
  --border:    oklch(91.5% 0.012 74);
  --border-2:  oklch(87% 0.015 72);
  --text:      oklch(28% 0.018 60);
  --text-2:    oklch(49% 0.016 62);
  --text-3:    oklch(63% 0.014 64);
  --r-sm: 9px; --r: 12px; --r-lg: 16px; --r-xl: 22px;
}
[data-style="sharp"] {
  --bg:        oklch(97.5% 0.002 255);
  --surface:   #ffffff;
  --surface-2: oklch(97% 0.003 255);
  --surface-3: oklch(94% 0.004 255);
  --border:    oklch(89% 0.006 255);
  --border-2:  oklch(82% 0.01 255);
  --text:      oklch(20% 0.014 264);
  --text-2:    oklch(44% 0.013 264);
  --r-xs: 2px; --r-sm: 3px; --r: 4px; --r-lg: 6px; --r-xl: 8px;
  --shadow:    0 2px 0 rgba(18,22,31,.04), 0 0 0 1px var(--border);
}

/* ---- dark theme -------------------------------------------- */
[data-theme="dark"] {
  --bg:        oklch(19% 0.012 264);
  --surface:   oklch(23% 0.013 264);
  --surface-2: oklch(26% 0.014 264);
  --surface-3: oklch(30% 0.015 264);
  --border:    oklch(33% 0.014 264);
  --border-2:  oklch(40% 0.016 264);
  --text:      oklch(95% 0.006 264);
  --text-2:    oklch(74% 0.012 264);
  --text-3:    oklch(60% 0.013 264);
  --accent-soft: color-mix(in oklch, var(--accent) 26%, oklch(24% 0.013 264));
  --accent-line: color-mix(in oklch, var(--accent) 45%, oklch(28% 0.013 264));
  --success-soft: color-mix(in oklch, var(--success) 20%, oklch(24% 0.013 264));
  --warning-soft: color-mix(in oklch, var(--warning) 20%, oklch(24% 0.013 264));
  --danger-soft:  color-mix(in oklch, var(--danger) 22%, oklch(24% 0.013 264));
  --cash-soft:    color-mix(in oklch, var(--cash) 20%, oklch(24% 0.013 264));
  --shadow-lg: 0 24px 60px -16px rgba(0,0,0,.6), 0 4px 12px rgba(0,0,0,.4);
}

/* ============================================================ */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.mono { font-family: var(--mono); font-feature-settings: "tnum" 1; letter-spacing: -0.01em; white-space: nowrap; }
button { font-family: inherit; }
::selection { background: var(--accent-soft); }

/* ---- App frame --------------------------------------------- */
.viewport {
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}
.shell { flex: 1; display: flex; min-height: 0; }

/* ---- Sidebar ----------------------------------------------- */
.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  min-height: 0;
}
.brand {
  display: flex; align-items: center; gap: 11px;
  padding: 16px 18px 14px;
}
.brand-mark {
  width: 32px; height: 32px; border-radius: var(--r-sm);
  background: var(--accent); color: var(--accent-fg);
  display: grid; place-items: center; flex: 0 0 auto;
  box-shadow: var(--shadow-xs);
}
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: -0.02em; line-height: 1; }
.brand-sub { font-size: 11.5px; color: var(--text-3); margin-top: 3px; white-space: nowrap; }

.sidebar-tools {
  margin: 0 12px 10px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.sidebar-tools .lang-select { flex: 1; min-width: 0; }
.sidebar-tools .lang-trigger { width: 100%; justify-content: center; }
.sidebar-tools .icon-btn { flex: 0 0 auto; }

.shop-switch {
  margin: 4px 12px 8px; padding: 9px 11px;
  border: 1px solid var(--border); border-radius: var(--r);
  background: var(--surface-2);
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  transition: border-color .15s var(--ease);
}
.shop-switch:hover { border-color: var(--border-2); }
.shop-av {
  width: 28px; height: 28px; border-radius: var(--r-sm); flex: 0 0 auto;
  background: var(--surface-3); display: grid; place-items: center;
  font-weight: 700; font-size: 12px; color: var(--text-2);
}
.shop-meta { min-width: 0; flex: 1; }
.shop-meta b { font-size: 12.5px; font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shop-meta span { font-size: 11px; color: var(--text-3); }

.shop-rating {
  margin: 0 12px 8px; padding: 7px 11px;
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--border); border-radius: var(--r);
  cursor: pointer; transition: border-color .15s var(--ease), background .15s var(--ease);
}
.shop-rating:hover { border-color: var(--border-2); background: var(--surface-2); }
.shop-rating-score { display: inline-flex; align-items: center; gap: 4px; color: var(--warning); flex: 0 0 auto; }
.shop-rating-score b { font-size: 12.5px; font-weight: 700; color: var(--text); }
.shop-rating-meta { font-size: 11px; color: var(--text-3); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.nav { padding: 6px 12px; overflow-y: auto; flex: 1; }
.nav-group-label {
  font-size: 10.5px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-3);
  padding: 14px 10px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 10px; border-radius: var(--r-sm);
  color: var(--text-2); font-size: 13.5px; font-weight: 500; white-space: nowrap;
  cursor: pointer; user-select: none; position: relative;
  transition: background .12s var(--ease), color .12s var(--ease);
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
[data-theme="dark"] .nav-item.active { color: var(--text); }
.nav-item .ico { flex: 0 0 auto; opacity: .9; }
.nav-item .count {
  margin-left: auto; font-size: 11px; font-weight: 600;
  background: var(--surface-3); color: var(--text-2);
  min-width: 20px; height: 19px; border-radius: var(--r-pill);
  display: grid; place-items: center; padding: 0 6px;
}
.nav-item.active .count { background: var(--accent); color: var(--accent-fg); }
.nav-item .dot-alert {
  margin-left: auto; width: 7px; height: 7px; border-radius: 50%;
  background: var(--warning);
}

.nav-foot { padding: 10px 12px; border-top: 1px solid var(--border); }

.customer-quote-link {
  width: 100%;
  min-height: 34px;
  margin-bottom: 9px;
  padding: 0 9px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--text-2);
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}
.customer-quote-link:hover { border-color: var(--border-2); color: var(--text); }
.customer-quote-link span { flex: 1; min-width: 0; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* language dropdown */
.lang-select { position: relative; }
.lang-trigger {
  display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 8px 0 9px;
  border: 1px solid var(--border); border-radius: var(--r-sm); background: transparent;
  cursor: pointer; color: var(--text-2); font: inherit; transition: background .14s, border-color .14s, color .14s;
}
.lang-trigger:hover { background: var(--surface-2); color: var(--text); }
.lang-trigger.open { background: var(--surface-2); border-color: var(--border-2); color: var(--text); }
.lang-trigger .lang-cur { font-size: 12px; font-weight: 700; letter-spacing: .04em; }
.lang-trigger .caret { color: var(--text-3); transition: transform .16s var(--ease); }
.lang-trigger.open .caret { transform: rotate(180deg); }
.lang-menu {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 50; min-width: 168px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  box-shadow: var(--shadow-pop, 0 12px 32px rgba(0,0,0,.16)); padding: 5px;
  animation: lang-pop .14s var(--ease);
}
@keyframes lang-pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.lang-menu button {
  display: flex; align-items: center; gap: 9px; width: 100%; height: 36px; padding: 0 9px;
  border: none; background: transparent; cursor: pointer; border-radius: var(--r-sm);
  font: inherit; color: var(--text-2); text-align: left; transition: background .12s;
}
.lang-menu button:hover { background: var(--surface-2); }
.lang-menu button.on { color: var(--text); }
.lang-menu .lang-code {
  font-size: 11px; font-weight: 700; letter-spacing: .04em; color: var(--text-3);
  width: 26px; flex: 0 0 auto;
}
.lang-menu button.on .lang-code { color: var(--accent); }
.lang-menu .lang-name { flex: 1; font-size: 13px; font-weight: 550; }
.lang-menu .tick { color: var(--accent); flex: 0 0 auto; }
.user-chip {
  display: flex; align-items: center; gap: 10px; padding: 7px 9px;
  border-radius: var(--r-sm); cursor: pointer;
}
.user-chip:hover { background: var(--surface-2); }
.avatar {
  border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-weight: 700; flex: 0 0 auto;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---- Main column ------------------------------------------- */
.main { flex: 1; min-width: 0; overflow-y: auto; }
.page { max-width: var(--maxw); margin: 0 auto; padding: 26px 32px 80px; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 22px; }
.page-title { font-size: 23px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; }
.page-sub { color: var(--text-3); font-size: 13.5px; margin-top: 5px; }
.page-head .spacer { flex: 1; }

.breadcrumb { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-3); margin-bottom: 12px; }
.breadcrumb a { color: var(--text-3); cursor: pointer; text-decoration: none; }
.breadcrumb a:hover { color: var(--text); }

/* ---- Buttons ----------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 34px; padding: 0 14px; border-radius: var(--r-sm);
  font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap;
  border: 1px solid transparent; background: var(--surface); color: var(--text);
  transition: background .14s var(--ease), border-color .14s var(--ease), transform .06s var(--ease), box-shadow .14s var(--ease);
}
.btn:active { transform: translateY(.5px); }
.btn.sm { height: 29px; padding: 0 10px; font-size: 12.5px; gap: 5px; }
.btn.lg { height: 40px; padding: 0 18px; font-size: 14px; }
.btn.block { width: 100%; }
.btn-primary { background: var(--accent); color: var(--accent-fg); box-shadow: var(--shadow-xs); }
.btn-primary:hover { background: var(--accent-press); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-outline { border-color: var(--border-2); background: var(--surface); color: var(--text); }
.btn-outline:hover { background: var(--surface-2); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { background: color-mix(in oklch, var(--danger) 18%, var(--surface)); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(.95); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.icon-btn {
  width: 34px; height: 34px; padding: 0; border-radius: var(--r-sm);
  display: grid; place-items: center; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  transition: background .14s, color .14s, border-color .14s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-2); }

/* ---- Cards ------------------------------------------------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-xs);
}
.card-pad { padding: 18px; }
.card-hd { display: flex; align-items: center; gap: 10px; padding: 15px 18px; border-bottom: 1px solid var(--border); }
.card-hd h3 { font-size: 14px; font-weight: 650; letter-spacing: -0.01em; margin: 0; white-space: nowrap; }
.card-hd .spacer { flex: 1; }
.card-ft { padding: 13px 18px; border-top: 1px solid var(--border); }

/* ---- Stat cards -------------------------------------------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 15px 16px; position: relative; overflow: hidden;
}
.stat .lbl { font-size: 12px; color: var(--text-3); font-weight: 500; display: flex; align-items: center; gap: 7px; }
.stat .val { font-size: 27px; font-weight: 700; letter-spacing: -0.03em; margin-top: 9px; line-height: 1; white-space: nowrap; }
.stat .val small { font-size: 14px; color: var(--text-3); font-weight: 600; letter-spacing: 0; }
.stat .delta { font-size: 12px; font-weight: 600; margin-top: 9px; display: inline-flex; align-items: center; gap: 4px; }
.stat .delta.up { color: var(--success); }
.stat .delta.down { color: var(--danger); }
.stat .delta.flat { color: var(--text-3); }

/* ---- Badges / pills ---------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 9px; border-radius: var(--r-pill);
  font-size: 11.5px; font-weight: 600; letter-spacing: -0.005em; white-space: nowrap;
  background: var(--surface-3); color: var(--text-2);
}
.badge .pip { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.neutral { background: var(--surface-3); color: var(--text-2); }
.badge.accent  { background: var(--accent-soft); color: var(--accent); }
.badge.success { background: var(--success-soft); color: var(--success); }
.badge.warning { background: var(--warning-soft); color: oklch(48% 0.1 65); }
[data-theme="dark"] .badge.warning { color: var(--warning); }
.badge.danger  { background: var(--danger-soft); color: var(--danger); }
.badge.cash    { background: var(--cash-soft); color: var(--cash); }
.badge.outline { background: transparent; border: 1px solid var(--border-2); color: var(--text-2); }

/* ---- Tables ------------------------------------------------ */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .05em; color: var(--text-3); padding: 10px 16px; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.tbl td { padding: 13px 16px; border-bottom: 1px solid var(--border); font-size: 13.5px; vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr.clickable { cursor: pointer; }
.tbl tbody tr.clickable:hover { background: var(--surface-2); }
.tbl .num { text-align: right; font-family: var(--mono); font-size: 12.5px; }
.tbl .muted { color: var(--text-3); }

/* ---- Misc utility ------------------------------------------ */
.row { display: flex; align-items: center; gap: 10px; }
.col { display: flex; flex-direction: column; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.spacer { flex: 1; }
.muted { color: var(--text-3); }
.muted2 { color: var(--text-2); }
.tiny { font-size: 11.5px; }
.sec { font-size: 13.5px; }
.strong { font-weight: 650; }
.divider { height: 1px; background: var(--border); margin: 14px 0; }

/* grouped page sections */
.fin-group { margin-bottom: 28px; }
.fin-group:last-child { margin-bottom: 0; }
.group-label {
  display: flex; align-items: center; gap: 12px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .09em;
  text-transform: uppercase; color: var(--text-3);
  margin: 0 0 14px;
}
.group-label .ln { height: 1px; background: var(--border); flex: 1; }
.group-note { letter-spacing: 0; text-transform: none; font-weight: 600; color: var(--text-3); font-size: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.settings-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 22px; align-items: start; }
@media (max-width: 940px) { .settings-grid { grid-template-columns: 1fr; } }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; }
.two-col { display: grid; grid-template-columns: 1fr 360px; gap: 22px; align-items: start; }

/* vehicle / customer cell */
.veh { display: flex; align-items: center; gap: 11px; }
.veh-ic {
  width: 36px; height: 36px; border-radius: var(--r-sm); flex: 0 0 auto;
  background: var(--surface-3); display: grid; place-items: center; color: var(--text-2);
}
.veh b { font-size: 13.5px; font-weight: 600; display: block; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.veh span { font-size: 12px; color: var(--text-3); }
.plate {
  font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: .04em;
  border: 1px solid var(--border-2); border-radius: var(--r-xs); padding: 1px 5px;
  color: var(--text-2); background: var(--surface-2); white-space: nowrap; flex: 0 0 auto;
}

/* ---- Status pipeline --------------------------------------- */
.pipe { display: flex; align-items: center; gap: 0; flex-wrap: wrap; }
.pipe-step { display: flex; align-items: center; gap: 8px; }
.pipe-node {
  display: flex; align-items: center; gap: 7px; padding: 5px 11px 5px 8px;
  border-radius: var(--r-pill); font-size: 12px; font-weight: 600; white-space: nowrap;
  background: var(--surface-2); color: var(--text-3); border: 1px solid var(--border);
}
.pipe-node .tick {
  width: 17px; height: 17px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-3); color: var(--text-3); flex: 0 0 auto;
}
.pipe-step.done .pipe-node { color: var(--text-2); }
.pipe-step.done .pipe-node .tick { background: var(--success); color: #fff; }
.pipe-step.current .pipe-node { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-line); }
.pipe-step.current .pipe-node .tick { background: var(--accent); color: var(--accent-fg); }
.pipe-line { width: 18px; height: 2px; background: var(--border-2); margin: 0 2px; flex: 0 0 auto; }
.pipe-step.done + .pipe-conn { background: var(--success); }

/* ---- Tickets ----------------------------------------------- */
.ticket {
  border: 1px solid var(--border); border-radius: var(--r-lg);
  background: var(--surface); overflow: hidden; transition: border-color .15s, box-shadow .15s;
}
.ticket.proposed { border-color: var(--accent-line); }
.ticket-hd { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; }
.ticket-type {
  width: 34px; height: 34px; border-radius: var(--r-sm); flex: 0 0 auto;
  display: grid; place-items: center; background: var(--surface-3); color: var(--text-2);
}
.ticket-type.replace { background: var(--accent-soft); color: var(--accent); }
.ticket-type.order { background: var(--warning-soft); color: oklch(50% 0.11 65); }
.ticket-type.problem { background: var(--danger-soft); color: var(--danger); }
.ticket-type.extra { background: var(--success-soft); color: var(--success); }
.ticket-body { flex: 1; min-width: 0; }
.ticket-title { font-size: 14px; font-weight: 650; letter-spacing: -0.01em; }
.ticket-desc { font-size: 12.5px; color: var(--text-2); margin-top: 3px; line-height: 1.45; }
.ticket-meta { display: flex; align-items: center; gap: 9px; margin-top: 9px; font-size: 11.5px; color: var(--text-3); }
.ticket-price { font-family: var(--mono); font-size: 15px; font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; }
.ticket-foot { display: flex; align-items: center; gap: 9px; padding: 11px 16px; border-top: 1px solid var(--border); background: var(--surface-2); }

/* photo thumbs / slots */
.thumbs { display: flex; gap: 7px; margin-top: 11px; flex-wrap: wrap; }
.thumb {
  width: 60px; height: 46px; border-radius: var(--r-sm); flex: 0 0 auto;
  background-color: var(--surface-3);
  background-image: repeating-linear-gradient(135deg, transparent, transparent 5px, rgba(120,128,145,.10) 5px, rgba(120,128,145,.10) 6px);
  border: 1px solid var(--border); position: relative; overflow: hidden;
  display: grid; place-items: center; color: var(--text-3);
}
.thumb.req {
  border-style: dashed; border-color: var(--border-2);
  font-size: 9px; text-align: center; font-family: var(--mono); padding: 2px; line-height: 1.2;
}
.thumb.req.missing { border-color: var(--danger); color: var(--danger); background-color: var(--danger-soft); }

/* running total panel */
.total-panel { position: sticky; top: 0; }
.total-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 7px 0; font-size: 13px; }
.total-row > span:first-child { min-width: 0; }
.total-row .v { font-family: var(--mono); font-weight: 600; white-space: nowrap; flex: 0 0 auto; }
.total-row.muted .v, .total-row.muted span { color: var(--text-3); }
.total-grand { display: flex; align-items: baseline; justify-content: space-between; padding-top: 13px; margin-top: 6px; border-top: 1px solid var(--border); }
.total-grand .lab { font-size: 13px; font-weight: 600; }
.total-grand .v { font-family: var(--mono); font-size: 24px; font-weight: 700; letter-spacing: -0.03em; white-space: nowrap; }
.total-bump { animation: bump .5s var(--ease); display: inline-block; }
@keyframes bump { 0%{ transform: translateY(-3px) scale(1.04); } 100%{ transform: translateY(0) scale(1); } }

/* ---- Forms ------------------------------------------------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.field .hint { font-size: 11.5px; color: var(--text-3); margin-top: 5px; }
.input, .select, .textarea {
  width: 100%; height: 36px; padding: 0 11px; font-size: 13.5px; font-family: inherit;
  background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--r-sm);
  color: var(--text); outline: none; transition: border-color .14s, box-shadow .14s;
}
.textarea { height: auto; padding: 9px 11px; resize: vertical; min-height: 72px; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input-money { display: flex; align-items: center; border: 1px solid var(--border-2); border-radius: var(--r-sm); background: var(--surface); padding-left: 11px; }
.input-money:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input-money span { color: var(--text-3); font-size: 13px; font-weight: 600; }
.input-money input { border: none; box-shadow: none; flex: 1; }
.input-money input:focus { box-shadow: none; }

.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 2px; gap: 2px; }
.seg button {
  border: none; background: transparent; cursor: pointer; height: 30px; padding: 0 14px;
  border-radius: calc(var(--r-sm) - 1px); font-size: 12.5px; font-weight: 600; color: var(--text-2);
  display: inline-flex; align-items: center; gap: 7px; transition: background .14s, color .14s;
}
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); }
[data-theme="dark"] .seg button.on { background: var(--surface-3); }

/* toggle */
.switch { width: 38px; height: 22px; border-radius: var(--r-pill); background: var(--border-2); position: relative; cursor: pointer; transition: background .18s; flex: 0 0 auto; }
.switch.on { background: var(--accent); }
.switch i { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-xs); transition: left .18s var(--ease); }
.switch.on i { left: 18px; }

/* ---- Settings: capabilities + tag chips -------------------- */
.cap { display: flex; gap: 14px; padding: 17px 0; }
.cap + .cap { border-top: 1px solid var(--border); }
.cap-ic { width: 38px; height: 38px; border-radius: var(--r-sm); display: grid; place-items: center; flex: 0 0 auto; background: var(--surface-2); color: var(--text-3); transition: background .16s, color .16s; }
.cap-ic.on { background: var(--accent-soft); color: var(--accent); }
.cap-main { flex: 1; min-width: 0; }
.cap-title { font-size: 13.5px; font-weight: 650; letter-spacing: -0.01em; white-space: nowrap; }
.cap-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; line-height: 1.45; }
.cap-editor { margin-top: 12px; padding: 13px 14px; background: var(--surface-2); border-radius: var(--r-sm); border: 1px solid var(--border); }
.tagrow { display: flex; flex-wrap: wrap; gap: 7px; }
.tagchip { display: inline-flex; align-items: center; gap: 6px; height: 27px; padding: 0 6px 0 11px; border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--border-2); font-size: 12.5px; font-weight: 600; color: var(--text); white-space: nowrap; }
.tagchip button { border: none; background: none; cursor: pointer; color: var(--text-3); display: grid; place-items: center; padding: 2px; border-radius: 50%; transition: color .14s, background .14s; }
.tagchip button:hover { color: var(--danger); background: var(--danger-soft); }
.tagchip-add { display: inline-flex; align-items: center; gap: 5px; height: 27px; padding: 0 12px; border-radius: var(--r-pill); background: none; border: 1px dashed var(--border-2); font-size: 12.5px; font-weight: 600; color: var(--text-2); cursor: pointer; transition: border-color .14s, color .14s; white-space: nowrap; }
.tagchip-add:hover { border-color: var(--accent); color: var(--accent); }
/* brand/insurer picker grid */
.pickgrid { display: flex; flex-wrap: wrap; gap: 8px; }
.pickchip { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 13px; border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--border-2); font-size: 13px; font-weight: 600; color: var(--text-2); cursor: pointer; transition: all .14s; }
.pickchip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
/* client preview card */
.preview { border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; background: var(--surface); }
.preview-img { height: 84px; background-color: var(--surface-3); background-image: repeating-linear-gradient(135deg, transparent, transparent 7px, color-mix(in oklch, var(--text-3) 12%, transparent) 7px, color-mix(in oklch, var(--text-3) 12%, transparent) 8px); display: grid; place-items: center; color: var(--text-3); font-weight: 800; font-size: 22px; overflow: hidden; }
.preview-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.badge.warranty { background: var(--accent-soft); color: var(--accent); }

/* ---- Modal ------------------------------------------------- */
.scrim { position: fixed; inset: 0; background: rgba(16,18,24,.42); backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 60; padding: 24px; }
.modal { width: min(560px, 100%); max-height: 88vh; overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); animation: pop .2s var(--ease) both; }
.modal.wide { width: min(720px, 100%); }
@keyframes pop { from { transform: translateY(10px) scale(.985); } to { transform: translateY(0) scale(1); } }
.modal-hd { display: flex; align-items: center; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.modal-hd h3 { font-size: 16px; font-weight: 700; letter-spacing: -0.02em; margin: 0; }
.modal-bd { padding: 20px; }
.modal-ft { padding: 15px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; position: sticky; bottom: 0; background: var(--surface); }

/* ---- Chat -------------------------------------------------- */
.chat { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; max-height: 260px; overflow-y: auto; }
.msg { max-width: 80%; padding: 9px 12px; border-radius: var(--r-lg); font-size: 13px; line-height: 1.45; }
.msg.them { align-self: flex-start; background: var(--surface-3); color: var(--text); border-bottom-left-radius: var(--r-xs); }
.msg.me { align-self: flex-end; background: var(--accent); color: var(--accent-fg); border-bottom-right-radius: var(--r-xs); }
.msg .who { font-size: 10.5px; font-weight: 700; opacity: .7; margin-bottom: 3px; text-transform: uppercase; letter-spacing: .04em; }
.chat-input { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); }

/* ---- empty / list states ----------------------------------- */
.list-item { display: flex; align-items: center; gap: 13px; padding: 14px 18px; border-bottom: 1px solid var(--border); transition: background .12s; }
.list-item:last-child { border-bottom: none; }
.list-item.clickable { cursor: pointer; }
.list-item.clickable:hover { background: var(--surface-2); }

.empty { text-align: center; padding: 48px 20px; color: var(--text-3); }
.empty .ico { margin: 0 auto 12px; opacity: .5; }

/* scrollbars */
.main::-webkit-scrollbar, .nav::-webkit-scrollbar, .modal::-webkit-scrollbar, .chat::-webkit-scrollbar { width: 10px; height: 10px; }
.main::-webkit-scrollbar-thumb, .nav::-webkit-scrollbar-thumb, .modal::-webkit-scrollbar-thumb, .chat::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 10px; border: 3px solid var(--surface); }

/* toast */
.toast-wrap { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 11px 15px;
  background: var(--text); color: var(--surface); border-radius: var(--r-lg);
  font-size: 13px; font-weight: 600; box-shadow: var(--shadow-lg); animation: toastin .26s var(--ease) both;
}
.toast .ti { display: grid; place-items: center; }
@keyframes toastin { from { transform: translateY(12px) scale(.96); } to { transform: translateY(0) scale(1); } }

/* slide-in for view switches — translate only, never hides content
   (CSS animations are throttled in background iframes, so an opacity:0
   start frame can get stuck and blank the page). */
.view-fade { animation: vfade .28s var(--ease) both; }
@keyframes vfade { from { transform: translateY(7px); } to { transform: translateY(0); } }
