/* Tangani VideoGen — tone tangani.id: krem hangat, tinta cokelat-hitam, aksen oranye-tembaga, serif miring untuk penekanan. */
:root {
  --bg: #faf8f3; --surface: #ffffff; --surface-2: #f5f0e4; --surface-3: #efe7d8;
  --ink: #18150f; --ink-2: #3a342b; --muted: #7a7368; --line: #ebe4d6; --grid: rgba(24, 21, 15, .045);
  --brand: #c2691f; --brand-hover: #a9571a; --brand-2: #e89544; --brand-soft: #fbeee0; --brand-ring: rgba(194, 105, 31, .22);
  --mint: #2bb59a; --mint-soft: #e2f5ef;
  --err: #b42318; --err-soft: #fdecea; --info: #8a5a1c; --info-soft: #fdf3e4;
  --user-bubble: #18150f; --user-ink: #faf8f3;
  --code-bg: #18150f; --code-ink: #f5f1ec;
  --shadow: 0 1px 2px rgba(24, 21, 15, .05), 0 8px 24px rgba(24, 21, 15, .06);
  --shadow-lg: 0 24px 60px rgba(24, 21, 15, .14);
  --radius: 14px;
  --sans: 'Plus Jakarta Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --serif: 'Instrument Serif', Georgia, serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #12100e; --surface: #1c1916; --surface-2: #26221e; --surface-3: #2f2a25;
  --ink: #f5f1ec; --ink-2: #d9d2c7; --muted: #a8a099; --line: #2f2a25; --grid: rgba(255, 255, 255, .035);
  --brand: #e2843a; --brand-hover: #f09a4f; --brand-soft: #2d2117; --brand-ring: rgba(226, 132, 58, .28);
  --mint-soft: #15302a; --err: #ff8b7e; --err-soft: #3a1d1a; --info: #f4c58c; --info-soft: #2f2418;
  --user-bubble: #e2843a; --user-ink: #1a1209;
  --code-bg: #0c0a08;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--sans); background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased;
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 44px 44px;
}
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--brand); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.hidden { display: none !important; }
.serif { font-family: var(--serif); font-style: italic; font-weight: 400; color: var(--brand); letter-spacing: 0; }
.eyebrow { font-family: var(--mono); font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: var(--brand); }
.muted { color: var(--muted); }
.small { font-size: .8rem; }

/* ---------- tombol & input */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 42px; padding: .55rem 1.1rem; border-radius: 12px;
  border: 1px solid transparent; font-weight: 700; font-size: .9rem; cursor: pointer; background: var(--brand); color: #fff;
  box-shadow: 0 6px 16px var(--brand-ring); transition: background .15s, transform .1s, box-shadow .15s; }
.btn:hover { background: var(--brand-hover); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--line); box-shadow: none; }
.btn.secondary:hover { border-color: var(--brand); color: var(--brand); }
.btn.ghost { background: transparent; color: var(--ink-2); box-shadow: none; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { background: var(--surface); color: var(--err); border-color: color-mix(in srgb, var(--err) 35%, transparent); box-shadow: none; }
.btn.small { min-height: 34px; padding: .35rem .8rem; font-size: .8rem; border-radius: 10px; }
.icon-btn { width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; color: var(--ink-2); }
.icon-btn:hover { border-color: var(--brand); color: var(--brand); }
.input { width: 100%; min-height: 44px; padding: .6rem .85rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); transition: border-color .15s, box-shadow .15s; }
.input::placeholder { color: var(--muted); opacity: .8; }
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-ring); }
label.lbl { display: block; font-size: .82rem; font-weight: 700; margin-bottom: .35rem; color: var(--ink-2); }
.chip { display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .6rem; border-radius: 999px; font-size: .72rem; font-weight: 700;
  background: var(--brand-soft); color: var(--brand); border: 1px solid color-mix(in srgb, var(--brand) 25%, transparent); }
.chip.mint { background: var(--mint-soft); color: var(--mint); border-color: color-mix(in srgb, var(--mint) 30%, transparent); }
.chip.ink { background: var(--surface-2); color: var(--ink-2); border-color: var(--line); }
.alert { padding: .65rem .85rem; border-radius: 12px; font-size: .88rem; margin: .5rem 0; border: 1px solid transparent; }
.alert.err { background: var(--err-soft); color: var(--err); border-color: color-mix(in srgb, var(--err) 25%, transparent); }
.alert.info { background: var(--info-soft); color: var(--info); border-color: color-mix(in srgb, var(--brand) 25%, transparent); }
.alert.warn { background: var(--info-soft); color: var(--info); }

/* ---------- login */
.login-wrap { min-height: 100%; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-hero { padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between; gap: 32px; }
.login-hero h1 { font-size: clamp(2.2rem, 4.2vw, 3.6rem); line-height: 1.02; letter-spacing: -.035em; margin: 18px 0 16px; font-weight: 800; }
.login-hero h1 .serif { display: block; font-size: 1.05em; }
.login-hero .lead { max-width: 30rem; color: var(--ink-2); line-height: 1.6; border-left: 3px solid var(--brand); padding-left: 14px; }
.steps { display: flex; gap: 10px; flex-wrap: wrap; }
.login-hero .step { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow); min-width: 150px; }
.login-hero .step b { display: block; font-size: .9rem; }
.login-hero .step span { font-size: .78rem; color: var(--muted); }
.login-side { display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 30px; box-shadow: var(--shadow-lg); }
.login-card h2 { margin: 0 0 4px; font-size: 1.5rem; letter-spacing: -.02em; }
.login-card form > * + * { margin-top: 16px; }
.qr { display: grid; place-items: center; gap: 8px; padding: 14px; border: 1px dashed color-mix(in srgb, var(--brand) 45%, transparent); border-radius: 16px; background: var(--brand-soft); }
.qr img { width: 196px; height: 196px; border-radius: 10px; background: #fff; padding: 6px; }
.qr code { font-family: var(--mono); font-size: .72rem; word-break: break-all; text-align: center; color: var(--ink-2); }
.brandmark { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: .04em; color: var(--brand); text-decoration: none; }
.brandmark img { width: 34px; height: 34px; }
.brandmark .pill { font-family: var(--mono); font-size: .62rem; letter-spacing: .12em; padding: 3px 7px; border-radius: 999px; background: var(--ink); color: var(--bg); }

/* ---------- layout aplikasi */
.app { display: grid; grid-template-columns: 272px minmax(0, 1fr); grid-template-rows: 64px minmax(0, 1fr); height: 100vh; height: 100dvh; }
.topbar { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; padding: 0 18px; background: color-mix(in srgb, var(--surface) 88%, transparent);
  border-bottom: 1px solid var(--line); min-width: 0; }
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 12px; overflow-x: auto; }
.tab { background: transparent; border: 0; color: var(--ink-2); padding: 7px 14px; border-radius: 9px; cursor: pointer; font-weight: 700; font-size: .86rem; white-space: nowrap; text-decoration: none; }
.tab:hover { color: var(--brand); }
.tab.active { background: var(--surface); color: var(--brand); box-shadow: var(--shadow); }
.spacer { flex: 1; }
.sidebar { background: color-mix(in srgb, var(--surface) 92%, transparent); border-right: 1px solid var(--line); overflow-y: auto; padding: 16px; }
.sidebar h3 { margin: 0 0 10px; display: flex; justify-content: space-between; align-items: center; }
.sidebar h3 .eyebrow { color: var(--muted); }
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
.list a { display: flex; justify-content: space-between; gap: 8px; align-items: center; padding: 9px 10px; border-radius: 10px; font-size: .9rem; color: var(--ink); text-decoration: none; border: 1px solid transparent; }
.list a:hover { background: var(--surface-2); }
.list a.active { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 25%, transparent); color: var(--brand); font-weight: 700; }
.list .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .meta { font-family: var(--mono); font-size: .66rem; color: var(--muted); }
.main { min-width: 0; min-height: 0; overflow-y: auto; }
.page { max-width: 1120px; margin: 0 auto; padding: 24px 22px 60px; }
.page-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; justify-content: space-between; margin-bottom: 20px; }
.page-head h1 { margin: 4px 0 0; font-size: clamp(1.5rem, 3vw, 2.1rem); letter-spacing: -.025em; overflow-wrap: anywhere; }
.page-head p { margin: 6px 0 0; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card + .card { margin-top: 14px; }
.card h2 { margin: 0 0 12px; font-size: 1.05rem; }
.empty { text-align: center; padding: 48px 20px; }
.empty h2 { font-size: 1.4rem; margin: 0 0 6px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.vcard { display: flex; flex-direction: column; text-decoration: none; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.vcard:hover { border-color: var(--brand); }
.vcard .thumb { aspect-ratio: 16/9; background: var(--surface-3); position: relative; }
.vcard .thumb img, .vcard .thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.vcard .thumb .chip { position: absolute; left: 8px; top: 8px; }
.vcard .body { padding: 12px 14px; display: grid; gap: 4px; }
.vcard b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip.live::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: blink 1s infinite alternate; }
@keyframes blink { to { opacity: .25; } }

/* ---------- formulir video & pemilih gaya */
textarea.input { resize: vertical; line-height: 1.55; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: .88rem; }
.check input { margin-top: 3px; accent-color: var(--brand); }
.cats { display: flex; gap: 6px; overflow-x: auto; padding: 10px 0; }
.cats button { white-space: nowrap; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 12px; font-size: .78rem; font-weight: 700; cursor: pointer; color: var(--ink-2); }
.cats button.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.styles { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); grid-auto-rows: max-content; gap: 10px; max-height: 470px; overflow-y: auto; padding: 3px; }
.style { text-align: left; padding: 0; border: 2px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; overflow: hidden; display: flex; flex-direction: column; }
.style img { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; background: var(--surface-3); }
.style span { padding: 7px 9px 9px; font-size: .8rem; font-weight: 700; line-height: 1.3; }
.style small { display: block; font-weight: 400; color: var(--muted); font-size: .68rem; margin-top: 2px; }
.style:hover { border-color: var(--brand-2); }
.style.on { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-ring); }
.picked { margin-top: 10px; }
.voice-box { display: grid; gap: 12px; }
.voice-box audio { width: 100%; height: 36px; }
.sticky-submit { position: sticky; bottom: 0; padding: 12px 0; background: linear-gradient(transparent, var(--bg) 35%); display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }

/* ---------- ruang kerja video */
.work { height: 100%; display: flex; flex-direction: column; min-height: 0; }
.work-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 80%, transparent); }
.work-head .title { min-width: 0; flex: 1 1 220px; }
.work-head h1 { margin: 0; font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.work-head a { font-size: .78rem; }
.pane { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.pane.scroll { overflow-y: auto; }
.messages { flex: 1; overflow-y: auto; padding: 20px 18px; }
.messages > * { max-width: 820px; margin: 0 auto 12px; }
.msg-user { background: var(--user-bubble); color: var(--user-ink); border-radius: 16px 16px 4px 16px; padding: 12px 15px; white-space: pre-wrap; overflow-wrap: anywhere; width: fit-content; margin-right: max(0px, calc(50% - 410px)); }
.msg-ai { background: var(--surface); border: 1px solid var(--line); border-radius: 4px 16px 16px 16px; padding: 4px 16px; line-height: 1.6; overflow-wrap: anywhere; box-shadow: var(--shadow); }
.msg-ai pre { background: var(--code-bg); color: var(--code-ink); padding: 12px; border-radius: 10px; overflow-x: auto; font-size: .8rem; }
.msg-ai code { font-family: var(--mono); font-size: .85em; }
.msg-ai table { border-collapse: collapse; display: block; overflow-x: auto; }
.msg-ai td, .msg-ai th { border: 1px solid var(--line); padding: 5px 9px; }
.tool { font-size: .8rem; }
.tool summary { cursor: pointer; color: var(--muted); font-family: var(--mono); font-size: .72rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool summary.err { color: var(--err); }
.tool pre { background: var(--code-bg); color: var(--code-ink); padding: 10px; border-radius: 10px; overflow: auto; max-height: 260px; white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--mono); font-size: .72rem; }
.note { text-align: center; font-family: var(--mono); font-size: .68rem; color: var(--muted); }
.composer { padding: 10px 18px 16px; }
.composer-card { max-width: 820px; margin: 0 auto; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 10px 12px; box-shadow: var(--shadow-lg); }
.composer-card textarea { width: 100%; border: 0; background: transparent; resize: none; outline: none; min-height: 48px; max-height: 200px; line-height: 1.5; }
.composer-foot { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: transparent; padding: 6px 11px; border-radius: 8px; font-size: .78rem; font-weight: 700; cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--brand); box-shadow: var(--shadow); }
.player { width: 100%; max-height: 70vh; background: #000; border-radius: var(--radius); }
.files { width: 100%; border-collapse: collapse; font-size: .84rem; }
.files td { padding: 8px 6px; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.files td:not(:first-child) { white-space: nowrap; text-align: right; color: var(--muted); }
.term-pane { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 12px 18px; gap: 8px; }
.term-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.term-bar select { width: auto; min-width: 150px; min-height: 34px; padding: .2rem .6rem; }
.term-wrap { flex: 1; min-height: 240px; background: #0c0a08; border-radius: 12px; padding: 8px; overflow: hidden; }
.keys { display: none; gap: 6px; flex-wrap: wrap; }
.keys button { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 7px 11px; font-family: var(--mono); font-size: .75rem; }

/* ---------- kunci & audit */
.key-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 14px 0; border-top: 1px solid var(--line); }
.key-row .order { font-family: var(--serif); font-style: italic; font-size: 1.8rem; color: var(--brand); text-align: center; }
.key-row.off { opacity: .55; }
.meter { height: 7px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin: 6px 0 3px; max-width: 420px; }
.meter i { display: block; height: 100%; background: var(--brand); }
.chip.bad { background: var(--err-soft); color: var(--err); border-color: transparent; }
.audit { overflow-x: auto; }
.audit table { width: 100%; border-collapse: collapse; font-size: .78rem; }
.audit td, .audit th { text-align: left; padding: 7px 8px; border-top: 1px solid var(--line); vertical-align: top; }
.audit td:last-child { font-family: var(--mono); font-size: .68rem; overflow-wrap: anywhere; min-width: 260px; }

dialog.modal { border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--ink); width: min(460px, calc(100vw - 32px)); padding: 22px; box-shadow: var(--shadow-lg); }
dialog.modal::backdrop { background: rgba(24, 21, 15, .45); }
dialog.modal h2 { margin: 0 0 6px; font-size: 1.2rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 60; max-width: min(380px, calc(100vw - 32px)); }
.toast { background: var(--ink); color: var(--bg); padding: 11px 14px; border-radius: 12px; font-size: .85rem; box-shadow: var(--shadow-lg); }
.toast.err { background: var(--err); color: var(--surface); }
.menu-btn { display: none; }
.credit { font-size: .7rem; color: var(--muted); margin-top: 8px; }

@media (max-width: 900px) {
  .login-wrap { grid-template-columns: 1fr; }
  .login-hero { padding: 24px; }
  .login-hero .steps, .login-hero .foot { display: none; }
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .topbar { flex-wrap: wrap; padding: 10px 12px; }
  .topbar .tabs { order: 3; width: 100%; }
  .brandmark .word { display: none; }
  .menu-btn { display: inline-grid; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(300px, 84vw); z-index: 40; transform: translateX(-102%); transition: transform .2s; background: var(--surface); }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .page { padding: 16px 12px 50px; }
  .styles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .work-head, .messages, .composer, .term-pane { padding-left: 12px; padding-right: 12px; }
  .keys { display: flex; }
  .key-row { grid-template-columns: 28px minmax(0, 1fr); }
  .key-row > .row { grid-column: 2; }
}
