:root {
  --bg: #f4f6f9; --panel: #fff; --text: #111827; --muted: #6b7280; --line: #e5e7eb;
  --accent: #2563eb; --accent-dark: #1d4ed8; --bad: #dc2626; --ok: #16a34a; --warn: #d97706;
  --radius: 10px; --shadow: 0 1px 2px rgba(0,0,0,.05), 0 1px 3px rgba(0,0,0,.06);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; margin: 4px 0; }
h3 { font-size: 14px; margin: 0 0 10px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
h4 { margin: 12px 0 6px; font-size: 13px; }
code { background: #eef2f7; padding: 1px 5px; border-radius: 4px; }
.muted { color: var(--muted); } .small { font-size: 12px; } .strong { font-weight: 600; color: var(--text); }
.bad { color: var(--bad); } .num { text-align: right; white-space: nowrap; }

.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 24px; padding: 0 20px;
  height: 52px; background: #0f172a; color: #fff; }
.topbar .brand { color: #fff; font-weight: 700; font-size: 17px; }
.topbar nav { display: flex; gap: 4px; flex: 1; }
.topbar nav a { color: #cbd5e1; padding: 8px 12px; border-radius: 8px; }
.topbar nav a.active, .topbar nav a:hover { background: #1e293b; color: #fff; text-decoration: none; }
.topbar .who { display: flex; align-items: center; gap: 12px; color: #cbd5e1; }
.topbar .who form { margin: 0; }
button.link { background: none; border: 0; color: #93c5fd; cursor: pointer; font: inherit; padding: 0; }

.page { max-width: 1440px; margin: 0 auto; padding: 18px 20px 40px; }
.page.wide { max-width: none; }

button, .button { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 8px;
  border: 1px solid var(--line); background: #fff; color: var(--text); font: inherit; cursor: pointer; white-space: nowrap; }
.button:hover { text-decoration: none; background: #f9fafb; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.primary:hover { background: var(--accent-dark); }
button:disabled { opacity: .45; cursor: not-allowed; }
.button.small, button.small { height: 28px; padding: 0 10px; font-size: 12px; }
.wide { width: 100%; justify-content: center; }
input, select, textarea { font: inherit; height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--text); min-width: 0; }
textarea { height: auto; padding: 8px 10px; resize: vertical; }
input[type=checkbox] { height: auto; }
input:focus, select:focus, textarea:focus { outline: 2px solid #bfdbfe; border-color: var(--accent); }

.login-page { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.login-card { width: 100%; max-width: 360px; background: var(--panel); padding: 28px; border-radius: 14px; box-shadow: var(--shadow);
  display: grid; gap: 14px; }
.login-card label { display: grid; gap: 6px; font-weight: 600; }
.alert { background: #fef2f2; color: var(--bad); border: 1px solid #fecaca; padding: 8px 12px; border-radius: 8px; }
.toast { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; padding: 8px 12px; border-radius: 8px; margin-bottom: 12px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi { display: grid; gap: 2px; background: var(--panel); padding: 14px 16px; border-radius: var(--radius); box-shadow: var(--shadow);
  color: var(--text); }
a.kpi:hover { text-decoration: none; outline: 2px solid #dbeafe; }
.kpi-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
.kpi-value { font-size: 28px; font-weight: 700; } .kpi-value small { font-size: 16px; color: var(--muted); }
.kpi-sub { color: var(--muted); font-size: 12px; } .kpi-sub.bad { color: var(--bad); font-weight: 600; }
.bar { height: 6px; background: #e5e7eb; border-radius: 3px; overflow: hidden; margin: 4px 0; }
.bar span { display: block; height: 100%; background: var(--ok); }

.panels { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.panel { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; margin-bottom: 12px; }
.panels .panel { margin: 0; }
.panel.empty { text-align: center; padding: 40px; color: var(--muted); }
.funnel-row { display: grid; grid-template-columns: 130px 1fr 40px; align-items: center; gap: 8px; padding: 3px 0; color: var(--text); }
.funnel-bar { height: 10px; background: #f1f5f9; border-radius: 5px; overflow: hidden; }
.funnel-bar span { display: block; height: 100%; min-width: 2px; }
.funnel-n { text-align: right; font-weight: 600; }
.sig-row, .src-row { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; border-bottom: 1px dashed var(--line); color: var(--text); }
.src-row span:first-child { flex: 1; }
.new { color: var(--ok); }

.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: var(--panel); padding: 12px;
  border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 10px; }
.filters input[type=search] { flex: 1 1 260px; }
.filters .short { width: 70px; } .filters .mid { width: 140px; }
.inline { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
details.multi { position: relative; }
details.multi summary { list-style: none; height: 34px; display: flex; align-items: center; padding: 0 12px; border: 1px solid var(--line);
  border-radius: 8px; cursor: pointer; background: #fff; }
details.multi .menu { position: absolute; top: 38px; left: 0; z-index: 20; display: grid; gap: 6px; min-width: 230px;
  background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; box-shadow: 0 8px 24px rgba(0,0,0,.12); }
details.multi .menu label { display: flex; gap: 8px; align-items: center; }

.table-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 6px 0; flex-wrap: wrap; }
.bulk-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.table-wrap { overflow-x: auto; background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); }
table.leads { width: 100%; border-collapse: collapse; }
table.leads th { position: sticky; top: 0; background: #f8fafc; text-align: left; font-size: 12px; color: var(--muted);
  font-weight: 600; padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.leads td { padding: 9px 10px; border-bottom: 1px solid #f1f5f9; vertical-align: top; }
table.leads tr:hover td { background: #f8fafc; }
tr.overdue td { background: #fff7f7; }
td.empty { text-align: center; color: var(--muted); padding: 30px; }
.chips { max-width: 280px; }
.chip { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 10px; background: #eef2f7; margin: 1px 2px 1px 0; white-space: nowrap; }
.c-foreclosure, .c-demolition_review { background: #fee2e2; color: #991b1b; }
.c-tax_delinquent { background: #fef3c7; color: #92400e; }
.c-tax_cert_sold { background: #ffedd5; color: #9a3412; }
.c-vacant_survey { background: #e0e7ff; color: #3730a3; }
.c-code_violations { background: #fce7f3; color: #9d174d; }
.score { display: inline-block; min-width: 36px; text-align: center; font-weight: 700; padding: 2px 6px; border-radius: 6px; background: #e5e7eb; }
.score.s2 { background: #fef3c7; } .score.s3 { background: #fed7aa; } .score.s4 { background: #fca5a5; } .score.s5 { background: #ef4444; color: #fff; }
.score.big { font-size: 26px; padding: 6px 14px; }
.stage { display: inline-block; color: #fff; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 10px; white-space: nowrap; }
.pill { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 10px; background: #e5e7eb; }
.pill.ok { background: #dcfce7; color: #166534; } .pill.bad { background: #fee2e2; color: #991b1b; } .pill.new { background: #dcfce7; color: #166534; }
.phone { font-variant-numeric: tabular-nums; font-weight: 600; }
.match { display: inline-block; font-size: 10px; padding: 0 6px; border-radius: 8px; margin-left: 4px; vertical-align: middle; }
.m-match { background: #dcfce7; color: #166534; } .m-partial { background: #fef9c3; color: #854d0e; }
.m-no_match { background: #fee2e2; color: #991b1b; } .m-unknown { background: #f1f5f9; color: #475569; }
.pager { display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 14px; }

.lead-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.lead-score { display: flex; align-items: center; gap: 12px; } .lead-score form { margin: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
dl.facts { display: grid; grid-template-columns: 170px 1fr; gap: 6px 12px; margin: 0; }
dl.facts dt { color: var(--muted); } dl.facts dd { margin: 0; }
.contact { border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-bottom: 8px; }
.contact-match { border-color: #86efac; background: #f0fdf4; }
.contact-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
ul.phones { list-style: none; padding: 0; margin: 6px 0; display: grid; gap: 3px; }
ul.phones li.blocked { color: var(--muted); }
.crm-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.crm-form label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.crm-form .span2 { grid-column: span 2; }
ul.timeline { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; max-height: 420px; overflow-y: auto; }
ul.timeline li { border-left: 3px solid #dbeafe; padding-left: 10px; }
.signal { padding: 8px 0; border-bottom: 1px dashed var(--line); } .signal.closed { opacity: .55; }
table.mini { width: 100%; } table.mini td { padding: 3px 0; }

.crm-toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.tabs, .layout-switch { display: flex; gap: 4px; background: #e2e8f0; padding: 3px; border-radius: 9px; }
.tabs a, .layout-switch a { padding: 6px 12px; border-radius: 7px; color: var(--text); }
.tabs a.active, .layout-switch a.active { background: #fff; box-shadow: var(--shadow); text-decoration: none; }
.inline-form { display: flex; gap: 8px; align-items: center; }
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 10px; }
.column { background: #eef2f7; border-radius: var(--radius); padding: 8px; min-height: 120px; display: grid; gap: 8px; align-content: start; }
.column-head { font-weight: 700; border-top: 4px solid; padding: 6px 4px 2px; display: flex; justify-content: space-between; }
.card { background: #fff; border-radius: 8px; padding: 10px; box-shadow: var(--shadow); display: grid; gap: 4px; }
.card.overdue { border-left: 4px solid var(--bad); } .card.stale { opacity: .9; }
.card-foot { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.card-foot .move { margin-left: auto; } .card-foot select { height: 28px; font-size: 12px; padding: 0 6px; }

.lang-switch { display: inline-flex; gap: 2px; background: #1e293b; border-radius: 7px; padding: 2px; }
.lang-switch a { color: #94a3b8; padding: 2px 8px; border-radius: 5px; font-size: 12px; font-weight: 600; }
.lang-switch a.active { background: #334155; color: #fff; text-decoration: none; }
.login-top { display: flex; justify-content: space-between; align-items: center; }
.login-page .lang-switch { background: #e2e8f0; } .login-page .lang-switch a { color: var(--muted); }
.login-page .lang-switch a.active { background: #fff; color: var(--text); }
.panel-title { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.panel-title h3 { margin: 0; } .panel-title form { margin: 0; }
table.prices td { padding: 6px 0; border-bottom: 1px dashed var(--line); vertical-align: top; }
table.prices tr.total td { border-bottom: 0; padding-top: 10px; }
.row-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; } .row-actions form { margin: 0; }
.confirm { max-width: 980px; } .confirm form { margin-top: 12px; } .confirm .switch { margin-top: 10px; }
pre.log, pre.result { background: #0f172a; color: #e2e8f0; padding: 12px; border-radius: 8px; overflow: auto;
  max-height: 520px; font-size: 12px; white-space: pre-wrap; }

@media (max-width: 1100px) { .panels { grid-template-columns: 1fr; } .grid2 { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
  .page { padding: 12px; } .topbar { gap: 10px; padding: 0 12px; } .topbar .who span { display: none; }
  .kpi-value { font-size: 22px; } dl.facts { grid-template-columns: 1fr; } .crm-form { grid-template-columns: 1fr; }
  .crm-form .span2 { grid-column: auto; } .filters > * { flex: 1 1 100%; }
}

/* ---- auctions ---- */
.src-strip { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.src-chip { background: #fff; border: 1px solid #e2e8f0; border-left: 4px solid #16a34a; border-radius: 8px; padding: 4px 10px; font-size: 13px; color: var(--text); }
.src-chip.bad { border-left-color: #dc2626; }
.round { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #e2e8f0; color: #334155; white-space: nowrap; }
.round.r-first { background: #dbeafe; color: #1e40af; }
.round.r-second { background: #fde68a; color: #92400e; }
.round.r-subsequent { background: #fecaca; color: #991b1b; }
.round.r-unknown { background: #f1f5f9; color: #64748b; border: 1px dashed #94a3b8; }
.pill.o-sold { background: #dcfce7; color: #166534; } .pill.o-unsold { background: #fef3c7; color: #92400e; }
.pill.o-canceled, .pill.o-withdrawn, .pill.o-bankruptcy { background: #fee2e2; color: #991b1b; }
.pill.o-rescheduled, .pill.o-postponed, .pill.o-awaiting { background: #ede9fe; color: #5b21b6; }
.pill.o-scheduled { background: #e0f2fe; color: #075985; }
.pill.f-verified_risk { background: #fee2e2; color: #991b1b; } .pill.f-potential_risk { background: #fef3c7; color: #92400e; }
.pill.f-no_issue_found { background: #dcfce7; color: #166534; } .pill.f-not_checked { background: #f1f5f9; color: #475569; }
.pill.e-completed { background: #dcfce7; color: #166534; } .pill.e-failed, .pill.e-not_configured { background: #fee2e2; color: #991b1b; }
.pill.e-manual, .pill.e-partial, .pill.e-not_available, .pill.e-skipped { background: #fef3c7; color: #92400e; }
table.auctions tr.hot td { background: #f0fdf4; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.bigbid { display: flex; flex-direction: column; align-items: flex-end; } .bigbid b { font-size: 26px; }
.calc-result { border: 1px solid #e2e8f0; border-radius: 10px; padding: 10px 12px; margin-top: 10px; }
.calc-result.chosen { border-color: #2563eb; box-shadow: 0 0 0 2px #dbeafe; }
.calc-result .bids { display: flex; gap: 18px; margin: 6px 0; } .calc-result .bids div { display: flex; flex-direction: column; } .calc-result .bids b { font-size: 20px; }
.blocked { background: #fee2e2; color: #991b1b; font-weight: 700; padding: 10px; border-radius: 8px; }
.blocked ul { font-weight: 400; margin: 6px 0 0; }
.calc-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.calc-grid .span2 { grid-column: 1 / -1; }
.cite { color: #64748b; font-size: 11px; }
.links { columns: 2; padding-left: 18px; }
.bad { color: #b91c1c; }
@media (max-width: 760px) { .calc-grid { grid-template-columns: 1fr 1fr; } .links { columns: 1; } }

/* auctions: freshness and coverage */
.warn-banner { background: #fef3c7; border: 1px solid #f59e0b; color: #78350f; padding: 10px 14px; border-radius: 10px; margin: 0 0 12px; }
.warn-banner.soft { background: #f1f5f9; border-color: #94a3b8; color: #334155; }
.src-chip.fc-fresh { border-left-color: #16a34a; } .src-chip.fc-aging { border-left-color: #f59e0b; }
.src-chip.fc-stale, .src-chip.fc-never { border-left-color: #dc2626; }
.fresh { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.fresh.f-fresh { background: #dcfce7; color: #166534; } .fresh.f-aging { background: #fef3c7; color: #92400e; }
.fresh.f-stale, .fresh.f-never { background: #fee2e2; color: #991b1b; }
.cov { display: inline-block; padding: 1px 6px; border-radius: 6px; font-size: 12px; margin: 1px 0; }
.cov.c-missing { background: #fee2e2; color: #991b1b; } .cov.c-results_pending { background: #ede9fe; color: #5b21b6; }
.cov.c-never_captured { background: #f1f5f9; color: #475569; border: 1px dashed #94a3b8; }
.ok-text { color: #166534; }
.mode { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.mode.m-automated { background: #dcfce7; color: #166534; } .mode.m-manual { background: #fef3c7; color: #92400e; }
.mode.m-unavailable { background: #fee2e2; color: #991b1b; } .mode.m-imported { background: #e0f2fe; color: #075985; }
/* auctions: range filters, map */
.range { display: inline-flex; align-items: center; gap: 4px; }
.range .short, .grid-ranges .short { width: 78px; }
.menu.wide { min-width: 520px; }
.grid-ranges { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; margin-bottom: 8px; }
.grid-ranges label { display: flex; flex-direction: column; font-size: 13px; }
iframe.map { width: 100%; height: 320px; border: 0; border-radius: 10px; }
@media (max-width: 760px) { .menu.wide { min-width: 0; } .grid-ranges { grid-template-columns: 1fr; } }
/* ---- data quality / scoring V2 ---- */
.dq td, .dq th { vertical-align: top; }
.st { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 6px; white-space: nowrap; text-decoration: none; }
.st-PASS { background: #dcfce7; color: #166534; } .st-WARNING { background: #fef3c7; color: #92400e; }
.st-FAILED { background: #fee2e2; color: #991b1b; } .st-NOT_CHECKED { background: #e2e8f0; color: #475569; }
.st-NOT_APPLICABLE { background: #f1f5f9; color: #94a3b8; }
.tier { display: inline-block; font-size: 10px; font-weight: 700; padding: 0 6px; border-radius: 6px; background: #e2e8f0; color: #334155; }
.tier-HIGH { background: #fee2e2; color: #991b1b; } .tier-MEDIUM { background: #ffedd5; color: #9a3412; }
.tier-LOW { background: #fef9c3; color: #854d0e; } .tier-MINIMAL { background: #f1f5f9; color: #64748b; }
.tier-NOT_ELIGIBLE { background: #f1f5f9; color: #94a3b8; text-decoration: line-through; }
.sev { display: inline-block; font-size: 11px; font-weight: 700; padding: 0 6px; border-radius: 6px; }
.sev-P0 { background: #7f1d1d; color: #fff; } .sev-P1 { background: #fee2e2; color: #991b1b; }
.sev-P2 { background: #fef3c7; color: #92400e; } .sev-P3 { background: #e2e8f0; color: #475569; }
.ds { font-size: 11px; font-weight: 600; padding: 0 6px; border-radius: 6px; background: #e2e8f0; }
.ds-VERIFIED { background: #dcfce7; color: #166534; } .ds-SOURCE_REPORTED { background: #e0f2fe; color: #075985; }
.ds-DERIVED { background: #ede9fe; color: #5b21b6; } .ds-UNVERIFIED { background: #f1f5f9; color: #64748b; }
.ds-CONFLICTED, .ds-INVALID { background: #fee2e2; color: #991b1b; } .ds-STALE { background: #fef3c7; color: #92400e; }
.ev { font-size: 10px; padding: 0 5px; border-radius: 5px; background: #f1f5f9; }
.ev-positive { background: #fee2e2; color: #991b1b; } .ev-negative { background: #dcfce7; color: #166534; }
.ev-unknown, .ev-not_observed { background: #f1f5f9; color: #64748b; font-style: italic; }
.scores3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 10px; }
.s3 { display: flex; flex-direction: column; gap: 2px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
.s3 b { font-size: 28px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.mini { width: 100%; font-size: 12px; border-collapse: collapse; } .mini td { padding: 2px 4px; border-bottom: 1px dashed var(--line); }
.review-form { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; } .review-form select, .review-form input { height: 28px; font-size: 12px; }
.v2badge { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line); border-radius: 8px; padding: 2px 8px; }
.raw { max-width: 640px; word-break: break-word; }
.f-fresh { background: #dcfce7; color: #166534; } .f-aging { background: #fef3c7; color: #92400e; }
.f-stale { background: #fee2e2; color: #991b1b; } .f-unknown { background: #e2e8f0; color: #475569; }
@media (max-width: 900px) { .scores3, .grid3 { grid-template-columns: 1fr; } }.ev-conflicting { background: #fef3c7; color: #92400e; font-weight: 700; }

/* ---- smart qualification ---- */
.qt { display: inline-block; min-width: 26px; text-align: center; font-weight: 800; padding: 1px 6px; border-radius: 6px; background: #e2e8f0; color: #334155; }
.qt-A { background: #b91c1c; color: #fff; } .qt-B { background: #f97316; color: #fff; } .qt-C { background: #fde68a; color: #78350f; }
.qt-D { background: #e2e8f0; color: #475569; } .qt-BLOCKED { background: #1e293b; color: #fff; } .qt-X { background: #f1f5f9; color: #94a3b8; text-decoration: line-through; }
.fin { font-size: 11px; font-weight: 600; padding: 0 5px; border-radius: 5px; background: #f1f5f9; color: #475569; }
.fin-PRELIMINARY_POTENTIAL { background: #fef3c7; color: #92400e; } .fin-CONFLICTED_FINANCIAL_EVIDENCE { background: #fee2e2; color: #991b1b; }
.fin-FINANCIALLY_PROMISING { background: #dcfce7; color: #166534; } .fin-FINANCIALLY_UNATTRACTIVE { background: #fee2e2; color: #991b1b; }