:root {
  --bg: #07050a;
  --surface: #110b14;
  --surface-2: #1c1420;
  --line: rgba(255, 255, 255, 0.09);
  --muted: #aa9fac;
  --text: #fff9fc;
  --accent: #ff2858;
  --accent-2: #b52bb9;
  --accent-deep: #710735;
  --danger: #ff496b;
  --success: #49d6a4;
  --radius: 18px;
  font-family: "Segoe UI", "Avenir Next", system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }
body { background: var(--bg); overflow-x: hidden; }
button, input, select { font: inherit; }
button { color: inherit; }
.hidden { display: none !important; }

.ambient { position: fixed; z-index: 0; border-radius: 50%; filter: blur(120px); opacity: .15; pointer-events: none; }
.ambient-one { width: 420px; height: 420px; background: var(--accent); right: -160px; top: -120px; }
.ambient-two { width: 380px; height: 380px; background: var(--accent-2); left: 20%; bottom: -260px; }

.brand { display: flex; align-items: center; gap: 11px; font: 700 18px "Avenir Next", "Segoe UI", sans-serif; letter-spacing: -.4px; }
.brand-mark { display: block; width: 36px; height: 36px; object-fit: contain; filter: drop-shadow(0 0 12px rgba(255,40,88,.24)); }
.brand-large { font-size: 21px; }
.brand-large .brand-mark { width: 46px; height: 46px; }
.eyebrow { margin: 0 0 10px; color: var(--accent); font-size: 10px; font-weight: 700; letter-spacing: 2.5px; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-family: "Avenir Next", "Segoe UI", sans-serif; }
h1 { letter-spacing: -2.2px; }
em { color: var(--accent); font-style: normal; }

.auth-layout { position: relative; z-index: 1; min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(390px, .8fr); align-items: center; gap: 8vw; max-width: 1240px; padding: 7vh 5vw; margin: auto; }
.auth-intro h1 { margin: 46px 0 24px; max-width: 720px; font-size: clamp(48px, 6.4vw, 88px); line-height: .98; }
.auth-intro .intro-copy { max-width: 540px; color: var(--muted); font-size: 17px; line-height: 1.7; }
.glass { background: rgba(17, 11, 20, .86); border: 1px solid var(--line); box-shadow: 0 35px 100px rgba(45,0,25,.4); backdrop-filter: blur(22px); }
.auth-card { width: 100%; max-width: 470px; min-height: 520px; padding: 28px 38px 38px; border-radius: 26px; justify-self: end; }
.auth-tabs { display: flex; gap: 4px; margin-bottom: 42px; padding: 4px; border-radius: 12px; background: rgba(255,255,255,.04); }
.auth-tab { flex: 1; padding: 10px; border: 0; border-radius: 9px; color: var(--muted); background: transparent; cursor: pointer; font-size: 13px; }
.auth-tab.active { color: var(--text); background: var(--surface-2); box-shadow: 0 4px 14px rgba(0,0,0,.18); }
.form-heading { margin-bottom: 30px; }
.form-heading h2 { margin: 0; font-size: 28px; letter-spacing: -1px; }
.auth-form, .stack-form { display: flex; flex-direction: column; gap: 17px; }
label { display: flex; flex-direction: column; gap: 8px; color: #b7b8c0; font-size: 12px; font-weight: 600; }
input, select { width: 100%; padding: 13px 14px; border: 1px solid var(--line); border-radius: 10px; outline: none; color: var(--text); background: rgba(255,255,255,.035); transition: border-color .2s, background .2s; }
input:focus, select:focus { border-color: rgba(255,40,88,.65); background: rgba(255,40,88,.05); }
select option { background: #1c1420; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 12px; min-height: 44px; padding: 11px 18px; border: 0; border-radius: 10px; cursor: pointer; font-weight: 700; transition: transform .2s, filter .2s; }
.button:hover { transform: translateY(-1px); filter: brightness(1.08); }
.button:disabled { opacity: .45; cursor: wait; transform: none; }
.button-primary { margin-top: 6px; color: #fff; background: linear-gradient(135deg, #f34d73, var(--accent-2)); box-shadow: 0 10px 28px rgba(181,43,185,.18); }
.button-secondary { border: 1px solid var(--line); color: var(--text); background: var(--surface-2); }
.form-error { min-height: 18px; margin: 18px 0 0; color: #ff8292; font-size: 13px; }
.sound-bars { display: flex; align-items: center; gap: 5px; height: 50px; margin-top: 52px; opacity: .7; }
.sound-bars i { width: 3px; height: 12px; border-radius: 3px; background: linear-gradient(var(--accent-2), var(--accent)); animation: wave 1.8s ease-in-out infinite alternate; }
.sound-bars i:nth-child(3n) { height: 36px; animation-delay: -.5s; }
.sound-bars i:nth-child(2n) { height: 24px; animation-delay: -1s; }
@keyframes wave { to { transform: scaleY(.4); opacity: .35; } }

.app-layout { position: relative; z-index: 1; min-height: 100vh; display: grid; grid-template-columns: 235px 1fr; padding-bottom: 92px; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 10; width: 235px; display: flex; flex-direction: column; padding: 30px 22px 116px; border-right: 1px solid var(--line); background: rgba(7,5,10,.9); backdrop-filter: blur(18px); }
.main-nav { display: flex; flex-direction: column; gap: 6px; margin-top: 55px; }
.nav-item { display: flex; align-items: center; gap: 13px; width: 100%; padding: 12px 14px; border: 0; border-radius: 10px; color: var(--muted); background: transparent; cursor: pointer; text-align: left; }
.nav-item span { width: 18px; color: #c8c8ce; font-size: 20px; text-align: center; }
.nav-item:hover, .nav-item.active { color: var(--text); background: var(--surface-2); }
.nav-item.active::after { width: 4px; height: 4px; margin-left: auto; border-radius: 50%; background: var(--accent); content: ""; }
.sidebar-footer { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; margin-top: auto; }
.sidebar-footer a, .text-button { padding: 0; border: 0; color: var(--muted); background: none; cursor: pointer; font-size: 12px; text-decoration: none; }
.sidebar-footer a:hover, .text-button:hover { color: var(--text); }
.workspace { grid-column: 2; min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 8; height: 96px; display: flex; align-items: center; justify-content: space-between; padding: 0 4vw; border-bottom: 1px solid var(--line); background: rgba(7,5,10,.78); backdrop-filter: blur(18px); }
.topbar h2 { margin: 0; font-size: 21px; }
.topbar .eyebrow { margin-bottom: 3px; }
.user-chip { display: flex; align-items: center; gap: 11px; }
.user-chip > span:last-child { display: flex; flex-direction: column; }
.user-chip strong { font-size: 13px; }
.user-chip small { color: var(--muted); font-size: 10px; text-transform: uppercase; }
.avatar { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid rgba(255,40,88,.38); border-radius: 50%; color: var(--accent); background: rgba(255,40,88,.1); font-weight: 700; }
.menu-button { display: none !important; }
.content-scroll { padding: 42px 4vw 80px; }
.view-panel { max-width: 1400px; margin: auto; }
.hero-panel { position: relative; min-height: 285px; display: flex; align-items: center; justify-content: space-between; overflow: hidden; margin-bottom: 56px; padding: 48px clamp(30px, 5vw, 76px); border: 1px solid var(--line); border-radius: 24px; background: linear-gradient(115deg, #170713 0%, #0d0910 55%, #240716 100%); }
.hero-panel::before { position: absolute; inset: 0; background: radial-gradient(circle at 78% 50%, rgba(255,22,102,.24), transparent 38%); content: ""; }
.hero-panel > div { position: relative; z-index: 1; }
.hero-panel h1 { margin: 0; font-size: clamp(37px, 4.2vw, 64px); line-height: 1.05; }
.hero-orbit { position: relative; flex: 0 0 230px; width: 230px; height: 230px; margin-right: 3vw; border: 1px solid rgba(255,255,255,.08); border-radius: 50%; background: rgba(0,0,0,.16); box-shadow: 0 0 80px rgba(181,43,185,.2); }
.hero-orbit img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 18px 38px rgba(255,40,88,.28)); }
.section-heading { margin-bottom: 26px; }
.section-heading h1 { margin: 0; font-size: 44px; }
.section-heading h3 { margin: 0; font-size: 24px; }
.inline-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.search-box { flex-direction: row; align-items: center; width: min(360px, 100%); padding-left: 15px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); }
.search-box span { color: var(--muted); font-size: 22px; }
.search-box input { border: 0; background: transparent; }
.track-list { display: flex; flex-direction: column; }
.track-row { display: grid; grid-template-columns: 42px minmax(170px, 1.4fr) minmax(130px, 1fr) 80px 110px; align-items: center; gap: 14px; min-height: 68px; padding: 9px 13px; border-bottom: 1px solid rgba(255,255,255,.055); border-radius: 9px; transition: background .18s; }
.track-row:hover { background: rgba(255,255,255,.035); }
.play-button { display: grid; place-items: center; width: 35px; height: 35px; padding-left: 2px; border: 1px solid var(--line); border-radius: 50%; background: transparent; cursor: pointer; }
.play-button:hover { border-color: var(--accent); color: var(--accent); }
.track-title, .track-album { min-width: 0; }
.track-title strong, .track-title small, .track-album { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track-title { display: flex; flex-direction: column; gap: 4px; }
.track-title strong { font-size: 14px; }
.track-title small, .track-album, .track-duration { color: var(--muted); font-size: 12px; }
.track-actions { display: flex; justify-content: flex-end; gap: 5px; }
.icon-button { display: grid; place-items: center; width: 35px; height: 35px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); background: transparent; cursor: pointer; }
.icon-button:hover, .icon-button.active { color: var(--accent); border-color: rgba(255,40,88,.45); }
.icon-button.accent { color: #fff; border: 0; background: var(--accent); }
.empty-state { padding: 42px 18px; color: var(--muted); text-align: center; }

.library-grid, .admin-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.panel { padding: 25px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(17,11,20,.82); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.panel-heading h3 { margin: 0; font-size: 20px; }
.panel-heading .eyebrow { margin-bottom: 5px; }
.count-badge, .status-badge { padding: 5px 9px; border-radius: 999px; color: var(--muted); background: rgba(255,255,255,.06); font-size: 10px; text-transform: uppercase; }
.status-badge.published, .status-badge.ready { color: var(--success); background: rgba(100,214,160,.09); }
.status-badge.failed { color: var(--danger); background: rgba(255,77,100,.09); }
.compact-list { display: flex; flex-direction: column; }
.compact-row { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 2px; border-bottom: 1px solid rgba(255,255,255,.05); }
.compact-row > span:not(.cover-mini) { min-width: 0; display: flex; flex: 1; flex-direction: column; }
.compact-row strong, .compact-row small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compact-row strong { font-size: 13px; }
.compact-row small { color: var(--muted); font-size: 11px; }
.cover-mini { display: grid; place-items: center; flex: 0 0 38px; width: 38px; height: 38px; border-radius: 9px; color: #fff; background: linear-gradient(145deg, #ed426d, #8e28ad); box-shadow: 0 7px 18px rgba(120,15,95,.18); font-weight: 700; }
.inline-form { display: flex; gap: 8px; margin-bottom: 15px; }
.playlist-list { display: flex; flex-direction: column; gap: 8px; }
.playlist-card { padding: 13px; border: 1px solid transparent; border-radius: 10px; background: rgba(255,255,255,.03); cursor: pointer; }
.playlist-card:hover { border-color: var(--line); }
.playlist-card strong, .playlist-card small { display: block; }
.playlist-card small { margin-top: 3px; color: var(--muted); }
.playlist-tracks { display: none; padding: 10px 0 0; }
.playlist-card.open .playlist-tracks { display: block; }
.history-panel { margin-top: 20px; }
.admin-grid { align-items: start; }
.stack-form + .stack-form { margin-top: 26px; padding-top: 24px; border-top: 1px solid var(--line); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.upload-form { margin-top: 28px; }
.file-drop { padding: 18px; border: 1px dashed rgba(255,255,255,.18); border-radius: 11px; text-align: center; cursor: pointer; }
.file-drop input { padding: 4px; border: 0; background: transparent; }
.file-drop span { color: var(--muted); font-size: 10px; }
.pipeline-panel { grid-column: 1 / -1; }
.admin-track-list { display: flex; flex-direction: column; }
.admin-track { display: grid; grid-template-columns: minmax(180px,1fr) 100px 1.4fr auto; align-items: center; gap: 15px; padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,.06); }
.admin-track strong, .admin-track small { display: block; }
.admin-track small { margin-top: 3px; color: var(--muted); }
.admin-track .error-note { overflow: hidden; color: #c5a69b; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.admin-actions { display: flex; gap: 7px; }
.admin-actions button { min-height: 34px; padding: 7px 11px; font-size: 11px; }
.token-result { margin: 20px 0; padding: 14px; border: 1px solid rgba(255,40,88,.25); border-radius: 10px; background: rgba(255,40,88,.05); }
.token-result small, .token-result code { display: block; }
.token-result code { overflow-wrap: anywhere; margin: 8px 0; color: var(--accent-2); }

.player { position: fixed; z-index: 20; right: 0; bottom: 0; left: 235px; height: 92px; display: grid; grid-template-columns: minmax(180px, .7fr) minmax(300px, 1fr) 40px; align-items: center; gap: 24px; padding: 13px 4vw; border-top: 1px solid var(--line); background: rgba(10,6,12,.96); backdrop-filter: blur(22px); }
.now-playing { min-width: 0; display: flex; align-items: center; gap: 12px; }
.now-playing > span:last-child { min-width: 0; display: flex; flex-direction: column; }
.now-playing strong, .now-playing small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.now-playing strong { font-size: 13px; }
.now-playing small { margin-top: 3px; color: var(--muted); font-size: 11px; }
audio { width: 100%; height: 38px; accent-color: var(--accent); }
.toast { position: fixed; z-index: 100; right: 26px; bottom: 112px; max-width: 380px; padding: 13px 18px; border: 1px solid var(--line); border-radius: 11px; color: var(--text); background: #251628; box-shadow: 0 14px 40px rgba(0,0,0,.35); opacity: 0; transform: translateY(10px); pointer-events: none; transition: .25s; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { border-color: rgba(255,77,100,.35); }

@media (max-width: 900px) {
  .auth-layout { grid-template-columns: 1fr; padding: 35px 20px; }
  .auth-intro { display: none; }
  .auth-card { justify-self: center; }
  .app-layout { grid-template-columns: 1fr; }
  .sidebar { transform: translateX(-100%); transition: transform .25s; box-shadow: 20px 0 50px rgba(0,0,0,.4); }
  .sidebar.open { transform: translateX(0); }
  .workspace { grid-column: 1; }
  .menu-button { display: grid !important; }
  .topbar { padding: 0 20px; }
  .content-scroll { padding: 28px 18px 70px; }
  .hero-panel { min-height: 240px; padding: 35px 28px; }
  .hero-orbit { display: none; }
  .library-grid, .admin-grid { grid-template-columns: 1fr; }
  .pipeline-panel { grid-column: auto; }
  .player { left: 0; grid-template-columns: 1fr 1.4fr 35px; padding: 12px 16px; }
}

@media (max-width: 620px) {
  .auth-card { min-height: 0; padding: 22px; }
  .inline-heading { align-items: stretch; flex-direction: column; }
  .search-box { width: 100%; }
  .track-row { grid-template-columns: 38px minmax(0,1fr) 80px; }
  .track-album, .track-duration { display: none; }
  .form-row { grid-template-columns: 1fr; }
  .admin-track { grid-template-columns: 1fr auto; }
  .admin-track .error-note { grid-column: 1 / -1; }
  .admin-actions { grid-column: 1 / -1; }
  .player { height: 128px; grid-template-columns: 1fr 35px; }
  .player audio { grid-column: 1 / -1; grid-row: 2; }
  .user-chip > span:last-child { display: none; }
}
