:root {
  --bg: #0a0e16; --bg2: #0e1320; --panel: #141b29; --panel2: #1a2233;
  --text: #eef2f8; --muted: #8d9bb2; --line: rgba(255,255,255,.07);
  --accent: #6c8cff; --gold: #f5b301; --green: #34d399; --red: #f87171; --cyan: #22d3ee;
  --r: 16px; --shadow: 0 6px 24px rgba(0,0,0,.28);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(1200px 600px at 80% -10%, #16203a 0%, var(--bg) 55%);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }

/* login */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { background: var(--panel); border: 1px solid var(--line); border-radius: 22px; padding: 40px 30px; text-align: center; max-width: 380px; width: 100%; box-shadow: var(--shadow); }
.logo { font-size: 30px; font-weight: 800; letter-spacing: .5px; }
.login-sub { color: var(--muted); margin: 6px 0 26px; }
.login-err { color: var(--red); margin-top: 14px; font-size: 14px; }

/* shell */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 16px 24px; background: rgba(12,17,28,.7); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 800; font-size: 19px; letter-spacing: .3px; }
.brand span { color: var(--gold); }
.logout { background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 9px 16px; cursor: pointer; font-weight: 600; transition: .15s; }
.logout:hover { background: #232d42; }
.nav { display: flex; gap: 8px; padding: 16px 24px 4px; flex-wrap: wrap; }
.nav button { background: var(--panel); color: var(--muted); border: 1px solid var(--line); border-radius: 12px; padding: 10px 18px; cursor: pointer; font-weight: 700; font-size: 14px; transition: .15s; }
.nav button:hover { color: var(--text); }
.nav button.active { background: linear-gradient(135deg, var(--accent), #8aa2ff); color: #0a0e16; border-color: transparent; box-shadow: 0 4px 14px rgba(108,140,255,.35); }
main { padding: 14px 24px 70px; max-width: 1180px; margin: 0 auto; }

/* section header */
.section-title { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 800; letter-spacing: 1.4px; text-transform: uppercase; color: var(--muted); margin: 26px 2px 12px; }
.section-title::before { content: ""; width: 3px; height: 15px; border-radius: 3px; background: var(--accent); }

/* metric cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 14px; }
.card { display: flex; align-items: center; gap: 13px; background: linear-gradient(160deg, var(--panel), var(--bg2)); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; transition: transform .14s, border-color .14s; }
.card:hover { transform: translateY(-3px); border-color: rgba(108,140,255,.4); }
.card-ic { width: 44px; height: 44px; flex: none; border-radius: 13px; display: flex; align-items: center; justify-content: center; font-size: 21px; background: rgba(108,140,255,.14); }
.card.g .card-ic { background: rgba(52,211,153,.15); }
.card.gold .card-ic { background: rgba(245,179,1,.15); }
.card .v { font-size: 26px; font-weight: 800; line-height: 1.05; letter-spacing: -.5px; }
.card .k { color: var(--muted); font-size: 12.5px; margin-top: 3px; }

/* charts */
.chart-wrap { background: linear-gradient(160deg, var(--panel), var(--bg2)); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.chart { width: 100%; height: 170px; display: block; }
.chart-empty { color: var(--muted); text-align: center; padding: 40px; }

/* panels / lists */
.tcols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 820px) { .tcols { grid-template-columns: 1fr; } }
.panel { background: linear-gradient(160deg, var(--panel), var(--bg2)); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.lrow { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); }
.lrow:first-child { border-top: none; }
.lrow .n { width: 24px; text-align: center; font-weight: 800; color: var(--muted); }
.lrow .n.top { color: var(--gold); }
.lrow .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lrow .vv { font-weight: 800; color: var(--accent); }
.muted { color: var(--muted); font-size: 13px; }

/* groups */
.search { width: 100%; padding: 13px 16px; border: 1px solid var(--line); border-radius: 13px; background: var(--panel); color: var(--text); margin-bottom: 14px; font-size: 15px; outline: none; }
.search:focus { border-color: var(--accent); }
.grow { display: flex; align-items: center; gap: 13px; padding: 14px 16px; border-top: 1px solid var(--line); cursor: pointer; transition: background .12s; }
.grow:hover { background: var(--panel2); }
.grow .gav { width: 36px; height: 36px; border-radius: 10px; flex: none; display: flex; align-items: center; justify-content: center; font-weight: 800; color: #fff; font-size: 14px; }
.grow .gt { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.dot.on { background: var(--green); box-shadow: 0 0 0 3px rgba(52,211,153,.18); }
.dot.off { background: var(--red); }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 16px; }
.pager button { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 9px 16px; cursor: pointer; }
.pager button:disabled { opacity: .35; cursor: default; }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 20; backdrop-filter: blur(3px); }
.modal.hidden { display: none; }
.sheet { background: var(--panel); border: 1px solid var(--line); border-radius: 20px; width: 100%; max-width: 600px; max-height: 88vh; overflow: auto; padding: 24px; box-shadow: var(--shadow); }
.sheet h3 { margin: 0 0 4px; font-size: 20px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0; }
.chip { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 7px 13px; font-size: 13px; color: var(--muted); }
.chip b { color: var(--text); }
.loading { text-align: center; color: var(--muted); padding: 34px; }
