:root {
  color-scheme: dark;
  --bg: #07080c;
  --bg2: #0c0e15;
  --panel: rgba(18, 20, 30, .82);
  --panel2: rgba(24, 27, 40, .9);
  --line: rgba(255,255,255,.08);
  --line2: rgba(255,255,255,.13);
  --text: #f5f7ff;
  --muted: #8f96aa;
  --accent: #8f6bff;
  --accent2: #5d8dff;
  --success: #4dd7a8;
  --danger: #ff6b7a;
  --warning: #ffc76a;
  --shadow: 0 22px 60px rgba(0,0,0,.38);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, sans-serif; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

body {
  background:
    radial-gradient(circle at 20% 10%, rgba(105, 72, 255, .16), transparent 31rem),
    radial-gradient(circle at 90% 20%, rgba(64, 137, 255, .11), transparent 28rem),
    linear-gradient(180deg, #090a0f, #07080c 52%);
}

.noise {
  position: fixed; inset: 0; pointer-events: none; opacity: .18;
  background-image: linear-gradient(rgba(255,255,255,.015) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.015) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(to bottom, black, transparent 80%);
}

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 28px; }
.login-card {
  width: min(520px, 100%);
  padding: 34px;
  border: 1px solid var(--line2);
  border-radius: 26px;
  background: linear-gradient(160deg, rgba(22,24,36,.96), rgba(10,11,17,.94));
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.brand-row { display: flex; align-items: center; gap: 14px; }
.brand-row.compact { padding: 6px 2px 28px; }
.brand-row.compact strong { display:block; font-size: 14px; }
.brand-row.compact small { display:block; color: var(--muted); margin-top: 3px; }

.brand-mark {
  width: 44px; height: 44px; border-radius: 14px; display:grid; place-items:center; font-weight:900;
  background: linear-gradient(140deg, var(--accent), var(--accent2));
  box-shadow: 0 10px 32px rgba(103,91,255,.35);
}
.eyebrow { color: #aaa4cf; font-size: 11px; letter-spacing: .16em; font-weight: 800; text-transform: uppercase; }
h1,h2,h3,p { margin: 0; }
h1 { font-size: 20px; margin-top: 4px; }
.login-copy { margin: 38px 0 28px; }
.login-copy h2 { font-size: clamp(28px, 5vw, 42px); line-height: 1.02; margin: 14px 0 14px; max-width: 430px; }
.login-copy p { color: var(--muted); line-height: 1.6; }

.pill, .owner-chip {
  display: inline-flex; align-items:center; min-height: 28px; padding: 0 10px; border-radius: 999px;
  background: rgba(143,107,255,.12); border: 1px solid rgba(143,107,255,.25); color: #c8baff;
  font-size: 11px; font-weight: 800; letter-spacing:.05em;
}

.stack { display: grid; gap: 14px; }
label { display: grid; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 700; }
input, select {
  width: 100%; color: var(--text); background: rgba(255,255,255,.045); border: 1px solid var(--line2);
  border-radius: 12px; padding: 13px 14px; outline: none; transition: .18s ease;
}
input:focus, select:focus { border-color: rgba(143,107,255,.68); box-shadow: 0 0 0 4px rgba(143,107,255,.1); }

button {
  border: 0; color: var(--text); border-radius: 12px; padding: 12px 15px; font-weight: 800;
  transition: transform .15s ease, border-color .15s ease, background .15s ease;
}
button:hover { transform: translateY(-1px); }
.primary { background: linear-gradient(135deg, #8f6bff, #5f82ff); box-shadow: 0 10px 28px rgba(90,93,255,.23); }
.primary.small { padding: 9px 12px; font-size:12px; }
.ghost { background: rgba(255,255,255,.045); border: 1px solid var(--line); }
.danger { background: rgba(255,107,122,.1); color: #ff9aa5; border: 1px solid rgba(255,107,122,.18); }

.login-foot { margin-top: 18px; color: #6f7588; text-align: center; font-size: 11px; }
.error { margin-top: 14px; padding: 12px 14px; border-radius: 11px; color: #ff9ca7; background: rgba(255,107,122,.08); border: 1px solid rgba(255,107,122,.17); }

.app-shell { min-height:100vh; display:grid; grid-template-columns: 240px minmax(0,1fr); }
.sidebar {
  position: sticky; top:0; height:100vh; border-right: 1px solid var(--line);
  padding: 24px 18px; background: rgba(8,9,14,.8); backdrop-filter: blur(18px);
  display:flex; flex-direction:column;
}
nav { display:grid; gap:8px; }
.nav-button { text-align:left; background:transparent; color:#858ca1; border:1px solid transparent; }
.nav-button.active { color:white; background:rgba(143,107,255,.11); border-color:rgba(143,107,255,.18); }
.sidebar-bottom { margin-top:auto; display:grid; gap:12px; }
.backend-state { color:var(--muted); font-size:12px; display:flex; gap:8px; align-items:center; }
.dot { width:8px; height:8px; border-radius:99px; background:var(--success); box-shadow:0 0 14px rgba(77,215,168,.7); }

.workspace { min-width:0; padding: 24px 28px 44px; }
.topbar { min-height: 74px; display:flex; align-items:center; justify-content:space-between; gap:20px; margin-bottom:24px; }
.topbar h2 { font-size: 28px; margin-top:4px; }
.top-actions { display:flex; gap:10px; align-items:center; }

.view { display:none; }
.view.active { display:block; }
.metric-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:14px; margin-bottom:14px; }
.metric {
  padding: 20px; border:1px solid var(--line); border-radius:18px; background:var(--panel); box-shadow:0 12px 38px rgba(0,0,0,.18);
}
.metric strong { display:block; font-size:32px; margin-top:8px; }
.metric small { color:var(--muted); }

.grid-two { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:14px; }
.panel { background:var(--panel); border:1px solid var(--line); border-radius:18px; padding:20px; box-shadow:0 12px 34px rgba(0,0,0,.16); min-width:0; }
.panel-head { display:flex; align-items:center; justify-content:space-between; gap:16px; margin-bottom:18px; }
.panel h3 { margin-top:5px; font-size:18px; }

.list { display:grid; gap:9px; }
.list-item {
  display:flex; align-items:center; justify-content:space-between; gap:12px; padding:12px 13px;
  border:1px solid var(--line); border-radius:12px; background:rgba(255,255,255,.025);
}
.list-item .sub { color:var(--muted); font-size:11px; margin-top:4px; }
.list-item strong { font-size:13px; }

.badge { display:inline-flex; align-items:center; padding:5px 8px; border-radius:999px; font-size:10px; font-weight:900; letter-spacing:.04em; }
.badge.user { color:#c4c9d7; background:rgba(190,198,215,.08); }
.badge.music { color:#8ee8c5; background:rgba(77,215,168,.10); }
.badge.premium { color:#a9c8ff; background:rgba(93,141,255,.12); }
.badge.owner { color:#d7c7ff; background:rgba(143,107,255,.14); }
.badge.ok { color:#8fe6c8; background:rgba(77,215,168,.10); }
.badge.off { color:#ff9aa5; background:rgba(255,107,122,.10); }

.table-wrap { overflow:auto; border:1px solid var(--line); border-radius:14px; }
table { width:100%; border-collapse:collapse; min-width:840px; }
th,td { padding:12px 13px; text-align:left; border-bottom:1px solid var(--line); font-size:12px; }
th { color:#7f879d; font-size:10px; letter-spacing:.08em; text-transform:uppercase; background:rgba(255,255,255,.025); }
td { color:#d8dbea; }
tr:last-child td { border-bottom:0; }
.actions { display:flex; flex-wrap:wrap; gap:6px; }
.actions button { padding:7px 9px; font-size:10px; }

.form-grid {
  grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; margin-bottom:18px; padding:16px;
  border:1px solid var(--line); border-radius:14px; background:rgba(255,255,255,.02);
}
.form-actions { grid-column:1/-1; display:flex; gap:8px; }
.switch-row { grid-template-columns:1fr auto; align-items:center; }
.switch-row input { width:18px; height:18px; }

.empty-state { color:var(--muted); padding:28px; border:1px dashed var(--line2); border-radius:14px; text-align:center; }
.toast {
  position:fixed; right:22px; bottom:22px; max-width:min(420px,calc(100vw - 44px)); padding:13px 15px;
  border-radius:13px; background:#191c28; border:1px solid var(--line2); box-shadow:var(--shadow); z-index:30; font-size:13px;
}

@media (max-width: 980px) {
  .metric-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .grid-two { grid-template-columns:1fr; }
  .form-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width: 740px) {
  .app-shell { grid-template-columns:1fr; }
  .sidebar { position:relative; height:auto; border-right:0; border-bottom:1px solid var(--line); }
  nav { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .sidebar-bottom { margin-top:18px; }
  .workspace { padding:20px 14px 36px; }
  .topbar { align-items:flex-start; }
  .metric-grid { grid-template-columns:1fr 1fr; }
}
