:root {
  color-scheme: dark;
  --bg: #101016; --panel: #191920; --panel-2: #211f2a; --line: #2f2b3b;
  --ink: #f3f0ff; --muted: #a29daf; --accent: #b3a1ff; --accent-strong: #a18ae9;
  --free: #b3a1ff; --plus: #5fb3a6; --danger: #f0a3b4; --danger-bg: #3a2029;
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 14px; }
.top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 14px 20px; border-bottom: 1px solid var(--line); background: var(--panel); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.brand small { margin-left: 4px; color: var(--accent); font-size: 10px; letter-spacing: .14em; }
.mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 10px; background: linear-gradient(145deg, #b3a1ff, #7256d8); color: #fff; }
main { width: min(1100px, 100%); margin: 0 auto; padding: 20px 16px 48px; display: grid; gap: 16px; }
.muted { color: var(--muted); margin: 0; }
.small { font-size: 12px; }
.banner { margin: 0; padding: 10px 14px; border: 1px solid #5a4a7a; border-radius: 12px; background: #231d33; }
.banner-error { border-color: #6b4a59; background: var(--danger-bg); color: #ffe1e8; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.tile { display: grid; gap: 4px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.tile-label { color: var(--muted); font-size: 12px; }
.tile strong { font-size: 28px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tile-sub { color: var(--muted); font-size: 12px; }
.card { padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); min-width: 0; }
.card h2 { margin: 0 0 12px; font-size: 15px; font-weight: 600; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.button { padding: 8px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); color: var(--ink); font: inherit; font-size: 13px; cursor: pointer; }
.button:hover { background: #2a2736; }
.button:disabled { opacity: .5; cursor: default; }
.button-primary { border-color: var(--accent-strong); background: var(--accent-strong); color: #100c1d; font-weight: 600; }
.button-primary:hover { background: #baa7ff; }
.button-danger { border-color: #6b4a59; background: var(--danger-bg); color: #ffe1e8; padding: 5px 10px; font-size: 12px; }
.button-danger:hover { background: #4a2633; }
.limits { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); align-items: end; gap: 12px; margin-bottom: 10px; }
.limits label { display: grid; gap: 5px; font-size: 12px; font-weight: 600; color: #c9c1d8; }
.unit { color: var(--muted); font-weight: 400; }
.limits input { height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; background: #14131c; color: var(--ink); font: inherit; }
.limits input:focus { outline: none; border-color: var(--accent); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: var(--muted); font-size: 12px; font-weight: 600; }
td code, code { font-family: Consolas, monospace; font-size: 12px; color: #d9ccff; }
.chart { display: flex; align-items: flex-end; gap: 2px; height: 140px; padding-top: 6px; border-bottom: 1px solid var(--line); }
.bar { flex: 1 1 0; display: flex; flex-direction: column-reverse; min-width: 2px; height: 100%; }
.bar span { display: block; width: 100%; }
.bar .seg-free { background: var(--free); border-radius: 2px 2px 0 0; }
.bar .seg-plus { background: var(--plus); }
.chart-axis { display: flex; justify-content: space-between; margin-top: 6px; }
.legend { display: flex; gap: 14px; color: var(--muted); font-size: 12px; }
.swatch { display: inline-block; width: 10px; height: 10px; margin-right: 6px; border-radius: 3px; vertical-align: -1px; }
.swatch-free { background: var(--free); }
.swatch-plus { background: var(--plus); }
.totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin: 0; }
.totals div { padding: 10px 12px; border-radius: 10px; background: var(--panel-2); }
.totals dt { color: var(--muted); font-size: 12px; }
.totals dd { margin: 4px 0 0; font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.site-group { margin: 16px 0 8px; font-size: 13px; font-weight: 600; }
.site-actions { display: flex; gap: 6px; }
.button-small { padding: 5px 10px; font-size: 12px; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--line); }
.tab-btn { padding: 9px 16px; border: none; border-bottom: 2px solid transparent; background: none; color: var(--muted); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.tab-btn:hover { color: var(--ink); }
.tab-btn.active { color: var(--ink); border-bottom-color: var(--accent); }
.tab-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tab-panel { display: grid; gap: 16px; }
.tab-panel[hidden] { display: none; }
.meters { display: grid; gap: 10px; }
.meter { display: grid; grid-template-columns: 84px 1fr 44px; align-items: center; gap: 10px; }
.meter-label { color: var(--muted); font-size: 12px; }
.meter-bar { height: 10px; border-radius: 6px; background: #14131c; overflow: hidden; }
.meter-fill { display: block; height: 100%; border-radius: 6px; background: var(--plus); transition: width .4s ease; }
.meter-fill.mid { background: #d9b45f; }
.meter-fill.low { background: var(--danger); }
.meter-val { font-size: 12px; font-variant-numeric: tabular-nums; text-align: right; color: var(--muted); }
.pill { display: inline-block; padding: 2px 11px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill-approved { background: #1b3a33; color: #7fd8c6; }
.pill-denied { background: var(--danger-bg); color: #ffd7e0; }
.site-group-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 18px 0 8px; }
.site-group-head .site-group { margin: 0; }
.filter-input { height: 32px; padding: 0 11px; border: 1px solid var(--line); border-radius: 8px; background: #14131c; color: var(--ink); font: inherit; font-size: 12px; min-width: 170px; }
.filter-input:focus { outline: none; border-color: var(--accent); }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #211f2a; }
.panel-dialog { width: min(440px, calc(100vw - 32px)); padding: 22px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); color: var(--ink); box-shadow: 0 20px 48px #00000066; }
.panel-dialog::backdrop { background: #05040acc; }
.panel-dialog-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.panel-dialog-head h2 { margin: 0; font-size: 16px; }
.settings-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
