/* ============================================================
   K.D. Automobiles CRM - clean, minimal interface
   ============================================================ */

:root {
  --bg: #f3f5f7;
  --surface: #ffffff;
  --surface-2: #f8fafb;
  --surface-3: #eef2f6;
  --border: #e2e8ee;
  --border-strong: #cbd5e1;
  --text: #17212b;
  --text-2: #435264;
  --muted: #6b7a8c;
  --faint: #93a1b1;
  --navy: #0f2a43;
  --navy-2: #133754;
  --primary: #174a7e;
  --primary-hover: #103a65;
  --primary-soft: #eaf1f8;
  --green: #157347;
  --green-soft: #e7f5ee;
  --amber: #92600a;
  --amber-soft: #fdf3d7;
  --red: #b42318;
  --red-soft: #fdecea;
  --blue: #1d5fa8;
  --blue-soft: #e8f0fb;
  --violet: #5b3ea8;
  --violet-soft: #efeafb;
  --slate: #526071;
  --slate-soft: #eef1f4;
  --radius: 8px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(15, 42, 67, 0.06);
  --shadow-lg: 0 18px 50px rgba(15, 42, 67, 0.16);
  --sidebar-w: 236px;
  --topbar-h: 60px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.modal-open { overflow: hidden; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4, p { margin: 0; }
svg { display: block; flex: none; }

.boot {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--muted);
}
.boot-mark, .brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 9px;
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.5px;
}
.boot-text { font-size: 13px; }

.noscript {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  padding: 24px;
  text-align: center;
}

/* ------------------------------------------------------------
   Authentication
   ------------------------------------------------------------ */
.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 460px;
  background: var(--surface);
}
.auth-panel {
  background: var(--navy);
  color: #dbe6f1;
  padding: 52px 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.auth-panel::after {
  content: "";
  position: absolute;
  right: -160px;
  bottom: -160px;
  width: 440px;
  height: 440px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  box-shadow: 0 0 0 70px rgba(255, 255, 255, 0.025), 0 0 0 140px rgba(255, 255, 255, 0.02);
}
.auth-brand { display: flex; align-items: center; gap: 12px; position: relative; z-index: 1; }
.auth-brand .brand-mark { background: rgba(255, 255, 255, 0.12); border: 1px solid rgba(255, 255, 255, 0.16); }
.auth-brand-title { color: #fff; font-weight: 650; font-size: 15px; letter-spacing: 0.2px; }
.auth-brand-sub { color: #9fb4c9; font-size: 11.5px; text-transform: uppercase; letter-spacing: 1.2px; }
.auth-copy { position: relative; z-index: 1; max-width: 430px; }
.auth-copy h1 { color: #fff; font-size: 30px; line-height: 1.2; font-weight: 650; letter-spacing: -0.3px; }
.auth-copy p { margin-top: 14px; color: #a9bdd1; font-size: 14px; line-height: 1.7; }
.auth-points { margin-top: 30px; display: grid; gap: 12px; }
.auth-point { display: flex; align-items: center; gap: 10px; color: #c6d6e6; font-size: 13px; }
.auth-point span:first-child {
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  display: flex; align-items: center; justify-content: center; color: #fff;
}
.auth-panel-foot { position: relative; z-index: 1; color: #7e97af; font-size: 12px; }
.auth-main {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 44px;
}
.auth-card { width: 100%; max-width: 348px; }
.auth-card-mark { display: none; }
.auth-card h2 { font-size: 22px; font-weight: 650; letter-spacing: -0.2px; }
.auth-card .sub { color: var(--muted); font-size: 13.5px; margin-top: 6px; margin-bottom: 26px; }
.auth-form { display: grid; gap: 16px; }
.auth-form .btn { width: 100%; height: 40px; margin-top: 4px; }
.auth-foot { margin-top: 26px; color: var(--faint); font-size: 12px; text-align: center; }
.auth-error {
  display: none;
  background: var(--red-soft);
  border: 1px solid #f6c9c4;
  color: var(--red);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 16px;
}
.auth-error.show { display: block; }
.auth-alt { margin-top: 18px; font-size: 13px; color: var(--muted); text-align: center; }
.auth-alt button { background: none; border: 0; color: var(--primary); cursor: pointer; padding: 0; font-weight: 600; }
.auth-alt button:hover { text-decoration: underline; }
.auth-locked { text-align: center; padding: 8px 0; }
.auth-locked .lock-icon { width: 44px; height: 44px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: flex; align-items: center; justify-content: center; margin: 0 auto 14px; }

/* ------------------------------------------------------------
   Shell / sidebar
   ------------------------------------------------------------ */
.shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--navy);
  color: #c9d7e5;
  display: flex;
  flex-direction: column;
  z-index: 40;
}
.sidebar-brand {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  flex: none;
  text-decoration: none;
}
.sidebar-brand:hover { text-decoration: none; }
.sidebar-brand .brand-mark { width: 32px; height: 32px; font-size: 11.5px; background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.14); }
.sidebar-brand-text { line-height: 1.2; min-width: 0; }
.sidebar-brand-title { color: #fff; font-size: 13px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-brand-sub { color: #7f99b3; font-size: 9.5px; letter-spacing: 1.3px; text-transform: uppercase; }

.nav { flex: 1; overflow-y: auto; padding: 16px 10px 10px; }
.nav::-webkit-scrollbar { width: 5px; }
.nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.15); border-radius: 5px; }
.nav-section { padding: 16px 10px 7px; font-size: 9.5px; text-transform: uppercase; letter-spacing: 1.4px; color: #6c88a2; font-weight: 650; }
.nav-section:first-child { padding-top: 4px; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 37px;
  padding: 0 10px;
  margin-bottom: 2px;
  border-radius: 6px;
  color: #b9c9d9;
  font-size: 13px;
  font-weight: 500;
  position: relative;
  text-decoration: none;
}
.nav-link:hover { background: rgba(255, 255, 255, 0.055); color: #fff; text-decoration: none; }
.nav-link.active { background: rgba(255, 255, 255, 0.1); color: #fff; font-weight: 600; }
.nav-link.active::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: #7fb2e1;
}
.nav-icon { width: 18px; color: #8ba7c1; display: flex; justify-content: center; }
.nav-link.active .nav-icon, .nav-link:hover .nav-icon { color: #dce9f5; }
.nav-label { flex: 1; text-align: left; }
.nav-badge {
  min-width: 19px;
  height: 19px;
  border-radius: 10px;
  background: #c23b31;
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}
.nav-badge.show { display: inline-flex; }

.sidebar-foot { border-top: 1px solid rgba(255, 255, 255, 0.07); padding: 12px 12px 14px; flex: none; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 4px 12px; min-width: 0; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex: none;
  letter-spacing: 0.4px;
}
.user-meta { min-width: 0; }
.user-name { color: #fff; font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { color: #7f99b3; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.8px; }
.sidebar-actions { display: flex; gap: 6px; }
.sidebar-actions .btn {
  flex: 1;
  height: 31px;
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
  color: #c9d7e5;
  font-size: 12px;
  font-weight: 500;
}
.sidebar-actions .btn:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }

.main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 26px;
  position: sticky;
  top: 0;
  z-index: 30;
}
.hamburger { display: none; }
.topbar-title { font-size: 15px; font-weight: 650; letter-spacing: -0.1px; min-width: 0; }
.topbar-search { margin-left: auto; position: relative; width: 290px; max-width: 36vw; }
.topbar-search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.topbar-search input {
  width: 100%;
  height: 34px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 0 10px 0 33px;
  font-size: 12.5px;
  outline: none;
}
.topbar-search input:focus { background: #fff; border-color: #a9c0d8; box-shadow: 0 0 0 3px rgba(23, 74, 126, 0.08); }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.topbar-user { display: none; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.icon-btn.mobile-search-btn { display: none; }

.content { padding: 24px 26px 48px; max-width: 1440px; width: 100%; margin: 0 auto; flex: 1; }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 25, 40, 0.45);
  z-index: 35;
}

/* ------------------------------------------------------------
   Page header
   ------------------------------------------------------------ */
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.page-head h1 { font-size: 21px; font-weight: 650; letter-spacing: -0.3px; line-height: 1.25; }
.page-sub { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-bottom: 9px; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--primary); text-decoration: none; }
.crumbs svg { color: var(--faint); }
.crumbs span { color: var(--text-2); }

/* ------------------------------------------------------------
   Buttons
   ------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.btn:hover { background: var(--surface-2); border-color: #b8c5d3; text-decoration: none; }
.btn:disabled, .btn.is-busy { opacity: 0.6; cursor: not-allowed; }
.btn svg { color: var(--muted); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-primary svg { color: #fff; }
.btn-danger { background: #fff; border-color: #e9b7b2; color: var(--red); }
.btn-danger:hover { background: var(--red-soft); border-color: #dfa39d; }
.btn-danger svg { color: var(--red); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); border-color: transparent; }
.btn-sm { height: 29px; padding: 0 10px; font-size: 12px; gap: 5px; }
.btn-icon { width: 32px; padding: 0; }
.btn-block { width: 100%; }
.icon-btn {
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; background: transparent; color: var(--muted);
  border-radius: var(--radius-sm); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.link { background: none; border: 0; padding: 0; color: var(--primary); font-size: 12.5px; font-weight: 600; cursor: pointer; }
.link:hover { text-decoration: underline; }
.link.danger { color: var(--red); }
.btn-group { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.btn-group .btn { border: 0; border-radius: 0; height: 32px; font-size: 12px; }
.btn-group .btn + .btn { border-left: 1px solid var(--border); }
.btn-group .btn.active { background: var(--primary-soft); color: var(--primary); }

/* ------------------------------------------------------------
   Cards, stats, grids
   ------------------------------------------------------------ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-width: 0;
}
.card + .card { margin-top: 16px; }
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  min-height: 51px;
}
.card-title { font-size: 13px; font-weight: 650; letter-spacing: -0.05px; display: flex; align-items: center; gap: 8px; }
.card-title svg { color: var(--muted); }
.card-body { padding: 18px; }
.card-body.flush { padding: 0; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.card-link { font-size: 12px; font-weight: 600; color: var(--primary); cursor: pointer; background: none; border: 0; padding: 0; }
.card-link:hover { text-decoration: underline; }

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 17px;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  display: block;
  min-width: 0;
}
a.stat:hover { border-color: #c4d2e0; text-decoration: none; }
.stat-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); font-weight: 650; }
.stat-value { font-size: 26px; font-weight: 650; letter-spacing: -0.6px; margin-top: 7px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-foot { margin-top: 7px; font-size: 11.5px; color: var(--faint); display: flex; align-items: center; gap: 5px; }
.stat.danger .stat-value { color: var(--red); }
.stat.warn .stat-value { color: var(--amber); }
.stat.good .stat-value { color: var(--green); }
.stat.info .stat-value { color: var(--blue); }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(300px, 0.95fr); gap: 16px; align-items: start; }
.main-col, .side-col { min-width: 0; }
.side-col .card + .card { margin-top: 16px; }
.stack { display: grid; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.mono { font-family: var(--mono); font-size: 12px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.hidden { display: none !important; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.section-title { font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.9px; color: var(--muted); margin-bottom: 12px; }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-amber { color: var(--amber); }
.nowrap { white-space: nowrap; }

/* ------------------------------------------------------------
   Definition lists
   ------------------------------------------------------------ */
.dl { display: grid; grid-template-columns: minmax(120px, 0.75fr) minmax(0, 1.6fr); gap: 0; margin: 0; }
.dl dt, .dl dd { margin: 0; padding: 9px 0; border-bottom: 1px solid #eef2f6; font-size: 12.8px; }
.dl dt { color: var(--muted); padding-right: 16px; }
.dl dd { color: var(--text); word-break: break-word; }
.dl > dt:last-of-type, .dl > dd:last-of-type { border-bottom: 0; }
.dl.tight dt, .dl.tight dd { padding: 7px 0; }

/* ------------------------------------------------------------
   Tables
   ------------------------------------------------------------ */
.table-wrap { width: 100%; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 12.8px; }
.table th {
  text-align: left;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
  font-weight: 650;
  background: var(--surface-2);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td { padding: 11px 14px; border-bottom: 1px solid #eef2f6; vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr[data-href] { cursor: pointer; }
.table tbody tr[data-href]:hover { background: #f8fafc; }
.table tbody tr:hover { background: #f8fafc; }
.table .num, .table .money { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .center { text-align: center; }
.table-actions { display: flex; align-items: center; gap: 4px; justify-content: flex-end; white-space: nowrap; }
.cell-main { font-weight: 600; color: var(--text); }
.cell-sub { color: var(--muted); font-size: 11.5px; margin-top: 1px; }
.table-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 12px;
  color: var(--muted);
  border-radius: 0 0 var(--radius) var(--radius);
  flex-wrap: wrap;
}
.pager { display: flex; align-items: center; gap: 6px; }
.pager .btn { height: 28px; padding: 0 9px; font-size: 11.5px; }
.pager .btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.pager .page-info { padding: 0 5px; font-variant-numeric: tabular-nums; }
.table-empty, .empty {
  padding: 42px 18px;
  text-align: center;
  color: var(--muted);
}
.empty-icon {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--surface-3); color: var(--faint);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 12px;
}
.empty-title { font-weight: 600; color: var(--text-2); font-size: 13px; }
.empty-text { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

/* ------------------------------------------------------------
   Badges / pills
   ------------------------------------------------------------ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10.8px;
  font-weight: 650;
  letter-spacing: 0.2px;
  white-space: nowrap;
  background: var(--slate-soft);
  color: var(--slate);
}
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: 0.85; }
.badge.no-dot::before { display: none; }
.badge-blue { background: var(--blue-soft); color: var(--blue); }
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-amber { background: var(--amber-soft); color: var(--amber); }
.badge-red { background: var(--red-soft); color: var(--red); }
.badge-violet { background: var(--violet-soft); color: var(--violet); }
.badge-slate { background: var(--slate-soft); color: var(--slate); }
.pill { display: inline-flex; align-items: center; padding: 2px 7px; border-radius: 4px; background: var(--surface-3); color: var(--text-2); font-size: 11px; font-weight: 600; }
.pill.warn { background: var(--amber-soft); color: var(--amber); }
.pill.danger { background: var(--red-soft); color: var(--red); }

/* ------------------------------------------------------------
   Forms
   ------------------------------------------------------------ */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid + .form-grid { margin-top: 14px; }
.form-grid.cols-1 { grid-template-columns: 1fr; }
.span-2 { grid-column: span 2; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.req { color: var(--red); font-weight: 600; }
.input, select.input, textarea.input {
  width: 100%;
  min-height: 37px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
  color: var(--text);
}
textarea.input { min-height: 76px; resize: vertical; line-height: 1.5; }
select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7a8c' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}
.input:focus, select.input:focus, textarea.input:focus { border-color: #8fb0ce; box-shadow: 0 0 0 3px rgba(23, 74, 126, 0.09); }
.input::placeholder { color: #a6b2c0; }
.input:disabled { background: var(--surface-2); color: var(--muted); }
.input.invalid { border-color: #d97168; box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.07); }
.hint { font-size: 11.3px; color: var(--faint); line-height: 1.45; }
.field-error { color: var(--red); font-size: 11.3px; font-weight: 500; }
.check { display: flex; align-items: flex-start; gap: 8px; font-size: 12.8px; color: var(--text-2); cursor: pointer; line-height: 1.45; }
.check input { width: 15px; height: 15px; margin: 1px 0 0; accent-color: var(--primary); flex: none; }
.check span small { display: block; color: var(--faint); font-size: 11px; }
.check-group { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 18px; }
.form-section { border-top: 1px solid var(--border); margin-top: 20px; padding-top: 18px; }
.form-section:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
.form-section > h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.9px; color: var(--muted); margin-bottom: 13px; }
.form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.inline-fields { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }

.filter-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  box-shadow: var(--shadow);
}
.filter-search { position: relative; flex: 1 1 230px; min-width: 190px; }
.filter-search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.filter-search input { padding-left: 32px; }
.filter-bar .input { height: 35px; min-height: 35px; font-size: 12.5px; }
.filter-bar select.input { width: auto; min-width: 130px; }
.filter-bar .date-input { width: 140px; }
.date-filter { display: inline-flex; align-items: center; gap: 6px; }
.date-filter .filter-label { margin-left: 0; }
.lead-age-filter { display: flex; flex: 1 0 100%; align-items: center; gap: 8px; flex-wrap: wrap; padding-top: 2px; }
.lead-age-filter .filter-label { margin-left: 0; }
.filter-bar .filter-label { font-size: 11px; color: var(--muted); font-weight: 600; margin-left: 4px; }

.segmented { display: inline-flex; background: var(--surface-3); border-radius: 6px; padding: 2px; gap: 2px; }
.seg-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  height: 29px;
  padding: 0 11px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.seg-btn:hover { color: var(--text); }
.seg-btn.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(15, 42, 67, 0.1); }

.expense-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.expense-form .field { flex: 1 1 140px; }

/* ------------------------------------------------------------
   Modal
   ------------------------------------------------------------ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 25, 40, 0.46);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 6vh 18px 28px;
  z-index: 100;
  overflow-y: auto;
  animation: fade-in 0.12s ease-out;
}
.modal {
  background: var(--surface);
  width: 100%;
  max-width: 560px;
  border-radius: 9px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  max-height: 88vh;
  animation: pop-in 0.14s ease-out;
}
.modal-lg { max-width: 780px; }
.modal-xl { max-width: 980px; }
.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex: none;
}
.modal-head h2 { font-size: 15.5px; font-weight: 650; letter-spacing: -0.15px; }
.modal-head p { color: var(--muted); font-size: 12px; margin-top: 3px; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  padding: 13px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 0 0 9px 9px;
  flex: none;
}
.modal-foot .left { margin-right: auto; }
.confirm-text { color: var(--text-2); font-size: 13.5px; line-height: 1.6; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(-6px) scale(0.99); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------
   Toasts / alerts
   ------------------------------------------------------------ */
.toasts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 380px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  background: var(--navy);
  color: #e8eff6;
  border-radius: 7px;
  padding: 11px 14px;
  font-size: 12.8px;
  line-height: 1.45;
  box-shadow: 0 8px 26px rgba(15, 42, 67, 0.2);
  pointer-events: auto;
  animation: toast-in 0.16s ease-out;
}
.toast svg { margin-top: 1px; color: #8fd0ae; }
.toast-error { background: #6d1a14; }
.toast-error svg { color: #ffb4aa; }
.toast-info svg { color: #9dc3ea; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.alert { border: 1px solid var(--border); background: var(--surface-2); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 12.8px; color: var(--text-2); display: flex; gap: 10px; align-items: flex-start; }
.alert svg { color: var(--muted); margin-top: 1px; }
.alert-warn { background: #fffaf0; border-color: #f1dfae; color: #6f5310; }
.alert-warn svg { color: #a97c12; }
.alert-danger { background: var(--red-soft); border-color: #f3c7c2; color: var(--red); }
.alert-danger svg { color: var(--red); }
.alert-info { background: var(--primary-soft); border-color: #cfe0f1; color: #194a78; }
.alert-info svg { color: var(--primary); }
.alert + .form-grid, .alert + .form-section { margin-top: 14px; }

/* ------------------------------------------------------------
   Tabs
   ------------------------------------------------------------ */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  padding: 10px 13px 11px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ------------------------------------------------------------
   Timeline
   ------------------------------------------------------------ */
.timeline { display: grid; gap: 0; }
.timeline-item { display: flex; gap: 11px; padding: 0 0 15px; position: relative; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-rail { width: 9px; flex: none; display: flex; justify-content: center; position: relative; }
.timeline-rail::after { content: ""; position: absolute; top: 13px; bottom: -3px; width: 1px; background: var(--border); }
.timeline-item:last-child .timeline-rail::after { display: none; }
.timeline-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--border-strong); margin-top: 5px; flex: none; }
.timeline-item:first-child .timeline-dot { background: var(--primary); }
.timeline-body { min-width: 0; font-size: 12.3px; color: var(--text-2); }
.timeline-time { color: var(--faint); font-size: 10.8px; margin-top: 2px; }
.timeline-title { font-weight: 600; color: var(--text); }

/* ------------------------------------------------------------
   Activity / documents / misc detail
   ------------------------------------------------------------ */
.log-list { display: grid; gap: 0; }
.log-item { padding: 12px 0; border-bottom: 1px solid #eef2f6; }
.log-item:first-child { padding-top: 0; }
.log-item:last-child { border-bottom: 0; padding-bottom: 0; }
.log-desc { font-size: 12.5px; color: var(--text-2); }
.log-meta { font-size: 10.8px; color: var(--faint); margin-top: 3px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.log-changes { margin-top: 7px; }
.log-changes summary { font-size: 11px; color: var(--primary); cursor: pointer; }
.log-changes pre {
  margin: 7px 0 0;
  padding: 9px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text-2);
  overflow-x: auto;
  white-space: pre-wrap;
}

.doc-row { display: flex; align-items: center; gap: 12px; }
.doc-icon { width: 38px; height: 42px; border-radius: 5px; background: var(--red-soft); color: var(--red); display: flex; align-items: center; justify-content: center; flex: none; }
.doc-meta { min-width: 0; flex: 1; }
.doc-name { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-sub { font-size: 10.8px; color: var(--faint); }
.doc-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }

.list-rows { display: grid; }
.list-row { display: flex; align-items: flex-start; gap: 12px; padding: 13px 0; border-bottom: 1px solid #eef2f6; color: inherit; text-decoration: none; }
a.list-row:hover { text-decoration: none; }
a.list-row:hover .list-title { color: var(--primary); }
.list-row:first-child { padding-top: 0; }
.list-row:last-child { border-bottom: 0; padding-bottom: 0; }
.list-main { flex: 1; min-width: 0; }
.list-title { font-size: 12.8px; font-weight: 600; color: var(--text); }
.list-sub { font-size: 11.8px; color: var(--muted); margin-top: 2px; }
.list-actions { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.avatar-sm { width: 28px; height: 28px; border-radius: 50%; background: var(--surface-3); color: var(--muted); font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex: none; }

.check-grid { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.check-row { display: grid; grid-template-columns: minmax(150px, 1.1fr) 120px minmax(120px, 1fr); gap: 8px; align-items: center; padding: 6px 10px; border-bottom: 1px solid #eef2f6; }
.check-row:last-child { border-bottom: 0; }
.check-row:nth-child(even) { background: #fbfcfd; }
.check-row label { font-size: 12px; color: var(--text-2); }
.check-row .input { min-height: 31px; height: 31px; font-size: 12px; padding: 4px 8px; }
.check-group-title { padding: 7px 10px; background: var(--surface-3); font-size: 10px; letter-spacing: 0.9px; text-transform: uppercase; color: var(--muted); font-weight: 650; }
.salvage-list { display: grid; gap: 8px; }
.salvage-row { display: grid; grid-template-columns: 1fr 150px 32px; gap: 8px; align-items: center; }
.salvage-row .input { min-height: 33px; height: 33px; font-size: 12.5px; }

.doc-total { font-size: 12.5px; font-weight: 650; color: var(--text); }

.report-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.report-tab {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.report-tab:hover { border-color: var(--border-strong); text-decoration: none; }
.report-tab.active { background: var(--navy); border-color: var(--navy); color: #fff; }
.report-section + .report-section { margin-top: 16px; }
.report-section .table th { background: var(--surface-2); }

/* ------------------------------------------------------------
   Skeleton / loading
   ------------------------------------------------------------ */
.skeleton { padding: 4px 0; }
.sk-line { height: 12px; border-radius: 4px; background: linear-gradient(90deg, #eef2f6 25%, #f7f9fb 37%, #eef2f6 63%); background-size: 400% 100%; animation: shimmer 1.25s ease infinite; margin-bottom: 12px; }
.sk-line.w40 { width: 40%; }
.sk-line.w60 { width: 60%; }
.sk-line.w80 { width: 80%; }
.sk-card { height: 92px; border-radius: var(--radius); background: linear-gradient(90deg, #eef2f6 25%, #f7f9fb 37%, #eef2f6 63%); background-size: 400% 100%; animation: shimmer 1.25s ease infinite; }
.sk-table { height: 260px; border-radius: var(--radius); margin-top: 16px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* ------------------------------------------------------------
   Responsive
   ------------------------------------------------------------ */
@media (max-width: 1180px) {
  .detail-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
  .auth { grid-template-columns: 1fr; }
  .auth-panel { display: none; }
  .auth-main { min-height: 100vh; padding: 32px 22px; background: var(--bg); }
  .auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 30px 26px; box-shadow: var(--shadow); max-width: 400px; }
  .auth-card-mark { display: flex; margin-bottom: 20px; }
  .auth-card h2 { font-size: 20px; }

  .sidebar { transform: translateX(-102%); transition: transform 0.18s ease; }
  .shell.sidebar-open .sidebar { transform: none; box-shadow: 12px 0 34px rgba(10, 25, 40, 0.22); }
  .shell.sidebar-open .sidebar-overlay { display: block; }
  .main { margin-left: 0; }
  .hamburger { display: inline-flex; }
  .topbar { padding: 0 16px; }
  .topbar-user { display: flex; }
  .content { padding: 20px 16px 40px; }
}

@media (max-width: 760px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 13px 14px; }
  .stat-value { font-size: 22px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .check-group { grid-template-columns: 1fr; }
  .topbar-search { display: none; }
  .icon-btn.mobile-search-btn { display: inline-flex; margin-left: auto; }
  .page-head h1 { font-size: 19px; }
  .card-body { padding: 15px; }
  .card-head { padding: 12px 15px; }
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal { max-width: none; max-height: 94vh; border-radius: 12px 12px 0 0; }
  .modal-foot { border-radius: 0; }
  .check-row { grid-template-columns: 1fr 100px; }
  .check-row .remark { grid-column: span 2; }
  .salvage-row { grid-template-columns: 1fr 100px 30px; }
  .filter-bar { padding: 10px; }
  .filter-bar .field { flex: 1 1 120px; min-width: 0; }
  .filter-bar select.input { min-width: 0; flex: none; width: 100%; }
  .dl { grid-template-columns: 110px minmax(0, 1fr); }
  .table th, .table td { padding: 9px 10px; }
}

@media (max-width: 460px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
  .user-chip { display: none; }
  .auth-card { border: 0; box-shadow: none; background: transparent; padding: 10px 4px; }
}

@media print {
  .sidebar, .topbar, .page-actions, .filter-bar, .table-foot, .toasts, .modal-overlay { display: none !important; }
  .main { margin: 0; }
  .content { padding: 0; max-width: none; }
  .card { box-shadow: none; border-color: #ccc; }
  body { background: #fff; }
}

/* ------------------------------------------------------------
   Overdue marking (follow-ups)
   .text-red was overridden by .cell-main / .cell-sub (defined later), so overdue never looked red.
   ------------------------------------------------------------ */
.cell-main.text-red, .cell-sub.text-red, .text-red { color: var(--red) !important; }
.table tbody tr.row-overdue td { background: #fff6f5; }
.table tbody tr.row-overdue td:first-child { box-shadow: inset 4px 0 0 var(--red); }
.table tbody tr.row-overdue:hover td { background: #fdecea; }
.tab.tab-alert { color: var(--red); }
.tab.tab-alert.active { color: var(--red); border-bottom-color: var(--red); }
.pill.overdue { background: var(--red); color: #fff; }

/* ------------------------------------------------------------
   Cover photo
   ------------------------------------------------------------ */
.cover-thumb { display: inline-flex; align-items: center; justify-content: center; width: 64px; height: 48px; border-radius: 6px; background: var(--surface-3); color: var(--faint, #9aa7b5); overflow: hidden; flex: none; border: 1px solid var(--border); }
.cover-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-thumb.cover-large { width: 100%; max-width: 360px; height: 220px; border-radius: 8px; }
.col-cover, .table th.col-cover { width: 76px; padding-right: 0 !important; }
.cover-field { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.cover-field-preview { width: 240px; max-width: 100%; }
.cover-field-preview .cover-thumb.cover-large { height: 160px; }
.cover-field-actions { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.cover-hero-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.cover-thumb.has-img { cursor: zoom-in; }

.drag-over { outline: 2px dashed var(--primary); outline-offset: -4px; background: #f3f8fd; }
#cover-card.is-busy { opacity: .6; pointer-events: none; }
#cover-card .cover-thumb:not(.has-img) { cursor: pointer; }

/* Car photos from the lead PDF */
.doc-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.doc-photo { position: relative; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-3); aspect-ratio: 4 / 3; cursor: zoom-in; }
.doc-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.doc-photo:hover { border-color: var(--primary); }
.doc-photo:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.doc-file { margin-top: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pv { position: fixed; inset: 0; z-index: 400; background: rgba(8, 14, 22, 0.92); display: flex; align-items: center; justify-content: center; }
.pv-img { max-width: min(94vw, 1400px); max-height: 90vh; object-fit: contain; border-radius: 4px; background: #fff; }
.pv-btn { position: absolute; border: 0; background: rgba(255, 255, 255, 0.14); color: #fff; width: 44px; height: 44px; border-radius: 50%; font-size: 28px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.pv-btn:hover { background: rgba(255, 255, 255, 0.28); }
.pv-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.pv-btn[hidden] { display: none; }
.pv-x { top: 14px; right: 14px; }
.pv-nav { top: 50%; transform: translateY(-50%); }
.pv-prev { left: 14px; }
.pv-next { right: 14px; }
.pv-count { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); color: #fff; font-size: 13px; background: rgba(0, 0, 0, 0.45); padding: 3px 12px; border-radius: 12px; }

/* ------------------------------------------------------------
   v2.7 — Lead detail: bigger, coloured cards + photo grid
   ------------------------------------------------------------ */
.detail-grid { gap: 20px; grid-template-columns: minmax(0, 1.7fr) minmax(320px, 1fr); }
.detail-grid .card { border-radius: 14px; box-shadow: 0 2px 10px rgba(15, 42, 67, 0.07); border-color: #dde5ee; overflow: hidden; }
.detail-grid .card + .card { margin-top: 20px; }
.detail-grid .card-head { padding: 16px 22px; background: linear-gradient(180deg, #f7faff, #f1f6fc); border-bottom: 1px solid #e3ebf4; }
.detail-grid .card-title { font-size: 15px; font-weight: 700; color: var(--navy); }
.detail-grid .card-title svg { color: var(--primary); }
.detail-grid .card-body { padding: 22px; }
.detail-grid .dl dt, .detail-grid .dl dd { font-size: 14px; padding: 11px 0; }
.detail-grid .dl dt { font-weight: 600; }
.count-chip { display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 22px; padding: 0 8px; border-radius: 11px; background: var(--primary); color: #fff; font-size: 12px; font-weight: 700; }

/* hero: cover + price tiles */
.hero-card { border-top: 4px solid var(--primary); }
.hero-split { display: grid; grid-template-columns: minmax(0, 360px) minmax(0, 1fr); gap: 24px; align-items: start; }
.hero-cover .cover-thumb.cover-large { max-width: 100%; height: 240px; border-radius: 12px; }
.hero-title { font-size: 22px; font-weight: 800; color: var(--navy); letter-spacing: -0.3px; line-height: 1.2; }
.hero-sub { font-size: 13.5px; color: var(--muted); margin: 5px 0 16px; }
.price-tiles { display: grid; grid-template-columns: 1fr; gap: 12px; }
.price-tiles.stack { margin-top: 14px; gap: 10px; }
.price-tile { border-radius: 12px; padding: 14px 16px; border: 1px solid transparent; }
.price-tile-top { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 700; letter-spacing: .2px; text-transform: uppercase; }
.price-tile-ic { width: 26px; height: 26px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; background: rgba(255,255,255,.7); }
.price-tile-value { font-size: 28px; font-weight: 800; letter-spacing: -0.5px; margin-top: 8px; line-height: 1.1; }
.price-tiles.stack .price-tile-value { font-size: 22px; margin-top: 6px; }
.price-tile.is-empty .price-tile-value { opacity: .45; }
.price-tile.tone-green  { background: linear-gradient(135deg, #e3f6ec, #f1fbf6); border-color: #b9e4cc; color: #0d6b3f; }
.price-tile.tone-blue   { background: linear-gradient(135deg, #e2eefc, #f0f6fe); border-color: #b7d3f3; color: #164f93; }
.price-tile.tone-amber  { background: linear-gradient(135deg, #fdf0cc, #fef8e6); border-color: #f0d68a; color: #86560a; }
.price-tile.tone-violet { background: linear-gradient(135deg, #ece6fb, #f6f2fe); border-color: #cfc3f1; color: #54379f; }

/* information grid with coloured icon chips */
.info-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.info-item { display: flex; align-items: center; gap: 12px; padding: 13px 14px; border: 1px solid #e6edf4; border-radius: 12px; background: #fbfcfe; min-width: 0; }
.info-item.wide { grid-column: 1 / -1; }
.info-ic { width: 38px; height: 38px; flex: none; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; }
.info-ic.tone-green  { background: var(--green-soft); color: var(--green); }
.info-ic.tone-blue   { background: var(--blue-soft); color: var(--blue); }
.info-ic.tone-amber  { background: var(--amber-soft); color: var(--amber); }
.info-ic.tone-violet { background: var(--violet-soft); color: var(--violet); }
.info-ic.tone-slate  { background: var(--slate-soft); color: var(--slate); }
.info-txt { min-width: 0; }
.info-label { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.info-value { font-size: 15px; font-weight: 600; color: var(--text); margin-top: 2px; word-break: break-word; }

/* customer card */
.cust-head { display: flex; align-items: center; gap: 14px; }
.cust-avatar { width: 50px; height: 50px; border-radius: 50%; background: linear-gradient(135deg, #174a7e, #3b82c4); color: #fff; font-size: 21px; font-weight: 800; display: flex; align-items: center; justify-content: center; flex: none; }
.cust-name { font-size: 17px; font-weight: 700; min-width: 0; word-break: break-word; }
.cust-city { font-size: 12.5px; font-weight: 500; color: var(--muted); margin-top: 2px; }
.call-chip { display: flex; align-items: center; justify-content: center; gap: 9px; margin: 16px 0 8px; padding: 12px 16px; border-radius: 12px; background: linear-gradient(135deg, #157347, #1f9d63); color: #fff; font-size: 17px; font-weight: 700; letter-spacing: .3px; text-decoration: none; }
.call-chip:hover { text-decoration: none; filter: brightness(1.06); }
.call-chip svg { color: #fff; }

/* car photos: big tiles, one photo each, built in the browser */
#doc-card { border-top: 4px solid var(--violet); }
.doc-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; max-height: 760px; overflow-y: auto; padding: 2px; }
.doc-photo-wrap { position: relative; }
.doc-photo-wrap .doc-photo { width: 100%; border-radius: 12px; border: 2px solid #e3e9f0; transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease; }
.doc-photo-wrap .doc-photo:hover { transform: translateY(-2px); border-color: var(--violet); box-shadow: 0 6px 16px rgba(91, 62, 168, .22); }
.doc-photo-n { position: absolute; left: 8px; top: 8px; min-width: 24px; height: 24px; padding: 0 7px; border-radius: 12px; background: rgba(15, 42, 67, .75); color: #fff; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.doc-photo-dl { position: absolute; right: 8px; bottom: 8px; width: 32px; height: 32px; border: 0; border-radius: 50%; background: rgba(255,255,255,.95); color: var(--violet); display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,.25); }
.doc-photo-dl:hover { background: var(--violet); color: #fff; }
.doc-loading { grid-column: 1 / -1; padding: 26px 8px; text-align: center; color: var(--muted); font-size: 13.5px; }
.spinner-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--violet); border-right-color: transparent; vertical-align: -2px; animation: kd-spin .7s linear infinite; }
@keyframes kd-spin { to { transform: rotate(360deg); } }
.doc-actions .btn[hidden] { display: none; }
.pv-save { bottom: 10px; right: 14px; font-size: 24px; }

@media (max-width: 1180px) { .detail-grid { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .hero-split { grid-template-columns: 1fr; gap: 16px; }
  .info-grid { grid-template-columns: 1fr; }
  .detail-grid .card-body { padding: 16px; }
  .detail-grid .card-head { padding: 13px 16px; }
  .price-tile-value { font-size: 25px; }
  .doc-photos { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ------------------------------------------------------------
   v2.8 — Car photos: wide landscape gallery
   ------------------------------------------------------------ */
.gallery { display: block; max-height: none; overflow: visible; padding: 0; }
.gal-stage { position: relative; width: 100%; aspect-ratio: 16 / 10; border-radius: 14px; overflow: hidden; background: #0b1622; isolation: isolate; box-shadow: 0 8px 24px rgba(15, 42, 67, .22); }
.gal-stage::before { content: ''; position: absolute; inset: -20px; background: var(--u) center / cover no-repeat; filter: blur(26px) brightness(.55); z-index: -1; }
.gal-open { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; background: transparent; cursor: zoom-in; display: flex; align-items: center; justify-content: center; }
.gal-open img { max-width: 100%; max-height: 100%; width: 100%; height: 100%; object-fit: contain; display: block; }
.gal-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 46px; height: 46px; border-radius: 50%; border: 0; background: rgba(255,255,255,.18); backdrop-filter: blur(6px); color: #fff; font-size: 32px; line-height: 1; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.gal-nav:hover { background: rgba(255,255,255,.38); }
.gal-prev { left: 12px; } .gal-next { right: 12px; }
.gal-count { position: absolute; left: 12px; top: 12px; padding: 4px 12px; border-radius: 14px; background: rgba(0,0,0,.55); color: #fff; font-size: 13px; font-weight: 700; }
.gal-save { position: absolute; right: 12px; top: 12px; display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border: 0; border-radius: 18px; background: #fff; color: var(--violet); font-size: 13px; font-weight: 700; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.3); }
.gal-save:hover { background: var(--violet); color: #fff; }
.gal-zoom { position: absolute; right: 12px; bottom: 12px; display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 14px; background: rgba(0,0,0,.5); color: #fff; font-size: 12px; pointer-events: none; }
.gal-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 10px; margin-top: 14px; max-height: 330px; overflow-y: auto; padding: 4px 2px; }
.gal-thumb { position: relative; padding: 0; border: 2px solid transparent; border-radius: 10px; overflow: hidden; aspect-ratio: 4 / 3; background: #0b1622; cursor: pointer; isolation: isolate; opacity: .78; transition: opacity .12s, transform .12s, border-color .12s; }
.gal-thumb::before { content: ''; position: absolute; inset: -10px; background: var(--u) center / cover; filter: blur(10px) brightness(.6); z-index: -1; }
.gal-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.gal-thumb span { position: absolute; left: 5px; top: 5px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: rgba(15,42,67,.75); color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.gal-thumb:hover { opacity: 1; transform: translateY(-1px); }
.gal-thumb.on { opacity: 1; border-color: var(--violet); box-shadow: 0 0 0 2px #fff inset, 0 4px 12px rgba(91,62,168,.35); }
@media (max-width: 760px) {
  .gal-stage { aspect-ratio: 4 / 3; }
  .gal-thumbs { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); max-height: 250px; }
  .gal-nav { width: 38px; height: 38px; font-size: 26px; }
}

/* v2.9 — gallery polish: no click-zoom, tidy thumbs, no inner scrolling */
.gal-stage { aspect-ratio: 16 / 9; }
.gal-open { cursor: default; }
.gal-zoom { border: 0; cursor: pointer; pointer-events: auto; padding: 7px 13px; background: rgba(0,0,0,.6); font-weight: 600; }
.gal-zoom:hover { background: rgba(0,0,0,.85); }
.gal-thumbs { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; max-height: none; overflow: visible; padding: 2px 0; margin-top: 12px; }
.gal-thumb { aspect-ratio: 4 / 3; border-radius: 9px; background: var(--surface-3); opacity: 1; border-width: 3px; }
.gal-thumb::before { display: none; }
.gal-thumb img { object-fit: cover; }
.gal-thumb:not(.on) img { filter: saturate(.85) brightness(.9); }
.gal-thumb.on { box-shadow: 0 4px 12px rgba(91, 62, 168, .35); }
.gal-thumbs:not(.all) .gal-thumb.extra { display: none; }
.gal-more { display: block; width: 100%; margin-top: 10px; padding: 11px; border: 1px dashed var(--border-strong); border-radius: 10px; background: var(--surface-2); color: var(--primary); font-size: 14px; font-weight: 700; cursor: pointer; }
.gal-more:hover { background: var(--primary-soft); }
@media (max-width: 760px) { .gal-stage { aspect-ratio: 4 / 3; } .gal-thumbs { grid-template-columns: repeat(4, minmax(0, 1fr)); max-height: none; } }

/* v2.9.2 — car photos: plain grid of small tiles, click one to open it big (no heavy stage) */
.gal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.gal-tile { position: relative; padding: 0; border: 0; border-radius: 10px; overflow: hidden; aspect-ratio: 4 / 3; background: var(--surface-3, #e8edf3); cursor: zoom-in; contain: layout paint; transition: transform .12s, box-shadow .12s; }
.gal-tile img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transition: opacity .18s; }
.gal-tile.ready img { opacity: 1; }
.gal-tile:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(15, 42, 67, .25); }
.gal-tile:focus-visible { outline: 3px solid var(--violet, #5b3ea8); outline-offset: 2px; }
.gal-tile span { position: absolute; left: 5px; top: 5px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: rgba(15, 42, 67, .75); color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
@media (max-width: 760px) { .gal-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; } }
/* viewer: no white box behind the photo, smoother swaps */
.pv-img { background: transparent; }

/* v2.9.2 — lead hero: bigger vehicle name + details */
.hero-title { font-size: 32px; line-height: 1.15; letter-spacing: -0.5px; }
.hero-sub { font-size: 18px; font-weight: 600; color: var(--text-2, #3b4a5c); margin: 8px 0 20px; }
@media (max-width: 760px) { .hero-title { font-size: 26px; } .hero-sub { font-size: 16px; } }
