:root {
  --bg: #0b0e14;
  --bg-2: #11151d;
  --bg-3: #171c26;
  --line: #232a37;
  --text: #e8edf5;
  --muted: #8d99ad;
  --accent: #2fd6a6;
  --accent-2: #1c9f7a;
  --danger: #e0483f;
  --warn: #e0a13f;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font-family: inherit; }

/* ---------------- login ---------------- */
.login-body {
  display: grid; place-items: center; min-height: 100vh;
  background:
    radial-gradient(900px 500px at 70% -10%, rgba(47,214,166,.16), transparent 60%),
    radial-gradient(700px 400px at 0% 100%, rgba(28,159,122,.12), transparent 60%),
    var(--bg);
}
.login-card {
  width: 100%; max-width: 380px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 34px 30px;
  box-shadow: 0 30px 80px rgba(0,0,0,.5);
}
.login-logo { font-size: 40px; }
.login-card h1 { margin: 8px 0 2px; font-size: 26px; letter-spacing: -.02em; }
.login-sub { margin: 0 0 22px; color: var(--muted); font-size: 14px; }
.login-card label {
  display: block; font-size: 12px; text-transform: uppercase;
  letter-spacing: .08em; color: var(--muted); margin: 14px 0 6px;
}
.login-card input {
  width: 100%; padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg-3); color: var(--text);
  font-size: 15px; outline: none;
}
.login-card input:focus { border-color: var(--accent); }
.login-card button {
  width: 100%; margin-top: 22px; padding: 13px; border: 0; border-radius: 10px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  color: #06251c; font-weight: 700; font-size: 15px; cursor: pointer;
}
.login-card button:hover { filter: brightness(1.07); }
.login-error {
  background: rgba(224,72,63,.12); border: 1px solid rgba(224,72,63,.4);
  color: #ffb3ad; padding: 10px 12px; border-radius: 9px; font-size: 13px;
}

/* ---------------- layout ---------------- */
.app {
  display: grid;
  grid-template-columns: 260px 1fr;
  grid-template-rows: 1fr 96px;
  grid-template-areas: "sidebar main" "player player";
  height: 100vh;
}

.sidebar {
  grid-area: sidebar;
  background: var(--bg-2);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  padding: 18px 14px;
}

.brand { display: flex; gap: 10px; align-items: center; padding: 4px 6px 18px; }
.brand-icon { font-size: 26px; }
.brand-name { font-weight: 700; letter-spacing: -.01em; }
.brand-sub { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-btn {
  text-align: left; padding: 11px 12px; border-radius: 10px; border: 0;
  background: transparent; color: var(--muted); font-size: 14.5px; cursor: pointer;
}
.nav-btn:hover { background: var(--bg-3); color: var(--text); }
.nav-btn.active { background: var(--bg-3); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }

.sidebar-foot { margin-top: auto; border-top: 1px solid var(--line); padding-top: 14px; }
.user-chip { display: flex; gap: 10px; align-items: center; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #3a7bd5);
  display: grid; place-items: center; font-weight: 700; color: #06251c;
}
.user-name { font-size: 13.5px; font-weight: 600; }
.user-role { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.foot-links { display: flex; gap: 14px; margin-top: 12px; }
.foot-links a { color: var(--muted); font-size: 12.5px; text-decoration: none; }
.foot-links a:hover { color: var(--accent); }

/* ---------------- main ---------------- */
.main {
  grid-area: main; overflow-y: auto;
  padding: 0 26px 26px;
  background:
    radial-gradient(1000px 420px at 80% -20%, rgba(47,214,166,.07), transparent 60%),
    var(--bg);
}
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; gap: 16px; align-items: center;
  padding: 18px 0 14px; background: linear-gradient(var(--bg) 70%, transparent);
}
.crumbs { display: flex; gap: 6px; flex-wrap: wrap; font-size: 14px; }
.crumb { color: var(--muted); cursor: pointer; border: 0; background: none; padding: 0; font-size: 14px; }
.crumb:hover { color: var(--text); }
.crumb-sep { color: var(--line); }
.search {
  margin-left: auto; width: 260px; padding: 9px 13px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg-2); color: var(--text); outline: none;
  font-size: 13.5px;
}
.search:focus { border-color: var(--accent); }

.banner-warn {
  margin: 14px 0 0; padding: 12px 14px; border-radius: 10px;
  background: rgba(224,161,63,.1); border: 1px solid rgba(224,161,63,.35);
  color: #f0c98a; font-size: 13.5px;
}
.banner-warn a { color: var(--accent); }

.content { padding-top: 8px; }

.sec-title { font-size: 13px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 26px 0 12px; }

.grid {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
}

.row {
  display: flex; align-items: center; gap: 13px;
  padding: 11px 13px; border-radius: 12px; cursor: pointer;
  border: 1px solid transparent;
}
.row:hover { background: var(--bg-2); border-color: var(--line); }
.row.playing { background: var(--bg-2); border-color: var(--accent-2); }
.row-icon { font-size: 20px; width: 26px; text-align: center; }
.row-main { min-width: 0; flex: 1; }
.row-name { font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-meta { font-size: 12px; color: var(--muted); }
.row-actions { display: flex; gap: 6px; opacity: 0; }
.row:hover .row-actions { opacity: 1; }
.icon-btn {
  border: 0; background: var(--bg-3); color: var(--muted);
  width: 30px; height: 30px; border-radius: 8px; cursor: pointer; font-size: 14px;
}
.icon-btn:hover { color: var(--text); }
.icon-btn.on { color: var(--accent); }

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

/* ---------------- player ---------------- */
.player {
  grid-area: player;
  display: grid;
  grid-template-columns: minmax(180px, 300px) 1fr auto;
  grid-template-rows: auto auto;
  gap: 4px 22px;
  align-items: center;
  padding: 12px 24px;
  background: var(--bg-2);
  border-top: 1px solid var(--line);
}
.now { grid-row: 1 / span 2; min-width: 0; }
.now-title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.controls { display: flex; align-items: center; gap: 10px; justify-content: center; }
.controls button {
  border: 0; background: transparent; color: var(--text);
  font-size: 18px; cursor: pointer; width: 38px; height: 38px; border-radius: 50%;
}
.controls button:hover { background: var(--bg-3); }
.controls .play {
  background: var(--text); color: var(--bg);
  width: 44px; height: 44px; font-size: 17px;
}
.controls .play:hover { background: #fff; }
.time { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; margin-left: 6px; }

.progress-wrap { grid-column: 2; width: 100%; display: flex; align-items: center; }
input[type=range] { -webkit-appearance: none; appearance: none; background: transparent; cursor: pointer; }
input[type=range]::-webkit-slider-runnable-track {
  height: 4px; background: var(--bg-3); border-radius: 3px;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 13px; height: 13px; border-radius: 50%;
  background: var(--accent); margin-top: -4.5px;
}
#seek { width: 100%; }

.extra { display: flex; align-items: center; gap: 8px; }
.extra button {
  border: 0; background: var(--bg-3); color: var(--muted);
  width: 36px; height: 36px; border-radius: 9px; cursor: pointer; font-size: 15px;
}
.extra button:hover, .extra button.on { color: var(--accent); }
.vol { width: 90px; }

/* ---------------- drawers ---------------- */
.drawer {
  position: fixed; top: 0; right: 0; height: 100%; width: 380px; max-width: 92vw;
  background: var(--bg-2); border-left: 1px solid var(--line);
  transform: translateX(100%); transition: transform .22s ease;
  z-index: 40; padding: 20px; overflow-y: auto;
}
.drawer.open { transform: translateX(0); }
.drawer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.drawer-head h3 { margin: 0; font-size: 16px; }
.drawer-head .close { border: 0; background: var(--bg-3); color: var(--muted); width: 30px; height: 30px; border-radius: 8px; cursor: pointer; }
.drawer h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 22px 0 10px; }

.backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  opacity: 0; pointer-events: none; transition: opacity .22s; z-index: 30;
}
.backdrop.on { opacity: 1; pointer-events: auto; }

.presets { display: flex; flex-wrap: wrap; gap: 7px; }
.presets button {
  border: 1px solid var(--line); background: var(--bg-3); color: var(--muted);
  padding: 7px 11px; border-radius: 20px; font-size: 12.5px; cursor: pointer;
}
.presets button:hover, .presets button.active { color: var(--text); border-color: var(--accent); }

.eq-bands { display: flex; gap: 4px; justify-content: space-between; margin-top: 8px; }
.band { display: flex; flex-direction: column; align-items: center; gap: 8px; flex: 1; }
.band input[type=range] {
  writing-mode: vertical-lr; direction: rtl;
  width: 26px; height: 150px;
}
.band span { font-size: 10.5px; color: var(--muted); }
.band b { font-size: 10.5px; color: var(--text); font-variant-numeric: tabular-nums; }

.fx { display: flex; flex-direction: column; gap: 12px; }
.fx label { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--muted); }
.fx input[type=range] { width: 150px; }
.fx select { background: var(--bg-3); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }
.drawer-foot { margin-top: 26px; }
.drawer-foot button {
  width: 100%; padding: 11px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg-3); color: var(--text); cursor: pointer;
}

.queue { padding-left: 20px; margin: 0; }
.queue li { padding: 9px 4px; font-size: 13.5px; color: var(--muted); cursor: pointer; border-bottom: 1px solid var(--line); }
.queue li:hover { color: var(--text); }
.queue li.on { color: var(--accent); }

/* ---------------- admin ---------------- */
.admin-wrap { max-width: 980px; margin: 0 auto; padding: 30px 20px 60px; }
.admin-wrap h1 { font-size: 24px; }
.card { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 18px; }
.card h2 { font-size: 15px; margin: 0 0 14px; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); }
.card input, .card select {
  padding: 10px 12px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--bg-3); color: var(--text); font-size: 14px; outline: none;
}
.card input:focus, .card select:focus { border-color: var(--accent); }
.form-row { display: flex; flex-wrap: wrap; gap: 10px; }
.btn {
  border: 0; border-radius: 9px; padding: 10px 16px; font-weight: 600;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  color: #06251c; cursor: pointer; font-size: 14px;
}
.btn.ghost { background: var(--bg-3); color: var(--text); border: 1px solid var(--line); }
.btn.danger { background: var(--danger); color: #fff; }
table.users { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.users th { text-align: left; color: var(--muted); font-weight: 500; padding: 8px 6px; border-bottom: 1px solid var(--line); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
table.users td { padding: 10px 6px; border-bottom: 1px solid var(--line); }
table.users tr:last-child td { border-bottom: 0; }
.badge { padding: 3px 9px; border-radius: 20px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.badge.admin { background: rgba(47,214,166,.14); color: var(--accent); }
.badge.oyente { background: var(--bg-3); color: var(--muted); }
.badge.off { background: rgba(224,72,63,.14); color: #ff9d97; }

.toast {
  position: fixed; bottom: 110px; left: 50%; transform: translateX(-50%);
  background: var(--bg-3); border: 1px solid var(--line); color: var(--text);
  padding: 11px 18px; border-radius: 10px; font-size: 13.5px; z-index: 80;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.toast.on { opacity: 1; }

@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; grid-template-areas: "main" "player"; }
  .sidebar { display: none; }
  .player { grid-template-columns: 1fr auto; }
  .now { display: none; }
  .search { width: 140px; }
}
