:root {
  color-scheme: light;
  --surface-0: #f4f4f2; --surface-1: #fcfcfb; --surface-2: #ffffff; --border: #e3e2dd;
  --text-primary: #0b0b0b; --text-secondary: #52514e; --text-muted: #8a8984;
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100;
  --seq-100: #cde2fb; --seq-300: #6da7ec; --seq-500: #256abf; --seq-700: #0d366b;
  --div-neg: #e34948; --div-mid: #f0efec; --div-pos: #2a78d6;
  --good: #0ca30c; --warning: #fab219; --serious: #ec835a; --critical: #d03b3b;
  --grid: #ecebe7; --radius: 10px; --font: "Inter", "Hiragino Sans", "Noto Sans JP", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --surface-0: #111110; --surface-1: #1a1a19; --surface-2: #222220; --border: #33332f;
    --text-primary: #ffffff; --text-secondary: #c3c2b7; --text-muted: #8f8e86;
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
    --seq-100: #184f95; --seq-300: #256abf; --seq-500: #5598e7; --seq-700: #b7d3f6;
    --div-neg: #e66767; --div-mid: #383835; --div-pos: #3987e5; --grid: #2a2a27;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --surface-0: #111110; --surface-1: #1a1a19; --surface-2: #222220; --border: #33332f;
  --text-primary: #ffffff; --text-secondary: #c3c2b7; --text-muted: #8f8e86;
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
  --seq-100: #184f95; --seq-300: #256abf; --seq-500: #5598e7; --seq-700: #b7d3f6;
  --div-neg: #e66767; --div-mid: #383835; --div-pos: #3987e5; --grid: #2a2a27;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--surface-0); color: var(--text-primary); font-family: var(--font); font-size: 14px; line-height: 1.5; }
a { color: var(--series-1); }
header { display: flex; align-items: center; gap: 16px; padding: 12px 16px; background: var(--surface-1); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; flex-wrap: wrap; }
header h1 { font-size: 16px; margin: 0; font-weight: 600; }
header nav.sister { display: flex; gap: 6px; }
header nav.sister a { font-size: 12px; padding: 3px 8px; border: 1px solid var(--border); border-radius: 999px; color: var(--text-secondary); text-decoration: none; background: var(--surface-2); white-space: nowrap; }
header nav.sister a:hover { color: var(--text-primary); border-color: var(--series-1); }
header .meta { color: var(--text-muted); font-size: 12px; margin-left: auto; display: flex; gap: 12px; align-items: center; }
nav.tabs { display: flex; gap: 4px; padding: 8px 16px 0; background: var(--surface-1); border-bottom: 1px solid var(--border); overflow-x: auto; }
nav.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 12px; color: var(--text-secondary); cursor: pointer; font: inherit; white-space: nowrap; }
nav.tabs button.active { color: var(--text-primary); border-bottom-color: var(--series-1); font-weight: 600; }
main { padding: 16px; max-width: 1400px; margin: 0 auto; }
section.view { display: none; } section.view.active { display: block; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); }
.grid.wide { grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); }
.card { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; min-width: 0; }
.card h2 { font-size: 13px; font-weight: 600; margin: 0 0 8px; color: var(--text-secondary); letter-spacing: .02em; }
.card h3 { font-size: 14px; margin: 0 0 6px; }
.tile { display: flex; flex-direction: column; gap: 2px; }
.tile .value { font-size: 26px; font-weight: 600; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.tile .sub { color: var(--text-muted); font-size: 12px; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 999px; font-size: 12px; border: 1px solid var(--border); color: var(--text-secondary); background: var(--surface-2); }
.badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); }
.badge.go::before { background: var(--good); } .badge.prepare::before { background: var(--warning); } .badge.watch::before { background: var(--text-muted); }
.badge.action::before { background: var(--critical); } .badge.info::before { background: var(--series-1); }
.chart { position: relative; height: 240px; }
.chart.tall { height: 320px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--grid); vertical-align: top; }
th { color: var(--text-secondary); font-weight: 600; font-size: 12px; position: sticky; top: 0; background: var(--surface-1); }
td.num, th.num { text-align: right; }
tr.clickable { cursor: pointer; } tr.clickable:hover { background: var(--surface-2); }
.meter { height: 8px; background: var(--grid); border-radius: 4px; overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--series-1); border-radius: 4px; }
.meter.distress > span { background: var(--series-2); }
.muted { color: var(--text-muted); } .small { font-size: 12px; }
.reasons { margin: 8px 0 0; padding-left: 18px; color: var(--text-secondary); font-size: 12px; }
.opp { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.opp .score { font-size: 28px; font-weight: 600; font-variant-numeric: tabular-nums; }
.opp details { grid-column: 1 / -1; } .opp summary { cursor: pointer; color: var(--text-secondary); font-size: 12px; }
.opp .tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.opp .tags span { font-size: 11px; padding: 1px 6px; border: 1px solid var(--border); border-radius: 4px; color: var(--text-secondary); }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
button.btn, .btn { font: inherit; padding: 6px 12px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-primary); cursor: pointer; }
button.btn.primary { background: var(--series-1); color: #fff; border-color: var(--series-1); }
textarea, select, input { font: inherit; background: var(--surface-2); color: var(--text-primary); border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; }
textarea { width: 100%; min-height: 120px; }
pre.out { background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 8px; max-height: 240px; overflow: auto; font-size: 12px; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--text-secondary); margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.memo { max-width: 860px; } .memo h1, .memo h2, .memo h3 { margin-top: 1.2em; }
.empty { color: var(--text-muted); padding: 24px; text-align: center; border: 1px dashed var(--border); border-radius: var(--radius); }
@media (max-width: 640px) { main { padding: 12px 16px; } .tile .value { font-size: 22px; } .chart { height: 200px; } }
