:root {
  --bg: #14161a;
  --panel: #1c1f24;
  --side: #101214;
  --text: #f3f4f6;
  --muted: #8d939c;
  --line: #2a2e35;
  --accent: #e67e22;
  --accent2: #f39c12;
  --ok: #27ae60;
  --err: #e74c3c;
  --ui: "Segoe UI", system-ui, sans-serif;
  --r: 8px;
}
* { box-sizing: border-box }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 15px/1.45 var(--ui) }
button, input, select { font: inherit; color: inherit }
button { cursor: pointer; border-radius: var(--r) }
a { color: var(--accent) }
body.working { cursor: progress }
button:disabled, .btn:disabled { opacity: .55; cursor: wait }

.spin {
  display: inline-block; width: .9em; height: .9em; border: 2px solid currentColor;
  border-right-color: transparent; border-radius: 50%; vertical-align: -2px;
  animation: spin .7s linear infinite;
}
.spin.lg { width: 28px; height: 28px; border-width: 3px }
@keyframes spin { to { transform: rotate(360deg) } }

.login-body {
  min-height: 100%; display: grid; place-items: center;
  background: radial-gradient(1100px 520px at 18% -8%, #3a2414, var(--bg));
}
.login-card {
  width: min(380px, 92vw); background: var(--panel); border: 1px solid var(--line);
  padding: 32px 28px; display: grid; gap: 14px; border-radius: 12px;
}
.login-card .brand { text-align: center; margin-bottom: 8px }
.login-card h1 { margin: 8px 0 0; font-weight: 650; letter-spacing: -.03em }
.login-card p { margin: 0; color: var(--muted); font-size: .78rem; letter-spacing: .14em; text-transform: uppercase }
.login-card label { display: grid; gap: 6px; color: var(--muted); font-size: .82rem }
input[type=text], input[type=password], input[type=search], input[type=number], input:not([type=range]):not([type=file]):not([type=checkbox]),
select, textarea {
  background: #121417; border: 1px solid var(--line); padding: 10px 12px; width: 100%;
  border-radius: var(--r); outline: none;
}
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(230,126,34,.18) }
.login-card button, .btn {
  background: var(--accent); border: 0; color: #1a1208; font-weight: 700;
  padding: 10px 16px; border-radius: var(--r); display: inline-flex; align-items: center;
  justify-content: center; gap: 8px; transition: transform .08s, background .12s, box-shadow .12s;
}
.login-card button:hover:not(:disabled), .btn:hover:not(:disabled) { background: var(--accent2) }
.login-card button:active:not(:disabled), .btn:active:not(:disabled) { transform: scale(.97) }
.err { color: #f5b7b1; margin: 0; font-size: .88rem }
.err-box {
  background: #2c1010; border: 1px solid #7b241c; color: #f5b7b1;
  padding: 10px 12px; border-radius: var(--r); font-size: .88rem;
}

.logo {
  display: inline-grid; place-items: center; width: 32px; height: 32px;
  background: var(--accent); color: #1a1208; font-weight: 800; border-radius: 6px;
}
.brand-inline { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -.02em }

.top {
  display: flex; align-items: center; gap: 12px; padding: 8px 14px;
  background: #b03a2e; border-bottom: 1px solid #922b21;
  position: sticky; top: 0; z-index: 5;
}
.top .brand-inline { color: #fff }
.top select {
  background: rgba(0,0,0,.28); border: 1px solid rgba(255,255,255,.18);
  padding: 6px 10px; min-width: 180px; width: auto; color: #fff;
}
.top .ghost, .ghost {
  background: transparent; border: 1px solid rgba(255,255,255,.28); padding: 7px 12px; color: #fff;
}
.top .ghost:hover:not(:disabled) { background: rgba(255,255,255,.1) }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--text) }
.btn.ghost:hover:not(:disabled) { background: #252830; border-color: #444 }
.btn.danger { background: #922b21; color: #fff }
.btn.danger:hover:not(:disabled) { background: #c0392b }
.menu { display: none; background: transparent; border: 0; color: #fff; font-size: 1.25rem; padding: 4px 8px }
.spacer { flex: 1 }
.muted { color: var(--muted) }
.who { color: rgba(255,255,255,.85); font-size: .85rem }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .72rem; letter-spacing: .05em; text-transform: uppercase; font-weight: 700;
  padding: 4px 10px; border-radius: 999px; border: 1px solid transparent;
}
.pill i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: block }
.pill.on { color: #d5f5e3; background: #145a32; border-color: #1e8449 }
.pill.off { color: #fadbd8; background: rgba(0,0,0,.25); border-color: rgba(255,255,255,.2) }
.pill.err { color: #f5b7b1; background: #6e1b15; border-color: #922b21 }
.pill.wait { color: #fdebd0; background: #6e3c0e; border-color: var(--accent) }
.pill.wait i { animation: pulse 1s ease-in-out infinite }
@keyframes pulse { 50% { opacity: .25 } }

.banner {
  padding: 8px 16px; font-size: .88rem; display: flex; align-items: center; gap: 10px;
  background: #1f2a20; border-bottom: 1px solid #1e8449; color: #d5f5e3;
}
.banner.wait { background: #2a2114; border-color: #a05a12; color: #fdebd0 }
.banner.err { background: #2c1010; border-color: #7b241c; color: #f5b7b1 }

.shell { display: grid; grid-template-columns: 188px 1fr; height: calc(100vh - 48px - 88px) }
aside {
  background: var(--side); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 10px 8px; gap: 3px;
}
aside button {
  text-align: left; background: transparent; border: 0; padding: 10px 12px; color: var(--muted);
  border-radius: var(--r);
}
aside button:hover { color: var(--text); background: #1c1f24 }
aside button:active { transform: scale(.98) }
aside button.on { color: #fff; background: var(--accent); font-weight: 700 }

main { overflow: auto; padding: 22px 24px 36px }
h2 { margin: 0 0 16px; font-weight: 650; font-size: 1.45rem; letter-spacing: -.02em }
.page-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px }
.page-head h2 { margin: 0 }
.page-load { display: grid; place-items: center; gap: 12px; color: var(--muted); min-height: 30vh; font-size: .95rem }

.row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: center }
.row input { flex: 1; min-width: 160px }

table { width: 100%; border-collapse: collapse }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line) }
th { color: var(--muted); font-size: .7rem; letter-spacing: .07em; text-transform: uppercase; font-weight: 700 }
tr:hover td { background: rgba(230, 126, 34, .06) }
tr.now td { background: rgba(230, 126, 34, .12) }
td.actions { white-space: nowrap }
td.actions button, .chip {
  background: #23262c; border: 1px solid var(--line); color: var(--text);
  padding: 5px 10px; border-radius: 6px; font-size: .82rem; font-weight: 600;
}
td.actions button:hover:not(:disabled), .chip:hover { border-color: var(--accent); color: var(--accent2) }
td.actions button:active:not(:disabled) { transform: scale(.96) }

.drop {
  border: 1.5px dashed var(--line); padding: 28px; text-align: center; color: var(--muted);
  margin-bottom: 16px; border-radius: 10px; background: #181b20;
}
.drop.over { border-color: var(--accent); color: var(--text); background: rgba(230,126,34,.1) }
.drop .bar { height: 6px; background: #2a2e35; border-radius: 99px; margin: 12px auto 0; max-width: 280px; overflow: hidden }
.drop .bar > i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .15s }

.list-split { display: grid; grid-template-columns: 220px 1fr; gap: 18px; min-height: 46vh }
.pl { display: flex; flex-direction: column; gap: 4px }
.pl button {
  text-align: left; background: #1a1d22; border: 1px solid var(--line); padding: 9px 10px;
  display: flex; justify-content: space-between; align-items: center;
}
.pl button.on { border-color: var(--accent); background: #2a1d12 }
.badge { background: var(--accent); color: #1a1208; font-size: .7rem; padding: 1px 7px; font-weight: 800; border-radius: 99px }

.form { display: grid; gap: 12px; max-width: 560px }
.form label { display: grid; gap: 6px; color: var(--muted); font-size: .82rem }
.hint { font-size: .8rem; color: var(--muted); margin-top: 8px }

.player {
  min-height: 88px; display: grid; grid-template-columns: 1.15fr 1.2fr .7fr;
  align-items: center; gap: 12px; padding: 8px 16px 10px;
  background: #0e1014; border-top: 3px solid var(--accent);
}
.now { display: flex; align-items: center; gap: 12px; min-width: 0 }
.art {
  width: 52px; height: 52px; background: #2a1d12; display: grid; place-items: center;
  color: var(--accent); flex: none; border-radius: 6px; font-size: 1.2rem;
}
.art.playing { animation: throb 1.6s ease-in-out infinite }
@keyframes throb { 50% { box-shadow: 0 0 0 4px rgba(230,126,34,.25) } }
.now-text { min-width: 0 }
.np-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 700 }
.np-artist { font-size: .8rem }
.transport { display: grid; gap: 6px; justify-items: center }
.controls { display: flex; justify-content: center; gap: 4px }
.controls button {
  background: transparent; border: 0; color: var(--text); width: 38px; height: 38px; font-size: 1.05rem;
  position: relative;
}
.controls button:hover:not(:disabled) { background: #1c1f24 }
.controls .play { background: var(--accent); color: #1a1208; font-weight: 800 }
.controls .play:hover:not(:disabled) { background: var(--accent2) }
.controls button.on { color: var(--accent) }
.controls button.busy::after {
  content: ""; position: absolute; inset: 8px; border: 2px solid currentColor;
  border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite;
}
.controls button.busy { color: transparent !important }
.seek { display: flex; align-items: center; gap: 8px; width: min(420px, 100%); font-size: .72rem; color: var(--muted); font-variant-numeric: tabular-nums }
.bar { flex: 1; height: 5px; background: #2a2e35; border-radius: 99px; overflow: hidden }
.bar > i { display: block; height: 100%; width: 0; background: var(--accent) }
.vol { display: flex; align-items: center; gap: 8px; justify-content: flex-end }
.vol input[type=range] { width: 120px; accent-color: var(--accent) }
.vol #volN { min-width: 2ch; font-variant-numeric: tabular-nums; font-size: .85rem; color: var(--muted) }

.card-help {
  max-width: 560px; background: var(--panel); border: 1px solid var(--line);
  padding: 18px 20px; border-radius: var(--r); margin-bottom: 16px;
}
.card-help p { margin: 0 0 12px }
.steps { margin: 0 0 16px; padding-left: 1.2em; color: var(--muted); line-height: 1.55 }
.steps li { margin: 6px 0 }
.steps b, .card-help b { color: var(--text) }
code { font-size: .85em; background: #121417; padding: 1px 6px; border-radius: 4px }
.empty { color: var(--muted); padding: 28px 0; text-align: center }
.empty b { color: var(--text); display: block; margin-bottom: 6px }

.toasts {
  position: fixed; bottom: 100px; right: 16px; z-index: 20;
  display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 24px));
}
.toast {
  background: #1c1f24; border: 1px solid var(--line); color: var(--text);
  padding: 11px 14px; border-radius: var(--r); box-shadow: 0 8px 24px rgba(0,0,0,.35);
  animation: in .15s ease-out;
}
.toast.ok { border-color: #1e8449; background: #102216 }
.toast.err { border-color: #922b21; background: #2c1010; color: #fadbd8 }
.toast.info { border-color: var(--accent) }
@keyframes in { from { opacity: 0; transform: translateY(8px) } }

@media (max-width: 800px) {
  .menu { display: block }
  .shell { grid-template-columns: 1fr }
  aside {
    display: none; position: absolute; z-index: 4; top: 48px; bottom: 88px; left: 0; width: 210px;
    box-shadow: 8px 0 24px rgba(0,0,0,.4);
  }
  aside.open { display: flex }
  .list-split { grid-template-columns: 1fr }
  .player { grid-template-columns: 1fr; padding: 10px 12px 12px; gap: 8px }
  .vol { justify-content: stretch }
  .vol input[type=range] { flex: 1 }
  .top select { min-width: 0; flex: 1 }
  .seek { width: 100% }
}
