:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --ink: #16202e;
  --ink-soft: #5b6b80;
  --line: #e2e8f0;
  --accent: #1f56d6;
  --accent-soft: #eaf0ff;
  --ok: #17a673;
  --ok-soft: #e7f6f0;
  --warn: #d98a12;
  --warn-soft: #fdf3e2;
  --bad: #d0433a;
  --bad-soft: #fdeceb;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 32, 56, .06), 0 8px 24px rgba(16, 32, 56, .06);
  color-scheme: light;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 "Segoe UI", system-ui, -apple-system, sans-serif;
}
h2 { font-size: 13px; letter-spacing: .04em; text-transform: uppercase;
     color: var(--ink-soft); margin: 0 0 14px; font-weight: 600; }
h3 { font-size: 12px; letter-spacing: .03em; text-transform: uppercase;
     color: var(--ink-soft); margin: 22px 0 10px; font-weight: 600; }
.muted { color: var(--ink-soft); }
.tabular { font-variant-numeric: tabular-nums; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 22px; flex-wrap: wrap;
  padding: 10px 22px; background: var(--panel); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; }
.mark { width: 32px; height: 32px; border-radius: 9px; flex: none;
        background: linear-gradient(135deg, var(--accent), #4b82f7); }
.brand-name { font-weight: 700; font-size: 16px; letter-spacing: -.01em; }
.brand-sub { font-size: 12px; color: var(--ink-soft); }

.nav { display: flex; gap: 4px; margin-right: auto; flex-wrap: wrap; }
.nav a {
  padding: 7px 14px; border-radius: 8px; text-decoration: none;
  color: var(--ink-soft); font-weight: 600; font-size: 13px;
}
.nav a:hover { background: var(--bg); color: var(--ink); }
.nav a.active { background: var(--accent-soft); color: var(--accent); }

.status {
  display: flex; align-items: center; gap: 8px; background: var(--bg);
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px;
  font-size: 12px; color: var(--ink-soft);
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-soft); flex: none; }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 3px rgba(23,166,115,.16); }
.dot.warn { background: var(--warn); box-shadow: 0 0 0 3px rgba(217,138,18,.16); }

/* ---------- layout ---------- */
.wrap { padding: 18px 22px 48px; max-width: 1500px; margin: 0 auto; }
.cols { display: grid; gap: 18px; align-items: start; }
.cols-3 { grid-template-columns: 330px minmax(0, 1fr) 340px; }
.cols-2 { grid-template-columns: 360px minmax(0, 1fr); }
@media (max-width: 1150px) { .cols-3, .cols-2 { grid-template-columns: 1fr; } }

.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px;
}
.panel + .panel { margin-top: 18px; }

/* ---------- forms ---------- */
label.field { display: block; margin-bottom: 12px; }
label.field span { display: block; font-size: 12px; color: var(--ink-soft);
                   margin-bottom: 4px; font-weight: 600; }
input[type=text], input[type=password], input[type=email], input[type=tel],
input[type=search], input[type=number], input[type=date], textarea, select {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line);
  border-radius: 8px; font: inherit; background: #fff; color: var(--ink);
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
/* Browsers inject their own control into password fields -- Edge a reveal eye, Chrome a
   saved-credentials key, Safari a strong-password button. Each one eats space inside the
   box and makes it sit differently to every other field. Hide them so Password matches
   Email. */
input[type=password]::-ms-reveal,
input[type=password]::-ms-clear { display: none; }
input[type=password]::-webkit-credentials-auto-fill-button,
input[type=password]::-webkit-strong-password-auto-fill-button {
  display: none !important;
  visibility: hidden;
  pointer-events: none;
  width: 0; margin: 0;
}
textarea { resize: vertical; min-height: 64px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 16px; border-radius: 9px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); font: inherit; font-weight: 600;
  cursor: pointer; transition: background .13s, border-color .13s, opacity .13s;
}
.btn:hover:not(:disabled) { background: var(--bg); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: #1846b4; }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-ok:hover:not(:disabled) { background: #128a5f; }
.btn-warn { background: var(--warn); border-color: var(--warn); color: #fff; }
.btn-warn:hover:not(:disabled) { background: #b8740c; }
.btn-bad { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-bad:hover:not(:disabled) { background: #b0352d; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-block { width: 100%; }

/* ---------- steps ---------- */
.step-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.step-num {
  width: 24px; height: 24px; border-radius: 50%; flex: none;
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-size: 12px; font-weight: 700;
}
.step-head h2 { margin: 0; }
.panel.locked { opacity: .5; pointer-events: none; }

/* ---------- dropzone ---------- */
.dropzone {
  border: 1.5px dashed #c4d0e0; border-radius: var(--radius);
  padding: 22px 16px; text-align: center; cursor: pointer;
  background: #fbfcfe; transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone:focus-visible, .dropzone.over {
  border-color: var(--accent); background: var(--accent-soft); outline: none;
}
.dz-icon { width: 24px; height: 24px; stroke: var(--accent); stroke-width: 1.7;
           fill: none; stroke-linecap: round; stroke-linejoin: round; }
.dz-title { margin: 8px 0 2px; font-weight: 600; }
.dz-hint { margin: 0; font-size: 12px; color: var(--ink-soft); }

.samples { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.samples img {
  width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 8px;
  cursor: pointer; border: 2px solid transparent; transition: border-color .15s; display: block;
}
.samples img:hover { border-color: var(--accent); }

/* ---------- analysed photo cards ---------- */
.thumbs { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.thumb { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #0e1726; }
.thumb canvas { width: 100%; display: block; }
.thumb-meta {
  background: var(--panel); padding: 9px 11px; font-size: 12px;
  display: flex; justify-content: space-between; gap: 8px; align-items: baseline;
}
.thumb-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty-note {
  border: 1.5px dashed var(--line); border-radius: 10px; padding: 26px;
  text-align: center; color: var(--ink-soft);
}

/* ---------- verdict ---------- */
.verdict { border-radius: 10px; padding: 14px 16px; border: 1px solid; }
.verdict-title { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.verdict-sub { font-size: 12.5px; margin-top: 3px; opacity: .85; }
.verdict.claimable { background: var(--ok-soft); border-color: #bfe6d5; color: #0d6b4a; }
.verdict.manual_review { background: var(--warn-soft); border-color: #f2ddb4; color: #8a5806; }
.verdict.not_claimable { background: var(--bad-soft); border-color: #f4c9c5; color: #93281f; }

.reasons { margin: 12px 0 0; padding-left: 18px; font-size: 13px; }
.reasons li { margin-bottom: 5px; }
.flags { list-style: none; margin: 10px 0 0; padding: 0; }
.flags li {
  background: var(--warn-soft); border: 1px solid #f2ddb4; color: #8a5806;
  border-radius: 8px; padding: 8px 11px; font-size: 12.5px; margin-bottom: 6px;
  display: flex; gap: 7px;
}
.flags li::before { content: "!"; font-weight: 700; flex: none; }

/* ---------- money breakdown ---------- */
.money { width: 100%; border-collapse: collapse; font-size: 13px; }
.money th { text-align: left; font-size: 11px; text-transform: uppercase;
            letter-spacing: .04em; color: var(--ink-soft); padding: 0 8px 7px 0; font-weight: 600; }
.money td { padding: 7px 8px 7px 0; border-top: 1px solid var(--line); vertical-align: top; }
.money td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.money tr.excluded td { color: var(--ink-soft); }
.money tr.total td { border-top: 2px solid var(--ink); font-weight: 700; font-size: 15px; }
.money tr.sub td { border-top: 1px dashed var(--line); color: var(--ink-soft); }
.line-note { font-size: 11.5px; color: var(--ink-soft); display: block; margin-top: 2px; }

/* ---------- badges ---------- */
.badge {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.badge.claimable, .badge.approved { background: var(--ok-soft); color: #0d6b4a; }
.badge.manual_review, .badge.pending_review, .badge.partially_approved,
.badge.analysing { background: var(--warn-soft); color: #8a5806; }
.badge.not_claimable, .badge.rejected { background: var(--bad-soft); color: #93281f; }
.badge.neutral { background: var(--bg); color: var(--ink-soft); }

/* ---------- tables ---------- */
.table-scroll { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--ink-soft); padding: 8px 10px; border-bottom: 1px solid var(--line);
  white-space: nowrap; font-weight: 600;
}
table.data td { padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data tr:hover td { background: #fbfcfe; }
table.data td.wrap { white-space: normal; }

/* ---------- surveyor queue ---------- */
.queue { display: flex; flex-direction: column; gap: 8px; max-height: 70vh; overflow-y: auto; }
.queue-item {
  border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px;
  cursor: pointer; background: #fff; transition: border-color .13s, background .13s;
}
.queue-item:hover { border-color: var(--accent); background: #fbfcff; }
.queue-item.active { border-color: var(--accent); background: var(--accent-soft); }
.queue-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.queue-id { font-weight: 700; font-size: 13px; }
.queue-sub { font-size: 12px; color: var(--ink-soft); margin-top: 3px;
             display: flex; justify-content: space-between; gap: 8px; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 5px 14px; font-size: 13px; }
.kv dt { color: var(--ink-soft); }
.kv dd { margin: 0; font-weight: 600; }

/* ---------- misc ---------- */
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 9px;
  font-weight: 600; box-shadow: var(--shadow); z-index: 50; max-width: 90vw;
}
.toast.bad { background: var(--bad); }
.spinner {
  width: 15px; height: 15px; border-radius: 50%; display: inline-block;
  border: 2px solid rgba(255,255,255,.3); border-top-color: #fff;
  animation: spin .8s linear infinite;
}
.spinner.dark { border-color: rgba(31,86,214,.25); border-top-color: var(--accent); }
@keyframes spin { to { transform: rotate(360deg); } }

.jobchip {
  display: inline-flex; align-items: center; gap: 8px; background: var(--accent-soft);
  color: var(--accent); border-radius: 8px; padding: 8px 12px; font-weight: 700;
  font-size: 13px; margin-bottom: 14px;
}

/* ---------- print (report page) ---------- */
@media print {
  .topbar, .no-print { display: none !important; }
  body { background: #fff; }
  .panel { box-shadow: none; border-color: #ccc; break-inside: avoid; }
  .wrap { padding: 0; }
}

/* ---------- login ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: 100%; max-width: 380px; background: var(--panel); padding: 30px;
             border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.auth-error { background: var(--bad-soft); border: 1px solid #f4c9c5; color: #93281f;
              border-radius: 8px; padding: 9px 12px; font-size: 13px; margin-bottom: 14px; }

/* ---------- stat grid ---------- */
.stat-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
             margin-bottom: 18px; }
.stat-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
             padding: 16px 18px; box-shadow: var(--shadow); }
.stat-card .stat-value { font-size: 28px; font-weight: 700; line-height: 1.1;
                         font-variant-numeric: tabular-nums; }
.stat-card .stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
                         color: var(--ink-soft); margin-top: 4px; font-weight: 600; }

/* ---------- filters + link box ---------- */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.filters label.field { margin: 0; }
.filters input, .filters select { min-width: 150px; }

.link-box { background: var(--accent-soft); border: 1px solid #c7d8ff; border-radius: 10px;
            padding: 14px; margin-top: 14px; }
.link-url { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px;
            word-break: break-all; background: #fff; border: 1px solid var(--line);
            border-radius: 7px; padding: 9px 11px; margin: 9px 0; }

/* ---------- report sections ---------- */
.section-card { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
                margin-bottom: 16px; background: var(--panel); }
.section-head { display: flex; align-items: center; gap: 11px; padding: 13px 16px;
                border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.side-badge { width: 30px; height: 30px; border-radius: 8px; flex: none; display: grid;
              place-items: center; font-weight: 700; color: #fff; font-size: 13px; }
.side-badge.damaged { background: var(--bad); }
.side-badge.clean { background: var(--ok); }
.section-name { font-weight: 700; }
.section-state { font-size: 12.5px; }
.section-state.damaged { color: var(--bad); }
.section-state.clean { color: var(--ok); }
.section-date { margin-left: auto; font-size: 12px; color: var(--ink-soft); }

.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 14px 16px; }
@media (max-width: 720px) { .pair { grid-template-columns: 1fr; } }
.pane { position: relative; border-radius: 9px; overflow: hidden; background: #0e1726; }
.pane canvas, .pane img { width: 100%; display: block; }
.pane-tag { position: absolute; left: 0; bottom: 0; right: 0; padding: 7px 11px;
            background: linear-gradient(transparent, rgba(8,14,24,.82)); color: #fff;
            font-size: 12px; font-weight: 600; display: flex; justify-content: space-between; }
.pane.analysis { outline: 2px solid var(--ok); outline-offset: -2px; }

/* ---------- vehicle identity ---------- */
.id-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.id-field { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.id-label { font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
            color: var(--ink-soft); font-weight: 600; }
.id-value { font-family: ui-monospace, Consolas, monospace; font-size: 15px; font-weight: 700;
            margin: 5px 0 3px; word-break: break-all; }
.id-note { font-size: 11.5px; }
.id-note.ok { color: var(--ok); }
.id-note.bad { color: var(--bad); }

/* ---------- customer capture ---------- */
.cap-body { max-width: 560px; margin: 0 auto; padding: 16px 16px 40px; }
.cap-progress { display: flex; gap: 4px; margin: 14px 0 18px; }
.cap-progress span { flex: 1; height: 5px; border-radius: 3px; background: var(--line); }
.cap-progress span.done { background: var(--ok); }
.cap-progress span.current { background: var(--accent); }
.cap-stage { background: #0e1726; border-radius: var(--radius); overflow: hidden;
             position: relative; aspect-ratio: 3/4; display: grid; place-items: center; }
.cap-stage video, .cap-stage canvas, .cap-stage img { width: 100%; height: 100%;
             object-fit: cover; display: block; }
.cap-guide { position: absolute; inset: 10%; border: 2px dashed rgba(255,255,255,.55);
             border-radius: 14px; pointer-events: none; }
.cap-hint { background: var(--accent-soft); border: 1px solid #c7d8ff; color: #1a3f9e;
            border-radius: 9px; padding: 11px 13px; font-size: 13.5px; margin: 14px 0; }
.cap-warn { background: var(--warn-soft); border: 1px solid #f2ddb4; color: #8a5806;
            border-radius: 9px; padding: 11px 13px; font-size: 13px; margin: 12px 0; }
.cap-target-name { font-size: 19px; font-weight: 700; }
.cap-step { font-size: 12px; color: var(--ink-soft); text-transform: uppercase;
            letter-spacing: .05em; font-weight: 600; }
.rec-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--bad);
           display: inline-block; animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }

/* ---------- chart ---------- */
.chart-card { background: var(--panel); border: 1px solid var(--line);
              border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.chart-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
              margin-bottom: 10px; }
.chart-title { font-weight: 700; font-size: 15px; margin-right: auto; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px;
       overflow: hidden; }
.seg button { border: 0; background: #fff; padding: 6px 14px; font: inherit;
              font-weight: 600; font-size: 12.5px; color: var(--ink-soft); cursor: pointer; }
.seg button.active { background: var(--accent); color: #fff; }
.seg button + button { border-left: 1px solid var(--line); }
.chart-total { background: var(--ok); color: #fff; border-radius: var(--radius);
               padding: 18px 20px; display: flex; align-items: center;
               justify-content: space-between; gap: 14px; }
.chart-total .label { font-size: 17px; font-weight: 700; }
.chart-total .value { font-size: 26px; font-weight: 700; background: rgba(255,255,255,.18);
                      border-radius: 10px; padding: 4px 18px; min-width: 76px;
                      text-align: center; }
.period { display: flex; gap: 10px; align-items: flex-end; margin-top: 14px; }
.period label.field { margin: 0; }

/* ---------- team directory ---------- */
.sup-row { border: 1px solid var(--line); border-radius: var(--radius);
           margin-bottom: 12px; background: var(--panel); overflow: hidden; }
.sup-head { display: flex; align-items: center; gap: 14px; padding: 14px 16px;
            flex-wrap: wrap; }
.sup-name { font-weight: 700; font-size: 15px; }
.sup-email { color: var(--ink-soft); font-size: 13px; }
.sup-actions { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.sup-actions .btn { padding: 6px 11px; font-size: 12.5px; }
.sup-body { border-top: 1px solid var(--line); padding: 14px 16px; background: #fbfcfe; }
.sup-stats { display: grid; gap: 12px;
             grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.sup-stat { background: #fff; border: 1px solid var(--line); border-radius: 10px;
            padding: 12px 14px; }
.sup-stat .k { font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
               color: var(--ink-soft); font-weight: 600; margin-bottom: 6px; }
.sup-stat .big { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ratio { display: flex; justify-content: space-between; font-size: 12.5px;
         padding: 2px 0; }
.ratio span:last-child { font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- prominent recommendation ---------- */
.reco { border-radius: var(--radius); padding: 18px 20px; display: flex;
        align-items: center; gap: 20px; flex-wrap: wrap; border: 1px solid; }
.reco-main { flex: 1; min-width: 220px; }
.reco-verdict { font-size: 21px; font-weight: 800; letter-spacing: -.01em; }
.reco-headline { font-size: 13.5px; margin-top: 3px; opacity: .9; }
.reco-amount { text-align: right; }
.reco-amount .n { font-size: 34px; font-weight: 800; line-height: 1;
                  font-variant-numeric: tabular-nums; }
.reco-amount .k { font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
                  font-weight: 700; opacity: .8; margin-top: 4px; }
.reco.good { background: var(--ok-soft); border-color: #bfe6d5; color: #0d6b4a; }
.reco.caution { background: var(--warn-soft); border-color: #f2ddb4; color: #8a5806; }
.reco.bad { background: var(--bad-soft); border-color: #f4c9c5; color: #93281f; }
