:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #667085;
  --line: #d9dfeb;
  --surface: #ffffff;
  --canvas: #f4f7fb;
  --accent: #1459d9;
  --accent-soft: #eaf1ff;
  --danger: #b42318;
  --success: #067647;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, sans-serif; color: var(--ink); background: var(--canvas); font-size: 16px; }
a { color: var(--accent); text-decoration: none; }
button, input, select { font: inherit; }
button { cursor: pointer; }

.topbar { height: 64px; padding: 0 28px; display: flex; align-items: center; justify-content: space-between; background: #0d1b33; color: white; border-bottom: 1px solid #253652; }
.brand { color: inherit; font-weight: 750; letter-spacing: -.01em; }
.course { margin-left: 12px; color: #aab7cc; font-size: .875rem; }
.text-button { border: 0; color: white; background: transparent; padding: 8px 0; }

.app-shell { min-height: calc(100vh - 64px); display: grid; grid-template-columns: 260px minmax(0, 1fr); }
.sidebar { background: var(--surface); border-right: 1px solid var(--line); padding: 24px 16px; }
.nav-label, .eyebrow { margin: 0 0 10px; color: var(--muted); font-weight: 700; font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; }
.nav-label-spaced { margin-top: 26px; }
.nav-item { padding: 11px 12px; display: flex; gap: 8px; justify-content: space-between; color: #344054; border-radius: 7px; margin-bottom: 4px; font-size: .9rem; }
.nav-item strong { color: var(--muted); font-size: .78rem; }
.nav-item.active { color: var(--accent); background: var(--accent-soft); }
.source-note { margin-top: 28px; padding: 14px; border: 1px solid var(--line); border-radius: 8px; display: grid; gap: 5px; font-size: .82rem; color: var(--muted); }
.source-note strong { color: var(--ink); }
.warning-note { border-color: #e8cf91; background: #fffaf0; }
.warning-note strong { color: #7a4d00; }

.workspace { min-width: 0; padding: 30px; }
.dataset-heading { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; margin-bottom: 24px; }
h1 { margin: 0 0 8px; font-size: 1.75rem; letter-spacing: -.035em; }
h2 { margin: 0 0 14px; font-size: 1.05rem; }
.dataset-heading p:not(.eyebrow) { max-width: 820px; margin: 0; color: var(--muted); line-height: 1.55; }
.freshness { min-width: 220px; padding: 12px 14px; background: white; border: 1px solid var(--line); border-radius: 8px; display: grid; gap: 4px; font-size: .8rem; }
.freshness span, .freshness small { color: var(--muted); }
.freshness strong { font-size: .86rem; }
.status { display: inline-flex; width: fit-content; padding: 2px 7px; border-radius: 99px; background: #edf2f7; color: #344054; font-size: .75rem; }
.status.success, .status.resolved { background: #e8f7ef; color: var(--success); }
.status.failed, .status.disputed, .alert.error { background: #fff0ee; color: var(--danger); }

.toolbar { display: flex; justify-content: space-between; gap: 16px; align-items: center; padding: 12px; background: white; border: 1px solid var(--line); border-radius: 9px 9px 0 0; }
.filters { display: flex; gap: 8px; min-width: 0; }
.filters input { width: min(360px, 35vw); }
input, select { min-height: 39px; border: 1px solid #c9d1df; border-radius: 6px; padding: 8px 10px; background: white; color: var(--ink); }
.filters button, .login-form button { border: 0; border-radius: 6px; padding: 9px 16px; background: var(--accent); color: white; font-weight: 700; }
.downloads { display: flex; align-items: center; gap: 6px; white-space: nowrap; font-size: .82rem; color: var(--muted); }
.downloads a { padding: 6px 8px; border: 1px solid var(--line); border-radius: 5px; font-weight: 700; background: white; }
.table-meta { padding: 9px 12px; background: #f9fbfe; border-left: 1px solid var(--line); border-right: 1px solid var(--line); color: var(--muted); font-size: .8rem; }
.table-wrap { overflow: auto; max-height: calc(100vh - 320px); background: white; border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; font-size: .8rem; }
th { position: sticky; top: 0; z-index: 1; text-align: left; background: #eef3f9; color: #475467; font-size: .72rem; text-transform: uppercase; letter-spacing: .035em; }
th, td { padding: 9px 11px; border-bottom: 1px solid #e7ebf2; max-width: 280px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
tbody tr:hover { background: #f7faff; }
.empty { padding: 40px; color: var(--muted); text-align: center; }
.pagination { min-height: 48px; display: flex; align-items: center; justify-content: center; gap: 20px; color: var(--muted); font-size: .85rem; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #0d1b33; }
.login-card { width: min(420px, 100%); background: white; padding: 34px; border-radius: 12px; box-shadow: 0 20px 60px #0005; }
.login-card h1 { font-size: 2rem; }
.muted { color: var(--muted); }
.login-form { display: grid; gap: 16px; margin-top: 24px; }
.login-form label { display: grid; gap: 7px; font-weight: 650; font-size: .88rem; }
.login-form button { min-height: 44px; }
.alert { padding: 10px 12px; border-radius: 6px; margin-top: 16px; font-size: .88rem; }

.detail-shell { padding: 34px; max-width: 1200px; margin: auto; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 24px; }
.panel { background: white; border: 1px solid var(--line); border-radius: 9px; padding: 20px; min-width: 0; }
.panel.wide { grid-column: 1 / -1; }
.long-text { white-space: pre-wrap; line-height: 1.6; color: #344054; }
dl { display: grid; gap: 0; margin: 18px 0 0; }
dl div { display: grid; grid-template-columns: 180px 1fr; gap: 12px; padding: 9px 0; border-top: 1px solid #edf0f5; }
dt { color: var(--muted); }
dd { margin: 0; overflow-wrap: anywhere; }
.mono, code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .8rem; }
.version-row { display: flex; justify-content: space-between; padding: 8px 0; border-top: 1px solid #edf0f5; font-size: .82rem; }

.dashboard-workspace, .docs-workspace { max-width: 1440px; width: 100%; }
.hero-panel { display: flex; align-items: flex-start; justify-content: space-between; gap: 30px; padding: 28px; color: white; background: #0d1b33; border-radius: 12px; }
.hero-panel h1 { max-width: 840px; font-size: clamp(1.8rem, 3vw, 2.7rem); line-height: 1.12; }
.hero-panel p:not(.eyebrow) { max-width: 850px; margin: 12px 0 0; color: #c6d1e2; line-height: 1.6; }
.hero-panel .eyebrow { color: #9fb6de; }
.sample-stamp { min-width: 235px; padding: 16px; display: grid; gap: 5px; border: 1px solid #486086; border-radius: 9px; background: #172947; }
.sample-stamp span, .sample-stamp small { color: #b8c5d9; }
.sample-stamp strong { font-size: 1.12rem; color: #ffd88a; }

.notice { margin-top: 18px; padding: 18px 20px; display: flex; align-items: center; justify-content: space-between; gap: 24px; border: 1px solid var(--line); border-radius: 9px; background: white; }
.notice-warning { border-color: #e5c779; background: #fffaf0; }
.notice p { margin: 5px 0 0; color: #5f4b24; line-height: 1.5; }
.secondary-button { flex: 0 0 auto; padding: 9px 12px; border: 1px solid #c9d1df; border-radius: 6px; background: white; font-weight: 700; font-size: .85rem; }

.section-block { margin-top: 26px; }
.section-heading { margin-bottom: 14px; display: flex; align-items: flex-end; justify-content: space-between; gap: 22px; }
.section-heading.simple { align-items: flex-start; }
.section-heading h2, .next-stage h2, .docs-section h2 { font-size: 1.35rem; margin-bottom: 4px; }
.section-heading p:not(.eyebrow), .chart-heading p { margin: 4px 0 0; color: var(--muted); line-height: 1.5; }
.freshness.compact { min-width: 250px; }
.metric-grid { display: grid; grid-template-columns: repeat(5, minmax(150px, 1fr)); gap: 12px; }
.metric-card { min-height: 122px; padding: 17px; display: flex; flex-direction: column; justify-content: space-between; gap: 8px; background: white; border: 1px solid var(--line); border-radius: 9px; }
.metric-card span { color: var(--muted); font-size: .82rem; }
.metric-card strong { font-size: 1.8rem; letter-spacing: -.04em; }
.metric-card small { color: var(--muted); line-height: 1.35; }

.coverage-grid { display: grid; grid-template-columns: repeat(4, minmax(180px, 1fr)); gap: 12px; }
.coverage-card { padding: 17px; display: grid; gap: 12px; background: white; border: 1px solid var(--line); border-radius: 9px; }
.coverage-card > div { display: flex; justify-content: space-between; gap: 12px; font-size: .88rem; }
.coverage-card > div span { font-weight: 800; color: var(--accent); }
.coverage-card small { color: var(--muted); line-height: 1.4; }
progress { width: 100%; height: 9px; border: 0; border-radius: 99px; overflow: hidden; background: #e8edf5; }
progress::-webkit-progress-bar { background: #e8edf5; border-radius: 99px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 99px; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 99px; }
.coverage-caveat { margin: 12px 0 0; padding: 11px 13px; color: #674d16; background: #fff8e8; border-left: 3px solid #d29a1b; font-size: .85rem; }

.chart-grid { margin-top: 26px; display: grid; grid-template-columns: 1.3fr 1fr; gap: 14px; }
.chart-panel { padding: 20px; }
.chart-heading h2 { margin-bottom: 3px; }
.chart-heading p { min-height: 42px; font-size: .82rem; }
.bar-list { margin-top: 20px; display: grid; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 115px minmax(100px, 1fr) 50px; align-items: center; gap: 10px; font-size: .8rem; }
.bar-row strong { text-align: right; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }

.quality-list { overflow: hidden; background: white; border: 1px solid var(--line); border-radius: 9px; }
.quality-row { min-height: 45px; padding: 10px 14px; display: grid; grid-template-columns: 10px minmax(240px, 1fr) auto; align-items: center; gap: 12px; border-bottom: 1px solid #e9edf3; font-size: .84rem; }
.quality-row:last-child { border-bottom: 0; }
.quality-row > span:last-child { color: var(--muted); }
.quality-dot { width: 9px; height: 9px; border-radius: 50%; background: #98a2b3; }
.quality-dot.ok { background: var(--success); }
.quality-dot.medium { background: #d29a1b; }
.quality-dot.high { background: var(--danger); }

.next-stage { margin-top: 26px; padding: 24px; display: grid; grid-template-columns: 1.4fr 1fr; gap: 32px; color: white; background: #132441; border-radius: 10px; }
.next-stage p:not(.eyebrow) { color: #c6d1e2; line-height: 1.55; }
.next-stage .eyebrow { color: #9fb6de; }
.stage-list { display: grid; align-content: center; gap: 10px; }
.stage-list span { display: flex; align-items: center; gap: 10px; color: #d8e0ec; }
.stage-list strong { width: 27px; height: 27px; display: grid; place-items: center; color: white; background: #285fab; border-radius: 50%; }

.docs-header { padding: 26px; color: white; background: #0d1b33; border-radius: 11px; }
.docs-header p:not(.eyebrow) { max-width: 800px; color: #c6d1e2; line-height: 1.55; }
.docs-header .eyebrow { color: #9fb6de; }
.anchor-nav { margin-top: 20px; display: flex; flex-wrap: wrap; gap: 7px; }
.anchor-nav a { padding: 7px 10px; color: white; border: 1px solid #486086; border-radius: 6px; font-size: .8rem; }
.docs-section { margin-top: 18px; padding: 24px; background: white; border: 1px solid var(--line); border-radius: 9px; scroll-margin-top: 20px; }
.docs-section > p:not(.eyebrow) { max-width: 960px; color: #475467; line-height: 1.65; }
.definition-box { max-width: 780px; margin-top: 16px; padding: 14px; display: grid; grid-template-columns: 170px 1fr; gap: 14px; background: #f5f8fc; border-radius: 7px; }
.docs-table-wrap { overflow-x: auto; }
.docs-table th { position: static; }
.docs-table td { white-space: normal; line-height: 1.45; }
.note-text { padding: 11px 13px; background: #f6f8fb; border-left: 3px solid #8492a6; font-size: .85rem; }
.highlight-section { border-color: #e1bd62; }
.method-list, .limitation-list { padding-left: 22px; color: #344054; line-height: 1.55; }
.method-list li, .limitation-list li { margin: 9px 0; }
.risk-box { margin: 18px 0; padding: 16px; border: 1px solid #e4b2aa; border-radius: 7px; background: #fff4f2; }
.risk-box strong { color: var(--danger); }
.risk-box p { margin: 6px 0 0; color: #7a271a; line-height: 1.5; }
.docs-quality { max-width: 900px; }
.dataset-doc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.dataset-doc-grid article { padding: 17px; border: 1px solid var(--line); border-radius: 8px; }
.dataset-doc-grid article > div { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.dataset-doc-grid h3 { margin: 0; font-size: 1rem; }
.dataset-doc-grid article > div span { color: var(--muted); font-size: .78rem; white-space: nowrap; }
.dataset-doc-grid p { color: var(--muted); font-size: .83rem; line-height: 1.45; }
.dataset-doc-grid code { overflow-wrap: anywhere; }
.docs-next { color: white; border: 0; }
.docs-next > div { max-width: 980px; }

@media (max-width: 850px) {
  .app-shell { width: 100%; min-width: 0; grid-template-columns: minmax(0, 1fr); }
  .sidebar { width: 100%; min-width: 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar nav { width: 100%; min-width: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; }
  .nav-item { min-width: 0; align-items: flex-start; }
  .nav-item span { min-width: 0; overflow-wrap: anywhere; }
  .source-note { display: none; }
  .workspace { width: 100%; min-width: 0; padding: 20px 14px; }
  .dataset-heading, .toolbar { align-items: stretch; flex-direction: column; }
  .freshness { min-width: 0; }
  .downloads { overflow-x: auto; }
  .filters input { width: 100%; }
  .detail-grid { grid-template-columns: 1fr; }
  .panel.wide { grid-column: auto; }
  .hero-panel, .notice, .section-heading { flex-direction: column; align-items: stretch; }
  .sample-stamp { min-width: 0; }
  .metric-grid, .coverage-grid, .chart-grid, .next-stage, .dataset-doc-grid { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bar-row { grid-template-columns: 82px minmax(80px, 1fr) 45px; }
  .quality-row { grid-template-columns: 10px 1fr; }
  .quality-row > span:last-child { grid-column: 2; }
  .definition-box { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .metric-grid { grid-template-columns: 1fr; }
  .hero-panel, .docs-header, .docs-section { padding: 20px; }
}
