:root {
  --bg: #141414;
  --panel: #1e1e1e;
  --panel-2: #252525;
  --border: #2e2e2e;
  --text: #f0f0f0;
  --muted: #999999;
  --accent: #ff6b35;
  --accent-dark: #ff8555;
  --good: #2faa57;
  --warn: #d59b2a;
  --bad: #ff4444;
  --row-hover: #232323;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace; }

.topbar { display: flex; align-items: center; gap: 24px;
  padding: 12px 20px; background: var(--panel); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700;
  letter-spacing: 4px; font-size: 16px; color: var(--text); }
.brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 10px var(--accent); }
.topbar nav { display: flex; gap: 6px; flex: 1; }
.topbar nav a { color: var(--muted); padding: 6px 12px; border-radius: 6px; }
.topbar nav a:hover { color: var(--text); background: var(--panel-2); text-decoration: none; }
.topbar nav a.on { color: var(--text); background: var(--panel-2); }
.link-btn { background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; padding: 6px 10px; }
.link-btn:hover { color: var(--text); }

.page { padding: 20px; max-width: 1200px; margin: 0 auto; }
h1 { margin: 0 0 4px; font-size: 22px; }
h2 { margin: 22px 0 10px; font-size: 16px; }
.muted { color: var(--muted); font-size: 13px; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin: 16px 0; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px; }
.card .n { font-size: 30px; font-weight: 700; font-family: "IBM Plex Mono", monospace; }
.card .l { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; margin-top: 4px; }
.card .n.accent { color: var(--accent); }

.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px; margin: 16px 0; }
.setup-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); }
.setup-row:first-child { border-top: none; }
.pill { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; letter-spacing: 0.4px; }
.pill.ok { background: rgba(47,170,87,0.15); color: var(--good); border: 1px solid rgba(47,170,87,0.35); }
.pill.no { background: rgba(214,80,74,0.12); color: var(--bad); border: 1px solid rgba(214,80,74,0.30); }
.setup-row .what { flex: 1; }

button.primary { background: var(--accent); border: 1px solid var(--accent); color: #fff; font-weight: 600;
  border-radius: 6px; padding: 10px 14px; cursor: pointer; font: inherit; }
button.primary:hover { background: var(--accent-dark); }
input { font: inherit; color: var(--text); background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 6px; padding: 10px 12px; }
input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.login-body { display: grid; place-items: center; min-height: 100vh; }
.login-card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 28px; width: 320px; display: flex; flex-direction: column; gap: 12px; }
.login-card .brand { justify-content: center; margin-bottom: 6px; }
.error { color: var(--bad); font-size: 13px; }

/* ---- demo banner ---- */
.demo-banner { background: rgba(255,107,53,0.12); border: 1px solid rgba(255,107,53,0.35);
  color: var(--accent-dark); border-radius: 8px; padding: 8px 14px; margin: 0 0 14px; font-size: 13px; }

/* ---- search ---- */
.searchbar { display: flex; gap: 10px; margin: 14px 0; }
.searchbar input { flex: 1; }

/* ---- tables ---- */
.table-wrap { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
thead th { text-align: left; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px;
  padding: 10px 12px; border-bottom: 1px solid var(--border); font-weight: 600; }
tbody td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--row-hover); }
.num { text-align: right; font-family: "IBM Plex Mono", monospace; }
.plate { font-family: "IBM Plex Mono", monospace; font-weight: 600; letter-spacing: 0.5px; }

/* ---- chips / badges ---- */
.chip { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--muted); margin: 1px 2px; }
.cat { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 4px; margin: 1px 2px; color: #111; }
.pri { display: inline-block; font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 4px; letter-spacing: 0.3px; }
.pri1 { background: rgba(255,68,68,0.18); color: #ff6b6b; border: 1px solid rgba(255,68,68,0.4); }
.pri2 { background: rgba(213,155,42,0.16); color: var(--warn); border: 1px solid rgba(213,155,42,0.4); }
.pri3 { background: rgba(47,163,170,0.14); color: #4fc3cc; border: 1px solid rgba(47,163,170,0.35); }
.pri4, .pri5 { background: var(--panel-2); color: var(--muted); border: 1px solid var(--border); }
.overdue { color: var(--bad); font-weight: 600; }
.soon { color: var(--warn); }

/* ---- profile header ---- */
.profile-head { display: flex; align-items: flex-start; gap: 18px; flex-wrap: wrap; }
.profile-head .id { flex: 1; }
.profile-head h1 { margin: 0; }
.meta-row { color: var(--muted); font-size: 13px; margin-top: 4px; }
.stat-inline { display: flex; gap: 22px; margin-top: 10px; }
.stat-inline .n { font-family: "IBM Plex Mono", monospace; font-size: 20px; font-weight: 700; }
.stat-inline .l { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px; }

/* ---- vehicle cards ---- */
.veh-card { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; margin: 10px 0; }
.veh-card .hd { display: flex; align-items: center; gap: 10px; }
.veh-card .hd a { font-weight: 600; }
.veh-card .hd .muted { margin-left: auto; }

/* ---- timeline ---- */
.timeline { border-left: 2px solid var(--border); margin: 8px 0 8px 8px; padding-left: 16px; }
.tl-item { position: relative; padding: 8px 0; }
.tl-item::before { content: ""; position: absolute; left: -23px; top: 14px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 3px var(--bg); }
.tl-date { font-family: "IBM Plex Mono", monospace; font-size: 12px; color: var(--muted); }
.tl-body { margin-top: 3px; }

/* ---- followup rows ---- */
.fu-row { display: flex; align-items: center; gap: 12px; padding: 12px; border-bottom: 1px solid var(--border); }
.fu-row:last-child { border-bottom: none; }
.fu-main { flex: 1; min-width: 0; }
.fu-title { font-weight: 600; }
.fu-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.btn { display: inline-block; font: inherit; font-size: 13px; padding: 7px 12px; border-radius: 6px; cursor: pointer;
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text); }
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn.wa { background: #1f7a44; border-color: #1f7a44; color: #fff; }
.btn.wa:hover { background: #248a4e; }

/* ---- ai box ---- */
.ai-box { background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; margin: 10px 0; }
.ai-box .score { font-family: "IBM Plex Mono", monospace; font-size: 26px; font-weight: 700; color: var(--accent); }
.ai-draft { white-space: pre-wrap; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-top: 8px; font-size: 14px; }

/* ---- responsive: follow-up rows + nav on narrow widths ---- */
.fu-row { align-items: flex-start; flex-wrap: wrap; }
@media (max-width: 760px) {
  .fu-main { flex: 1 1 100%; }
  .fu-row .btn { flex: 1 1 auto; text-align: center; margin-top: 8px; }
  .topbar { flex-wrap: wrap; gap: 10px; }
  .topbar nav { order: 3; flex: 1 1 100%; }
  .cards { grid-template-columns: 1fr 1fr; }
}

/* ---- inspection ---- */
.insp-card { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 16px; margin: 10px 0; }
.insp-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.stat-badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-good { background: rgba(47,170,87,0.16); color: var(--good); border: 1px solid rgba(47,170,87,0.4); }
.stat-monitor { background: rgba(213,155,42,0.16); color: var(--warn); border: 1px solid rgba(213,155,42,0.4); }
.stat-replace { background: rgba(255,68,68,0.16); color: #ff6b6b; border: 1px solid rgba(255,68,68,0.4); }
.measures { display: flex; gap: 22px; flex-wrap: wrap; margin: 12px 0; }
.measures .m .v { font-family: "IBM Plex Mono", monospace; font-size: 20px; font-weight: 700; }
.measures .m .k { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px; }
.wheel-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 10px 0; }
.wheel { background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; text-align: center; }
.wheel .pos { color: var(--muted); font-size: 11px; }
.wheel .val { font-family: "IBM Plex Mono", monospace; font-weight: 700; font-size: 16px; }
.insp-summary { background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-top: 10px; font-size: 14px; white-space: pre-wrap; color: var(--text); }
@media (max-width: 560px) { .wheel-grid { grid-template-columns: repeat(2, 1fr); } }

/* ===== profile pages (customer + vehicle) — shared design system ===== */
.back-link { display: inline-block; margin-bottom: 14px; }
.cust-hero { display: flex; align-items: center; gap: 18px; background: var(--panel);
  border: 1px solid var(--border); border-radius: 14px; padding: 20px 22px; }
.avatar { width: 64px; height: 64px; flex: 0 0 64px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark)); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 24px; letter-spacing: 1px; }
.avatar.good { background: linear-gradient(135deg, var(--good), #1f7a44); }
.avatar.monitor { background: linear-gradient(135deg, var(--warn), #b07d1e); }
.avatar.replace { background: linear-gradient(135deg, #ff6b6b, var(--bad)); }
.avatar svg { width: 30px; height: 30px; }
.hero-main { min-width: 0; }
.hero-main h1 { margin: 0 0 6px; font-size: 24px; }
.hero-contact { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hero-phone { font-size: 15px; }
.hero-meta { color: var(--muted); font-size: 13px; margin-top: 8px; }
.btn.sm { padding: 4px 11px; font-size: 12px; }
.metrics { margin: 18px 0; }
.profile-grid { display: grid; grid-template-columns: 1fr; gap: 20px; align-items: start; }
@media (min-width: 940px) { .profile-grid { grid-template-columns: minmax(0,1.9fr) minmax(0,1fr); } }
.col-main section + section { margin-top: 26px; }
.col-main h2 { margin: 0 0 12px; }
.veh-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.veh-card2 { display: block; background: var(--panel); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px 16px; color: var(--text); transition: border-color .12s; }
.veh-card2:hover { border-color: var(--accent); text-decoration: none; }
.vc-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.plate.lg { font-size: 17px; }
.vc-model { color: var(--muted); font-size: 13px; margin-top: 4px; }
.vc-meta { font-size: 12.5px; color: var(--muted); margin-top: 10px; }
.vc-meta strong { color: var(--text); font-weight: 600; }
.vc-foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.vc-open { margin-left: auto; color: var(--accent); font-size: 13px; font-weight: 600; }
table.hist thead th { position: static; }
.hist-date { white-space: nowrap; font-variant-numeric: tabular-nums; }
.hist-doc { color: var(--muted); font-size: 11px; font-family: "IBM Plex Mono", monospace; margin-top: 2px; }
.hist-cats { margin-bottom: 3px; }
.hist-desc { color: var(--muted); font-size: 12.5px; }
.hist-amt { font-weight: 600; white-space: nowrap; }
.col-side .panel { margin: 0 0 16px; }
.col-side h3 { margin: 0 0 10px; font-size: 14px; }
.attn-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--border); }
.attn-item:first-of-type { border-top: none; padding-top: 4px; }
.attn-main { flex: 1; min-width: 0; }
.attn-title { font-size: 13.5px; font-weight: 600; }
.attn-sub { color: var(--muted); font-size: 12px; margin-top: 1px; }
.spend-row { margin: 10px 0; }
.spend-top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
.spend-bar { height: 7px; background: var(--panel-2); border-radius: 4px; overflow: hidden; }
.spend-fill { height: 100%; border-radius: 4px; }
.spec-row { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-top: 1px solid var(--border); font-size: 13px; }
.spec-row:first-child { border-top: none; }
.spec-row .k { color: var(--muted); }
.spec-row .v { font-weight: 600; text-align: right; word-break: break-word; }
.ai-panel .score { font-family: "IBM Plex Mono", monospace; font-size: 28px; font-weight: 700; color: var(--accent); }
.ai-panel .ai-draft { margin-top: 8px; }
