:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --surface-2: #f0efec;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --hairline: #e1e0d9;
  --border: rgba(11, 11, 11, 0.10);
  --accent: #2a78d6;      /* series-1 blue: single-series bars, primary buttons */
  --accent-ink: #ffffff;
  --comp: #eb6834;        /* categorical slot 2: competitors */
  --anch: #1baf7a;        /* categorical slot 3: anchors */
  --good: #0ca30c;
  --critical: #d03b3b;
  --seq-100: #cde2fb; --seq-200: #9ec5f4; --seq-300: #6da7ec; --seq-400: #3987e5; --seq-500: #256abf; --seq-600: #1c5cab; --seq-700: #0d366b;
  --radius: 8px;
  --panel-w: 390px;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0d0d0d; --surface: #1a1a19; --surface-2: #262625; --ink: #ffffff; --ink-2: #c3c2b7; --muted: #898781;
    --hairline: #2c2c2a; --border: rgba(255, 255, 255, 0.10);
    --accent: #3987e5; --comp: #d95926; --anch: #199e70;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d; --surface: #1a1a19; --surface-2: #262625; --ink: #ffffff; --ink-2: #c3c2b7; --muted: #898781;
  --hairline: #2c2c2a; --border: rgba(255, 255, 255, 0.10);
  --accent: #3987e5; --comp: #d95926; --anch: #199e70;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--page); color: var(--ink); }
#app { display: flex; height: 100vh; width: 100vw; overflow: hidden; }
#panel { width: var(--panel-w); flex: 0 0 var(--panel-w); background: var(--surface); border-right: 1px solid var(--hairline); display: flex; flex-direction: column; overflow: hidden; }
#map-wrap { flex: 1; position: relative; min-width: 0; }
#map { position: absolute; inset: 0; }

.brand { padding: 14px 16px 8px; border-bottom: 1px solid var(--hairline); }
.brand-row { display: flex; align-items: center; gap: 10px; }
.brand-mark { border-radius: 6px; flex: 0 0 26px; }
.brand h1 { font-size: 20px; margin: 0; letter-spacing: -0.01em; }
.brand .tag { color: var(--muted); font-size: 12px; }
.note { margin-top: 8px; font-size: 12px; color: var(--ink-2); background: var(--surface-2); border-radius: 6px; padding: 6px 8px; }

.tabs { display: flex; border-bottom: 1px solid var(--hairline); }
.tabs button { flex: 1; background: none; border: 0; padding: 10px 0; font: inherit; font-size: 13px; color: var(--ink-2); cursor: pointer; border-bottom: 2px solid transparent; }
.tabs button.active { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }

.tab { display: none; padding: 14px 16px 24px; overflow-y: auto; flex: 1; }
.tab.active { display: block; }
.hidden { display: none !important; }

h2 { font-size: 16px; margin: 0 0 4px; }
h3 { font-size: 13px; margin: 18px 0 8px; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
h3 .link { margin-left: 6px; text-transform: none; letter-spacing: 0; font-weight: 400; }
.help { color: var(--muted); font-size: 12px; margin: 6px 0 0; line-height: 1.4; }
.empty { color: var(--muted); font-size: 13px; padding: 10px 0; }

.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 12px; font-weight: 600; color: var(--ink-2); margin-bottom: 5px; }
input[type=text], input[type=search], input[type=number], select {
  width: 100%; font: inherit; font-size: 13px; padding: 7px 9px; border: 1px solid var(--hairline); border-radius: 6px; background: var(--surface); color: var(--ink);
}
input[type=number] { width: 70px; }
.row { display: flex; align-items: center; gap: 10px; margin: 6px 0; flex-wrap: wrap; }
label.inline { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); }
.search-row { display: flex; gap: 6px; }
.search-row input { flex: 1; }

.segmented { display: flex; margin-bottom: 8px; border: 1px solid var(--hairline); border-radius: 6px; overflow: hidden; }
.segmented button { flex: 1; border: 0; background: var(--surface); font: inherit; font-size: 12px; padding: 6px; color: var(--ink-2); cursor: pointer; }
.segmented button.active { background: var(--accent); color: var(--accent-ink); }

.results { list-style: none; margin: 6px 0 0; padding: 0; border: 1px solid var(--hairline); border-radius: 6px; max-height: 220px; overflow-y: auto; }
.results li { padding: 7px 9px; font-size: 12px; cursor: pointer; border-bottom: 1px solid var(--hairline); line-height: 1.35; }
.results li:last-child { border-bottom: 0; }
.results li:hover { background: var(--surface-2); }
.results li .meta { color: var(--muted); display: block; }

.btn-primary, .btn-secondary { font: inherit; font-size: 13px; padding: 8px 14px; border-radius: 6px; cursor: pointer; border: 1px solid transparent; text-decoration: none; display: inline-block; }
.btn-primary { background: var(--accent); color: var(--accent-ink); width: 100%; font-weight: 600; }
.btn-primary:disabled { opacity: 0.5; cursor: progress; }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--hairline); }
.btn-secondary:hover { background: var(--surface-2); }
.link { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; font-size: 12px; padding: 0; }
.actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.actions .btn-primary { width: auto; flex: 1; }

details.advanced { margin: 4px 0 14px; }
details.advanced summary { font-size: 12px; color: var(--ink-2); cursor: pointer; }

.progress { margin-top: 12px; }
.progress .bar { height: 6px; background: var(--seq-100); border-radius: 3px; overflow: hidden; }
.progress #progress-fill { height: 100%; width: 0; background: var(--accent); transition: width 0.3s; }
#progress-log { margin: 8px 0 0; padding-left: 18px; font-size: 12px; color: var(--ink-2); max-height: 180px; overflow-y: auto; }
#progress-log li { margin: 2px 0; }
#progress-log li.err { color: var(--critical); }

.sources { margin-top: 24px; border-top: 1px solid var(--hairline); padding-top: 10px; }
.sources p { font-size: 11px; color: var(--muted); line-height: 1.4; margin: 0; }
.sources a { color: var(--ink-2); }

/* tiles */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; }
.tile { background: var(--surface-2); border-radius: var(--radius); padding: 8px 10px; }
.tile .label { font-size: 11px; color: var(--muted); }
.tile .value { font-size: 18px; font-weight: 600; margin-top: 2px; }
.tile .sub { font-size: 11px; color: var(--ink-2); }

.layer-toggles { display: flex; gap: 12px; font-size: 12px; color: var(--ink-2); margin: 8px 0; flex-wrap: wrap; }
.layer-toggles label { display: inline-flex; align-items: center; gap: 4px; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 2px; box-shadow: 0 0 0 2px var(--surface); }
.swatch.comp, .dot.comp { background: var(--comp); }
.swatch.anch, .dot.anch { background: var(--anch); }
.swatch.traffic { background: var(--muted); }
.swatch.permit { background: var(--surface); border: 2px solid var(--ink-2); box-sizing: border-box; }
.gates .warn { color: var(--critical); font-weight: 700; }

/* top list */
.top-list { list-style: none; margin: 0; padding: 0; }
.top-list li { display: grid; grid-template-columns: 24px 1fr 44px; align-items: center; gap: 8px; padding: 5px 4px; border-radius: 6px; cursor: pointer; font-size: 12px; }
.top-list li:hover, .top-list li.active { background: var(--surface-2); }
.top-list .rank { color: var(--muted); font-variant-numeric: tabular-nums; }
.top-list .bar { height: 10px; background: var(--seq-100); border-radius: 0 4px 4px 0; overflow: hidden; }
.top-list .bar > i { display: block; height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; }
.top-list .score { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.top-list .where { color: var(--muted); font-size: 11px; }

/* recommended sites */
.site { border: 1px solid var(--hairline); border-radius: var(--radius); padding: 8px 10px; margin-bottom: 8px; cursor: pointer; }
.site:hover, .site.active { background: var(--surface-2); }
.site .head { display: flex; align-items: baseline; gap: 8px; }
.site .badge-rank { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; background: var(--ink); color: var(--surface); font-size: 12px; font-weight: 700; flex: 0 0 22px; }
.site .name { font-weight: 600; font-size: 13px; flex: 1; }
.site .sc { font-weight: 600; font-variant-numeric: tabular-nums; }
.site .kind { font-size: 11px; color: var(--muted); margin-left: 30px; }
.site ul { margin: 6px 0 4px 30px; padding: 0; list-style: none; font-size: 12px; color: var(--ink-2); }
.site li { padding: 1px 0; }
.site li.warn { color: var(--critical); }
.site .links { margin-left: 30px; font-size: 12px; display: flex; gap: 10px; flex-wrap: wrap; }
.site .links a { color: var(--accent); }
.eval-card { border: 1px solid var(--hairline); border-radius: var(--radius); padding: 8px 10px; margin-top: 8px; font-size: 12px; }

/* spaces */
.space-card { border: 1px solid var(--hairline); border-radius: var(--radius); padding: 9px 10px; margin-bottom: 8px; }
.space-card.active { background: var(--surface-2); }
.space-card .head { display: flex; align-items: baseline; gap: 8px; }
.space-card .name { font-weight: 600; font-size: 13px; flex: 1; cursor: pointer; }
.verdict { font-size: 10px; padding: 2px 7px; border-radius: 10px; text-transform: uppercase; letter-spacing: 0.03em; font-weight: 700; color: #fff; }
.verdict.strong { background: var(--good); } .verdict.yes { background: var(--accent); } .verdict.check { background: #c98500; } .verdict.no { background: var(--critical); }
.space-card .facts-line { font-size: 12px; color: var(--ink-2); margin: 3px 0; }
.space-card ul { margin: 4px 0; padding-left: 16px; font-size: 12px; color: var(--ink-2); }
.space-card li.bad { color: var(--critical); } .space-card li.good { color: var(--good); }
.space-card .steps { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.space-card .steps a, .space-card .steps button { font-size: 12px; padding: 4px 9px; }
.model-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; font-size: 12px; }
.model-grid div { display: flex; justify-content: space-between; border-bottom: 1px solid var(--hairline); padding: 3px 0; }
.model-grid span:first-child { color: var(--muted); } .model-grid span:last-child { font-variant-numeric: tabular-nums; }
.assump { display: grid; grid-template-columns: 1fr 90px; gap: 4px 8px; align-items: center; font-size: 12px; margin-top: 6px; }
.assump label { color: var(--ink-2); } .assump input { width: 90px; font-size: 12px; padding: 4px 6px; }
.cand { border: 1px dashed var(--hairline); border-radius: 6px; padding: 8px; margin-top: 8px; font-size: 12px; }
.cand .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 8px; }
.cand input { width: 100%; font-size: 12px; padding: 4px 6px; }
.cand .lbl { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.portal-links a { display: block; font-size: 12px; padding: 4px 0; color: var(--accent); }
.unlisted { border-bottom: 1px solid var(--hairline); padding: 6px 0; font-size: 12px; }
.unlisted .t { font-weight: 600; }

/* hex details */
.hero { display: flex; align-items: baseline; gap: 10px; margin: 4px 0 8px; }
.hero .num { font-size: 40px; font-weight: 600; line-height: 1; }
.hero .meta { font-size: 12px; color: var(--ink-2); }
.bars { display: grid; grid-template-columns: 150px 1fr 40px; gap: 4px 8px; align-items: center; font-size: 12px; }
.bars .lbl { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bars .track { height: 12px; background: var(--seq-100); border-radius: 0 4px 4px 0; }
.bars .track > i { display: block; height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; }
.bars .val { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 10px; font-size: 12px; margin: 10px 0; }
.facts div { display: flex; justify-content: space-between; border-bottom: 1px solid var(--hairline); padding: 3px 0; }
.facts span:first-child { color: var(--muted); }
.facts span:last-child { font-variant-numeric: tabular-nums; }
.gates { list-style: none; margin: 8px 0; padding: 0; font-size: 12px; }
.gates li { display: flex; gap: 6px; align-items: center; padding: 3px 0; }
.gates .ok { color: var(--good); font-weight: 700; }
.gates .bad { color: var(--critical); font-weight: 700; }
.gates .na { color: var(--muted); }
.gates .v { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }

/* weights */
.weight { display: grid; grid-template-columns: 140px 1fr 34px; align-items: center; gap: 8px; font-size: 12px; margin: 4px 0; }
.weight label { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.weight input[type=range] { width: 100%; accent-color: var(--accent); }
.weight .v { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); }

/* watches */
.card { background: var(--surface-2); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 12px; }
.card h3 { margin-top: 0; }
.watch { border: 1px solid var(--hairline); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 8px; font-size: 12px; }
.watch .title { font-weight: 600; font-size: 13px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.watch .meta { color: var(--muted); margin: 4px 0; }
.watch .btns { display: flex; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.watch .btns button { font-size: 12px; padding: 4px 8px; }
.watch.off { opacity: 0.6; }
.change { border-bottom: 1px solid var(--hairline); padding: 7px 0; font-size: 12px; }
.change .when { color: var(--muted); font-size: 11px; }
.change .what { display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.badge { font-size: 10px; padding: 1px 6px; border-radius: 10px; background: var(--surface-2); color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.03em; }
.badge.added, .badge.new_license { background: var(--good); color: #fff; }
.badge.removed { background: var(--critical); color: #fff; }
.change .link { font-size: 11px; }

/* legend & tooltip */
.legend { position: absolute; right: 12px; bottom: 28px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 10px; font-size: 11px; color: var(--ink-2); box-shadow: 0 1px 4px rgba(0,0,0,0.08); min-width: 150px; }
.legend-title { font-weight: 600; color: var(--ink); margin-bottom: 4px; }
.legend .ramp { height: 10px; border-radius: 3px; background: linear-gradient(to right, var(--seq-100), var(--seq-200), var(--seq-300), var(--seq-400), var(--seq-500), var(--seq-600), var(--seq-700)); }
.legend .ramp-labels { display: flex; justify-content: space-between; margin-top: 2px; }
.legend-keys { display: flex; gap: 10px; margin-top: 6px; }
.legend-keys span { display: inline-flex; align-items: center; gap: 4px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; box-shadow: 0 0 0 2px var(--surface); }
.hover-tip { position: absolute; pointer-events: none; background: var(--surface); color: var(--ink); border: 1px solid var(--border); border-radius: 6px; padding: 5px 8px; font-size: 12px; box-shadow: 0 1px 4px rgba(0,0,0,0.1); transform: translate(12px, 12px); white-space: nowrap; }
.hover-tip b { font-variant-numeric: tabular-nums; }

.maplibregl-popup-content { font-family: inherit; font-size: 12px; color: #0b0b0b; padding: 8px 10px; border-radius: 6px; }
.maplibregl-popup-content h4 { margin: 0 0 4px; font-size: 13px; }
.maplibregl-popup-content .k { color: #898781; }
.maplibregl-ctrl-attrib { font-size: 10px; }

@media (max-width: 760px) {
  #app { flex-direction: column; }
  #panel { width: 100%; flex: 0 0 52vh; border-right: 0; border-bottom: 1px solid var(--hairline); }
  :root { --panel-w: 100%; }
}

/* ---- Accounts ---- */
.user-chip { margin-top: 6px; display: flex; gap: 10px; align-items: center; font-size: 12px; color: var(--ink-2); }
.user-chip #user-name { font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }
.auth-gate { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: safe center; overflow-y: auto; padding: 16px; background: color-mix(in srgb, var(--page) 88%, transparent); backdrop-filter: blur(6px); }
.auth-card { flex: 0 0 auto; }
.auth-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--hairline); border-radius: 12px; padding: 22px 22px 16px; box-shadow: 0 20px 60px rgba(0,0,0,0.18); display: flex; flex-direction: column; gap: 10px; }
.auth-brand { display: flex; gap: 12px; align-items: center; margin-bottom: 6px; }
.auth-brand h2 { margin: 0; font-size: 20px; }
.auth-tabs { display: flex; border-bottom: 1px solid var(--hairline); margin-bottom: 4px; }
.auth-tabs button { flex: 1; background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 0; font: inherit; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.auth-tabs button.active { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.auth-card label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--ink-2); }
.auth-card input { font: inherit; font-size: 14px; padding: 8px 10px; border: 1px solid var(--hairline); border-radius: 6px; background: var(--page); color: var(--ink); }
.auth-card input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.auth-error { min-height: 16px; font-size: 12px; color: var(--critical); }
.auth-card .help { margin: 4px 0 0; text-align: center; }
.users-dialog { border: 1px solid var(--hairline); border-radius: 12px; background: var(--surface); color: var(--ink); padding: 18px; width: min(680px, 94vw); }
.users-dialog::backdrop { background: rgba(0,0,0,0.35); }
.users-dialog h3 { margin: 0 0 4px; }
table.users { width: 100%; border-collapse: collapse; font-size: 12px; margin: 8px 0 12px; }
table.users th, table.users td { text-align: left; padding: 5px 6px; border-bottom: 1px solid var(--hairline); }
table.users th { color: var(--muted); font-weight: 500; }
.user-add .row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.user-add input, .user-add select { font: inherit; font-size: 12px; padding: 6px 8px; border: 1px solid var(--hairline); border-radius: 6px; background: var(--page); color: var(--ink); flex: 1 1 120px; }
.users-dialog .actions { margin-top: 12px; display: flex; justify-content: flex-end; }
@media (max-width: 600px) { .auth-card { padding: 18px 16px 12px; } }

/* ---- Accounts: approval + admin link ---- */
.user-chip a.link { text-decoration: none; }
.user-chip a.attention { font-weight: 700; color: var(--comp); }
#auth-pending h3 { margin: 4px 0 0; font-size: 16px; }
#auth-pending .help { text-align: left; }
#auth-turnstile { min-height: 0; }

/* ---- Admin portal ---- */
.admin-body { height: auto; min-height: 100%; overflow: auto; }
.admin { max-width: 1120px; margin: 0 auto; padding: 14px 20px 60px; }
.admin-head { display: flex; align-items: center; gap: 10px; padding: 6px 0 10px; border-bottom: 1px solid var(--hairline); }
.admin-head h1 { margin: 0; font-size: 20px; }
.admin-head .spacer { flex: 1; }
.admin section { margin-top: 22px; }
.admin h2 { font-size: 15px; margin: 0 0 4px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-top: 14px; }
.card { background: var(--surface); border: 1px solid var(--hairline); border-radius: 10px; padding: 12px 14px; }
.card.warn { border-color: var(--comp); }
.card .big { font-size: 26px; font-weight: 700; line-height: 1.1; }
.card .big.small { font-size: 16px; padding: 5px 0; }
.card .label { font-size: 12px; color: var(--ink-2); margin-top: 2px; }
.card .sub { font-size: 11px; color: var(--muted); margin-top: 4px; }
.table-wrap { overflow-x: auto; }
table.admin-table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 6px; }
table.admin-table th, table.admin-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--hairline); vertical-align: top; }
table.admin-table th { color: var(--muted); font-weight: 500; white-space: nowrap; }
table.admin-table tr.pending td { background: color-mix(in srgb, var(--comp) 8%, transparent); }
table.admin-table tr.disabled td { opacity: 0.6; }
table.admin-table td.acts { white-space: nowrap; }
table.admin-table td.acts .link { margin-right: 6px; }
.link.danger { color: var(--critical); }
.pill { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); text-transform: none; }
.pill.active, .pill.login, .pill.signup { background: color-mix(in srgb, var(--anch) 18%, transparent); color: var(--anch); }
.pill.pending { background: color-mix(in srgb, var(--comp) 18%, transparent); color: var(--comp); }
.pill.disabled, .pill.failed, .pill.blocked { background: color-mix(in srgb, var(--critical) 14%, transparent); color: var(--critical); }
.pending-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 12px; margin-top: 8px; border: 1px solid var(--comp); border-radius: 10px; background: var(--surface); }
.pending-row .btns { display: flex; gap: 8px; }
.pending-row .btn-primary { width: auto; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px 14px; margin-top: 8px; }
.settings-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--ink-2); }
.settings-grid input, .settings-grid select { font: inherit; font-size: 13px; padding: 7px 9px; border: 1px solid var(--hairline); border-radius: 6px; background: var(--page); color: var(--ink); }
.settings-actions { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; }
.settings-actions .btn-primary { width: auto; }
.admin .user-add { margin-top: 12px; }
@media (max-width: 640px) { .pending-row { flex-direction: column; align-items: stretch; } }

/* ---- Plans ---- */
.plan-chip { font-weight: 600; }
.plan-chip.attention { color: var(--comp); }
.plans-dialog { border: 1px solid var(--hairline); border-radius: 14px; background: var(--surface); color: var(--ink); padding: 20px 22px; width: min(860px, 94vw); max-height: 92vh; overflow: auto; }
.plans-dialog::backdrop { background: rgba(0,0,0,0.4); }
.plans-dialog h3 { margin: 0 0 6px; font-size: 18px; }
.plans-why { margin: 6px 0 10px; border-left: 3px solid var(--comp); }
.plans-status { font-size: 13px; color: var(--ink-2); margin-bottom: 12px; }
.plan-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.plan-card { border: 1px solid var(--hairline); border-radius: 12px; padding: 14px 14px 12px; background: var(--page); display: flex; flex-direction: column; gap: 6px; }
.plan-card.current { border-color: var(--anch); }
.plan-card.suggested { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent); }
.plan-name { font-weight: 700; font-size: 15px; display: flex; gap: 8px; align-items: center; }
.plan-price { font-size: 26px; font-weight: 700; line-height: 1; margin: 2px 0 4px; }
.plan-price .per { font-size: 12px; font-weight: 400; color: var(--muted); }
.plan-card ul { margin: 0; padding-left: 18px; font-size: 12px; color: var(--ink-2); line-height: 1.6; }
.plan-card .help { margin: 2px 0 6px; min-height: 30px; }
.plan-card .btn-primary, .plan-card .btn-secondary { width: 100%; margin-top: 4px; text-align: center; }
.interval-toggle { display: inline-flex; border: 1px solid var(--hairline); border-radius: 999px; overflow: hidden; align-self: flex-start; }
.interval-toggle button { font: inherit; font-size: 11px; padding: 3px 10px; border: 0; background: none; color: var(--ink-2); cursor: pointer; }
.interval-toggle button.active { background: var(--accent); color: var(--accent-ink); }
.plans-dialog .actions { margin-top: 12px; display: flex; justify-content: flex-end; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; background: var(--ink); color: var(--page); padding: 10px 16px; border-radius: 999px; font-size: 13px; box-shadow: 0 10px 30px rgba(0,0,0,0.25); max-width: min(90vw, 520px); }
.upsell { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); font-size: 13px; line-height: 1.5; }
.upsell .btn-primary { width: auto; margin-top: 8px; display: block; }

/* ---- Market context ---- */
.card.market { padding: 10px 12px; }
ul.verdicts { list-style: none; margin: 0 0 6px; padding: 0; font-size: 12.5px; line-height: 1.45; }
ul.verdicts li { padding: 4px 0 4px 18px; position: relative; border-bottom: 1px solid var(--hairline); }
ul.verdicts li:last-child { border-bottom: 0; }
ul.verdicts li::before { content: ''; position: absolute; left: 3px; top: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
ul.verdicts li.good::before { background: var(--good); }
ul.verdicts li.warn::before { background: var(--comp); }
.card.market details { margin-top: 6px; font-size: 12px; }
.card.market summary { cursor: pointer; color: var(--accent); }
table.mini { width: 100%; border-collapse: collapse; font-size: 11.5px; margin-top: 4px; }
table.mini th, table.mini td { text-align: left; padding: 3px 4px; border-bottom: 1px solid var(--hairline); }
table.mini th { color: var(--muted); font-weight: 500; }
.scorecard { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 2px; }
.chip { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); }
.chip.ok { background: color-mix(in srgb, var(--anch) 16%, transparent); color: var(--anch); }
.chip.bad { background: color-mix(in srgb, var(--critical) 14%, transparent); color: var(--critical); }
.danger { color: var(--critical); }
.pill.failed { background: color-mix(in srgb, var(--critical) 14%, transparent); color: var(--critical); }
.pill.refreshing, .pill.never { background: var(--surface-2); color: var(--ink-2); }

/* ---- Inbox ---- */
.card.inbox { font-size: 12.5px; }
.inbox-addr { display: flex; gap: 6px; align-items: center; margin: 4px 0 6px; }
.inbox-addr code { flex: 1; font-size: 12px; padding: 6px 8px; background: var(--page); border: 1px solid var(--hairline); border-radius: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox-steps { margin: 4px 0 6px; padding-left: 18px; line-height: 1.5; }
.inbox-list { margin: 6px 0; padding-left: 16px; line-height: 1.5; }
pre.mail-text { white-space: pre-wrap; word-break: break-word; font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--page); border: 1px solid var(--hairline); border-radius: 8px; padding: 10px; max-height: 60vh; overflow: auto; }

/* ---- Landing (signed-out) ---- */
.auth-layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(300px, 400px); gap: 40px; align-items: center; width: min(1040px, 100%); margin: auto; }
.auth-side { display: flex; flex-direction: column; align-items: stretch; }
.auth-side .auth-card { max-width: none; }
.auth-hero { color: var(--ink); }
.hero-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; margin-bottom: 18px; }
.auth-hero h1 { font-size: clamp(26px, 3.4vw, 40px); line-height: 1.1; margin: 0 0 12px; letter-spacing: -0.01em; }
.hero-lede { font-size: 16px; line-height: 1.5; color: var(--ink-2); margin: 0 0 18px; max-width: 34em; }
.hero-points { list-style: none; padding: 0; margin: 0 0 20px; display: grid; gap: 10px; }
.hero-points li { position: relative; padding-left: 22px; font-size: 14px; line-height: 1.45; color: var(--ink-2); }
.hero-points li::before { content: ''; position: absolute; left: 2px; top: 6px; width: 10px; height: 10px; border-radius: 3px; background: var(--accent); }
.hero-points b { color: var(--ink); }
.hero-prices { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.hero-prices div { border: 1px solid var(--hairline); background: var(--surface); border-radius: 10px; padding: 8px 12px; display: flex; flex-direction: column; min-width: 120px; }
.hero-prices b { font-size: 17px; }
.hero-prices span { font-size: 11.5px; color: var(--muted); }
.hero-credit { font-size: 11.5px; color: var(--muted); margin: 0; }
.auth-gate { background: color-mix(in srgb, var(--page) 94%, transparent); }
@media (max-width: 820px) {
  .auth-gate { align-items: flex-start; }
  .auth-layout { grid-template-columns: 1fr; gap: 18px; }
  .auth-hero h1 { font-size: 26px; }
  .hero-lede { font-size: 14.5px; margin-bottom: 12px; }
  .hero-points { gap: 6px; margin-bottom: 12px; }
  .hero-points li { font-size: 13px; }
  .hero-brand { margin-bottom: 10px; }
}
@media (max-width: 520px) {
  .hero-points, .hero-credit { display: none; }
  .hero-prices { gap: 6px; flex-wrap: nowrap; margin-bottom: 4px; }
  .hero-prices div { min-width: 0; flex: 1; padding: 6px 8px; }
  .hero-prices b { font-size: 15px; }
  .hero-prices span { font-size: 10.5px; line-height: 1.25; }
  .auth-hero h1 { font-size: 23px; margin-bottom: 8px; }
}
