:root {
    --bg: #f4f6f9; --card: #fff; --ink: #1d2433; --muted: #6b7385; --line: #dde2ea;
    --brand: #1f4e8c; --good: #1e8e3e; --mid: #d97a00; --bad: #c8102e; --none: #b3001b;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--brand); }
h1 { font-size: 1.6rem; margin: .2rem 0 1rem; } h1.inline { margin: 0; font-size: 1.35rem; }
h2 { font-size: 1.15rem; margin: 0 0 .6rem; } h3 { font-size: 1rem; margin: 1rem 0 .3rem; }
.muted { color: var(--muted); } .small { font-size: .85rem; }

.topbar { display: flex; justify-content: space-between; align-items: center; padding: .6rem 1.2rem; background: var(--ink); color: #fff; }
.topbar a, .topbar .link { color: #cfd6e4; text-decoration: none; margin-left: 1rem; background: none; border: 0; font: inherit; cursor: pointer; }
.topbar a.on, .topbar a:hover, .topbar .link:hover { color: #fff; }
.topbar .brand { color: #fff; font-weight: 700; margin: 0; }
.topbar nav { display: flex; align-items: center; } .topbar form { display: inline; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 1.2rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 1.1rem; margin-bottom: 1rem; }
.narrow { max-width: 460px; }
.stack { display: flex; flex-direction: column; gap: .7rem; }
.row { display: flex; align-items: center; } .gap { gap: .6rem; } .between { justify-content: space-between; } .wrap-row { flex-wrap: wrap; gap: .6rem; margin-bottom: .8rem; }
.row.gap > label { flex: 1; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; }
@media (max-width: 860px) { .grid2 { grid-template-columns: 1fr; } }

label { display: flex; flex-direction: column; gap: .25rem; font-weight: 600; font-size: .9rem; }
label.inline { flex-direction: row; align-items: center; gap: .5rem; }
label.check { flex-direction: row; align-items: center; gap: .5rem; font-weight: 400; }
input, select { font: inherit; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 6px; background: #fff; width: 100%; }
input[type=checkbox] { width: auto; }
.row > input { flex: 1; }

.btn { display: inline-block; padding: .5rem .9rem; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); text-decoration: none; font: inherit; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.danger { color: var(--bad); }
.btn.small { padding: .25rem .55rem; font-size: .85rem; }

.flash { padding: .7rem 1rem; border-radius: 8px; margin-bottom: 1rem; }
.flash.ok { background: #e6f4ea; color: #145c2b; } .flash.err { background: #fde8eb; color: #8a0c20; }

.table { width: 100%; border-collapse: collapse; background: var(--card); margin-bottom: 1rem; }
.table th, .table td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.table .actions { display: flex; gap: .35rem; flex-wrap: wrap; } .table .actions form { display: inline; }
tr.dim td { opacity: .55; }
.pill { display: inline-block; font-size: .72rem; padding: .05rem .45rem; border-radius: 99px; background: #e8ebf1; color: var(--muted); font-weight: 600; vertical-align: middle; }
.pill.green { background: #e6f4ea; color: var(--good); } .pill.red { background: #fde8eb; color: var(--bad); }

/* Grid report */
.timeline { display: flex; justify-content: space-between; position: relative; margin: 1rem 0 1.4rem; padding-top: 8px; overflow-x: auto; }
.timeline::before { content: ""; position: absolute; top: 15px; left: 0; right: 0; height: 2px; background: #8a8f99; }
.tick { position: relative; display: flex; flex-direction: column; align-items: center; min-width: 70px; text-decoration: none; color: var(--ink); font-size: .85rem; text-align: center; }
.tick .dot { width: 16px; height: 16px; border-radius: 50%; background: var(--bad); border: 2px solid var(--bad); margin-bottom: .35rem; z-index: 1; }
.tick.on .dot { width: 22px; height: 22px; margin-top: -3px; background: #fff; border: 6px solid var(--bad); }
.tick.pending .dot { background: #c3c8d1; border-color: #c3c8d1; }
.tiles { margin-bottom: 1rem; }
.tile { width: 190px; height: 110px; border-radius: 6px; display: flex; flex-direction: column; justify-content: center; align-items: center; color: #fff; }
.tile strong { font-size: 2.2rem; line-height: 1.1; } .tile span { font-weight: 600; }
.tile.good { background: var(--good); } .tile.mid { background: var(--mid); } .tile.bad, .tile.none { background: var(--bad); }
.tile.outline { background: #fff; color: var(--ink); border: 2px solid var(--ink); }
.map { height: 620px; border-radius: 8px; border: 1px solid var(--line); }
.small-map { height: 300px; }
.pt span { display: flex; width: 34px; height: 34px; border-radius: 50%; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: .85rem; box-shadow: 0 1px 3px rgba(0,0,0,.35); }
.pt-good span { background: var(--good); } .pt-mid span { background: var(--mid); } .pt-bad span { background: var(--bad); } .pt-none span { background: var(--none); } .pt-wait span { background: #9aa1ad; }
.center-pin span { display: block; width: 18px; height: 18px; border-radius: 50%; background: #2d3a8c; border: 3px solid #fff; box-shadow: 0 0 0 2px #2d3a8c; }
.popup-list { margin: .4rem 0 0; padding-left: 0; list-style: none; }
.popup-list li { margin: .15rem 0; }
@media (max-width: 600px) { .tile { width: 100%; } .tiles { flex-direction: column; } .map { height: 420px; } }

/* Logo + results tables */
.biz-head { display: flex; align-items: center; gap: .8rem; margin-bottom: .9rem; }
.biz-logo { max-width: 400px; max-height: 140px; width: auto; object-fit: contain; }
@media (max-width: 600px) { .biz-logo { max-width: 100%; } }
.biz-name { font-weight: 700; font-size: 1.1rem; }
.logo-preview { max-height: 60px; max-width: 180px; object-fit: contain; border: 1px solid var(--line); border-radius: 6px; padding: 4px; background: #fff; }
.pt-selected span { outline: 3px solid #111; outline-offset: 2px; }
.results { margin-top: 1rem; }
.table.small th, .table.small td { padding: .35rem .45rem; font-size: .85rem; }
tr.is-client td { background: #eef3fb; font-weight: 700; }
tr.gap-row td { text-align: center; color: var(--muted); padding: .1rem; }

/* Charts (palette slots 1-4: blue, orange, aqua, yellow — validated for CVD; aqua/yellow
   are under 3:1 on white, so every series also carries a direct label) */
.chart { margin: 0 0 .5rem; --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; }
.chart figcaption { font-weight: 700; font-size: .95rem; margin-bottom: .4rem; }
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart .grid-line { stroke: #e6e9ef; stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 10px; }
.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { stroke: #fff; stroke-width: 2; }
.chart .series-label { font-size: 10px; font-weight: 700; fill: var(--ink); }
.chart .line.s1, .chart .dot.s1 { stroke: var(--s1); } .chart .dot.s1 { fill: var(--s1); }
.chart .line.s2, .chart .dot.s2 { stroke: var(--s2); } .chart .dot.s2 { fill: var(--s2); }
.chart .line.s3, .chart .dot.s3 { stroke: var(--s3); } .chart .dot.s3 { fill: var(--s3); }
.chart .line.s4, .chart .dot.s4 { stroke: var(--s4); } .chart .dot.s4 { fill: var(--s4); }
.chart .legend { display: flex; flex-wrap: wrap; gap: .8rem; list-style: none; padding: 0; margin: .4rem 0 0; font-size: .82rem; }
.chart .legend li { display: flex; align-items: center; gap: .35rem; }
.chart .swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.chart .swatch.s1 { background: var(--s1); } .chart .swatch.s2 { background: var(--s2); }
.chart .swatch.s3 { background: var(--s3); } .chart .swatch.s4 { background: var(--s4); }
