:root {
  --bg: #f7f7fb;
  --panel: #ffffff;
  --border: #e6e6ee;
  --text: #14141a;
  --muted: #6b6b78;
  --brand: #5b3df5;
  --brand-2: #7a5cff;
  --brand-soft: #eee9ff;
  --success: #1f9d55;
  --success-soft: #e6f7ec;
  --error: #d6365b;
  --error-soft: #fde9ee;
  --info: #245fbf;
  --info-soft: #e7f0ff;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(20, 20, 26, 0.04), 0 4px 16px rgba(20, 20, 26, 0.04);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: var(--font); color: var(--text); background: var(--bg); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Auth screens ---------- */
.auth-body {
  min-height: 100vh;
  display: flex;
  background: linear-gradient(135deg, #f4f0ff 0%, #f7f7fb 50%);
}
.auth-shell {
  margin: auto;
  padding: 24px;
  width: 100%;
  max-width: 520px;
}
.auth-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 32px;
  box-shadow: var(--shadow);
}
.auth-card-wide { max-width: 520px; }
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 24px; }
.brand-mark {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand); color: #fff; border-radius: 8px;
  font-weight: 700; font-size: 16px;
}
.brand-name { font-weight: 700; font-size: 18px; letter-spacing: -0.01em; }
.auth-heading { margin: 0 0 8px 0; font-size: 24px; font-weight: 700; letter-spacing: -0.01em; }
.auth-sub { margin: 0 0 24px 0; color: var(--muted); font-size: 14px; }
.auth-links { margin-top: 20px; font-size: 13px; color: var(--muted); text-align: center; }
.auth-links a { color: var(--brand); }
.auth-links span { margin: 0 8px; }

/* ---------- Forms ---------- */
.form { display: flex; flex-direction: column; gap: 16px; }
.form-inline { margin-top: 16px; text-align: center; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 13px; font-weight: 500; color: var(--text); }
.field-hint { font-size: 12px; color: var(--muted); }
.input {
  appearance: none;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font-size: 14px;
  font-family: var(--font);
  width: 100%;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.input-sm { padding: 7px 10px; font-size: 13px; }
.input-code { letter-spacing: 12px; font-size: 22px; text-align: center; font-weight: 600; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font); font-weight: 600; font-size: 14px;
  padding: 11px 16px; border-radius: var(--radius-sm);
  border: 1px solid transparent; cursor: pointer; transition: background .15s, border-color .15s;
  text-decoration: none;
}
.btn-block { width: 100%; }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-2); text-decoration: none; }
.btn-secondary { background: #fff; color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); }

/* ---------- Flash ---------- */
.flash-stack { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.flash {
  padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13px;
  border: 1px solid transparent; transition: opacity .3s ease;
}
.flash-success { background: var(--success-soft); border-color: #c9eed5; color: #156c3a; }
.flash-error { background: var(--error-soft); border-color: #f6c2cf; color: #93203d; }
.flash-info { background: var(--info-soft); border-color: #c6daf6; color: #1a4a98; }

/* ---------- App shell ---------- */
.app-body { background: var(--bg); }
.app-shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.app-main { display: flex; flex-direction: column; min-width: 0; }

/* ---------- Sidebar ---------- */
.sidebar {
  background: #fff; border-right: 1px solid var(--border);
  padding: 18px 14px; display: flex; flex-direction: column; gap: 20px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { padding: 4px 6px; }
.brand-link { display: flex; align-items: center; gap: 10px; color: var(--text); }
.brand-link:hover { text-decoration: none; }
.sidebar-cta { margin-top: 4px; }
.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item, .nav-sub {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px;
  font-size: 14px; color: var(--text); cursor: pointer;
}
.nav-item:hover, .nav-sub:hover { background: var(--bg); text-decoration: none; }
.nav-item.is-active, .nav-sub.is-active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.nav-sub { padding-left: 18px; font-size: 13px; color: var(--muted); }
.nav-sub.is-muted { color: #b6b6c0; cursor: default; }
.nav-sub.is-muted:hover { background: transparent; }
.nav-group { margin-top: 14px; display: flex; flex-direction: column; gap: 2px; }
.nav-group-label { padding: 4px 12px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.nav-icon { font-size: 14px; color: var(--muted); }
.sidebar-footer { display: flex; gap: 12px; padding: 8px 12px; font-size: 12px; color: var(--muted); }
.nav-mini { color: var(--muted); }

/* ---------- Topbar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px; background: #fff; border-bottom: 1px solid var(--border);
}
.topbar-title { font-weight: 600; font-size: 15px; }
.topbar-actions { display: flex; align-items: center; gap: 14px; }
.user-chip { text-align: right; line-height: 1.2; }
.user-name { font-size: 13px; font-weight: 600; }
.user-meta { font-size: 11px; color: var(--muted); }
.inline-form { display: inline; }

/* ---------- Content ---------- */
.content { padding: 24px; max-width: 1200px; width: 100%; }
.greeting h1 { margin: 0 0 4px 0; font-size: 22px; }
.greeting .sub { margin: 0; color: var(--muted); font-size: 14px; }

/* ---------- Stat cards ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 24px 0; }
.stat-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow);
}
.stat-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.stat-value { font-size: 28px; font-weight: 700; margin-top: 6px; }

/* ---------- Panel ---------- */
.panel {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow); margin-top: 16px;
}
.panel-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.panel-header h2 { margin: 0; font-size: 16px; }
.link { font-size: 13px; color: var(--brand); }

/* ---------- Release list ---------- */
.release-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.release-row {
  display: grid; grid-template-columns: 56px 1fr auto; align-items: center; gap: 14px;
  padding: 10px 8px; border-radius: 8px;
}
.release-row:hover { background: var(--bg); }
.release-cover { width: 48px; height: 48px; border-radius: 8px; overflow: hidden; background: var(--bg); display: flex; align-items: center; justify-content: center; }
.release-cover img { width: 100%; height: 100%; object-fit: cover; }
.cover-placeholder { font-weight: 700; color: var(--muted); }
.release-title { font-size: 14px; font-weight: 600; }
.release-artist { font-size: 12px; color: var(--muted); }

/* ---------- Empty state ---------- */
.empty { padding: 32px; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 14px; }

/* ---------- Catalog table ---------- */
.catalog-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 8px; }
.tabs { display: flex; gap: 4px; background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 4px; }
.tab { padding: 7px 14px; border-radius: 7px; font-size: 13px; color: var(--muted); }
.tab:hover { background: var(--bg); text-decoration: none; }
.tab.is-active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.search { display: flex; gap: 6px; }

.muted { color: var(--muted); }
.small { font-size: 12px; }

.table-wrap { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-top: 12px; box-shadow: var(--shadow); }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { padding: 12px 14px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.table th { background: #fafafd; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #fafafd; }
.cover-cell { width: 56px; }
.cover-cell img, .cover-cell .cover-placeholder { width: 40px; height: 40px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; object-fit: cover; background: var(--bg); }

/* ---------- Pill / status ---------- */
.pill {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 600; text-transform: capitalize;
  background: var(--bg); color: var(--muted);
}
.pill-live { background: var(--success-soft); color: #156c3a; }
.pill-draft { background: #fff2d6; color: #8a5d00; }
.pill-pending_review { background: var(--info-soft); color: #1a4a98; }
.pill-correction_requested { background: var(--error-soft); color: #93203d; }
.pill-taken_down { background: #f1f1f5; color: var(--muted); }

/* ---------- Pager ---------- */
.pager { display: flex; gap: 4px; margin-top: 14px; justify-content: center; }
.pager-item {
  display: inline-block; padding: 6px 11px; border-radius: 7px;
  background: #fff; border: 1px solid var(--border); font-size: 13px; color: var(--text);
}
.pager-item:hover { background: var(--bg); text-decoration: none; }
.pager-item.is-active { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; }
  .row-2 { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr; }
}

/* ---------- Page title ---------- */
.page-title { margin: 4px 0 18px 0; font-size: 22px; }
.back-link { display: inline-block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.back-link:hover { color: var(--brand); }

/* ---------- Wizard ---------- */
.wizard-shell { max-width: 640px; margin: 0 auto; }
.wizard-progress { display: flex; align-items: center; gap: 0; margin: 12px 0 28px 0; }
.wstep { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.wstep-num {
  width: 32px; height: 32px; border-radius: 999px;
  background: #fff; border: 2px solid var(--border); color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px;
}
.wstep-label { font-size: 12px; color: var(--muted); }
.wstep.is-active .wstep-num { background: var(--brand); color: #fff; border-color: var(--brand); }
.wstep.is-active .wstep-label { color: var(--brand); font-weight: 600; }
.wstep.is-done .wstep-num { background: var(--brand-soft); color: var(--brand); border-color: var(--brand); }
.wstep-line { flex: 1; height: 2px; background: var(--border); margin: 0 8px; margin-bottom: 22px; }

.wizard-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 32px; box-shadow: var(--shadow);
}
.wizard-heading { margin: 0 0 6px 0; font-size: 22px; }
.wizard-sub { margin: 0 0 22px 0; color: var(--muted); font-size: 14px; }
.wizard-actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 24px; }

/* ---------- Choice cards (radio) ---------- */
.choice-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.choice {
  display: flex; flex-direction: column; gap: 4px;
  padding: 14px 16px; border: 1px solid var(--border); border-radius: 10px;
  cursor: pointer; background: #fff;
  transition: border-color .15s, background .15s;
}
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice:hover { border-color: var(--brand); }
.choice.is-checked { border-color: var(--brand); background: var(--brand-soft); }
.choice-title { font-weight: 600; font-size: 14px; }
.choice-sub { font-size: 13px; color: var(--muted); }

/* ---------- Release detail ---------- */
.release-header { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 20px; }
.release-header h1 { margin: 6px 0 6px 0; font-size: 24px; }
.release-sub { display: flex; align-items: center; gap: 8px; }
.release-header-actions { display: flex; gap: 8px; }
.btn-danger { color: var(--error); }
.btn-danger:hover { background: var(--error-soft); }

.release-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 1100px) { .release-grid { grid-template-columns: 1.4fr 1fr; } }

.release-title-link { font-size: 14px; font-weight: 600; color: var(--text); }
.release-title-link:hover { color: var(--brand); text-decoration: none; }

/* ---------- Tracks ---------- */
.track-list { list-style: none; padding: 0; margin: 0 0 16px 0; display: flex; flex-direction: column; gap: 4px; }
.track-row {
  display: grid; grid-template-columns: 32px 1fr auto; gap: 12px; align-items: center;
  padding: 10px 12px; background: var(--bg); border-radius: 8px;
}
.track-pos { color: var(--muted); font-weight: 600; font-size: 13px; text-align: center; }
.track-title { font-size: 14px; font-weight: 500; }
.track-isrc { margin-top: 2px; }
.badge { display: inline-block; padding: 1px 6px; background: #333; color: #fff; border-radius: 4px; font-size: 10px; font-weight: 700; }

/* ---------- Compact form ---------- */
.form-compact { gap: 10px; padding-top: 14px; border-top: 1px dashed var(--border); }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }
.checkbox { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }


/* ---------- Cover panel ---------- */
.cover-panel { display: flex; flex-direction: column; gap: 14px; align-items: stretch; }
.cover-preview {
  width: 100%; aspect-ratio: 1 / 1; max-width: 280px;
  margin: 0 auto;
  background: var(--bg); border: 1px dashed var(--border); border-radius: 10px;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.cover-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-empty { color: var(--muted); font-size: 13px; }
.panel-divider { height: 1px; background: var(--border); margin: 20px -20px; }

/* ---------- Track audio form (inline per-track) ---------- */
.track-row-detailed { grid-template-columns: 32px 1fr auto; gap: 14px; padding: 14px; }
.track-audio-form { display: inline-flex; gap: 6px; align-items: center; margin-top: 6px; }
.track-audio-form input[type=file] { font-size: 12px; max-width: 220px; }
.status-warn { color: #8a5d00; font-weight: 600; }

/* ---------- File input polish ---------- */
input[type=file].input { padding: 8px 10px; font-size: 13px; }
input[type=file] { font-family: var(--font); }
