:root {
  --bg-0: #020617;
  --bg-1: #0b1120;
  --bg-2: #111827;
  --border: #1e293b;
  --border-hi: #334155;
  --text: #f8fafc;
  --muted: #94a3b8;
  --accent: #0ea5e9;
  --accent-hi: #38bdf8;
  --success: #10b981;
  --warn: #f59e0b;
  --danger: #ef4444;
  --radius: 10px;
}

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg-0);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

dialog:modal {
  overscroll-behavior: contain;
  background: var(--bg-1);
  color: var(--text);
  border: 1px solid var(--border-hi);
  border-radius: 14px;
  padding: 0;
  width: min(620px, 94vw);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.65);
}

dialog::backdrop {
  overflow: hidden;
  overscroll-behavior: contain;
  background: rgba(2, 6, 23, 0.78);
  backdrop-filter: blur(4px);
}

.dialog-body {
  padding: 24px 26px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.dialog-body h2 {
  margin: 0;
  font-size: 19px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

.app-shell {
  display: grid;
  grid-template-columns: 256px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--bg-1);
  border-right: 1px solid var(--border);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 6px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: linear-gradient(135deg, #0284c7, #38bdf8);
  color: #020617;
  font-weight: 900;
  font-size: 15px;
  display: grid;
  place-items: center;
  letter-spacing: -0.03em;
}

.brand-kicker {
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--accent-hi);
  font-weight: 700;
}

.brand-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-btn {
  appearance: none;
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  text-align: left;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.14s ease;
}

.nav-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
}

.nav-btn.active {
  color: var(--text);
  background: rgba(14, 165, 233, 0.12);
  border-color: rgba(56, 189, 248, 0.28);
}

.nav-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: currentColor;
}

.badge {
  margin-left: auto;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text);
}

.sidebar-links {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 12px 8px;
  border-top: 1px solid var(--border);
}

.sidebar-section-label {
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 2px;
}

.sidebar-links a {
  color: #cbd5e1;
  text-decoration: none;
  font-size: 13px;
}

.sidebar-links a:hover {
  color: var(--accent-hi);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.status-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 999px;
}

.status-pill.unlocked {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.status-pill.locked {
  background: rgba(245, 158, 11, 0.16);
  color: #fbbf24;
}

.workspace {
  padding: 24px 30px 60px;
  max-width: 1440px;
  width: 100%;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 22px;
}

.topbar h1 {
  margin: 0 0 4px;
  font-size: 24px;
  letter-spacing: -0.02em;
}

.topbar-actions {
  display: flex;
  gap: 10px;
}

.muted {
  color: var(--muted);
  margin: 0;
}

.alert-banner {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.kpi-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}

.kpi-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.kpi-value {
  font-size: 32px;
  font-weight: 800;
  margin: 6px 0 4px;
  letter-spacing: -0.03em;
}

.kpi-sub {
  font-size: 12.5px;
  color: var(--accent-hi);
}

.two-col {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 18px;
  margin-bottom: 20px;
}

.studio-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 18px;
  align-items: start;
}

.panel-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 18px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-head h2 {
  margin: 0;
  font-size: 16px;
}

.breakdown-list, .provider-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.breakdown-row, .provider-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
  align-items: center;
}

.search-input {
  flex: 1 1 280px;
}

.select-sm {
  width: auto;
  min-width: 170px;
}

.input {
  width: 100%;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-hi);
  background: var(--bg-0);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
}

.input:focus {
  outline: 2px solid var(--accent);
  border-color: transparent;
}

.input:user-invalid {
  border-color: var(--danger);
}

.textarea-lg {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field label {
  font-size: 12px;
  font-weight: 600;
  color: #cbd5e1;
}

.field-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field-row-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.inline-brand-select {
  display: flex;
  gap: 6px;
}

.form-actions, .blast-action-bar, .btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 9px 15px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: opacity 0.14s ease, transform 0.1s ease;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-sm {
  padding: 6px 11px;
  font-size: 12.5px;
}

.btn-primary {
  background: var(--accent);
  color: #020617;
  font-weight: 700;
}

.btn-secondary {
  background: var(--bg-2);
  border-color: var(--border-hi);
  color: var(--text);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--muted);
}

.btn-ghost:hover {
  color: var(--text);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  font-weight: 700;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th, td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--muted);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent-hi);
}

.tag.tier-1 {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.tag.tier-2 {
  background: rgba(14, 165, 233, 0.14);
  color: #38bdf8;
}

.tag.tier-3 {
  background: rgba(148, 163, 184, 0.15);
  color: #cbd5e1;
}

.preview-iframe {
  width: 100%;
  height: 700px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f1f5f9;
}

.radio-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.radio-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 13px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}

.radio-card strong {
  display: block;
  font-size: 13.5px;
  color: var(--text);
}

.radio-card span {
  font-size: 12px;
  color: var(--muted);
}

.beat-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px;
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.beat-pills label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--bg-2);
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
}

.console-box {
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  min-height: 320px;
  color: #cbd5e1;
}

.hint-text {
  font-size: 12px;
  color: var(--muted);
  margin: 12px 0 0;
}

.toast {
  position: fixed;
  bottom: 22px;
  right: 22px;
  background: #0f172a;
  border: 1px solid var(--accent);
  color: var(--text);
  padding: 11px 16px;
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
  font-weight: 600;
  z-index: 50;
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: static;
    height: auto;
  }
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .two-col, .studio-grid {
    grid-template-columns: 1fr;
  }
}
