:root {
  --bg: #0b0c0c;
  --bg-2: #0e0f0f;
  --surface: rgba(255,255,255,.03);
  --surface-2: rgba(255,255,255,.06);
  --surface-hover: rgba(255,255,255,.085);
  --border: rgba(255,255,255,.08);
  --border-strong: rgba(255,255,255,.15);
  --text: #f5f6f5;
  --muted: #a8a8c0;
  --muted-2: #6b6c82;

  --primary: #14b8a6;
  --primary-dim: #0d9488;
  --primary-2: #2dd4bf;
  --primary-soft: rgba(20,184,166,.1);
  --violet: #7c6cf2;
  --coral: #f2545b;

  --success: #34d399;
  --warn: #fbbf24;
  --danger: #f87171;
  --discord: #5865f2;

  --radius: 20px;
  --radius-lg: 24px;
  --radius-sm: 8px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow-md: 0 8px 24px -8px rgba(0,0,0,.55);
  --shadow-lg: 0 24px 60px -16px rgba(0,0,0,.65);

  --ease: cubic-bezier(.22,1,.36,1);
  --ease-spring: cubic-bezier(.34,1.56,.64,1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { color-scheme: dark; scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 Manrope, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* faint fixed grid texture + a single soft accent glow — restrained, not a colorful mesh */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(800px 420px at 15% -10%, rgba(20,184,166,.09), transparent 60%),
    repeating-linear-gradient(0deg, rgba(255,255,255,.025) 0 1px, transparent 1px 44px),
    repeating-linear-gradient(90deg, rgba(255,255,255,.025) 0 1px, transparent 1px 44px),
    var(--bg-2);
  mask-image: radial-gradient(1200px 800px at 50% 0%, #000 0%, transparent 75%);
}

::selection { background: rgba(20,184,166,.35); color: #fff; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.26); background-clip: padding-box; }

:focus-visible { outline: 2px solid var(--primary-2); outline-offset: 2px; border-radius: 4px; }

.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.centered { text-align: center; }
.row { display: flex; gap: 10px; align-items: center; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.right { margin-left: auto; }

@keyframes fadeRise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes popIn { from { opacity: 0; transform: scale(.96) translateY(4px); } to { opacity: 1; transform: scale(1) translateY(0); } }
@keyframes softPulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }

/* ---------- eyebrow badge (kicker above section titles) ---------- */
.eyebrow {
  display: inline-flex; align-items: center;
  background: var(--primary); color: #fff;
  font-size: 12.5px; font-weight: 600;
  padding: 3px 10px; border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  margin-bottom: 8px;
}

/* ---------- login ---------- */
.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}
/* slow-drifting aurora behind the card — the only screen with room for drama */
.login-screen::before,
.login-screen::after {
  content: "";
  position: absolute;
  width: 620px; height: 620px;
  border-radius: 50%;
  filter: blur(90px);
  opacity: .5;
  pointer-events: none;
}
.login-screen::before {
  background: radial-gradient(circle, var(--primary) 0%, transparent 68%);
  top: -280px; left: -180px;
  animation: drift1 17s ease-in-out infinite alternate;
}
.login-screen::after {
  background: radial-gradient(circle, var(--login-glow-2, #0ea5e9) 0%, transparent 68%);
  bottom: -300px; right: -200px;
  animation: drift2 21s ease-in-out infinite alternate;
}
@keyframes drift1 { to { transform: translate3d(120px, 90px, 0) scale(1.18); } }
@keyframes drift2 { to { transform: translate3d(-110px, -70px, 0) scale(1.12); } }

.login-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 410px;
  background: rgba(18,19,19,.72);
  backdrop-filter: blur(22px) saturate(150%);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 40px 34px;
  text-align: center;
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255,255,255,.06);
  animation: popIn .55s var(--ease-spring);
}
.login-logo {
  font-size: 34px;
  width: 68px; height: 68px;
  display: grid; place-items: center;
  margin: 0 auto 20px;
  border-radius: var(--radius);
  background: var(--primary);
  box-shadow: 0 8px 28px -6px rgba(20,184,166,.6), inset 0 1px 0 rgba(255,255,255,.25);
  animation: logoFloat 5s ease-in-out infinite alternate;
}
@keyframes logoFloat { to { transform: translateY(-5px); } }

.login-card #loginBadge { margin-bottom: 10px; }
.login-card h1 {
  font-size: 25px;
  font-weight: 800;
  letter-spacing: -.03em;
  margin: 2px 0 5px;
  color: var(--text);
}

/* the two portals should never be mistaken for one another */
body[data-face="admin"] {
  --primary: #6366f1; --primary-dim: #4f46e5; --primary-2: #a5b4fc;
  --primary-soft: rgba(99,102,241,.12); --login-glow-2: #a855f7;
}
body[data-face="customer"] { --login-glow-2: #22d3ee; }
.login-form { margin-top: 26px; text-align: left; }
.login-form label { display: block; font-size: 12.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 7px; }
.divider { position: relative; margin: 24px 0 18px; text-align: center; }
.divider::before { content: ""; position: absolute; inset: 50% 0 auto; height: 1px; background: linear-gradient(90deg, transparent, var(--border-strong), transparent); }
.divider span { position: relative; background: #131414; padding: 0 14px; color: var(--muted-2); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }

/* ---------- controls ---------- */
input, select, textarea {
  width: 100%;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 14px;
  transition: border-color .15s var(--ease), background .15s var(--ease), box-shadow .15s var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--muted-2); }
input:hover, select:hover, textarea:hover { border-color: var(--border-strong); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary-2);
  background: rgba(20,184,166,.06);
  box-shadow: 0 0 0 3px rgba(20,184,166,.16);
}
textarea { min-height: 110px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
label.field { display: block; margin-bottom: 15px; }
label.field > span { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 6px; letter-spacing: .01em; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: transform .12s var(--ease), background .15s var(--ease), border-color .15s var(--ease), box-shadow .15s var(--ease), filter .15s var(--ease);
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--surface-hover); border-color: var(--border-strong); transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: scale(.96); transition-duration: .08s; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.primary {
  background: var(--primary);
  border-color: transparent;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 16px -4px rgba(20,184,166,.45);
}
.btn.primary:hover:not(:disabled) { background: var(--primary-dim); box-shadow: 0 6px 20px -4px rgba(20,184,166,.6); }
.btn.discord { background: var(--discord); border-color: transparent; color: #fff; font-weight: 600; }
.btn.discord:hover:not(:disabled) { box-shadow: 0 4px 16px -4px rgba(88,101,242,.6); }
.btn.danger { background: rgba(248,113,113,.08); border-color: rgba(248,113,113,.3); color: #fca5a5; }
.btn.danger:hover:not(:disabled) { background: rgba(248,113,113,.16); border-color: rgba(248,113,113,.5); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover:not(:disabled) { background: var(--surface-2); }
.btn.small { padding: 7px 12px; font-size: 13px; }
.btn.block { width: 100%; margin-top: 16px; }

/* ---------- layout: sidebar shell ---------- */
.brand-mark { display: block; }

.app-shell { display: flex; min-height: 100vh; align-items: stretch; }

.sidebar {
  width: 246px; flex: 0 0 246px;
  background: rgba(14,15,15,.7);
  backdrop-filter: blur(20px) saturate(140%);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; z-index: 30;
}
.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 22px 20px 18px; }
.sidebar-brand .mark-box {
  width: 34px; height: 34px; display: grid; place-items: center; flex: 0 0 auto;
  border-radius: 10px; background: var(--primary-soft); border: 1px solid rgba(20,184,166,.28);
}
.sidebar-brand .wordmark { font-weight: 700; font-size: 15.5px; letter-spacing: -.01em; }

.side-nav { display: flex; flex-direction: column; gap: 2px; padding: 6px 12px; overflow-y: auto; flex: 1; position: relative; }
.side-nav .tab {
  width: 100%; justify-content: flex-start;
  position: relative; z-index: 1;
  padding: 10px 14px 10px 16px;
}
.side-nav .tab.active::before {
  content: ""; position: absolute; left: -3px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; border-radius: 3px; background: var(--primary);
}

/* sliding highlight — one element that glides between tabs via transform,
   instead of each button instantly toggling its own background */
.nav-indicator {
  position: absolute; left: 12px; right: 12px; top: 0; height: 38px;
  border-radius: 9px; background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--border-strong);
  transition: transform .38s var(--ease), height .38s var(--ease);
  z-index: 0; pointer-events: none; opacity: 0;
}
.nav-indicator.ready { opacity: 1; }

.tab {
  background: none; border: none; color: var(--muted);
  border-radius: 9px; cursor: pointer; font: inherit; font-size: 13.5px; font-weight: 500; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 10px;
  transition: color .15s var(--ease), background .18s var(--ease);
}
.tab:hover { color: var(--text); background: rgba(255,255,255,.035); }
.side-nav .tab:hover { background: transparent; }
.tab.active { background: var(--surface-2); color: #fff; font-weight: 600; }
.side-nav .tab.active { background: transparent; }
.tab .ic {
  font-size: 12px; line-height: 1; width: 22px; height: 22px; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; background: transparent; color: var(--muted-2);
  transition: background .18s var(--ease), color .18s var(--ease);
}
.tab.active .ic, .tab:hover .ic { background: var(--primary-soft); color: var(--primary-2); }

.sidebar-foot { padding: 14px; border-top: 1px solid var(--border); }
#userLabel { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.user-meta { display: flex; flex-direction: column; gap: 3px; line-height: 1.2; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.role-pill {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  padding: 2px 6px; border-radius: 5px; width: fit-content;
}
.role-pill.admin { color: #99f2e2; background: var(--primary-soft); }
.role-pill.customer { color: #93c5fd; background: rgba(59,130,246,.14); }
.avatar {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex: 0 0 auto;
  background: var(--primary); color: #fff; font-size: 12.5px; font-weight: 700;
  box-shadow: 0 2px 8px -2px rgba(20,184,166,.5);
}

.sidebar-backdrop { position: fixed; inset: 0; background: rgba(5,6,10,.6); backdrop-filter: blur(2px); z-index: 25; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.mobile-bar { display: none; }

.view { padding: 32px 32px 60px; max-width: 1180px; margin: 0 auto; width: 100%; }
/* re-added on every tab switch (see paintView in app.js) so the fade actually
   replays each time, instead of once on first paint */
.view-in { animation: fadeRise .4s var(--ease); }
.loading { color: var(--muted); padding: 60px; text-align: center; }
.loading::before {
  content: ""; display: block; width: 26px; height: 26px; margin: 0 auto 14px;
  border-radius: 50%; border: 2.5px solid var(--border-strong); border-top-color: var(--primary-2);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- skeleton loading state ---------- */
.skeleton-view { animation: fadeRise .25s var(--ease); }
.skel {
  background: linear-gradient(90deg, rgba(255,255,255,.04) 25%, rgba(255,255,255,.1) 50%, rgba(255,255,255,.04) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: 7px;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.skel-eyebrow { width: 88px; height: 20px; border-radius: var(--radius-sm); margin-bottom: 12px; }
.skel-title { width: 220px; height: 30px; margin-bottom: 26px; }
.skel-card .skel-line { height: 12px; margin-bottom: 12px; }
.skel-card .skel-line.short { width: 55%; }
.skel-card .skel-line.tall { width: 40%; height: 22px; margin-bottom: 0; }
.skel-panel .panel-body { padding: 16px 20px; }
.skel-row { height: 40px; margin-bottom: 10px; }
.skel-row:last-child { margin-bottom: 0; }

h2.section { font-size: 28px; font-weight: 700; letter-spacing: -.02em; margin-bottom: 4px; }
.section-head { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.section-head .right { margin-left: auto; }
.section-head-main { display: flex; flex-direction: column; }

/* ---------- cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 28px; }
.card {
  background: rgba(255,255,255,.025);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  transition: transform .18s var(--ease), border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.card:hover { transform: translateY(-2px); border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.card .label { color: var(--muted); font-size: 12.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.card .card-icon {
  width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--primary-soft); color: var(--primary-2); font-size: 12px;
}
.card .value { font-size: 30px; font-weight: 700; letter-spacing: -.02em; margin-top: 8px; }
.card .value.ok { color: var(--success); }
.card .value.warn { color: var(--warn); }
.card .value.bad { color: var(--danger); }

.panel {
  background: rgba(255,255,255,.02);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 22px;
  box-shadow: var(--shadow-sm);
}
.panel-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.panel-head h3 { font-size: 15px; font-weight: 700; letter-spacing: -.005em; }
.panel-body { padding: 20px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left; padding: 12px 16px; color: var(--muted-2); font-weight: 600; font-size: 11.5px;
  text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--border); white-space: nowrap;
}
td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr { transition: background .12s var(--ease); }
tbody tr:hover { background: rgba(255,255,255,.03); }
td.actions { text-align: right; white-space: nowrap; }
td.actions .btn { margin-left: 6px; }

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.truncate { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; vertical-align: bottom; }

/* ---------- pills ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--border);
}
.pill.ok { color: var(--success); border-color: rgba(52,211,153,.3); background: rgba(52,211,153,.09); }
.pill.warn { color: var(--warn); border-color: rgba(251,191,36,.3); background: rgba(251,191,36,.09); }
.pill.bad { color: var(--danger); border-color: rgba(248,113,113,.3); background: rgba(248,113,113,.09); }
.pill.off { color: var(--muted); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; display: inline-block; box-shadow: 0 0 6px currentColor; }
.pill.ok .dot { animation: softPulse 2s ease-in-out infinite; }

/* ---------- alerts / toast ---------- */
.alert { padding: 12px 15px; border-radius: var(--radius-sm); font-size: 13.5px; margin-bottom: 14px; border: 1px solid; }
.alert.error { background: rgba(248,113,113,.1); border-color: rgba(248,113,113,.28); color: #fca5a5; }
.alert.info { background: var(--primary-soft); border-color: rgba(20,184,166,.28); color: #99f2e2; }
.alert.warn { background: rgba(251,191,36,.1); border-color: rgba(251,191,36,.28); color: #fcd34d; }

.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
  background: rgba(20,21,21,.94); border: 1px solid var(--border-strong);
  padding: 13px 22px; border-radius: 12px; z-index: 100; max-width: 90vw;
  box-shadow: var(--shadow-lg); backdrop-filter: blur(12px);
  font-size: 14px; font-weight: 500;
  animation: popIn .4s var(--ease-spring);
}
.toast.ok { border-color: rgba(52,211,153,.45); }
.toast.bad { border-color: rgba(248,113,113,.45); }

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(5,6,10,.72); backdrop-filter: blur(4px);
  display: grid; place-items: center; z-index: 50; padding: 20px;
  animation: fadeRise .18s var(--ease);
}
.modal {
  background: #131414; border: 1px solid var(--border-strong); border-radius: var(--radius-lg);
  width: 100%; max-width: 520px; max-height: 85vh; display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: popIn .34s var(--ease-spring);
}
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; }
.modal-head h3 { font-size: 16px; font-weight: 700; flex: 1; letter-spacing: -.01em; }
.modal-body { padding: 22px; overflow-y: auto; }
.modal-foot { padding: 16px 22px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ---------- admin previewing the customer dashboard ---------- */
.preview-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 16px; margin-bottom: 20px;
  border-radius: var(--radius-sm);
  background: rgba(251,191,36,.09);
  border: 1px solid rgba(251,191,36,.3);
  color: #fcd34d; font-size: 13.5px;
}
.preview-dot {
  width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto;
  background: var(--warn); box-shadow: 0 0 8px var(--warn);
  animation: softPulse 2s ease-in-out infinite;
}
.preview-bar .btn { color: var(--text); }

/* ==================================================================
   CUSTOMER DASHBOARD
   ================================================================== */

/* ---------- hero band ---------- */
.hero {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: linear-gradient(150deg, rgba(20,184,166,.13), rgba(255,255,255,.02) 45%);
  padding: 30px 32px;
  margin-bottom: 26px;
}
.hero-glow {
  position: absolute; top: -60%; right: -10%; width: 420px; height: 420px;
  background: radial-gradient(circle, rgba(20,184,166,.28), transparent 65%);
  filter: blur(30px); pointer-events: none;
  animation: heroFloat 9s ease-in-out infinite alternate;
}
@keyframes heroFloat {
  from { transform: translate3d(0,0,0) scale(1); }
  to   { transform: translate3d(-40px,26px,0) scale(1.12); }
}
.hero-inner {
  position: relative; z-index: 1;
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 28px; flex-wrap: wrap;
}
.hero-title { font-size: 32px; font-weight: 800; letter-spacing: -.03em; margin: 2px 0 6px; }
.hero-sub { color: var(--muted); font-size: 14.5px; }
.hero-stats { display: flex; gap: 30px; }
.hero-stat-value { font-size: 30px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.hero-stat-value.ok { color: var(--primary-2); }
.hero-stat-value.warn { color: var(--warn); }
.hero-stat-label {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .07em; color: var(--muted-2); margin-top: 5px;
}

/* ---------- server rail (pick a server by its real icon) ---------- */
.g-avatar {
  border-radius: 30%;              /* squircle — reads as Discord without copying it */
  object-fit: cover;
  display: grid; place-items: center;
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 700;
  flex: 0 0 auto;
  overflow: hidden;
}

.rail { margin-bottom: 22px; }
.rail-scroll {
  display: flex; gap: 10px; overflow-x: auto;
  padding: 4px 2px 10px;
  scroll-snap-type: x proximity;
}
.rail-scroll::-webkit-scrollbar { height: 6px; }

.rail-item {
  position: relative;
  flex: 0 0 auto; width: 104px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 12px 8px 10px;
  background: rgba(255,255,255,.025);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer; font: inherit; color: var(--muted);
  scroll-snap-align: start;
  transition: transform .2s var(--ease), border-color .2s var(--ease),
              background .2s var(--ease), color .2s var(--ease);
}
.rail-item:hover { transform: translateY(-2px); border-color: var(--border-strong); color: var(--text); }
.rail-item .rail-avatar {
  width: 46px; height: 46px; font-size: 17px;
  filter: saturate(.5) brightness(.8);
  transition: filter .25s var(--ease), transform .25s var(--ease);
}
.rail-item:hover .rail-avatar { filter: none; }

.rail-item.active {
  background: var(--primary-soft);
  border-color: rgba(20,184,166,.45);
  color: var(--text);
}
.rail-item.active .rail-avatar { filter: none; transform: scale(1.04); }

/* the little capsule that slides out on the active server, Discord-style */
.rail-pill {
  position: absolute; left: 0; top: 50%;
  width: 3px; height: 0; border-radius: 0 3px 3px 0;
  background: var(--primary);
  transform: translateY(-50%);
  transition: height .25s var(--ease);
}
.rail-item.active .rail-pill { height: 46px; }

.rail-name {
  font-size: 11.5px; font-weight: 600; line-height: 1.25;
  text-align: center; max-width: 100%;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.rail-dot {
  position: absolute; top: 10px; right: 10px;
  width: 7px; height: 7px; border-radius: 50%;
}
.rail-dot.on { background: var(--success); box-shadow: 0 0 7px var(--success); }
.rail-dot.off { background: var(--muted-2); }

/* ---------- selected server stage ---------- */
.stage { margin-bottom: 30px; }
.stage-head {
  display: flex; align-items: center; gap: 15px;
  margin-bottom: 16px; flex-wrap: wrap;
}
.stage-avatar { width: 52px; height: 52px; font-size: 20px; }
.stage-id { min-width: 0; flex: 1; }
.stage-name { font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.stage-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 3px; }
.stage-sid { color: var(--muted-2); font-size: 11.5px; }
.row-avatar { width: 32px; height: 32px; font-size: 13px; }

/* ---------- bot tiles ---------- */
.bot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 16px; }
.bot-tile {
  position: relative;
  background: rgba(255,255,255,.028);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  overflow: hidden;
  transition: transform .22s var(--ease), border-color .22s var(--ease), box-shadow .22s var(--ease);
}
.bot-tile:hover { transform: translateY(-3px); border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.bot-tile.is-off { opacity: .62; }
.bot-tile.is-playing { border-color: rgba(20,184,166,.4); }
/* soft accent wash only while audio is actually playing */
.bot-tile.is-playing::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(420px 120px at 50% 0%, rgba(20,184,166,.14), transparent 70%);
}

.bt-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; position: relative; z-index: 1; }
.bt-avatar {
  width: 44px; height: 44px; flex: 0 0 auto;
  border-radius: 13px;
  display: grid; place-items: center;
  background: var(--primary-soft);
  border: 1px solid rgba(20,184,166,.25);
  color: var(--primary-2);
  font-weight: 700; font-size: 15px;
}
.bot-tile.is-playing .bt-avatar {
  background: var(--primary); border-color: transparent; color: #fff;
  box-shadow: 0 4px 16px -4px rgba(20,184,166,.6);
}
.bt-id { min-width: 0; flex: 1; }
.bt-name { font-weight: 700; font-size: 14.5px; letter-spacing: -.01em; }
.bt-prefix { min-height: 17px; }

/* animated equalizer — only rendered while playing */
.eq { display: flex; align-items: flex-end; gap: 2.5px; height: 18px; }
.eq i {
  width: 3px; border-radius: 2px; background: currentColor;
  animation: eqBounce .9s ease-in-out infinite;
}
.eq i:nth-child(1) { height: 40%; animation-delay: -.5s; }
.eq i:nth-child(2) { height: 90%; animation-delay: -.25s; }
.eq i:nth-child(3) { height: 60%; animation-delay: -.75s; }
.eq i:nth-child(4) { height: 75%; animation-delay: 0s; }
@keyframes eqBounce { 0%, 100% { transform: scaleY(.35); } 50% { transform: scaleY(1); } }

.bt-np { margin-bottom: 16px; position: relative; z-index: 1; }
.bt-np-label {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--muted-2); margin-bottom: 5px;
}
.bt-np-title {
  font-size: 14px; font-weight: 500; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bot-tile.is-off .bt-np-title, .bot-tile:not(.is-playing) .bt-np-title { color: var(--muted); }

.bt-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  padding: 12px 0; margin-bottom: 14px;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  position: relative; z-index: 1;
}
.bt-stat { text-align: center; }
.bt-stat-value { font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.bt-stat-label {
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted-2); margin-top: 3px;
}

.bt-actions { display: flex; gap: 7px; align-items: center; position: relative; z-index: 1; }
.icon-ctl {
  width: 34px; height: 34px; flex: 0 0 auto;
  display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; color: var(--text);
  font-size: 12px; cursor: pointer;
  transition: background .15s var(--ease), border-color .15s var(--ease),
              transform .12s var(--ease), color .15s var(--ease);
}
.icon-ctl:hover:not(:disabled) {
  background: var(--primary-soft); border-color: rgba(20,184,166,.45);
  color: var(--primary-2); transform: translateY(-1px);
}
.icon-ctl:active:not(:disabled) { transform: scale(.92); transition-duration: .08s; }
.icon-ctl:disabled { opacity: .35; cursor: not-allowed; }
.icon-ctl.busy { color: transparent; position: relative; }
.icon-ctl.busy::after {
  content: ""; position: absolute; width: 13px; height: 13px;
  border-radius: 50%; border: 2px solid var(--border-strong);
  border-top-color: var(--primary-2); animation: spin .6s linear infinite;
}
.bt-play { margin-left: auto; }
.bt-play:not(:disabled) { color: var(--primary-2); border-color: rgba(20,184,166,.35); }
.bot-tile.is-paused { border-color: rgba(251,191,36,.3); }
.bot-tile.is-paused .bt-avatar { background: rgba(251,191,36,.12); border-color: rgba(251,191,36,.3); color: var(--warn); }

/* ---------- subscription cards ---------- */
.sub-card {
  background: rgba(255,255,255,.025);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 20px;
}
.sub-card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  padding: 18px 22px; border-bottom: 1px solid var(--border);
}
.sub-card-head h3 { font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.sub-card-body { display: flex; gap: 32px; padding: 26px 22px; align-items: center; flex-wrap: wrap; }
.sub-detail { flex: 1; min-width: 240px; }
.sub-detail .alert { margin-top: 14px; margin-bottom: 0; }
.sub-actions { margin-top: 18px; }

.detail-row {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 9px 0; border-bottom: 1px solid var(--border);
}
.detail-row:last-of-type { border-bottom: none; }
.detail-label { color: var(--muted); font-size: 13px; }
.detail-value { font-weight: 600; font-size: 13.5px; text-transform: capitalize; }

/* conic-gradient donut — --pct is set inline per server */
.ring {
  --ring-color: var(--primary);
  width: 132px; height: 132px; flex: 0 0 auto;
  border-radius: 50%;
  display: grid; place-items: center;
  background: conic-gradient(var(--ring-color) calc(var(--pct) * 1%), rgba(255,255,255,.06) 0);
  transition: background .6s var(--ease);
}
.ring-warn { --ring-color: var(--warn); }
.ring-bad { --ring-color: var(--danger); }
.ring-face {
  width: 106px; height: 106px; border-radius: 50%;
  background: #101111;
  display: grid; place-items: center; text-align: center;
}
.ring-value { font-size: 30px; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.ring-label {
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .07em; color: var(--muted-2); margin-top: 5px;
}

.empty { padding: 48px 20px; text-align: center; color: var(--muted-2); font-size: 14px; }

@media (max-width: 560px) {
  .hero { padding: 24px 20px; }
  .hero-title { font-size: 26px; }
  .hero-stats { gap: 22px; }
  .hero-stat-value { font-size: 24px; }
  .sub-card-body { gap: 22px; justify-content: center; }
}

/* ---------- overview: subscription status distribution ---------- */
.dist-bar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--surface-2); }
.dist-seg { height: 100%; transition: width .4s var(--ease); }
.dist-seg:not(:last-child) { border-right: 2px solid var(--bg-2); }
.dist-legend { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 16px; }
.dist-legend-item { display: flex; align-items: center; gap: 7px; font-size: 13px; }
.dist-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }

.icon-btn { width: 34px; height: 34px; padding: 0; font-size: 15px; }

@media (max-width: 860px) {
  .app-shell { display: block; }
  .mobile-bar {
    display: flex; align-items: center; gap: 12px; height: 56px; padding: 0 16px;
    background: rgba(14,15,15,.85); backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20;
  }
  .mobile-brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14.5px; }
  .sidebar {
    position: fixed; left: 0; top: 0; height: 100vh; z-index: 40;
    transform: translateX(-100%); transition: transform .25s var(--ease);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .view { padding: 20px 16px 50px; }
  h2.section { font-size: 23px; }
}
@media (min-width: 861px) {
  .sidebar-backdrop { display: none; }
}
