/* Design system: "Minimalism & Swiss Style" + "B2B Service" palette (UI UX Pro Max).
   Navy primary, single blue accent, slate neutrals, hairline borders, no gradients. */
:root {
  --bg: #f8fafc; --surface: #ffffff; --surface-2: #f1f5f9;
  --ink: #0f172a; --ink-2: #475569; --muted: #64748b;
  --line: #e2e8f0; --line-2: #cbd5e1;
  --primary: #0f172a; --accent: #0369a1; --accent-soft: #e0f2fe;
  --good: #15803d; --bad: #b91c1c; --warn: #b45309;
  --grid: #eef2f6; --axis: #cbd5e1;
  --s1:#2a78d6; --s2:#eb6834; --s3:#1baf7a; --s4:#eda100; --s5:#e87ba4; --s6:#008300; --s7:#6250d6; --s8:#e34948;
  --seq0:#f1f5f9; --seq1:#cde2fb; --seq2:#86b6ef; --seq3:#3987e5; --seq4:#1c5cab; --seq5:#0d366b;
  --r: 6px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:#0b1120; --surface:#111827; --surface-2:#1e293b; --ink:#f1f5f9; --ink-2:#cbd5e1; --muted:#94a3b8;
    --line:#1f2a3c; --line-2:#334155; --primary:#f1f5f9; --accent:#38bdf8; --accent-soft:#0c2a40;
    --good:#22c55e; --bad:#f87171; --warn:#fbbf24; --grid:#1a2333; --axis:#334155;
    --s1:#3987e5; --s2:#d95926; --s3:#199e70; --s4:#c98500; --s5:#d55181; --s6:#008300; --s7:#9085e9; --s8:#e66767;
    --seq0:#1e293b; --seq1:#184f95; --seq2:#1c5cab; --seq3:#2a78d6; --seq4:#6da7ec; --seq5:#cde2fb;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.5 Inter, system-ui, sans-serif; font-feature-settings: "tnum" 1, "cv11" 1; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 24px; }
@media (max-width: 640px) { .wrap { padding: 0 16px; } }

.top { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topin { display: flex; align-items: center; justify-content: space-between; height: 56px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: -.01em; white-space: nowrap; }
.brand em { font-style: normal; font-weight: 500; font-size: 11px; color: var(--muted); border: 1px solid var(--line); padding: 1px 6px; border-radius: 4px; }
.mark { width: 26px; height: 26px; border-radius: 5px; background: var(--primary); color: var(--bg); display: grid; place-items: center; font-size: 13px; font-weight: 700; }
.nav { display: flex; gap: 2px; overflow-x: auto; }
.nav a { padding: 6px 12px; border-radius: var(--r); color: var(--ink-2); font-weight: 500; white-space: nowrap; transition: background .2s, color .2s; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a.on { color: var(--ink); background: var(--surface-2); }
@media (max-width: 640px) { .brand em { display: none; } .nav a { padding: 6px 8px; } }

main { padding: 28px 0 48px; min-height: 70vh; }
.foot { color: var(--muted); font-size: 12px; padding: 24px; border-top: 1px solid var(--line); }

.crumb { color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.crumb a:hover { color: var(--ink); }
.ph { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
h1 { font-size: 24px; letter-spacing: -.02em; margin: 0; font-weight: 600; }
h2 { font-size: 15px; margin: 0; font-weight: 600; letter-spacing: -.01em; }
.sub { color: var(--ink-2); margin: 4px 0 0; }
.note { color: var(--muted); font-size: 12px; margin: 2px 0 0; }

.grid { display: grid; gap: 16px; }
.g4 { grid-template-columns: repeat(4, 1fr); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: 2fr 1fr; }
@media (max-width: 980px) { .g4 { grid-template-columns: repeat(2, 1fr); } .g2, .g3 { grid-template-columns: 1fr; } }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 18px 20px; min-width: 0; }
.ch { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.kpi .l { color: var(--ink-2); font-size: 12px; font-weight: 500; }
.kpi .v { font-size: 26px; font-weight: 600; letter-spacing: -.02em; margin-top: 4px; }
.kpi .d { font-size: 12px; margin-top: 2px; color: var(--muted); }
.up { color: var(--good); } .down { color: var(--bad); }
.bar-mini { height: 4px; background: var(--surface-2); border-radius: 2px; margin-top: 10px; overflow: hidden; }
.bar-mini i { display: block; height: 100%; background: var(--accent); border-radius: 2px; }

/* filter bar */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin-bottom: 16px; }
.filters .lbl { font-size: 12px; color: var(--muted); font-weight: 500; margin-right: 4px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.seg button { border: 0; background: transparent; padding: 6px 12px; font: inherit; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--primary); color: var(--bg); }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 4px 10px; font: inherit; font-size: 12.5px; color: var(--ink-2); cursor: pointer; transition: border-color .2s, background .2s; }
.chip:hover { border-color: var(--line-2); }
.chip.on { border-color: var(--ink); color: var(--ink); background: var(--surface-2); }
.chip .sw { width: 8px; height: 8px; border-radius: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.btn { border: 1px solid var(--line); background: var(--surface); border-radius: var(--r); padding: 6px 12px; font: inherit; font-size: 13px; color: var(--ink); cursor: pointer; }
.btn:hover { background: var(--surface-2); }
.btn.pri { background: var(--primary); color: var(--bg); border-color: var(--primary); }
.sp { flex: 1; }
select, input[type=search] { font: inherit; font-size: 13px; border: 1px solid var(--line); border-radius: var(--r); padding: 6px 10px; background: var(--surface); color: var(--ink); }

/* charts */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { font-family: Inter, system-ui, sans-serif; fill: var(--muted); font-size: 11px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--ink-2); margin-top: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 3px; border-radius: 2px; display: inline-block; }
.legend i.box { height: 10px; }
.tip { position: fixed; z-index: 50; pointer-events: none; background: var(--surface); border: 1px solid var(--line-2); border-radius: 6px; padding: 8px 10px; font-size: 12px; box-shadow: 0 4px 16px rgba(15,23,42,.08); min-width: 140px; }
.tip b { display: block; font-weight: 600; margin-bottom: 4px; color: var(--ink); }
.tip .row { display: flex; justify-content: space-between; gap: 14px; color: var(--ink-2); }
.tip .row i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; margin-right: 6px; }
.tip .row span:last-child { color: var(--ink); font-weight: 500; }

/* tables */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .n { text-align: right; }
.tbl tbody tr.link { cursor: pointer; }
.tbl tbody tr.link:hover td { background: var(--surface-2); }
.tw { overflow-x: auto; }
.tag { font-size: 11px; padding: 1px 7px; border-radius: 4px; border: 1px solid var(--line); color: var(--ink-2); }
.tag.lead { border-color: var(--accent); color: var(--accent); }

.av { width: 40px; height: 40px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 600; }
.prof { display: flex; gap: 14px; align-items: center; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; font-size: 13px; }
.kv dt { color: var(--ink-2); } .kv dd { margin: 0; font-weight: 500; text-align: right; }
.formula { background: var(--surface-2); border-radius: 6px; padding: 12px 14px; font-size: 13px; color: var(--ink-2); }
.formula b { color: var(--ink); }
.ref { display: flex; gap: 8px; } .ref input { flex: 1; min-width: 0; font: inherit; font-size: 13px; border: 1px solid var(--line); border-radius: var(--r); padding: 6px 10px; background: var(--surface-2); color: var(--ink); }
.hero { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 8px; }
.hero a { display: block; }
.hero .card { transition: border-color .2s; height: 100%; }
.hero .card:hover { border-color: var(--ink); }
@media (max-width: 720px) { .hero { grid-template-columns: 1fr; } }
.mt { margin-top: 16px; }
