:root {
  --bg: #f6f5fb;
  --card: #ffffff;
  --soft: #f1f0f7;
  --line: #e6e4ef;
  --text: #1d1b29;
  --muted: #6c6880;
  --accent: #fe2c55;
  --accent-soft: #ffe8ed;
  --accent-text: #d81c45;
  --teal: #0fb5ae;
  --teal-soft: #dcf6f4;
  --ok: #16a34a;
  --ok-soft: #dcfce7;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --err: #dc2626;
  --err-soft: #fee2e2;
  --shadow: 0 1px 2px rgba(29, 27, 41, .04), 0 8px 24px rgba(29, 27, 41, .06);
  --radius: 18px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111017; --card: #1a1922; --soft: #23222d; --line: #2e2c3a; --text: #f1f0f6; --muted: #a09cb3;
    --accent-soft: #3a1621; --accent-text: #ff7590; --teal-soft: #0f2f2e; --ok-soft: #10301d; --warn: #fbbf24; --warn-soft: #33270d;
    --err: #f87171; --err-soft: #3a1717; --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111017; --card: #1a1922; --soft: #23222d; --line: #2e2c3a; --text: #f1f0f6; --muted: #a09cb3;
  --accent-soft: #3a1621; --accent-text: #ff7590; --teal-soft: #0f2f2e; --ok-soft: #10301d; --warn: #fbbf24; --warn-soft: #33270d;
  --err: #f87171; --err-soft: #3a1717; --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.55 "Plus Jakarta Sans", system-ui, "Segoe UI", Roboto, sans-serif; -webkit-tap-highlight-color: transparent; }
a { color: var(--accent-text); font-weight: 600; }
code, kbd { font: 12.5px ui-monospace, Consolas, monospace; background: var(--soft); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
h1 { font-size: 26px; margin: 0 0 4px; letter-spacing: -.02em; }
h2 { font-size: 17px; margin: 0; letter-spacing: -.01em; }
h3 { font-size: 17px; margin: 0; }

/* ---------- Header ---------- */
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 28px; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 16px; }
.brand small { display: block; font-weight: 500; font-size: 12px; color: var(--muted); }
.logo { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--teal), var(--accent)); box-shadow: 0 6px 16px rgba(254, 44, 85, .3); }
nav { display: flex; gap: 6px; background: var(--card); padding: 5px; border-radius: 14px; border: 1px solid var(--line); }
.tab { display: flex; align-items: center; gap: 8px; border: 0; background: none; color: var(--muted); padding: 9px 16px; border-radius: 10px; cursor: pointer; font: 600 14px inherit; font-family: inherit; position: relative; transition: background .15s, color .15s; }
.tab svg { width: 18px; height: 18px; }
.tab:hover { color: var(--text); }
.tab.active { background: var(--accent-soft); color: var(--accent-text); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.dot.ok { background: var(--ok); }

main { max-width: 1240px; margin: 0 auto; padding: 28px; }
.view { display: none; }
.view.active { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.page-head { margin-bottom: 20px; }
.page-head p { margin: 0; }

/* ---------- Cards & layout ---------- */
.grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 20px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.card-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 16px; }
.card-head p { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; }
.step-num { flex: 0 0 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; color: #fff; background: var(--accent); }
.result { position: sticky; top: 92px; min-height: 560px; }

/* ---------- Banner ---------- */
.banner { display: flex; align-items: center; gap: 16px; padding: 16px 20px; margin-bottom: 22px; border-radius: var(--radius); background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); }
.banner-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--card); color: var(--warn); }
.banner-text { flex: 1; min-width: 0; }
.checklist { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 4px; font-size: 13.5px; color: var(--muted); }
.checklist span { display: inline-flex; align-items: center; gap: 5px; }
.checklist svg { width: 16px; height: 16px; color: var(--err); }
.checklist .done { color: var(--ok); }
.checklist .done svg { color: var(--ok); }

/* ---------- Upload ---------- */
.drop { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; padding: 28px 16px; border: 2px dashed var(--line); border-radius: 16px; background: var(--soft); cursor: pointer; transition: border-color .15s, background .15s; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop-icon { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: var(--card); color: var(--accent); box-shadow: var(--shadow); margin-bottom: 6px; }
.drop-icon svg { width: 24px; height: 24px; }
.drop .muted { font-size: 13px; }
.thumbs { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.thumbs:empty { display: none; }
.thumb { position: relative; width: 78px; height: 104px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb button { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .65); color: #fff; cursor: pointer; display: grid; place-items: center; padding: 0; }
.thumb button svg { width: 14px; height: 14px; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; min-width: 0; }
.label { display: block; font-size: 13px; font-weight: 700; color: var(--text); margin-top: 16px; }
.field .label { margin-top: 0; }
.label em { font-weight: 500; font-style: normal; color: var(--muted); }
input, select, textarea { width: 100%; min-width: 0; background: var(--card); color: var(--text); border: 1.5px solid var(--line); border-radius: 12px; padding: 11px 13px; font: inherit; transition: border-color .15s, box-shadow .15s; }
textarea { resize: vertical; }
input[type=file] { padding: 8px; font-size: 13px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }

.choices { display: grid; gap: 10px; }
.choice { display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; border: 1.5px solid var(--line); border-radius: 14px; cursor: pointer; transition: border-color .15s, background .15s; }
.choice:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice:has(input:focus-visible) { box-shadow: 0 0 0 4px var(--accent-soft); }
.choice-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--soft); color: var(--muted); flex-shrink: 0; }
.choice:has(input:checked) .choice-icon { background: var(--accent); color: #fff; }
.choice-body b { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tag.hot { background: var(--accent-soft); color: var(--accent-text); }
.choice-body > span { display: block; font-size: 13.5px; color: var(--muted); margin-top: 2px; }
.tag { font-style: normal; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--teal-soft); color: var(--teal); }

.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.pill input { position: absolute; opacity: 0; pointer-events: none; }
.pill span { display: block; padding: 9px 18px; border-radius: 99px; border: 1.5px solid var(--line); font-weight: 600; font-size: 14px; cursor: pointer; transition: all .15s; }
.pill span:hover { border-color: var(--accent); }
.pill input:checked + span { background: var(--text); border-color: var(--text); color: var(--card); }
.pill input:focus-visible + span { box-shadow: 0 0 0 4px var(--accent-soft); }

details.more { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
details.more > summary { cursor: pointer; font-weight: 700; font-size: 14px; color: var(--muted); list-style: none; display: flex; align-items: center; gap: 8px; user-select: none; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: ""; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform .15s; margin-right: 2px; }
details.more[open] > summary::before { transform: rotate(45deg); }
details.more > summary:hover { color: var(--text); }

.switch { display: flex; align-items: center; gap: 10px; margin-top: 16px; font-size: 14px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; }
.track { width: 40px; height: 24px; border-radius: 99px; background: var(--line); position: relative; transition: background .15s; flex-shrink: 0; }
.track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); transition: transform .18s; }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(16px); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 12px; padding: 11px 18px; font: 700 14px inherit; font-family: inherit; cursor: pointer; text-decoration: none; transition: transform .1s, filter .15s, background .15s; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: #fff; box-shadow: 0 6px 16px rgba(254, 44, 85, .25); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.soft { background: var(--soft); color: var(--text); border: 1px solid var(--line); }
.btn.soft:hover { border-color: var(--muted); }
.btn.ghost { background: none; color: var(--muted); }
.btn.danger { color: var(--err); }
.btn.big { width: 100%; padding: 17px; font-size: 17px; border-radius: 16px; }
.btn.big svg { width: 22px; height: 22px; }
.look-hint { margin: 8px 0 0; }
.cta-box .hint { text-align: center; margin: 10px 0 0; color: var(--muted); font-size: 13.5px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.keyrow { display: flex; gap: 8px; margin-top: 14px; }

/* ---------- Result ---------- */
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; min-height: 510px; gap: 16px; }
.phone { position: relative; width: 100%; max-width: 290px; aspect-ratio: 9 / 16; background: #000; border-radius: 26px; border: 7px solid #1d1b29; overflow: hidden; flex-shrink: 0; box-shadow: var(--shadow); }
.phone video { width: 100%; height: 100%; object-fit: cover; display: block; }
.phone.ghost { width: 150px; display: grid; place-items: center; background: var(--soft); border-color: var(--line); color: var(--muted); box-shadow: none; }
.phone.ghost svg { width: 40px; height: 40px; stroke-width: 1.5; }
.how { list-style: none; padding: 0; margin: 4px 0 0; display: grid; gap: 10px; text-align: left; }
.how li { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; }
.how li span:first-child { flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--soft); color: var(--text); font-weight: 700; font-size: 12.5px; }
.scene-preview { position: absolute; inset: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 2px; background: #000; }
.scene-preview img { width: 100%; height: 100%; object-fit: cover; }
.scene-preview:empty { display: none; }

.job-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.job-head h2 { overflow-wrap: anywhere; }
.job-head p { margin: 2px 0 0; }
.badge { font-size: 12.5px; font-weight: 700; padding: 4px 12px; border-radius: 99px; background: var(--soft); white-space: nowrap; }
.badge.done { background: var(--ok-soft); color: var(--ok); }
.badge.error { background: var(--err-soft); color: var(--err); }
.badge.running, .badge.queued { background: var(--teal-soft); color: var(--teal); }

.timeline { list-style: none; padding: 0; margin: 18px 0 6px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.timeline.three { grid-template-columns: repeat(3, 1fr); }
.timeline li { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; font-size: 12.5px; font-weight: 600; color: var(--muted); position: relative; }
.timeline li::before { content: ""; position: absolute; top: 17px; left: calc(-50% + 22px); right: calc(50% + 22px); height: 2px; background: var(--line); }
.timeline li:first-child::before { display: none; }
.timeline .ic { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--soft); border: 2px solid var(--line); color: var(--muted); }
.timeline .ic svg { width: 17px; height: 17px; }
.timeline .done .ic { background: var(--ok); border-color: var(--ok); color: #fff; }
.timeline .done::before, .timeline .active::before { background: var(--ok); }
.timeline .active { color: var(--text); }
.timeline .active .ic { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); animation: pulse 1.6s ease-in-out infinite; }
.timeline .fail .ic { background: var(--err); border-color: var(--err); color: #fff; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px var(--accent-soft); } }

.progress-wrap { margin: 14px 0 4px; }
.bar { height: 8px; background: var(--soft); border-radius: 99px; overflow: hidden; }
#bar { height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--teal), var(--accent)); transition: width .5s ease; }
.step { font-size: 14px; font-weight: 600; margin-top: 8px; }
.progress-wrap p { margin: 4px 0 0; }
.error { background: var(--err-soft); color: var(--err); padding: 12px 14px; border-radius: 12px; margin: 12px 0; white-space: pre-wrap; font-size: 13.5px; overflow-wrap: anywhere; }

.out { display: flex; gap: 22px; margin-top: 18px; align-items: flex-start; }
.side { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.side .field:first-of-type { margin-top: 0; }
.side #download { margin-bottom: 14px; width: 100%; padding: 14px; font-size: 15px; }
.side #copyCaption { align-self: flex-start; }
pre { white-space: pre-wrap; font-size: 12px; color: var(--muted); max-height: 260px; overflow: auto; margin: 10px 0 0; overflow-wrap: anywhere; }

/* ---------- History ---------- */
.history { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 18px; }
.hcard { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; cursor: pointer; box-shadow: var(--shadow); transition: transform .15s, border-color .15s; }
.hcard:hover { transform: translateY(-2px); border-color: var(--accent); }
.hcard .cover { aspect-ratio: 9 / 16; background: var(--soft) center / cover no-repeat; position: relative; }
.hcard .cover .badge { position: absolute; top: 10px; left: 10px; }
.hcard .meta { padding: 12px 14px; display: flex; gap: 8px; align-items: flex-start; }
.hcard .meta div { flex: 1; min-width: 0; }
.hcard .meta b { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hcard .meta small { color: var(--muted); }
.hcard .del { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 4px; border-radius: 8px; }
.hcard .del:hover { color: var(--err); background: var(--err-soft); }
.hcard .del svg { width: 16px; height: 16px; }
.empty-hist { grid-column: 1 / -1; text-align: center; padding: 60px 20px; }
.empty-hist p { color: var(--muted); }

/* ---------- API key page ---------- */
.key-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; align-items: start; }
.keycard-head { display: flex; gap: 14px; align-items: center; }
.keycard-head > div { flex: 1; min-width: 0; }
.keycard-head p { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; }
.kc-icon { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; }
.kc-icon.pen { background: var(--teal-soft); color: var(--teal); }
.kc-icon.film { background: var(--accent-soft); color: var(--accent-text); }
.status { font-size: 12.5px; font-weight: 700; padding: 5px 12px; border-radius: 99px; background: var(--warn-soft); color: var(--warn); white-space: nowrap; }
.status.ok { background: var(--ok-soft); color: var(--ok); }
.mini-steps { margin: 18px 0 0; padding: 14px 16px 14px 34px; background: var(--soft); border-radius: 14px; font-size: 13.5px; display: grid; gap: 4px; }
.test-msg { margin: 10px 0 0; font-size: 13.5px; font-weight: 600; min-height: 1px; overflow-wrap: anywhere; }
.test-msg:empty { display: none; }
.test-msg.ok { color: var(--ok); }
.test-msg.err { color: var(--err); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chips:empty { display: none; }
.chip { font-size: 12px; padding: 4px 10px; border-radius: 99px; background: var(--soft); border: 1px solid var(--line); cursor: pointer; }
.chip:hover { border-color: var(--accent); }
.chip em { color: var(--muted); font-style: normal; }
.other { margin-top: 22px; }
.other.more { border-top: 1px solid var(--line); padding-top: 16px; }
.other #saveOther { margin-top: 12px; }


/* ---------- Koleksi ---------- */
.row-between { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.tabs-bar { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.lib-tabs { display: flex; gap: 8px; overflow-x: auto; flex: 1; min-width: 0; padding: 2px 2px 6px; scrollbar-width: thin; }
.lib-tab { flex-shrink: 0; display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 99px; border: 1.5px solid var(--line); background: var(--card); color: var(--text); font: 600 14px inherit; font-family: inherit; cursor: pointer; white-space: nowrap; transition: all .15s; }
.lib-tab:hover { border-color: var(--accent); }
.lib-tab.active { background: var(--text); color: var(--card); border-color: var(--text); }
.lib-tab .count { font-size: 12px; padding: 1px 7px; border-radius: 99px; background: var(--soft); color: var(--muted); }
.lib-tab.active .count { background: color-mix(in srgb, var(--card) 20%, transparent); color: var(--card); }
.small-btn { padding: 9px 14px; flex-shrink: 0; }
.tab-tools { display: flex; gap: 8px; margin-bottom: 18px; }
.tab-tools:empty { display: none; }
.tab-tools .btn { padding: 6px 12px; font-size: 13px; }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 18px; }
.lcard { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.lcard .cover { aspect-ratio: 4 / 5; background: var(--soft) center / cover no-repeat; position: relative; }
.lcard .cover .n { position: absolute; bottom: 8px; right: 8px; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: rgba(0,0,0,.6); color: #fff; }
.lcard .body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.lcard .body b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.lcard .body small { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lcard .acts { display: flex; gap: 6px; margin-top: auto; }
.lcard .acts .btn { padding: 9px 10px; font-size: 13px; white-space: nowrap; }
.lcard .acts .btn svg { width: 17px; height: 17px; }
.lcard .acts .btn.primary { flex: 1; box-shadow: none; }
.lib-empty { grid-column: 1 / -1; text-align: center; padding: 56px 20px; }
.lib-empty p { color: var(--muted); margin: 6px 0 16px; }
.niche-chip { display: inline-flex; align-items: center; gap: 8px; margin-top: 12px; padding: 6px 12px; border-radius: 99px; background: var(--teal-soft); color: var(--teal); font-size: 13px; font-weight: 700; }
.niche-chip button { border: 0; background: none; color: inherit; cursor: pointer; padding: 0; display: grid; }
.niche-chip svg { width: 15px; height: 15px; }
.lib-actions { margin-top: 12px; }

/* ---------- Dialog ---------- */
.dlg { border: 0; padding: 0; border-radius: 20px; background: var(--card); color: var(--text); width: min(520px, calc(100vw - 32px)); box-shadow: 0 24px 64px rgba(0,0,0,.25); }
.dlg::backdrop { background: rgba(20, 18, 30, .45); backdrop-filter: blur(3px); }
.dlg form { padding: 22px; }
.dlg h2 { margin-bottom: 4px; }
.dlg-actions { justify-content: flex-end; margin-top: 20px; }
.dlg .thumbs { margin-top: 10px; }
.dlg .drop { padding: 18px 12px; }

.toast { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(16px); background: var(--text); color: var(--card); padding: 12px 20px; border-radius: 12px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; font-weight: 600; max-width: calc(100vw - 32px); z-index: 50; box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .grid { grid-template-columns: 1fr; }
  .result { position: static; min-height: 0; }
  .empty { min-height: 380px; }
}
@media (max-width: 760px) {
  main { padding: 18px 16px 100px; }
  /* backdrop-filter membuat nav fixed menempel ke header; matikan di ponsel. */
  .top { padding: 10px 16px; backdrop-filter: none; background: var(--bg); }
  .brand small { display: none; }
  nav { position: fixed; left: 12px; right: 12px; bottom: 12px; justify-content: space-around; padding: 6px; border-radius: 18px; box-shadow: var(--shadow); z-index: 20; padding-bottom: max(6px, env(safe-area-inset-bottom)); }
  .tab { flex: 1; flex-direction: column; gap: 2px; font-size: 11.5px; padding: 8px 4px; justify-content: center; }
  .tab .dot { position: absolute; top: 6px; right: calc(50% - 18px); }
  .key-grid, .opts { grid-template-columns: 1fr; }
  .lib-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .row-between .btn { width: 100%; }
  .tab { font-size: 11px; }
  .card { padding: 18px; }
  .out { flex-direction: column; align-items: center; }
  .side { width: 100%; }
  .banner { flex-wrap: wrap; }
  .banner .btn { width: 100%; }
  .toast { bottom: 96px; }
  input, select, textarea { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Login & akun ---------- */
body:not(.is-admin) .admin-only { display: none !important; }
body.logged-out > header, body.logged-out > main { display: none; }
.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(1200px 600px at 10% -10%, var(--accent-soft), transparent 60%), radial-gradient(900px 500px at 110% 110%, var(--teal-soft), transparent 60%), var(--bg); }
.login-card { width: min(420px, 100%); background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 28px; box-shadow: var(--shadow); }
.login-brand { display: flex; gap: 12px; align-items: center; margin-bottom: 22px; }
.login-brand b { display: block; font-size: 16px; }
.login-brand small { color: var(--muted); font-size: 12.5px; }
.login-card h1 { font-size: 24px; margin: 0; }
.login-card > p { margin: 4px 0 6px; }
.login-card .btn.big { margin-top: 16px; }
.login-foot { text-align: center; margin: 16px 0 0; }
.owner-pick { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; color: var(--muted); margin-bottom: 12px; }
.owner-pick select { width: auto; min-width: 180px; padding: 8px 12px; }
.narrow-card { max-width: 520px; }
.user-table { display: grid; gap: 10px; }
.urow { display: grid; grid-template-columns: minmax(0, 1.4fr) auto auto auto; gap: 10px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; }
.urow b { display: block; }
.urow small { color: var(--muted); }
.urow .acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.urow .acts .btn { padding: 7px 11px; font-size: 13px; }
.role { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 99px; background: var(--soft); white-space: nowrap; }
.role.admin { background: var(--accent-soft); color: var(--accent-text); }
.role.off { background: var(--err-soft); color: var(--err); }
.hcard .owner { display: block; font-size: 12px; color: var(--teal); font-weight: 600; }
@media (max-width: 760px) {
  .urow { grid-template-columns: 1fr; }
  .urow .acts { justify-content: flex-start; }
  .owner-pick { width: 100%; }
  .owner-pick select { flex: 1; }
}

#profileForm .btn.primary { margin-top: 16px; }
