/* DatumSimulacra — dark premium theme. Near-black surfaces, hairline borders, glass panels,
   champagne-gold accent reserved for selection and primary actions. */

@font-face {
  font-family: "Inter";
  src: url("../vendor/fonts/inter-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #0b0c0f;
  --surface: #121316;
  --surface-2: #17181c;
  --surface-3: #1e2025;
  --glass: rgba(16, 17, 20, 0.78);
  --glass-strong: rgba(14, 15, 18, 0.92);
  --line: rgba(255, 255, 255, 0.07);
  --line-2: rgba(255, 255, 255, 0.12);
  --ink: #f4f3ef;
  --ink-2: #b7b5ae;
  --ink-3: #85847e;
  --gold: #d6b36a;
  --gold-2: #e8cd93;
  --gold-wash: rgba(214, 179, 106, 0.12);
  --good: #0ca30c;
  --warning: #fab219;
  --critical: #d03b3b;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.55), 0 2px 8px rgba(0, 0, 0, 0.35);
  --sidebar: 296px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-feature-settings: "cv11", "ss01";
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--ink); overflow: hidden; }
body { font-size: 13.5px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
button, input { font: inherit; color: inherit; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 6px; }

.app { display: grid; grid-template-columns: var(--sidebar) 1fr; height: 100vh; height: 100dvh; }

/* ---------- Sidebar ---------- */
.sidebar {
  display: flex; flex-direction: column; min-height: 0;
  background: linear-gradient(180deg, #111215 0%, #0d0e11 100%);
  border-right: 1px solid var(--line);
  z-index: 5;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 20px 20px 16px; }
.brand-mark { width: 34px; height: 34px; padding: 6px; border-radius: 10px; stroke: var(--gold); stroke-width: 2.6;
  background: radial-gradient(120% 120% at 20% 0%, #23201a 0%, #141417 70%); border: 1px solid rgba(214, 179, 106, 0.25); }
.brand-name { font-size: 17px; font-weight: 650; letter-spacing: 0.02em; }
.brand-sub { font-size: 11.5px; color: var(--ink-3); letter-spacing: 0.02em; }
.sidebar-close { margin-left: auto; }
.icon-btn.sidebar-close, .icon-btn.menu-btn { display: none; }   /* shown on narrow screens only */

.field { display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 12px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-3);
  transition: border-color 0.15s, background 0.15s; }
.field:focus-within { border-color: rgba(214, 179, 106, 0.45); background: var(--surface-3); }
.field input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); }
.field input::placeholder { color: var(--ink-3); }
.field input::-webkit-search-cancel-button { filter: invert(0.6); }
.field-sm { height: 36px; margin: 0 16px 10px; border-radius: 10px; }

.metric-list { flex: 1; overflow-y: auto; padding: 4px 10px 16px; scrollbar-width: thin; scrollbar-color: #2a2b30 transparent; }
.group { margin-top: 6px; }
.group-head { width: 100%; display: flex; align-items: center; gap: 8px; padding: 10px 10px 6px; border: 0; background: none;
  color: var(--ink-3); font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; cursor: pointer; }
.group-head svg { width: 14px; height: 14px; margin-left: auto; transition: transform 0.2s var(--ease); }
.group[data-collapsed="true"] .group-head svg { transform: rotate(-90deg); }
.group[data-collapsed="true"] .group-items { display: none; }
.metric { position: relative; width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 10px 9px 14px; border: 0;
  border-radius: 10px; background: none; color: var(--ink-2); text-align: left; cursor: pointer; transition: background 0.12s, color 0.12s; }
.metric:hover { background: rgba(255, 255, 255, 0.04); color: var(--ink); }
.metric[aria-pressed="true"] { background: var(--gold-wash); color: var(--ink); }
.metric[aria-pressed="true"]::before { content: ""; position: absolute; left: 4px; top: 9px; bottom: 9px; width: 3px; border-radius: 3px; background: var(--gold); }
.metric .m-name { flex: 1; }
.metric .m-info { width: 15px; height: 15px; color: var(--ink-3); opacity: 0; transition: opacity 0.12s; }
.metric:hover .m-info, .metric[aria-pressed="true"] .m-info { opacity: 1; }
.metric-empty { padding: 16px 14px; color: var(--ink-3); }
.sidebar-foot { padding: 14px 20px 18px; border-top: 1px solid var(--line); color: var(--ink-3); font-size: 11.5px; line-height: 1.55; }
.sidebar-foot strong { color: var(--ink-2); font-weight: 600; }

/* ---------- Stage & map ---------- */
.stage { position: relative; min-width: 0; overflow: hidden; }
.map { position: absolute; inset: 0; background: var(--bg); }
.maplibregl-ctrl-group { background: var(--glass) !important; border: 1px solid var(--line-2); box-shadow: var(--shadow) !important; border-radius: 12px !important; backdrop-filter: blur(14px); }
.maplibregl-ctrl-group button { width: 34px !important; height: 34px !important; }
.maplibregl-ctrl-group button + button { border-top: 1px solid var(--line) !important; }
.maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: invert(0.85); }
.maplibregl-ctrl-bottom-right { right: 6px; bottom: 34px; }
.maplibregl-ctrl-attrib { background: rgba(11, 12, 15, 0.6) !important; color: var(--ink-3); font-size: 10px; }
.maplibregl-ctrl-attrib a { color: var(--ink-3) !important; }
.maplibregl-ctrl-attrib-button { filter: invert(0.8); }

.progress { position: absolute; top: 0; left: 0; right: 0; height: 2px; z-index: 30; overflow: hidden; }
.progress::after { content: ""; position: absolute; top: 0; bottom: 0; width: 35%; background: linear-gradient(90deg, transparent, var(--gold), transparent);
  animation: slide 1.1s var(--ease) infinite; }
@keyframes slide { from { left: -35%; } to { left: 100%; } }

/* ---------- Glass panels ---------- */
.topbar, .legend, .data-chip, .hover-card, .scorecard, .sheet, .banner, .search-results, .hint {
  background: var(--glass); border: 1px solid var(--line-2); box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%);
}

.topbar { position: absolute; top: 16px; left: 16px; right: 16px; z-index: 20; display: flex; align-items: center; gap: 10px;
  padding: 8px; border-radius: 16px; max-width: 980px; }
.search { position: relative; flex: 1; min-width: 180px; }
.search .field { background: rgba(255, 255, 255, 0.04); }
.kbd { font: 600 11px/1 "Inter", sans-serif; color: var(--ink-3); border: 1px solid var(--line-2); border-radius: 6px; padding: 3px 6px; }
.search-results { position: absolute; top: calc(100% + 8px); left: 0; right: 0; border-radius: 14px; padding: 6px; max-height: 420px; overflow-y: auto; }
.result { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: 0; border-radius: 10px; background: none; text-align: left; cursor: pointer; color: var(--ink-2); }
.result[aria-selected="true"], .result:hover { background: rgba(255, 255, 255, 0.06); color: var(--ink); }
.result .r-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result .r-name mark { background: none; color: var(--gold-2); font-weight: 600; }
.chip { font-size: 10.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3);
  border: 1px solid var(--line-2); border-radius: 999px; padding: 2px 8px; }
.result-empty { padding: 14px 12px; color: var(--ink-3); }

.seg { display: flex; padding: 3px; border-radius: 12px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); }
.seg button { border: 0; background: none; color: var(--ink-2); padding: 8px 14px; border-radius: 9px; cursor: pointer; font-weight: 550; transition: background 0.15s, color 0.15s; }
.seg button:hover { color: var(--ink); }
.seg button[aria-selected="true"] { background: var(--surface-3); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-2), 0 1px 0 rgba(255, 255, 255, 0.04); }

.btn { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border-radius: 11px; border: 1px solid var(--line-2);
  background: rgba(255, 255, 255, 0.04); color: var(--ink); cursor: pointer; font-weight: 550; transition: background 0.15s, border-color 0.15s; white-space: nowrap; }
.btn:hover { background: rgba(255, 255, 255, 0.08); }
.btn[aria-pressed="true"] { border-color: rgba(214, 179, 106, 0.5); background: var(--gold-wash); color: var(--gold-2); }
.btn-gold { background: linear-gradient(180deg, #e2c27f, #c9a35a); color: #16130c; border-color: transparent; }
.btn-gold:hover { background: linear-gradient(180deg, #ebcd8d, #d3ad64); }
.icon-btn { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; border: 1px solid transparent; background: none; color: var(--ink-2); cursor: pointer; }
.icon-btn:hover { background: rgba(255, 255, 255, 0.06); color: var(--ink); }

/* ---------- Legend & chips ---------- */
.legend { position: absolute; left: 16px; bottom: 16px; z-index: 10; width: 320px; padding: 14px 16px 12px; border-radius: 14px; }
.legend-title { font-weight: 600; font-size: 13px; }
.legend-sub { color: var(--ink-3); font-size: 11.5px; margin: 2px 0 10px; }
.legend-bar { position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; height: 10px; border-radius: 5px; overflow: visible; }
.legend-bar i:first-child { border-radius: 5px 0 0 5px; }
.legend-bar i:last-child { border-radius: 0 5px 5px 0; }
/* the reference point (U.S. level or threshold) sits exactly between the cold and hot halves */
.legend-bar::after { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; border-radius: 1px; background: var(--ink); }
.legend-scale { display: flex; justify-content: space-between; margin-top: 6px; font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.legend-center { color: var(--ink); font-weight: 600; }
.legend-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; margin-top: 10px; }
.legend-col-head { font-size: 10.5px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.legend-row { display: flex; align-items: center; gap: 7px; white-space: nowrap; font-size: 11.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; line-height: 1.7; }
.legend-row i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend-row.muted { color: var(--ink-3); }
.legend-row.nodata { margin-top: 8px; color: var(--ink-3); }
.legend-row.nodata i { background: transparent; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35); }

.data-chip { position: absolute; right: 16px; bottom: 16px; z-index: 10; padding: 8px 12px; border-radius: 10px; font-size: 11.5px; color: var(--ink-2); }
.data-chip b { color: var(--ink); font-weight: 600; }
.hint { position: absolute; top: 88px; left: 50%; transform: translateX(-50%); z-index: 12; padding: 8px 14px; border-radius: 999px; color: var(--ink-2); font-size: 12.5px; }

/* ---------- Hover card ---------- */
.hover-card { position: absolute; z-index: 25; pointer-events: none; min-width: 210px; max-width: 280px; padding: 12px 14px; border-radius: 12px; }
.hc-name { font-weight: 600; font-size: 13px; }
.hc-level { color: var(--ink-3); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; margin-top: 1px; }
.hc-value { display: flex; align-items: baseline; gap: 8px; margin-top: 10px; }
.hc-value .v { font-size: 22px; font-weight: 650; letter-spacing: -0.01em; }
.hc-value i { width: 10px; height: 10px; border-radius: 3px; }
.hc-meta { color: var(--ink-3); font-size: 11.5px; margin-top: 4px; font-variant-numeric: tabular-nums; }

/* ---------- Scorecard ---------- */
.scorecard { position: absolute; top: 88px; right: 16px; bottom: 16px; z-index: 15; width: 400px; border-radius: 18px; display: flex; flex-direction: column;
  animation: in-right 0.28s var(--ease); background: var(--glass-strong); }
@keyframes in-right { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
.sc-head { display: flex; align-items: flex-start; gap: 10px; padding: 18px 18px 14px; border-bottom: 1px solid var(--line); }
.sc-title { flex: 1; min-width: 0; }
.sc-name { font-size: 17px; font-weight: 650; line-height: 1.3; }
.sc-kicker { display: flex; gap: 8px; align-items: center; margin-top: 6px; }
.sc-body { flex: 1; overflow-y: auto; padding: 16px 18px 20px; scrollbar-width: thin; scrollbar-color: #2a2b30 transparent; }
.sc-hero { padding: 16px 16px 16px 19px; border-radius: 14px; background: linear-gradient(160deg, rgba(214, 179, 106, 0.10), rgba(255, 255, 255, 0.02) 60%);
  border: 1px solid rgba(214, 179, 106, 0.18); box-shadow: inset 3px 0 0 var(--heat, transparent); }
.sc-hero-label { color: var(--ink-2); font-size: 12px; }
.sc-hero-value { font-size: 34px; font-weight: 680; letter-spacing: -0.02em; margin-top: 4px; }
.sc-hero-meta { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 8px; color: var(--ink-3); font-size: 12px; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; padding: 3px 9px 3px 7px; border-radius: 999px; }
.status svg { width: 13px; height: 13px; stroke-width: 2.4; }
.status.good { color: #5fd35f; background: rgba(12, 163, 12, 0.14); }
.status.warning { color: var(--warning); background: rgba(250, 178, 25, 0.12); }
.status.critical { color: #ff7a7a; background: rgba(208, 59, 59, 0.16); }
.sc-section { margin-top: 12px; border-top: 1px solid var(--line); }
.sc-section-title { width: 100%; display: flex; align-items: center; gap: 8px; padding: 12px 0 6px; border: 0; background: none; cursor: pointer;
  color: var(--ink-3); font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; text-align: left; }
.sc-section-title:hover { color: var(--ink); }
.sc-section-title em { font-style: normal; letter-spacing: 0; border: 1px solid var(--line-2); border-radius: 999px; padding: 0 7px; font-size: 10.5px; }
.sc-section-title svg { width: 14px; height: 14px; margin-left: auto; transition: transform 0.2s var(--ease); }
.sc-section[data-open="false"] .sc-section-title svg { transform: rotate(-90deg); }
.sc-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 10px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.sc-row:last-child { border-bottom: 0; }
.sc-row:hover .sc-label { color: var(--ink); }
.sc-row.active .sc-label { color: var(--gold-2); }
.sc-label { color: var(--ink-2); }
.sc-value { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.sc-compare { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; color: var(--ink-3); font-size: 11.5px; }
.pbar { position: relative; flex: 1; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, 0.07); }
.pbar i { position: absolute; top: -3px; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 2px rgba(11, 12, 15, 0.9); }
.sc-foot { display: flex; gap: 8px; padding: 14px 18px; border-top: 1px solid var(--line); }
.sc-foot .btn { flex: 1; justify-content: center; }
.skeleton { height: 14px; border-radius: 6px; margin: 12px 0; background: linear-gradient(90deg, #1a1b1f 25%, #23252a 50%, #1a1b1f 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- Banner ---------- */
.banner { position: absolute; top: 88px; left: 50%; transform: translateX(-50%); z-index: 40; display: flex; align-items: center; gap: 12px;
  padding: 10px 10px 10px 14px; border-radius: 14px; border-color: rgba(208, 59, 59, 0.45); max-width: min(620px, calc(100% - 32px)); }
.banner > svg { color: #ff7a7a; }
.banner div { display: flex; flex-direction: column; font-size: 12.5px; color: var(--ink-2); }
.banner strong { color: var(--ink); font-size: 13px; }

/* ---------- Table sheet ---------- */
.sheet { position: absolute; left: 16px; right: 16px; bottom: 16px; height: min(58vh, 620px); z-index: 18; border-radius: 18px;
  display: flex; flex-direction: column; background: var(--glass-strong); animation: in-up 0.3s var(--ease); }
@keyframes in-up { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
.sheet-head { display: flex; align-items: center; gap: 12px; padding: 14px 14px 12px 20px; border-bottom: 1px solid var(--line); }
.sheet-head > div:first-child { flex: 1; }
.sheet-title { font-weight: 650; font-size: 15px; }
.sheet-sub { color: var(--ink-3); font-size: 12px; }
.sheet-filter { margin: 0; width: 260px; }
.table { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.table-head, .table-row { display: grid; align-items: center; font-variant-numeric: tabular-nums; }
.table-head { border-bottom: 1px solid var(--line); color: var(--ink-3); font-size: 11.5px; font-weight: 600; overflow: hidden; }
.table-head button { display: flex; align-items: center; justify-content: flex-end; gap: 4px; height: 40px; padding: 0 14px; border: 0; background: none; color: inherit; cursor: pointer; text-align: right; }
.table-head button:first-child { justify-content: flex-start; }
.table-head button:hover { color: var(--ink); }
.table-head button[aria-sort] { color: var(--gold-2); }
.table-head button[aria-sort="descending"]::after { content: "↓"; }
.table-head button[aria-sort="ascending"]::after { content: "↑"; }
.table-body { position: relative; flex: 1; overflow: auto; scrollbar-width: thin; scrollbar-color: #2a2b30 transparent; }
.table-row { position: absolute; left: 0; height: 38px; border-bottom: 1px solid rgba(255, 255, 255, 0.04); cursor: pointer; }
.table-row:hover { background: rgba(255, 255, 255, 0.04); }
.table-row.selected { background: var(--gold-wash); }
.table-row > div { padding: 0 14px; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); }
.table-row > div:first-child { text-align: left; color: var(--ink); display: flex; align-items: center; gap: 10px; }
.table-row .sw { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.table-spacer { width: 1px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .scorecard { width: 360px; }
  .seg button { padding: 8px 10px; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(320px, 86vw); transform: translateX(-100%); transition: transform 0.28s var(--ease); z-index: 50; box-shadow: var(--shadow); }
  .app.menu-open .sidebar { transform: none; }
  .icon-btn.sidebar-close, .icon-btn.menu-btn { display: grid; }
  .topbar { flex-wrap: wrap; }
  .search { order: 3; flex-basis: 100%; }
  #table-btn { margin-left: auto; }
  .scorecard { left: 12px; right: 12px; top: auto; width: auto; height: 62vh; bottom: 12px; }
  .legend { width: auto; right: 12px; left: 12px; bottom: 12px; }
  .data-chip { display: none; }
  .sheet { left: 8px; right: 8px; bottom: 8px; }
  .sheet-filter { width: 150px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- History chart (scorecard) ---------- */
.sc-chart-wrap { margin-top: 14px; padding: 12px 12px 10px; border-radius: 14px; background: rgba(255, 255, 255, 0.025); border: 1px solid var(--line); }
.sc-chart-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; color: var(--ink-3);
  font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.seg-sm { padding: 2px; border-radius: 9px; }
.seg-sm button { padding: 4px 9px; border-radius: 7px; font-size: 11.5px; letter-spacing: 0; text-transform: none; }
.sc-chart { position: relative; }
.chart-svg { display: block; width: 100%; height: auto; overflow: visible; stroke: none; fill: none; }   /* opt out of the icon defaults on svg */
.chart-svg .grid { stroke: rgba(255, 255, 255, 0.06); stroke-width: 1; }
.chart-svg .tick { fill: var(--ink-3); font: 500 10.5px "Inter", sans-serif; font-variant-numeric: tabular-nums; }
.chart-svg .us-line { fill: none; stroke: rgba(214, 211, 202, 0.45); stroke-width: 1.4; stroke-dasharray: 4 3; }
.chart-svg .ref { stroke: rgba(244, 243, 239, 0.55); stroke-width: 1; stroke-dasharray: 2 3; }
.chart-svg .ref-label { fill: var(--ink-2); font: 600 10.5px "Inter", sans-serif; paint-order: stroke; stroke: rgba(11, 12, 15, 0.85); stroke-width: 3px; }
.chart-svg .crosshair { stroke: rgba(255, 255, 255, 0.35); stroke-width: 1; }
.chart-svg .hover-dot { fill: var(--ink); stroke: #0b0c0f; stroke-width: 2; }
.chart-svg .hit { fill: transparent; cursor: crosshair; }
.chart-tip { position: absolute; top: -6px; padding: 5px 9px; border-radius: 8px; background: rgba(8, 9, 11, 0.94); border: 1px solid var(--line-2);
  font-size: 11.5px; white-space: nowrap; pointer-events: none; display: flex; gap: 8px; align-items: baseline; }
.chart-tip b { font-weight: 650; }
.chart-tip span { color: var(--ink-3); }
.chart-empty { padding: 24px 0; color: var(--ink-3); text-align: center; }
.sc-chart-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 4px; font-size: 11px; color: var(--ink-3); }
.sc-chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.sc-chart-legend i { display: inline-block; width: 18px; height: 0; }
.lg-line { height: 3px !important; border-radius: 2px; background: linear-gradient(90deg, #6cc2f4, #59a4f4, #d96323, #b5161f); }
.lg-us { border-top: 1.5px dashed rgba(214, 211, 202, 0.6); }
.lg-ref { border-top: 1.5px dotted rgba(244, 243, 239, 0.7); }
.data-chip { cursor: pointer; }
.data-chip u { text-decoration: none; color: var(--gold-2); font-weight: 600; }
.data-chip:hover u { text-decoration: underline; }

/* ---------- Filters ---------- */
.badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--gold); color: #16130c;
  font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; }
.filter-panel { position: absolute; top: 88px; right: 16px; z-index: 22; width: 380px; max-height: calc(100% - 110px); overflow: hidden auto;
  border-radius: 16px; padding: 14px; background: var(--glass-strong); border: 1px solid var(--line-2); box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(140%); animation: in-right 0.24s var(--ease); }
.fp-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 10px; }
.fp-title { font-weight: 650; font-size: 15px; }
.fp-count { color: var(--ink-3); font-size: 12px; margin-top: 2px; }
.fp-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.chip-btn { border: 1px solid var(--line-2); background: rgba(255, 255, 255, 0.03); color: var(--ink-2); border-radius: 999px;
  padding: 6px 11px; font-size: 12px; font-weight: 550; cursor: pointer; }
.chip-btn:hover { color: var(--ink); background: rgba(255, 255, 255, 0.07); }
.chip-btn[aria-pressed="true"] { border-color: rgba(214, 179, 106, 0.55); background: var(--gold-wash); color: var(--gold-2); }
.fp-rule { padding: 10px; border-radius: 12px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); margin-bottom: 8px; }
.fp-rule select { width: 100%; height: 34px; padding: 0 8px; border-radius: 9px; border: 1px solid var(--line-2);
  background: var(--surface-2); color: var(--ink); font: inherit; }
.fp-range { display: flex; gap: 8px; margin-top: 8px; align-items: center; }
.field-xs { height: 34px; flex: 1; min-width: 0; padding: 0 8px; gap: 6px; border-radius: 9px; }
.field-xs input { min-width: 0; width: 100%; }
.fp-range .icon-btn { flex: none; }
.field-xs span { font-size: 11px; color: var(--ink-3); white-space: nowrap; }
.fp-actions { display: flex; gap: 8px; margin-top: 4px; }
.fp-actions .btn { height: 34px; font-size: 12.5px; }

/* ---------- Forecast notes ---------- */
.sc-notes { margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.025); border: 1px solid var(--line);
  font-size: 12px; color: var(--ink-2); }
.sc-notes summary { cursor: pointer; font-weight: 600; color: var(--ink); }
.sc-notes p { margin: 8px 0; line-height: 1.5; }
.sc-notes .muted { color: var(--ink-3); font-size: 11.5px; }
.sc-notes table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.sc-notes th, .sc-notes td { text-align: right; padding: 4px 6px; border-bottom: 1px solid var(--line); }
.sc-notes th:first-child, .sc-notes td:first-child { text-align: left; }
.sc-notes th { color: var(--ink-3); font-weight: 600; font-size: 11px; }
@media (max-width: 900px) { .filter-panel { left: 12px; right: 12px; width: auto; top: auto; bottom: 12px; max-height: min(70%, 560px); } }

/* ---------- Input check (#debug=1) ---------- */
.input-debug { position: fixed; top: 96px; left: 50%; transform: translateX(-50%); z-index: 60; width: min(420px, calc(100% - 32px));
  padding: 12px 14px; border-radius: 12px; background: var(--glass-strong); border: 1px solid rgba(214, 179, 106, 0.45);
  box-shadow: var(--shadow); font-size: 12.5px; line-height: 1.6; color: var(--ink-2); pointer-events: none; }
.input-debug .id-title { font-weight: 650; color: var(--gold-2); margin-bottom: 4px; }
.input-debug .ok { color: #7fd8a4; font-weight: 600; }
.input-debug .no { color: #f0a36b; font-weight: 600; }
.input-debug pre { margin: 8px 0 0; font: 11.5px/1.45 ui-monospace, Consolas, monospace; color: var(--ink-3); white-space: pre-wrap; }

/* ---------- Home report ---------- */
.homecard { z-index: 16; }
.home-pin { width: 32px; height: 40px; cursor: default; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.6)); }
.home-pin svg { width: 32px; height: 40px; fill: var(--gold); stroke: #16130c; stroke-width: 1.5; }
.home-pin .house { fill: #16130c; stroke: none; }
.hr-sub { color: var(--ink-2); font-size: 12.5px; margin-top: 2px; }
.hr-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.hr-area-chip { height: 24px; padding: 0 9px; border-radius: 999px; border: 1px solid var(--line-2); background: rgba(255, 255, 255, 0.04);
  color: var(--ink-2); font: inherit; font-size: 11.5px; cursor: pointer; white-space: nowrap; }
.hr-area-chip:hover { color: var(--gold-2); border-color: rgba(214, 179, 106, 0.5); }
.hr-muted { color: var(--ink-3); font-weight: 400; }
.hr-unit { font-size: 16px; font-weight: 500; color: var(--ink-2); margin-left: 2px; }
.hr-status { margin-top: 10px; }
.hr-empty { padding: 18px 4px; color: var(--ink-2); line-height: 1.55; }
.hr-note { margin-top: 8px; color: var(--ink-3); font-size: 11.5px; line-height: 1.5; }
.hr-error { margin: 8px 0; padding: 8px 10px; border-radius: 10px; background: rgba(205, 57, 22, 0.12);
  border: 1px solid rgba(205, 57, 22, 0.4); color: #f3b39a; font-size: 12px; }
.hr-h { margin: 18px 0 6px; font-size: 11.5px; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.hr-h .hr-muted { text-transform: none; letter-spacing: 0; margin-left: 4px; }
.hr-form { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.hr-field { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--ink-3); min-width: 0; }
.hr-input { display: flex; align-items: center; gap: 4px; height: 34px; padding: 0 9px; border-radius: 9px;
  background: var(--surface-2); border: 1px solid var(--line-2); }
.hr-input:focus-within, .hr-field > input:focus { border-color: rgba(214, 179, 106, 0.6); }
.hr-input i { font-style: normal; color: var(--ink-3); font-size: 12px; }
.hr-input input, .hr-field > input { flex: 1; min-width: 0; width: 100%; border: 0; background: none; color: var(--ink); font: inherit;
  font-size: 13px; font-variant-numeric: tabular-nums; outline: none; }
.hr-field > input { height: 34px; padding: 0 9px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--line-2);
  color-scheme: dark; }
.hr-list { border-top: 1px solid var(--line); }
.hr-line { display: grid; grid-template-columns: 1fr auto; gap: 1px 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.hr-line span { color: var(--ink-2); }
.hr-line b { font-weight: 620; text-align: right; font-variant-numeric: tabular-nums; }
.hr-line em { grid-column: 1 / -1; font-style: normal; color: var(--ink-3); font-size: 11.5px; }
.hr-line.total span, .hr-line.total b { color: var(--ink); font-weight: 700; }
.hr-links { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.hr-link { display: flex; flex-direction: column; gap: 2px; padding: 9px 11px; border-radius: 11px; text-decoration: none;
  background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line-2); color: var(--ink); }
.hr-link:hover { border-color: rgba(214, 179, 106, 0.5); background: var(--gold-wash); }
.hr-link b { font-size: 13px; font-weight: 620; }
.hr-link span { font-size: 11px; color: var(--ink-3); }
.hr-rc-cta { display: flex; flex-direction: column; gap: 2px; margin: 4px 0 8px; }
.hr-rc-cta .btn { align-self: flex-start; }
.hr-quota { margin-top: 10px; padding: 8px 10px; border-radius: 10px; background: rgba(255, 255, 255, 0.025); border: 1px solid var(--line);
  color: var(--ink-3); font-size: 11.5px; }
.btn-sm { height: 26px; padding: 0 9px; font-size: 11.5px; margin-left: 6px; }
.hr-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 6px 0 10px; }
.hr-facts div { padding: 8px 9px; border-radius: 10px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); min-width: 0; }
.hr-facts span { display: block; font-size: 10.5px; color: var(--ink-3); }
.hr-facts b { display: block; font-size: 12.5px; font-weight: 620; margin-top: 2px; overflow-wrap: anywhere; }
.hr-table { margin-top: 8px; font-size: 12px; font-variant-numeric: tabular-nums; }
.hr-tr { display: grid; grid-template-columns: 1.1fr 1fr 0.9fr; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.hr-tr span:not(:first-child) { text-align: right; }
.hr-tr span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hr-th { color: var(--ink-3); font-size: 11px; font-weight: 600; }
.hr-area .hr-tr { grid-template-columns: minmax(0, 1.7fr) repeat(var(--cols), minmax(0, 1fr)); gap: 6px; font-size: 11.5px; }
.hr-area .hr-tr span:first-child { white-space: normal; color: var(--ink-2); }
.linkish { border: 0; background: none; padding: 0; color: var(--gold-2); font: inherit; cursor: pointer; text-decoration: underline;
  text-decoration-color: rgba(214, 179, 106, 0.4); text-underline-offset: 2px; }
@media (max-width: 480px) { .hr-facts { grid-template-columns: 1fr 1fr; } .hr-links { grid-template-columns: 1fr; } }
