/* Must win over any element/class display rule below (e.g. .login-screen,
   .app-shell both set `display`), otherwise toggling the `hidden` property
   in JS has no visible effect — author CSS beats the UA default [hidden]
   rule on a specificity tie. */
[hidden] { display: none !important; }

/* Tema tunggal: navy gelap + teks putih, sengaja tidak mengikuti mode
   terang/gelap sistem — ini tampilan tetap yang diminta, bukan default yang
   bisa berubah sendiri. */
:root {
  color-scheme: dark;
  --bg: #0a1930;             /* navy gelap */
  --panel-bg: #11213c;       /* navy sedikit lebih terang untuk kartu/panel */
  --border: #24405f;
  --text: #ffffff;
  --muted: #a9bdd6;
  --accent: #4a72ad;         /* biru navy terang, kontras di atas navy gelap */
  --accent-text: #ffffff;
  --topbar-bg: #071322;      /* navy paling gelap untuk header */
  --topbar-text: #ffffff;
  --danger: #ef4444;
  --warn-bg: #3a2f0e;
  --warn-text: #fbbf24;
  --ok-bg: #103a1c;
  --ok-text: #4ade80;
  --input-bg: #0f2038;
  --shadow: 0 1px 3px rgba(0,0,0,0.4);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
}
input, textarea, select, button { font-family: inherit; font-size: inherit; }
h1, h2, h3 { margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.full-width { width: 100%; }

/* Login */
.login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-card { background: var(--panel-bg); border: 1px solid var(--border); border-radius: 12px; padding: 32px; width: 100%; max-width: 360px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; }
.login-card label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.login-card input { padding: 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--input-bg); color: var(--text); width: 100%; }
.password-field { position: relative; display: flex; }
.password-field input { padding-right: 84px; }
.password-toggle-btn {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--accent); font-size: 12px; font-weight: 600;
  padding: 6px 8px; cursor: pointer; border-radius: 6px;
}
.password-toggle-btn:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.error-text { color: var(--danger); font-size: 13px; }

/* App shell */
.app-shell { display: flex; flex-direction: column; min-height: 100vh; }
.topbar { display: flex; align-items: center; gap: 16px; padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--topbar-bg); position: sticky; top: 0; z-index: 10; }
.app-brand { display: flex; align-items: center; gap: 10px; }
.brand-icon { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 18px; background: linear-gradient(135deg, #6d5bd0, #4a72ad); flex-shrink: 0; }
.brand-title { font-weight: 700; color: var(--topbar-text); line-height: 1.2; }
.brand-subtitle { font-size: 11px; color: color-mix(in srgb, var(--topbar-text) 60%, transparent); }
.topnav { display: flex; gap: 8px; flex: 1; padding-left: 12px; }
.nav-btn { background: none; border: none; color: color-mix(in srgb, var(--topbar-text) 70%, transparent); padding: 8px 12px; border-radius: 8px; cursor: pointer; }
.nav-btn.active { background: var(--accent); color: var(--accent-text); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar .ghost-btn { border-color: color-mix(in srgb, var(--topbar-text) 35%, transparent); color: var(--topbar-text); }
.user-chip { display: flex; align-items: center; gap: 8px; }
.user-avatar { width: 32px; height: 32px; border-radius: 999px; background: linear-gradient(135deg, #4a72ad, #6d5bd0); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; color: #fff; flex-shrink: 0; }
.user-name { font-size: 12px; font-weight: 600; color: var(--topbar-text); line-height: 1.2; }
.user-role { font-size: 10px; color: color-mix(in srgb, var(--topbar-text) 55%, transparent); }
.ghost-btn { background: none; border: 1px solid var(--border); color: var(--text); padding: 8px 12px; border-radius: 8px; cursor: pointer; }
.icon-btn { background: var(--accent); color: var(--accent-text); border: none; width: 28px; height: 28px; border-radius: 8px; cursor: pointer; font-weight: 700; }
.primary-btn { background: var(--accent); color: var(--accent-text); border: none; padding: 10px 16px; border-radius: 8px; cursor: pointer; font-weight: 600; }
.pill-btn { border: none; border-radius: 999px; padding: 6px 14px; font-size: 13px; font-weight: 600; cursor: pointer; }
/* Tombol "+" buat project baru: emas */
#new-project-btn { background: #d4a017; color: #1b1400; }
/* Tombol "+ Tambah Akun": merah */
.pill-btn-red { background: #dc2626; color: #ffffff; }
.pill-btn-red:hover { background: #b91c1c; }
.pill-btn-green, #add-account-btn { background: #16a34a; color: #ffffff; }
.pill-btn-green:hover, #add-account-btn:hover { background: #15803d; }
button { cursor: pointer; }

/* Footer */
.app-footer { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; border-top: 1px solid var(--border); background: var(--topbar-bg); font-size: 12px; color: var(--muted); }
.footer-right { display: flex; align-items: center; gap: 8px; }
.footer-link { background: none; border: none; color: var(--muted); font-size: 12px; cursor: pointer; padding: 0; text-decoration: underline; }
.footer-dot { opacity: 0.5; }
.status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 999px; background: #4ade80; margin-right: 2px; }

.workspace-grid {
  display: grid;
  grid-template-columns: 260px 1fr 300px;
  gap: 12px;
  padding: 12px;
  flex: 1;
  align-items: start;
}
.panel { background: var(--panel-bg); border: 1px solid var(--border); border-radius: 12px; padding: 14px; }
.panel-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }

.search-box { margin-bottom: 10px; }
.search-box input { width: 100%; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--input-bg); color: var(--text); }

.project-list, .account-list { display: flex; flex-direction: column; gap: 8px; }
.project-item, .account-item { border: 1px solid var(--border); border-radius: 10px; padding: 10px; cursor: pointer; }
.project-item { display: flex; align-items: center; gap: 10px; }
.project-item.active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.project-thumb { width: 40px; height: 40px; border-radius: 8px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; font-size: 15px; }
.project-item .p-name { font-weight: 600; }
.project-item .p-meta { font-size: 12px; color: var(--muted); }

.new-project-card { margin-top: 12px; border: 1px dashed var(--border); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.new-project-card-icon { width: 32px; height: 32px; border-radius: 999px; background: var(--accent); color: var(--accent-text); display: flex; align-items: center; justify-content: center; font-weight: 700; }
.new-project-card .primary-btn { margin-top: 6px; }

.account-item { display: flex; flex-direction: column; gap: 6px; cursor: default; }
.account-item .a-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.account-item .a-top-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.account-avatar { width: 30px; height: 30px; border-radius: 999px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; color: #fff; flex-shrink: 0; }
.account-item .a-email { font-weight: 600; word-break: break-all; }
.account-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.account-actions button { font-size: 12px; padding: 4px 8px; border-radius: 6px; border: 1px solid var(--border); background: none; color: var(--text); }
.account-actions button.activate { background: var(--accent); color: var(--accent-text); border: none; }

.account-menu { position: relative; flex-shrink: 0; }
.account-menu-btn { background: none; border: 1px solid var(--border); border-radius: 6px; width: 26px; height: 26px; color: var(--text); font-weight: 700; }
.account-menu-dropdown { position: absolute; right: 0; top: 30px; background: var(--panel-bg); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); z-index: 20; display: flex; flex-direction: column; min-width: 150px; padding: 4px; }
.account-menu-dropdown button { text-align: left; background: none; border: none; color: var(--text); padding: 8px 10px; border-radius: 6px; font-size: 13px; }
.account-menu-dropdown button:hover { background: var(--bg); }
.account-menu-dropdown button.danger { color: var(--danger); }

.quick-tips-card { margin-top: 14px; border: 1px solid var(--border); border-radius: 10px; padding: 12px; background: var(--bg); }
.quick-tips-title { font-weight: 700; margin-bottom: 8px; }
.quick-tips-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); }

.badge { font-size: 11px; padding: 2px 8px; border-radius: 999px; font-weight: 600; }
.badge-active { background: var(--ok-bg); color: var(--ok-text); }
.badge-warn { background: var(--warn-bg); color: var(--warn-text); }
.badge-muted { background: var(--border); color: var(--muted); }

.project-header { display: flex; gap: 8px; margin-bottom: 10px; }
.project-name-input { flex: 1; font-size: 18px; font-weight: 700; padding: 8px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--text); }
.project-name-input:focus { border-color: var(--border); background: var(--input-bg); }
select, .project-header select { padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--input-bg); color: var(--text); }

.continuity-box { border: 1px solid var(--border); border-radius: 10px; padding: 10px; margin-bottom: 12px; }
.continuity-box summary { cursor: pointer; font-weight: 600; }
.continuity-checkbox { display: flex; align-items: center; gap: 8px; margin: 10px 0; font-size: 13px; cursor: pointer; }
.continuity-checkbox input { width: 16px; height: 16px; cursor: pointer; }
.continuity-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.continuity-grid .full { grid-column: 1 / -1; }
.continuity-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.continuity-grid input, .continuity-grid textarea { padding: 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--input-bg); color: var(--text); }

.flow-workspace { border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin-bottom: 12px; }
.account-honesty-banner { background: var(--bg); border: 1px dashed var(--border); border-radius: 8px; padding: 8px 10px; font-size: 12px; margin-bottom: 8px; }
.reference-section { border: 1px solid var(--border); border-radius: 8px; padding: 10px; margin-top: 8px; }
.reference-list { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.reference-item { display: flex; flex-direction: column; gap: 4px; align-items: center; width: 100px; }
.reference-item img, .reference-item video { width: 100px; height: 70px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }
.reference-item span { max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.small-btn { font-size: 12px; padding: 4px 8px; }
.active-scene-box textarea { width: 100%; min-height: 90px; padding: 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--input-bg); color: var(--text); resize: vertical; }
.final-prompt-preview { white-space: pre-wrap; background: var(--bg); border: 1px dashed var(--border); border-radius: 8px; padding: 10px; font-family: ui-monospace, monospace; font-size: 12px; max-height: 240px; overflow: auto; }

.flow-embed-fallback { border: 1px solid var(--border); border-radius: 10px; padding: 14px; margin-bottom: 12px; }
.flow-embed-header { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }

.scene-timeline-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.scene-timeline { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.scene-card { min-width: 160px; border: 1px solid var(--border); border-radius: 10px; padding: 10px; cursor: pointer; flex-shrink: 0; }
.scene-card.selected { border-color: var(--accent); }
.scene-card .s-title { font-weight: 600; }
.scene-card .s-prompt { font-size: 12px; color: var(--muted); max-height: 40px; overflow: hidden; }

.empty-state { color: var(--muted); padding: 40px; text-align: center; }

/* Dashboard sambutan (ditampilkan saat belum ada project dipilih) */
.empty-state-hero { display: flex; flex-direction: column; gap: 16px; }
.hero-banner {
  border-radius: 14px; padding: 32px 24px; text-align: center;
  background: radial-gradient(circle at 30% 20%, rgba(109,91,208,0.35), transparent 60%),
              radial-gradient(circle at 80% 80%, rgba(74,114,173,0.35), transparent 60%),
              var(--panel-bg);
  border: 1px solid var(--border);
}
.hero-banner h2 { font-size: 28px; line-height: 1.25; margin-bottom: 8px; background: linear-gradient(135deg, #a78bfa, #7dd3fc); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-banner p { color: var(--muted); max-width: 520px; margin: 0 auto; }
.hero-illustration { display: block; width: 100%; max-width: 720px; margin: 12px auto 0; border-radius: 10px; }

.quick-actions-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.quick-action-card {
  position: relative; text-align: left; border: 1px solid var(--border); border-radius: 12px; padding: 14px;
  background: var(--panel-bg); color: var(--text); display: flex; flex-direction: column; gap: 6px; cursor: pointer;
}
.quick-action-card:hover { border-color: var(--accent); }
.quick-action-card .qa-icon { width: 34px; height: 34px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 16px; margin-bottom: 4px; }
.quick-action-card p { margin: 0; font-size: 12px; color: var(--muted); }
.quick-action-card .qa-arrow { align-self: flex-end; margin-top: auto; color: var(--muted); opacity: 0.7; font-size: 15px; }
.qa-blue .qa-icon { background: rgba(74,114,173,0.25); }
.qa-purple .qa-icon { background: rgba(167,139,250,0.25); }
.qa-green .qa-icon { background: rgba(74,222,128,0.2); }
.qa-gold .qa-icon { background: rgba(212,160,23,0.25); }

.tips-banner { display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; font-size: 13px; }
.tips-close { background: none; border: none; color: var(--muted); font-size: 14px; }
.hero-quote { text-align: center; color: var(--muted); font-style: italic; font-size: 13px; margin: 4px 0 0; }

.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat-card { border: 1px solid var(--border); border-radius: 12px; padding: 16px; text-align: center; background: var(--panel-bg); }
.stat-icon { font-size: 20px; margin-bottom: 6px; }
.stat-value { font-size: 22px; font-weight: 700; }
.stat-label { font-size: 11px; color: var(--muted); margin-top: 2px; }

.empty-state-hero { display: flex; flex-direction: column; gap: 16px; min-height: calc(100vh - 220px); }
.hero-banner { padding: 44px 24px; }

@media (max-width: 900px) {
  .quick-actions-grid { grid-template-columns: repeat(2, 1fr); }
}

.settings-view { padding: 16px; max-width: 720px; margin: 0 auto; width: 100%; }
.settings-card { background: var(--panel-bg); border: 1px solid var(--border); border-radius: 12px; padding: 20px; margin-bottom: 16px; }
.settings-card h3 { margin-bottom: 14px; }

/* FAQ: pertanyaan di baris sendiri, jawaban di bawahnya — bukan sejajar
   berdesakan seperti tabel key-value. */
.faq-item { padding: 14px 0; border-bottom: 1px solid var(--border); }
.faq-item:first-child { padding-top: 0; }
.faq-item:last-child { border-bottom: none; padding-bottom: 0; }
.faq-q { font-weight: 600; margin-bottom: 6px; }
.faq-a { color: var(--muted); font-size: 13px; line-height: 1.6; }

.check-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 10px; }
.check-list li { line-height: 1.6; }

.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 100; }
.modal-card { background: var(--panel-bg); border-radius: 12px; padding: 20px; width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 10px; max-height: 90vh; overflow-y: auto; }
.modal-card.modal-card-wide { max-width: 640px; }
.modal-card label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); }
.modal-card input, .modal-card select, .modal-card textarea {
  padding: 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--input-bg); color: var(--text);
  width: 100%; box-sizing: border-box; font-size: 14px;
}
.modal-card textarea { resize: vertical; min-height: 130px; line-height: 1.5; font-family: inherit; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }

@media (max-width: 900px) {
  .workspace-grid { grid-template-columns: 1fr; }
  .projects-panel, .accounts-panel { order: 2; }
  .center-panel { order: 1; }
  .topbar { flex-wrap: wrap; row-gap: 8px; }
  .topnav { order: 3; flex-basis: 100%; padding-left: 0; }
  .brand-subtitle { display: none; }
  .user-name, .user-role { display: none; }
  .app-footer { flex-wrap: wrap; gap: 6px; }
}
