:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --surface-3: #eaf0f7;
  --border: #dce4ee;
  --border-strong: #c4d0df;
  --text: #172333;
  --text-2: #45556a;
  --muted: #68788d;
  --accent: #087f8c;
  --accent-ink: #ffffff;
  --accent-soft: rgb(8 127 140 / .09);
  --accent-2: #3566d6;
  --up: #16865b;
  --up-soft: rgb(22 134 91 / .1);
  --down: #c43d58;
  --down-soft: rgb(196 61 88 / .1);
  --radius: 14px;
  --radius-sm: 9px;
  --rank-w: 54px;
  --shadow: 0 1px 0 rgb(255 255 255 / .8) inset, 0 12px 32px -18px rgb(35 55 80 / .2);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 520px at 85% -120px, rgb(8 127 140 / .08), transparent 60%),
    radial-gradient(900px 480px at 0% -160px, rgb(53 102 214 / .07), transparent 60%),
    var(--bg);
  color: var(--text);
  font: 14.5px/1.5 var(--font);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}

main { width: min(1440px, calc(100% - 40px)); margin: 0 auto; padding: 8px 0 40px; }

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .35; }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; border-radius: 6px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.up { color: var(--up); }
.down { color: var(--down); }

/* --- App bar --- */
.appbar {
  position: sticky; top: 0; z-index: 20;
  border-bottom: 1px solid var(--border);
  background: rgb(255 255 255 / .86);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
}
.appbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; width: min(1440px, calc(100% - 40px)); height: 58px; margin: 0 auto; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 600; letter-spacing: -.01em; text-decoration: none; }
.brand b { font-weight: 800; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; box-shadow: 0 0 0 1px var(--border-strong); }
.appbar-nav { display: flex; align-items: center; gap: 18px; }
.data-status {
  display: inline-flex; align-items: center; gap: 8px; margin: 0; padding: 5px 12px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
  color: var(--muted); font-size: .8rem; white-space: nowrap;
}
.data-status strong { color: var(--text-2); font-weight: 600; }
.pulse { position: relative; width: 7px; height: 7px; border-radius: 50%; background: var(--up); }
.pulse::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 1px solid var(--up); opacity: 0; animation: pulse 2.4s ease-out infinite; }
.pulse.offline { background: var(--down); }
.pulse.offline::after { display: none; }
@keyframes pulse { 0% { transform: scale(.5); opacity: .7; } 100% { transform: scale(1.4); opacity: 0; } }

/* --- Hero & KPIs --- */
.hero { padding: 36px 0 22px; }
.eyebrow { margin: 0 0 8px; color: var(--accent); font-size: .74rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(1.9rem, 3.6vw, 2.75rem); font-weight: 800; letter-spacing: -.035em; line-height: 1.08; }
.lede { max-width: 720px; margin: 12px 0 0; color: var(--text-2); font-size: 1rem; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi {
  display: grid; gap: 2px; padding: 16px 18px; min-width: 0;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: linear-gradient(180deg, var(--surface-2), var(--surface)); box-shadow: var(--shadow);
}
.kpi-label { color: var(--muted); font-size: .76rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.kpi-value { font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi-note { overflow: hidden; color: var(--muted); font-size: .8rem; text-overflow: ellipsis; white-space: nowrap; }

/* --- Filter Screener --- */
.filter-screener {
  margin-top: 20px;
}
.filter-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  line-height: 1;
}

/* --- Filter Panel --- */
.filter-panel {
  padding: 18px 20px;
  margin-bottom: 16px;
}
.filter-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 16px;
}
.filter-head-left {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.filter-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.filter-title-row h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -.01em;
}
.btn-toggle-filters {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s ease;
  user-select: none;
}
.btn-toggle-filters:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
}
.btn-toggle-filters .toggle-icon {
  width: 14px;
  height: 14px;
  transition: transform .2s ease;
}
.btn-toggle-filters[aria-expanded="false"] .toggle-icon {
  transform: rotate(-90deg);
}
.btn-toggle-filters[aria-expanded="true"] .toggle-icon {
  transform: rotate(0deg);
}
.filter-summary-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 26px;
}
.filter-summary-empty {
  margin: 0;
  color: var(--muted);
  font-size: .84rem;
  line-height: 1.4;
}
.filter-summary-active {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: .84rem;
  line-height: 1.4;
}
.filter-summary-active[hidden] {
  display: none !important;
}
.filter-summary-label {
  color: var(--text);
  font-weight: 600;
  font-size: .84rem;
  flex: none;
}
.filter-summary-chips {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border: 1px solid rgb(8 127 140 / .3);
  border-radius: 7px;
  background: var(--accent-soft);
  color: var(--text);
  font-size: .78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s ease;
  user-select: none;
}
.filter-chip:hover {
  background: rgb(196 61 88 / .12);
  border-color: var(--down);
  color: var(--down);
}
.filter-chip .chip-text {
  font-weight: 500;
}
.filter-chip .chip-remove {
  font-weight: 700;
  font-size: .88rem;
  line-height: 1;
  color: var(--accent);
  transition: color .15s;
}
.filter-chip:hover .chip-remove {
  color: var(--down);
}
.filter-summary-match {
  color: var(--muted);
  font-size: .82rem;
  font-variant-numeric: tabular-nums;
  flex: none;
}
.filter-grid[hidden] {
  display: none !important;
}
.filter-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
}
.filter-card {
  grid-column: span 2;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.filter-card-ni,
.filter-card-perf {
  grid-column: span 3;
}
.filter-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  min-height: 22px;
}
.filter-range-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
}
.input-wrap {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  padding: 0 8px;
  transition: border-color .15s, box-shadow .15s;
}
.input-wrap:focus-within {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 2px rgb(53 102 214 / .12);
}
.input-label {
  color: var(--muted);
  font-size: .72rem;
  font-weight: 600;
  margin-right: 4px;
  flex: none;
}
.input-wrap input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  font-size: .84rem;
  color: var(--text);
  padding: 0;
}
.input-wrap input:focus {
  outline: none;
}
.range-sep {
  color: var(--muted);
  font-size: .8rem;
  flex: none;
}
.filter-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.preset-chip {
  padding: 3px 7px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-2);
  font-size: .73rem;
  font-weight: 500;
  transition: all .15s;
}
.preset-chip:hover {
  border-color: var(--accent-2);
  color: var(--accent-2);
}
.preset-chip.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}
.preset-chip.clear-chip {
  color: var(--muted);
  border-style: dashed;
}
.preset-chip.clear-chip:hover {
  color: var(--down);
  border-color: var(--down);
}
.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .75rem;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.checkbox-label input {
  margin: 0;
  accent-color: var(--accent);
}
.ni-active-period-name,
.perf-active-period-name {
  color: var(--accent);
  font-size: .75rem;
  font-weight: 700;
}
.ni-period-selector,
.perf-period-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.ni-pill-btn,
.perf-pill-btn {
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-2);
  font-size: .73rem;
  font-weight: 600;
  transition: all .15s;
}
.ni-pill-btn:hover,
.perf-pill-btn:hover {
  border-color: var(--border-strong);
  color: var(--text);
}
.ni-pill-btn.active,
.perf-pill-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.ni-pill-btn.has-filter:not(.active),
.perf-pill-btn.has-filter:not(.active) {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

/* --- Table --- */
.table-panel {
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.table-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.search { position: relative; display: flex; flex: 0 1 300px; }
.search svg { position: absolute; top: 50%; left: 11px; width: 15px; height: 15px; transform: translateY(-50%); fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; pointer-events: none; }
.search input, .table-toolbar select { height: 36px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); font-size: .88rem; transition: border-color .15s; }
.search input { width: 100%; padding: 0 12px 0 34px; }
.table-toolbar select { padding: 0 32px 0 12px; appearance: none; background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='m3 4.5 3 3 3-3' fill='none' stroke='%2368788d' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 10px center / 12px; }
.search input:hover, .table-toolbar select:hover { border-color: var(--border-strong); }
.search input:focus, .table-toolbar select:focus { border-color: var(--accent-2); outline: none; box-shadow: 0 0 0 3px rgb(53 102 214 / .14); }
.result-count { margin: 0 0 0 auto; color: var(--muted); font-size: .82rem; }

.table-wrap {
  max-height: 74vh;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  border-radius: 0 0 var(--radius) var(--radius);
  scrollbar-color: var(--border-strong) transparent;
}
table { width: 100%; border-collapse: separate; border-spacing: 0; font-variant-numeric: tabular-nums; }
th, td { padding: 8px 14px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
tbody tr:last-child > * { border-bottom: 0; }
thead th { position: sticky; top: 0; z-index: 2; padding-top: 11px; padding-bottom: 11px; background: var(--surface-2); color: var(--muted); font-size: .72rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; box-shadow: inset 0 -1px 0 var(--border); border-bottom: 0; }
thead th button { display: inline-flex; align-items: center; gap: 6px; padding: 0; border: 0; background: none; color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit; }
thead th button:hover { color: var(--text); }
thead th.active { color: var(--accent); }
.sort-icon { opacity: 0; font-size: .8rem; transition: opacity .15s; }
thead th button:hover .sort-icon, thead th button:focus-visible .sort-icon { opacity: .8; }
.badge { padding: 1px 6px; border-radius: 5px; background: var(--accent); color: var(--accent-ink); font-size: .68rem; font-weight: 800; letter-spacing: 0; }
.num { text-align: right; }
thead th.num button { flex-direction: row-reverse; }
td.num { color: var(--text-2); font-size: .9rem; }
td.active { background: rgb(8 127 140 / .04); color: var(--text); }
th.last-active, td.last-active { box-shadow: inset -2px 0 0 rgb(8 127 140 / .28); }
td.num.up { color: var(--up); }
td.num.down { color: var(--down); }

.delta { display: inline-block; min-width: 64px; padding: 2px 7px; border-radius: 6px; font-weight: 600; text-align: right; }
td.up .delta { background: var(--up-soft); }
td.down .delta { background: var(--down-soft); }

tbody tr { transition: background .1s; }
tbody tr[data-symbol] { cursor: pointer; }
tbody tr:hover > *, tbody tr:focus-within > * { background-color: var(--surface-3); }

.rank-col {
  position: sticky;
  left: 0;
  z-index: 2;
  width: var(--rank-w);
  min-width: var(--rank-w);
  max-width: var(--rank-w);
  box-sizing: border-box;
  padding-left: 8px;
  padding-right: 10px;
  background: var(--surface);
  color: var(--muted);
  font-size: .85rem;
  font-weight: 600;
  text-align: right;
}
.rank-col small { display: block; color: var(--muted); font-size: .68rem; font-weight: 500; opacity: .8; }
thead .rank-col { z-index: 4; background: var(--surface-2); }
.security-col {
  position: sticky;
  left: var(--rank-w);
  z-index: 2;
  min-width: 200px;
  max-width: 260px;
  background: var(--surface);
  box-shadow: 4px 0 8px -2px rgba(15, 23, 42, 0.08), inset -1px 0 0 var(--border);
  font-weight: 400;
  white-space: normal;
}
thead .security-col {
  z-index: 4;
  background: var(--surface-2);
  box-shadow: 4px 0 8px -2px rgba(15, 23, 42, 0.08), inset -1px 0 0 var(--border);
}
.security-line { display: flex; align-items: center; gap: 10px; min-width: 0; }
.symbol { display: block; flex: none; color: var(--text); font-weight: 700; letter-spacing: .01em; }
button.symbol { padding: 0; border: 0; background: none; text-align: left; transition: color .15s; }
tbody tr:hover button.symbol, button.symbol:focus-visible { color: var(--accent); }
.name { display: block; overflow: hidden; color: var(--text-2); font-size: .84rem; text-overflow: ellipsis; white-space: nowrap; }
.sector { display: flex; align-items: center; gap: 5px; min-width: 0; overflow: hidden; color: var(--muted); font-size: .7rem; white-space: nowrap; text-overflow: ellipsis; }
.sector-name { overflow: hidden; text-overflow: ellipsis; }
.dot { flex: none; width: 7px; height: 7px; border-radius: 2px; background: hsl(var(--hue) 70% 62%); }
.status { padding: 40px; color: var(--muted); text-align: center; }

/* --- Methodology & footer --- */
.notes { margin-top: 16px; padding: 0 20px; color: var(--text-2); font-size: .87rem; }
.notes summary { display: flex; align-items: baseline; gap: 12px; padding: 16px 0; cursor: pointer; list-style: none; }
.notes summary::-webkit-details-marker { display: none; }
.notes summary::before { content: "›"; color: var(--muted); font-size: 1.1rem; transition: transform .15s; }
.notes[open] summary::before { transform: rotate(90deg); }
.notes summary h2 { margin: 0; color: var(--text); font-size: .95rem; }
.notes ul { margin: 0; padding: 0 0 16px 22px; }
.notes li { margin-bottom: 6px; }
.notes strong { color: var(--text); }
.site-footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin-top: 22px; color: var(--muted); font-size: .78rem; }
.site-footer p { margin: 0; }

/* --- Security detail view --- */
body.detail-open { overflow: hidden; }
.detail {
  width: min(1120px, calc(100% - 40px)); max-width: none; max-height: calc(100% - 40px);
  padding: 0; border: 1px solid var(--border-strong); border-radius: 18px;
  background: var(--bg); color: var(--text); box-shadow: 0 30px 90px rgb(35 55 80 / .22);
}
.detail[open] { animation: detail-in .18s ease-out; }
@keyframes detail-in { from { opacity: 0; transform: translateY(8px) scale(.99); } }
.detail::backdrop { background: rgb(23 35 51 / .34); backdrop-filter: blur(4px); }
.detail-inner { max-height: calc(100vh - 42px); padding: 22px 28px 28px; overflow-y: auto; }
.detail-navigation { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 8px; }
.detail-back { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text-2); font-size: .85rem; font-weight: 500; }
.detail-back:hover { border-color: var(--border-strong); color: var(--text); }
.detail-nav-actions { display: inline-flex; align-items: center; gap: 8px; }
.detail-share { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text-2); font-size: .84rem; font-weight: 600; cursor: pointer; transition: all .15s ease; }
.detail-share:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.detail-share svg { width: 14px; height: 14px; flex-shrink: 0; }
.detail-rank-nav { display: inline-flex; gap: 6px; }
.detail-rank-nav button { width: 34px; height: 34px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text-2); font-size: 1.1rem; font-weight: 700; }
.detail-rank-nav button:not(:disabled):hover { border-color: var(--accent-2); color: var(--text); }
.detail-rank-nav button:disabled { cursor: default; opacity: .35; }
.detail-header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; }
.detail-symbol { display: inline-block; margin: 0; padding: 2px 8px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); font-size: .8rem; font-weight: 800; letter-spacing: .06em; }
.detail-header h2 { margin: 8px 0 2px; font-size: clamp(1.5rem, 3vw, 2.1rem); font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.detail-sector { margin: 0; color: var(--muted); font-size: .88rem; }
.detail-quote { display: grid; justify-items: end; gap: 2px; text-align: right; }
.detail-quote strong { font-size: 2.1rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.detail-quote span { font-weight: 600; font-variant-numeric: tabular-nums; }
.detail-quote small { color: var(--muted); font-size: .82rem; }

.range-tabs { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 4px; margin-bottom: 14px; padding: 4px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.range-tabs button { display: grid; gap: 1px; padding: 7px 4px; border: 0; border-radius: 8px; background: transparent; text-align: center; transition: background .15s; }
.range-tabs button span { font-size: .86rem; font-weight: 700; }
.range-tabs button small { color: var(--muted); font-size: .72rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.range-tabs button small.up { color: var(--up); }
.range-tabs button small.down { color: var(--down); }
.range-tabs button:hover { background: var(--surface-2); }
.range-tabs button[aria-pressed="true"] { background: var(--surface-3); box-shadow: 0 0 0 1px var(--border-strong), 0 2px 8px rgb(35 55 80 / .1); }

.chart-card { position: relative; padding: 14px 16px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.chart-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 4px; }
.chart-caption { margin: 0; color: var(--muted); font-size: .8rem; }
.log-toggle { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: .82rem; cursor: pointer; }
.log-toggle input { accent-color: var(--accent); }
.chart { min-height: 260px; }
.chart-status { display: grid; place-items: center; min-height: 260px; margin: 0; color: var(--muted); }
.chart-svg { display: block; width: 100%; height: auto; overflow: visible; touch-action: pan-y; }
.chart-svg:focus { outline: none; }
.chart-svg:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 4px; border-radius: 6px; }
.chart-svg .grid line { stroke: var(--border); stroke-width: 1; }
.chart-svg text { fill: var(--muted); font-family: var(--font); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart-svg .baseline { stroke: var(--muted); stroke-dasharray: 3 4; opacity: .5; }
.chart-svg .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-svg .area { fill: url(#area-fill); }
.chart-svg.up .line { stroke: var(--up); }
.chart-svg.down .line { stroke: var(--down); }
.chart-svg.up .fill-top { stop-color: var(--up); stop-opacity: .22; }
.chart-svg.down .fill-top { stop-color: var(--down); stop-opacity: .22; }
.chart-svg .fill-bottom { stop-color: var(--surface); stop-opacity: 0; }
.chart-svg .cursor line { stroke: var(--text); stroke-opacity: .35; stroke-dasharray: 2 3; }
.chart-svg .cursor circle { fill: var(--bg); stroke: var(--text); stroke-width: 2; }
.chart-tooltip {
  position: absolute; z-index: 2; display: grid; gap: 1px; padding: 8px 11px; pointer-events: none;
  border: 1px solid var(--border-strong); border-radius: 9px; background: rgb(255 255 255 / .97);
  box-shadow: 0 10px 24px rgb(35 55 80 / .16); font-size: .8rem; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.chart-tooltip[hidden] { display: none; }
.chart-tooltip strong { font-size: 1rem; }
.chart-tooltip span:first-child { color: var(--muted); }

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.detail-grid section { padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.detail-grid h3 { margin: 0 0 12px; color: var(--muted); font-size: .72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 18px; margin: 0; }
.stats div { min-width: 0; }
.stats dt { color: var(--muted); font-size: .78rem; }
.stats dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.stats dd small { display: block; color: var(--muted); font-size: .74rem; font-weight: 400; }
.detail-note { margin: 14px 0 0; color: var(--muted); font-size: .78rem; }

/* --- Detail Multi-Period Performance Breakdown --- */
.detail-perf-panel {
  margin-top: 14px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.detail-perf-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 12px;
}
.detail-perf-head h3 {
  margin: 0;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.perf-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.detail-perf-table {
  width: 100%;
  font-size: .84rem;
}
.detail-perf-table th, .detail-perf-table td {
  padding: 6px 10px;
}
.detail-perf-table thead th {
  background: var(--surface-2);
  font-size: .68rem;
}
.detail-perf-table th:first-child,
.detail-perf-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--surface);
  font-weight: 700;
  box-shadow: 2px 0 6px -2px rgba(15, 23, 42, 0.1), inset -1px 0 0 var(--border);
}
.detail-perf-table thead th:first-child {
  background: var(--surface-2);
  z-index: 3;
}
.detail-perf-table tr.active td {
  background: var(--accent-soft);
  font-weight: 600;
}
.detail-perf-table tr.active td:first-child {
  background: var(--accent-soft);
}
.detail-perf-table tbody tr {
  cursor: pointer;
}
.detail-perf-table tbody tr:hover td {
  background: var(--surface-3);
}

/* --- Responsive --- */
@media (max-width: 1024px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  :root { --rank-w: 46px; }
  .filter-grid { grid-template-columns: 1fr; }
  .filter-card, .filter-card-ni, .filter-card-perf { grid-column: span 1; }
  main, .appbar-inner { width: calc(100% - 24px); }
  .appbar-inner { gap: 8px; }
  .hero { padding: 24px 0 16px; }
  .lede { font-size: .93rem; }
  .kpi { padding: 12px 14px; }
  .kpi-value { font-size: 1.3rem; }
  .kpi-note { white-space: normal; line-height: 1.3; }

  .filter-panel { padding: 14px; }
  .filter-panel-head { flex-direction: column; align-items: stretch; gap: 12px; }
  .filter-head-left { gap: 8px; }
  .filter-title-row { justify-content: space-between; }
  .btn-clear-all { align-self: flex-start; min-height: 34px; padding: 6px 12px; }

  .input-wrap { height: 38px; }
  .input-wrap input, .search input, .table-toolbar select { font-size: 16px; }
  .filter-chip { padding: 5px 10px; font-size: .8rem; min-height: 32px; }
  .preset-chip { padding: 6px 10px; font-size: .78rem; min-height: 34px; }
  .ni-pill-btn, .perf-pill-btn { padding: 6px 10px; font-size: .78rem; min-height: 34px; }

  .search { flex: 1 1 100%; }
  .search input, .table-toolbar select { height: 42px; }
  .table-toolbar select { flex: 1 1 auto; }

  th, td { padding: 8px 10px; }
  .rank-col { padding-left: 4px; padding-right: 6px; font-size: .8rem; }
  .security-col { min-width: 140px; max-width: 160px; padding: 8px 8px; }
  .security-line { gap: 6px; }
  .symbol { font-size: .84rem; }
  .name { font-size: .8rem; }
  .sector { font-size: .68rem; }

  .site-footer { flex-direction: column; }
  .detail { width: 100%; height: 100dvh; max-height: 100dvh; margin: 0; border: 0; border-radius: 0; }
  .detail-inner { max-height: 100dvh; padding: 14px 14px calc(24px + env(safe-area-inset-bottom)); }
  .range-tabs {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 4px;
    padding: 4px;
  }
  .range-tabs::-webkit-scrollbar { display: none; }
  .range-tabs button { flex: 0 0 auto; min-width: 58px; padding: 6px 8px; }

  .detail-grid { grid-template-columns: 1fr; }
  .detail-quote { justify-items: start; text-align: left; }
}
@media (max-width: 420px) {
  .appbar-inner { height: 54px; }
  .brand-mark { width: 26px; height: 26px; }
  .data-status { padding: 4px 9px; font-size: .74rem; }
  .brand span { display: none; }
  .kpis { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
