:root {
  --bg: #f4f6fb;
  --bg-2: #eef1f8;
  --surface: #ffffff;
  --surface-2: #f8f9fd;
  --border: #e5e8f1;
  --border-2: #d7dcea;
  --text: #121833;
  --text-2: #4a5272;
  --muted: #8189a6;
  --primary: #4f46e5;
  --primary-2: #6366f1;
  --primary-soft: #eef0ff;
  --brand: #4D04EA;
  --brand-2: #5812F0;
  --accent: #14b8a6;
  --warn: #f59e0b;
  --danger: #ef4444;
  --ok: #22c55e;
  --shadow: 0 10px 30px rgba(18,24,51,.08);
  --radius: 16px;
  --side: linear-gradient(180deg, #121a3f 0%, #0d1330 100%);
  --side-text: #c3c8e6;
}
html[data-theme="dark"] {
  --bg: #0b1020;
  --bg-2: #0f1529;
  --surface: #131a31;
  --surface-2: #171f3a;
  --border: #232c4a;
  --border-2: #2e3858;
  --text: #e8eaf6;
  --text-2: #b4bad6;
  --muted: #7d86a8;
  --primary: #818cf8;
  --primary-2: #a5b4fc;
  --primary-soft: rgba(129,140,248,.14);
  --brand: #a78bfa;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --side: linear-gradient(180deg, #0a0f22 0%, #12183a 100%);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: Inter, "Noto Sans", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}
a { color: var(--primary); text-decoration: none; }
button, input, select, textarea { font: inherit; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 12px; padding: 10px 16px; cursor: pointer;
  background: var(--primary); color: #fff; font-weight: 600;
  box-shadow: 0 6px 16px rgba(79,70,229,.25);
}
.btn:hover { filter: brightness(1.05); }
.btn.secondary { background: var(--surface-2); color: var(--text); box-shadow: none; border: 1px solid var(--border); }
.btn.danger { background: var(--danger); box-shadow: none; }
.btn.ghost { background: transparent; color: var(--text-2); box-shadow: none; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.input, select, textarea {
  width: 100%; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); border-radius: 12px; padding: 10px 12px; outline: none;
}
.input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.muted { color: var(--muted); }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

/* Login */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background:
    radial-gradient(900px 420px at 50% -10%, #ece7ff, transparent 70%),
    var(--bg);
}
html[data-theme="dark"] .login-wrap {
  background: radial-gradient(900px 420px at 50% -10%, rgba(77,4,234,.25), transparent 70%), var(--bg);
}
.login-card { width: 100%; max-width: 420px; padding: 32px 28px; }
.login-logo { display: flex; justify-content: center; margin-bottom: 10px; }
.login-logo img, .login-logo object, .brand-full { height: 42px; width: auto; }
.login-card h1 { text-align: center; font-size: 22px; margin: 8px 0 4px; }
.login-card .sub { text-align: center; color: var(--muted); margin-bottom: 22px; }
.login-card label { display: block; font-size: 13px; color: var(--text-2); margin: 12px 0 6px; }
.login-card .error { background: #feecec; color: #b91c1c; border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; }
html[data-theme="dark"] .login-card .error { background: rgba(239,68,68,.15); color: #fca5a5; }
.login-card .btn { width: 100%; margin-top: 16px; padding: 12px; }
.theme-btn {
  position: fixed; top: 16px; right: 16px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); border-radius: 999px;
  padding: 8px 12px; cursor: pointer;
}

/* Admin layout */
.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side {
  background: var(--side); color: var(--side-text); padding: 20px 14px;
  display: flex; flex-direction: column; gap: 6px;
}
.side .brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 18px; color: #fff; }
.side .brand img { height: 36px; width: auto; }
.side .brand b { color: #fff; font-size: 16px; letter-spacing: .02em; }
.side a.nav, .side button.nav {
  display: flex; align-items: center; gap: 10px; width: 100%;
  border: 0; background: transparent; color: var(--side-text);
  padding: 10px 12px; border-radius: 12px; cursor: pointer; text-align: left; font-weight: 500;
}
.side a.nav.active, .side button.nav.active, .side a.nav:hover, .side button.nav:hover {
  background: rgba(255,255,255,.08); color: #fff;
}
.side .foot { margin-top: auto; padding: 10px 8px; display: flex; gap: 8px; }
.main { padding: 24px 28px 48px; min-width: 0; }
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 22px;
}
.top h1 { margin: 0; font-size: 24px; letter-spacing: -.02em; }
.section { display: none; }
.section.active { display: block; }

.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat { padding: 16px 18px; }
.stat .k { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.stat .v { font-size: 22px; font-weight: 700; margin-top: 4px; }
.now {
  display: grid; grid-template-columns: 120px 1fr; gap: 18px; padding: 18px; margin: 16px 0;
  align-items: center;
}
.cover, .cover-ph {
  width: 120px; height: 120px; border-radius: 16px; object-fit: cover;
  background: linear-gradient(135deg, #5812F0, #9B6EFB);
}
.player audio { width: 100%; margin-top: 8px; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); font-size: 14px; vertical-align: middle; }
.table th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.drop {
  border: 1.5px dashed var(--border-2); border-radius: 16px; padding: 28px;
  text-align: center; background: var(--surface-2); color: var(--text-2); margin-bottom: 16px;
}
.drop.drag { border-color: var(--primary); background: var(--primary-soft); }
.progress { height: 6px; background: var(--border); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.progress > i { display: block; height: 100%; background: var(--primary); width: 0; }
.chip { display: inline-block; padding: 2px 8px; border-radius: 99px; background: var(--primary-soft); color: var(--brand); font-size: 12px; font-weight: 600; }
.search { max-width: 280px; }
.sched {
  display: grid; grid-template-columns: 90px repeat(7, 1fr); gap: 4px; font-size: 12px;
}
.sched .h, .sched .d { color: var(--muted); text-align: center; padding: 6px; font-weight: 600; }
.slot {
  min-height: 36px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border);
  cursor: pointer;
}
.slot.on { background: var(--primary-soft); border-color: var(--primary); color: var(--brand); font-weight: 600; padding: 4px; }
.list-item { display: flex; gap: 10px; align-items: center; padding: 8px; border-bottom: 1px solid var(--border); }
.list-item img { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; }

/* Public */
.pub {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center;
  padding: 40px 20px 60px;
  background:
    radial-gradient(1000px 500px at 50% -20%, rgba(77,4,234,.16), transparent 60%),
    var(--bg);
}
.pub-card { width: 100%; max-width: 520px; padding: 28px; text-align: center; }
.pub-card h1 { margin: 8px 0 4px; font-size: 28px; }
.pub-cover { width: 220px; height: 220px; border-radius: 24px; margin: 18px auto; display: block; object-fit: cover; box-shadow: var(--shadow); }
.pub-title { font-size: 20px; font-weight: 700; }
.pub-art { color: var(--muted); margin-bottom: 16px; }
.stream-url { font-size: 13px; background: var(--surface-2); border-radius: 10px; padding: 10px; word-break: break-all; }
.embed-box { margin-top: 16px; text-align: left; font-size: 12px; }
.embed-box textarea { min-height: 80px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side {
    position: sticky; top: 0; z-index: 20; flex-direction: row; flex-wrap: wrap; align-items: center;
    padding: 10px; gap: 4px;
  }
  .side .brand { padding: 0 8px 0 0; }
  .side a.nav, .side button.nav { width: auto; padding: 8px 10px; font-size: 13px; }
  .side .foot { margin: 0 0 0 auto; }
  .main { padding: 16px 14px 40px; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .now { grid-template-columns: 80px 1fr; }
  .cover, .cover-ph { width: 80px; height: 80px; }
  .sched { grid-template-columns: 48px repeat(7, 1fr); overflow-x: auto; }
}
