:root {
  --bg: #0b0b12;
  --bg-2: #11111b;
  --panel: rgba(255, 255, 255, 0.045);
  --panel-2: rgba(255, 255, 255, 0.075);
  --border: rgba(255, 255, 255, 0.08);
  --border-2: rgba(255, 255, 255, 0.14);
  --text: #f3f2f8;
  --muted: #9a98ad;
  --faint: #6b6980;
  --accent: #8b5cf6;
  --accent-2: #06b6d4;
  --accent-3: #ec4899;
  --grad: linear-gradient(135deg, var(--accent) 0%, #6366f1 50%, var(--accent-2) 100%);
  --ok: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 20px 60px -20px rgba(0, 0, 0, 0.6);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Space Grotesk", var(--font);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: "";
  position: fixed; inset: 0;
  background:
    radial-gradient(900px 600px at 0% -10%, rgba(139, 92, 246, 0.16), transparent 60%),
    radial-gradient(800px 500px at 110% 10%, rgba(6, 182, 212, 0.10), transparent 60%);
  pointer-events: none;
  z-index: -1;
}
[hidden] { display: none !important; }
svg { width: 20px; height: 20px; flex: none; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--display); letter-spacing: -0.02em; margin: 0; }
.muted { color: var(--muted); }
.glass {
  background: var(--panel);
  border: 1px solid var(--border);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
}

/* ---------- Buttons & fields ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px;
  border-radius: 999px; border: 1px solid var(--border-2);
  background: var(--panel-2);
  font-weight: 600; white-space: nowrap;
  transition: transform .15s, background .2s, border-color .2s, box-shadow .2s;
}
.btn svg { width: 18px; height: 18px; }
.btn:hover { background: rgba(255, 255, 255, 0.12); }
.btn:active { transform: scale(0.97); }
.btn.primary {
  background: var(--grad); border-color: transparent; color: white;
  box-shadow: 0 8px 24px -8px rgba(139, 92, 246, 0.7);
}
.btn.primary:hover { box-shadow: 0 10px 30px -6px rgba(139, 92, 246, 0.9); filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.small { height: 34px; padding: 0 14px; font-size: 13px; }
.btn.danger { color: var(--bad); }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .5; pointer-events: none; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 36px; height: 36px; border-radius: 10px;
  border: 0; background: transparent; color: var(--muted);
  transition: background .2s, color .2s;
}
.icon-btn:hover { background: var(--panel-2); color: var(--text); }
.icon-btn.danger:hover { color: var(--bad); }
.icon-btn svg { width: 18px; height: 18px; }

.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 13px; color: var(--muted); font-weight: 500; }
.field input, .field select {
  height: 44px; padding: 0 14px;
  border-radius: var(--radius-sm); border: 1px solid var(--border-2);
  background: rgba(0, 0, 0, 0.25); outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.field input:focus, .field select:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.2); }
.form-error { color: var(--bad); min-height: 1.2em; margin: 0 0 10px; font-size: 14px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
  background: var(--panel-2); border: 1px solid var(--border);
}
.chip.admin { color: #f0abfc; background: rgba(236, 72, 153, .12); border-color: rgba(236, 72, 153, .3); }
.chip.dj { color: #c4b5fd; background: rgba(139, 92, 246, .14); border-color: rgba(139, 92, 246, .35); }
.chip.listener { color: #67e8f9; background: rgba(6, 182, 212, .12); border-color: rgba(6, 182, 212, .3); }
.chip.live { color: #fecaca; background: rgba(239, 68, 68, .18); border-color: rgba(239, 68, 68, .4); }
.chip.live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #ef4444; animation: pulse 1.4s infinite; }

/* ---------- Brand ---------- */
.brand { display: flex; align-items: center; gap: 10px; font: 700 20px var(--display); letter-spacing: -0.02em; }
.brand.big { font-size: 30px; justify-content: center; margin-bottom: 6px; }
.logo {
  display: grid; place-items: center;
  width: 36px; height: 36px; border-radius: 11px;
  background: var(--grad); color: white;
  box-shadow: 0 6px 20px -6px rgba(139, 92, 246, 0.8);
}
.brand.big .logo { width: 48px; height: 48px; border-radius: 14px; }
.logo svg { width: 20px; height: 20px; }

/* ---------- Login ---------- */
.login { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; position: relative; overflow: hidden; }
.login-card { width: min(400px, 100%); padding: 36px 30px 30px; border-radius: 24px; box-shadow: var(--shadow); position: relative; z-index: 1; }
.login-card > p { text-align: center; margin: 0 0 26px; }
.blob { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .55; animation: float 16s ease-in-out infinite; }
.b1 { width: 420px; height: 420px; background: #7c3aed; top: -120px; left: -80px; }
.b2 { width: 360px; height: 360px; background: #0891b2; bottom: -120px; right: -60px; animation-delay: -5s; }
.b3 { width: 260px; height: 260px; background: #db2777; top: 40%; left: 55%; opacity: .35; animation-delay: -10s; }
@keyframes float { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(40px, -30px) scale(1.1); } }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: 280px 1fr; min-height: 100%; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 6px;
  padding: 22px 16px;
  border-right: 1px solid var(--border);
  background: rgba(10, 10, 16, 0.6);
  backdrop-filter: blur(20px);
}
.sidebar .brand { padding: 0 8px 14px; }
.side-label { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); padding: 14px 10px 6px; }
.main { padding: 28px clamp(16px, 4vw, 48px) 60px; min-width: 0; max-width: 1200px; width: 100%; }

/* Bot list */
.bot-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.bot {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 10px 12px;
  border-radius: 14px; border: 1px solid transparent;
  background: transparent; text-align: left;
  transition: background .2s, border-color .2s;
}
.bot:hover { background: var(--panel); }
.bot.active { background: var(--panel-2); border-color: var(--border-2); }
.bot-icon {
  position: relative; display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: 12px;
  background: linear-gradient(135deg, rgba(139, 92, 246, .3), rgba(6, 182, 212, .25));
  font: 700 12px var(--display); color: white;
}
.bot-icon .dot { position: absolute; right: -2px; bottom: -2px; border: 2px solid var(--bg); }
.bot-text { min-width: 0; flex: 1; }
.bot-text b { display: block; font-size: 14px; }
.bot-text small { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--faint); flex: none; }
.dot.on { background: var(--ok); box-shadow: 0 0 10px rgba(52, 211, 153, .7); }
.dot.off { background: var(--bad); }

.eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; }
.eq i { width: 3px; background: var(--accent-2); border-radius: 2px; animation: eq 1s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: -.3s; background: var(--accent); }
.eq i:nth-child(3) { animation-delay: -.6s; background: var(--accent-3); }
.eq.paused i { animation-play-state: paused; }
@keyframes eq { 0%, 100% { height: 4px; } 50% { height: 14px; } }

/* Nav */
.nav { display: grid; gap: 2px; }
.nav button {
  display: flex; align-items: center; gap: 12px;
  height: 42px; padding: 0 12px;
  border: 0; border-radius: 12px; background: transparent;
  color: var(--muted); font-weight: 500; text-align: left;
  transition: background .2s, color .2s;
}
.nav button:hover { background: var(--panel); color: var(--text); }
.nav button.active { background: var(--panel-2); color: var(--text); }
.nav button.active svg { color: var(--accent); }

.me {
  margin-top: auto;
  display: flex; align-items: center; gap: 10px;
  padding: 12px; border-radius: 14px;
  background: var(--panel); border: 1px solid var(--border);
}
.avatar {
  display: grid; place-items: center;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--grad); font-weight: 700; color: white; text-transform: uppercase;
}
.me-text { flex: 1; min-width: 0; }
.me-text b { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; }
.me-text small { color: var(--muted); font-size: 12px; }

/* ---------- Hero / now playing ---------- */
.hero {
  position: relative; overflow: hidden;
  border-radius: 28px; border: 1px solid var(--border);
  background: var(--bg-2);
  box-shadow: var(--shadow);
  isolation: isolate;
}
.hero-bg {
  position: absolute; inset: -60px; z-index: -1;
  background: radial-gradient(600px 400px at 20% 30%, rgba(139, 92, 246, .45), transparent 60%),
              radial-gradient(500px 400px at 90% 80%, rgba(6, 182, 212, .35), transparent 60%);
  background-size: cover; background-position: center;
  filter: blur(50px) saturate(160%);
  opacity: .9;
  transition: background-image .6s;
}
.hero-bg.has-img { opacity: .55; }
.hero::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(11, 11, 18, .15), rgba(11, 11, 18, .75)); }
.hero-inner { display: flex; gap: 32px; align-items: center; padding: 32px; }
.art {
  width: 220px; height: 220px; flex: none;
  border-radius: 22px; overflow: hidden;
  display: grid; place-items: center;
  background: var(--grad);
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .7);
  transition: transform .4s;
}
.art svg { width: 72px; height: 72px; color: rgba(255, 255, 255, .85); }
.art img { width: 100%; height: 100%; object-fit: cover; }
.art.spin-in { animation: pop .5s ease; }
@keyframes pop { from { transform: scale(.92); opacity: .4; } to { transform: scale(1); opacity: 1; } }
.hero-info { flex: 1; min-width: 0; }
.eyebrow { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }
.hero h1 { font-size: clamp(24px, 3.4vw, 40px); line-height: 1.12; margin: 10px 0 8px; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sub { color: #cfcde0; margin: 0 0 22px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.progress { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.time { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 40px; }
.time:last-child { text-align: right; }
.bar { position: relative; flex: 1; height: 6px; border-radius: 6px; background: rgba(255, 255, 255, .14); cursor: pointer; }
.bar .fill { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: inherit; background: var(--grad); }
.bar .knob { position: absolute; top: 50%; left: 0; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: white; box-shadow: 0 2px 8px rgba(0, 0, 0, .5); opacity: 0; transition: opacity .2s; }
.bar:hover .knob { opacity: 1; }
.progress.live .bar { cursor: default; }
.progress.live .fill { width: 100% !important; opacity: .35; animation: shimmer 2.4s linear infinite; background-size: 200% 100%; }
.progress.live .knob { display: none; }
@keyframes shimmer { to { background-position: -200% 0; } }

.controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ctl {
  display: grid; place-items: center;
  width: 48px; height: 48px; border-radius: 50%;
  border: 1px solid var(--border-2); background: rgba(255, 255, 255, .08);
  transition: transform .15s, background .2s;
}
.ctl:hover { background: rgba(255, 255, 255, .16); }
.ctl:active { transform: scale(.93); }
.ctl.big { width: 64px; height: 64px; background: white; color: #0b0b12; border: 0; box-shadow: 0 10px 30px -8px rgba(255, 255, 255, .4); }
.ctl.big:hover { background: #fff; transform: scale(1.05); }
.ctl.big svg { width: 26px; height: 26px; }
.volume { display: flex; align-items: center; gap: 8px; margin-left: auto; min-width: 200px; }
.volume span { font-size: 13px; color: var(--muted); min-width: 28px; font-variant-numeric: tabular-nums; }

input[type=range] { -webkit-appearance: none; appearance: none; flex: 1; height: 6px; border-radius: 6px; background: rgba(255, 255, 255, .14); outline: none; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: white; box-shadow: 0 2px 8px rgba(0, 0, 0, .5); cursor: pointer; }
input[type=range]::-moz-range-thumb { width: 16px; height: 16px; border: 0; border-radius: 50%; background: white; cursor: pointer; }

/* ---------- Quick input ---------- */
.quick {
  display: flex; align-items: center; gap: 10px;
  margin: 22px 0 30px; padding: 8px 8px 8px 18px;
  border-radius: 999px;
  transition: border-color .2s, box-shadow .2s;
}
.quick:focus-within { border-color: rgba(139, 92, 246, .6); box-shadow: 0 0 0 4px rgba(139, 92, 246, .15); }
.quick-icon { color: var(--muted); }
.quick input { flex: 1; min-width: 0; height: 42px; border: 0; background: transparent; outline: none; font-size: 15px; }
.quick input::placeholder { color: var(--faint); }

/* ---------- Queue ---------- */
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.section-head h2 { font-size: 20px; display: flex; align-items: center; gap: 10px; }
.count { font: 600 12px var(--font); padding: 2px 9px; border-radius: 999px; background: var(--panel-2); color: var(--muted); }
.queue { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.item {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 12px; border-radius: 14px;
  background: var(--panel); border: 1px solid var(--border);
  transition: background .2s, transform .2s;
  animation: slide .3s ease;
}
.item:hover { background: var(--panel-2); }
@keyframes slide { from { opacity: 0; transform: translateY(6px); } }
.item .num { width: 22px; text-align: center; color: var(--faint); font-variant-numeric: tabular-nums; font-size: 13px; }
.thumb {
  width: 52px; height: 52px; flex: none; border-radius: 10px; overflow: hidden;
  display: grid; place-items: center;
  background: linear-gradient(135deg, rgba(139, 92, 246, .35), rgba(6, 182, 212, .3));
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb svg { color: rgba(255, 255, 255, .8); }
.item-text { flex: 1; min-width: 0; }
.item-text b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-text small { color: var(--muted); font-size: 13px; }
.item-actions { display: flex; gap: 2px; opacity: .55; transition: opacity .2s; }
.item:hover .item-actions { opacity: 1; }
.empty {
  padding: 40px 20px; text-align: center; color: var(--muted);
  border: 1px dashed var(--border-2); border-radius: var(--radius);
}
.empty svg { width: 36px; height: 36px; margin-bottom: 8px; color: var(--faint); }

/* ---------- Pages ---------- */
.page-head { margin-bottom: 22px; }
.page-head h1 { font-size: 32px; }
.page-head p { margin: 6px 0 0; }
.page-head.row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.cards { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.card {
  border-radius: var(--radius); overflow: hidden;
  background: var(--panel); border: 1px solid var(--border);
  transition: transform .25s, border-color .25s, box-shadow .25s;
  animation: slide .35s ease both;
}
.card:hover { transform: translateY(-4px); border-color: var(--border-2); box-shadow: var(--shadow); }
.card-img { position: relative; aspect-ratio: 16 / 9; background: var(--bg-2); }
.card-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-img .dur { position: absolute; right: 8px; bottom: 8px; padding: 2px 7px; border-radius: 6px; background: rgba(0, 0, 0, .75); font-size: 12px; font-weight: 600; }
.card-body { padding: 12px 14px 14px; }
.card-body b { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-weight: 600; min-height: 2.9em; }
.card-actions { display: flex; gap: 8px; margin-top: 12px; }
.card-actions .btn { flex: 1; }

.stations { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.station {
  position: relative; overflow: hidden;
  padding: 18px; min-height: 150px;
  border-radius: 20px; border: 1px solid var(--border);
  display: flex; flex-direction: column; justify-content: space-between; gap: 14px;
  isolation: isolate;
  transition: transform .25s, box-shadow .25s;
  animation: slide .35s ease both;
}
.station::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--station-grad); opacity: .85; }
.station::after { content: ""; position: absolute; inset: 0; z-index: -1; background: radial-gradient(circle at 100% 0%, rgba(255, 255, 255, .25), transparent 50%); }
.station:hover { transform: translateY(-4px) scale(1.01); box-shadow: var(--shadow); }
.station.playing { outline: 2px solid white; outline-offset: -2px; }
.station h3 { font-size: 20px; color: white; text-shadow: 0 2px 10px rgba(0, 0, 0, .3); overflow-wrap: anywhere; }
.station .genre { font-size: 13px; color: rgba(255, 255, 255, .8); }
.station-foot { display: flex; align-items: center; justify-content: space-between; }
.station .play {
  display: grid; place-items: center;
  width: 46px; height: 46px; border-radius: 50%;
  border: 0; background: white; color: #111;
  box-shadow: 0 8px 20px -6px rgba(0, 0, 0, .5);
  transition: transform .15s;
}
.station .play:hover { transform: scale(1.08); }
.station .tools { display: flex; gap: 2px; }
.station .tools .icon-btn { color: rgba(255, 255, 255, .8); }
.station .tools .icon-btn:hover { background: rgba(0, 0, 0, .2); color: white; }

/* ---------- Library ---------- */
.dropzone {
  display: grid; justify-items: center; gap: 6px;
  padding: 36px 20px; margin-bottom: 22px;
  border: 2px dashed var(--border-2); border-radius: 22px;
  background: var(--panel); text-align: center; cursor: pointer;
  transition: border-color .2s, background .2s;
}
.dropzone svg { width: 34px; height: 34px; color: var(--accent); margin-bottom: 4px; }
.dropzone.over { border-color: var(--accent); background: rgba(139, 92, 246, .1); }
.upload-bar { width: min(360px, 100%); height: 6px; border-radius: 6px; background: rgba(255, 255, 255, .1); overflow: hidden; margin-top: 10px; }
.upload-bar div { height: 100%; width: 0; background: var(--grad); transition: width .2s; }
.files { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }

/* ---------- Support ---------- */
.support-grid { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.support-card {
  padding: 20px; border-radius: 20px;
  background: var(--panel); border: 1px solid var(--border);
  display: grid; gap: 16px; align-content: start;
  animation: slide .35s ease both;
}
.support-card.off { opacity: .6; }
.support-card.alert { border-color: rgba(251, 191, 36, .55); box-shadow: 0 0 0 4px rgba(251, 191, 36, .08); }
.support-top { display: flex; align-items: center; gap: 12px; }
.support-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: linear-gradient(135deg, rgba(139, 92, 246, .35), rgba(236, 72, 153, .3)); flex: none; }
.support-top h3 { font-size: 18px; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.support-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { padding: 12px 14px; border-radius: 14px; background: rgba(0, 0, 0, .2); border: 1px solid var(--border); }
.stat b { display: block; font: 700 24px var(--display); }
.stat small { color: var(--muted); font-size: 12px; }
.stat.warn b { color: var(--warn); }
.stat.good b { color: var(--ok); }
.names { font-size: 13px; color: var(--muted); }
.names span { color: var(--text); }
.support-foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.support-foot .chip { font-weight: 500; }
.support-foot .spacer { flex: 1; }

.switch { position: relative; width: 42px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: rgba(255, 255, 255, .16); transition: background .2s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: white; transition: transform .2s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(18px); }

.field textarea {
  min-height: 70px; padding: 10px 14px; resize: vertical;
  border-radius: var(--radius-sm); border: 1px solid var(--border-2);
  background: rgba(0, 0, 0, .25); outline: none; font: inherit; color: inherit;
}
.field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(139, 92, 246, .2); }
.field .hint { font-size: 12px; color: var(--faint); }
.checks { display: flex; flex-wrap: wrap; gap: 8px; max-height: 160px; overflow: auto; padding: 2px; }
.checks label { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border-2); cursor: pointer; font-size: 13px; transition: background .2s, border-color .2s; }
.checks input { display: none; }
.checks label:has(input:checked) { background: rgba(139, 92, 246, .22); border-color: var(--accent); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dialog.wide { width: min(620px, calc(100% - 32px)); }
.dialog #dialogBody { max-height: min(65vh, 640px); overflow: auto; padding-right: 4px; }

/* ---------- Playlists ---------- */
.pl-grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.pl-card {
  border-radius: 20px; overflow: hidden; cursor: pointer;
  background: var(--panel); border: 1px solid var(--border);
  transition: transform .25s, box-shadow .25s, border-color .25s;
  animation: slide .35s ease both;
}
.pl-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--border-2); }
.pl-cover { position: relative; aspect-ratio: 1; display: grid; grid-template-columns: 1fr 1fr; background: var(--cover-grad); }
.pl-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pl-cover.single { grid-template-columns: 1fr; }
.pl-cover .placeholder { grid-column: 1 / -1; display: grid; place-items: center; }
.pl-cover .placeholder svg { width: 56px; height: 56px; color: rgba(255, 255, 255, .85); }
.pl-cover .pl-play {
  position: absolute; right: 12px; bottom: 12px;
  display: grid; place-items: center; width: 50px; height: 50px; border-radius: 50%;
  border: 0; background: var(--grad); color: white;
  box-shadow: 0 10px 24px -6px rgba(0, 0, 0, .6);
  opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s;
}
.pl-card:hover .pl-play { opacity: 1; transform: none; }
.pl-body { padding: 12px 14px 14px; }
.pl-body b { display: block; font: 600 16px var(--display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-body small { color: var(--muted); }

.pl-head { display: flex; gap: 26px; align-items: flex-end; margin-bottom: 24px; flex-wrap: wrap; }
.pl-head .pl-cover { width: 200px; border-radius: 22px; overflow: hidden; box-shadow: var(--shadow); flex: none; }
.pl-head-info { flex: 1; min-width: 240px; }
.pl-head-info h1 { font-size: clamp(28px, 4vw, 44px); margin: 6px 0; overflow-wrap: anywhere; }
.pl-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.back-link { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; color: var(--muted); padding: 0; font-weight: 600; }
.back-link:hover { color: var(--text); }
@media (max-width: 900px) {
  .pl-cover .pl-play { opacity: 1; transform: none; }
  .pl-head .pl-cover { width: 140px; }
}

/* ---------- Bot management ---------- */
.botm-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.botm {
  display: grid; gap: 14px; align-content: start;
  padding: 18px; border-radius: 20px;
  background: var(--panel); border: 1px solid var(--border);
  animation: slide .35s ease both;
}
.botm.off { opacity: .6; }
.botm-head { display: flex; align-items: center; gap: 12px; }
.botm-head .bot-icon { width: 46px; height: 46px; border-radius: 14px; font-size: 13px; }
.botm-head h3 { font-size: 18px; }
.botm-head small { display: block; color: var(--muted); }
.botm-head > div { flex: 1; min-width: 0; }
.botm dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 0; font-size: 14px; }
.botm dt { color: var(--muted); }
.botm dd { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.botm-foot { display: flex; align-items: center; gap: 6px; }
.botm-foot .spacer { flex: 1; }
.status-chip.on { color: #6ee7b7; border-color: rgba(52, 211, 153, .4); background: rgba(52, 211, 153, .1); }
.status-chip.wait { color: #fcd34d; border-color: rgba(251, 191, 36, .4); background: rgba(251, 191, 36, .1); }
details.advanced { margin-bottom: 14px; }
details.advanced summary { cursor: pointer; color: var(--muted); font-weight: 600; margin-bottom: 12px; }

/* ---------- Commands ---------- */
.cmd-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.cmd {
  display: grid; gap: 12px; align-content: start;
  padding: 18px; border-radius: 20px;
  background: var(--panel); border: 1px solid var(--border);
  animation: slide .35s ease both;
}
.cmd.off { opacity: .55; }
.cmd-head { display: flex; align-items: center; gap: 10px; }
.cmd-name { font: 700 20px var(--display); color: white; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.cmd-name::before { content: "!"; color: var(--accent); margin-right: 1px; }
.cmd-alias { color: var(--muted); font-size: 13px; }
.cmd-preview {
  margin: 0; padding: 12px 14px; border-radius: 14px;
  background: rgba(0, 0, 0, .25); border: 1px solid var(--border);
  font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere;
  max-height: 120px; overflow: hidden; position: relative;
  -webkit-mask-image: linear-gradient(180deg, #000 70%, transparent);
          mask-image: linear-gradient(180deg, #000 70%, transparent);
}
.cmd-preview b { color: white; }
.cmd-preview a { color: #a5b4fc; }
.cmd-foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cmd-foot .chip { font-weight: 500; }
.cmd-foot .spacer { flex: 1; }
.builtin { margin-top: 26px; border-radius: var(--radius); padding: 14px 18px; }
.builtin summary { cursor: pointer; font-weight: 600; }
.builtin #builtin { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
code { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: .92em; padding: 1px 6px; border-radius: 6px; background: rgba(255, 255, 255, .08); }

/* ---------- Channels ---------- */
.feature-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.feature {
  position: relative; overflow: hidden;
  padding: 20px; border-radius: 20px;
  background: var(--panel); border: 1px solid var(--border);
  display: grid; gap: 12px; align-content: start;
  animation: slide .35s ease both;
}
.feature::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--feature-color, var(--grad)); opacity: .9; }
.feature.off::before { opacity: .2; }
.feature-head { display: flex; align-items: center; gap: 12px; }
.feature-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; background: var(--feature-color); color: white; flex: none; }
.feature-head h3 { flex: 1; font-size: 18px; }
.feature p { margin: 0; color: var(--muted); font-size: 14px; }
.feature .summary { display: flex; flex-wrap: wrap; gap: 6px; }
.feature .summary .chip { font-weight: 500; }
.feature-foot { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.temp-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 12px; background: rgba(0, 0, 0, .2); }
.temp-row span { flex: 1; min-width: 0; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.small-note { font-size: 13px; display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
svg.inline { width: 15px; height: 15px; vertical-align: -3px; }
.tree { border-radius: var(--radius); padding: 6px; }
.tree-row {
  display: flex; align-items: center; gap: 8px;
  min-height: 40px; padding: 4px 8px 4px calc(10px + var(--depth) * 22px);
  border-radius: 10px;
  transition: background .15s;
}
.tree-row:hover { background: var(--panel-2); }
.tree-row.spacer { color: var(--faint); }
.tree-row.swap-src { background: rgba(139, 92, 246, .2); outline: 1px solid var(--accent); }
.tree-name { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; }
.tree-name b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-row.spacer .tree-name b { font-style: italic; font-weight: 400; }
.tree-clients { display: flex; gap: 4px; flex-wrap: wrap; max-width: 45%; justify-content: flex-end; }
.tree-clients .chip { font-size: 11px; padding: 1px 8px; font-weight: 500; }
.tree-actions { display: flex; gap: 0; opacity: 0; transition: opacity .15s; }
.tree-row:hover .tree-actions, .tree-row:focus-within .tree-actions { opacity: 1; }
.tree-actions .icon-btn { width: 30px; height: 30px; }
.tag { font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 2px 7px; border-radius: 6px; flex: none; }
.tag.afk { background: rgba(251, 191, 36, .16); color: #fcd34d; }
.tag.creator { background: rgba(52, 211, 153, .15); color: #6ee7b7; }
.tag.temp { background: rgba(6, 182, 212, .15); color: #67e8f9; }
.swap-banner {
  display: flex; align-items: center; gap: 12px; margin-bottom: 10px;
  padding: 10px 14px; border-radius: 14px;
  background: rgba(139, 92, 246, .15); border: 1px solid rgba(139, 92, 246, .45);
}
.swap-banner span { flex: 1; }
@media (max-width: 900px) {
  .tree-actions { opacity: 1; }
  .tree-clients { display: none; }
  .tree-row { padding-left: calc(6px + var(--depth) * 14px); }
}

/* ---------- Users ---------- */
.roles-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; color: var(--muted); font-size: 13px; margin-bottom: 16px; }
.roles-legend .chip:not(:first-child) { margin-left: 10px; }
.table { border-radius: var(--radius); overflow: hidden; }
.row-user { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.row-user:last-child { border-bottom: 0; }
.row-user .avatar { width: 34px; height: 34px; font-size: 14px; }
.row-user b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Dialog & toasts ---------- */
.dialog {
  width: min(440px, calc(100% - 32px)); padding: 24px;
  border-radius: 22px; color: var(--text);
  background: rgba(20, 20, 30, 0.92);
  box-shadow: var(--shadow);
}
.dialog::backdrop { background: rgba(0, 0, 0, .55); backdrop-filter: blur(4px); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; }
.toasts { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 10px; z-index: 50; }
.toast {
  display: flex; align-items: center; gap: 10px;
  max-width: 360px; padding: 12px 16px;
  border-radius: 14px; border: 1px solid var(--border-2);
  background: rgba(24, 24, 36, .95); box-shadow: var(--shadow);
  animation: toast .3s ease;
}
.toast.err { border-color: rgba(248, 113, 113, .5); }
.toast.err::before, .toast.ok::before { content: ""; width: 8px; height: 8px; border-radius: 50%; flex: none; }
.toast.ok::before { background: var(--ok); }
.toast.err::before { background: var(--bad); }
@keyframes toast { from { opacity: 0; transform: translateY(10px); } }
@keyframes pulse { 50% { opacity: .3; } }

.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .25); border-top-color: white; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-row { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 20px 4px; }

body.readonly [data-control] { display: none !important; }
body:not(.is-admin) [data-admin] { display: none !important; }

/* ---------- Mobile ---------- */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: sticky; top: 0; z-index: 10; height: auto;
    flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px;
    padding: 12px 16px; border-right: 0; border-bottom: 1px solid var(--border);
    /* backdrop-filter would make the fixed bottom nav position relative to the sidebar */
    backdrop-filter: none; -webkit-backdrop-filter: none;
    background: rgba(11, 11, 18, 0.96);
  }
  .sidebar .brand { padding: 0; }
  .side-label { display: none; }
  .bot-list { order: 3; width: 100%; display: flex; overflow-x: auto; gap: 8px; scrollbar-width: none; }
  .bot { width: auto; flex: none; padding: 6px 12px 6px 6px; background: var(--panel); }
  .bot-icon { width: 32px; height: 32px; border-radius: 10px; font-size: 10px; }
  .bot-text small { display: none; }
  .nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    display: flex; justify-content: space-around;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    background: rgba(12, 12, 20, .92); backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
  }
  .nav button { flex-direction: column; gap: 2px; height: auto; padding: 6px 8px; font-size: 11px; flex: 1; justify-content: center; }
  .me { margin: 0 0 0 auto; padding: 4px; background: transparent; border: 0; }
  .me-text { display: none; }
  .main { padding: 18px 16px 100px; }
  .hero-inner { flex-direction: column; align-items: stretch; text-align: center; padding: 22px 18px; gap: 20px; }
  .art { width: 180px; height: 180px; margin: 0 auto; }
  .eyebrow, .sub { justify-content: center; }
  .controls { justify-content: center; }
  .volume { margin: 6px 0 0; width: 100%; min-width: 0; }
  .quick { border-radius: 20px; flex-wrap: wrap; padding: 8px; }
  .quick-icon { display: none; }
  .quick input { width: 100%; flex-basis: 100%; padding: 0 10px; }
  .quick .btn { flex: 1; }
  .item-actions { opacity: 1; }
  .page-head h1 { font-size: 26px; }
  .toasts { left: 16px; right: 16px; bottom: 84px; }
}
