:root {
  --brand: #005198;
  --brand-accent: #FFC63E;
  --page: #f4f6f9;
  --surface: #ffffff;
  --ink: #191919;
  --ink-2: #666666;
  --grid: #e7e7e7;
  --axis: #c2c2c2;
  --border: rgba(11, 11, 11, 0.10);
  --good: #006c10;
  --bad: #c62828;
  --s1: #257de0; --s2: #f47230; --s3: #00b894; --s4: #f2a600;
  --s5: #ee7fac; --s6: #008a17; --s7: #6a4ce2; --s8: #ec4647;
  --muted-bg: #eef1f5;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--ink); font-size: 14px; }
button, input, select { font: inherit; }

.top { position: sticky; top: 0; z-index: 20; background: var(--surface); box-shadow: 0 1px 0 var(--border); }
.brandbar { background: var(--brand); color: #fff; padding: 10px 20px; display: flex; gap: 16px; align-items: baseline; flex-wrap: wrap; }
.brandbar h1 { font-size: 16px; margin: 0; font-weight: 800; }
.brandbar h1 b { color: var(--brand-accent); }
.brandbar .fresh { font-size: 12px; opacity: .85; margin-left: auto; }

.filters { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; padding: 10px 20px; }
.filters label { font-size: 12px; color: var(--ink-2); display: flex; gap: 6px; align-items: center; }
.filters input[type=date], .filters select { padding: 5px 8px; border: 1px solid var(--axis); border-radius: 6px; background: var(--surface); }
.seg { display: inline-flex; border: 1px solid var(--axis); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); padding: 6px 12px; cursor: pointer; color: var(--ink); }
.seg button + button { border-left: 1px solid var(--axis); }
.seg button.on { background: var(--brand); color: #fff; }
.presets button { padding: 5px 10px; }

.rap-picker { position: relative; }
.rap-picker > button { padding: 6px 12px; border: 1px solid var(--axis); border-radius: 8px; background: var(--surface); cursor: pointer; min-width: 180px; text-align: left; }
.rap-panel { position: absolute; top: 110%; left: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.12); padding: 10px; width: 300px; max-height: 420px; overflow: auto; z-index: 30; }
.rap-panel h4 { margin: 8px 0 4px; font-size: 12px; color: var(--ink-2); text-transform: uppercase; letter-spacing: .04em; }
.rap-panel label { display: flex; gap: 8px; padding: 3px 0; font-size: 13px; color: var(--ink); cursor: pointer; }
.rap-panel .actions { display: flex; gap: 8px; margin-bottom: 6px; }
.rap-panel .actions button { font-size: 12px; padding: 3px 8px; border: 1px solid var(--axis); border-radius: 6px; background: var(--surface); cursor: pointer; }

.nav { display: flex; gap: 4px; padding: 0 20px; overflow-x: auto; border-top: 1px solid var(--border); }
.nav button { border: 0; background: none; padding: 10px 12px; cursor: pointer; color: var(--ink-2); border-bottom: 3px solid transparent; white-space: nowrap; font-weight: 600; }
.nav button.on { color: var(--brand); border-bottom-color: var(--brand); }

main { padding: 18px 20px 60px; max-width: 1500px; margin: 0 auto; }
.page-head h2 { margin: 0 0 4px; font-size: 20px; color: var(--brand); }
.page-head p { margin: 0 0 16px; color: var(--ink-2); }
.section { margin: 22px 0 10px; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.section h3 { margin: 0; font-size: 15px; }
.section .q { color: var(--ink-2); font-size: 13px; }

.grid { display: grid; gap: 12px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpis { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
@media (max-width: 900px) { .g2, .g3 { grid-template-columns: minmax(0, 1fr); } }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; min-width: 0; position: relative; }
.card h4 { margin: 0 0 8px; font-size: 13px; color: var(--ink-2); font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.card .note { color: var(--ink-2); font-size: 12px; margin-top: 8px; line-height: 1.45; }
.chart-box { position: relative; height: 280px; }
.chart-box.tall { height: 360px; }

.kpi .v { font-size: 22px; font-weight: 800; margin: 2px 0 6px; }
.kpi .unit { font-size: 12px; color: var(--ink-2); font-weight: 600; }
.kpi .rows { display: grid; grid-template-columns: auto auto; gap: 2px 10px; font-size: 12px; color: var(--ink-2); }
.kpi .rows b { justify-self: end; color: var(--ink); font-variant-numeric: tabular-nums; }
.up { color: var(--good) !important; }
.down { color: var(--bad) !important; }

table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
.t th, .t td { padding: 6px 8px; border-bottom: 1px solid var(--grid); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.t th { color: var(--ink-2); font-weight: 600; font-size: 12px; position: sticky; top: 0; background: var(--surface); cursor: pointer; }
.t th:first-child, .t td:first-child { text-align: left; }
.t td.txt { text-align: left; white-space: normal; }
.table-wrap { overflow: auto; max-height: 460px; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.pill.p1 { background: #fde2e2; color: #a11; }
.pill.p2 { background: #fff1d6; color: #8a5a00; }
.pill.ok { background: #e7f6ea; color: #1b6b2a; }
.pill.op { background: #e3efff; color: #1757ac; }

.soon { overflow: hidden; min-height: 170px; }
.soon .ghost { filter: blur(3px); opacity: .45; pointer-events: none; user-select: none; }
.soon .ghost .bar { height: 12px; border-radius: 6px; background: #c9d3e0; margin: 9px 0; }
.soon .overlay { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 16px; background: rgba(244, 246, 249, .55); }
.soon .badge { background: var(--brand); color: #fff; font-weight: 800; font-size: 12px; padding: 4px 12px; border-radius: 999px; letter-spacing: .03em; }
.soon .overlay .title { font-weight: 800; margin: 8px 0 2px; }
.soon .overlay .need { font-size: 12px; color: var(--ink-2); max-width: 420px; line-height: 1.45; }

.callout { background: #fff8e6; border: 1px solid #f2d48a; border-radius: 10px; padding: 10px 14px; font-size: 13px; line-height: 1.5; }
.empty { color: var(--ink-2); font-style: italic; padding: 20px 0; text-align: center; }

.target-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.target-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--ink-2); }
.target-form input { padding: 7px 9px; border: 1px solid var(--axis); border-radius: 6px; font-size: 14px; text-align: right; }
.btn { padding: 7px 14px; border-radius: 8px; border: 1px solid var(--brand); background: var(--brand); color: #fff; cursor: pointer; font-weight: 600; }
.btn.ghost { background: var(--surface); color: var(--brand); }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--ink-2); margin-bottom: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

@media (max-width: 600px) {
  main { padding: 14px 16px 50px; }
  .filters, .nav, .brandbar { padding-left: 16px; padding-right: 16px; }
}
