:root {
  color-scheme: light;
  --bg: #f4f3f0;
  --surface: #fcfcfb;
  --line: #e3e1db;
  --text: #0b0b0b;
  --text-2: #52514e;
  --text-3: #7b7a75;
  --accent: #2a78d6;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --neutral: #8a8983;
  --good: #0a7a2f;
  --bad: #c62f2e;
  --chip: #eceae5;
  --shadow: 0 1px 2px rgba(0, 0, 0, .05);
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #111110;
    --surface: #1a1a19;
    --line: #2e2e2b;
    --text: #f0efec;
    --text-2: #c3c2b7;
    --text-3: #8f8e86;
    --accent: #5a9cec;
    --series-1: #3987e5;
    --series-2: #d95926;
    --neutral: #8f8e86;
    --good: #35b45a;
    --bad: #e66767;
    --chip: #262624;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}
h1 { font-size: 17px; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 15px; margin: 0 0 12px; font-weight: 600; }
p { margin: 0 0 10px; }
button, input, select { font: inherit; color: inherit; }
.num, td.r, .kpi b, .hero-value { font-variant-numeric: tabular-nums; }

.top { position: sticky; top: 0; z-index: 5; background: var(--surface); border-bottom: 1px solid var(--line); }
.top-in { max-width: 1040px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
#tabs { display: flex; gap: 4px; }
#tabs button { border: 0; background: none; padding: 8px 12px; border-radius: 8px; color: var(--text-2); cursor: pointer; font-weight: 500; }
#tabs button.on { background: var(--chip); color: var(--text); }
#progress { height: 3px; background: var(--line); }
#progress-bar { height: 100%; width: 0; background: var(--accent); transition: width .2s; }

@media (max-width: 719px) {
  #tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: var(--surface);
    border-top: 1px solid var(--line); padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); gap: 0;
  }
  #tabs button { flex: 1; padding: 10px 2px; font-size: 13px; }
}
@media (min-width: 720px) { body { padding-bottom: 32px; } }

main { max-width: 1040px; margin: 0 auto; padding: 16px; display: grid; gap: 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; box-shadow: var(--shadow); min-width: 0; }
.muted { color: var(--text-3); }
.small { font-size: 13px; }
.pad { padding: 24px 0; text-align: center; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips button {
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 12px; cursor: pointer;
  color: var(--text-2); font-size: 13px; font-weight: 500; min-height: 34px;
}
.chips button.on { background: var(--text); color: var(--surface); border-color: var(--text); }
.filters { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

.hero-label { color: var(--text-2); font-size: 13px; }
.hero-value { font-size: 38px; font-weight: 650; letter-spacing: -.02em; line-height: 1.15; }
.hero-sub { font-size: 14px; margin-top: 2px; }
.today { display: flex; gap: 28px; flex-wrap: wrap; margin: 10px 0 8px; }
.today > div { min-width: 0; }
.today span { display: block; color: var(--text-2); font-size: 12.5px; }
.today b { font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; }
.today small { display: block; font-size: 13px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.today small.pos { color: var(--good); } .today small.neg { color: var(--bad); }
.legend b { color: var(--text); font-weight: 600; }
.pos { color: var(--good); } .neg { color: var(--bad); }
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 16px; }
@media (min-width: 720px) { .kpis { grid-template-columns: repeat(4, 1fr); } }
.kpi { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-width: 0; }
.kpi span { display: block; color: var(--text-2); font-size: 12.5px; }
.kpi b { font-size: 17px; font-weight: 600; }
.kpi small { display: block; color: var(--text-3); font-size: 12px; }

.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.legend i, .sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }
.chart { position: relative; touch-action: pan-y; }
.chart svg { display: block; width: 100%; height: auto; cursor: crosshair; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .grid.zero { stroke: var(--text-3); }
.chart .tick { fill: var(--text-3); font-size: 11px; }
.chart .cross { stroke: var(--text-3); stroke-width: 1; }
.chart .dot { stroke: var(--surface); stroke-width: 2; }
.tip {
  position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 10px; font-size: 12.5px; box-shadow: 0 4px 14px rgba(0, 0, 0, .12); min-width: 170px; z-index: 2;
}
.tip-date { color: var(--text-2); margin-bottom: 4px; }
.tip-row { display: flex; align-items: center; gap: 4px; }
.tip-row b { margin-left: auto; padding-left: 12px; font-variant-numeric: tabular-nums; }

.bar { height: 6px; border-radius: 3px; background: var(--chip); overflow: hidden; margin-top: 6px; }
.bar > div { height: 100%; background: var(--series-1); border-radius: 3px; }
.acc + .acc { margin-top: 14px; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-weight: 500; color: var(--text-2); font-size: 12.5px; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
th.r, td.r { text-align: right; white-space: nowrap; }
.scroll { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
.t-name { font-weight: 550; }
.t-sub { color: var(--text-3); font-size: 12.5px; }
.hide-s { display: none; }
@media (min-width: 720px) { .hide-s { display: table-cell; } .only-s { display: none; } }

.btn {
  border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 9px 14px; cursor: pointer; font-weight: 550; min-height: 40px;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { color: var(--bad); }
.btn:disabled { opacity: .5; cursor: default; }
input[type=search], input[type=text], select {
  border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 8px 10px; min-height: 40px; min-width: 0;
}
.tools { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.tools input { flex: 1 1 160px; }
ol.steps { margin: 0 0 14px; padding-left: 20px; color: var(--text-2); }
ol.steps li { margin-bottom: 4px; }
.drop { border: 2px dashed var(--line); border-radius: 14px; padding: 22px 16px; text-align: center; }
.drop.over { border-color: var(--accent); }
.warn { border-left: 3px solid var(--neutral); padding: 2px 0 2px 10px; color: var(--text-2); font-size: 13px; margin-top: 8px; }
details summary { cursor: pointer; font-weight: 600; }
details[open] summary { margin-bottom: 10px; }
#toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 10;
  background: var(--text); color: var(--surface); padding: 10px 16px; border-radius: 10px; font-size: 14px; max-width: calc(100vw - 32px);
}
