:root {
  --bg: #f5f6f8; --card: #fff; --ink: #1d2433; --muted: #6b7385; --line: #e3e6ec;
  --accent: #2f5d9e; --accent-ink: #fff; --good: #2f8a5b; --bad: #b5404b;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.45; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; margin: 0 0 16px; }
h2 { font-size: 16px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 18px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
code { background: #eef1f6; padding: 1px 5px; border-radius: 4px; }

.topbar { display: flex; align-items: center; gap: 24px; padding: 0 28px; height: 56px;
  background: #16213a; color: #cfd6e4; }
.brand { font-weight: 700; font-size: 20px; color: #fff; letter-spacing: -.02em; }
.brand span { color: #8fb3ea; }
.topbar nav { display: flex; gap: 4px; flex: 1; }
.topbar nav a { color: #cfd6e4; padding: 6px 12px; border-radius: 6px; }
.topbar nav a.active, .topbar nav a:hover { background: #24345a; color: #fff; text-decoration: none; }
.topbar .user { margin-left: auto; display: flex; gap: 10px; align-items: center; }
button.link { background: none; border: 0; color: #8fb3ea; cursor: pointer; font: inherit; }
form.inline { display: inline; }

main { max-width: 1240px; margin: 0 auto; padding: 24px 28px 60px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.page-head h1 { margin: 0; }
.inline-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.inline-form label { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); gap: 2px; }

.grid { display: grid; gap: 16px; margin-bottom: 16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); }
.grid.stats { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid.cards { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; margin-bottom: 16px; }
.grid > .card { margin-bottom: 0; }
.card.narrow { max-width: 520px; }
.link-card:hover { border-color: var(--accent); text-decoration: none; }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat .label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.stat strong { font-size: 24px; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12px; font-weight: normal; }

table.data { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
table.data th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; border-bottom: 2px solid var(--line); padding: 6px 8px; }
table.data td { border-bottom: 1px solid var(--line); padding: 6px 8px; }
table.data tfoot td { font-weight: 700; border-top: 2px solid var(--line); }
table.data .num { text-align: right; white-space: nowrap; }
table.compact td { padding: 3px 8px; }
tr.done td { color: var(--muted); }
.scroll { max-height: 320px; overflow: auto; }
.neg { color: var(--bad); }
.pos { color: var(--good); }

.tag { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 10px; background: #eef1f6; color: var(--muted); font-weight: 600; vertical-align: middle; }
.tag.good { background: #e3f3ea; color: var(--good); }
.tag.bad { background: #f8e5e7; color: var(--bad); }

.btn { display: inline-block; padding: 7px 14px; border-radius: 6px; border: 1px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; font: inherit; }
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.small { padding: 4px 10px; font-size: 12px; margin: 0 4px 6px 0; }
input, select, textarea { font: inherit; padding: 6px 8px; border: 1px solid #ccd2dc; border-radius: 6px; background: #fff; }
input:focus, select:focus { outline: 2px solid #c6d6f0; border-color: var(--accent); }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; }
.field { display: flex; flex-direction: column; gap: 3px; }
.field label { font-size: 12px; color: var(--muted); font-weight: 600; }
.field small { color: var(--muted); font-size: 11px; }
.field.error input { border-color: var(--bad); }
.errorlist { color: var(--bad); margin: 4px 0; padding-left: 16px; }
.stacked p { display: flex; flex-direction: column; gap: 4px; }
.stacked .helptext { color: var(--muted); font-size: 12px; }
.actions { margin-top: 14px; }
ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { padding: 4px 0; border-bottom: 1px dashed var(--line); }
.flash { padding: 10px 14px; border-radius: 8px; background: #e3f3ea; color: var(--good); margin-bottom: 16px; }

.donut-wrap { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
svg.donut { width: 220px; height: 220px; }
.legend { list-style: none; padding: 0; margin: 0; flex: 1; min-width: 180px; }
.legend li { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.legend li span { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--muted); }
.legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.legend.row { display: flex; flex-wrap: wrap; gap: 4px 16px; }
svg.linechart { width: 100%; height: auto; }
svg.linechart text { font-size: 11px; fill: var(--muted); }
svg.linechart .grid { stroke: var(--line); }
svg.linechart .axis-title { font-weight: 600; }
@media (max-width: 640px) { .grid.two { grid-template-columns: 1fr; } .fields { grid-template-columns: 1fr; } main { padding: 16px; } }
