:root {
  --bg: #0d0d0d; --panel: #141414; --panel2: #1a1a1a; --line: #262626;
  --txt: #e8e8e8; --muted: #888; --green: #1db954; --red: #e74c3c;
  --amber: #f0c040; --blue: #4aa3ff;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--txt);
  font-family: -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif; font-size: 14px; }
.hidden { display: none !important; }
a { color: var(--blue); }

/* ── Login ── */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 32px; width: 320px; display: flex; flex-direction: column; gap: 12px; }
.login-sub { color: var(--muted); font-size: 0.8rem; margin-bottom: 8px; }
.login-card input { background: var(--panel2); border: 1px solid var(--line); color: var(--txt);
  border-radius: 8px; padding: 11px 12px; font-size: 0.9rem; }
.login-err { color: var(--red); font-size: 0.8rem; min-height: 16px; }

/* ── Topbar ── */
.topbar { display: flex; align-items: center; gap: 20px; padding: 10px 20px;
  background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.brand { font-weight: 700; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.dot-logo { width: 12px; height: 12px; border-radius: 50%; background: var(--green);
  box-shadow: 0 0 10px var(--green); display: inline-block; }
.ws-dot { width: 8px; height: 8px; border-radius: 50%; background: #555; margin-left: 4px; }
.ws-dot.on { background: var(--green); box-shadow: 0 0 8px var(--green); }
.tabs { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.tab { background: none; border: none; color: var(--muted); padding: 8px 14px; border-radius: 8px;
  cursor: pointer; font-size: 0.85rem; }
.tab:hover { color: var(--txt); background: var(--panel2); }
.tab.active { color: var(--green); background: #1db95418; }
.user-box { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.role-badge { font-size: 0.65rem; font-weight: 700; padding: 2px 8px; border-radius: 6px;
  background: #4aa3ff22; color: var(--blue); border: 1px solid #4aa3ff55; text-transform: uppercase; }
.role-badge.admin { background: #f0c04022; color: var(--amber); border-color: #f0c04055; }

/* ── Content ── */
.content { padding: 20px; max-width: 1200px; margin: 0 auto; }
h2.view-title { font-size: 1.1rem; margin: 0 0 16px; }

/* ── Tiles ── */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.tile .v { font-size: 1.7rem; font-weight: 700; }
.tile .l { color: var(--muted); font-size: 0.72rem; text-transform: uppercase; margin-top: 2px; }
.tile.green .v { color: var(--green); } .tile.red .v { color: var(--red); }
.tile.amber .v { color: var(--amber); } .tile.blue .v { color: var(--blue); }

/* ── Cards / panels ── */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 16px; }
.card h3 { margin: 0 0 12px; font-size: 0.95rem; }

/* ── Tables ── */
table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
th { text-align: left; color: var(--muted); font-size: 0.68rem; text-transform: uppercase;
  padding: 6px 8px; border-bottom: 1px solid var(--line); font-weight: 600; }
td { padding: 8px; border-bottom: 1px solid #1c1c1c; }
tr:hover td { background: #171717; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.78rem; }

/* ── Dots / badges ── */
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: #555; }
.dot.online { background: var(--green); box-shadow: 0 0 7px var(--green); }
.pill { font-size: 0.66rem; font-weight: 700; padding: 2px 8px; border-radius: 6px; }
.pill.active { background: #1db95422; color: var(--green); }
.pill.unused { background: #4aa3ff22; color: var(--blue); }
.pill.revoked, .pill.suspended { background: #e74c3c22; color: var(--red); }

/* ── Buttons / forms ── */
.btn { background: var(--panel2); border: 1px solid var(--line); color: var(--txt); border-radius: 8px;
  padding: 9px 14px; cursor: pointer; font-size: 0.85rem; }
.btn:hover { border-color: #3a3a3a; }
.btn-green { background: var(--green); border-color: var(--green); color: #052; font-weight: 700; }
.btn-gray { background: #222; }
.btn-red { background: #2a1414; border-color: #52201c; color: #ff8c7a; }
.btn-sm { padding: 5px 10px; font-size: 0.75rem; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
input, select { background: var(--panel2); border: 1px solid var(--line); color: var(--txt);
  border-radius: 8px; padding: 8px 10px; font-size: 0.85rem; }
.muted { color: var(--muted); } .empty { color: #555; font-size: 0.85rem; padding: 10px 0; }
.code-val { font-family: ui-monospace, monospace; letter-spacing: 1px; color: var(--green); }

/* ── Bar chart ── */
.bars { display: flex; align-items: flex-end; gap: 4px; height: 120px; margin-top: 8px; }
.bar { flex: 1; background: linear-gradient(var(--green), #0f7a35); border-radius: 3px 3px 0 0; min-height: 2px; position: relative; }
.bar span { position: absolute; bottom: -18px; left: 0; right: 0; text-align: center; font-size: 0.6rem; color: #666; }
.toast { position: fixed; bottom: 20px; right: 20px; background: var(--panel); border: 1px solid var(--line);
  border-left: 3px solid var(--green); padding: 12px 16px; border-radius: 8px; font-size: 0.85rem; z-index: 100; }
