:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1f232c;
  --line: #2a2f3a;
  --text: #eef0f4;
  --muted: #8b93a3;
  --accent: #ff6a3d;
  --accent-2: #3dc8ff;
  --accent-3: #b48cff;
  --good: #4fd18b;
  --bad: #ff5d6c;
  --radius: 14px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: 0 0 .6rem; letter-spacing: -.02em; }
h2 { font-size: 1.05rem; margin: 0; }
h3 { font-size: .9rem; margin: 1.2rem 0 .4rem; color: var(--muted); font-weight: 600; }
small { display: block; color: var(--muted); font-size: .8rem; }
code { background: var(--panel-2); padding: .1rem .35rem; border-radius: 6px; font-size: .85em; }
code.block { display: block; padding: .7rem; overflow-x: auto; word-break: break-all; }

.top {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding: .9rem 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0;
  background: rgba(15, 17, 21, .92); backdrop-filter: blur(8px); z-index: 10;
}
.brand { font-weight: 800; font-size: 1.15rem; color: var(--text); letter-spacing: -.03em; }
.brand span { color: var(--accent); }
.top nav { display: flex; gap: .3rem; flex-wrap: wrap; }
.top nav a { color: var(--muted); padding: .35rem .7rem; border-radius: 999px; font-size: .9rem; }
.top nav a.on, .top nav a:hover { color: var(--text); background: var(--panel-2); text-decoration: none; }

main { max-width: 1200px; margin: 0 auto; padding: 1.2rem 16px 3rem; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.toolbar h1 { margin: 0; }

.flash, .notice {
  background: rgba(61, 200, 255, .1); border: 1px solid rgba(61, 200, 255, .35);
  padding: .75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem;
}
.err { color: var(--bad); }
.ok { color: var(--good) !important; }
.muted { color: var(--muted); }
.foot { text-align: center; font-size: .8rem; margin-top: 2rem; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: .8rem; margin-bottom: .8rem; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
.stat b { display: block; font-size: 1.6rem; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.lbl { color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.delta { display: block; font-size: .78rem; color: var(--muted); margin-top: .2rem; }
.delta.up { color: var(--good); }
.delta.down { color: var(--bad); }

.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .8rem; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; min-width: 0; }
.card.wide { grid-column: 1 / -1; }
.card.narrow { max-width: 640px; margin: 0 auto 1rem; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: .6rem; flex-wrap: wrap; margin-bottom: .8rem; }
.card-head .muted { font-size: .8rem; }

.kpis { display: flex; flex-wrap: wrap; gap: 1.4rem; align-items: flex-end; margin-bottom: .8rem; }
.kpis b { display: block; font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.kpis b.pos { color: var(--good); }
.kpis b.neg { color: var(--bad); }
.formtxt { margin-left: auto; background: var(--panel-2); padding: .4rem .7rem; border-radius: 999px; font-size: .85rem; }

.chart { position: relative; height: 200px; margin-top: .6rem; }
.chart.tall { height: 260px; }
.chart.short { height: 150px; }

.tbl { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: .9rem; }
.tbl th { text-align: left; color: var(--muted); font-weight: 600; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; padding: .4rem .5rem; border-bottom: 1px solid var(--line); }
.tbl td { padding: .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl td small { display: inline; margin-left: .3rem; }
.scroll { overflow-x: auto; }

.pill { display: inline-block; background: rgba(255, 106, 61, .15); color: var(--accent); font-size: .7rem; font-weight: 700; padding: .1rem .45rem; border-radius: 999px; white-space: nowrap; }
.pill.grey { background: var(--panel-2); color: var(--muted); }

.list { list-style: none; padding: 0; margin: 0; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: .8rem; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }

.btn {
  display: inline-block; background: var(--accent); color: #140700; border: 0; border-radius: 10px;
  padding: .65rem 1.1rem; font: inherit; font-weight: 700; cursor: pointer;
}
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn.ghost { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); }
.btn.small { padding: .35rem .75rem; font-size: .85rem; }

.form { display: grid; gap: .8rem; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .8rem; }
label { display: grid; gap: .3rem; font-size: .85rem; color: var(--muted); font-weight: 600; }
input, select, textarea {
  width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; padding: .6rem .7rem; font: inherit; font-weight: 400;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-2); outline-offset: 1px; }
.card.narrow form + p, .card.narrow form + form { margin-top: 1rem; }

.source { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .8rem 0; border-bottom: 1px solid var(--line); }
.source:last-of-type { margin-bottom: 1rem; }

@media (max-width: 820px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .grid { grid-template-columns: 1fr; }
  .formtxt { margin-left: 0; }
  .stat b { font-size: 1.3rem; }
}
