:root {
  --bg: #07070c;
  --panel: rgba(18, 18, 28, 0.72);
  --panel-strong: rgba(24, 24, 36, 0.9);
  --line: rgba(255, 255, 255, 0.08);
  --text: #f6f4f8;
  --muted: #9b97ad;
  --red: #ec4141;
  --red-2: #ff6b81;
  --gold: #efc56d;
  --ok: #49d39c;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  --radius: 22px;
  --fill: rgba(255, 255, 255, 0.04);
  --toast-bg: rgba(20, 20, 30, 0.92);
  --toast-ok: #b8f5dc;
  --toast-err: #ffb4b4;
  --on-accent: #fff;
  --cover-bg: #191922;
  --avatar-bg: #222;
  --badge-bad: #ff9b9b;
  --orb-opacity: 0.45;
}

html[data-theme="light"] {
  --bg: #f6f1ea;
  --panel: rgba(255, 255, 255, 0.82);
  --panel-strong: rgba(255, 255, 255, 0.96);
  --line: rgba(36, 24, 32, 0.1);
  --text: #1c1520;
  --muted: #6d6478;
  --gold: #b57a12;
  --ok: #1a9464;
  --shadow: 0 20px 60px rgba(80, 36, 48, 0.12);
  --fill: rgba(28, 21, 32, 0.04);
  --toast-bg: rgba(255, 255, 255, 0.96);
  --toast-ok: #0f7a52;
  --toast-err: #c0392b;
  --on-accent: #fff;
  --cover-bg: #ece6e0;
  --avatar-bg: #e4dfd8;
  --badge-bad: #c0392b;
  --orb-opacity: 0.2;
}

html { color-scheme: dark; }
html[data-theme="light"] { color-scheme: light; }

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; overflow-x: hidden; }
body {
  font-family: "Outfit", "Noto Sans SC", sans-serif;
  color: var(--text);
  background: var(--bg);
  letter-spacing: 0.01em;
}

.bg { position: fixed; inset: 0; overflow: hidden; z-index: 0; pointer-events: none; }
.orb {
  position: absolute;
  width: 42vw;
  height: 42vw;
  border-radius: 50%;
  filter: blur(80px);
  opacity: var(--orb-opacity);
}
.orb-a { background: #ec4141; top: -12%; left: -8%; }
.orb-b { background: #5b3dff; bottom: -18%; right: -10%; width: 36vw; height: 36vw; }
.orb-c { background: #2a1848; top: 40%; left: 40%; width: 28vw; height: 28vw; }

#app { position: relative; z-index: 1; min-height: 100vh; min-width: 0; overflow-x: hidden; }

.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--toast-bg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  color: var(--text);
}
.toast.error { border-color: rgba(236, 65, 65, 0.5); color: var(--toast-err); }
.toast.ok { border-color: rgba(73, 211, 156, 0.4); color: var(--toast-ok); }
.hidden { display: none !important; }

.auth-wrap {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 80px 16px 32px;
}
.theme-toggle {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 2;
}
.auth-card {
  width: min(920px, 100%);
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 28px;
  overflow: hidden;
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}
.hero {
  padding: 48px 40px;
  background:
    radial-gradient(120% 80% at 0% 0%, rgba(236, 65, 65, 0.28), transparent 55%),
    linear-gradient(180deg, rgba(255,255,255,0.03), transparent);
}
.hero h1 { font-size: 42px; margin: 12px 0 10px; line-height: 1.15; }
.hero p { color: var(--muted); line-height: 1.7; margin: 0; }
.kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--red-2);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.vinyl {
  width: 148px;
  height: 148px;
  margin-top: 36px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, #1a1a22 0 18%, transparent 19%),
    repeating-radial-gradient(circle, #111 0 3px, #1d1d28 4px 7px);
  box-shadow: 0 0 0 8px rgba(236,65,65,0.18), inset 0 0 0 18px rgba(236,65,65,0.35);
  animation: spin 12s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.form-side { padding: 42px 36px; }
.tabs { display: flex; gap: 8px; margin-bottom: 24px; }
.tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
}
.tab.active { background: rgba(236, 65, 65, 0.16); color: var(--on-accent); }
html[data-theme="light"] .tab.active { color: var(--text); }
label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 6px; }
input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--fill);
  color: var(--text);
  border-radius: 14px;
  padding: 12px 14px;
  outline: none;
  font: inherit;
}
input:focus, textarea:focus { border-color: rgba(236,65,65,0.7); }
.btn {
  width: 100%;
  margin-top: 18px;
  border: 0;
  border-radius: 14px;
  padding: 12px 16px;
  font-weight: 700;
  cursor: pointer;
  background: linear-gradient(90deg, var(--red), #ff6b6b);
  color: white;
}
.btn.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
}
.btn.small { width: auto; margin: 0; padding: 8px 12px; font-size: 13px; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.hint { font-size: 12px; color: var(--muted); margin-top: 14px; }

.shell { max-width: 1180px; margin: 0 auto; padding: 24px 18px 64px; min-width: 0; overflow-x: hidden; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.brand { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 20px; }
.logo-dot {
  width: 34px; height: 34px; border-radius: 12px;
  background: linear-gradient(135deg, var(--red), #ff8aa0);
  display: grid; place-items: center;
}
.userchip { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; color: var(--muted); }
#bind-email {
  max-width: min(240px, 70vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav {
  display: flex; gap: 8px; margin-bottom: 22px;
}
.nav button {
  border: 1px solid var(--line);
  background: var(--fill);
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
}
.nav button.active { color: var(--on-accent); background: rgba(236,65,65,0.18); border-color: transparent; }
html[data-theme="light"] .nav button.active { color: var(--text); }

.grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 0.8fr); gap: 18px; }
.card {
  min-width: 0;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  backdrop-filter: blur(18px);
}
.card h2 { margin: 0 0 6px; font-size: 20px; }
.muted { color: var(--muted); font-size: 13px; line-height: 1.6; }
.nowplay {
  display: flex; gap: 16px; align-items: center; margin-top: 18px;
}
.cover {
  width: 84px; height: 84px; border-radius: 16px; object-fit: cover;
  background: var(--cover-bg);
}
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 18px; }
.stat {
  background: var(--fill);
  border-radius: 16px;
  padding: 12px;
}
.stat b { display: block; font-size: 22px; }
.account {
  display: flex; gap: 12px; align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.account:last-child { border-bottom: 0; }
.avatar { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; background: var(--avatar-bg); }
.grow { flex: 1; }
.qr-box { display: grid; place-items: center; padding: 12px 0 4px; }
.qr-box svg { background: white; border-radius: 16px; padding: 10px; width: 240px; height: 240px; display: block; }
.qr-url { font-size: 11px; color: var(--muted); word-break: break-all; margin-top: 8px; }
.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}
.pager .row-actions { margin: 0; }
.track {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  color: var(--muted);
  font-size: 14px;
}
.track b { color: var(--text); font-weight: 500; }
.cap-wrap { margin: 16px 0 4px; }
cap-widget {
  --cap-background: var(--fill);
  --cap-border-color: var(--line);
  --cap-color: var(--text);
  --cap-checkbox-background: var(--fill);
  --cap-spinner-color: var(--gold);
  --cap-spinner-background-color: var(--line);
}
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: "Noto Sans SC", sans-serif;
  font-size: 12px;
  padding: 3px 8px;
  line-height: 1.25;
  letter-spacing: 0;
  border-radius: 999px;
  background: rgba(73, 211, 156, 0.15);
  color: var(--ok);
  white-space: nowrap;
  vertical-align: middle;
}
.badge.bad { background: rgba(236,65,65,0.15); color: var(--badge-bad); }
.badge.warn { background: rgba(239, 197, 109, 0.16); color: var(--gold); }
.table-wrap {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  margin-top: 8px;
}
.table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.table th, .table td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  vertical-align: middle;
}
.table .col-center {
  text-align: center;
}
.row-actions { display: flex; gap: 6px; flex-wrap: nowrap; }
.modal-bg {
  position: fixed; inset: 0; background: rgba(0,0,0,0.55);
  display: grid; place-items: center; z-index: 20; padding: 16px;
}
.modal {
  width: min(460px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 22px;
}
.or-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0 4px;
  color: var(--muted);
  font-size: 13px;
}
.or-line::before,
.or-line::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}
.modal .tabs { margin-bottom: 12px; flex-wrap: wrap; }
.sms-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.sms-row input { flex: 1; }
.sms-row .btn {
  width: auto;
  margin-top: 0;
  flex-shrink: 0;
}
.modal textarea {
  min-height: 88px;
  font-size: 12px;
  line-height: 1.45;
  resize: vertical;
}
.logs { max-height: 360px; overflow: auto; }
.logline { font-size: 13px; color: var(--muted); padding: 8px 0; border-bottom: 1px solid var(--line); }

@media (max-width: 860px) {
  .auth-wrap { place-items: start center; }
  .auth-card, .grid { grid-template-columns: 1fr; }
  .hero { padding: 32px 24px 8px; }
  .stats { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; align-items: flex-start; gap: 12px; }
}
