:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-alt: #f0f1f4;
  --border: #e2e4e9;
  --text: #16181d;
  --text-muted: #6b7280;
  --accent: #5b5bf6;
  --accent-hover: #4747d8;
  --success: #16a34a;
  --danger: #dc2626;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 18, 24, 0.06), 0 1px 12px rgba(16, 18, 24, 0.04);
}

[data-theme="dark"] {
  --bg: #101114;
  --surface: #17181d;
  --surface-alt: #1e2026;
  --border: #2a2c33;
  --text: #eef0f3;
  --text-muted: #9aa0ab;
  --accent: #7c7cff;
  --accent-hover: #9494ff;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 20px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  transition: background 0.2s ease, color 0.2s ease;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar .brand {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
  padding: 0 12px 20px;
  color: var(--text);
}

.sidebar a.nav-link {
  display: block;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
}

.sidebar a.nav-link:hover { background: var(--surface-alt); color: var(--text); }
.sidebar a.nav-link.active { background: var(--accent); color: white; }

.sidebar .theme-toggle {
  margin-top: auto;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
}

.main {
  flex: 1;
  padding: 32px 40px;
  max-width: 1200px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-header h1 { font-size: 22px; margin: 0; letter-spacing: -0.01em; }
.page-header p { color: var(--text-muted); font-size: 14px; margin: 4px 0 0; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: var(--accent);
  color: white;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

.btn:hover { background: var(--accent-hover); }
.btn:active { transform: scale(0.98); }

.btn-secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-secondary:hover { background: var(--surface-alt); }

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-danger { background: var(--danger); }

form.stacked { display: flex; flex-direction: column; gap: 16px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.field .hint { font-size: 12px; color: var(--text-muted); }

input[type="text"], input[type="password"], input[type="url"], input[type="number"], input[type="date"], select, textarea {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  width: 100%;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--text-muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; padding: 10px 12px; border-bottom: 1px solid var(--border); }
td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface-alt); }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  background: var(--surface-alt);
  color: var(--text-muted);
}
.badge.ready { background: rgba(22,163,74,0.12); color: var(--success); }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.flash {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 14px;
  background: rgba(91,91,246,0.1);
  border: 1px solid rgba(91,91,246,0.25);
  color: var(--accent);
}
.flash.error {
  background: rgba(220,38,38,0.1);
  border-color: rgba(220,38,38,0.25);
  color: var(--danger);
}

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #14151a, #1c1e2c);
}

.login-card {
  width: 340px;
  background: var(--surface);
  border-radius: 16px;
  padding: 36px 32px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}

.login-card h1 { font-size: 20px; margin: 0 0 4px; }
.login-card p { color: var(--text-muted); font-size: 13px; margin: 0 0 24px; }

.track-preview {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 16px;
  background: var(--surface-alt);
  border-radius: 10px;
  margin-top: 8px;
}
.track-preview img { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; }
.track-preview .meta strong { display: block; font-size: 14px; }
.track-preview .meta span { font-size: 13px; color: var(--text-muted); }

.copy-input {
  display: flex;
  gap: 8px;
}
.copy-input input { flex: 1; }

.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin: 28px 0 12px; font-weight: 700; }
.section-title:first-child { margin-top: 0; }

pre.code-block {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  font-size: 13px;
  overflow-x: auto;
}

ol.instructions li { margin-bottom: 10px; line-height: 1.6; }
