:root {
  --bg: #0a0c10;
  --bg-elevated: #11151c;
  --surface: #151a23;
  --surface-2: #1b2230;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #f3f5f9;
  --text-2: #b6c0d1;
  --muted: #7d8aa0;
  --primary: #5b8cff;
  --primary-2: #3d6ef5;
  --teal: #2dd4bf;
  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #f87171;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  --font: "Inter", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(900px 480px at 0% -10%, rgba(91, 140, 255, 0.18), transparent 55%),
    radial-gradient(700px 420px at 100% 0%, rgba(45, 212, 191, 0.1), transparent 50%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

.app-shell { min-height: 100vh; }

/* ——— Topbar ——— */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 12, 16, 0.72);
  backdrop-filter: blur(16px) saturate(1.2);
  position: sticky;
  top: 0;
  z-index: 50;
  flex-wrap: wrap;
}
.main-nav {
  display: flex;
  gap: 6px;
  padding: 4px;
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
}
.nav-tab {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.nav-tab:hover { color: var(--text-2); }
.nav-tab.active {
  background: linear-gradient(135deg, rgba(91, 140, 255, 0.35), rgba(45, 212, 191, 0.2));
  color: var(--text);
}
.layout-single {
  grid-template-columns: 1fr;
  max-width: 1100px;
}
.char-gen-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 20px;
}
@media (max-width: 800px) {
  .char-gen-grid { grid-template-columns: 1fr; }
}
.char-gen-form select {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.char-gen-preview {
  min-height: 280px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 12px;
}
.char-gen-preview img {
  max-width: 100%;
  max-height: 420px;
  border-radius: 12px;
  object-fit: cover;
}
.char-lib-grid, .gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}
.gallery-grid {
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.gallery-filter {
  font: inherit;
  font-size: 0.8rem;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
}
.gallery-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(0,0,0,0.65);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.15);
}
.char-lib-card, .gallery-card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.char-lib-card img, .gallery-card video, .gallery-card img {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  background: #0a0c10;
}
.gallery-card video {
  aspect-ratio: 9/16;
  max-height: 360px;
  background: #000;
}
.char-lib-meta, .gallery-meta {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.8rem;
}
.char-lib-meta strong, .gallery-meta strong {
  font-size: 0.88rem;
}
.char-lib-meta span, .gallery-meta span {
  color: var(--muted);
  font-size: 0.72rem;
}
.char-lib-actions, .gallery-actions {
  display: flex;
  gap: 6px;
  padding: 0 10px 10px;
  flex-wrap: wrap;
}
.char-lib-actions .btn, .gallery-actions .btn {
  font-size: 0.72rem;
  padding: 6px 10px;
}
.btn-danger {
  border-color: rgba(248, 113, 113, 0.45) !important;
  color: #fecaca !important;
  background: rgba(248, 113, 113, 0.1) !important;
}
.btn-danger:hover:not(:disabled) {
  background: rgba(248, 113, 113, 0.22) !important;
}

/* ——— Story 4-scene ——— */
.story-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 700px) {
  .story-form-row { grid-template-columns: 1fr; }
}
.story-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
  margin: 8px 0 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.story-scene-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
@media (max-width: 1100px) {
  .story-scene-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .story-scene-grid { grid-template-columns: 1fr; }
}
.scene-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.scene-card.ready {
  border-color: rgba(52, 211, 153, 0.35);
}
.scene-card.missing-still {
  border-color: rgba(251, 191, 36, 0.35);
}
.scene-card-head {
  padding: 10px 12px 6px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
}
.scene-card-head strong {
  font-size: 0.86rem;
}
.scene-card-head span {
  font-size: 0.68rem;
  color: var(--muted);
  font-family: var(--mono);
}
.scene-portrait {
  aspect-ratio: 9 / 16;
  width: 100%;
  background: #0a0c10;
  display: grid;
  place-items: center;
  overflow: hidden;
  position: relative;
}
.scene-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.scene-portrait .ph {
  color: var(--muted);
  font-size: 0.78rem;
  padding: 12px;
  text-align: center;
}
.scene-beat {
  padding: 8px 12px;
  font-size: 0.75rem;
  color: var(--text-2);
  line-height: 1.4;
  min-height: 3.2em;
}
.scene-actions {
  padding: 0 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.scene-actions .btn {
  width: 100%;
  justify-content: center;
  font-size: 0.75rem;
  padding: 8px 10px;
}
.scene-card video {
  width: 100%;
  max-height: 180px;
  background: #000;
}
/* ——— MV (music video) landscape stills ——— */
.mv-project-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}
.mv-project-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}
.mv-project-row.active-mv {
  border-color: rgba(96, 165, 250, 0.45);
}
.mv-project-row .mv-proj-main {
  flex: 1 1 200px;
  min-width: 0;
}
.mv-project-row .mv-proj-main strong {
  display: block;
  font-size: 0.9rem;
}
.mv-project-row .mv-proj-main .micro {
  color: var(--muted);
  margin-top: 2px;
}
.mv-project-row .mv-proj-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.mv-project-row .pill-mini {
  font-size: 0.68rem;
  font-family: var(--mono);
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  white-space: nowrap;
}
.mv-project-row .pill-mini.ok {
  color: var(--ok, #34d399);
  border-color: rgba(52, 211, 153, 0.35);
}
.mv-project-row .pill-mini.run {
  color: #60a5fa;
  border-color: rgba(96, 165, 250, 0.4);
}

.mv-shot-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 12px;
}
@media (max-width: 900px) {
  .mv-shot-grid { grid-template-columns: 1fr; }
}
.mv-shot-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.mv-shot-card.ready {
  border-color: rgba(52, 211, 153, 0.35);
}
.mv-shot-card.missing-still {
  border-color: rgba(251, 191, 36, 0.35);
}
.mv-shot-head {
  padding: 10px 12px 6px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  align-items: baseline;
}
.mv-shot-head strong {
  font-size: 0.86rem;
}
.mv-shot-head .tags {
  font-size: 0.68rem;
  color: var(--muted);
  font-family: var(--mono);
}
.mv-landscape {
  aspect-ratio: 16 / 9;
  width: 100%;
  background: #0a0c10;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.mv-landscape img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.mv-landscape .ph {
  color: var(--muted);
  font-size: 0.78rem;
  padding: 12px;
  text-align: center;
}
.mv-shot-card .scene-edit-fields {
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.mv-shot-card textarea,
.mv-shot-card select {
  width: 100%;
  font-size: 0.78rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 8px 10px;
  resize: vertical;
}
.mv-meta-box {
  margin-top: 8px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--text-2);
}
.mv-meta-box strong {
  color: var(--text);
}

.story-thumb-box {
  margin: 16px 0 20px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}
.story-thumb-layout {
  display: grid;
  grid-template-columns: minmax(140px, 200px) 1fr;
  gap: 16px;
  align-items: start;
  margin-top: 10px;
}
@media (max-width: 700px) {
  .story-thumb-layout { grid-template-columns: 1fr; }
}
.story-thumb-preview {
  aspect-ratio: 9 / 16;
  border-radius: 12px;
  overflow: hidden;
  background: #0a0a0a;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}
.story-thumb-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.story-thumb-preview .ph {
  color: var(--text-2);
  font-size: 0.78rem;
  text-align: center;
  padding: 12px;
  line-height: 1.4;
}
/* DJ still preview: match project aspect (default 9:16 via .story-thumb-preview) */
#djStillPreview.dj-preview-port {
  aspect-ratio: 9 / 16;
  max-width: 220px;
}
#djStillPreview.dj-preview-land {
  aspect-ratio: 16 / 9;
  max-width: 100%;
  width: 100%;
}
#djWorkspace .story-thumb-layout:has(#djStillPreview.dj-preview-land) {
  grid-template-columns: 1fr;
}
.story-thumb-fields .field { margin-bottom: 8px; }
.story-thumb-fields input,
.story-thumb-fields textarea {
  width: 100%;
  font: inherit;
  font-size: 0.84rem;
}

.story-script-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
@media (max-width: 800px) {
  .story-script-grid { grid-template-columns: 1fr; }
}
.story-script-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
  padding: 12px;
}
.story-script-card textarea {
  font-size: 0.82rem;
}
.story-ai-help {
  margin: 14px 0 8px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px dashed var(--border-strong);
  background: rgba(255,255,255,0.02);
  color: var(--text-2);
  font-size: 0.84rem;
}
.story-ai-help summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
}
.scene-edit-fields {
  padding: 0 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.scene-edit-fields textarea {
  width: 100%;
  font: inherit;
  font-size: 0.72rem;
  color: var(--text);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  resize: vertical;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 1.05rem;
  color: white;
  background: linear-gradient(145deg, #5b8cff 0%, #2dd4bf 100%);
  box-shadow: 0 8px 20px rgba(91, 140, 255, 0.35);
}
.brand-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
}
.brand-sub {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 2px;
}
.status-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.72rem;
  font-weight: 500;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
}
.pill .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.85;
}
.pill-ok { color: var(--ok); border-color: rgba(52, 211, 153, 0.28); background: rgba(52, 211, 153, 0.08); }
.pill-bad { color: var(--danger); border-color: rgba(248, 113, 113, 0.3); background: rgba(248, 113, 113, 0.08); }
.pill-muted { color: var(--muted); }

/* ——— Layout ——— */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 22px;
  max-width: 1320px;
  margin: 0 auto;
  padding: 24px 28px 48px;
}
@media (max-width: 1024px) {
  .layout { grid-template-columns: 1fr; padding: 16px; }
  .topbar { padding: 12px 16px; }
}

/* ——— Cards ——— */
.card {
  background: linear-gradient(180deg, rgba(27, 34, 48, 0.92), rgba(17, 21, 28, 0.96));
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  box-shadow: var(--shadow);
  padding: 22px 22px 20px;
}
.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.eyebrow {
  margin: 0 0 4px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--teal);
}
.card-title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.step-chip {
  font-size: 0.7rem;
  font-weight: 600;
  font-family: var(--mono);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 8px;
  background: var(--bg-elevated);
}
.lead {
  margin: 0 0 22px;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--text-2);
}
.lead.muted { color: var(--muted); }
.lead code, .micro code {
  font-family: var(--mono);
  font-size: 0.78em;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 5px;
  color: var(--text-2);
}

/* ——— Sections ——— */
.section { margin-bottom: 22px; }
.section-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
}
.section-label > span:first-child {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
}
.section-hint {
  font-size: 0.72rem;
  color: var(--muted);
}

/* ——— Themes ——— */
.theme-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
@media (max-width: 560px) {
  .theme-grid { grid-template-columns: 1fr; }
}
.theme-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 12px 12px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}
.theme-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}
.theme-card.selected {
  border-color: rgba(91, 140, 255, 0.55);
  background: linear-gradient(145deg, rgba(91, 140, 255, 0.12), rgba(45, 212, 191, 0.05));
  box-shadow: inset 0 0 0 1px rgba(91, 140, 255, 0.15);
}
.theme-card input { display: none; }
.theme-icon {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  position: relative;
}
.theme-icon::after {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 4px;
  background: var(--primary);
  opacity: 0.85;
}
.theme-icon[data-theme="doa"]::after {
  background: linear-gradient(135deg, #a78bfa, #2dd4bf);
  border-radius: 50%;
}
.theme-icon[data-theme="cctv"]::after {
  background: linear-gradient(135deg, #64748b, #94a3b8);
  box-shadow: 0 0 0 2px rgba(148,163,184,0.3);
}
.theme-icon[data-theme="miniatur"]::after {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
}
.theme-icon[data-theme="jualan"]::after {
  background: linear-gradient(135deg, #22c55e, #eab308);
}
.theme-icon[data-theme="nasehat"]::after {
  background: linear-gradient(135deg, #38bdf8, #a78bfa);
  border-radius: 6px;
}
.theme-body strong {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 3px;
}
.theme-body p {
  margin: 0 0 8px;
  font-size: 0.74rem;
  line-height: 1.4;
  color: var(--muted);
}
.theme-meta {
  display: flex;
  gap: 6px;
}
.theme-meta span {
  font-size: 0.65rem;
  font-weight: 600;
  font-family: var(--mono);
  color: var(--text-2);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 6px;
}

/* ——— Characters ——— */
.char-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 10px;
}
.char-card {
  display: block;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.char-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
}
.char-card.selected {
  border-color: rgba(45, 212, 191, 0.65);
  box-shadow: 0 0 0 1px rgba(45, 212, 191, 0.35), 0 10px 24px rgba(0,0,0,0.35);
}
.char-card input { display: none; }
.char-thumb {
  position: relative;
  aspect-ratio: 3 / 3.6;
  background: #0d1117;
  overflow: hidden;
}
.char-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.char-thumb.missing {
  background: repeating-linear-gradient(
    -45deg,
    #1a1f2a,
    #1a1f2a 8px,
    #12161e 8px,
    #12161e 16px
  );
}
.char-card .check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.35);
  background: rgba(0,0,0,0.35);
  opacity: 0;
  transition: opacity 0.15s;
}
.char-card.selected .check {
  opacity: 1;
  border-color: transparent;
  background: var(--teal);
  box-shadow: 0 0 0 2px rgba(0,0,0,0.25);
}
.char-card.selected .check::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 3px;
  width: 5px;
  height: 9px;
  border: solid #042f2e;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.char-meta {
  padding: 8px 9px 10px;
}
.char-meta strong {
  display: block;
  font-size: 0.74rem;
  font-weight: 600;
  line-height: 1.25;
  margin-bottom: 2px;
}
.char-meta span {
  font-size: 0.62rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ——— Doa ——— */
.doa-panel {
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(167, 139, 250, 0.2);
  background: linear-gradient(160deg, rgba(167, 139, 250, 0.08), rgba(45, 212, 191, 0.04));
}
.stats-bar {
  font-size: 0.75rem;
  color: var(--text-2);
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 11px;
  margin-bottom: 10px;
  font-family: var(--mono);
}
.doa-list {
  max-height: 200px;
  overflow: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  margin-bottom: 10px;
}
.doa-list::-webkit-scrollbar { width: 8px; }
.doa-list::-webkit-scrollbar-thumb {
  background: #2a3344;
  border-radius: 8px;
}
.doa-item {
  display: block;
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s;
}
.doa-item:last-child { border-bottom: none; }
.doa-item:hover { background: rgba(255,255,255,0.03); }
.doa-item.selected {
  background: rgba(91, 140, 255, 0.1);
  box-shadow: inset 3px 0 0 var(--primary);
}
.doa-item strong {
  display: block;
  font-size: 0.84rem;
  font-weight: 600;
  margin-bottom: 3px;
}
.doa-item small {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.4;
  margin-top: 2px;
}
.micro {
  margin: 10px 0 0;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.45;
}

/* ——— Fields ——— */
.field {
  display: block;
  margin-bottom: 12px;
}
.field-label {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 7px;
}
.field-label em {
  font-style: normal;
  font-weight: 500;
  font-size: 0.7rem;
  color: var(--muted);
}
.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
select,
textarea,
input[type="text"],
input[type="number"] {
  width: 100%;
  appearance: none;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  font: inherit;
  font-size: 0.88rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%237d8aa0' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
select:focus,
textarea:focus,
input:focus {
  outline: none;
  border-color: rgba(91, 140, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(91, 140, 255, 0.15);
}
textarea {
  min-height: 68px;
  resize: vertical;
  line-height: 1.45;
}
.input-affix {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.input-affix:focus-within {
  border-color: rgba(91, 140, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(91, 140, 255, 0.15);
}
.input-affix input {
  border: none;
  box-shadow: none !important;
  border-radius: 0;
  flex: 1;
}
.input-affix span {
  padding: 0 12px;
  font-size: 0.75rem;
  color: var(--muted);
  border-left: 1px solid var(--border);
  white-space: nowrap;
}

/* ——— Buttons ——— */
.btn-row, .actions, .compose-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.compose-footer {
  justify-content: flex-end;
  padding-top: 4px;
  margin-bottom: 18px;
}
/* Step 2: tombol Generate selalu kelihatan di bawah form */
.compose-footer-sticky {
  position: sticky;
  bottom: 0;
  z-index: 20;
  margin: 16px -8px 0;
  padding: 14px 12px;
  background: linear-gradient(180deg, rgba(17, 21, 28, 0.55), rgba(17, 21, 28, 0.97) 28%);
  border-top: 1px solid var(--border-strong);
  backdrop-filter: blur(10px);
  border-radius: 0 0 12px 12px;
}
.btn-generate {
  min-width: 220px !important;
  animation: pulse-gen 2.2s ease-in-out 2;
}
@keyframes pulse-gen {
  0%, 100% { box-shadow: 0 8px 22px rgba(61, 110, 245, 0.35); }
  50% { box-shadow: 0 8px 28px rgba(45, 212, 191, 0.55); }
}
.job-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  align-items: center;
}
.job-actions .btn { font-size: 0.8rem; padding: 8px 12px; }
.job-actions .btn-primary { min-width: 140px; }
.resume-banner {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(251, 191, 36, 0.35);
  background: rgba(251, 191, 36, 0.1);
  color: var(--text-2);
  font-size: 0.84rem;
  line-height: 1.45;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}
.resume-banner strong { color: var(--warn); }
.btn {
  appearance: none;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  border-radius: 11px;
  padding: 10px 16px;
  cursor: pointer;
  transition: transform 0.12s, background 0.12s, border-color 0.12s, opacity 0.12s;
}
.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(255,255,255,0.22);
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn-primary {
  border: none;
  color: #fff;
  background: linear-gradient(135deg, #5b8cff 0%, #3d6ef5 55%, #0d9488 140%);
  box-shadow: 0 8px 22px rgba(61, 110, 245, 0.35);
}
.btn-primary:hover:not(:disabled) {
  filter: brightness(1.05);
}
.btn-ghost {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text-2);
}
.btn-lg {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  padding: 11px 18px 10px;
  min-width: 168px;
}
.btn-sub {
  font-size: 0.65rem;
  font-weight: 500;
  opacity: 0.8;
  letter-spacing: 0.02em;
}

/* ——— Log ——— */
.log-wrap {
  border-radius: 12px;
  border: 1px solid var(--border);
  overflow: hidden;
  background: #080a0e;
}
.log-head {
  display: flex;
  justify-content: space-between;
  padding: 8px 12px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
}
.log {
  font-family: var(--mono);
  font-size: 0.72rem;
  line-height: 1.5;
  padding: 12px;
  min-height: 88px;
  max-height: 150px;
  overflow: auto;
  color: #9aa8bd;
  white-space: pre-wrap;
}

/* ——— Jobs ——— */
.jobs {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: calc(100vh - 220px);
  overflow: auto;
  padding-right: 2px;
}
.jobs:empty::after,
.jobs .empty-state {
  display: block;
  text-align: center;
  padding: 36px 16px;
  color: var(--muted);
  font-size: 0.86rem;
  border: 1px dashed var(--border);
  border-radius: 14px;
  background: rgba(255,255,255,0.02);
}
.job {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  background: var(--bg-elevated);
  transition: border-color 0.15s;
}
.job:hover { border-color: var(--border-strong); }
.job .top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
}
.job .top strong {
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.job .meta-line {
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 8px;
  line-height: 1.4;
}
.job .status {
  flex-shrink: 0;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(251, 191, 36, 0.12);
  color: var(--warn);
  border: 1px solid rgba(251, 191, 36, 0.25);
}
.job .status.done {
  background: rgba(52, 211, 153, 0.12);
  color: var(--ok);
  border-color: rgba(52, 211, 153, 0.28);
}
.job .status.error {
  background: rgba(248, 113, 113, 0.12);
  color: var(--danger);
  border-color: rgba(248, 113, 113, 0.28);
}
.job .status.script_ready,
.job .status.queued,
.job .status.scripting,
.job .status.image,
.job .status.video {
  background: rgba(91, 140, 255, 0.12);
  color: #93b4ff;
  border-color: rgba(91, 140, 255, 0.28);
}
.preview {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 12px;
  margin-top: 10px;
  align-items: start;
}
.preview img {
  width: 100%;
  border-radius: 10px;
  background: #000;
  aspect-ratio: 9/16;
  object-fit: cover;
  border: 1px solid var(--border);
}
.preview video {
  grid-column: 1 / -1;
  width: 100%;
  max-height: 380px;
  border-radius: 12px;
  background: #000;
  border: 1px solid var(--border);
}
.script-box {
  font-size: 0.76rem;
  color: var(--text-2);
  line-height: 1.45;
  max-height: 150px;
  overflow: auto;
  white-space: pre-wrap;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 11px;
  margin-top: 8px;
  font-family: var(--mono);
}
.script-box.err {
  color: #fecaca;
  border-color: rgba(248, 113, 113, 0.3);
  background: rgba(248, 113, 113, 0.08);
}

.hidden { display: none !important; }

.hint {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0 0 12px;
  line-height: 1.4;
}

/* ——— Wizard ——— */
.wizard-steps {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
  display: flex;
  gap: 8px;
}
.wizard-steps li {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.2);
}
.wizard-steps li span {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 0.7rem;
  font-weight: 700;
  font-family: var(--mono);
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.wizard-steps li.active {
  color: var(--text);
  border-color: rgba(91, 140, 255, 0.45);
  background: rgba(91, 140, 255, 0.1);
}
.wizard-steps li.active span {
  background: var(--primary);
  border-color: transparent;
  color: #fff;
}
.wizard-steps li.done {
  color: var(--ok);
  border-color: rgba(52, 211, 153, 0.3);
}
.wizard-steps li.done span {
  background: rgba(52, 211, 153, 0.2);
  border-color: transparent;
  color: var(--ok);
}
.wizard-pane { animation: fadeIn 0.2s ease; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

.edit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 14px;
  margin-bottom: 8px;
}
.edit-grid .field-full { grid-column: 1 / -1; }
@media (max-width: 640px) {
  .edit-grid { grid-template-columns: 1fr; }
  .wizard-steps { flex-direction: column; }
}

.rtl-ish {
  direction: rtl;
  text-align: right;
  font-size: 1.05rem;
  line-height: 1.6;
}

.done-box {
  text-align: center;
  padding: 28px 16px 12px;
  border: 1px solid rgba(52, 211, 153, 0.25);
  border-radius: 16px;
  background: linear-gradient(160deg, rgba(52, 211, 153, 0.1), rgba(91, 140, 255, 0.05));
  margin-bottom: 18px;
}
.done-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.4rem;
  font-weight: 700;
  color: #042f2e;
  background: var(--ok);
  box-shadow: 0 8px 24px rgba(52, 211, 153, 0.35);
}
.done-box h3 {
  margin: 0 0 8px;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}
.done-box p {
  margin: 0 auto;
  max-width: 360px;
  font-size: 0.88rem;
  color: var(--text-2);
  line-height: 1.5;
}

.job-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.btn-dl {
  text-decoration: none;
  font-size: 0.8rem !important;
  padding: 8px 14px !important;
}

/* ——— Progress ——— */
.progress-block, .live-progress {
  margin: 10px 0 8px;
}
.progress-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #5b8cff, #2dd4bf);
  box-shadow: 0 0 12px rgba(91, 140, 255, 0.45);
  transition: width 0.45s ease;
}
.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 6px;
  font-size: 0.72rem;
  font-family: var(--mono);
  color: var(--text-2);
}
.stage-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.stage {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: rgba(0,0,0,0.2);
}
.stage.on {
  color: #93b4ff;
  border-color: rgba(91, 140, 255, 0.4);
  background: rgba(91, 140, 255, 0.12);
}
.stage.done {
  color: var(--ok);
  border-color: rgba(52, 211, 153, 0.35);
  background: rgba(52, 211, 153, 0.1);
}
.job-active {
  border-color: rgba(91, 140, 255, 0.45) !important;
  box-shadow: 0 0 0 1px rgba(91, 140, 255, 0.15);
}
.wait-hint {
  font-size: 0.75rem;
  color: var(--muted);
}
.live-progress {
  max-width: 360px;
  margin: 16px auto 0;
  text-align: left;
}

.check-row {
  display: flex !important;
  flex-direction: row !important;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(45, 212, 191, 0.25);
  background: rgba(45, 212, 191, 0.06);
  cursor: pointer;
}
.check-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: #2dd4bf;
  flex-shrink: 0;
}
.check-row strong {
  display: block;
  font-size: 0.88rem;
  margin-bottom: 2px;
}
.check-row em {
  display: block;
  font-style: normal;
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.4;
}


.youtube-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  margin: 12px 0 16px;
  border: 1px solid var(--line, rgba(255,255,255,.12));
  border-radius: 14px;
  background: rgba(255,255,255,.045);
}
.youtube-panel.connected {
  border-color: rgba(34,197,94,.45);
  background: rgba(34,197,94,.08);
}
.youtube-panel.not-connected {
  border-color: rgba(245,158,11,.45);
  background: rgba(245,158,11,.08);
}
.youtube-panel.not-configured {
  border-color: rgba(239,68,68,.45);
  background: rgba(239,68,68,.08);
}
.yt-status-line { margin-top: 2px; }
.yt-actions { justify-content: flex-end; margin: 0; }
@media (max-width: 700px) {
  .youtube-panel { flex-direction: column; align-items: stretch; }
  .yt-actions { justify-content: stretch; }
  .yt-actions .btn { flex: 1; }
}
