:root {
  --bg: #05070d;
  --bg-2: #0a1020;
  --surface: rgba(13, 19, 34, 0.94);
  --surface-2: rgba(20, 27, 46, 0.95);
  --border: rgba(255, 255, 255, 0.12);
  --text: #f5f8ff;
  --muted: #93a1bb;
  --accent: #67a7ff;
  --accent-2: #7c4dff;
  --accent-3: #26d0ce;
  --success: #39d98a;
  --warning: #ffb84d;
  --danger: #ff5d5d;
  --shadow: 0 18px 44px rgba(0,0,0,0.28);
  --radius-lg: 24px;
  --radius-md: 14px;
  --sidebar-width: 280px;
  --navbar-height: 76px;
  --transition-fast: 180ms ease;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body {
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(103,167,255,0.32), transparent 28%),
    radial-gradient(circle at 100% 0%, rgba(124,77,255,0.28), transparent 24%),
    radial-gradient(circle at 50% 100%, rgba(38,208,206,0.16), transparent 22%),
    linear-gradient(135deg, var(--bg), var(--bg-2));
  color: var(--text);
  line-height: 1.5;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0.72), transparent 90%);
  opacity: 0.45;
}

body::after {
  content: "";
  position: fixed;
  inset: auto auto -140px -120px;
  width: 360px;
  height: 360px;
  background: radial-gradient(circle, rgba(103,167,255,0.2), transparent 70%);
  filter: blur(30px);
  pointer-events: none;
}

button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
}

.sidebar {
  padding: 20px 16px;
  border-right: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(7, 11, 22, 0.94), rgba(8, 12, 24, 0.86));
  backdrop-filter: blur(18px);
  position: relative;
}

.sidebar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(103,167,255,0.08), transparent 42%);
  pointer-events: none;
}

.main-area { display: flex; flex-direction: column; min-width: 0; }
.navbar {
  min-height: var(--navbar-height);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: rgba(5, 8, 16, 0.82);
  backdrop-filter: blur(20px);
  position: sticky;
  top: 0;
  z-index: 5;
}
.content { padding: 24px; display: grid; gap: 18px; }
.grid-2 { display: grid; gap: 18px; grid-template-columns: 1.1fr 0.9fr; }
.grid-3 { display: grid; gap: 18px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { display: grid; gap: 18px; grid-template-columns: repeat(4, minmax(0, 1fr)); }

.brand {
  display: flex; align-items: center; gap: 12px;
  padding: 12px;
  margin-bottom: 20px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(103,167,255,0.2), rgba(124,77,255,0.16));
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
}
.brand-mark {
  width: 46px; height: 46px; display: grid; place-items: center;
  border-radius: 14px; background: linear-gradient(135deg, var(--accent), var(--accent-2));
  font-weight: 800; letter-spacing: 0.02em;
  box-shadow: 0 10px 25px rgba(103,167,255,0.24);
}
.brand h1 { margin: 0; font-size: 1rem; }
.brand p { margin: 2px 0 0; color: var(--muted); font-size: 0.84rem; }

.nav-list { display: grid; gap: 8px; }
.nav-item {
  width: 100%; border: 1px solid transparent; background: transparent; color: var(--text);
  padding: 11px 13px; border-radius: 12px; text-align: left; display: flex; align-items: center; gap: 10px;
  transition: transform var(--transition-fast), background var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.nav-item:hover, .nav-item.active {
  background: linear-gradient(90deg, rgba(103,167,255,0.18), rgba(124,77,255,0.12));
  border-color: rgba(103,167,255,0.35);
  transform: translateX(2px);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
}
.nav-icon { width: 17px; height: 17px; flex-shrink: 0; color: var(--muted); }
.nav-item:hover .nav-icon, .nav-item.active .nav-icon { color: var(--text); }

.eyebrow {
  margin: 0 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.24em;
  font-size: 0.74rem;
  color: var(--accent);
}
.topbar-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.pill, .user-chip {
  padding: 9px 12px; border-radius: 999px; background: rgba(255,255,255,0.05); border: 1px solid var(--border); color: var(--muted);
}

.hero-card, .card {
  background: linear-gradient(180deg, var(--surface), rgba(255,255,255,0.02));
  border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 18px;
}
.hero-card {
  background: linear-gradient(135deg, rgba(103,167,255,0.2), rgba(124,77,255,0.16) 55%, rgba(38,208,206,0.14));
  padding: 24px; position: relative; overflow: hidden;
}
.hero-card::before {
  content: "";
  position: absolute; right: -32px; bottom: -42px; width: 220px; height: 220px;
  background: radial-gradient(circle, rgba(255,255,255,0.26), transparent 64%);
  pointer-events: none;
}
.hero-card h3 { margin: 0 0 8px; font-size: 1.45rem; }
.hero-card p { margin: 0; color: var(--muted); max-width: 740px; }

.media-hero {
  background: linear-gradient(135deg, rgba(103,167,255,0.16), rgba(124,77,255,0.12) 55%, rgba(38,208,206,0.12));
  padding: 20px 22px 18px;
}
.media-hero h3 {
  margin: 6px 0 0;
  font-size: clamp(1.3rem, 2vw, 2rem);
  max-width: 760px;
}
.media-hero-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 20px;
}
.media-quick {
  padding: 12px 14px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  background: rgba(255,255,255,0.04);
  color: var(--text);
  text-align: left;
  font-weight: 600;
  transition: transform var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
}
.media-quick:hover {
  transform: translateY(-2px);
  border-color: rgba(103,167,255,0.45);
  background: rgba(103,167,255,0.08);
}

.hero-meta {
  display: flex; flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}
.metric-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 999px;
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.12);
  color: var(--text);
  font-size: 0.88rem;
}
.dot {
  width: 8px; height: 8px; border-radius: 50%; display: inline-block;
}
.dot.blue { background: var(--accent); }
.dot.purple { background: var(--accent-2); }
.dot.teal { background: var(--accent-3); }

.hero-progress {
  display: grid; gap: 10px; margin-top: 16px;
  max-width: 560px;
}
.progress-item { display: grid; gap: 6px; }
.progress-label {
  display: flex; justify-content: space-between; font-size: 0.9rem; color: var(--text);
}
.progress-track {
  height: 8px; border-radius: 999px; background: rgba(255,255,255,0.16); overflow: hidden;
}
.progress-track span {
  display: block; height: 100%; border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-3));
}

.stats-grid { display: grid; gap: 14px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.panel-grid { display: grid; gap: 18px; grid-template-columns: 1.2fr 0.8fr; }
.stat-card {
  background: linear-gradient(180deg, var(--surface-2), rgba(255,255,255,0.02));
  border: 1px solid var(--border); border-radius: 18px; padding: 16px; min-height: 110px; box-shadow: var(--shadow);
  position: relative; overflow: hidden;
}
.stat-card::before {
  content: "";
  position: absolute; inset: 0 auto auto 0; width: 100%; height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}
.stat-card .label { color: var(--muted); font-size: 0.84rem; }
.stat-card .value { margin-top: 8px; font-size: 1.4rem; font-weight: 700; }

.card h4 {
  margin: 0 0 12px;
  font-size: 1.05rem;
}

.list { display: grid; gap: 10px; }
.list-item {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 12px 13px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.035);
}
.badge {
  display: inline-flex; align-items: center; padding: 6px 10px; border-radius: 999px;
  background: rgba(103,167,255,0.14); color: var(--accent); font-size: 0.8rem; white-space: nowrap;
}
.badge.good { background: rgba(57,217,138,0.16); color: var(--success); }
.badge.warn { background: rgba(255,184,77,0.16); color: var(--warning); }

.metric-row-toggle {
  width: 100%; text-align: left; font: inherit; color: var(--text); cursor: pointer;
}
.metric-row-toggle::after {
  content: '▾'; margin-left: 8px; color: var(--muted); font-size: 0.75rem; display: inline-block; transition: transform 0.15s ease;
}
.metric-row[aria-expanded="true"] .metric-row-toggle::after { transform: rotate(180deg); }
.metric-row-toggle:hover { border-color: var(--accent); }
.metric-detail {
  margin-top: 6px; padding: 10px 13px; border-radius: 12px; border: 1px dashed var(--border);
  background: rgba(255,255,255,0.02); font-size: 0.82rem; color: var(--muted); display: grid; gap: 6px;
}
.metric-detail .metric-formula { color: var(--text); font-weight: 600; }
.metric-evidence { display: flex; flex-wrap: wrap; gap: 6px; }
.metric-evidence span {
  display: inline-block; background: rgba(103,167,255,0.14); color: var(--accent);
  border-radius: 999px; padding: 2px 8px; font-size: 0.75rem;
}

.u-flex-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

.empty-state {
  padding: 22px 14px;
  text-align: center;
  color: var(--muted);
  font-size: 0.92rem;
  border: 1px dashed rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.02);
}

.project-card { margin-bottom: 0; transition: border-color var(--transition-fast), transform var(--transition-fast); }
.project-card:hover { border-color: rgba(103, 167, 255, 0.35); transform: translateY(-1px); }
.project-title { margin: 0; }
.project-synopsis { color: var(--muted); font-size: 0.9rem; }
.project-meta { display: flex; flex-wrap: wrap; gap: 8px; }
.project-actions { display: flex; gap: 8px; }

.form-grid { display: grid; gap: 12px; }
input, textarea, select {
  width: 100%; border: 1px solid var(--border); border-radius: var(--radius-md);
  background: rgba(255,255,255,0.04); color: var(--text); padding: 12px 13px; outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
input:focus, textarea:focus, select:focus {
  border-color: rgba(103,167,255,0.6); box-shadow: 0 0 0 3px rgba(103,167,255,0.12);
}
textarea { min-height: 118px; resize: vertical; }
.btn {
  border: 0; padding: 10px 14px; border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: white; font-weight: 700;
  box-shadow: 0 8px 22px rgba(103,167,255,0.24); transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 12px 26px rgba(103,167,255,0.28); }
.btn.secondary { background: rgba(255,255,255,0.06); color: var(--text); box-shadow: none; }
.btn-sm { padding: 6px 10px; font-size: 0.82rem; border-radius: 8px; }
.btn-sm.danger { background: rgba(255,93,93,0.14); color: var(--danger); box-shadow: none; }
.btn-sm.danger:hover { background: rgba(255,93,93,0.24); }
.chip-list { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 8px 10px; border-radius: 999px; background: rgba(255,255,255,0.05); border: 1px solid var(--border); }
.switch-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: rgba(255,255,255,0.04); border: 1px solid var(--border); }
.switch-row input { width: auto; }
.chat-composer {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
}
.chat-header {
  font-size: 0.9rem;
  color: var(--muted);
}
.chat-composer textarea {
  min-height: 180px;
  border-radius: 12px;
  background: rgba(5, 8, 16, 0.72);
}
.view-panel { display: none; }
.view-panel.active { display: block; animation: fadeUp 260ms ease both; }
.u-muted { color: var(--muted); }
.u-mt-2 { margin-top: 12px; }
.u-mt-3 { margin-top: 16px; }

@keyframes fadeUp { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--border); }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .navbar { padding: 0 16px; }
  .content { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .panel-grid { grid-template-columns: 1fr; }
  .topbar-actions { width: 100%; justify-content: flex-end; }
}

/* ---------- Toast Notifications ---------- */
.toast-container {
  position: fixed;
  /* Was top:18px — the navbar is position:sticky at the same corner (z-index
     5 vs toast's 2000), so the first toast always landed directly over the
     topbar search/AI-copilot controls, clipping them. Clear the navbar. */
  top: calc(var(--navbar-height) + 12px);
  right: 18px;
  z-index: 2000;
  display: grid;
  gap: 10px;
  max-width: min(380px, calc(100vw - 36px));
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(13, 19, 34, 0.97), rgba(8, 12, 24, 0.97));
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.38);
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.4;
  opacity: 0;
  transform: translateX(24px);
  transition: opacity 220ms ease, transform 220ms ease;
  pointer-events: auto;
}
.toast-visible {
  opacity: 1;
  transform: translateX(0);
}
.toast-hiding {
  opacity: 0;
  transform: translateX(24px);
}
.toast-icon { font-size: 1.2rem; flex-shrink: 0; }
.toast-message { flex: 1; min-width: 0; }
.toast-close {
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 1.25rem;
  line-height: 1;
  padding: 4px 6px;
  cursor: pointer;
  transition: color var(--transition-fast);
}
.toast-close:hover { color: var(--text); }
.toast-success { border-left: 3px solid var(--success); }
.toast-error { border-left: 3px solid var(--danger); }
.toast-warning { border-left: 3px solid var(--warning); }
.toast-info { border-left: 3px solid var(--accent); }
.toast-ai { border-left: 3px solid var(--accent-2); }

/* ---------- AI Studio Assistant ---------- */
.assistant-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1900;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.6rem;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 12px 32px rgba(124, 77, 255, 0.4);
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
.assistant-fab:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 16px 40px rgba(124, 77, 255, 0.5);
}
.assistant-panel {
  position: fixed;
  bottom: 96px;
  right: 24px;
  z-index: 1900;
  width: min(400px, calc(100vw - 48px));
  max-height: 64vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--surface), rgba(8, 12, 24, 0.98));
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transform: translateY(16px) scale(0.97);
  transform-origin: bottom right;
  pointer-events: none;
  transition: opacity 240ms ease, transform 240ms ease;
}
.assistant-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.assistant-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.assistant-title {
  display: flex;
  align-items: center;
  gap: 10px;
}
.assistant-avatar {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  font-size: 1.2rem;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(124, 77, 255, 0.35), rgba(103, 167, 255, 0.3));
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.assistant-title strong { display: block; font-size: 0.96rem; }
.assistant-title small { color: var(--muted); font-size: 0.78rem; }
.assistant-close {
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 1.4rem;
  line-height: 1;
  padding: 4px 8px;
  cursor: pointer;
  transition: color var(--transition-fast);
}
.assistant-close:hover { color: var(--text); }
.assistant-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  display: grid;
  gap: 10px;
  max-height: 40vh;
}
.assistant-message {
  display: flex;
}
.assistant-bot {
  justify-content: flex-start;
}
.assistant-user {
  justify-content: flex-end;
}
.assistant-user .assistant-bubble {
  background: linear-gradient(135deg, rgba(103, 167, 255, 0.35), rgba(124, 77, 255, 0.28));
  border: 1px solid rgba(103, 167, 255, 0.3);
  border-bottom-right-radius: 6px;
}
.assistant-bubble {
  max-width: 88%;
  padding: 11px 13px;
  border-radius: 14px;
  border-bottom-left-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.88rem;
  line-height: 1.5;
  word-break: break-word;
}
.assistant-meta {
  margin-top: 7px;
  padding-top: 7px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.78rem;
  color: var(--muted);
}
.assistant-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
}
.assistant-quick-btn {
  border: 1px solid rgba(103, 167, 255, 0.4);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.8rem;
  background: rgba(103, 167, 255, 0.12);
  color: var(--accent);
  cursor: pointer;
  transition: background var(--transition-fast), transform var(--transition-fast);
}
.assistant-quick-btn:hover {
  background: rgba(103, 167, 255, 0.25);
  transform: translateY(-1px);
}
.assistant-composer {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}
.assistant-composer input {
  flex: 1;
  padding: 10px 12px;
  border-radius: 999px;
  font-size: 0.9rem;
}
.assistant-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(103, 167, 255, 0.32);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
.assistant-send:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(103, 167, 255, 0.4);
}

/* ---------- Command Palette (Ctrl+K) ---------- */
.palette-overlay {
  position: fixed;
  inset: 0;
  z-index: 2100;
  background: rgba(2, 4, 10, 0.66);
  backdrop-filter: blur(6px);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 12vh 18px 18px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}
.palette-open {
  opacity: 1;
  pointer-events: auto;
}
.palette-panel {
  width: min(620px, 100%);
  background: linear-gradient(180deg, var(--surface), rgba(8, 12, 24, 0.98));
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}
.palette-search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--border);
}
.palette-search-icon { font-size: 1.1rem; opacity: 0.8; }
.palette-search input {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 6px 0;
  font-size: 1rem;
  color: var(--text);
  outline: none;
}
.palette-search kbd {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  padding: 3px 7px;
  font-size: 0.72rem;
  color: var(--muted);
}
.palette-results {
  max-height: 46vh;
  overflow-y: auto;
  padding: 8px;
  display: grid;
  gap: 2px;
}
.palette-result {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  padding: 10px 12px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}
.palette-result:hover, .palette-result.active {
  background: rgba(103, 167, 255, 0.12);
  border-color: rgba(103, 167, 255, 0.3);
}
.palette-result-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}
.palette-result-body {
  flex: 1;
  min-width: 0;
}
.palette-result-body strong {
  display: block;
  font-size: 0.93rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.palette-result-body mark {
  background: rgba(255, 184, 77, 0.35);
  color: var(--warning);
  border-radius: 3px;
}
.palette-result-body small {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.palette-result-badge {
  flex-shrink: 0;
  font-size: 0.7rem;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(103, 167, 255, 0.14);
  color: var(--accent);
}
.palette-empty {
  padding: 22px;
  text-align: center;
  color: var(--muted);
  font-size: 0.92rem;
}

@media (max-width: 720px) {
  .assistant-panel {
    left: 12px;
    right: 12px;
    width: auto;
    max-height: 70vh;
  }
  .assistant-body { max-height: 44vh; }
  .toast-container { left: 12px; right: 12px; max-width: none; }
  .palette-overlay { padding-top: 8vh; }
}

/* ---------- Act Structuring ---------- */
.act-file-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px dashed rgba(103, 167, 255, 0.5);
  background: rgba(103, 167, 255, 0.08);
  color: var(--accent);
  cursor: pointer;
  font-size: 0.9rem;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}
.act-file-label:hover {
  border-color: rgba(103, 167, 255, 0.85);
  background: rgba(103, 167, 255, 0.14);
}
.act-file-label input[type="file"] {
  display: none;
}
.act-pdf-name {
  min-height: 18px;
  font-size: 0.84rem;
  color: var(--muted);
  text-align: center;
}

.storyboard-input-row { display: flex; gap: 8px; align-items: flex-start; }
.storyboard-input-row textarea { flex: 1; }
.btn-icon {
  flex-shrink: 0; width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--border);
  background: rgba(255,255,255,0.04); color: var(--text); font-size: 1.1rem; cursor: pointer;
}
.btn-icon:hover { border-color: var(--accent); }
.btn-icon:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-icon.is-recording { background: rgba(255,93,93,0.18); border-color: var(--danger); animation: pulse-record 1.2s ease-in-out infinite; }
@keyframes pulse-record { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }
.chip-remove {
  border: none; background: none; color: inherit; cursor: pointer; font-size: 0.9rem; margin-left: 4px; padding: 0 2px; opacity: 0.7;
}
.chip-remove:hover { opacity: 1; }

.act-status {
  min-height: 20px;
  margin-top: 10px;
  font-size: 0.86rem;
  color: var(--muted);
}
.act-status-info { color: var(--accent); }
.act-status-success { color: var(--success); }
.act-status-error { color: var(--danger); }

.act-summary {
  padding: 14px 16px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(103, 167, 255, 0.16), rgba(124, 77, 255, 0.12));
  border: 1px solid rgba(103, 167, 255, 0.3);
  font-size: 0.95rem;
  line-height: 1.5;
}
.act-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.act-score-wrap {
  margin-top: 14px;
  display: grid;
  gap: 8px;
}
.act-score-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.9rem;
}
.act-acts {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}
.act-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: linear-gradient(180deg, var(--surface-2), rgba(255, 255, 255, 0.02));
  padding: 16px;
}
.act-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.act-range {
  font-size: 0.78rem;
  color: var(--accent);
  background: rgba(103, 167, 255, 0.14);
  padding: 4px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.act-goal {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}
.act-beats {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}
.act-beat {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
  padding: 11px 12px;
}
.act-beat-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.act-beat-note {
  margin-top: 6px;
  font-size: 0.84rem;
  color: var(--muted);
  line-height: 1.4;
}
.act-recs {
  margin-top: 16px;
}
.act-recs h4 {
  margin: 0 0 12px;
}
.act-recs-header {
  display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap;
}
.act-recs-header h4 { margin: 0; }
.bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  overflow: hidden;
}
.bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-3));
}

/* ============================================================
   Scene Builder (scenegen view)
   ============================================================ */
.scenegen-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 20px;
  align-items: start;
}
@media (max-width: 900px) {
  .scenegen-layout { grid-template-columns: 1fr; }
}
.scenegen-config { padding: 20px; }
.scenegen-right  { display: flex; flex-direction: column; }

/* shot list */
.sb-shot-list { display: flex; flex-direction: column; gap: 8px; }
.sb-empty { color: var(--text-muted); font-size: 0.82rem; padding: 12px 0; }
.sb-shot-item {
  display: flex; gap: 8px; align-items: flex-start;
  background: var(--surface-2); border-radius: 8px; padding: 8px 10px;
}
.sb-shot-num {
  min-width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 0.72rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center; margin-top: 2px; flex-shrink: 0;
}
.sb-shot-body { flex: 1; min-width: 0; }
.sb-shot-prompt {
  width: 100%; background: var(--surface-1); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px;
  font-size: 0.8rem; resize: vertical; font-family: inherit;
}
.sb-shot-meta { font-size: 0.72rem; color: var(--text-muted); margin-top: 4px; display: flex; gap: 10px; }
.sb-shot-actions { display: flex; flex-direction: column; gap: 4px; flex-shrink: 0; }
.sb-btn-icon {
  background: none; border: 1px solid var(--border); border-radius: 4px;
  color: var(--text-muted); cursor: pointer; padding: 2px 6px; font-size: 0.7rem;
  transition: background .15s;
}
.sb-btn-icon:hover { background: var(--surface-3); color: var(--text-primary); }
.sb-btn-icon.sb-del:hover { background: rgba(239,68,68,.15); color: #ef4444; border-color: #ef4444; }

/* progress */
.sb-progress-wrap { margin-top: 10px; }
.sb-progress-bar-track {
  width: 100%; height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden;
}
.sb-progress-bar {
  height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-3));
  border-radius: inherit; transition: width .4s ease;
}
.sb-status-log {
  margin-top: 10px; max-height: 160px; overflow-y: auto;
  font-size: 0.75rem; color: var(--text-muted); font-family: monospace;
}
.sb-log-line { padding: 2px 0; }
.sb-log-error { color: #f87171; }
