:root {
  --bg: #0b1020;
  --bg-2: #121933;
  --panel: #161f3d;
  --panel-2: #1d2950;
  --line: #2a3667;
  --txt: #e7ecff;
  --muted: #93a0cf;
  --brand: #5b8cff;
  --brand-2: #8a6bff;
  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #f87171;
  --radius: 14px;
  --shadow: 0 18px 50px rgba(0,0,0,.45);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: radial-gradient(1200px 700px at 80% -10%, #1b2552 0%, transparent 55%),
              radial-gradient(900px 600px at -10% 110%, #241a52 0%, transparent 55%),
              var(--bg);
  color: var(--txt);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); }
button { font: inherit; cursor: pointer; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* ---- Login ---- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card {
  width: 100%; max-width: 400px; background: linear-gradient(180deg, var(--panel), var(--bg-2));
  border: 1px solid var(--line); border-radius: 20px; padding: 36px 32px; box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.brand .logo {
  width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); font-weight: 800; color: #fff;
}
.brand h1 { font-size: 20px; margin: 0; letter-spacing: .2px; }
.brand .sub { font-size: 12px; color: var(--muted); }
.login-card p.lead { color: var(--muted); font-size: 14px; margin: 14px 0 22px; }

label { display: block; font-size: 12px; color: var(--muted); margin: 14px 0 6px; font-weight: 600; }
input, select {
  width: 100%; padding: 11px 13px; background: #0e1530; border: 1px solid var(--line);
  border-radius: 10px; color: var(--txt); font-size: 14px; outline: none;
}
input:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(91,140,255,.18); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 16px; border-radius: 10px; border: 1px solid transparent; font-weight: 600; font-size: 14px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; transition: .15s;
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.block { width: 100%; margin-top: 22px; }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--txt); }
.btn.ghost:hover { background: var(--panel-2); }
.btn.sm { padding: 7px 11px; font-size: 13px; }
.btn.danger { background: linear-gradient(135deg, #ef4444, #b91c1c); }
.err { color: var(--danger); font-size: 13px; margin-top: 12px; min-height: 16px; }

/* ---- Shell ---- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 28px; border-bottom: 1px solid var(--line);
  background: rgba(13,19,42,.7); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 5;
}
.topbar .right { display: flex; align-items: center; gap: 14px; font-size: 14px; }
.container { max-width: 1180px; margin: 0 auto; padding: 28px; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; gap: 16px; flex-wrap: wrap; }
.page-head h2 { margin: 0; font-size: 22px; }
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 4px; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px; }
.stat { background: linear-gradient(180deg, var(--panel), var(--bg-2)); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.stat .n { font-size: 26px; font-weight: 800; }
.stat .l { font-size: 12px; color: var(--muted); margin-top: 2px; }

table { width: 100%; border-collapse: collapse; background: linear-gradient(180deg, var(--panel), var(--bg-2)); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
th, td { text-align: left; padding: 13px 16px; font-size: 14px; border-bottom: 1px solid var(--line); }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); background: rgba(255,255,255,.02); }
tr:last-child td { border-bottom: none; }
tr.clickable:hover td { background: rgba(91,140,255,.06); cursor: pointer; }
.pill { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.pill.active { background: rgba(52,211,153,.15); color: var(--ok); }
.pill.suspended { background: rgba(248,113,113,.15); color: var(--danger); }
.pill.msp { background: rgba(91,140,255,.15); color: var(--brand); }
.pill.enterprise { background: rgba(138,107,255,.15); color: var(--brand-2); }
.pill.admin { background: rgba(251,191,36,.15); color: var(--warn); }
.pill.operator { background: rgba(147,160,207,.15); color: var(--muted); }

/* ---- Modal ---- */
.modal-bg { position: fixed; inset: 0; background: rgba(5,8,20,.7); display: grid; place-items: center; padding: 20px; z-index: 20; }
.modal { width: 100%; max-width: 560px; background: linear-gradient(180deg, var(--panel), var(--bg-2)); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); max-height: 92vh; overflow: auto; }
.modal header { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px; border-bottom: 1px solid var(--line); }
.modal header h3 { margin: 0; font-size: 18px; }
.modal .body { padding: 22px 24px; }
.modal .footer { padding: 18px 24px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; }
.x { background: none; border: none; color: var(--muted); font-size: 22px; line-height: 1; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.divider { height: 1px; background: var(--line); margin: 20px 0; }
.checkline { display: flex; align-items: center; gap: 10px; margin-top: 16px; }
.checkline input { width: auto; }
.note { background: #0e1530; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; font-size: 13px; color: var(--muted); margin-top: 6px; }
.token-box { background: #0e1530; border: 1px dashed var(--brand); border-radius: 10px; padding: 12px 14px; word-break: break-all; font-size: 13px; }
.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin: 4px 0 10px; font-weight: 700; }

.empty { text-align: center; color: var(--muted); padding: 50px 20px; }
.loading { text-align: center; color: var(--muted); padding: 40px; }

.toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--panel-2); border: 1px solid var(--line); color: var(--txt); padding: 12px 18px; border-radius: 10px; font-size: 14px; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: .25s; z-index: 50; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.ok { border-color: var(--ok); }
.toast.err { border-color: var(--danger); }

@media (max-width: 760px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .row2 { grid-template-columns: 1fr; }
  td.hide-sm, th.hide-sm { display: none; }
}
