/* Rankd Admin Console.
   Dark by default and only dark: this is an internal tool that lives on one
   screen next to Xcode, and a light variant would be surface area nobody asked
   for. Colour is carried by two accents over a near-black navy ground, so the
   things that matter — status, roles, destructive actions — are the only
   saturated pixels on the page. */

:root {
  --ink-900: #06070d;
  --ink-850: #090b14;
  --ink-800: #0d1020;
  --ink-700: #141834;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);

  --text: #eef0ff;
  --text-dim: #9aa0c4;
  --text-faint: #646a90;

  --brand: #7c5cff;
  --brand-2: #4aa8ff;
  --brand-glow: rgba(124, 92, 255, 0.45);

  --good: #35d08a;
  --warn: #ffb547;
  --bad: #ff5f6d;
  --unknown: #6b7194;

  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.55);

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 700px at 18% -10%, rgba(124, 92, 255, 0.16), transparent 60%),
    radial-gradient(900px 600px at 95% 0%, rgba(74, 168, 255, 0.12), transparent 55%),
    var(--ink-900);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }

/* ---------- Login ---------- */

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(420px, 100%);
  padding: 40px 36px;
  text-align: center;
  border-radius: 26px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(20, 24, 52, 0.85), rgba(9, 11, 20, 0.9));
  backdrop-filter: blur(30px);
  box-shadow: var(--shadow);
}

.logo {
  width: 62px; height: 62px;
  margin: 0 auto 20px;
  border-radius: 19px;
  display: grid; place-items: center;
  font-size: 30px; font-weight: 800;
  background: linear-gradient(140deg, var(--brand), var(--brand-2));
  box-shadow: 0 12px 34px var(--brand-glow);
}

.login-card h1 { margin: 0 0 6px; font-size: 23px; letter-spacing: -0.02em; }
.login-card p { margin: 0 0 28px; color: var(--text-dim); font-size: 14px; }

.apple-button {
  width: 100%;
  padding: 14px;
  border-radius: 13px;
  border: none;
  background: #fff;
  color: #000;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 9px;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.apple-button:hover { transform: translateY(-1px); }
.apple-button:active { transform: translateY(0); opacity: 0.85; }

.denied {
  margin-bottom: 22px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 95, 109, 0.3);
  background: rgba(255, 95, 109, 0.1);
  text-align: left;
}
.denied strong { display: block; font-size: 14px; margin-bottom: 4px; }
.denied span { font-size: 13px; color: var(--text-dim); }

/* ---------- Shell ---------- */

.shell { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }

.sidebar {
  border-right: 1px solid var(--line);
  background: rgba(6, 7, 13, 0.72);
  backdrop-filter: blur(24px);
  display: flex; flex-direction: column;
  padding: 22px 14px 16px;
  position: sticky; top: 0; height: 100vh;
}

.brand { display: flex; align-items: center; gap: 11px; padding: 0 10px 22px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 11px;
  display: grid; place-items: center; font-weight: 800; font-size: 17px;
  background: linear-gradient(140deg, var(--brand), var(--brand-2));
  box-shadow: 0 8px 20px var(--brand-glow);
}
.brand-text b { display: block; font-size: 14px; letter-spacing: -0.01em; }
.brand-text span { font-size: 11px; color: var(--text-faint); letter-spacing: 0.04em; text-transform: uppercase; }

.nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px; border-radius: 11px;
  color: var(--text-dim); font-size: 14px; cursor: pointer;
  border: 1px solid transparent; background: none; width: 100%; text-align: left;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.045); color: var(--text); }
.nav-item.active {
  color: var(--text);
  background: linear-gradient(90deg, rgba(124, 92, 255, 0.22), rgba(124, 92, 255, 0.05));
  border-color: rgba(124, 92, 255, 0.3);
}
.nav-item .glyph { width: 18px; text-align: center; font-size: 14px; }
.nav-item .soon { margin-left: auto; font-size: 10px; color: var(--text-faint); }

.me {
  margin-top: 14px; padding: 12px;
  border-radius: 14px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}
.me-row { display: flex; align-items: center; gap: 10px; }
.me-name { font-size: 13px; font-weight: 600; }
.me-handle { font-size: 12px; color: var(--text-faint); }
.signout {
  margin-top: 10px; width: 100%; padding: 8px;
  border-radius: 9px; border: 1px solid var(--line);
  background: transparent; color: var(--text-dim);
  font-size: 12.5px; cursor: pointer;
}
.signout:hover { color: var(--text); border-color: var(--line-strong); }

.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 700; color: #fff;
  background: linear-gradient(140deg, var(--brand), var(--brand-2));
  flex: none;
}
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.avatar.lg { width: 68px; height: 68px; font-size: 26px; }

/* ---------- Main ---------- */

.main { padding: 30px 34px 60px; max-width: 1400px; }
.page-head { margin-bottom: 26px; }
.page-head h1 { margin: 0 0 5px; font-size: 27px; letter-spacing: -0.025em; }
.page-head p { margin: 0; color: var(--text-dim); font-size: 14px; }

.range { display: flex; gap: 6px; margin-top: 16px; }
.range button {
  padding: 6px 13px; border-radius: 9px; font-size: 12.5px; cursor: pointer;
  border: 1px solid var(--line); background: rgba(255,255,255,0.03); color: var(--text-dim);
}
.range button.on { color: var(--text); border-color: rgba(124,92,255,0.45); background: rgba(124,92,255,0.16); }

.grid { display: grid; gap: 16px; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); margin-bottom: 18px; }
.two { grid-template-columns: 1.6fr 1fr; align-items: start; }
@media (max-width: 1080px) { .two { grid-template-columns: 1fr; } .shell { grid-template-columns: 1fr; } .sidebar { position: static; height: auto; } }

.card {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(20, 24, 52, 0.5), rgba(9, 11, 20, 0.6));
  backdrop-filter: blur(18px);
  padding: 18px 20px;
}
.card h2 { margin: 0 0 3px; font-size: 15px; letter-spacing: -0.01em; }
.card .sub { margin: 0 0 16px; font-size: 12.5px; color: var(--text-faint); }

.kpi .label { font-size: 12px; color: var(--text-dim); display: flex; align-items: center; gap: 6px; }
.kpi .value { font-size: 30px; font-weight: 800; letter-spacing: -0.03em; margin: 8px 0 3px; font-variant-numeric: tabular-nums; }
.kpi .delta { font-size: 12px; color: var(--text-faint); }
.kpi .delta.up { color: var(--good); }
.kpi .delta.down { color: var(--bad); }

/* ---------- Status ---------- */

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; letter-spacing: 0.01em;
  border: 1px solid var(--line);
}
.pill.owner { color: #ffd36e; border-color: rgba(255,211,110,0.3); background: rgba(255,211,110,0.1); }
.pill.admin { color: #b79bff; border-color: rgba(183,155,255,0.3); background: rgba(124,92,255,0.14); }
.pill.moderator { color: #7fd3ff; border-color: rgba(127,211,255,0.3); background: rgba(74,168,255,0.13); }
.pill.support { color: #86e5b8; border-color: rgba(134,229,184,0.28); background: rgba(53,208,138,0.12); }
.pill.none { color: var(--text-faint); }
.pill.active { color: var(--good); border-color: rgba(53,208,138,0.3); background: rgba(53,208,138,0.1); }
.pill.suspended { color: var(--warn); border-color: rgba(255,181,71,0.3); background: rgba(255,181,71,0.1); }
.pill.revoked, .pill.bad { color: var(--bad); border-color: rgba(255,95,109,0.3); background: rgba(255,95,109,0.1); }
.pill.pending { color: var(--text-dim); }

.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--unknown); }
.dot.operational { background: var(--good); box-shadow: 0 0 9px rgba(53,208,138,0.7); }
.dot.degraded { background: var(--warn); }
.dot.issue { background: var(--bad); box-shadow: 0 0 9px rgba(255,95,109,0.6); }

/* ---------- Tables ---------- */

.rows { display: flex; flex-direction: column; }
.row {
  display: grid; align-items: center; gap: 14px;
  padding: 12px 10px; border-radius: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  cursor: pointer; transition: background 0.12s ease;
}
.row:hover { background: rgba(255,255,255,0.04); }
.row:last-child { border-bottom: none; }
.row.users { grid-template-columns: 1fr 120px 90px 90px 130px; }
.row.admins { grid-template-columns: 1fr 120px 110px 150px 150px; }
.row.head {
  cursor: default; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-faint); padding-bottom: 8px;
}
.row.head:hover { background: none; }
.who { display: flex; align-items: center; gap: 11px; min-width: 0; }
.who b { display: block; font-size: 13.5px; font-weight: 600; }
.who span { font-size: 12px; color: var(--text-faint); }
.num { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--text-dim); }

.toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.search {
  flex: 1; min-width: 220px;
  padding: 10px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: rgba(255,255,255,0.04);
  color: var(--text); font-size: 14px;
}
.search:focus { outline: none; border-color: rgba(124,92,255,0.5); }
.search::placeholder { color: var(--text-faint); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 8px 13px; border-radius: 10px; font-size: 12.5px; cursor: pointer;
  border: 1px solid var(--line); background: rgba(255,255,255,0.03); color: var(--text-dim);
}
.chip.on { color: var(--text); border-color: rgba(124,92,255,0.45); background: rgba(124,92,255,0.16); }

/* ---------- Buttons ---------- */

.btn {
  padding: 9px 16px; border-radius: 11px; font-size: 13.5px; font-weight: 600;
  cursor: pointer; border: 1px solid var(--line); background: rgba(255,255,255,0.05);
  transition: transform 0.12s ease, background 0.12s ease;
}
.btn:hover { background: rgba(255,255,255,0.09); }
.btn:active { transform: scale(0.98); }
.btn.primary {
  border: none; color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 8px 22px var(--brand-glow);
}
.btn.danger { color: var(--bad); border-color: rgba(255,95,109,0.35); background: rgba(255,95,109,0.1); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

/* ---------- Modal ---------- */

.scrim {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(3, 4, 9, 0.72);
  backdrop-filter: blur(8px);
  display: grid; place-items: center; padding: 24px;
  animation: fade 0.18s ease;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  width: min(520px, 100%); max-height: 86vh; overflow-y: auto;
  border-radius: 22px; border: 1px solid var(--line-strong);
  background: linear-gradient(180deg, #171b38, #0b0e1c);
  box-shadow: var(--shadow); padding: 26px;
  animation: rise 0.22s cubic-bezier(0.2, 0.9, 0.3, 1);
}
@keyframes rise { from { transform: translateY(14px) scale(0.98); opacity: 0; } }
.modal h2 { margin: 0 0 6px; font-size: 19px; letter-spacing: -0.02em; }
.modal .sub { margin: 0 0 20px; color: var(--text-dim); font-size: 13.5px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }

.role-option {
  padding: 13px 15px; margin-bottom: 8px;
  border-radius: 13px; border: 1px solid var(--line);
  background: rgba(255,255,255,0.03); cursor: pointer;
}
.role-option:hover { border-color: var(--line-strong); }
.role-option.on { border-color: rgba(124,92,255,0.55); background: rgba(124,92,255,0.13); }
.role-option.off { opacity: 0.4; cursor: not-allowed; }
.role-option b { font-size: 14px; }
.role-option ul { margin: 8px 0 0; padding-left: 17px; font-size: 12.5px; color: var(--text-dim); }
.role-option li { margin-bottom: 3px; }
.role-option li.no { color: var(--text-faint); }

/* ---------- Misc ---------- */

.skeleton {
  border-radius: 10px;
  background: linear-gradient(90deg, rgba(255,255,255,0.04), rgba(255,255,255,0.09), rgba(255,255,255,0.04));
  background-size: 200% 100%;
  animation: shimmer 1.3s linear infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

.empty { padding: 34px 20px; text-align: center; color: var(--text-faint); font-size: 13.5px; }
.error-box {
  padding: 13px 15px; border-radius: 12px; font-size: 13px;
  border: 1px solid rgba(255,95,109,0.3); background: rgba(255,95,109,0.09); color: #ffc3c8;
}
.notice {
  padding: 11px 14px; border-radius: 11px; font-size: 12.5px; color: var(--text-dim);
  border: 1px solid var(--line); background: rgba(255,255,255,0.03);
}

.kv { display: grid; grid-template-columns: 150px 1fr; gap: 9px 16px; font-size: 13px; }
.kv dt { color: var(--text-faint); }
.kv dd { margin: 0; font-variant-numeric: tabular-nums; }

.pulse-score { font-size: 46px; font-weight: 800; letter-spacing: -0.04em; line-height: 1; }
.pulse-bar { height: 7px; border-radius: 999px; background: rgba(255,255,255,0.08); overflow: hidden; margin: 14px 0 10px; }
.pulse-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--brand), var(--brand-2)); transition: width 0.6s cubic-bezier(0.2,0.9,0.3,1); }

.bars { display: flex; align-items: flex-end; gap: 3px; height: 128px; margin-top: 6px; }
.bar { flex: 1; border-radius: 4px 4px 2px 2px; background: linear-gradient(180deg, var(--brand), rgba(74,168,255,0.35)); min-height: 2px; transition: height 0.4s ease; }
.bar.empty-bar { background: rgba(255,255,255,0.06); }
.bar-axis { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--text-faint); margin-top: 7px; }

.health-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid rgba(255,255,255,0.05); font-size: 13px; }
.health-row:last-child { border-bottom: none; }
.health-row .name { flex: 1; }
.health-row .state { font-size: 12px; color: var(--text-dim); }

.actions-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.action-tile {
  padding: 13px; border-radius: 13px; cursor: pointer; text-align: left;
  border: 1px solid var(--line); background: rgba(255,255,255,0.03);
  font-size: 13px; display: flex; align-items: center; gap: 9px;
}
.action-tile:hover { background: rgba(255,255,255,0.07); }
.action-tile:disabled { opacity: 0.4; cursor: not-allowed; }

select.input, input.input {
  width: 100%; padding: 10px 13px; border-radius: 11px; margin-top: 6px;
  border: 1px solid var(--line); background: rgba(255,255,255,0.05); color: var(--text); font-size: 14px;
}
label.field { display: block; font-size: 12.5px; color: var(--text-dim); margin-bottom: 14px; }

/* ---------- Sharing ---------- */
.row.share-funnel { grid-template-columns: 1.4fr repeat(7, 1fr); }
.row.share-top { grid-template-columns: 1fr 110px 110px; }
.row.share-top a { color: var(--text); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meter-row { display: grid; grid-template-columns: 130px 1fr 90px; gap: 12px; align-items: center; padding: 7px 0; font-size: 13px; }
.meter { height: 8px; border-radius: 999px; background: rgba(255,255,255,0.06); overflow: hidden; }
.meter-fill { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #7c5cff, #ec4899); }
.dot.down { background: var(--bad); }
.dot.degraded { background: var(--warn); }
