:root {
  --bg: #0f1419;
  --panel: #1a222c;
  --line: #2a3542;
  --text: #e7eef7;
  --muted: #93a4b8;
  --accent: #3d9cf0;
  --danger: #e85d5d;
  --ok: #3ecf8e;
  --sidebar: #121920;
  --sidebar-w: 240px;
  --font: "IBM Plex Sans", "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0; min-height: 100vh;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
}
a { color: var(--accent); text-decoration: none; }
.hidden { display: none !important; }

/* auth */
.auth { display:grid; place-items:center; min-height:100vh;
  background: radial-gradient(1200px 600px at 10% -10%, #1c2a3a, transparent), var(--bg); }
.login { width: min(400px, 92vw); display: grid; gap: 12px; }
.login h1 { margin: 0; font-size: 1.6rem; letter-spacing: -0.02em; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px;
}
.card.mini { padding: 16px 18px; }
.muted { color: var(--muted); margin: 0 0 8px; }
label { display:grid; gap:6px; font-size: .9rem; color: var(--muted); }
input, select, textarea, button {
  font: inherit; border-radius: 10px; border: 1px solid var(--line);
  background: #101820; color: var(--text); padding: 10px 12px;
}
button, .btn {
  background: var(--accent); color: #041018; border: 0; font-weight: 600;
  cursor: pointer; text-decoration: none; display:inline-flex; align-items:center; justify-content:center;
}
button.secondary, .btn.secondary { background: transparent; color: var(--text); border: 1px solid var(--line); }
button.danger { background: var(--danger); color: white; }
button.full { width: 100%; }
.error { background: #3a1c1c; color: #ffb4b4; padding: 10px 12px; border-radius: 10px; }
.ok { color: var(--ok); }

/* shell + sidebar */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
}
.brand { padding: 4px 10px 20px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.brand-title { font-weight: 700; font-size: 1.15rem; letter-spacing: -0.02em; }
.brand-sub { color: var(--muted); font-size: .8rem; margin-top: 4px; word-break: break-all; }
.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  color: var(--muted);
  padding: 10px 12px;
  border-radius: 10px;
  font-weight: 500;
  border: 1px solid transparent;
}
.nav-item:hover { color: var(--text); background: #1a222c; }
.nav-item.active {
  color: var(--text);
  background: #1c2836;
  border-color: var(--line);
}
.sidebar-foot { padding-top: 12px; border-top: 1px solid var(--line); }

.main { flex: 1; min-width: 0; padding: 20px 22px 48px; }
.topbar {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 18px; flex-wrap: wrap;
}
.topbar h1 { margin: 0; font-size: 1.35rem; letter-spacing: -0.02em; flex: 1; }
.toolbar { display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.menu-toggle { display: none; }

.top { display:flex; justify-content:space-between; align-items:center; gap:12px; margin-bottom: 20px; }
.grid { display:grid; gap:16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.stat { font-size: 1.8rem; font-weight: 700; letter-spacing: -0.03em; }
.table { width:100%; border-collapse: collapse; }
.table th, .table td { text-align:left; padding: 10px 8px; border-bottom: 1px solid var(--line); font-size: .92rem; vertical-align: top; }
.row-actions { display:flex; gap:8px; flex-wrap: wrap; }
.chart-wrap { position: relative; height: 280px; }
.badge { display:inline-block; padding: 2px 8px; border-radius: 999px; background:#243041; color:var(--muted); font-size:.75rem; }
.badge.on { background:#143528; color: var(--ok); }
.badge.off { background:#3a1c1c; color:#ffb4b4; }
form.inline { display:grid; gap:10px; max-width: 560px; }

.sidebar-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 30;
}
.sidebar-backdrop.show { display: block; }

@media (max-width: 860px) {
  .sidebar {
    position: fixed;
    left: 0; top: 0;
    transform: translateX(-105%);
    transition: transform .2s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .menu-toggle { display: inline-flex; }
  .main { padding: 14px 12px 40px; }
}

.quota-card .quota-bar-wrap {
  height: 12px; border-radius: 999px; background: #101820; border: 1px solid var(--line); overflow: hidden;
}
.quota-bar {
  height: 100%; width: 0; background: var(--ok); transition: width .3s ease;
}
.quota-bar.hot { background: var(--accent); }
.quota-bar.over { background: var(--danger); }
