:root {
  color-scheme: dark;
  --ink-950: oklch(13% 0.008 120);
  --ink-900: oklch(17% 0.008 120);
  --ink-850: oklch(20% 0.008 120);
  --ink-800: oklch(24% 0.008 120);
  --ink-700: oklch(33% 0.009 120);
  --paper-100: oklch(97% 0.006 95);
  --paper-200: oklch(90% 0.007 95);
  --paper-400: oklch(70% 0.008 95);
  --paper-500: oklch(60% 0.008 95);
  --risk: oklch(68% 0.19 32);
  --risk-soft: oklch(28% 0.06 32);
  --warn: oklch(76% 0.14 78);
  --warn-soft: oklch(29% 0.04 78);
  --good: oklch(75% 0.11 145);
  --good-soft: oklch(28% 0.04 145);
  --teal: oklch(73% 0.08 185);
  --blue: oklch(72% 0.08 245);
  --purple: oklch(70% 0.08 310);
  --border: oklch(30% 0.009 120);
  --border-strong: oklch(42% 0.01 120);
  --focus: oklch(82% 0.14 92);
  --font-display: "Songti SC", "STSong", "Noto Serif CJK SC", serif;
  --font-body: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-quart: cubic-bezier(0.25, 1, 0.5, 1);
  --sidebar: 224px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--ink-950);
  font-family: var(--font-body);
  font-size: 16px;
  letter-spacing: 0;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--paper-100);
  background: var(--ink-950);
  font-variant-numeric: tabular-nums;
  line-height: 1.5;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

button,
select,
input {
  font: inherit;
  letter-spacing: 0;
}

button,
select {
  color: inherit;
}

button {
  cursor: pointer;
}

button:focus,
select:focus,
input:focus {
  outline: none;
}

button:focus-visible,
select:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.8;
}

.skip-link,
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.skip-link:focus {
  z-index: 100;
  top: 12px;
  left: 12px;
  width: auto;
  height: auto;
  clip: auto;
  padding: 10px 14px;
  color: var(--ink-950);
  background: var(--focus);
  border-radius: 4px;
}

.app-shell {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  display: flex;
  width: var(--sidebar);
  flex-direction: column;
  padding: 28px 20px 24px;
  background: var(--ink-900);
  border-right: 1px solid var(--border);
}

.brand,
.mobile-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  place-items: center;
  color: var(--ink-950);
  background: var(--paper-100);
  border-radius: 4px;
  font-family: Georgia, serif;
  font-size: 1.35rem;
  font-weight: 700;
}

.brand div {
  display: grid;
  line-height: 1.25;
}

.brand strong {
  font-family: var(--font-display);
  font-size: 1.05rem;
}

.brand span:not(.brand-mark) {
  color: var(--paper-500);
  font-size: 0.75rem;
}

.primary-nav {
  display: grid;
  gap: 6px;
  margin-top: 52px;
}

.nav-item {
  position: relative;
  display: grid;
  min-height: 46px;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  color: var(--paper-400);
  background: transparent;
  border: 0;
  border-radius: 6px;
  text-align: left;
  transition: color 180ms var(--ease-quart), background-color 180ms var(--ease-quart), transform 100ms var(--ease-quart);
}

.nav-item:hover {
  color: var(--paper-100);
  background: var(--ink-850);
}

.nav-item:active {
  transform: scale(0.985);
}

.nav-item.is-active {
  color: var(--ink-950);
  background: var(--paper-100);
  font-weight: 600;
}

.nav-count {
  min-width: 22px;
  padding: 1px 6px;
  border-radius: 999px;
  color: var(--paper-100);
  background: var(--risk-soft);
  font-size: 0.75rem;
  text-align: center;
}

.nav-item.is-active .nav-count {
  color: var(--paper-100);
  background: var(--risk);
}

.source-status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding: 14px 12px;
  border-top: 1px solid var(--border);
}

.source-status div {
  display: grid;
  gap: 2px;
}

.source-status strong {
  font-size: 0.8rem;
  font-weight: 500;
}

.source-status span:not(.status-dot) {
  color: var(--paper-500);
  font-size: 0.7rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 0 4px var(--good-soft);
}

.workspace {
  width: calc(100% - var(--sidebar));
  min-height: 100vh;
  margin-left: var(--sidebar);
  padding: 28px 32px 20px;
}

.topbar {
  display: flex;
  min-height: 56px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.mobile-brand {
  display: none;
}

.eyebrow,
.section-kicker,
.panel-kicker {
  margin: 0;
  color: var(--paper-500);
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.3;
  text-transform: uppercase;
}

.title-group h1 {
  margin: 2px 0 0;
  font-family: var(--font-display);
  font-size: 1.55rem;
  line-height: 1.25;
}

.topbar-actions,
.detail-tools {
  display: flex;
  align-items: center;
  gap: 12px;
}

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  transition: color 180ms var(--ease-quart), background-color 180ms var(--ease-quart), border-color 180ms var(--ease-quart), transform 100ms var(--ease-quart);
}

.button:active,
.icon-button:active,
.text-button:active {
  transform: scale(0.97);
}

.button-secondary {
  color: var(--paper-100);
  background: var(--ink-850);
  border-color: var(--border);
}

.button-secondary:hover {
  background: var(--ink-800);
  border-color: var(--border-strong);
}

.button-light {
  color: var(--ink-950);
  background: var(--paper-100);
}

.button-light:hover {
  background: var(--paper-200);
}

.icon-button {
  display: grid;
  width: 44px;
  height: 44px;
  padding: 0;
  place-items: center;
  color: var(--paper-400);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: color 180ms var(--ease-quart), background-color 180ms var(--ease-quart), transform 100ms var(--ease-quart);
}

.icon-button:hover {
  color: var(--paper-100);
  background: var(--ink-800);
}

.filter-bar {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) minmax(190px, 1fr) auto;
  gap: 1px;
  margin: 28px 0 40px;
  overflow: hidden;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.filter-field {
  min-width: 0;
  padding: 10px 14px;
  background: var(--ink-900);
}

.filter-field label,
.filter-label {
  display: block;
  margin-bottom: 2px;
  color: var(--paper-500);
  font-size: 0.7rem;
}

.select-wrap {
  position: relative;
}

.select-wrap select,
.detail-tools select,
.search-field input {
  width: 100%;
  height: 28px;
  padding: 0 28px 0 0;
  color: var(--paper-100);
  background: transparent;
  border: 0;
  appearance: none;
  font-size: 0.875rem;
  font-weight: 600;
}

.select-wrap svg {
  position: absolute;
  top: 50%;
  right: 0;
  width: 16px;
  transform: translateY(-50%);
  pointer-events: none;
}

.filter-mode {
  min-width: 190px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2px;
  padding: 2px;
  background: var(--ink-950);
  border-radius: 5px;
}

.segmented button {
  min-height: 28px;
  padding: 0 14px;
  color: var(--paper-500);
  background: transparent;
  border: 0;
  border-radius: 4px;
  font-size: 0.75rem;
  transition: color 160ms var(--ease-quart), background-color 160ms var(--ease-quart);
}

.segmented button.is-active {
  color: var(--ink-950);
  background: var(--paper-100);
  font-weight: 600;
}

.view[hidden] {
  display: none;
}

.view.is-active {
  animation: view-in 360ms var(--ease-out) both;
}

.section-heading,
.panel-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.section-heading {
  margin-bottom: 24px;
}

.section-heading h2 {
  max-width: 720px;
  margin: 6px 0 0;
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 600;
  line-height: 1.25;
}

.text-button,
.sort-button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 6px;
  padding: 0;
  color: var(--paper-400);
  background: transparent;
  border: 0;
  font-size: 0.8rem;
  transition: color 180ms var(--ease-quart), transform 100ms var(--ease-quart);
}

.text-button:hover,
.sort-button:hover {
  color: var(--paper-100);
}

.text-button svg,
.sort-button svg {
  width: 15px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.kpi {
  position: relative;
  min-width: 0;
  padding: 22px 22px 20px;
  border-right: 1px solid var(--border);
}

.kpi:last-child {
  border-right: 0;
}

.kpi-primary::before {
  position: absolute;
  top: -1px;
  left: 22px;
  width: 36px;
  height: 2px;
  background: var(--paper-100);
  content: "";
}

.kpi-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--paper-400);
  font-size: 0.78rem;
}

.kpi-label svg {
  width: 16px;
  color: var(--paper-500);
}

.kpi-value {
  display: inline-block;
  margin-top: 14px;
  font-family: var(--font-display);
  font-size: 2.25rem;
  font-weight: 600;
  line-height: 1;
}

.kpi-value span {
  margin-left: 3px;
  color: var(--paper-400);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
}

.kpi-unit {
  margin-left: 5px;
  color: var(--paper-500);
  font-size: 0.75rem;
}

.kpi-meta {
  display: flex;
  min-height: 18px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 16px;
  color: var(--paper-500);
  font-size: 0.68rem;
}

.kpi-meta span:last-child {
  white-space: nowrap;
}

.meter {
  height: 3px;
  margin: 15px 0 0;
  overflow: hidden;
  background: var(--ink-700);
}

.meter span {
  display: block;
  width: 99.9%;
  height: 100%;
  background: var(--warn);
  transform-origin: left;
  transition: transform 420ms var(--ease-out), width 420ms var(--ease-out), background-color 180ms var(--ease-quart);
}

.risk-dots {
  display: grid;
  grid-template-columns: repeat(14, 1fr);
  gap: 3px;
  margin-top: 15px;
}

.risk-dots i {
  height: 3px;
  background: var(--ink-700);
}

.risk-dots i.is-risk {
  background: var(--risk);
}

.decision-strip {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  gap: 20px;
  margin: 32px 0;
  padding: 24px;
  color: var(--ink-950);
  background: var(--warn);
  border-radius: 6px;
}

.decision-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid color-mix(in oklch, var(--ink-950) 25%, transparent);
  border-radius: 50%;
}

.decision-icon svg {
  width: 22px;
  height: 22px;
}

.decision-copy span {
  font-size: 0.7rem;
  font-weight: 700;
}

.decision-copy h3 {
  margin: 2px 0 4px;
  font-family: var(--font-display);
  font-size: 1.2rem;
  line-height: 1.35;
}

.decision-copy p {
  max-width: 860px;
  margin: 0;
  color: oklch(27% 0.025 78);
  font-size: 0.8rem;
}
