/* ══════════════════════════════════════
   AI Content Factory MVP – style.css
   ══════════════════════════════════════ */

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

:root {
  --bg:        #0d0f14;
  --bg2:       #13161e;
  --bg3:       #1a1e29;
  --border:    #252a38;
  --accent:    #6c63ff;
  --accent2:   #a78bfa;
  --green:     #22c55e;
  --red:       #ef4444;
  --yellow:    #eab308;
  --text:      #e2e8f0;
  --text-dim:  #8892a4;
  --radius:    12px;
  --shadow:    0 4px 24px rgba(0,0,0,.4);
}

html { font-size: 15px; scroll-behavior: smooth; }

@media (max-width: 768px) {
  html { font-size: 14px; }
}

@media (max-width: 480px) {
  html { font-size: 12px; }
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── HEADER ───────────────────────────── */
.header {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
}
.logo { 
  display: flex; 
  align-items: center; 
  gap: 10px; 
  font-weight: 700; 
  font-size: 1.1rem; 
  flex: 1;
}
.logo-icon { font-size: 1.4rem; }
.badge {
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.header-status { 
  display: flex; 
  align-items: center; 
  gap: 8px; 
  font-size: .82rem; 
  color: var(--text-dim);
  margin-left: auto;
}
.status-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  transition: background .3s;
}
.status-dot.online  { background: var(--green); box-shadow: 0 0 6px var(--green); }
.status-dot.offline { background: var(--red); }
.status-dot.checking { background: var(--yellow); animation: pulse 1s infinite; }
.btn-providers {
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 6px 12px;
  font-size: .9rem;
  transition: color 0.3s;
  white-space: nowrap;
  margin-left: 8px;
}
.btn-providers:hover {
  color: var(--accent);
}

/* ── MAIN LAYOUT ─────────────────────── */
.main {
  flex: 1;
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 0;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  min-width: 0;
  padding: 28px 24px;
  gap: 24px;
  align-items: start;
}

/* ── PANELS ──────────────────────────── */
.panel {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  min-width: 0;
}
.panel-form { position: sticky; top: 80px; }
.section-title { font-size: 1rem; font-weight: 600; margin-bottom: 20px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .6px; }

/* ── PIPELINE BAR ─────────────────────── */
.pipeline-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 10px;
  margin-bottom: 24px;
  gap: 2px;
  flex-wrap: nowrap;
  overflow-x: auto;
}
.pipe-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: .68rem;
  font-weight: 500;
  color: var(--text-dim);
  white-space: nowrap;
  transition: all .3s;
  min-width: 44px;
}
.pipe-step .pipe-icon { font-size: 1rem; }
.pipe-step.active  { background: rgba(108,99,255,.2); color: var(--accent2); }
.pipe-step.done    { background: rgba(34,197,94,.15); color: var(--green); }
.pipe-step.error   { background: rgba(239,68,68,.15); color: var(--red); }
.pipe-arrow { color: var(--border); font-size: .8rem; }

.pipeline-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: -12px;
  margin-bottom: 18px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255,255,255,.015);
  font-size: .78rem;
  color: var(--text-dim);
}

#pipelineMetaPercent {
  color: var(--accent2);
  font-weight: 700;
}

/* ── FORM ─────────────────────────────── */
.form-group { margin-bottom: 20px; }
.form-group label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .85rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}
.required { color: var(--red); }
.hint { margin-left: auto; font-size: .8rem; font-weight: 700; color: var(--accent2); }

input[type="text"], select {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 10px 14px;
  font-size: .9rem;
  font-family: inherit;
  outline: none;
  transition: border-color .2s;
}
input[type="text"]:focus, select:focus { border-color: var(--accent); }
input[type="text"]::placeholder { 
  color: var(--text-dim);
  font-size: 0.8rem;
}
textarea,
input[type="number"] {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 10px 14px;
  font-size: .9rem;
  font-family: inherit;
  outline: none;
  transition: border-color .2s;
}
textarea { resize: vertical; min-height: 150px; line-height: 1.6; }
textarea:focus,
input[type="number"]:focus { border-color: var(--accent); }
textarea::placeholder,
input[type="number"]::placeholder { 
  color: var(--text-dim);
  font-size: 0.8rem;
}
.size-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.hint-inline { font-size: .74rem; color: var(--text-dim); }

.subtitle-style-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 12px;
  background: rgba(255,255,255,.02);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.subtitle-style-row {
  display: grid;
  grid-template-columns: 112px 1fr auto;
  gap: 10px;
  align-items: center;
  font-size: .8rem;
  color: var(--text-dim);
}

.subtitle-style-palette {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 10px;
  align-items: center;
  font-size: .8rem;
  color: var(--text-dim);
}

.subtitle-style-palette input[type="color"] {
  width: 44px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  padding: 1px;
  cursor: pointer;
}

.subtitle-style-row input[type="checkbox"] {
  justify-self: start;
  accent-color: var(--accent);
  width: 18px;
  height: 18px;
}

.subtitle-style-select select {
  max-width: 150px;
}

.subtitle-preview-box {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.subtitle-preview-meta {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-size: .74rem;
  color: var(--text-dim);
  background: rgba(255,255,255,.02);
}

.subtitle-preview-frame {
  width: min(100%, 300px);
  margin: 12px auto;
  aspect-ratio: 9 / 16;
  padding: 0;
  background: linear-gradient(160deg, #4d6281 0%, #2b3345 48%, #141822 100%);
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 10px;
}

.subtitle-safe-area {
  position: absolute;
  inset: 6%;
  border: 1px dashed rgba(255,255,255,.4);
  border-radius: 8px;
  pointer-events: none;
}

.subtitle-preview-text {
  position: absolute;
  max-width: 88%;
  left: 50%;
  transform: translateX(-50%);
  bottom: 38px;
  text-align: center;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: .1px;
  color: #fff;
  font-size: 28px;
  text-shadow: 0 0 2px rgba(0,0,0,.95), 0 2px 6px rgba(0,0,0,.8);
  word-break: break-word;
  padding: 2px 6px;
}

.subtitle-preview-text.boxed {
  border-radius: 8px;
}

/* Topic suggestions */
.topic-suggestions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; align-items: center; }
.suggest-label { font-size: .75rem; color: var(--text-dim); }
.chip {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-dim);
  font-size: .75rem;
  padding: 3px 11px;
  cursor: pointer;
  transition: all .2s;
  font-family: inherit;
}
.chip:hover { border-color: var(--accent); color: var(--accent2); }

/* Range slider */
input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
  background: transparent;
  height: 6px;
}
.range-ticks {
  display: flex;
  justify-content: space-between;
  font-size: .7rem;
  color: var(--text-dim);
  margin-top: 4px;
}

/* Radio group */
.radio-group { display: flex; gap: 10px; }
.radio-card {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: .88rem;
  transition: all .2s;
}
.radio-card:has(input:checked) {
  border-color: var(--accent);
  background: rgba(108,99,255,.1);
}
.radio-card input { accent-color: var(--accent); }

/* Mode toggle */
.mode-toggle { display: flex; gap: 10px; }
.mode-btn {
  flex: 1;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-dim);
  cursor: pointer;
  font-family: inherit;
  font-size: .85rem;
  font-weight: 600;
  padding: 10px 12px;
  text-align: center;
  transition: all .2s;
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: center;
}
.mode-btn small { font-size: .72rem; font-weight: 400; color: var(--text-dim); }
.mode-btn.active {
  border-color: var(--accent);
  background: rgba(108,99,255,.15);
  color: var(--accent2);
}
.mode-btn.active small { color: var(--accent2); opacity: .8; }

.btn-advanced-toggle {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  font-size: .84rem;
  font-weight: 600;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all .2s;
}

.btn-advanced-toggle:hover {
  border-color: var(--accent);
  color: var(--accent2);
}

/* Run button */
.btn-run {
  width: 100%;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  border: none;
  border-radius: 10px;
  color: #fff;
  cursor: pointer;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: opacity .2s, transform .1s;
  margin-top: 4px;
}
.btn-run:hover { opacity: .9; transform: translateY(-1px); }
.btn-run:active { transform: translateY(0); }
.btn-run:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-icon { font-size: 1.2rem; }

/* Step buttons */
.step-buttons { display: flex; flex-direction: column; gap: 8px; }
.btn-step {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  font-size: .88rem;
  padding: 10px 14px;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all .2s;
}
.btn-step:hover { border-color: var(--accent); color: var(--accent2); }
.btn-step:disabled { opacity: .4; cursor: not-allowed; }

/* Divider */
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* ── TIPS BOX ─────────────────────────── */
.tips-box {
  background: rgba(108,99,255,.06);
  border: 1px solid rgba(108,99,255,.25);
  border-radius: 10px;
  padding: 16px;
  margin-top: 24px;
}
.tips-header { font-size: .85rem; font-weight: 700; margin-bottom: 10px; }
.tips-list { list-style: none; display: flex; flex-direction: column; gap: 7px; }
.tips-list li {
  font-size: .8rem;
  color: var(--text-dim);
  padding-left: 16px;
  position: relative;
  line-height: 1.5;
}
.tips-list li::before { content: "•"; position: absolute; left: 0; color: var(--accent); }
.tips-list strong { color: var(--text); }
.tips-list code { background: var(--bg3); border-radius: 4px; padding: 1px 5px; font-size: .78rem; color: var(--accent2); }
.tips-list em { font-style: normal; color: var(--accent2); }

.files-box {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  margin-top: 14px;
}

.files-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.files-header-row .tips-header {
  margin-bottom: 0;
}

.files-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.files-total-size {
  font-size: .74rem;
  color: var(--text-dim);
  white-space: nowrap;
}

.files-meta {
  font-size: .75rem;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.files-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
}

.files-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg2);
  padding: 8px 10px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.files-item-thumbnail {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  border-radius: 6px;
  background: linear-gradient(135deg, rgba(88,86,214,.15), rgba(104,91,238,.15));
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.files-thumb-icon {
  font-size: 28px;
}

.files-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.files-item-content {
  flex: 1;
  min-width: 0;
}

.files-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.files-item-title {
  display: block;
  color: var(--accent2);
  text-decoration: none;
  font-size: .8rem;
  margin-bottom: 4px;
  word-break: break-all;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  font-family: 'Courier New', monospace;
  letter-spacing: 0.5px;
}

button.files-item-title {
  background: none;
  border: none;
  padding: 0;
  margin: 0 0 4px 0;
  text-align: left;
  cursor: pointer;
  font-family: 'Courier New', monospace;
}

.files-item-title:hover {
  text-decoration: underline;
}

.files-item-meta {
  font-size: .72rem;
  color: var(--text-dim);
}

.files-item-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.files-action-btn,
.files-action-link {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg3);
  color: var(--text-dim);
  font-size: .7rem;
  padding: 3px 8px;
  text-decoration: none;
  cursor: pointer;
}

.files-action-btn:hover,
.files-action-link:hover {
  border-color: var(--accent);
  color: var(--accent2);
}

.files-action-btn.delete {
  border-color: rgba(255,82,82,.3);
  color: #ff9c9c;
}

.files-action-btn.delete:hover {
  border-color: #ff5252;
  color: #ffd0d0;
}

/* ── OUTPUT PANEL ─────────────────────── */
.panel-output { display: flex; flex-direction: column; gap: 16px; }

/* Progress */
.progress-area {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
}
.progress-header { display: flex; align-items: center; gap: 10px; font-weight: 600; margin-bottom: 12px; }
.progress-track {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 14px;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 3px;
  transition: width .5s ease;
}
.progress-steps { display: flex; flex-direction: column; gap: 6px; }
.progress-step-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .82rem;
  color: var(--text-dim);
}
.progress-step-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.progress-step-sub {
  font-size: .7rem;
  color: var(--text-dim);
  line-height: 1.3;
}
.progress-step-item.active { color: var(--text); }
.progress-step-item.done   { color: var(--green); }
.progress-step-item.error  { color: var(--red); }
.step-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--border);
  flex-shrink: 0;
}
.progress-step-item.active .step-dot { background: var(--accent); animation: pulse 1s infinite; }
.progress-step-item.done  .step-dot  { background: var(--green); }
.progress-step-item.error .step-dot  { background: var(--red); }

.live-events {
  max-height: 240px;
  overflow-y: auto;
}
.live-event {
  display: grid;
  grid-template-columns: 70px 74px 1fr;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  font-size: .8rem;
  align-items: start;
}
.live-event:last-child { border-bottom: none; }
.live-time { color: var(--text-dim); font-family: monospace; font-size: .72rem; }
.live-step {
  font-size: .72rem;
  color: var(--accent2);
  text-transform: uppercase;
  letter-spacing: .4px;
}
.live-message { color: var(--text); line-height: 1.5; }
.live-event.success .live-step { color: var(--green); }
.live-event.error .live-step { color: var(--red); }

.server-log-events {
  max-height: 180px;
  font-family: Consolas, monospace;
}

.server-log-events .live-event {
  grid-template-columns: 70px 56px 1fr;
}

.server-log-events .live-step {
  text-transform: uppercase;
  font-weight: 700;
}

.server-log-events .live-message {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.server-log-events .live-event.warn .live-step { color: var(--yellow); }

/* Output cards */
.output-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: .85rem;
  font-weight: 700;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,.02);
}
.copy-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-dim);
  cursor: pointer;
  font-size: .8rem;
  padding: 3px 8px;
  transition: all .2s;
}
.copy-btn:hover { border-color: var(--accent); color: var(--accent2); }

.code-preview {
  padding: 14px 16px;
  font-family: 'Courier New', monospace;
  font-size: .8rem;
  color: var(--text-dim);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 200px;
  overflow-y: auto;
  line-height: 1.6;
}
.subtitle-preview { max-height: 150px; }

/* Scenes grid */
.scenes-grid { display: flex; flex-direction: column; gap: 0; }
.scene-item {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  align-items: start;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: .82rem;
}
.scene-item:last-child { border-bottom: none; }
.scene-num {
  background: rgba(108,99,255,.2);
  color: var(--accent2);
  border-radius: 6px;
  font-weight: 700;
  font-size: .75rem;
  text-align: center;
  padding: 4px;
  line-height: 1;
}
.scene-narration { color: var(--text); line-height: 1.5; }
.scene-keyword {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-dim);
  font-size: .72rem;
  padding: 3px 9px;
  white-space: nowrap;
}

/* Audio player */
.audio-player {
  width: 100%;
  padding: 14px 16px;
  display: block;
  accent-color: var(--accent);
}

/* Video player */
.video-wrapper { position: relative; background: #000; }
.video-player {
  width: 100%;
  max-height: 500px;
  display: block;
  object-fit: contain;
  background: #000;
}
.video-format-badge {
  position: absolute;
  bottom: 8px;
  right: 10px;
  background: rgba(0,0,0,.7);
  color: #fff;
  font-size: .7rem;
  padding: 3px 8px;
  border-radius: 4px;
}
.video-actions {
  display: flex;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.btn-download {
  background: var(--green);
  color: #fff;
  text-decoration: none;
  border-radius: 8px;
  padding: 9px 18px;
  font-size: .85rem;
  font-weight: 700;
  transition: opacity .2s;
}
.btn-download:hover { opacity: .85; }
.btn-copy-link {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  font-size: .85rem;
  font-weight: 600;
  padding: 9px 18px;
  transition: all .2s;
}
.btn-copy-link:hover { border-color: var(--accent); color: var(--accent2); }
.job-id {
  font-size: .7rem;
  color: var(--text-dim);
  font-weight: 400;
  font-family: monospace;
}

/* Output info grid */
.output-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--border);
  border-top: 1px solid var(--border);
}
.info-card {
  background: var(--bg3);
  padding: 12px 16px;
}
.info-label { font-size: .72rem; color: var(--text-dim); margin-bottom: 4px; }
.info-value { font-size: .85rem; font-weight: 600; }
.info-value code { font-size: .75rem; color: var(--accent2); }

/* Publish tips */
.publish-tips { padding: 16px; }
.publish-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.publish-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pub-icon { font-size: 1.3rem; }
.publish-item strong { font-size: .85rem; }
.publish-item small { font-size: .75rem; color: var(--text-dim); line-height: 1.4; }

/* Error card */
.error-card { border-color: rgba(239,68,68,.4); }
.error-text { color: var(--red); }
.btn-retry {
  margin: 0 16px 16px;
  background: rgba(239,68,68,.15);
  border: 1px solid var(--red);
  border-radius: 8px;
  color: var(--red);
  cursor: pointer;
  font-family: inherit;
  font-size: .85rem;
  padding: 9px 20px;
  transition: background .2s;
}
.btn-retry:hover { background: rgba(239,68,68,.25); }

/* Caption card */
.caption-card { border-color: rgba(108,99,255,.4); }
.caption-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.caption-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  flex: 1;
}
.caption-tab-btn {
  padding: 8px 16px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-dim);
  cursor: pointer;
  font-size: .85rem;
  font-weight: 500;
  transition: all .2s;
  white-space: nowrap;
}
.caption-tab-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.caption-tab-btn.active {
  background: rgba(108,99,255,.15);
  border-color: var(--accent);
  color: var(--accent);
}

.caption-reload-btn {
  padding: 8px 16px;
  background: rgba(108,99,255,.15);
  border: 1px solid var(--accent);
  border-radius: 6px;
  color: var(--accent);
  cursor: pointer;
  font-size: .85rem;
  font-weight: 500;
  transition: all .2s;
  white-space: nowrap;
}
.caption-reload-btn:hover {
  background: rgba(108,99,255,.25);
}
.caption-reload-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.caption-contents {
  padding: 16px;
}
.caption-tab-content {
  animation: fadeIn .3s ease-in;
}
.caption-section {
  margin-bottom: 20px;
}
.caption-label {
  font-weight: 600;
  font-size: .9rem;
  margin-bottom: 8px;
  color: var(--accent);
}
.caption-textarea {
  width: 100%;
  min-height: 80px;
  padding: 12px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: 'Courier New', monospace;
  font-size: .85rem;
  resize: vertical;
  margin-bottom: 8px;
}
.caption-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(108,99,255,.1);
}
.caption-textarea.hashtag-list {
  min-height: 100px;
}
.caption-input {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: .9rem;
  margin-bottom: 8px;
}
.caption-input:focus {
  outline: none;
  border-color: var(--accent);
}

.copy-btn-sm {
  padding: 6px 12px;
  background: rgba(108,99,255,.1);
  border: 1px solid var(--accent);
  border-radius: 6px;
  color: var(--accent);
  cursor: pointer;
  font-size: .8rem;
  font-weight: 500;
  transition: all .2s;
}
.copy-btn-sm:hover {
  background: rgba(108,99,255,.2);
}

.caption-full {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.copy-btn-primary {
  width: 100%;
  padding: 12px;
  background: rgba(34,197,94,.15);
  border: 1px solid var(--green);
  border-radius: 8px;
  color: var(--green);
  cursor: pointer;
  font-size: .9rem;
  font-weight: 600;
  transition: all .2s;
}
.copy-btn-primary:hover {
  background: rgba(34,197,94,.25);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  text-align: center;
  color: var(--text-dim);
}
.empty-icon { font-size: 3.5rem; margin-bottom: 16px; opacity: .5; }
.empty-title { font-size: 1.15rem; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.empty-desc { font-size: .88rem; line-height: 1.7; margin-bottom: 24px; }
.empty-flow {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .8rem;
  flex-wrap: wrap;
  justify-content: center;
  opacity: .6;
}
.arr { color: var(--accent); }

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 20px;
  font-size: .85rem;
  box-shadow: var(--shadow);
  z-index: 999;
  transition: opacity .3s, transform .3s;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.hidden { opacity: 0; transform: translateY(10px); pointer-events: none; }
.toast.success { border-color: var(--green); color: var(--green); }
.toast.error   { border-color: var(--red);   color: var(--red); }
.toast.info    { border-color: var(--accent); color: var(--accent2); }

/* Utility */
.hidden { display: none !important; }

/* Spinner */
.spinner {
  width: 16px; height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ── PROVIDERS BUTTON & MODAL ─────────────── */
.btn-providers {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-dim);
  cursor: pointer;
  font-family: inherit;
  font-size: .8rem;
  font-weight: 600;
  padding: 6px 14px;
  transition: all .2s;
}
.btn-providers:hover { border-color: var(--accent); color: var(--accent2); }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-box {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 700px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 1rem;
}
.modal-close {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 1rem;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background .2s;
}
.modal-close:hover { background: var(--bg3); }

.modal-settings-btn {
  background: none;
  border: none;
  color: var(--accent2);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all .2s;
  margin-left: auto;
}
.modal-settings-btn:hover {
  background: var(--bg3);
  transform: rotate(20deg);
}

.modal-body { padding: 20px; display: flex; flex-direction: column; gap: 24px; }

/* Settings Modal Styles */
.settings-modal-box {
  max-width: 700px;
  max-height: 85vh;
  overflow-y: auto;
}

.settings-modal-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.settings-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}

.settings-tab {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 6px 6px 0 0;
  border-bottom: 2px solid transparent;
  transition: all .2s;
  font-weight: 500;
}

.settings-tab:hover {
  color: var(--text);
  background: var(--bg3);
}

.settings-tab.active {
  color: var(--accent2);
  border-bottom-color: var(--accent2);
  background: transparent;
}

.settings-content {
  display: none;
  flex-direction: column;
  gap: 16px;
}

.settings-content.active {
  display: flex;
}

.settings-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.settings-group label {
  font-size: .9rem;
  font-weight: 500;
  color: var(--text);
}

.settings-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.settings-input-wrapper input {
  width: 100%;
}

.settings-toggle-password {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: var(--text-dim);
  padding: 4px 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color .2s;
}

.settings-toggle-password:hover {
  color: var(--text);
}

.settings-group input,
.settings-group select {
  padding: 8px 12px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: 'Courier New', monospace;
  font-size: .85rem;
}

.settings-input-wrapper input[type="password"],
.settings-input-wrapper input[type="text"] {
  padding-right: 40px;
}

.settings-group input:focus,
.settings-group select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(88,86,214,.2);
}

.settings-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.settings-hint {
  font-size: .75rem;
  color: var(--text-dim);
  margin-top: 2px;
}

.settings-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  margin-top: 16px;
}

.btn-save,
.btn-cancel {
  padding: 8px 16px;
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s;
  border: 1px solid var(--border);
}

.btn-save {
  background: rgba(88,86,214,.2);
  color: var(--accent2);
}

.btn-save:hover {
  background: rgba(88,86,214,.35);
  border-color: var(--accent);
}

.btn-cancel {
  background: transparent;
  color: var(--text-dim);
}

.btn-cancel:hover {
  background: var(--bg3);
  color: var(--text);
}

/* Password Toggle Button */
.password-toggle-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  padding: 4px 8px;
  opacity: 0.6;
  transition: opacity .2s;
}

.password-toggle-btn:hover {
  opacity: 1;
}

.modal-body { padding: 20px; display: flex; flex-direction: column; gap: 24px; }

.preview-modal-box {
  max-width: 860px;
}

.preview-modal-body {
  padding-top: 14px;
}

.preview-modal-player {
  width: 100%;
  max-height: 72vh;
  background: #000;
  border-radius: 10px;
}

.provider-section { display: flex; flex-direction: column; gap: 10px; }
.provider-section-title { font-size: .9rem; font-weight: 700; }
.provider-note { font-size: .75rem; color: var(--text-dim); }
.provider-list { display: flex; flex-direction: column; gap: 6px; }
.provider-loading { font-size: .82rem; color: var(--text-dim); padding: 8px 0; }

.provider-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: .83rem;
}
.provider-item.active  { border-color: rgba(34,197,94,.4); }
.provider-item.inactive{ border-color: var(--border); opacity: .55; }
.pi-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.provider-item.active  .pi-dot { background: var(--green); box-shadow: 0 0 5px var(--green); }
.provider-item.inactive .pi-dot { background: var(--text-dim); }
.pi-name { font-weight: 600; min-width: 110px; }
.pi-label { color: var(--text-dim); font-size: .78rem; flex: 1; }
.pi-badge {
  font-size: .7rem;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 600;
}
.pi-badge.configured { background: rgba(34,197,94,.15); color: var(--green); }
.pi-badge.missing    { background: rgba(234,179,8,.12);  color: var(--yellow); }
.pi-badge.free       { background: rgba(108,99,255,.15); color: var(--accent2); }
.pi-badge.checking   { background: rgba(59,130,246,.15); color: #3b82f6; animation: pulse 1.5s ease-in-out infinite; }
.pi-badge.invalid    { background: rgba(239,68,68,.15); color: var(--red); }
.pi-badge.rate_limited { background: rgba(234,179,8,.15); color: var(--yellow); }

/* Provider quota bar (ElevenLabs) */
.pi-quota {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .72rem;
  color: var(--text-dim);
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px dashed var(--border);
}
.pi-quota .quota-bar {
  width: 80px;
  height: 6px;
  background: var(--bg3);
  border-radius: 3px;
  overflow: hidden;
}
.pi-quota .quota-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--accent));
  border-radius: 3px;
  transition: width 0.3s ease;
}
.pi-quota small {
  color: var(--text-dim);
  opacity: 0.7;
}
.pi-quota-info {
  flex-wrap: wrap;
}
.pi-quota .quota-tier {
  background: rgba(108,99,255,.15);
  color: var(--accent2);
  padding: 1px 6px;
  border-radius: 8px;
  font-weight: 600;
  text-transform: uppercase;
  font-size: .65rem;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Provider item layout for quota */
.provider-item {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--green);
  border-radius: 10px;
  background: rgba(34,197,94,.05);
  transition: all .2s;
}

/* Provider links grid */
.provider-links { border-top: 1px solid var(--border); padding-top: 16px; }
.links-title { font-size: .85rem; font-weight: 700; margin-bottom: 12px; }
.links-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.link-card {
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  text-decoration: none;
  color: var(--text);
  transition: all .2s;
}
.link-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.link-card strong { font-size: .85rem; }
.link-card small  { font-size: .72rem; color: var(--text-dim); line-height: 1.4; }
.link-card.groq      { border-left: 3px solid #f97316; }
.link-card.gemini    { border-left: 3px solid #4285f4; }
.link-card.github    { border-left: 3px solid #8b949e; }
.link-card.pexels    { border-left: 3px solid #05a081; }
.link-card.elevenlabs{ border-left: 3px solid #a855f7; }
.link-card.azure     { border-left: 3px solid #0078d4; }
.link-card.piper     { border-left: 3px solid #ff6b35; }
.link-card.ollama    { border-left: 3px solid #22c55e; }

/* ── FLOATING QUEUE MONITOR ───────────────────────---- */
.queue-monitor {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,.6);
  z-index: 1000;
  min-width: 280px;
  max-width: 360px;
  overflow: hidden;
  transition: transform .3s, box-shadow .3s;
}

.queue-monitor:hover {
  box-shadow: 0 12px 48px rgba(108,99,255,.2);
  border-color: var(--accent);
}

.queue-monitor-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--bg3) 0%, rgba(108,99,255,.05) 100%);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
  transition: background .2s;
}

.queue-monitor-header:hover {
  background: linear-gradient(135deg, var(--bg3) 0%, rgba(108,99,255,.1) 100%);
}

.queue-icon { 
  font-size: 1.3rem;
  display: flex;
  align-items: center;
}

.queue-title {
  flex: 1;
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: 0.3px;
}

.queue-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: .8rem;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(108,99,255,.4);
}

.queue-toggle {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0 4px;
  transition: transform .2s, color .2s;
  display: flex;
  align-items: center;
}

.queue-toggle:hover {
  color: var(--accent);
}

.queue-monitor.expanded .queue-toggle {
  transform: rotate(180deg);
}

/* Queue panel (expanded view) */
.queue-panel {
  padding: 16px;
  max-height: 420px;
  animation: slideUp .2s ease-out;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: hidden;
}

.queue-panel.hidden {
  display: none;
}

@keyframes slideUp {
  from { transform: translateY(10px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes slideDown {
  from { transform: translateY(-10px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes slideIn {
  from { transform: translateX(-10px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Queue stats */
.queue-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 12px;
  background: linear-gradient(135deg, rgba(108,99,255,.08) 0%, rgba(108,99,255,.03) 100%);
  border-radius: 8px;
  border: 1px solid rgba(108,99,255,.2);
}

.stat-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-label {
  font-size: .75rem;
  color: var(--text-dim);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--accent);
}

.stat-max {
  font-size: .75rem;
  color: var(--text-dim);
  font-weight: 500;
}

/* Queue jobs list */
.queue-jobs {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 60px;
  max-height: 280px;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  padding-right: 4px;
}

.queue-jobs::-webkit-scrollbar {
  width: 6px;
}

.queue-jobs::-webkit-scrollbar-track {
  background: transparent;
}

.queue-jobs::-webkit-scrollbar-thumb {
  background: rgba(108,99,255,.2);
  border-radius: 3px;
}

.queue-jobs::-webkit-scrollbar-thumb:hover {
  background: rgba(108,99,255,.4);
}

.queue-empty {
  text-align: center;
  padding: 20px 12px;
  color: var(--text-dim);
  font-size: .85rem;
  font-style: italic;
}

/* Individual job item */
.queue-job {
  padding: 11px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: all .2s;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.queue-job:hover {
  border-color: var(--accent);
  background: rgba(108,99,255,.05);
}

.queue-job.running {
  border-left: 3px solid var(--green);
}

.queue-job.queued {
  border-left: 3px solid var(--yellow);
  opacity: 0.7;
}

.job-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: .7rem;
  font-weight: 600;
  width: fit-content;
}

.job-status-badge.running {
  background: rgba(34,197,94,.15);
  color: var(--green);
}

.job-status-badge.queued {
  background: rgba(234,179,8,.12);
  color: var(--yellow);
}

.job-name {
  font-size: .9rem;
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
  line-height: 1.3;
}

.job-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .75rem;
}

.job-progress-bar {
  flex: 1;
  height: 5px;
  background: var(--border);
  border-radius: 2.5px;
  overflow: hidden;
}

.job-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  animation: progress 2s ease-in-out infinite;
}

.job-progress-percent {
  color: var(--text-dim);
  min-width: 35px;
  text-align: right;
  font-weight: 600;
}

@keyframes progress {
  0% { opacity: 0.6; }
  50% { opacity: 1; }
  100% { opacity: 0.6; }
}

/* ── Hook & CTA Styling ────────────────────────────── */
.hookCTA-section {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 12px;
}

.hookCTA-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-weight: 600;
  color: var(--text);
  font-size: .95rem;
}

.hookCTA-regenerate {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: .8rem;
  transition: all .2s;
}

.hookCTA-regenerate:hover {
  background: rgba(88,86,214,.1);
  border-color: var(--accent);
  color: var(--accent);
}

.hookCTA-input-group {
  margin-bottom: 10px;
}

.hookCTA-textarea {
  width: 100%;
  min-height: 60px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg3);
  color: var(--text);
  font-family: inherit;
  font-size: .9rem;
  resize: vertical;
  transition: all .2s;
  margin-bottom: 6px;
}

.hookCTA-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(88,86,214,.2);
}

.hookCTA-info {
  font-size: .75rem;
  color: var(--text-dim);
  padding: 0 6px;
}

.hookCTA-examples {
  font-size: .8rem;
  color: var(--text-dim);
  margin-top: 8px;
  padding: 8px;
  background: rgba(88,86,214,.05);
  border-radius: 4px;
  border-left: 2px solid var(--accent);
}

.hookCTA-examples strong {
  display: block;
  margin-bottom: 4px;
  color: var(--text);
}

.hookCTA-examples li {
  margin-left: 16px;
  margin-bottom: 4px;
}

.hookCTA-action {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: .9rem;
}

.hookCTA-action label {
  font-weight: 600;
  color: var(--text);
}

.hookCTA-select {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg3);
  color: var(--text);
  cursor: pointer;
  font-size: .9rem;
  transition: all .2s;
}

.hookCTA-select:hover,
.hookCTA-select:focus {
  border-color: var(--accent);
  outline: none;
}


/* Cancel button in job item */
.queue-job {
  position: relative;
}

.btn-cancel-job {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  background: rgba(239,68,68,.1);
  color: var(--red);
  border-radius: 4px;
  cursor: pointer;
  font-size: .9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all .2s;
}

.queue-job:hover .btn-cancel-job {
  opacity: 1;
}

.btn-cancel-job:hover {
  background: rgba(239,68,68,.2);
  transform: scale(1.1);
}

.btn-cancel-job:active {
  transform: scale(0.95);
}

/* Animations */
@keyframes spin  { to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:.4; } }

/* ── SIDEBAR NAVIGATION ──────────────── */
.sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 8px 12px;
  margin-right: 16px;
  transition: color 0.3s;
}

.sidebar-toggle:hover {
  color: var(--accent);
}

/* ── MOBILE MENU (FLOATING BUTTON) ──── */
.mobile-menu-btn {
  display: none;
  position: fixed;
  left: 16px;
  bottom: 16px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  z-index: 300;
  box-shadow: 0 4px 12px rgba(108, 99, 255, 0.4);
  transition: all 0.3s;
}

.mobile-menu-btn:active {
  transform: scale(0.95);
}

.mobile-menu-dropdown {
  display: none;
  position: fixed;
  left: 16px;
  bottom: 72px;
  width: calc(100vw - 32px);
  max-width: 220px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  z-index: 299;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  animation: slideUp 0.3s ease-out;
}

.mobile-menu-dropdown.open {
  display: block;
}

.mobile-menu-list {
  list-style: none;
  padding: 8px 0;
  margin: 0;
}

.mobile-menu-link {
  display: block;
  padding: 12px 16px;
  color: var(--text);
  text-decoration: none;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

.mobile-menu-link:hover {
  background: rgba(108, 99, 255, 0.1);
  color: var(--accent);
  border-left-color: var(--accent);
}

.mobile-menu-link.active {
  background: rgba(108, 99, 255, 0.2);
  color: var(--accent);
  border-left-color: var(--accent);
}

.sidebar {
  position: fixed;
  left: -280px;
  top: 0;
  width: 280px;
  height: 100vh;
  background: var(--bg3);
  border-right: 1px solid var(--border);
  z-index: 200;
  transition: left 0.3s ease-out;
  display: flex;
  flex-direction: column;
  padding-top: 70px;
  overflow-y: auto;
}

.sidebar.open {
  left: 0;
}

.sidebar-close {
  position: absolute;
  top: 20px;
  right: 16px;
  display: none;
}

.sidebar-close-btn {
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
}

.sidebar-item {
  margin: 0;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
  font-weight: 500;
}

.sidebar-link:hover {
  background: var(--bg2);
  color: var(--accent);
}

.sidebar-link.active {
  background: var(--accent);
  color: white;
}

.sidebar-icon {
  font-size: 1.2rem;
  display: flex;
  align-items: center;
}

.sidebar-label {
  flex: 1;
}

.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 150;
  display: none;
  transition: display 0.3s;
}

.sidebar-overlay.visible {
  display: block;
}

/* ── ROUTE CONTENT ──────────────────── */
.route-content {
  display: contents;
}

.route-content.hidden {
  display: none;
}

.route-content.active {
  display: contents;
}

/* ── RESPONSIVE SIDEBAR ─────────────── */
@media (max-width: 1200px) {
  .sidebar {
    display: none;
  }
  
  .mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .sidebar-close {
    display: none;
  }
}

/* Animations */
@keyframes spin  { to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:.4; } }

/* ── RESPONSIVE ───────────────────────── */
@media (max-width: 768px) {
  /* Hide desktop hamburger on mobile */
  .sidebar-toggle {
    display: none;
  }
  
  /* Show floating menu button on mobile */
  .mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  /* Header responsive */
  .header {
    padding: 10px 12px;
  }
  
  .header-inner {
    gap: 8px;
  }
  
  .logo {
    font-size: 0.9rem;
  }
  
  .logo-icon {
    font-size: 1rem;
  }
  
  .badge {
    font-size: 8px;
    padding: 1px 4px;
  }
  
  .header-status {
    font-size: 0.75rem;
    gap: 4px;
  }
  
  .btn-providers {
    padding: 6px 10px;
    font-size: 0.75rem;
  }
  
  /* Form responsive */
  .section-title {
    font-size: 0.85rem;
    margin-bottom: 14px;
  }
  
  .form-group {
    margin-bottom: 14px;
  }
  
  label {
    font-size: 0.85rem;
  }
  
  input, select, textarea {
    font-size: 0.9rem !important;
  }
  
  .btn {
    font-size: 0.85rem;
    padding: 10px 16px;
  }
  
  /* Main responsive */
  .main {
    grid-template-columns: 1fr;
    padding: 16px;
    gap: 16px;
  }
  
  .panel {
    padding: 16px;
  }
  
  .panel-form {
    position: static;
  }
  
  .pipeline-bar {
    gap: 0;
    padding: 8px 6px;
    flex-wrap: wrap;
    overflow-x: visible;
    justify-content: center;
  }
  
  .pipe-step {
    min-width: 36px;
    padding: 4px;
    font-size: 0.62rem;
  }
  .pipe-arrow { display: none; }
}

@media (max-width: 480px) {
  /* Extra small phones */
  .header {
    padding: 8px 8px;
  }
  
  .header-inner {
    gap: 4px;
  }
  
  .logo-icon {
    font-size: 0.9rem;
  }
  
  .logo {
    font-size: 0.75rem;
  }
  
  .badge {
    display: none;
  }
  
  .header-status {
    font-size: 0.65rem;
    gap: 3px;
  }
  
  #serverStatusText {
    display: none;
  }
  
  .btn-providers {
    padding: 4px 6px;
    font-size: 0.65rem;
  }
  
  .main {
    padding: 12px;
    gap: 12px;
  }
  
  .panel {
    padding: 12px;
  }
  
  .section-title {
    font-size: 0.75rem;
    margin-bottom: 10px;
  }
  
  input, select, textarea {
    font-size: 16px !important;
  }
  
  .btn {
    font-size: 0.8rem;
    padding: 8px 12px;
  }
}

/* Login mobile provider layout */
@media (max-width: 768px) {
  body.is-login .main {
    padding: 12px;
  }

  body.is-login #route-Login {
    gap: 12px;
  }

  body.is-login .provider-block-desc {
    font-size: 0.74rem;
    line-height: 1.35;
  }

  body.is-login .provider-item {
    grid-template-columns: auto minmax(56px, auto) 1fr auto;
    gap: 6px;
    padding: 9px 10px;
    font-size: 0.76rem;
  }

  body.is-login .pi-name {
    min-width: 0;
    max-width: 72px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.is-login .pi-label {
    min-width: 0;
    font-size: 0.7rem;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.is-login .pi-badge {
    font-size: 0.64rem;
    padding: 2px 6px;
    white-space: nowrap;
  }
}

@media (max-width: 480px) {
  body.is-login .provider-item {
    grid-template-columns: auto 1fr auto;
    align-items: start;
  }

  body.is-login .pi-name {
    max-width: none;
  }

  body.is-login .pi-label {
    grid-column: 2 / -1;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  body.is-login .pi-badge {
    grid-column: 3;
    grid-row: 1;
  }
}

/* ══════════════════════════════════════════════════════════════════════════════
   MODULE-SPECIFIC STYLES
   
   Clipper Generator, Content Generator, and Caption Generator specific styles
   have been moved to separate CSS files for better modularity:
   
   - style-clipperGenerator.css
   - style-contentGenerator.css
   - style-captionGenerator.css
   
   This keeps the main CSS focused on common/global styles only.
   ══════════════════════════════════════════════════════════════════════════════ */

/* ══════════════════════════════════════════════════════════════════════════════
   BLOG GENERATOR STYLES
   ══════════════════════════════════════════════════════════════════════════════ */

/* Live Progress Area */
.blog-progress-area {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
  animation: fadeIn 0.3s ease-in-out;
}

.blog-progress-area.hidden {
  display: none;
}

.blog-progress-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  font-weight: 600;
  color: var(--accent);
  font-size: 0.9rem;
}

.blog-progress-track {
  width: 100%;
  height: 4px;
  background: var(--bg-secondary);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 12px;
}

.blog-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--primary));
  transition: width 0.3s ease;
  border-radius: 2px;
}

.blog-progress-steps {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.75rem;
}

.progress-step {
  padding: 6px 12px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-dim);
  transition: all 0.3s ease;
  white-space: nowrap;
}

.progress-step.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  font-weight: 600;
  animation: pulse 0.6s ease-in-out;
}

.progress-step.completed {
  background: rgba(34, 197, 94, 0.2);
  border-color: var(--green);
  color: var(--green);
}

.blog-theme-selector {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}

.blog-theme-selector .form-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--text);
}

.blog-theme-selector .form-select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.blog-theme-selector .form-select:hover {
  border-color: var(--blue);
}

.blog-theme-selector .form-select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.blog-theme-selector .form-hint {
  display: block;
  margin-top: 6px;
  font-size: 0.85rem;
  color: var(--text-dim);
}

.blog-controls {
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 24px;
}

.blog-control-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.ui-icon {
  width: 16px;
  height: 16px;
  display: inline-block;
  vertical-align: -3px;
  filter: invert(1);
}

.login-input {
  width: 100%;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  padding: 12px 14px;
  font-size: 0.95rem;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.login-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(108,99,255,0.18);
}

.login-server-status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0 14px;
  color: var(--text-dim);
  font-size: 0.9rem;
}

body.is-login #route-Login a {
  color: var(--accent2);
  text-decoration: underline;
  text-underline-offset: 3px;
}
body.is-login #route-Login a:hover {
  color: var(--accent);
}

body.is-login .header,
body.is-login #sidebar,
body.is-login #sidebarOverlay,
body.is-login #mobileMenuBtn,
body.is-login #mobileMenuDropdown,
body.is-login #queueMonitor {
  display: none !important;
}

.provider-block-title { font-weight: 800; margin-bottom: 6px; }
.provider-block-desc { color: var(--text-dim); font-size: 0.85rem; margin-bottom: 10px; }

.btn-icon-only {
  padding: 10px 12px;
  min-width: 0;
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.btn-icon-only .btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.blog-status-bar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 16px;
  background: rgba(0,0,0,0.25);
  border-radius: 8px;
}

.blog-status-item {
  display: flex;
  flex-direction: row;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.status-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.status-value {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 55%;
}

.btn-icon-only[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%);
  background: rgba(0,0,0,0.85);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.12);
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.75rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
  z-index: 10;
}
.btn-icon-only[data-tooltip]:hover::after { opacity: 1; }

.blog-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.2s;
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.stat-icon {
  font-size: 1.8rem;
  line-height: 1;
}

.stat-content {
  flex: 1;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 4px;
}

.blog-section {
  margin-bottom: 24px;
}

.subsection-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.blog-log-container,
.blog-history-container {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  max-height: 350px;
  overflow-y: auto;
}

.blog-log-list,
.blog-history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.blog-log-empty,
.blog-history-empty {
  text-align: center;
  color: var(--text-dim);
  padding: 32px 16px;
  font-size: 0.9rem;
}

.blog-log-item {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  transition: all 0.2s;
  font-size: 0.85rem;
}

.blog-log-item:hover {
  border-color: var(--accent);
}

.blog-log-item.success {
  border-left: 4px solid var(--green);
}

.blog-log-item.error {
  border-left: 4px solid var(--red);
}

.blog-log-item.running {
  border-left: 4px solid var(--accent);
  animation: pulse 1.5s ease-in-out infinite;
}

.blog-log-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 6px;
  gap: 8px;
}

.blog-log-title {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text);
  flex: 1;
  line-height: 1.3;
}

.blog-log-status {
  font-size: 0.7rem;
  padding: 3px 6px;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
  white-space: nowrap;
}

.blog-log-status.success {
  background: rgba(34, 197, 94, 0.15);
  color: var(--green);
}

.blog-log-status.error {
  background: rgba(239, 68, 68, 0.15);
  color: var(--red);
}

.blog-log-status.running {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent);
}

.blog-log-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 6px;
}

.blog-log-meta-item {
  display: flex;
  align-items: center;
  gap: 3px;
}

.blog-history-item {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  grid-template-columns: 60px 1fr auto;
  gap: 12px;
  align-items: center;
  transition: all 0.2s;
  cursor: pointer;
}

.blog-history-item:hover {
  border-color: var(--accent);
  transform: translateX(2px);
  background: var(--bg3);
}

.blog-history-image {
  width: 60px;
  height: 60px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--bg1);
  flex-shrink: 0;
}

.blog-history-content {
  flex: 1;
  min-width: 0;
}

.blog-history-title {
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 3px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.blog-history-desc {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.blog-history-meta {
  display: flex;
  gap: 8px;
  font-size: 0.7rem;
  color: var(--text-dim);
  flex-wrap: wrap;
}

.blog-history-stats {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 0.7rem;
  color: var(--text-dim);
  text-align: right;
  white-space: nowrap;
}

.blog-history-stats strong {
  color: var(--text);
  font-size: 0.85rem;
}

/* Article Detail Panel (Right side) */
.blog-detail-empty {
  text-align: center;
  color: var(--text-dim);
  padding: 80px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 500px;
}

.blog-detail-empty .empty-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

.blog-detail-empty .empty-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}

.blog-detail-empty .empty-desc {
  font-size: 0.9rem;
}

#blogProgressDetails {
  max-height: 500px;
  overflow-y: auto;
  padding: 16px;
  background: rgba(0,0,0,0.02);
  border-radius: 8px;
  margin-top: 12px;
}

#blogProgressDetails > div {
  padding: 8px 12px;
  margin: 4px 0;
  border-radius: 4px;
  font-size: 0.9rem;
  line-height: 1.4;
  animation: slideIn 0.3s ease-out;
}

.blog-detail-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg);
}

.blog-detail-card.hidden {
  display: none;
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

.detail-close-btn {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--text-dim);
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.2s;
}

.detail-close-btn:hover {
  background: var(--bg3);
  color: var(--text);
}

.detail-meta {
  display: flex;
  gap: 12px;
  font-size: 0.75rem;
  color: var(--text-dim);
  flex: 1;
  justify-content: flex-end;
  white-space: nowrap;
}

.detail-id,
.detail-date {
  display: flex;
  align-items: center;
  gap: 4px;
}

.detail-image-container {
  width: 100%;
  height: 160px;
  background: var(--bg3);
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}

.detail-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-content {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
}

.detail-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text);
  line-height: 1.4;
}

.detail-author-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  font-size: 0.85rem;
  color: var(--text-dim);
  flex-wrap: wrap;
  gap: 8px;
}

.detail-author {
  font-weight: 500;
  color: var(--text-dim);
}

.detail-char-count {
  background: var(--bg3);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
}

.detail-body {
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--text);
}

.detail-body h1,
.detail-body h2,
.detail-body h3 {
  font-weight: 700;
  margin-top: 16px;
  margin-bottom: 8px;
  color: var(--text);
}

.detail-body h1 { font-size: 1.15rem; }
.detail-body h2 { font-size: 1.05rem; }
.detail-body h3 { font-size: 0.95rem; }

.detail-body p {
  margin-bottom: 10px;
}

.detail-body ul,
.detail-body ol {
  margin-left: 20px;
  margin-bottom: 10px;
}

.detail-body li {
  margin-bottom: 6px;
}

.detail-body strong {
  font-weight: 700;
  color: var(--primary);
}

.detail-body em {
  font-style: italic;
  color: var(--text-dim);
}

.detail-footer {
  padding: 12px 16px;
  background: var(--bg2);
  border-top: 1px solid var(--border);
  display: flex;
  gap: 12px;
}

.detail-footer .btn {
  flex: 1;
}

/* Responsive Blog Generator */
@media (max-width: 768px) {
  .blog-control-row {
    grid-template-columns: repeat(3, 1fr);
  }

  .blog-control-row .btn {
    width: 100%;
    font-size: 0.85rem;
    padding: 10px 14px;
  }

  .btn-icon-only {
    padding: 10px 12px;
  }

  .blog-status-bar {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    padding: 12px;
  }

  .blog-status-item {
    gap: 8px;
  }

  .status-label {
    font-size: 0.65rem;
  }

  .status-value {
    font-size: 0.85rem;
    max-width: 60%;
  }

  .btn-icon-only[data-tooltip]:hover::after { opacity: 0; }

  .blog-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
  }

  .stat-card {
    padding: 12px;
    gap: 10px;
  }

  .stat-icon {
    font-size: 1.5rem;
  }

  .stat-value {
    font-size: 1.2rem;
  }

  .stat-label {
    font-size: 0.75rem;
  }

  .blog-log-container,
  .blog-history-container {
    max-height: 300px;
    padding: 12px;
  }

  .blog-section {
    margin-bottom: 20px;
  }

  .subsection-title {
    font-size: 0.9rem;
    margin-bottom: 10px;
  }

  .detail-title {
    font-size: 1.1rem;
  }

  .detail-body {
    font-size: 0.85rem;
    line-height: 1.6;
  }
}

/* Responsive */
@media (max-width: 768px) {
  .config-row {
    grid-template-columns: 1fr;
  }

  .transcript-container {
    max-height: 300px;
  }

  .clipper-tabs {
    gap: 4px;
  }

  .clipper-tab-btn {
    padding: 10px 12px;
    font-size: 0.8rem;
  }
}

/* ── AIChat (DT-AIChat clone) ───────────────────────────────────────────── */
#route-AIChat .panel-form,
#route-AIChat .panel-output {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 140px);
  min-height: 0;
}

@media (max-width: 768px) {
  #route-AIChat .panel-form,
  #route-AIChat .panel-output {
    height: auto;
  }
}

.aichat-sidebar {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg3);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.aichat-sidebar-header {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
}

.aichat-conv-list {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: auto;
  min-height: 0;
}

.aichat-conv-item {
  text-align: left;
  border: 1px solid var(--border);
  background: var(--bg2);
  border-radius: 10px;
  padding: 10px;
  cursor: pointer;
}

.aichat-conv-item.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.18);
}

.aichat-conv-title {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 4px;
  color: var(--text);
}

.aichat-conv-preview {
  font-size: 0.8rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.aichat-chat {
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.aichat-messages {
  padding: 14px;
  overflow: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

.aichat-msg { display: flex; flex-direction: column; gap: 6px; }
.aichat-msg-user { align-items: flex-end; }
.aichat-msg-assistant { align-items: flex-start; }

.aichat-msg-bubble-wrap {
  position: relative;
  max-width: 85%;
}

.aichat-msg-bubble {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 12px;
  white-space: pre-wrap;
  line-height: 1.45;
  background: var(--bg2);
}

.aichat-msg-user .aichat-msg-bubble {
  border-color: rgba(99, 102, 241, 0.35);
  background: rgba(99, 102, 241, 0.10);
}

.aichat-msg-meta {
  font-size: 0.72rem;
  color: var(--text-dim);
}

.aichat-msg-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: inline-flex;
  gap: 6px;
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 120ms ease, transform 120ms ease;
  pointer-events: none;
}

.aichat-msg:hover .aichat-msg-actions {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.aichat-action-btn {
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(6px);
  color: var(--text);
  border-radius: 10px;
  padding: 6px 8px;
  font-size: 0.75rem;
  cursor: pointer;
}

.aichat-msg-user .aichat-action-btn {
  background: rgba(99, 102, 241, 0.18);
  border-color: rgba(99, 102, 241, 0.30);
}

.aichat-typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 18px;
}

.aichat-msg-assistant .aichat-msg-bubble .aichat-typing span {
  background: var(--text);
  opacity: 0.7;
}

.aichat-typing span {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--text-dim);
  opacity: 0.6;
  animation: aichatDot 1.2s infinite ease-in-out;
}

.aichat-typing span:nth-child(2) { animation-delay: 0.15s; }
.aichat-typing span:nth-child(3) { animation-delay: 0.30s; }

@keyframes aichatDot {
  0%, 100% { transform: translateY(0); opacity: 0.35; }
  50% { transform: translateY(-3px); opacity: 0.9; }
}

.aichat-composer {
  border-top: 1px solid var(--border);
  background: var(--bg2);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.aichat-composer textarea {
  width: 100%;
  min-height: 72px;
  resize: vertical;
}

.aichat-kb-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--text-dim);
  user-select: none;
}

.aichat-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.aichat-model {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--text-dim);
}

.aichat-model select {
  min-width: 220px;
}

.aichat-msg-meta-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.aichat-copy-btn {
  border: 1px solid var(--border);
  background: var(--bg2);
  color: var(--text);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 0.75rem;
  cursor: pointer;
}

.aichat-composer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.aichat-status {
  font-size: 0.8rem;
  color: var(--text-dim);
}

@media (max-width: 1200px) {
  .aichat-sidebar { min-height: 420px; }
  .aichat-chat { min-height: 520px; }
}
