/* ── DESIGN TOKENS ── */
:root {
  color-scheme: dark;
  --bg: #080c18;
  --bg-ink: #f1f5ff;
  --panel: rgba(12, 16, 30, 0.72);
  --panel-solid: rgba(10, 13, 26, 0.92);
  --panel-strong: rgba(99, 102, 241, 0.08);
  --text: #f1f5ff;
  --muted: rgba(165, 180, 252, 0.65);
  --line: rgba(99, 102, 241, 0.15);
  --accent: #6366f1;
  --accent-strong: #818cf8;
  --accent-soft: rgba(99, 102, 241, 0.12);
  --electric: #38bdf8;
  --violet: #8b5cf6;
  --teal: #14b8a6;
  --warning: #fbbf24;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  --shadow-soft: 0 12px 32px rgba(0, 0, 0, 0.3);
  --radius: 18px;
  --font: 'IBM Plex Sans Thai', 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', monospace;
  font-family: var(--font);
}

* { box-sizing: border-box; }

html { font-size: 17px; }
html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  overflow-x: hidden;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

/* ── THREE.JS BG ── sits behind frosted panels ── */
#bg-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
}

body.light-mode #bg-canvas { opacity: 0.5; }

/* ── SHELL ── */
.app-shell {
  position: relative;
  z-index: 1;
  width: min(1660px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 14px 0 28px;
  zoom: 1.13;
}

/* ── TOPBAR / HERO ── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 2px 12px;
}

.brand-lockup {
  display: grid;
  align-content: center;
  gap: 9px;
  width: min(680px, 58%);
  min-height: 150px;
}

.topbar h1, .panel h2 { margin: 0; letter-spacing: 0; }

.topbar h1 {
  font-size: clamp(28px, 3.2vw, 42px);
  line-height: 0.98;
  background: linear-gradient(135deg, #c7d2fe, #a5b4fc, #818cf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.panel h2 {
  font-size: 19px;
  color: #c7d2fe;
}

/* ── STATUS CLUSTER ── */
.status-cluster {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.08);
  color: var(--muted);
  white-space: nowrap;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(16px);
  font: inherit;
  cursor: pointer;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 0 5px rgba(52, 211, 153, 0.2);
}

.status-cluster.is-offline .status-dot {
  background: #fbbf24;
  box-shadow: 0 0 0 5px rgba(251, 191, 36, 0.2);
}

.status-cluster.is-error .status-dot {
  background: #fb7185;
  box-shadow: 0 0 0 5px rgba(251, 113, 133, 0.2);
}

.status-cluster.is-loading .status-dot {
  animation: dot-pulse 1.4s ease-in-out infinite;
}

@keyframes dot-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ── WORKSPACE ── */
.workspace {
  display: grid;
  gap: 16px;
}

.workspace-row {
  display: grid;
  gap: 16px;
  align-items: start;
}

.workspace-row-top { grid-template-columns: minmax(0, 1fr); }
.workspace-row-bottom { grid-template-columns: minmax(0, 1fr); }

.workspace-column {
  display: grid;
  gap: 16px;
  align-content: start;
  min-width: 0;
}

.steps-stack { grid-auto-rows: min-content; }
.steps-stack > [data-step-panel="step-2"] { order: 2; }
.steps-stack > [data-step-panel="step-3"] { order: 3; }
.steps-stack > [data-step-panel="step-4-audio"] { order: 4; }
.steps-stack > [data-step-panel="step-5-video"] { order: 5; }

.workspace-column > *, .audio-panel { min-width: 0; }
.audio-panel { min-height: auto; }
.workspace > *, .workspace-row > *, .panel { min-width: 0; }

/* ── PANELS ── */
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
  overflow: hidden;
}

.brief-panel, .output-panel, .visual-panel { min-height: 580px; }
.output-summary-panel, .output-middle-panel { min-height: auto; }
.output-panel { min-width: 0; }

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.06), rgba(139, 92, 246, 0.04));
}

.panel-heading::before {
  content: "";
  width: 5px;
  height: 30px;
  flex: 0 0 auto;
  border-radius: 5px;
  background: linear-gradient(180deg, var(--accent), var(--violet));
}

.panel-heading > div:first-child { margin-right: auto; }

.panel-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.panel-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.08);
  color: var(--muted);
  transition: background 140ms, border-color 140ms, transform 140ms;
  flex-shrink: 0;
}

.panel-toggle i { font-size: 15px; line-height: 1; transition: transform 220ms ease; }
.panel-toggle:hover { background: rgba(99, 102, 241, 0.18); border-color: rgba(99, 102, 241, 0.4); }
.panel-toggle:active { transform: scale(0.93); }
.panel.is-collapsed .panel-toggle i { transform: rotate(180deg); }

.brief-form,
.visual-panel > :not(.panel-heading),
.output-panel > :not(.panel-heading) { padding: 18px; }

.panel.is-collapsed > :not(.panel-heading) { display: none; }

.brief-panel.is-collapsed > .brief-form { display: grid; gap: 0; padding: 0; }
.brief-panel.is-collapsed .brief-heading { margin: 0; border-bottom: 0; }
.panel.is-collapsed .brief-body { display: none; }
.panel.is-collapsed { min-height: unset; }

/* ── BRIEF FORM ── */
.brief-form { display: grid; gap: 12px; }

.brief-heading { margin: -18px -18px 2px; border-bottom: 1px solid var(--line); }

.brief-body { display: grid; gap: 12px; }

.brief-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: 14px;
  align-items: stretch;
}

.brief-main-fields, .brief-side-fields { display: grid; gap: 11px; min-width: 0; }
.brief-side-fields { align-content: start; }

label, .channel-fieldset {
  display: grid;
  gap: 7px;
  color: #c7d2fe;
  font-size: 13px;
  font-weight: 700;
}

/* ── FORM INPUTS ── */
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(5, 7, 15, 0.5);
  color: var(--text);
  padding: 11px 13px;
  outline: none;
  transition: border-color 160ms, box-shadow 160ms;
}

select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 46px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--accent-strong) 50%),
    linear-gradient(135deg, var(--accent-strong) 50%, transparent 50%);
  background-position: calc(100% - 24px) 55%, calc(100% - 18px) 55%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  font-weight: 600;
}

select option {
  background: #0f1326;
  color: #f1f5ff;
}

textarea { resize: vertical; min-height: 74px; }

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15), 0 8px 24px rgba(99, 102, 241, 0.08);
}

input::placeholder, textarea::placeholder { color: rgba(165, 180, 252, 0.3); }

/* ── STEP STRIP ── */
.step-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 10px 0 0;
}

.step-strip span {
  display: block;
  padding: 9px 11px;
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.06);
  color: #a5b4fc;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

/* ── CHANNEL FIELDSET ── */
.channel-fieldset {
  grid-template-columns: 1fr;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  margin: 0;
  background: rgba(5, 7, 15, 0.3);
  gap: 9px;
}

.channel-fieldset legend { padding: 0 6px; color: var(--muted); }

.channel-chip {
  --channel-color: var(--accent);
  --channel-soft: rgba(99, 102, 241, 0.08);
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid rgba(99, 102, 241, 0.12);
  border-radius: 12px;
  background: rgba(5, 7, 15, 0.38);
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  user-select: none;
  transition: border-color 150ms, background 150ms, color 150ms, transform 120ms;
}

.channel-chip i {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border-radius: 9px;
  background: color-mix(in srgb, var(--channel-color) 16%, transparent);
  color: var(--channel-color);
  font-size: 17px;
  line-height: 1;
}

.channel-chip span { flex: 1; }

.channel-chip:hover {
  border-color: color-mix(in srgb, var(--channel-color) 42%, transparent);
  background: color-mix(in srgb, var(--channel-color) 10%, transparent);
  color: #e2e8ff;
}

.channel-chip:active { transform: scale(0.98); }

.channel-chip:has(input:checked) {
  border-color: color-mix(in srgb, var(--channel-color) 52%, transparent);
  background: color-mix(in srgb, var(--channel-color) 16%, transparent);
  color: #f1f5ff;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--channel-color) 22%, transparent) inset,
              0 8px 20px color-mix(in srgb, var(--channel-color) 12%, transparent);
}

.channel-chip input {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  margin: 0;
  border: 1.5px solid rgba(99, 102, 241, 0.3);
  border-radius: 6px;
  background: transparent;
  transition: background 150ms, border-color 150ms;
}

.channel-chip input:checked {
  border-color: var(--channel-color);
  background: color-mix(in srgb, var(--channel-color) 22%, transparent);
}

.channel-chip input:checked::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 5px;
  height: 9px;
  border: solid var(--channel-color);
  border-width: 0 2px 2px 0;
  transform: translate(-50%, -60%) rotate(45deg);
}

.channel-chip input:focus-visible {
  outline: 3px solid rgba(99, 102, 241, 0.3);
  outline-offset: 2px;
}

.channel-facebook { --channel-color: #60a5fa; --channel-soft: rgba(96, 165, 250, 0.08); }
.channel-line     { --channel-color: #34d399; --channel-soft: rgba(52, 211, 153, 0.09); }
.channel-tiktok   { --channel-color: #e2e8ff; --channel-soft: rgba(226, 232, 255, 0.06); }
.channel-youtube  { --channel-color: #fb7185; --channel-soft: rgba(251, 113, 133, 0.08); }
.channel-blog     { --channel-color: #fb923c; --channel-soft: rgba(251, 146, 60, 0.09); }
.channel-email    { --channel-color: #38bdf8; --channel-soft: rgba(56, 189, 248, 0.09); }

/* ── BUTTONS ── */
.ghost-static { cursor: default; pointer-events: none; }

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

.button-row {
  display: flex;
  gap: 10px;
  flex-wrap: nowrap;
  align-items: center;
  margin-top: 2px;
}

.button-row .bridge-button { flex: 1 1 auto; min-width: 0; white-space: nowrap; }
.button-row .secondary-button { flex: 0 0 auto; }

.primary-button, .secondary-button, .ghost-button, .copy-button, .tab-button {
  border-radius: 12px;
  border: 1px solid transparent;
  min-height: 40px;
  padding: 9px 14px;
  font-weight: 700;
}

.primary-button {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  box-shadow: 0 8px 28px rgba(99, 102, 241, 0.35);
  transition: transform 160ms, box-shadow 160ms;
}

.primary-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 36px rgba(99, 102, 241, 0.5);
}

.secondary-button {
  background: rgba(99, 102, 241, 0.08);
  color: #c7d2fe;
  border-color: var(--line);
}

.secondary-button:hover { background: rgba(99, 102, 241, 0.14); border-color: rgba(99, 102, 241, 0.3); }

.ghost-button {
  background: transparent;
  color: var(--accent-strong);
  border-color: var(--line);
}

.bridge-button {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  border: none;
  border-radius: 12px;
  min-height: 40px;
  padding: 9px 16px;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.35);
  transition: transform 160ms, box-shadow 160ms;
}

.bridge-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 32px rgba(99, 102, 241, 0.5);
}

/* ── SNAPSHOT / STRATEGY ── */
.snapshot-grid {
  display: block;
  min-height: 0;
}

.strategy-toolbar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.strategy-tab {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 46px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(5, 7, 15, 0.4);
  color: var(--muted);
  font-weight: 700;
  transition: transform 160ms, border-color 160ms, background 160ms;
}

.strategy-tab b {
  display: grid;
  place-items: center;
  min-width: 26px;
  height: 26px;
  border-radius: 7px;
  background: rgba(99, 102, 241, 0.1);
  color: #a5b4fc;
  font-size: 11px;
}

.strategy-tab.active {
  border-color: rgba(99, 102, 241, 0.4);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.14), rgba(139, 92, 246, 0.1));
  color: #c7d2fe;
}

.strategy-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.snapshot-card {
  display: none;
  min-height: 112px;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(5, 7, 15, 0.38);
  box-shadow: var(--shadow-soft);
  transition: transform 180ms, box-shadow 180ms, border-color 180ms;
}

.snapshot-card.active {
  display: block;
  animation: card-arrive 260ms ease both;
}

@keyframes card-arrive {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.snapshot-card strong {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--accent-strong);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-family: var(--mono);
}

.snapshot-card p {
  margin: 0;
  color: rgba(226, 232, 255, 0.8);
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-line;
}

/* ── TABS ── */
.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-top: 0 !important;
  padding-inline: 2px;
}

.tabs-center {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  overflow: visible;
  padding-inline: 0;
}

.tab-button {
  flex: 0 0 auto;
  border-color: var(--line);
  background: rgba(5, 7, 15, 0.38);
  color: var(--muted);
}

.tabs-center .tab-button {
  flex: initial;
  min-height: 56px;
  justify-content: center;
}

.tab-button.active {
  color: #a5b4fc;
  border-color: rgba(99, 102, 241, 0.4);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.16), rgba(56, 189, 248, 0.1));
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.18) inset;
}

/* ── OUTPUT / EMPTY ── */
.output-stack { display: grid; gap: 14px; }

.empty-state {
  display: grid;
  place-items: center;
  text-align: center;
  min-height: 360px;
  border: 1px dashed rgba(99, 102, 241, 0.2);
  border-radius: 16px;
  padding: 24px;
  color: var(--muted);
  background: rgba(5, 7, 15, 0.3);
}

.empty-state h3 { margin: 0 0 8px; color: #c7d2fe; }

/* ── CONTENT CARDS ── */
.content-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: visible;
  background: rgba(10, 13, 26, 0.6);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(14px);
}

.content-card-header {
  border-top-left-radius: 18px;
  border-top-right-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(139, 92, 246, 0.05));
  border-bottom: 1px solid var(--line);
}

.content-card-header h3 { margin: 0; font-size: 17px; color: #c7d2fe; }
.content-card-body { display: grid; gap: 13px; padding: 14px; }

/* ── OUTPUT BLOCKS ── */
.output-block { display: grid; gap: 8px; }

.output-block h4 {
  margin: 0;
  font-size: 12px;
  color: var(--accent-strong);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-family: var(--mono);
}

.output-block-head {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 30px;
}

.output-block-title { display: flex; align-items: center; gap: 10px; flex: 1 1 auto; min-width: 0; }

.output-block-head h4, .output-block-head .output-block-spacer { flex: 1 1 auto; min-width: 0; }

.output-block-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
  pointer-events: none;
}

.block-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.08);
  color: var(--muted);
  flex-shrink: 0;
  transition: background 140ms, border-color 140ms, transform 140ms;
}

.block-toggle i { font-size: 14px; line-height: 1; transition: transform 200ms; }
.block-toggle:hover { background: rgba(99, 102, 241, 0.18); border-color: rgba(99, 102, 241, 0.4); }
.block-toggle:active { transform: scale(0.92); }
.output-block.is-collapsed .block-toggle i { transform: rotate(180deg); }
.output-block.is-collapsed .output-text { display: none; }
.output-block.is-collapsed .output-block-actions { display: none; }
.output-block-spacer { flex: 1; }

.output-block:hover .output-block-actions,
.output-block:focus-within .output-block-actions,
.output-block.is-editing .output-block-actions { pointer-events: auto; }

.block-tools {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.08);
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 150ms, transform 150ms;
}

.output-block:hover .block-tools,
.output-block:focus-within .block-tools,
.output-block.is-editing .block-tools { opacity: 1; transform: translateY(0); }

.block-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  transition: background 140ms, color 140ms;
}

.block-icon-btn i { font-size: 16px; line-height: 1; }
.block-icon-btn:hover { background: rgba(99, 102, 241, 0.14); color: #a5b4fc; }

.output-block.is-editing .block-icon-btn[data-block-edit] {
  background: var(--accent);
  color: #fff;
}

.output-block.is-editing .output-text {
  outline: 2px solid var(--accent);
  cursor: text;
}

.output-text {
  margin: 0;
  padding: 12px;
  border-radius: 12px;
  background: rgba(5, 7, 15, 0.45);
  border: 1px solid var(--line);
  color: rgba(226, 232, 255, 0.88);
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* ── COPY BUTTON ── */
.copy-button {
  background: rgba(99, 102, 241, 0.08);
  border-color: var(--line);
  color: var(--accent-strong);
  min-height: 34px;
  padding: 7px 10px;
}

.copy-button:hover { background: rgba(99, 102, 241, 0.16); }

/* ── VISUAL PANEL ── */
.visual-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.canvas-wrap, #downloadImage, #renderImage { display: none !important; }

.canvas-wrap {
  display: grid;
  place-items: center;
  margin: 16px 18px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(5, 7, 15, 0.4);
}

.canvas-wrap canvas {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  max-height: 520px;
  object-fit: contain;
  border-radius: 14px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.4);
}

.generated-image {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  max-height: 520px;
  object-fit: contain;
  border-radius: 14px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.4);
}

.generated-image[hidden], canvas[hidden] { display: none; }

/* ── IMAGE PROMPT ── */
.image-prompt-block { display: grid; gap: 10px; margin-top: 16px; }

.image-prompt-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.image-prompt-label { margin-top: 0; display: block; }

.image-prompt-tools {
  justify-self: end;
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 150ms, transform 150ms;
}

.image-prompt-block:hover .image-prompt-tools,
.image-prompt-block:focus-within .image-prompt-tools { opacity: 1; transform: translateY(0); }

.image-prompt-label textarea { min-height: 160px; }
.visual-actions { padding-top: 0 !important; }

/* ── CALENDAR ── */
.calendar-panel { display: grid; gap: 14px; margin-top: 14px; padding-bottom: 18px; }

.calendar-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  padding: 0 18px;
}

.calendar-summary { padding: 0; }

.calendar-summary-card {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(5, 7, 15, 0.4);
  box-shadow: var(--shadow-soft);
}

.calendar-summary-card strong { display: block; margin-bottom: 6px; color: var(--accent-strong); }
.calendar-summary-card p { margin: 0 0 6px; color: rgba(226, 232, 255, 0.75); line-height: 1.5; }

.calendar-controls { display: grid; grid-template-columns: 1fr 180px; gap: 12px; }

.calendar-legend {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 0 18px;
  color: var(--muted);
  font-size: 13px;
}

.calendar-legend span {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.06);
}

.calendar-legend strong { color: var(--accent-strong); }

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 0 18px 18px;
}

.calendar-day-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(5, 7, 15, 0.4);
  box-shadow: var(--shadow-soft);
  text-align: left;
  width: 100%;
  cursor: pointer;
  transition: border-color 180ms, transform 160ms;
}

.calendar-day-card:hover { border-color: rgba(99, 102, 241, 0.35); transform: translateY(-2px); }

.calendar-day-card.active {
  border-color: rgba(99, 102, 241, 0.45);
  box-shadow: 0 16px 32px rgba(99, 102, 241, 0.14);
}

.calendar-day-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.calendar-day-head strong { display: block; margin-bottom: 4px; color: #e2e8ff; font-size: 16px; }
.calendar-day-head span { display: block; color: var(--muted); font-size: 13px; line-height: 1.35; }

.calendar-day-pill {
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.12);
  color: #a5b4fc;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  border: 1px solid rgba(99, 102, 241, 0.2);
}

.calendar-slot-list { display: grid; gap: 10px; }

.calendar-slot {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(5, 7, 15, 0.35);
}

.calendar-slot-time { color: var(--accent-strong); font-size: 13px; font-weight: 700; font-family: var(--mono); }
.calendar-slot-meta { display: grid; gap: 4px; }
.calendar-slot-meta span:first-child { color: #e2e8ff; font-size: 13px; font-weight: 700; }
.calendar-slot-meta span:last-child { color: var(--muted); font-size: 12px; line-height: 1.45; }

.calendar-preview { display: grid; gap: 14px; padding: 0 18px 18px; }
.calendar-preview-heading { padding-inline: 0; border-bottom: 0; background: transparent; }
.calendar-preview-stack { display: grid; gap: 14px; }

.calendar-preview-step {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(5, 7, 15, 0.4);
}

.calendar-preview-step h4 { margin: 0; font-size: 14px; color: #c7d2fe; }
.calendar-preview-grid { min-height: auto; }

.calendar-preview-box { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: rgba(5, 7, 15, 0.38); }

.calendar-preview-lead { margin: 0; color: rgba(226, 232, 255, 0.8); white-space: pre-wrap; line-height: 1.6; }

.calendar-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 960px;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: rgba(5, 7, 15, 0.4);
}

.calendar-table th, .calendar-table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  line-height: 1.45;
}

.calendar-table th {
  position: sticky;
  top: 0;
  background: rgba(8, 12, 24, 0.9);
  color: var(--accent-strong);
  font-size: 13px;
  font-family: var(--mono);
}

.calendar-table tbody tr:nth-child(even) td { background: rgba(99, 102, 241, 0.04); }

/* ── HISTORY ── */
.history-section { margin-top: 16px; }
.history-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 18px; }

.history-item {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  background: rgba(5, 7, 15, 0.4);
  box-shadow: var(--shadow-soft);
}

.history-item h3 { margin: 0 0 6px; font-size: 16px; color: #c7d2fe; }
.history-item p { margin: 0 0 10px; color: var(--muted); font-size: 13px; line-height: 1.45; }

.history-tags { display: flex; gap: 6px; flex-wrap: wrap; }

.tag {
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.1);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--line);
}

/* ── TOAST ── */
.toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 20;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  border-radius: 14px;
  background: rgba(10, 13, 26, 0.96);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #f1f5ff;
  padding: 12px 18px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 30px rgba(99, 102, 241, 0.15);
  transition: transform 200ms ease, opacity 200ms ease;
  min-width: 200px;
  font-size: 14px;
}

.toast.show { opacity: 1; transform: translateY(0); }

/* ── DIALOGS ── */
.ai-dialog {
  width: min(520px, calc(100% - 28px));
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 0;
  color: var(--text);
  background: rgba(10, 13, 26, 0.96);
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(99, 102, 241, 0.1);
  backdrop-filter: blur(24px);
}

.ai-dialog:not([open]) { display: none; }

.ai-dialog::backdrop {
  background: rgba(4, 6, 16, 0.65);
  backdrop-filter: blur(12px);
}

.calendar-preview-dialog {
  width: min(1120px, calc(100% - 28px));
  max-height: min(90vh, 900px);
  overflow: auto;
}

.calendar-dialog-actions { display: flex; justify-content: flex-end; }

.ai-dialog-form { display: grid; gap: 18px; padding: 22px; }

.ai-dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.ai-dialog-heading h2 { margin: 0; font-size: 22px; color: #c7d2fe; }

.dialog-close {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(99, 102, 241, 0.08);
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  transition: background 140ms, border-color 140ms, color 140ms;
}

.dialog-close:hover {
  background: rgba(244, 63, 94, 0.1);
  border-color: rgba(244, 63, 94, 0.35);
  color: #fb7185;
}

.dialog-copy, .dialog-message { margin: 0; color: var(--muted); line-height: 1.55; }
.dialog-message { min-height: 22px; color: var(--accent-strong); font-weight: 700; }
.dialog-message.is-error { color: #fb7185; }

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

/* ── BRIDGE DIALOG ── */
.bridge-dialog { width: min(760px, calc(100% - 28px)); }

.bridge-dialog-body { display: grid; gap: 16px; padding: 22px; }

.bridge-steps {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--muted);
}

.bridge-steps b {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
  font-size: 11px;
  margin-right: 5px;
  font-family: var(--mono);
}

.bridge-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.provider-launchers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }

.provider-button {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(5, 7, 15, 0.4);
  color: #c7d2fe;
  text-align: left;
  transition: border-color 160ms, background 160ms;
}

.provider-button:hover {
  border-color: rgba(99, 102, 241, 0.4);
  background: rgba(99, 102, 241, 0.1);
}

.provider-button strong { font-size: 15px; color: #e2e8ff; }
.provider-button span { font-size: 12px; color: var(--muted); }

.bridge-privacy { margin: 0; font-size: 12px; color: rgba(165, 180, 252, 0.4); }

/* ── EYEBROW / KICKER ── */
.eyebrow, .creator-kicker {
  margin: 0;
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-family: var(--mono);
}

.creator-subtitle {
  max-width: 620px;
  margin: 0;
  color: rgba(165, 180, 252, 0.7);
  font-size: 16px;
  line-height: 1.55;
}

/* ── HERO SECTION ── */
.creator-hero {
  position: relative;
  isolation: isolate;
  min-height: 210px;
  margin-bottom: 16px;
  padding: 28px 32px;
  border: 1px solid rgba(99, 102, 241, 0.15);
  border-radius: 20px;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(12, 16, 30, 0.85), rgba(15, 20, 45, 0.7));
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4), 0 0 60px rgba(99, 102, 241, 0.06);
  backdrop-filter: blur(20px);
}

.creator-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse at 70% 50%, rgba(99, 102, 241, 0.12), transparent 55%),
    radial-gradient(ellipse at 90% 10%, rgba(139, 92, 246, 0.1), transparent 45%);
  pointer-events: none;
}

.creator-hero .status-cluster {
  position: absolute;
  top: 18px;
  right: 20px;
  z-index: 4;
}

/* ── CREATOR SCENE (3D cube) ── */
.creator-scene {
  --scene-x: 0deg;
  --scene-y: 0deg;
  --light-x: 50%;
  --light-y: 50%;
  position: absolute;
  top: 18px;
  right: 28px;
  width: 430px;
  height: 176px;
  perspective: 820px;
  transform-style: preserve-3d;
  cursor: crosshair;
}

.scene-grid {
  position: absolute;
  inset: 18px 0 0;
  border: 1px solid rgba(99, 102, 241, 0.14);
  border-radius: 14px;
  background:
    linear-gradient(rgba(99, 102, 241, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(139, 92, 246, 0.05) 1px, transparent 1px),
    radial-gradient(circle at var(--light-x) var(--light-y), rgba(99, 102, 241, 0.14), transparent 34%);
  background-size: 24px 24px, 24px 24px, auto;
  transform: rotateX(calc(58deg + var(--scene-y))) rotateZ(calc(-6deg + var(--scene-x) * 0.18)) translateZ(-72px);
  transform-origin: center 78%;
  transition: transform 180ms ease;
}

.creator-cube {
  position: absolute;
  left: 196px;
  top: 65px;
  width: 72px;
  height: 72px;
  transform-style: preserve-3d;
  transform: rotateX(calc(-18deg + var(--scene-y))) rotateY(calc(30deg + var(--scene-x)));
  animation: creator-float 4.8s ease-in-out infinite;
  transition: transform 180ms ease;
}

.cube-face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border: 1px solid rgba(99, 102, 241, 0.4);
  background: rgba(99, 102, 241, 0.12);
  color: #c7d2fe;
  box-shadow: inset 0 0 28px rgba(99, 102, 241, 0.15);
  backdrop-filter: blur(8px);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.cube-front  { transform: translateZ(36px);          background: rgba(99, 102, 241, 0.16); }
.cube-back   { transform: rotateY(180deg) translateZ(36px); background: rgba(139, 92, 246, 0.14); }
.cube-right  { transform: rotateY(90deg) translateZ(36px);  background: rgba(56, 189, 248, 0.14); }
.cube-left   { transform: rotateY(-90deg) translateZ(36px); background: rgba(20, 184, 166, 0.14); }
.cube-top    { transform: rotateX(90deg) translateZ(36px);  background: rgba(251, 191, 36, 0.14); }
.cube-bottom { transform: rotateX(-90deg) translateZ(36px); background: rgba(244, 63, 94, 0.12); }

.orbit {
  position: absolute;
  left: 165px;
  top: 40px;
  width: 140px;
  height: 116px;
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 50%;
  transform-style: preserve-3d;
  pointer-events: none;
}

.orbit-a { transform: rotateX(68deg) rotateZ(12deg); animation: orbit-spin 8s linear infinite; }
.orbit-b { transform: rotateY(68deg) rotateZ(-8deg); border-color: rgba(56, 189, 248, 0.3); animation: orbit-spin-reverse 10s linear infinite; }

.idea-card {
  position: absolute;
  display: grid;
  place-items: center;
  width: 82px;
  height: 44px;
  border: 1px solid rgba(99, 102, 241, 0.4);
  border-radius: 10px;
  color: #fff;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.4);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.1em;
  transform-style: preserve-3d;
  transition: transform 180ms ease;
  backdrop-filter: blur(8px);
}

.idea-card-a { left: 40px;  top: 42px;    background: rgba(14, 165, 233, 0.7);  transform: rotateY(calc(12deg + var(--scene-x) * .25)) rotateZ(-7deg); }
.idea-card-b { right: 20px; top: 63px;    background: rgba(124, 58, 237, 0.7);  transform: rotateY(calc(-14deg + var(--scene-x) * .22)) rotateZ(7deg); }
.idea-card-c { left: 72px;  bottom: 12px; background: rgba(99, 102, 241, 0.7);  transform: rotateX(calc(8deg + var(--scene-y) * .25)) rotateZ(4deg); }

/* ── CREATOR ANIMATIONS ── */
@keyframes creator-float {
  0%, 100% { transform: rotateX(calc(-18deg + var(--scene-y))) rotateY(calc(30deg + var(--scene-x))) translateY(0); }
  50%       { transform: rotateX(calc(-18deg + var(--scene-y))) rotateY(calc(30deg + var(--scene-x))) translateY(-8px); }
}

@keyframes orbit-spin         { from { transform: rotateX(68deg)  rotateZ(12deg);   } to { transform: rotateX(68deg)  rotateZ(372deg);  } }
@keyframes orbit-spin-reverse { from { transform: rotateY(68deg)  rotateZ(-8deg);   } to { transform: rotateY(68deg)  rotateZ(-368deg); } }

/* ── LOADING / DISABLED ── */
button:disabled { cursor: wait; opacity: 0.5; transform: none !important; }

.button-loading { position: relative; overflow: hidden; }

.button-loading::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 2px;
  background: rgba(255, 255, 255, 0.7);
  animation: loading-bar 1.2s ease-in-out infinite;
}

@keyframes loading-bar {
  0%   { transform: translateX(-100%); }
  50%  { transform: translateX(0); }
  100% { transform: translateX(100%); }
}

/* ── RESPONSIVE ── */
@media (min-width: 1440px) {
  .snapshot-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 1280px) {
  .workspace-row-top  { grid-template-columns: minmax(0, 1fr); }
  .workspace-row-bottom { grid-template-columns: 1fr; }
  .tabs-center { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .visual-panel, .video-panel { min-height: auto; }
  .visual-panel > :not(.panel-heading) { max-width: 900px; margin-left: auto; margin-right: auto; }
  .calendar-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bridge-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .app-shell { width: min(100% - 20px, 760px); padding-top: 12px; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .workspace { gap: 12px; }
  .workspace-row { grid-template-columns: 1fr; }
  .tabs-center { grid-template-columns: 1fr; }
  .brief-panel, .output-panel, .visual-panel { min-height: auto; }
  .snapshot-grid, .history-list { grid-template-columns: 1fr 1fr; }
  .step-strip { grid-template-columns: 1fr; }
  .brief-layout { grid-template-columns: 1fr; }
  .channel-fieldset { grid-template-columns: 1fr 1fr; }
  .calendar-controls, .calendar-grid { grid-template-columns: 1fr; }
  .strategy-toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
  .panel-heading, .content-card-header, .visual-actions { align-items: stretch; flex-direction: column; }
  .channel-fieldset, .visual-controls, .snapshot-grid, .history-list { grid-template-columns: 1fr; }
  .primary-button, .secondary-button, .ghost-button { width: 100%; }
  .button-row .bridge-button { width: auto; }
  .button-row .secondary-button { width: auto; }
  .dialog-actions { flex-direction: column-reverse; }
  .provider-launchers { grid-template-columns: 1fr; }
  .creator-scene { display: none; }
  .brand-lockup { width: 100%; min-height: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}

/* ── SPLIT ROW ── */
.split-row { display: grid; grid-template-columns: 1fr; gap: 12px; }

/* ── BRIEF STICKY ── */
.brief-panel { position: sticky; top: 12px; }

/* ── OUTPUT SUMMARY ── */
.output-summary-panel { min-height: 100%; }

/* ── THEME TOGGLE BUTTON ── */
#theme-toggle {
  position: fixed;
  top: 16px;
  right: 18px;
  z-index: 9999;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1.5px solid rgba(99, 102, 241, 0.35);
  background: rgba(20, 22, 48, 0.72);
  backdrop-filter: blur(12px);
  color: #a5b4fc;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 200ms, box-shadow 200ms, background 250ms, border-color 250ms;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.3);
  line-height: 1;
}
#theme-toggle:hover {
  transform: scale(1.12) rotate(12deg);
  box-shadow: 0 6px 28px rgba(99, 102, 241, 0.55);
}

/* ── LIGHT MODE TOKENS ── refined cohesive palette ── */
body.light-mode {
  color-scheme: light;
  --bg: #eef1ff;
  --bg-ink: #1e1b4b;
  --panel: rgba(255, 255, 255, 0.72);
  --panel-solid: rgba(255, 255, 255, 0.98);
  --panel-strong: rgba(99, 102, 241, 0.05);
  --text: #1e2244;          /* deep ink-navy — high contrast body text */
  --muted: #5b6488;         /* neutral slate-indigo for secondary text */
  --line: rgba(99, 102, 241, 0.16);
  --accent: #4f46e5;
  --accent-strong: #6366f1;
  --accent-soft: rgba(99, 102, 241, 0.07);
  --electric: #0284c7;
  --violet: #7c3aed;
  --teal: #0d9488;
  --warning: #d97706;
  --shadow: 0 18px 48px rgba(79, 70, 229, 0.12), 0 2px 8px rgba(30, 34, 68, 0.04);
  --shadow-soft: 0 10px 28px rgba(79, 70, 229, 0.08);
}

body.light-mode #theme-toggle {
  background: rgba(255, 255, 255, 0.82);
  border-color: rgba(99, 102, 241, 0.28);
  color: #4f46e5;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.18);
}

/* Title gradient */
body.light-mode .topbar h1 {
  background: linear-gradient(135deg, #4338ca, #7c3aed, #6366f1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
body.light-mode .panel h2 { color: #3730a3; }
body.light-mode .creator-kicker { color: #6366f1; }
body.light-mode .creator-subtitle { color: rgba(79, 70, 229, 0.7); }

/* Panels — clean frosted white, soft indigo lift */
body.light-mode .panel {
  background: linear-gradient(160deg, rgba(255,255,255,0.92), rgba(244,246,253,0.82));
  border-color: rgba(99, 102, 241, 0.16);
  box-shadow:
    0 12px 36px rgba(79, 70, 229, 0.1),
    0 2px 8px rgba(30, 34, 68, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(24px) saturate(1.5);
}
body.light-mode .panel-heading {
  border-bottom-color: rgba(99, 102, 241, 0.12);
  background: linear-gradient(135deg, rgba(99,102,241,0.05), rgba(139,92,246,0.03));
}

/* HERO — light frosted (fixes dark banner bug in light mode) */
body.light-mode .creator-hero {
  background: linear-gradient(135deg, rgba(255,255,255,0.9), rgba(238,242,255,0.78));
  border-color: rgba(99, 102, 241, 0.18);
  box-shadow:
    0 18px 48px rgba(79, 70, 229, 0.12),
    0 2px 8px rgba(30, 34, 68, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}
body.light-mode .creator-hero::before {
  background:
    radial-gradient(ellipse at 70% 50%, rgba(99, 102, 241, 0.1), transparent 55%),
    radial-gradient(ellipse at 90% 10%, rgba(139, 92, 246, 0.08), transparent 45%);
}
/* creator-scene grid lines — darker so visible on light bg */
body.light-mode .scene-grid {
  background:
    linear-gradient(rgba(99, 102, 241, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(139, 92, 246, 0.1) 1px, transparent 1px),
    radial-gradient(circle at var(--light-x) var(--light-y), rgba(99, 102, 241, 0.2), transparent 34%);
  background-size: 24px 24px, 24px 24px, auto;
  border-color: rgba(99, 102, 241, 0.2);
}

/* Inputs & selects */
body.light-mode input[type="text"],
body.light-mode input[type="number"],
body.light-mode select,
body.light-mode textarea {
  background: rgba(255, 255, 255, 0.9);
  color: #1e1b4b;
  border-color: rgba(99, 102, 241, 0.22);
}
body.light-mode input::placeholder,
body.light-mode textarea::placeholder { color: rgba(79, 70, 229, 0.32); }
body.light-mode select option { background: #fff; color: #1e1b4b; }

/* Labels & text */
body.light-mode .eyebrow { color: #6366f1; }
body.light-mode .section-label { color: #374151; }
body.light-mode .creator-scene { opacity: 0.7; }

/* Channel tabs */
body.light-mode .channel-tab {
  background: rgba(255,255,255,0.65);
  border-color: rgba(99, 102, 241, 0.16);
  color: #374151;
}
body.light-mode .channel-tab.active {
  background: rgba(255,255,255,0.95);
  color: var(--accent);
}

/* Step strip */
body.light-mode .step-strip { border-color: rgba(99, 102, 241, 0.14); }
body.light-mode .step-pill { background: rgba(99,102,241,0.07); color: #4f46e5; }
body.light-mode .step-pill.done { background: rgba(13,148,136,0.12); color: #0d9488; }

/* Tone / mood chips */
body.light-mode .tone-chip {
  background: rgba(255,255,255,0.7);
  border-color: rgba(99,102,241,0.18);
  color: #374151;
}
body.light-mode .tone-chip.active { color: #fff; }

/* Toast */
body.light-mode .toast { background: #1e1b4b; color: #fff; }

/* Secondary button */
body.light-mode .secondary-button {
  background: rgba(99,102,241,0.06);
  color: #4f46e5;
  border-color: rgba(99,102,241,0.22);
}
body.light-mode .secondary-button:hover {
  background: rgba(99,102,241,0.12);
}

/* Strategy tabs */
body.light-mode .strategy-tab {
  background: rgba(255,255,255,0.65);
  border-color: rgba(99,102,241,0.14);
  color: #374151;
}
body.light-mode .strategy-tab.active {
  background: rgba(255,255,255,0.95);
  color: #3730a3;
}

/* Panel toggle arrows */
body.light-mode .panel-toggle { color: #6366f1; border-color: rgba(99,102,241,0.2); }
body.light-mode .panel-toggle:hover { background: rgba(99,102,241,0.08); }

/* ── LIGHT MODE: OUTPUT / CONTENT / CALENDAR / HISTORY / DIALOG surfaces ── */
/* Headings & strong text → deep ink-navy */
body.light-mode .panel h2,
body.light-mode .content-card-header h3,
body.light-mode .empty-state h3,
body.light-mode .calendar-preview-step h4,
body.light-mode .history-item h3,
body.light-mode .ai-dialog-heading h2,
body.light-mode .cube-face,
body.light-mode label,
body.light-mode .channel-fieldset { color: #1e1b4b; }

body.light-mode .calendar-day-head strong,
body.light-mode .calendar-slot-meta span:first-child,
body.light-mode .provider-button strong { color: #1e2244; }

/* Body / muted text */
body.light-mode .output-text,
body.light-mode .snapshot-card p,
body.light-mode .calendar-summary-card p,
body.light-mode .calendar-preview-lead { color: #2c3358; }

/* Light frosted surfaces (replace hardcoded dark rgba(5,7,15)/rgba(10,13,26)) */
body.light-mode .empty-state,
body.light-mode .content-card,
body.light-mode .output-text,
body.light-mode .snapshot-card,
body.light-mode .tab-button,
body.light-mode .calendar-summary-card,
body.light-mode .calendar-day-card,
body.light-mode .calendar-slot,
body.light-mode .calendar-preview-step,
body.light-mode .calendar-preview-box,
body.light-mode .calendar-table,
body.light-mode .history-item,
body.light-mode .provider-button,
body.light-mode .step-strip span {
  background: rgba(255, 255, 255, 0.82);
  border-color: rgba(99, 102, 241, 0.14);
}

body.light-mode .step-strip span { color: #3730a3; font-weight: 700; }

body.light-mode .content-card-header {
  background: linear-gradient(135deg, rgba(99,102,241,0.06), rgba(139,92,246,0.04));
  border-bottom-color: rgba(99,102,241,0.12);
}

body.light-mode .empty-state { border-style: dashed; border-color: rgba(99,102,241,0.28); }

body.light-mode .calendar-table th {
  background: rgba(238, 241, 255, 0.96);
  color: #4338ca;
}
body.light-mode .calendar-table th,
body.light-mode .calendar-table td { border-bottom-color: rgba(99,102,241,0.12); }
body.light-mode .calendar-table tbody tr:nth-child(even) td { background: rgba(99,102,241,0.04); }

/* Tab buttons */
body.light-mode .tab-button { color: #5b6488; }
body.light-mode .tab-button.active {
  color: #3730a3;
  border-color: rgba(99,102,241,0.4);
  background: linear-gradient(135deg, rgba(99,102,241,0.12), rgba(56,189,248,0.08));
}

/* Pills / tags / chips that used light text */
body.light-mode .calendar-day-pill,
body.light-mode .tag { color: #4338ca; background: rgba(99,102,241,0.1); border-color: rgba(99,102,241,0.18); }
body.light-mode .calendar-slot-time,
body.light-mode .snapshot-card strong,
body.light-mode .output-block h4 { color: #4f46e5; }

/* Dialogs */
body.light-mode .ai-dialog { background: rgba(255,255,255,0.98); color: #1e2244; }
body.light-mode .provider-button { color: #2c3358; }
body.light-mode .provider-button:hover { background: rgba(99,102,241,0.08); border-color: rgba(99,102,241,0.3); }

/* ── LIGHT MODE: CHANNEL CHIPS — clean, crisp, branded ── */
/* Container: drop the dark slab for an airy frosted card */
body.light-mode .channel-fieldset {
  background: rgba(255, 255, 255, 0.55);
  border-color: rgba(99, 102, 241, 0.16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}
body.light-mode .channel-fieldset legend { color: #4338ca; font-weight: 700; }

/* TikTok brand color is near-white — swap to ink so it reads on light */
body.light-mode .channel-tiktok { --channel-color: #1e293b; }

/* Chips: white base, soft brand wash on hover/checked, dark label */
body.light-mode .channel-chip {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(15, 23, 42, 0.08);
  color: #3a4266;
  box-shadow: 0 1px 2px rgba(30, 34, 68, 0.04);
}

body.light-mode .channel-chip i {
  background: color-mix(in srgb, var(--channel-color) 14%, #fff);
  color: var(--channel-color);
}

body.light-mode .channel-chip:hover {
  border-color: color-mix(in srgb, var(--channel-color) 38%, transparent);
  background: color-mix(in srgb, var(--channel-color) 7%, #fff);
  color: #1e2244;
}

body.light-mode .channel-chip:has(input:checked) {
  border-color: color-mix(in srgb, var(--channel-color) 55%, transparent);
  background: color-mix(in srgb, var(--channel-color) 12%, #fff);
  color: #1e1b4b;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--channel-color) 26%, transparent) inset,
              0 6px 16px color-mix(in srgb, var(--channel-color) 16%, transparent);
}

body.light-mode .channel-chip input {
  border-color: color-mix(in srgb, var(--channel-color) 40%, #cbd5e1);
  background: #fff;
}
body.light-mode .channel-chip input:checked {
  border-color: var(--channel-color);
  background: color-mix(in srgb, var(--channel-color) 30%, #fff);
}
