:root {
  --bg: #f3efe6;
  --surface: #fffdf8;
  --ink: #1b1914;
  --muted: #5e594e;
  --line: #e3dccf;
  --stacked: #5b45d6;
  --stacked-soft: #eee9ff;
  --tg: #0c7f78;
  --tg-soft: #e5f6f4;
  --good: #1f7a45;
  --bad: #a32632;
  --warn: #8a5a12;
  --shadow: 0 10px 30px rgba(40, 32, 16, 0.06);
  --radius: 16px;
  color-scheme: light;
}
html[data-theme="dark"] {
  --bg: #101114;
  --surface: #1a1d22;
  --ink: #f3efe6;
  --muted: #b7b1a6;
  --line: #2c3138;
  --stacked: #b7a6ff;
  --stacked-soft: #2a2444;
  --tg: #7ee0d6;
  --tg-soft: #163330;
  --good: #8ddea8;
  --bad: #ffb4b8;
  --warn: #f0c27a;
  --shadow: none;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.num { font-variant-numeric: tabular-nums; }
.app { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.nav {
  padding: 22px 16px;
  border-right: 1px solid var(--line);
  background: var(--surface);
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { font-weight: 700; letter-spacing: 0.08em; font-size: 13px; margin: 0 0 22px; }
.nav button {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 10px;
  padding: 11px 12px;
  margin-bottom: 4px;
  color: var(--muted);
}
.nav button.active { background: var(--bg); color: var(--ink); font-weight: 650; }
.main { padding: 22px 28px 48px; max-width: 1180px; }
.top { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
h1 { font-size: 28px; line-height: 1.15; margin: 0; font-weight: 650; }
.sub { color: var(--muted); margin-top: 6px; font-size: 13px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chip, .btn, .btn-ghost {
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 8px 12px;
  min-height: 40px;
}
.chip.active { border-color: var(--ink); }
.btn { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn-ghost { background: transparent; }
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 18px 0; }
.card, .panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}
.card h2, .panel h2 { margin: 0 0 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.metric { font-size: 32px; line-height: 1.1; font-weight: 650; }
.hint { color: var(--muted); font-size: 12px; margin-top: 8px; }
.good { color: var(--good); }
.bad { color: var(--bad); }
.grid-2 { display: grid; grid-template-columns: 1.4fr 0.8fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 14px; }
th { color: var(--muted); font-weight: 600; font-size: 12px; }
td.num, th.num { text-align: right; }
tr.clickable { cursor: pointer; }
.bar { display: flex; height: 28px; border-radius: 8px; overflow: hidden; background: transparent; gap: 3px; align-items: flex-end; min-height: 120px; }
.bar i { display: block; width: 100%; border-radius: 6px 6px 2px 2px; min-height: 2px; }
.stacked { background: var(--stacked); }
.tg { background: var(--tg); }
.miss { background: transparent; border: 1px dashed var(--line); }
.today { opacity: 0.55; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.sw { width: 8px; height: 8px; border-radius: 99px; display: inline-block; margin-right: 6px; }
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login form { width: min(420px, 100%); }
label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 6px; }
input, select, textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  min-height: 44px;
}
textarea { min-height: 80px; }
.err { color: var(--bad); font-size: 13px; min-height: 1.2em; }
.modal {
  position: fixed; inset: 0; background: rgba(16, 14, 10, 0.46);
  display: grid; place-items: end center; padding: 12px;
}
.sheet { width: min(640px, 100%); max-height: 92vh; overflow: auto; background: var(--surface); border-radius: 20px; padding: 18px; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tag { font-size: 12px; border-radius: 99px; padding: 2px 8px; background: var(--bg); }
.hbar { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; }
.hbar span { display: block; height: 100%; background: var(--stacked); }
@media (max-width: 1024px) {
  .cards { grid-template-columns: 1fr 1fr; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .app { grid-template-columns: 1fr; }
  .nav { position: sticky; top: 0; height: auto; z-index: 2; display: flex; gap: 6px; overflow: auto; padding: 10px; }
  .brand { display: none; }
  .nav button { width: auto; white-space: nowrap; margin: 0; }
  .main { padding: 16px; }
  .cards, .split { grid-template-columns: 1fr; }
  h1 { font-size: 24px; }
  .metric { font-size: 28px; }
}
