*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #0a0a0f; --bg2: #111118; --bg3: #1a1a24; --bg4: #22222f; --bg5: #2a2a38;
  --accent: #e8c97e; --accent2: #7eb8e8; --accent3: #a07ee8;
  --green: #5de8a0; --red: #e8706a;
  --text: #f0eee8; --text2: #9a9890; --text3: #5a5858; --border: #2a2a38;
  --radius: 10px; --rsm: 6px;
  --font: 'DM Sans', system-ui, sans-serif;
  --mono: 'DM Mono', monospace;
  --serif: 'Playfair Display', serif;
}
body { font-family: var(--font); background: var(--bg); color: var(--text); height: 100vh; overflow: hidden; -webkit-font-smoothing: antialiased; }

/* ── Login ── */
.login-screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--bg); z-index: 100; }
.login-box { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 40px; width: 320px; display: flex; flex-direction: column; gap: 14px; }
.login-box .logo { font-family: var(--serif); font-size: 26px; color: var(--accent); text-align: center; }
.login-sub { font-size: 13px; color: var(--text2); text-align: center; }
.login-box input { background: var(--bg3); border: 1px solid var(--border); border-radius: var(--rsm); color: var(--text); font-family: var(--font); font-size: 14px; padding: 10px 12px; outline: none; }
.login-box input:focus { border-color: var(--accent2); }
.login-err { font-size: 12px; color: var(--red); text-align: center; min-height: 16px; }

/* ── App layout ── */
#app { display: flex; flex-direction: column; height: 100vh; }
.topbar { height: 60px; background: var(--bg2); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 14px; padding: 0 18px; flex-shrink: 0; }
.logo { font-family: var(--serif); font-size: 18px; color: var(--accent); flex-shrink: 0; }
.topbar-center { flex: 1; display: flex; align-items: center; gap: 12px; min-width: 0; }
.now-art { width: 34px; height: 34px; border-radius: 4px; background: var(--bg4); display: flex; align-items: center; justify-content: center; font-size: 15px; flex-shrink: 0; overflow: hidden; }
.now-art img { width: 100%; height: 100%; object-fit: cover; }
.now-info { min-width: 0; width: 180px; flex-shrink: 0; }
.now-title { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now-artist { font-size: 11px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.progress-wrap { flex: 1; min-width: 0; }
.progress-bar { height: 4px; background: var(--bg4); border-radius: 2px; margin-bottom: 3px; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent3)); border-radius: 2px; width: 0%; transition: width 0.8s linear; }
.progress-times { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 10px; color: var(--text3); }
.topbar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.status-pill { display: flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 20px; border: 1px solid var(--border); font-family: var(--mono); font-size: 10px; color: var(--text3); }
.sdot { width: 6px; height: 6px; border-radius: 50%; background: var(--text3); }
.sdot.live { background: var(--red); animation: pulse 1.5s infinite; }
@keyframes pulse { 0%,100%{opacity:1}50%{opacity:0.3} }

.layout { display: flex; flex: 1; overflow: hidden; }
.sidebar { width: 210px; background: var(--bg2); border-right: 1px solid var(--border); padding: 12px 8px; overflow-y: auto; display: flex; flex-direction: column; flex-shrink: 0; }
.nav-group { margin-bottom: 20px; }
.nav-label { font-size: 9px; font-family: var(--mono); color: var(--text3); letter-spacing: 1.8px; padding: 0 8px; margin-bottom: 4px; }
.nav-item { padding: 7px 10px; border-radius: var(--rsm); cursor: pointer; font-size: 13px; color: var(--text2); transition: all 0.12s; border: 1px solid transparent; user-select: none; display: flex; align-items: center; gap: 8px; }
.nav-item:hover { background: var(--bg3); color: var(--text); }
.nav-item.active { background: var(--bg4); color: var(--accent); border-color: var(--border); }
.nbadge { margin-left: auto; font-size: 10px; font-family: var(--mono); color: var(--text3); background: var(--bg4); padding: 1px 5px; border-radius: 10px; }
.sidebar-stats { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--border); display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 4px; }
.sstat { text-align: center; }
.sstat-val { font-family: var(--mono); font-size: 14px; color: var(--accent); }
.sstat-lbl { font-size: 9px; color: var(--text3); margin-top: 1px; }

.main { flex: 1; overflow-y: auto; min-width: 0; background: var(--bg); }
.panel { padding: 24px; animation: fadeIn 0.18s ease; }
@keyframes fadeIn { from{opacity:0;transform:translateY(3px)}to{opacity:1;transform:none} }
.panel-title { font-family: var(--serif); font-size: 22px; margin-bottom: 4px; }
.panel-sub { font-size: 13px; color: var(--text2); margin-bottom: 22px; line-height: 1.6; }

.rightbar { width: 260px; background: var(--bg2); border-left: 1px solid var(--border); overflow-y: auto; padding: 14px; flex-shrink: 0; }
.rb-title { font-size: 9px; font-family: var(--mono); color: var(--text3); letter-spacing: 1.8px; margin-bottom: 10px; }
.queue-item { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: var(--rsm); cursor: default; transition: background 0.1s; margin-bottom: 2px; }
.queue-item:hover { background: var(--bg3); }
.queue-item.active { background: rgba(232,201,126,.07); }
.queue-num { font-family: var(--mono); font-size: 10px; color: var(--text3); width: 14px; text-align: right; flex-shrink: 0; }
.queue-art { width: 26px; height: 26px; border-radius: 3px; background: var(--bg4); display: flex; align-items: center; justify-content: center; font-size: 11px; flex-shrink: 0; }
.queue-info { flex: 1; min-width: 0; }
.queue-name { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.queue-artist { font-size: 10px; color: var(--text3); }
.queue-dur { font-family: var(--mono); font-size: 10px; color: var(--text3); flex-shrink: 0; }

/* ── Cards ── */
.card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; }
.card-title { font-size: 10px; font-family: var(--mono); color: var(--text3); letter-spacing: 1.2px; text-transform: uppercase; margin-bottom: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

/* ── Form ── */
.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field label { display: block; font-size: 11px; color: var(--text2); margin-bottom: 5px; font-weight: 500; }
.field input:not([type=checkbox]):not([type=color]):not([type=range]),
.field select, .field textarea {
  width: 100%; background: var(--bg3); border: 1px solid var(--border); border-radius: var(--rsm);
  color: var(--text); font-family: var(--font); font-size: 13px; padding: 8px 10px; outline: none; transition: border-color 0.15s;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent2); }
.field select option { background: var(--bg3); }
.field input[type=color] { height: 36px; cursor: pointer; border-radius: var(--rsm); padding: 2px; border: 1px solid var(--border); background: var(--bg3); }
.range-row { display: flex; align-items: center; gap: 10px; }
.range-row input[type=range] { flex: 1; accent-color: var(--accent); }
.range-val { font-family: var(--mono); font-size: 12px; color: var(--accent); min-width: 38px; text-align: right; }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: var(--rsm); font-family: var(--font); font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.12s; border: 1px solid transparent; user-select: none; }
.btn-primary { background: var(--accent); color: #0a0a0f; border-color: var(--accent); }
.btn-primary:hover { background: #f5d990; }
.btn-secondary { background: transparent; color: var(--text2); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg3); color: var(--text); }
.btn-danger { background: transparent; color: var(--red); border-color: rgba(232,112,106,.4); }
.btn-danger:hover { background: rgba(232,112,106,.1); }
.btn-live { background: var(--accent); color: #0a0a0f; border-color: var(--accent); font-size: 12px; padding: 6px 12px; }
.btn-live.streaming { background: var(--red); border-color: var(--red); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

/* ── Toggles ── */
.toggle-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.toggle-label { font-size: 13px; color: var(--text2); }
.toggle-sub { font-size: 11px; color: var(--text3); margin-top: 1px; }
.toggle { width: 36px; height: 20px; border-radius: 10px; background: var(--bg4); border: 1px solid var(--border); position: relative; cursor: pointer; transition: background 0.2s; flex-shrink: 0; }
.toggle.on { background: var(--green); border-color: var(--green); }
.toggle::after { content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: left 0.2s; }
.toggle.on::after { left: 18px; }

/* ── Tags ── */
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 500; border: 1px solid; cursor: pointer; transition: all 0.12s; user-select: none; white-space: nowrap; }
.tag.active-tag { outline: 2px solid var(--accent); outline-offset: 2px; }
.tag-purple { background: rgba(160,126,232,.15); color: #a07ee8; border-color: rgba(160,126,232,.3); }
.tag-blue   { background: rgba(126,184,232,.15); color: #7eb8e8; border-color: rgba(126,184,232,.3); }
.tag-green  { background: rgba(93,232,160,.15);  color: #5de8a0; border-color: rgba(93,232,160,.3); }
.tag-amber  { background: rgba(232,201,126,.15); color: #e8c97e; border-color: rgba(232,201,126,.3); }
.tag-red    { background: rgba(232,112,106,.15); color: #e8706a; border-color: rgba(232,112,106,.3); }
.tags-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }

/* ── Song rows ── */
.song-row { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--rsm); border: 1px solid transparent; transition: all 0.12s; cursor: pointer; }
.song-row:hover { background: var(--bg3); border-color: var(--border); }
.song-art { width: 36px; height: 36px; border-radius: 4px; background: var(--bg4); display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; overflow: hidden; }
.song-art img { width: 100%; height: 100%; object-fit: cover; }
.song-info { flex: 1; min-width: 0; }
.song-title { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.song-meta { font-size: 11px; color: var(--text2); }
.song-tags { display: flex; gap: 4px; align-items: center; flex-shrink: 0; }
.song-dur { font-family: var(--mono); font-size: 11px; color: var(--text3); flex-shrink: 0; }

/* ── Misc ── */
.divider { height: 1px; background: var(--border); margin: 14px 0; }
.empty-state { text-align: center; padding: 40px 20px; color: var(--text3); }
.empty-state .ei { font-size: 36px; margin-bottom: 12px; opacity: 0.4; }
.empty-state p { font-size: 13px; }
.pos-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 4px; padding: 8px; background: var(--bg3); border-radius: var(--rsm); margin-bottom: 12px; }
.pos-cell { aspect-ratio: 1; border-radius: 4px; background: var(--bg4); display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 14px; color: var(--text3); transition: all 0.12s; border: 1px solid transparent; }
.pos-cell:hover { background: var(--bg5); color: var(--text2); }
.pos-cell.active { background: rgba(232,201,126,.18); border-color: rgba(232,201,126,.4); color: var(--accent); }
.ddex-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--bg3); border-radius: var(--rsm); border: 1px solid var(--border); margin-bottom: 8px; }
.ddex-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.ddex-info { flex: 1; }
.ddex-name { font-size: 13px; }
.ddex-meta { font-size: 11px; color: var(--text3); margin-top: 2px; }
.sched-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--bg3); border-radius: var(--rsm); border: 1px solid var(--border); margin-bottom: 8px; }
.sched-time { font-family: var(--mono); font-size: 13px; color: var(--accent); min-width: 110px; }
.sched-info { flex: 1; }
.sched-name { font-size: 13px; font-weight: 500; }
.sched-days { font-size: 11px; color: var(--text3); margin-top: 2px; }
.day-pills { display: flex; gap: 4px; }
.day-pill { width: 24px; height: 24px; border-radius: 50%; background: var(--bg4); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 600; color: var(--text3); cursor: pointer; transition: all 0.12s; user-select: none; }
.day-pill.on { background: var(--accent); border-color: var(--accent); color: #0a0a0f; }
.upload-zone { background: var(--bg3); border: 2px dashed var(--border); border-radius: var(--rsm); padding: 32px; text-align: center; cursor: pointer; transition: border-color 0.15s; margin-bottom: 12px; }
.upload-zone:hover { border-color: var(--accent2); }
.upload-zone .uz-icon { font-size: 30px; margin-bottom: 8px; }
.upload-zone .uz-text { font-size: 13px; color: var(--text2); }
.upload-zone .uz-sub { font-size: 11px; color: var(--text3); margin-top: 4px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 20px; font-size: 13px; color: var(--text); box-shadow: 0 4px 20px rgba(0,0,0,.5); z-index: 9999; animation: toastIn 0.2s ease; white-space: nowrap; }
.toast.success { border-color: var(--green); color: var(--green); }
.toast.error { border-color: var(--red); color: var(--red); }
@keyframes toastIn { from{opacity:0;transform:translateX(-50%) translateY(8px)}to{opacity:1;transform:translateX(-50%) translateY(0)} }
.spinner { display: inline-block; animation: spin 1s linear infinite; }
@keyframes spin { from{transform:rotate(0deg)}to{transform:rotate(360deg)} }
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ── Song play button ── */
.song-play-btn {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text2);
  cursor: pointer;
  font-size: 11px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all 0.12s;
}
.song-play-btn:hover { background: var(--bg3); color: var(--text); border-color: var(--accent2); }
.song-play-btn.playing { background: var(--accent); border-color: var(--accent); color: #0a0a0f; }
