:root {
  --bg: #f6f7f9; --card: #ffffff; --text: #1f2937; --muted: #6b7280; --line: #e5e7eb;
  --accent: #e8710a; --accent-soft: #fff1e3; --ok: #1a7f37; --ok-bg: #dcf5e3; --bad: #c62828; --bad-bg: #fde4e4;
  --side: #1f2a37; --side-text: #cbd5e1;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11161d; --card: #1a212b; --text: #e5e7eb; --muted: #9aa4b2; --line: #2b3441;
    --accent: #ff8a2b; --accent-soft: #3a2a1a; --ok: #56d37a; --ok-bg: #173324; --bad: #ff7b72; --bad-bg: #3a1c1c;
    --side: #0c1015; --side-text: #9aa4b2;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.layout { display: flex; min-height: 100vh; }
.side { width: 220px; background: var(--side); color: var(--side-text); padding: 20px 14px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { font-weight: 700; font-size: 18px; color: #fff; display: flex; align-items: center; gap: 8px; margin: 0 8px 22px; }
.brand small { font-weight: 400; color: var(--side-text); font-size: 12px; }
.brand .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); display: inline-block; }
.brand.big { color: var(--text); font-size: 24px; justify-content: center; margin-bottom: 8px; }
.side nav { display: flex; flex-direction: column; gap: 4px; }
.side nav a { color: var(--side-text); padding: 10px 12px; border-radius: 8px; }
.side nav a:hover { background: rgba(255,255,255,.07); text-decoration: none; }
.side nav a.on { background: var(--accent); color: #fff; }
.logout { margin-top: auto; color: var(--side-text); padding: 10px 12px; }
.main { flex: 1; padding: 24px 28px 48px; min-width: 0; max-width: 1280px; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
h1 { font-size: 24px; margin: 0; }
h1 small { font-size: 14px; color: var(--muted); font-weight: 400; margin-left: 8px; }
h2 { font-size: 16px; margin: 0 0 12px; }
.muted { color: var(--muted); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; margin-bottom: 16px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi { margin: 0; display: flex; flex-direction: column; gap: 2px; }
.kpi span { color: var(--muted); font-size: 13px; }
.kpi b { font-size: 28px; line-height: 1.2; }
.kpi em { font-style: normal; font-size: 13px; color: var(--muted); }
.kpi em.up { color: var(--ok); } .kpi em.down { color: var(--bad); }
.kpi.big b { font-size: 34px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }
.grid2 > .card { margin-bottom: 0; }
section.grid2 { margin-bottom: 16px; }
.chartbox { position: relative; height: 280px; }
.chartbox.tall { height: 420px; }
.period { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.chip { padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--text); background: var(--card); font-size: 14px; }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip:hover { text-decoration: none; border-color: var(--accent); }
.range { margin-left: auto; display: flex; gap: 6px; align-items: center; color: var(--muted); flex-wrap: wrap; }
input, select { font: inherit; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--text); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.filters input[type=search] { flex: 1; min-width: 200px; }
.btn { display: inline-block; background: var(--accent); color: #fff; padding: 9px 16px; border: 0; border-radius: 8px; cursor: pointer; font: inherit; }
.btn:hover { text-decoration: none; filter: brightness(1.08); }
.btn.small { padding: 6px 12px; font-size: 14px; }
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.r { text-align: right; white-space: nowrap; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--accent-soft); }
tfoot td { font-weight: 700; border-bottom: 0; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; background: var(--line); color: var(--muted); }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.more { font-size: 13px; font-weight: 400; margin-left: 8px; }
.pager { display: flex; gap: 14px; align-items: center; justify-content: center; padding-top: 14px; }
.info { display: grid; grid-template-columns: 130px 1fr; gap: 8px 14px; margin: 0; }
.info dt { color: var(--muted); } .info dd { margin: 0; }
.loginbody { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.logincard { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 32px; max-width: 440px; width: 100%; }
.logincard h1 { text-align: center; margin-bottom: 18px; font-size: 22px; }
.logincard ol { padding-left: 20px; } .logincard li { margin-bottom: 8px; }
code { background: var(--accent-soft); padding: 1px 6px; border-radius: 6px; }
.alert { background: var(--bad-bg); color: var(--bad); padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }
@media (max-width: 820px) {
  .layout { flex-direction: column; }
  .side { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; flex-wrap: wrap; padding: 10px 12px; gap: 8px; }
  .brand { margin: 0 8px 0 0; }
  .side nav { flex-direction: row; flex-wrap: wrap; flex: 1; }
  .logout { margin: 0; }
  .main { padding: 16px 14px 40px; }
  .range { margin-left: 0; }
  .kpi b { font-size: 24px; }
}
