/* EstimateBay — design system (adapted from docs/estimate_scrubber_ui_mockups.html) */
:root {
  --page: #edf0ee;
  --paper: #ffffff;
  --paper-2: #f7f8f6;
  --ink: #17212b;
  --muted: #5d6873;
  --line: #d7ddd9;
  --line-strong: #bac4bf;
  --navy: #17395f;
  --blue: #1f6b9d;
  --teal: #19747e;
  --green: #1d7a4d;
  --amber: #b96d10;
  --red: #b63b33;
  --purple: #7650a8;
  --money: #0d8068;
  --rail: #152331;
  --inverse: #ffffff;
  --rail-ink: #e9eef2;
  --rail-muted: #aebbc8;
  --rail-control: #1d2f40;
  --rail-control-ink: #eef3f7;
  --rail-hover: rgba(255,255,255,.10);
  --rail-soft-hover: rgba(255,255,255,.07);
  --rail-border: rgba(255,255,255,.2);
  --rail-border-soft: rgba(255,255,255,.13);
  --rail-icon-border: rgba(255,255,255,.24);
  --focus: #7ed3bd;
  --mark-a: #7ed3bd;
  --mark-b: #5d8fce;
  --mark-ink: #10202e;
  --primary-hover: #1d4974;
  --drop-bg: #fbfcfa;
  --drop-border: #8e9f99;
  --drop-drag-bg: #eef6f2;
  --drop-icon-border: #bddbcf;
  --ok-bg: #e8f4ed;
  --ok-border: #bee2ce;
  --warn-bg: #fff2df;
  --warn-border: #f0d0a8;
  --bad-bg: #fae9e7;
  --bad-border: #e8bbb7;
  --review-bg: #f1ebfa;
  --review-border: #d7c7ee;
  --info-bg: #e9f2f8;
  --info-border: #c6deed;
  --money-bg: #eef8f5;
  --verdict-bg: #f2f8f5;
  --detail: #34404a;
  --verdict-detail: #43505b;
  --tag-bg: #eef3f1;
  --tag-border: #cfe0d8;
  --table-line: #eef1ef;
  --board-bg: #f3f6f4;
  --lane-bg: #edf2f0;
  --track-bg: #dfe5e1;
  --judgment-bg: #fdf6ec;
  --toast-bg: #1c2e3f;
  --overlay-bg: rgba(237,240,238,.78);
  --spinner-track: #d3dcd7;
  --addressed-line: #9aa7b1;
  --pass-accent: #cfe0d6;
  --info-accent: #cadeeb;
  --estimate-head-end: #1f567f;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(20,30,40,.08), 0 12px 26px rgba(20,30,40,.07);
  --mono: "Cascadia Code", Consolas, "Liberation Mono", monospace;
  --sans: Inter, "Segoe UI", Roboto, Arial, sans-serif;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #10171f;
  --paper: #17222c;
  --paper-2: #202c37;
  --ink: #eef3f0;
  --muted: #a8b5bf;
  --line: #31414d;
  --line-strong: #526473;
  --navy: #82b6e2;
  --blue: #76c3ef;
  --teal: #65c7cf;
  --green: #6bd69c;
  --amber: #e8b86e;
  --red: #f08a82;
  --purple: #c6a7f2;
  --money: #70dcc8;
  --rail: #0b1420;
  --rail-control: #152534;
  --rail-control-ink: #f0f6fa;
  --mark-ink: #10202e;
  --primary-hover: #6ca7d7;
  --drop-bg: #151f29;
  --drop-border: #506879;
  --drop-drag-bg: #173126;
  --drop-icon-border: #41695d;
  --ok-bg: #183426;
  --ok-border: #315f45;
  --warn-bg: #3a2a14;
  --warn-border: #6d5124;
  --bad-bg: #3a1d1d;
  --bad-border: #70403d;
  --review-bg: #2d2340;
  --review-border: #5a4775;
  --info-bg: #193041;
  --info-border: #385f78;
  --money-bg: #12362f;
  --verdict-bg: #153427;
  --detail: #c5d0d8;
  --verdict-detail: #b8c5ce;
  --tag-bg: #223340;
  --tag-border: #3e5361;
  --table-line: #293944;
  --board-bg: #111b24;
  --lane-bg: #18252f;
  --track-bg: #2b3a45;
  --judgment-bg: #382b18;
  --toast-bg: #243748;
  --overlay-bg: rgba(9,14,20,.78);
  --spinner-track: #2a3944;
  --addressed-line: #71828f;
  --pass-accent: #315f45;
  --info-accent: #385f78;
  --estimate-head-end: #255a7b;
  --shadow: 0 1px 2px rgba(0,0,0,.35), 0 12px 26px rgba(0,0,0,.28);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; color: var(--ink); background: var(--page);
  font: 14px/1.45 var(--sans); font-variant-numeric: tabular-nums;
}
h1, h2, h3, p { margin: 0; }
button, input, select { font: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 12px; }

/* ---- App shell: dark rail + main ---- */
.app-shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.rail {
  background: var(--rail); color: var(--rail-ink); padding: 18px 14px;
  display: flex; flex-direction: column; gap: 16px; position: sticky; top: 0; height: 100vh;
}
.wordmark { display: flex; align-items: center; gap: 10px; padding: 6px 6px 8px; border-radius: 8px; cursor: pointer; transition: background .12s; }
.wordmark:hover { background: var(--rail-soft-hover); }
.wordmark:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.mark {
  width: 34px; height: 34px; border-radius: 8px; flex: none;
  background: linear-gradient(135deg, var(--mark-a), var(--mark-b));
  display: grid; place-items: center; color: var(--mark-ink); font-weight: 900; font-size: 13px;
}
.wordmark b { display: block; font-size: 15px; }
.wordmark span { display: block; color: var(--rail-muted); font-size: 11px; margin-top: 1px; }
.rail-nav { display: grid; gap: 4px; }
.rail-btn {
  width: 100%; min-height: 38px; border: 0; border-radius: 7px; background: transparent;
  color: var(--rail-muted); text-align: left; padding: 8px 10px; display: flex; align-items: center;
  gap: 9px; cursor: pointer; font-weight: 600; transition: background .12s;
}
.rail-btn:hover { background: var(--rail-hover); color: var(--inverse); }
.mini-icon {
  width: 24px; height: 24px; border: 1px solid var(--rail-icon-border); border-radius: 6px;
  display: grid; place-items: center; font-size: 10px; font-weight: 800; flex: none;
}
.rail-upload { width: 100%; justify-content: center; cursor: pointer; }
.rail-field { display: grid; gap: 5px; font-size: 11px; color: var(--rail-muted); font-weight: 700; text-transform: uppercase; letter-spacing: .4px; }
.rail-field select {
  width: 100%; padding: 8px 9px; border-radius: 7px; border: 1px solid var(--rail-border);
  background: var(--rail-control); color: var(--rail-control-ink); font-weight: 600; text-transform: none; letter-spacing: 0;
}
.rail-field small { color: var(--rail-muted); font-size: 11px; line-height: 1.35; text-transform: none; letter-spacing: 0; font-weight: 500; }
.theme-toggle {
  min-height: 34px; border: 1px solid var(--rail-border); border-radius: 7px;
  color: var(--rail-muted); display: flex; align-items: center; gap: 8px;
  padding: 7px 9px; font-size: 12px; font-weight: 700; cursor: pointer;
}
.theme-toggle:hover { background: var(--rail-soft-hover); color: var(--rail-ink); }
.theme-toggle input { accent-color: var(--focus); }
.rail-foot {
  margin-top: auto; border-top: 1px solid var(--rail-border-soft); padding-top: 14px;
  color: var(--rail-muted); font-size: 12px; display: grid; gap: 6px;
}
.rail-foot b { color: var(--rail-ink); }
.rail-signout { color: var(--rail-muted); font-size: 12px; text-decoration: underline; justify-self: start; }
.rail-signout:hover { color: var(--inverse); }

/* ---- Login screen ---- */
.login-body {
  display: flex; align-items: center; justify-content: flex-start; min-height: 100vh;
  padding-left: clamp(24px, 9vw, 140px);
  background-color: var(--page);
  background-image: url("../img/login-hero.jpg");
  background-size: cover; background-position: center; background-repeat: no-repeat;
}
.login-wrap { width: 100%; max-width: 380px; padding: 24px; }
.login-card {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.30), 0 2px 8px rgba(15, 23, 42, 0.18);
  padding: 26px 24px; display: grid; gap: 14px;
}
.login-mark { display: flex; align-items: center; gap: 10px; }
.login-mark b { display: block; font-size: 15px; }
.login-mark span { display: block; color: var(--muted); font-size: 11px; margin-top: 1px; }
.login-card h1 { font-size: 20px; font-weight: 850; margin-top: 2px; }
.login-field { display: grid; gap: 5px; font-size: 12px; font-weight: 700; color: var(--muted); }
.login-field input { padding: 9px 11px; border: 1px solid var(--line-strong); border-radius: 7px; font-size: 14px; background: var(--paper); color: var(--ink); }
.login-field input:focus { outline: none; border-color: var(--navy); }
.login-submit { justify-content: center; margin-top: 4px; }
.login-error { background: var(--bad-bg); border: 1px solid var(--bad-border); color: var(--red); border-radius: 7px; padding: 8px 11px; font-size: 13px; font-weight: 650; }
.login-foot { color: var(--muted); font-size: 11px; text-align: center; margin-top: 2px; }
.main { min-width: 0; }
.content { max-width: 1280px; margin: 0 auto; padding: 22px; display: grid; gap: 16px; }

/* ---- Buttons ---- */
.btn {
  min-height: 34px; border: 1px solid var(--line-strong); border-radius: 7px;
  background: var(--paper); color: var(--ink); padding: 7px 12px; font-weight: 650;
  cursor: pointer; display: inline-flex; align-items: center; gap: 7px; transition: .12s;
}
.btn:hover { border-color: var(--navy); }
.btn.primary { color: var(--inverse); background: var(--navy); border-color: var(--navy); }
.btn.primary:hover { background: var(--primary-hover); }
.btn.sm { min-height: 28px; padding: 5px 10px; font-size: 12px; }
.btn-icon { width: 18px; height: 18px; border: 1px solid currentColor; border-radius: 5px; display: grid; place-items: center; font-size: 11px; font-weight: 900; line-height: 1; }
.link { background: none; border: none; color: var(--blue); font-weight: 700; cursor: pointer; padding: 0; text-decoration: underline; }

/* ---- Panels (bands) ---- */
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 1px 1px rgba(20,30,40,.04); overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.panel-head h3 { font-size: 14px; font-weight: 800; }

/* ---- Dropzone (intake) ---- */
.dropzone { border: 1px dashed var(--drop-border); background: var(--drop-bg); border-radius: var(--radius); padding: 30px 28px; box-shadow: var(--shadow); }
.dropzone.drag { border-color: var(--green); background: var(--drop-drag-bg); }
.dz-inner { display: grid; grid-template-columns: minmax(0, 1fr) minmax(250px, 340px); gap: 28px; align-items: center; }
.dz-copy { min-width: 0; }
.dz-icon { width: 56px; height: 56px; border-radius: 10px; background: var(--paper); border: 1px solid var(--drop-icon-border); display: grid; place-items: center; color: var(--green); font-size: 28px; margin-bottom: 14px; }
.dz-inner h2 { max-width: 650px; font-size: 25px; font-weight: 850; line-height: 1.12; }
.dz-inner p { color: var(--muted); margin-top: 9px; max-width: 610px; }
.dz-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.dz-setup { border-left: 1px solid var(--line); padding-left: 24px; display: grid; gap: 16px; }
.setup-row { display: grid; gap: 3px; }
.setup-row span {
  color: var(--muted); text-transform: uppercase; letter-spacing: .45px;
  font-size: 10px; font-weight: 900;
}
.setup-row b { font-size: 16px; font-weight: 850; }
.setup-row em { color: var(--muted); font-style: normal; font-size: 12.5px; line-height: 1.35; }

/* ---- Intake: recent audits strip ---- */
.recent { display: grid; gap: 12px; }
.recent-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.recent-head h3 { font-size: 14px; font-weight: 800; }
.recent-head .muted { display: block; margin-top: 1px; }
.recent-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(228px, 1fr)); gap: 12px; }
.recent-card {
  font: inherit; text-align: left; cursor: pointer; display: grid; gap: 6px; align-content: start;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 1px 1px rgba(20,30,40,.04); padding: 12px 13px; min-height: 102px; color: var(--ink);
  transition: border-color .12s, box-shadow .12s, transform .12s;
}
.recent-card:hover { border-color: var(--navy); box-shadow: var(--shadow); transform: translateY(-1px); }
.recent-card:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.rc-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rc-when { color: var(--muted); font-size: 11px; font-weight: 700; }
.rc-title { font-weight: 800; font-size: 14px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rc-sub { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-height: 16px; }
.rc-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 2px; font-size: 12px; color: var(--muted); }
.rc-recon { font-weight: 700; }
.rc-recon.ok { color: var(--green); }
.rc-recon.bad { color: var(--red); }
.rc-status { font-weight: 850; }
.rc-status.ok { color: var(--green); }
.rc-status.review { color: var(--purple); }
.rc-status.money { color: var(--money); }
.rc-status.bad { color: var(--red); }

/* ---- Review page header / verdict ---- */
.review-masthead {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px 18px; display: flex; align-items: center;
  justify-content: space-between; gap: 18px; flex-wrap: wrap;
}
.section-kicker {
  color: var(--blue); text-transform: uppercase; letter-spacing: .5px;
  font-size: 11px; font-weight: 900; margin-bottom: 4px;
}
.review-masthead h1 {
  font-size: 26px; line-height: 1.08; font-weight: 900; letter-spacing: 0;
}
.review-masthead p {
  color: var(--muted); margin-top: 6px; max-width: 680px; font-size: 13px;
}
.review-status-pill {
  min-height: 36px; border-radius: 999px; padding: 8px 13px; display: inline-flex;
  align-items: center; background: var(--review-bg); border: 1px solid var(--review-border);
  color: var(--purple); font-size: 12px; font-weight: 850; white-space: nowrap;
}
.review-status-pill.ok { background: var(--ok-bg); border-color: var(--ok-border); color: var(--green); }
.review-status-pill.review { background: var(--review-bg); border-color: var(--review-border); color: var(--purple); }

/* ---- Scorebar / verdict ---- */
.scorebar {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px 18px;
}
/* ---- Masthead actions + export menu ---- */
.review-masthead .masthead-id { min-width: 0; }
.masthead-actions { display: flex; align-items: center; gap: 10px; flex: none; }
.export-menu { position: relative; }
.export-menu .caret { font-size: 10px; opacity: .9; }
.export-pop {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 210px;
  background: var(--paper); border: 1px solid var(--line-strong); border-radius: 9px;
  box-shadow: var(--shadow); padding: 6px; display: grid; gap: 2px;
}
.export-fmt {
  text-align: left; background: none; border: 0; border-radius: 6px; padding: 8px 10px;
  font-weight: 650; color: var(--ink); cursor: pointer;
}
.export-fmt:hover { background: var(--paper-2); }
.export-redact {
  display: flex; align-items: center; gap: 8px; margin-top: 4px; padding: 9px 10px;
  border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); cursor: pointer;
}
.report-btn { border-color: var(--warn-border); color: var(--amber); }
.report-btn:disabled { opacity: .72; cursor: not-allowed; }

/* ---- Result note (opportunities / failures summary under the verdict) ---- */
.result-note { flex-basis: 100%; font-size: 13px; font-weight: 650; color: var(--muted); }
.result-note.bad { color: var(--red); }
.result-note.opp { color: var(--money); }
.result-note.good { font-weight: 600; }
.verdict-card {
  flex: 1 1 230px; max-width: 330px; min-height: 104px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--verdict-bg); padding: 12px 14px;
  display: grid; align-content: center; gap: 5px; border-left: 5px solid var(--green);
}
.verdict-card.review { background: var(--review-bg); border-left-color: var(--purple); }
.verdict-card.bad { background: var(--bad-bg); border-left-color: var(--red); }
.verdict-card.money { background: var(--money-bg); border-left-color: var(--money); }
.verdict-label {
  color: var(--muted); text-transform: uppercase; letter-spacing: .45px;
  font-size: 10px; font-weight: 900;
}
.verdict-title { font-size: 18px; line-height: 1.15; font-weight: 850; color: var(--ink); }
.verdict-detail { color: var(--verdict-detail); font-size: 12.5px; line-height: 1.35; }
.batch-scorebar { align-items: stretch; }
.batch-scorebar .verdict-card { flex: 1 1 250px; max-width: 350px; }
.batch-head { flex: 0 1 170px; display: grid; align-content: center; gap: 4px; }
.batch-head h2 { font-size: 18px; font-weight: 820; }
.batch-head .muted { line-height: 1.35; }

/* ---- KPI tiles ---- */
.kpis { flex: 2 1 340px; display: grid; grid-template-columns: repeat(auto-fit, minmax(126px, 1fr)); gap: 10px; min-width: 260px; }
.kpi { min-width: 0; background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 11px 12px; overflow: hidden; }
.kpi .v { font-size: 22px; font-weight: 850; line-height: 1.05; }
.kpi.money .v { font-size: clamp(17px, 1.45vw, 20px); white-space: nowrap; }
.kpi .l { color: var(--muted); text-transform: uppercase; font-size: 10px; font-weight: 800; margin-top: 7px; letter-spacing: .4px; }
.kpi .v.ok { color: var(--green); } .kpi .v.bad { color: var(--red); } .kpi .v.opp { color: var(--money); }

.exports { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.exports > span { font-size: 12px; color: var(--muted); margin-right: 2px; }
.redact-opt { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }

/* ---- Results layout ---- */
.layout { display: grid; grid-template-columns: 1fr 372px; gap: 16px; align-items: start; }
.col-main { display: grid; gap: 16px; min-width: 0; }
.col-side { display: grid; gap: 16px; }

/* ---- Findings ---- */
.finding-tools { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.view-toggle {
  display: inline-flex; align-items: center; border: 1px solid var(--line-strong);
  border-radius: 7px; overflow: hidden; background: var(--paper);
}
.view-btn {
  min-width: 56px; min-height: 28px; border: 0; border-right: 1px solid var(--line);
  background: transparent; color: var(--muted); padding: 5px 10px; font-size: 12px;
  font-weight: 800; cursor: pointer;
}
.view-btn:last-child { border-right: 0; }
.view-btn:hover { background: var(--paper-2); color: var(--ink); }
.view-btn.active { background: var(--navy); color: var(--inverse); }
.filters { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 11px; font-weight: 800; border-radius: 999px; padding: 3px 10px; border: 1px solid var(--line-strong); background: var(--paper); color: var(--muted); cursor: pointer; }
.chip.active { color: var(--inverse); background: var(--navy); border-color: var(--navy); }
.chip[data-k="fail"].active { background: var(--red); border-color: var(--red); }
.chip[data-k="warn"].active { background: var(--amber); border-color: var(--amber); }
.chip[data-k="review"].active { background: var(--purple); border-color: var(--purple); }
.chip[data-k="pass"].active { background: var(--green); border-color: var(--green); }
.review-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 14px; background: var(--paper-2); border-bottom: 1px solid var(--line); }
#review-progress { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
#review-progress b { color: var(--ink); }
.rp-bar { display: inline-block; width: 120px; height: 7px; border-radius: 999px; background: var(--track-bg); overflow: hidden; }
.rp-bar span { display: block; height: 100%; background: var(--green); }
.hide-addr { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }

.show-passed {
  width: 100%; text-align: center; background: var(--paper-2); border: 0;
  border-top: 1px solid var(--line); padding: 11px; font-size: 12.5px; font-weight: 750;
  color: var(--blue); cursor: pointer;
}
.show-passed:hover { background: var(--tag-bg); color: var(--navy); }

.cat-group { border-bottom: 1px solid var(--line); }
.cat-title { padding: 9px 16px; background: var(--paper-2); font-weight: 800; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); display: flex; justify-content: space-between; }
.finding-empty { padding: 22px 16px; color: var(--muted); font-weight: 650; }
.finding { display: grid; grid-template-columns: 72px 1fr; gap: 12px; padding: 13px 16px; border-top: 1px solid var(--table-line); border-left: 4px solid transparent; }
.finding:first-of-type { border-top: none; }
.finding:has(.badge.fail) { border-left-color: var(--red); }
.finding:has(.badge.warn) { border-left-color: var(--amber); }
.finding:has(.badge.review) { border-left-color: var(--purple); }
.finding:has(.badge.pass) { border-left-color: var(--pass-accent); }
.finding:has(.badge.info) { border-left-color: var(--info-accent); }
.badge { align-self: start; font-size: 10px; font-weight: 800; border-radius: 999px; padding: 3px 0; text-align: center; letter-spacing: .4px; border: 1px solid transparent; }
.badge.pass { color: var(--green); background: var(--ok-bg); border-color: var(--ok-border); }
.badge.warn { color: var(--amber); background: var(--warn-bg); border-color: var(--warn-border); }
.badge.fail { color: var(--red); background: var(--bad-bg); border-color: var(--bad-border); }
.badge.review { color: var(--purple); background: var(--review-bg); border-color: var(--review-border); }
.badge.info { color: var(--blue); background: var(--info-bg); border-color: var(--info-border); }
.sev { font-size: 9px; color: var(--muted); text-transform: uppercase; margin-top: 5px; text-align: center; letter-spacing: .3px; }
.finding .title { font-weight: 750; }
.finding .detail { color: var(--detail); margin-top: 3px; }
.finding .evidence { color: var(--muted); font-size: 12px; margin-top: 5px; font-family: var(--mono); background: var(--paper-2); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; }
.finding .rec { color: var(--navy); font-size: 12.5px; margin-top: 5px; font-weight: 600; }
.finding .cite { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 5px; }
.cite-tag { font-size: 10px; font-weight: 800; color: var(--navy); background: var(--tag-bg); border: 1px solid var(--tag-border); border-radius: 5px; padding: 2px 7px; }
.disp-tag { margin-top: 6px; font-size: 9px; font-weight: 900; text-transform: uppercase; letter-spacing: .5px; text-align: center; border-radius: 5px; padding: 2px 0; color: var(--inverse); }
.disp-tag.done { background: var(--green); } .disp-tag.dismissed { background: var(--muted); }
.finding.addressed { opacity: .6; }
.finding.addressed .title { text-decoration: line-through; text-decoration-color: var(--addressed-line); }

.finding-review { display: flex; align-items: center; gap: 8px; margin-top: 9px; flex-wrap: wrap; }
.disp { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 7px; overflow: hidden; }
.disp .d { background: var(--paper); border: none; border-right: 1px solid var(--line); padding: 5px 11px; font-size: 12px; font-weight: 650; color: var(--muted); cursor: pointer; }
.disp .d:last-child { border-right: none; }
.disp .d:hover { background: var(--paper-2); }
.disp .d.on { color: var(--inverse); background: var(--navy); }
.disp .d.on.done { background: var(--green); }
.disp .d.on.dismiss { background: var(--muted); }
.finding-review .note { flex: 1; min-width: 170px; font-size: 12.5px; padding: 6px 9px; border: 1px solid var(--line-strong); border-radius: 7px; }
.finding-review .note:focus { outline: none; border-color: var(--navy); }
.hist { margin-top: 6px; font-size: 11px; color: var(--muted); cursor: help; }

.findings-board {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(216px, 1fr));
  gap: 12px; padding: 12px; background: var(--board-bg);
}
.finding-lane {
  min-width: 0; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--lane-bg); overflow: hidden; display: flex; flex-direction: column;
}
.finding-lane-head {
  min-height: 54px; padding: 10px 12px; background: var(--paper);
  border-bottom: 1px solid var(--line); display: flex; align-items: center;
  justify-content: space-between; gap: 10px;
}
.finding-lane-head h4 { margin: 0; font-size: 13px; font-weight: 850; }
.finding-lane-head span { color: var(--muted); font-size: 11px; font-weight: 800; }
.lane-count {
  min-width: 28px; height: 28px; border-radius: 999px; display: grid; place-items: center;
  color: var(--inverse) !important; font-size: 12px !important; font-weight: 900 !important; flex: none;
}
.lane-count.fail { background: var(--red); }
.lane-count.warn { background: var(--amber); }
.lane-count.review { background: var(--purple); }
.lane-count.info { background: var(--blue); }
.lane-count.pass { background: var(--green); }
.finding-lane-cards { display: grid; gap: 10px; padding: 10px; align-content: start; }
.finding-board-card {
  display: grid; grid-template-columns: 1fr; gap: 7px; border: 1px solid var(--line);
  border-left-width: 5px; border-radius: var(--radius); background: var(--paper);
  padding: 10px; box-shadow: 0 2px 8px rgba(20,30,40,.05);
}
.finding-board-card:first-of-type { border-top: 1px solid var(--line); }
.finding-board-card.fail { border-left-color: var(--red); }
.finding-board-card.warn { border-left-color: var(--amber); }
.finding-board-card.review { border-left-color: var(--purple); }
.finding-board-card.info { border-left-color: var(--blue); }
.finding-board-card.pass { border-left-color: var(--green); }
.finding-board-card .badge { justify-self: start; min-width: 64px; padding: 3px 9px; }
.board-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.board-card-sev { color: var(--muted); font-size: 10px; font-weight: 900; text-transform: uppercase; }
.board-card-meta { color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.finding-board-card .title { font-size: 13px; line-height: 1.3; }
.finding-board-card .detail { font-size: 12.5px; }
.finding-board-card .evidence { font-size: 11px; overflow-wrap: anywhere; }
.finding-board-card .disp { width: 100%; }
.finding-board-card .disp .d { flex: 1; padding-left: 6px; padding-right: 6px; }
.finding-board-card .finding-review .note { min-width: 0; flex-basis: 100%; }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
#line-items th, #line-items td, #totals th, #totals td,
#batch-table th, #batch-table td, #history-table th, #history-table td {
  padding: 8px 11px; text-align: left; border-bottom: 1px solid var(--table-line); white-space: nowrap;
}
thead th { background: var(--paper-2); font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); position: sticky; top: 0; }
.num, td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
#line-items tr.judgment td { background: var(--judgment-bg); }
.tag { font-size: 10px; font-weight: 800; padding: 1px 6px; border-radius: 5px; background: var(--tag-bg); color: var(--navy); }
#totals td { white-space: normal; }
#totals tr.ok td.s { color: var(--green); } #totals tr.bad td.s { color: var(--red); font-weight: 800; } #totals td.s { width: 20px; }

/* batch / history tables */
#batch-table tr.drill, #history-table tr.drill { cursor: pointer; }
#batch-table tr.drill:hover, #history-table tr.drill:hover { background: var(--drop-drag-bg); }
#batch-table tr.bad-row { background: var(--bad-bg); }
#batch-table td.batch-result-cell, #batch-table td.batch-vehicle,
#history-table td.history-result-cell, #history-table td.history-item { white-space: normal; }
.row-result { min-width: 170px; display: grid; gap: 2px; line-height: 1.25; }
.row-result b { font-size: 12.5px; }
.row-result span { color: var(--muted); font-size: 11.5px; }
.row-result.ok b { color: var(--green); }
.row-result.review b { color: var(--purple); }
.row-result.money b { color: var(--money); }
.row-result.bad b { color: var(--red); }
.history-item { display: grid; grid-template-columns: auto 1fr; gap: 3px 8px; align-items: center; min-width: 240px; }
.history-item b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-item > span:not(.tag) { grid-column: 2; color: var(--muted); font-size: 11.5px; }
.empty-state {
  text-align: center !important; white-space: normal !important; padding: 24px 16px !important;
}
.empty-state b { display: block; font-size: 14px; margin-bottom: 3px; }
.empty-state span { color: var(--muted); font-size: 12.5px; }
.pill { display: inline-block; min-width: 30px; text-align: center; border-radius: 999px; padding: 2px 9px; font-weight: 800; color: var(--inverse); font-size: 12px; }
.pill.g { background: var(--green); } .pill.y { background: var(--amber); } .pill.r { background: var(--red); }
.opp-n { display: inline-block; min-width: 18px; text-align: center; background: var(--money); color: var(--inverse); border-radius: 999px; padding: 0 7px; font-weight: 800; font-size: 12px; }
.x { color: var(--red); font-weight: 800; }

/* ---- Batch progress ---- */
.batch-progress { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; box-shadow: 0 1px 1px rgba(20,30,40,.04); }
.batch-progress-copy { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.batch-progress-track { height: 8px; border-radius: 999px; background: var(--track-bg); overflow: hidden; }
.batch-progress-bar, #batch-progress-bar { display: block; height: 100%; width: 0; background: var(--navy); transition: width .25s; }

/* ---- Estimate identity card ---- */
.ec-head { padding: 14px 16px; background: linear-gradient(135deg, var(--navy), var(--estimate-head-end)); color: var(--inverse); }
.ec-head h3 { font-size: 15px; font-weight: 820; }
.ec-head .veh { font-size: 12px; opacity: .9; margin-top: 2px; }
.ec-body { padding: 4px 16px 14px; }
.ec-row { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--table-line); font-size: 13px; }
.ec-row:last-child { border-bottom: none; }
.ec-row .k { color: var(--muted); } .ec-row .v { font-weight: 650; text-align: right; }
.ec-more summary { cursor: pointer; color: var(--blue); font-weight: 700; font-size: 12.5px; padding: 9px 0 3px; list-style: none; }
.ec-more summary::-webkit-details-marker { display: none; }
.ec-more[open] summary { color: var(--muted); }

/* ---- Totals: one line when clean, breakdown on demand / on a problem ---- */
.totals-table { width: 100%; }
.totals-line { padding: 11px 14px; font-size: 13px; font-weight: 750; display: flex; align-items: center; gap: 8px; }
.totals-line.ok { color: var(--green); }
.totals-line.bad { color: var(--red); }
.totals-line .ic { font-weight: 800; }
.totals-more summary { cursor: pointer; color: var(--blue); font-weight: 700; font-size: 12.5px; padding: 9px 14px; list-style: none; border-top: 1px solid var(--line); }
.totals-more summary::-webkit-details-marker { display: none; }

/* ---- Toast + overlay ---- */
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--toast-bg); color: var(--inverse); padding: 10px 18px; border-radius: 8px; box-shadow: var(--shadow); z-index: 50; }
.toast.bad { background: var(--red); }
.overlay { position: fixed; inset: 0; background: var(--overlay-bg); display: grid; place-items: center; gap: 14px; grid-auto-flow: row; z-index: 40; color: var(--muted); font-weight: 700; }
.spinner { width: 40px; height: 40px; border: 4px solid var(--spinner-track); border-top-color: var(--navy); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Support report consent ---- */
.report-modal {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center;
  padding: 20px; background: var(--overlay-bg);
}
.report-card {
  width: min(100%, 460px); background: var(--paper); border: 1px solid var(--bad-border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px;
  display: grid; gap: 13px;
}
.report-warning {
  justify-self: start; border-radius: 6px; padding: 3px 8px; background: var(--bad-bg);
  color: var(--red); border: 1px solid var(--bad-border); font-size: 11px;
  font-weight: 900; text-transform: uppercase; letter-spacing: .4px;
}
.report-card h3 { font-size: 20px; line-height: 1.15; font-weight: 850; }
.report-card p { color: var(--detail); }
.report-consent {
  display: flex; align-items: flex-start; gap: 9px; padding: 10px;
  border: 1px solid var(--bad-border); border-radius: var(--radius);
  background: var(--bad-bg); color: var(--ink); font-weight: 700;
}
.report-consent input { margin-top: 2px; accent-color: var(--red); }
.report-field { display: grid; gap: 5px; color: var(--muted); font-size: 12px; font-weight: 800; }
.report-field textarea, .report-field input {
  width: 100%; border: 1px solid var(--line-strong); border-radius: 7px;
  background: var(--paper); color: var(--ink); padding: 8px 10px; resize: vertical;
}
.report-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }

/* ---- Responsive ---- */
@media (max-width: 1040px) { .layout { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px; }
  .rail-nav { grid-auto-flow: column; }
  .rail-foot { display: none; }
  .dz-inner { grid-template-columns: 1fr; }
  .dz-setup { border-left: 0; border-top: 1px solid var(--line); padding: 18px 0 0; }
}
