:root {
  --bg: #ffffff; --surface: #f4f6f7; --ink: #15232d; --muted: #5c6b75; --rule: #e1e6e9;
  --accent: #2457c5; --up: #0b7a55; --down: #c23a2b; --note-bg: #eef3fd;
  --radius-s: 6px; --radius-m: 10px;
  color-scheme: light;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f171c; --surface: #16222a; --ink: #e6ecef; --muted: #93a3ad; --rule: #26343d;
    --accent: #84a9ff; --up: #3cc48e; --down: #f2715f; --note-bg: #17263a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f171c; --surface: #16222a; --ink: #e6ecef; --muted: #93a3ad; --rule: #26343d;
  --accent: #84a9ff; --up: #3cc48e; --down: #f2715f; --note-bg: #17263a;
  color-scheme: dark;
}
html { scroll-padding-top: env(safe-area-inset-top, 0px); background: var(--bg); }
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: 'Public Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 16px; line-height: 1.5;
}
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--bg); }
a { color: var(--accent); text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
h1, h2 { margin: 0; line-height: 1.2; letter-spacing: -0.01em; }
h2 { font-size: 1.125rem; font-weight: 650; }
table, .stat-list, .quote, .range { font-variant-numeric: tabular-nums; }
.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 20px; }

.site-head { border-bottom: 1px solid var(--rule); background: var(--bg); position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; }
.site-head-inner { display: flex; align-items: center; gap: 24px; height: 60px; }
.brand { font-weight: 750; font-size: 1.15rem; color: var(--ink); text-decoration: none; letter-spacing: -0.02em; }
.search { position: relative; flex: 1; max-width: 460px; }
.search-input { width: 100%; height: 40px; padding: 0 14px; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid transparent; border-radius: var(--radius-s); }
.search-input:focus { outline: none; border-color: var(--accent); background: var(--bg); }
.search-list { position: absolute; top: calc(100% + 6px); left: 0; right: 0; margin: 0; padding: 6px; list-style: none; background: var(--bg); border: 1px solid var(--rule); border-radius: var(--radius-m); box-shadow: 0 12px 32px -12px rgba(21,35,45,.35); z-index: 20; }
.search-list[hidden] { display: none; }
.search-item { display: grid; grid-template-columns: 72px 1fr auto; gap: 10px; align-items: baseline; padding: 8px 10px; border-radius: var(--radius-s); cursor: pointer; }
.search-item:hover, .search-item.is-active { background: var(--surface); }
.search-symbol { font-weight: 700; }
.search-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-meta, .search-empty { color: var(--muted); font-size: 0.85rem; }
.search-empty { padding: 8px 10px; }

.is-up { color: var(--up); }
.is-down { color: var(--down); }
.range { display: flex; flex-wrap: wrap; gap: 4px; margin: 20px 0 8px; }
.range-btn { font: inherit; font-size: 0.875rem; font-weight: 600; color: var(--muted); background: none; border: 0; padding: 6px 12px; border-radius: var(--radius-s); cursor: pointer; }
.range-btn:hover, .range-btn[aria-pressed="true"] { color: var(--ink); background: var(--surface); }
.chart { position: relative; width: 100%; height: 300px; color: var(--muted); }
.chart.is-up { color: var(--up); }
.chart.is-down { color: var(--down); }
.chart svg { display: block; touch-action: pan-y; cursor: crosshair; }
.chart-line { fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.chart-grid { stroke: var(--rule); stroke-width: 1; }
.chart-axis { fill: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.chart-cross { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-dot { fill: currentColor; stroke: var(--bg); stroke-width: 2; }

.block { margin-top: 48px; }
.block > h2 { margin-bottom: 14px; }
.block-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; margin-bottom: 14px; }
.tabs { display: flex; gap: 2px; background: var(--surface); padding: 3px; border-radius: var(--radius-s); }
.tab { font: inherit; border: 0; background: none; cursor: pointer; padding: 5px 12px; border-radius: 4px; font-size: 0.875rem; font-weight: 600; color: var(--muted); }
.tab:hover { color: var(--ink); }
.tab[aria-pressed="true"] { background: var(--bg); color: var(--ink); box-shadow: 0 1px 2px rgba(21,35,45,.12); }
.tabs-small { margin-left: auto; }
@media (max-width: 640px) { .tabs-small { margin-left: 0; } }
.fine { color: var(--muted); font-size: 0.825rem; margin: 0 0 10px; }

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.fin-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.fin-table th, .fin-table td { padding: 8px 12px; border-bottom: 1px solid var(--rule); text-align: right; white-space: nowrap; }
.fin-table thead th { color: var(--muted); font-weight: 600; font-size: 0.825rem; }
.fin-table th[scope="row"], .fin-table thead th:first-child { text-align: left; position: sticky; left: 0; background: var(--bg); font-weight: 500; min-width: 220px; }
.fin-table tr.is-strong th, .fin-table tr.is-strong td { font-weight: 700; }
.fin-table tr.is-ratio th, .fin-table tr.is-ratio td { color: var(--muted); }
.fin-table td.is-neg { color: var(--down); }

.about { max-width: 70ch; margin: 0 0 20px; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px 24px; margin: 0; }
.facts dt { color: var(--muted); font-size: 0.825rem; }
.facts dd { margin: 2px 0 0; font-weight: 600; }

.site-foot { border-top: 1px solid var(--rule); margin-top: 64px; padding: 24px 0 40px; color: var(--muted); font-size: 0.85rem; }
@media (max-width: 640px) { .site-head-inner { gap: 14px; } .brand { font-size: 1rem; } }
.notice { background: var(--note-bg); border-radius: var(--radius-m); padding: 14px 18px; font-size: 0.925rem; margin-top: 16px; }
.muted { color: var(--muted); }
.hero { padding: 56px 0 28px; }
.hero h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 750; letter-spacing: -0.02em; }
.hero p { color: var(--muted); margin: 10px 0 0; max-width: 60ch; }
.market { margin-top: 36px; }
.market h2 { margin-bottom: 12px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.tile { display: block; padding: 14px 16px; border: 1px solid var(--rule); border-radius: var(--radius-m); color: var(--ink); text-decoration: none; }
.tile:hover { border-color: var(--accent); }
.tile span { color: var(--muted); font-size: 0.875rem; }
.skeleton { color: var(--muted); padding: 40px 0; }
/* ---- stock page, data-site layout ---- */
.quote-top { padding: 28px 0 0; }
.stock-title { font-size: clamp(1.5rem, 2.6vw, 1.9rem); font-weight: 700; letter-spacing: -0.015em; }
.stock-meta { margin: 4px 0 0; color: var(--muted); font-size: 0.9rem; }
.price-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-top: 14px; font-variant-numeric: tabular-nums; }
.price-big { font-size: clamp(2rem, 4vw, 2.6rem); font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.price-chg { font-size: 1.2rem; font-weight: 600; }
.price-note { margin: 4px 0 0; color: var(--muted); font-size: 0.85rem; }
.subnav { display: flex; gap: 4px; margin: 20px 0 0; border-bottom: 1px solid var(--rule); overflow-x: auto; scrollbar-width: none; }
.subnav a { padding: 10px 14px; color: var(--muted); font-weight: 600; font-size: 0.95rem; text-decoration: none; white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.subnav a:hover { color: var(--ink); }
.subnav a[aria-current="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.overview { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 32px; margin-top: 24px; align-items: start; }
@media (max-width: 1000px) { .overview { grid-template-columns: 1fr; } .chart-card { order: -1; } }
.info-tables { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; align-items: start; }
@media (max-width: 560px) { .info-tables { grid-template-columns: 1fr; } }
.info-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.info-table td { padding: 8px 2px; border-bottom: 1px solid var(--rule); line-height: 1.35; }
.info-table td:first-child { color: var(--muted); white-space: nowrap; padding-right: 10px; }
.info-table td:last-child { text-align: right; font-weight: 600; white-space: nowrap; }
.chart-card { border: 1px solid var(--rule); border-radius: var(--radius-m); padding: 12px 14px 6px; }
.chart-card .range { margin: 0 0 6px; }
.chart-card .chart { height: 320px; }
.chart-head { font-size: 0.9rem; font-weight: 600; margin: 0 0 4px 2px; min-height: 1.4em; }
.chart-head .muted { font-weight: 400; }
.perf { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.perf-item { background: var(--surface); border-radius: var(--radius-s); padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.perf-item span { color: var(--muted); font-size: 0.8rem; }
.perf-item b { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.data-table th { color: var(--muted); font-weight: 600; font-size: 0.8rem; text-align: right; padding: 8px 12px; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.data-table td { text-align: right; padding: 8px 12px; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.data-table th:first-child, .data-table td:first-child { text-align: left; }
.data-table tbody tr:hover { background: var(--surface); }
.block { scroll-margin-top: 72px; }
#overview { scroll-margin-top: 72px; }
.tile-sym { display: block; font-weight: 700; color: var(--accent); font-size: 0.85rem; }
.tile b { display: block; font-weight: 600; font-size: 0.95rem; }
.tile-meta { display: block; }
