/* ================================================================
   Makeup Studio AI — design palette: cream / soft pink / deep plum
   Theo ảnh tham chiếu (reference image)
================================================================ */

:root {
  --bg: #FAF5F0;
  --bg-cream: #FAF5F0;
  --bg-soft-pink: #FDF2F0;
  --bg-hero: linear-gradient(135deg, #FDF2F0 0%, #F7E8E4 100%);
  --card: #FFFFFF;
  --card-soft: #FDF9F5;
  --sidebar-bg: #F3E5DE;
  --sidebar-text: #5E3047;

  --text: #4A1E34;
  --text-strong: #3A152A;
  --text-soft: #7B4D62;
  --text-muted: #A28394;

  --primary: #9C3B5E;
  --primary-hover: #7E2B4A;
  --primary-soft: #EFC9D3;

  --accent-pink: #E8A6B6;
  --bubble-ai: #FADDE4;
  --bubble-user: #E8A6B6;

  --border: #EFD6D9;
  --border-soft: #F5E4E7;
  --divider: #F0DDDF;

  --success: #2E8B57;
  --warning: #D98E2F;
  --danger: #C14B6B;

  --sidebar-width: 240px;
  --shadow-sm: 0 1px 2px rgba(74, 30, 52, 0.06);
  --shadow-md: 0 4px 16px rgba(74, 30, 52, 0.08);
  --shadow-lg: 0 10px 32px rgba(74, 30, 52, 0.12);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: "Be Vietnam Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
button, input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
input, textarea { outline: none; }
a { text-decoration: none; color: inherit; }
.hidden { display: none !important; }

/* ==================== LOGIN OVERLAY ==================== */
.login-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: var(--bg-hero);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.login-overlay::before {
  content: ""; position: absolute; top: -20%; right: -10%;
  width: 60%; height: 80%;
  background: radial-gradient(circle, rgba(232, 166, 182, 0.2) 0%, transparent 60%);
  pointer-events: none;
}
.login-overlay::after {
  content: ""; position: absolute; bottom: -20%; left: -10%;
  width: 60%; height: 80%;
  background: radial-gradient(circle, rgba(156, 59, 94, 0.08) 0%, transparent 60%);
  pointer-events: none;
}
.login-card {
  background: var(--card);
  border-radius: var(--radius-xl);
  padding: 36px 32px 30px;
  width: 100%; max-width: 400px;
  box-shadow: var(--shadow-lg);
  position: relative; z-index: 1;
}
.login-logo {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  margin-bottom: 24px;
}
.logo-mark {
  width: 44px; height: 44px; border-radius: 12px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(156, 59, 94, 0.3);
}
.logo-mark svg { width: 28px; height: 28px; }
.brand-text { line-height: 1.1; }
.brand-main { font-family: "Playfair Display", serif; font-size: 20px; font-weight: 700; color: var(--text); }
.brand-tag {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  font-size: 10px; font-weight: 700;
  padding: 2px 7px; border-radius: 4px;
  letter-spacing: 1px;
  margin-top: 2px;
}
.login-card h2 {
  font-family: "Playfair Display", serif;
  font-size: 24px; color: var(--text-strong);
  text-align: center; margin-bottom: 4px; font-weight: 600;
}
.login-sub {
  text-align: center; color: var(--text-soft); font-size: 13px;
  margin-bottom: 22px;
}
.login-err {
  background: #FADEE4; color: var(--danger);
  padding: 10px 12px; border-radius: 8px;
  font-size: 13px; margin-bottom: 14px; text-align: center;
  border-left: 3px solid var(--danger);
  display: none;
}
.login-err.show { display: block; }
.login-card label {
  display: block; font-size: 12.5px; font-weight: 600;
  color: var(--text-soft); margin-bottom: 6px; letter-spacing: 0.2px;
}
.login-card input {
  width: 100%; padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--card-soft);
  font-size: 15px; color: var(--text);
  margin-bottom: 14px;
  transition: border-color 0.15s, background 0.15s;
}
.login-card input:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(156, 59, 94, 0.08);
}
.login-card button[type=submit] {
  width: 100%; padding: 13px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
  color: #fff; border-radius: 10px;
  font-weight: 700; font-size: 15px; letter-spacing: 0.3px;
  margin-top: 6px;
  transition: transform 0.1s, box-shadow 0.2s;
}
.login-card button[type=submit]:hover {
  box-shadow: 0 6px 18px rgba(156, 59, 94, 0.35);
  transform: translateY(-1px);
}
.login-card button[type=submit]:active { transform: translateY(0); }

/* ==================== APP SHELL ==================== */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  height: 100vh;
  width: 100vw;
}

/* ==================== SIDEBAR ==================== */
.sidebar {
  background: var(--sidebar-bg);
  padding: 20px 0 16px;
  display: flex; flex-direction: column;
  border-right: 1px solid var(--border);
  position: relative;
  z-index: 50;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 10px;
  padding: 0 20px 24px;
}
.sidebar .logo-mark {
  width: 40px; height: 40px;
  border-radius: 10px;
}
.sidebar .logo-mark svg { width: 24px; height: 24px; }
.sidebar .brand-main { font-size: 17px; color: var(--text-strong); }
.sidebar .brand-tag { font-size: 9px; padding: 1px 6px; }

.nav {
  display: flex; flex-direction: column;
  gap: 2px;
  padding: 0 12px;
  flex: 1;
}
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px;
  border-radius: 10px;
  color: var(--sidebar-text);
  font-size: 14px; font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.nav a:hover { background: rgba(255, 255, 255, 0.5); }
.nav a.active {
  background: #fff;
  color: var(--primary);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(74, 30, 52, 0.06);
}
.nav a svg { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.85; }
.nav a.active svg { opacity: 1; }

.sidebar-foot {
  padding: 12px;
  position: relative;
}
.workspace {
  background: #fff;
  border-radius: 12px;
  padding: 10px 12px;
  display: flex; align-items: center; gap: 10px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}
.ws-avatars {
  display: flex;
  flex-shrink: 0;
}
.ws-avatars span {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--primary-soft);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
  border: 2px solid #fff;
  margin-left: -8px;
}
.ws-avatars span:first-child { margin-left: 0; }
.ws-info { flex: 1; min-width: 0; line-height: 1.2; }
.ws-label { font-size: 11.5px; color: var(--text-muted); }
.ws-title { font-size: 13px; font-weight: 600; color: var(--text); }
.ws-menu {
  color: var(--text-muted); font-size: 14px; padding: 4px;
}
.ws-popup {
  position: absolute;
  left: 12px; right: 12px; bottom: 72px;
  background: #fff;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 100;
  border: 1px solid var(--border-soft);
}
.ws-popup-user {
  padding: 10px 12px 8px;
  font-size: 12px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 4px;
}
.ws-popup button {
  display: block; width: 100%; text-align: left;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  color: var(--text);
}
.ws-popup button:hover { background: var(--bg-soft-pink); }

/* ==================== MAIN AREA ==================== */
.main {
  display: flex; flex-direction: column;
  min-width: 0;
  background: var(--bg);
  overflow: hidden;
}

/* ==================== TOPBAR ==================== */
.topbar {
  flex-shrink: 0;
  padding: 20px 28px 16px;
  display: flex; align-items: center; gap: 16px;
  background: var(--bg-hero);
  border-bottom: 1px solid var(--border-soft);
  position: relative;
}
.topbar::after {
  content: "";
  position: absolute; right: 180px; top: 0; bottom: 0; width: 260px;
  background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 100"><g opacity="0.55"><circle cx="40" cy="30" r="18" fill="%23F5C8D0"/><circle cx="35" cy="35" r="12" fill="%23F8DDE3"/><rect x="100" y="15" width="18" height="60" rx="3" fill="%23E8C4A8"/><rect x="125" y="20" width="18" height="55" rx="3" fill="%23D4A88A"/><circle cx="165" cy="45" r="25" fill="%23F3D9CF"/><circle cx="165" cy="45" r="16" fill="%23E8BBAB"/></g></svg>') no-repeat center / contain;
  pointer-events: none;
  opacity: 0.6;
}
.menu-toggle { display: none; font-size: 22px; padding: 6px 10px; color: var(--text); }
.page-title { flex: 1; min-width: 0; z-index: 1; }
.page-title h1 {
  font-family: "Playfair Display", serif;
  font-size: 28px; font-weight: 700;
  color: var(--text-strong);
  line-height: 1.2;
}
.page-title p {
  color: var(--text-soft);
  font-size: 13.5px;
  margin-top: 2px;
}
.page-title h1::after {
  content: "";
  display: block;
  width: 56px; height: 3px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--accent-pink) 100%);
  border-radius: 2px;
  margin-top: 6px;
}
.topbar-right {
  display: flex; align-items: center; gap: 10px;
  z-index: 1;
}
.demo-chip {
  background: rgba(255, 255, 255, 0.8);
  color: var(--text-soft);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  border: 1px solid var(--border-soft);
}
.btn-primary {
  background: var(--primary);
  color: #fff;
  padding: 10px 18px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background 0.15s, transform 0.1s, box-shadow 0.2s;
}
.btn-primary:hover { background: var(--primary-hover); box-shadow: 0 4px 12px rgba(156,59,94,0.25); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary .plus { font-size: 18px; font-weight: 700; line-height: 1; margin-top: -1px; }

/* ==================== ROUTE CONTAINER ==================== */
.route {
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

/* ============================================================
   CHAT PAGE
============================================================ */
.chat-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 20px;
  padding: 20px 28px 20px;
  height: 100%;
  overflow: hidden;
}
.chat-left {
  display: flex; flex-direction: column;
  background: var(--card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-soft);
  min-width: 0;
}
.chat-right {
  display: flex; flex-direction: column;
  overflow-y: auto;
  padding-right: 4px;
}

/* Preset row */
.preset-row {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--bg-soft-pink);
}
.preset-chip {
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text-soft);
  padding: 8px 14px;
  border-radius: 24px;
  font-size: 13px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 6px;
  transition: all 0.15s;
}
.preset-chip:hover { border-color: var(--primary-soft); color: var(--primary); }
.preset-chip.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.preset-chip svg { width: 14px; height: 14px; }

/* Chat scroll */
.chat-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px 10px;
  display: flex; flex-direction: column; gap: 14px;
  -webkit-overflow-scrolling: touch;
}
.msg {
  display: flex; align-items: flex-start; gap: 10px;
  max-width: 85%;
  animation: fadeInUp 0.3s ease-out;
}
.msg.ai { align-self: flex-start; }
.msg.user { align-self: flex-end; flex-direction: row-reverse; }
.msg-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 14px;
  box-shadow: var(--shadow-sm);
}
.msg.ai .msg-avatar { background: #fff; border: 1.5px solid var(--primary-soft); }
.msg.ai .msg-avatar svg { width: 16px; height: 16px; }
.msg.user .msg-avatar {
  background: var(--primary);
  color: #fff;
  font-size: 12px; font-weight: 700;
}
.msg-content {
  display: flex; flex-direction: column; gap: 6px;
  min-width: 0;
}
.msg-label {
  font-size: 11.5px;
  color: var(--text-soft);
  font-weight: 600;
  padding: 0 2px;
}
.msg.user .msg-label { text-align: right; }
.bubble {
  padding: 11px 15px;
  border-radius: 16px;
  font-size: 14.5px;
  line-height: 1.55;
  word-wrap: break-word;
  white-space: pre-wrap;
}
.msg.ai .bubble {
  background: var(--bubble-ai);
  color: var(--text);
  border-top-left-radius: 4px;
}
.msg.user .bubble {
  background: var(--bubble-user);
  color: #fff;
  border-top-right-radius: 4px;
}

/* Chip row (inside chat) */
.chip-row {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 0 44px;
  margin-top: -4px;
  animation: fadeInUp 0.3s ease-out;
}
.chip {
  background: #fff;
  border: 1.5px solid var(--primary-soft);
  color: var(--primary);
  padding: 7px 14px;
  border-radius: 20px;
  font-size: 13px; font-weight: 500;
  transition: all 0.15s;
}
.chip:hover { background: var(--bubble-ai); }
.chip:disabled { opacity: 0.5; cursor: default; }

/* Idea cards row (inside chat) */
.ideas-row {
  display: flex; flex-direction: column; gap: 8px;
  padding: 0 0 0 44px;
  margin-top: 4px;
  animation: fadeInUp 0.3s ease-out;
}
.idea-card {
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  display: flex; align-items: center; gap: 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
  cursor: default;
}
.idea-card:hover { border-color: var(--primary-soft); box-shadow: var(--shadow-sm); }
.idea-card.selected { border-color: var(--primary); background: var(--bg-soft-pink); }
.idea-num {
  width: 24px; height: 24px; border-radius: 6px;
  background: var(--primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
  flex-shrink: 0;
}
.idea-thumb {
  width: 56px; height: 56px; border-radius: 10px;
  background: var(--bubble-ai);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
  overflow: hidden;
}
.idea-body { flex: 1; min-width: 0; }
.idea-title {
  font-weight: 700; color: var(--text-strong); font-size: 14.5px;
  margin-bottom: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.idea-meta {
  font-size: 12.5px; color: var(--text-soft);
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.idea-meta span.sep { color: var(--text-muted); }
.idea-choose {
  background: var(--primary);
  color: #fff;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 12.5px; font-weight: 600;
  flex-shrink: 0;
  transition: background 0.15s;
}
.idea-choose:hover { background: var(--primary-hover); }
.idea-choose:disabled { background: var(--text-muted); cursor: default; }

/* Script card */
.script-card {
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  margin-left: 44px;
  overflow: hidden;
  animation: fadeInUp 0.35s ease-out;
}
.script-head {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
  color: #fff;
  padding: 12px 16px;
}
.script-head .ctitle { font-size: 15px; font-weight: 700; margin-bottom: 2px; }
.script-head .cmeta { font-size: 12px; opacity: 0.9; }
.script-section { padding: 12px 16px; border-top: 1px solid var(--border-soft); }
.script-section:first-of-type { border-top: 0; }
.script-label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.5px;
  color: var(--primary); text-transform: uppercase; margin-bottom: 5px;
  display: flex; align-items: center; gap: 5px;
}
.script-content {
  font-size: 13.5px; line-height: 1.6; color: var(--text);
  white-space: pre-wrap;
}
.scene-item {
  background: var(--bg-soft-pink);
  border-radius: 10px;
  padding: 10px 12px;
  margin-top: 8px;
}
.scene-item:first-child { margin-top: 0; }
.scene-item .scene-head {
  display: flex; align-items: center; gap: 8px; margin-bottom: 4px;
  font-size: 12.5px; font-weight: 700; color: var(--primary);
}
.scene-item .scene-head .scene-dur {
  background: #fff;
  color: var(--text-soft);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
}
.scene-item .scene-head .scene-cam {
  background: var(--primary-soft);
  color: var(--primary);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
}
.scene-item .scene-head .scene-opt {
  background: var(--warning);
  color: #fff;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
}
.scene-item .scene-row {
  font-size: 13px; line-height: 1.55;
  margin-top: 2px;
}
.scene-item .scene-row b { color: var(--text-strong); font-weight: 600; }
.hashtags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.hashtag {
  font-size: 12px; color: var(--primary); background: var(--bubble-ai);
  padding: 3px 9px; border-radius: 12px;
}
.script-actions {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1px;
  background: var(--border-soft);
}
.script-actions button {
  padding: 11px; background: #fff; color: var(--primary);
  font-size: 13px; font-weight: 600;
}
.script-actions button:hover { background: var(--bg-soft-pink); }

/* Typing */
.typing-bubble {
  background: var(--bubble-ai);
  padding: 12px 16px;
  border-radius: 16px;
  border-top-left-radius: 4px;
  display: inline-flex; align-items: center; gap: 4px;
}
.typing-bubble span {
  width: 6px; height: 6px; background: var(--primary); border-radius: 50%;
  animation: bounce 1.3s infinite ease-in-out both; opacity: 0.6;
}
.typing-bubble span:nth-child(1) { animation-delay: -0.32s; }
.typing-bubble span:nth-child(2) { animation-delay: -0.16s; }
@keyframes bounce { 0%,80%,100% { transform: scale(0.6); opacity:0.4 } 40% { transform: scale(1); opacity: 1 } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* Composer */
.composer {
  flex-shrink: 0;
  background: #fff;
  border-top: 1px solid var(--border-soft);
  padding: 12px 16px;
}
.composer-inner {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-soft-pink);
  border: 1.5px solid var(--border-soft);
  border-radius: 24px;
  padding: 4px 6px 4px 16px;
  transition: border-color 0.15s;
}
.composer-inner:focus-within { border-color: var(--primary-soft); background: #fff; }
.composer-inner input {
  flex: 1; min-width: 0;
  background: none; border: 0;
  padding: 10px 0;
  font-size: 14px;
  color: var(--text);
}
.composer-inner input::placeholder { color: var(--text-muted); }
.composer-btn {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-soft);
  transition: all 0.15s;
  flex-shrink: 0;
}
.composer-btn:hover { background: var(--bubble-ai); color: var(--primary); }
.composer-btn svg { width: 18px; height: 18px; }
.composer-btn.send {
  background: var(--primary);
  color: #fff;
}
.composer-btn.send:hover { background: var(--primary-hover); }
.composer-btn.send:disabled { opacity: 0.45; }
.composer-btn.mic.recording {
  background: var(--danger);
  color: #fff;
  animation: pulse 1.2s infinite;
}
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(193,75,107,0.5); } 50% { box-shadow: 0 0 0 10px rgba(193,75,107,0); } }
.composer-hint {
  font-size: 12px; color: var(--text-muted);
  padding: 6px 2px 0;
  display: flex; align-items: center; gap: 5px;
}

/* ============================================================
   RIGHT PROJECT PANEL
============================================================ */
.project-panel {
  background: var(--card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-soft);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--border-soft);
}
.panel-head h3 {
  font-family: "Playfair Display", serif;
  font-weight: 600;
  color: var(--text-strong);
  font-size: 17px;
}
.status-badge {
  background: #FDF3E7;
  color: var(--warning);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11.5px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 4px;
}
.status-badge.live { background: #E8F6EC; color: var(--success); }
.panel-body { padding: 16px 18px; }
.panel-project-title {
  font-weight: 700;
  color: var(--text-strong);
  font-size: 18px;
  margin-bottom: 14px;
  line-height: 1.3;
}

/* Progress steps */
.progress-steps {
  display: flex;
  justify-content: space-between;
  position: relative;
  padding: 0 4px;
  margin-bottom: 18px;
}
.progress-steps::before {
  content: ""; position: absolute;
  top: 10px; left: 14px; right: 14px; height: 2px;
  background: var(--border);
  z-index: 0;
}
.progress-step {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  position: relative; z-index: 1;
  flex: 1;
}
.progress-dot {
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff;
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; color: var(--text-muted);
}
.progress-step.active .progress-dot {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.progress-step.done .progress-dot {
  background: var(--primary);
  border-color: var(--primary);
}
.progress-step.done .progress-dot::after { content: "✓"; color: #fff; font-size: 11px; font-weight: 700; }
.progress-label {
  font-size: 10.5px;
  color: var(--text-soft);
  font-weight: 500;
}
.progress-step.active .progress-label,
.progress-step.done .progress-label { color: var(--text); font-weight: 600; }

/* Preview image */
.preview-img {
  width: 100%;
  aspect-ratio: 4/3;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--bubble-ai) 0%, var(--primary-soft) 100%);
  display: flex; align-items: center; justify-content: center;
  color: var(--primary);
  font-size: 40px;
  margin-bottom: 12px;
  position: relative;
  overflow: hidden;
}
.preview-img .play-overlay {
  position: absolute; left: 10px; bottom: 10px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  padding: 4px 10px;
  border-radius: 14px;
  font-size: 12px;
  display: inline-flex; align-items: center; gap: 4px;
}
.preview-img .play-overlay svg { width: 12px; height: 12px; }

/* Meta cards */
.meta-cards {
  display: grid; gap: 8px;
  margin-bottom: 12px;
}
.meta-card {
  background: var(--bg-soft-pink);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex; align-items: center; gap: 10px;
  font-size: 13px;
  color: var(--text);
}
.meta-card svg { width: 16px; height: 16px; color: var(--primary); flex-shrink: 0; }

/* Checklist */
.checklist { margin-bottom: 14px; }
.check-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  background: var(--card-soft);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--text);
}
.check-item input { accent-color: var(--primary); width: 16px; height: 16px; flex-shrink: 0; }

/* CTA + Tip */
.panel-cta {
  width: 100%;
  background: var(--primary);
  color: #fff;
  padding: 13px;
  border-radius: 12px;
  font-weight: 700; font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: background 0.15s, box-shadow 0.2s;
  margin-bottom: 14px;
}
.panel-cta:hover { background: var(--primary-hover); box-shadow: 0 6px 16px rgba(156,59,94,0.3); }
.panel-cta:disabled { background: var(--text-muted); cursor: default; }
.panel-cta svg { width: 16px; height: 16px; }
.panel-tip {
  background: var(--bg-soft-pink);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex; align-items: flex-start; gap: 10px;
}
.panel-tip .tip-icon {
  width: 24px; height: 24px; border-radius: 50%;
  background: #FFF3DD; color: var(--warning);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 13px;
}
.panel-tip .tip-body { font-size: 12.5px; line-height: 1.5; }
.panel-tip .tip-title { font-weight: 700; color: var(--text); margin-bottom: 2px; }
.panel-tip .tip-text { color: var(--text-soft); }

/* Empty state in panel */
.panel-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
}
.panel-empty .pe-icon { font-size: 36px; margin-bottom: 10px; opacity: 0.7; }
.panel-empty .pe-title { font-size: 14px; color: var(--text); font-weight: 600; margin-bottom: 4px; }
.panel-empty .pe-sub { font-size: 12.5px; }

/* ============================================================
   SCRIPTS PAGE
============================================================ */
.scripts-page {
  padding: 24px 28px;
  overflow-y: auto;
  height: 100%;
}
.scripts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 16px;
}
.sp-card {
  background: #fff;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  padding: 16px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.2s;
}
.sp-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.sp-title { font-weight: 700; color: var(--text-strong); font-size: 15px; margin-bottom: 4px; }
.sp-meta { font-size: 12.5px; color: var(--text-soft); margin-bottom: 10px; }
.sp-badge {
  display: inline-block;
  padding: 3px 9px; border-radius: 10px;
  font-size: 11px; font-weight: 600;
  background: var(--primary-soft); color: var(--primary);
  margin-right: 6px;
}
.sp-badge.locked { background: #E8F6EC; color: var(--success); }
.sp-hook { font-size: 13px; color: var(--text); line-height: 1.5; }
.sp-foot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border-soft);
  font-size: 12px; color: var(--text-muted);
}
.sp-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.sp-empty .pe-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.6; }

/* Script detail modal */
.sp-modal-bg {
  position: fixed; inset: 0; background: rgba(74, 30, 52, 0.4);
  z-index: 900;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.sp-modal {
  background: #fff;
  border-radius: 16px;
  max-width: 720px; width: 100%;
  max-height: 90vh;
  overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
}
.sp-modal-head {
  padding: 16px 20px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
  color: #fff;
  display: flex; align-items: center; justify-content: space-between;
}
.sp-modal-head h3 { font-family: "Playfair Display", serif; font-size: 18px; }
.sp-modal-head .close {
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.sp-modal-body {
  flex: 1; overflow-y: auto;
  padding: 20px;
}

/* ============================================================
   SETTINGS PAGE
============================================================ */
.settings-page {
  padding: 24px 28px;
  overflow-y: auto;
  height: 100%;
}
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  max-width: 900px;
  margin-top: 16px;
}
.set-card {
  background: #fff;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.set-card h3 {
  font-family: "Playfair Display", serif;
  font-size: 17px; color: var(--text-strong);
  margin-bottom: 4px;
}
.set-card .set-sub { color: var(--text-soft); font-size: 13px; margin-bottom: 16px; }
.form-field { margin-bottom: 12px; }
.form-field label { display: block; font-size: 13px; font-weight: 600; color: var(--text-soft); margin-bottom: 4px; }
.form-field input, .form-field textarea, .form-field select {
  width: 100%; padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--card-soft);
  font-size: 14px;
  color: var(--text);
  transition: border-color 0.15s;
}
.form-field input:focus, .form-field textarea:focus, .form-field select:focus {
  border-color: var(--primary);
  background: #fff;
}
.form-field textarea { resize: vertical; min-height: 60px; font-family: inherit; }
.form-row {
  display: grid; gap: 12px;
  grid-template-columns: 1fr 1fr;
}
.form-help { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.btn-save {
  background: var(--primary); color: #fff;
  padding: 11px 18px;
  border-radius: 10px;
  font-weight: 700;
  margin-top: 8px;
  transition: background 0.15s;
}
.btn-save:hover { background: var(--primary-hover); }
.btn-ghost {
  background: transparent;
  color: var(--primary);
  padding: 9px 14px;
  border: 1.5px solid var(--primary-soft);
  border-radius: 10px;
  font-weight: 600;
}
.btn-ghost:hover { background: var(--bubble-ai); }

/* ============================================================
   OVERVIEW PAGE
============================================================ */
.overview-page {
  padding: 24px 28px;
  overflow-y: auto;
  height: 100%;
}
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-top: 16px;
  max-width: 900px;
}
.stat-card {
  background: #fff;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}
.stat-card .stat-icon {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--bubble-ai);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 10px;
}
.stat-card .stat-icon svg { width: 18px; height: 18px; }
.stat-card .stat-num {
  font-family: "Playfair Display", serif;
  font-size: 28px; font-weight: 700;
  color: var(--text-strong);
}
.stat-card .stat-label {
  font-size: 12.5px; color: var(--text-soft);
}

/* ============================================================
   COMING SOON
============================================================ */
.coming {
  padding: 60px 28px; text-align: center;
  color: var(--text-muted);
  max-width: 500px;
  margin: 40px auto;
}
.coming .cs-icon {
  font-size: 56px; opacity: 0.4; margin-bottom: 16px;
}
.coming h2 {
  font-family: "Playfair Display", serif;
  color: var(--text-strong);
  font-size: 22px;
  margin-bottom: 8px;
}
.coming p { font-size: 14px; line-height: 1.6; }

/* ============================================================
   TOAST
============================================================ */
.toast {
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%);
  background: var(--text-strong); color: #fff;
  padding: 11px 22px; border-radius: 24px;
  font-size: 13.5px; font-weight: 600;
  z-index: 2000;
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  box-shadow: var(--shadow-lg);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }

/* ============================================================
   RESPONSIVE (mobile)
============================================================ */
@media (max-width: 1024px) {
  .chat-page { grid-template-columns: 1fr; gap: 14px; }
  .chat-right { max-height: none; }
  .topbar::after { display: none; }
}

@media (max-width: 768px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0;
    width: 260px;
    transform: translateX(-100%);
    transition: transform 0.25s;
    z-index: 200;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar::after {
    content: "";
    position: fixed; inset: 0 0 0 260px;
    background: rgba(74, 30, 52, 0.35);
    display: none;
  }
  .sidebar.open::after { display: block; }
  .menu-toggle { display: inline-flex; }
  .topbar { padding: 14px 16px; }
  .page-title h1 { font-size: 20px; }
  .page-title p { font-size: 12px; }
  .btn-primary { padding: 8px 12px; font-size: 13px; }
  .chat-page { padding: 12px; gap: 12px; }
  .scripts-page, .settings-page, .overview-page { padding: 16px; }
  .chat-scroll { padding: 14px 12px 6px; }
  .chip-row, .ideas-row, .script-card { padding-left: 0; margin-left: 42px; }
  .composer { padding: 10px; }
}
