:root {
  --bg: #050505; --bg2: #0a0a0a; --card: #101010; --panel: #151515; --border: #303030;
  --text: #fff; --text2: #a3a3a3; --text3: #737373; --hi: #e8e8e8;
  --danger: #ff6b6b; --ok: #e8e8e8; --radius: 14px; --sidebar: 288px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font: 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased; overflow: hidden;
}
/* elemen luar angkasa minimal: titik bintang sangat redup + cahaya putih lembut */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .55;
  background:
    radial-gradient(1px 1px at 12% 18%, #fff8, transparent), radial-gradient(1px 1px at 78% 12%, #fff6, transparent),
    radial-gradient(1px 1px at 44% 70%, #fff5, transparent), radial-gradient(1px 1px at 90% 62%, #fff7, transparent),
    radial-gradient(1px 1px at 22% 88%, #fff5, transparent), radial-gradient(1px 1px at 63% 40%, #fff4, transparent),
    radial-gradient(60% 40% at 50% -10%, #ffffff12, transparent 70%);
}
#app { position: relative; z-index: 1; height: 100%; height: 100dvh; }
.boot { display: grid; place-items: center; }
.boot-mark { width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--border); border-top-color: #fff; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 #ffffff33; } 50% { box-shadow: 0 0 0 18px #ffffff00; } }
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { * { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

a { color: var(--hi); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--text2); } .dim { color: var(--text3); } .small { font-size: 12.5px; } .mono { font-family: var(--mono); }
.row { display: flex; align-items: center; gap: 10px; } .wrap { flex-wrap: wrap; } .grow { flex: 1; min-width: 0; } .gap-s { gap: 6px; }
.hidden { display: none !important; }

/* ---------- tombol & form ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 16px; border-radius: 10px;
  background: var(--panel); border: 1px solid var(--border); cursor: pointer; transition: background .15s, border-color .15s, transform .05s; white-space: nowrap;
}
.btn:hover:not(:disabled) { border-color: #555; background: #1c1c1c; } .btn:active:not(:disabled) { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: #fff; color: #000; border-color: #fff; font-weight: 600; } .btn.primary:hover:not(:disabled) { background: var(--hi); }
.btn.ghost { background: transparent; border-color: transparent; } .btn.ghost:hover:not(:disabled) { background: #ffffff10; border-color: transparent; }
.btn.danger { color: var(--danger); border-color: #5a2a2a; } .btn.sm { min-height: 34px; padding: 4px 11px; font-size: 13.5px; }
.btn.icon { padding: 0; width: 40px; } .btn.icon.sm { width: 34px; }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > label, .label { font-size: 13px; color: var(--text2); }
.input, textarea.input, select.input {
  width: 100%; background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; min-height: 42px; outline: none;
}
.input:focus { border-color: #888; } textarea.input { resize: vertical; line-height: 1.5; }
.hint { font-size: 12.5px; color: var(--text3); }
.check { display: flex; gap: 10px; align-items: flex-start; } .check input { margin-top: 4px; accent-color: #fff; width: 16px; height: 16px; }

/* ---------- kartu, badge, tabel ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; animation: fade .25s ease both; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 99px; font-size: 12px; border: 1px solid var(--border); color: var(--text2); background: var(--bg2); }
.badge.on { color: #000; background: #fff; border-color: #fff; } .badge.bad { color: var(--danger); border-color: #5a2a2a; } .badge.warn { color: var(--hi); border-style: dashed; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text3); display: inline-block; }
.dot.on { background: #fff; box-shadow: 0 0 8px #fff8; } .dot.bad { background: var(--danger); }
.notice { border: 1px solid var(--border); background: var(--panel); border-radius: 12px; padding: 12px 14px; font-size: 14px; color: var(--text2); }
.notice.bad { border-color: #5a2a2a; color: #ffb4b4; } .notice b { color: var(--text); }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); }
table.t { width: 100%; border-collapse: collapse; min-width: 560px; }
.t th, .t td { text-align: left; padding: 11px 14px; border-bottom: 1px solid #202020; font-size: 14px; vertical-align: top; }
.t th { color: var(--text2); font-weight: 500; font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; background: var(--bg2); position: sticky; top: 0; }
.t tr:last-child td { border-bottom: 0; } .t tbody tr:hover { background: #ffffff06; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat .v { font-size: 28px; font-weight: 650; letter-spacing: -.02em; } .stat .k { color: var(--text2); font-size: 13px; }
.bar { height: 6px; background: #202020; border-radius: 99px; overflow: hidden; } .bar > i { display: block; height: 100%; background: #fff; border-radius: 99px; }

/* ---------- modal & toast ---------- */
.overlay { position: fixed; inset: 0; z-index: 50; background: #000c; backdrop-filter: blur(4px); display: grid; place-items: center; padding: 16px; animation: fade .15s ease both; }
.modal { width: min(560px, 100%); max-height: calc(100dvh - 32px); display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--border); border-radius: 18px; box-shadow: 0 0 60px #ffffff0d; }
.modal.wide { width: min(760px, 100%); } .modal.full { width: min(520px, 100%); height: min(760px, calc(100dvh - 32px)); }
.modal > header { padding: 16px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.modal > header h3 { margin: 0; font-size: 17px; flex: 1; }
.modal > .body { padding: 18px; overflow-y: auto; -webkit-overflow-scrolling: touch; flex: 1; }
.modal > footer { padding: 14px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.toasts { position: fixed; z-index: 80; right: 16px; bottom: 16px; display: grid; gap: 8px; max-width: min(380px, calc(100vw - 32px)); }
.toast { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 11px 14px; font-size: 14px; animation: fade .2s ease both; }
.toast.bad { border-color: #7a3a3a; color: #ffb4b4; }

/* ---------- auth ---------- */
.auth { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; overflow-y: auto; }
.auth-box { width: min(420px, 100%); text-align: center; }
.auth-box img { width: 72px; height: 72px; filter: drop-shadow(0 0 22px #ffffff40); }
.auth-box h1 { margin: 14px 0 4px; font-size: 30px; letter-spacing: -.03em; }
.tagline { color: var(--text2); letter-spacing: .12em; text-transform: uppercase; font-size: 12px; margin-bottom: 26px; }
.auth-box .card { text-align: left; } .auth-box .btn.primary { width: 100%; }

/* ---------- shell (chat & admin) ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; height: 100%; height: 100dvh; }
.side { background: var(--bg2); border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; z-index: 30; }
.side-head { padding: 14px; display: flex; align-items: center; gap: 10px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 17px; letter-spacing: -.02em; } .brand img { width: 28px; height: 28px; }
.side-list { flex: 1; overflow-y: auto; padding: 4px 10px; min-height: 0; }
.side-foot { border-top: 1px solid var(--border); padding: 10px; display: grid; gap: 6px; }
.conv { display: flex; align-items: center; gap: 4px; border-radius: 10px; padding: 0 4px 0 0; }
.conv:hover, .conv.active { background: #ffffff0f; } .conv.active { box-shadow: inset 2px 0 0 #fff; }
.conv > button.title { flex: 1; min-width: 0; text-align: left; background: none; border: 0; cursor: pointer; padding: 9px 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv .acts { display: none; gap: 2px; } .conv:hover .acts, .conv.active .acts, .conv:focus-within .acts { display: flex; }
.nav-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 42px; padding: 8px 12px; border-radius: 10px; color: var(--text2); text-decoration: none; background: none; border: 0; cursor: pointer; text-align: left; }
.nav-item:hover { background: #ffffff0d; color: #fff; } .nav-item.active { background: #ffffff14; color: #fff; }
.nav-item.child { padding-left: 38px; min-height: 38px; font-size: 14px; }
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100%; }
.topbar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--border); background: #050505cc; backdrop-filter: blur(8px); min-height: 56px; }
.topbar h2 { margin: 0; font-size: 17px; } .menu-btn { display: none; }
.scrim { display: none; }
.content { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 24px; }
.content-inner { max-width: 1100px; margin: 0 auto; display: grid; gap: 18px; }
.page-head { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; } .page-head h1 { margin: 0; font-size: 24px; letter-spacing: -.02em; } .page-head p { margin: 2px 0 0; color: var(--text2); }

/* ---------- chat ---------- */
.msgs { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 20px 16px 8px; scroll-behavior: smooth; }
.msgs-inner { max-width: 820px; margin: 0 auto; display: grid; gap: 22px; }
.empty { margin: auto; text-align: center; padding: 8vh 16px; } .empty img { width: 64px; filter: drop-shadow(0 0 24px #fff5); } .empty h2 { margin: 12px 0 4px; font-size: 26px; letter-spacing: -.03em; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 18px; }
.chip { border: 1px solid var(--border); background: var(--card); padding: 8px 14px; border-radius: 99px; cursor: pointer; font-size: 14px; color: var(--text2); } .chip:hover { color: #fff; border-color: #666; }
.msg { animation: fade .2s ease both; } .msg .who { font-size: 12px; color: var(--text3); margin-bottom: 4px; display: flex; gap: 8px; align-items: center; }
.msg.user .bubble { background: var(--panel); border: 1px solid var(--border); border-radius: 16px 16px 4px 16px; padding: 10px 14px; margin-left: auto; width: fit-content; max-width: 88%; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.user .who { justify-content: flex-end; }
.msg.assistant .bubble { overflow-wrap: anywhere; }
.msg .tools { display: flex; gap: 4px; margin-top: 6px; opacity: .65; } .msg:hover .tools, .msg:focus-within .tools { opacity: 1; }
.msg.user .tools { justify-content: flex-end; }
.caret::after { content: "▍"; animation: blink 1s steps(2) infinite; margin-left: 2px; }
.thinking { display: inline-flex; gap: 5px; padding: 6px 0; } .thinking i { width: 7px; height: 7px; border-radius: 50%; background: #fff; opacity: .3; animation: pulse3 1.2s infinite; } .thinking i:nth-child(2) { animation-delay: .2s; } .thinking i:nth-child(3) { animation-delay: .4s; }
@keyframes pulse3 { 50% { opacity: 1; transform: translateY(-3px); } }
.errbox { border: 1px solid #6a3030; background: #1a0d0d; color: #ffb4b4; border-radius: 12px; padding: 10px 14px; margin-top: 6px; font-size: 14px; }
.composer-wrap { padding: 8px 16px calc(12px + env(safe-area-inset-bottom)); }
.composer { max-width: 820px; margin: 0 auto; background: var(--card); border: 1px solid var(--border); border-radius: 18px; padding: 8px 8px 8px 14px; display: flex; align-items: flex-end; gap: 6px; transition: border-color .15s, box-shadow .15s; }
.composer:focus-within { border-color: #777; box-shadow: 0 0 30px #ffffff10; }
.composer textarea { flex: 1; background: none; border: 0; outline: none; resize: none; max-height: 200px; min-height: 40px; padding: 9px 0; line-height: 1.5; }
.foot-note { text-align: center; font-size: 12px; color: var(--text3); margin-top: 6px; }
.model-select { max-width: 220px; }

/* ---------- markdown ---------- */
.md > :first-child { margin-top: 0; } .md > :last-child { margin-bottom: 0; }
.md p { margin: .6em 0; } .md h1, .md h2, .md h3, .md h4 { margin: 1.1em 0 .4em; line-height: 1.25; letter-spacing: -.01em; } .md h1 { font-size: 1.4em; } .md h2 { font-size: 1.22em; } .md h3 { font-size: 1.08em; }
.md ul, .md ol { padding-left: 1.4em; margin: .5em 0; } .md li { margin: .2em 0; }
.md blockquote { margin: .7em 0; padding: .1em 1em; border-left: 3px solid #555; color: var(--text2); }
.md hr { border: 0; border-top: 1px solid var(--border); margin: 1.2em 0; }
.md code { font-family: var(--mono); font-size: .88em; background: #1c1c1c; padding: .15em .4em; border-radius: 6px; }
.md table { border-collapse: collapse; margin: .8em 0; display: block; overflow-x: auto; } .md th, .md td { border: 1px solid var(--border); padding: 6px 10px; } .md th { background: var(--panel); }
.codeblock { margin: .8em 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: #0b0b0b; }
.codeblock .bar2 { display: flex; align-items: center; justify-content: space-between; padding: 4px 8px 4px 14px; background: #161616; font-size: 12px; color: var(--text2); border-bottom: 1px solid var(--border); }
.codeblock pre { margin: 0; padding: 12px 14px; overflow-x: auto; -webkit-overflow-scrolling: touch; } .codeblock pre code { background: none; padding: 0; font-size: 13px; line-height: 1.55; }
.tk-c { color: #737373; font-style: italic; } .tk-s { color: #d6d6d6; } .tk-n { color: #fff; font-weight: 600; } .tk-k { color: #fff; font-weight: 700; } .tk-f { color: #e8e8e8; text-decoration: underline dotted #666; }

/* ---------- Voice Mode ---------- */
.voice-body { display: grid; gap: 16px; text-align: center; }
.orb { width: 132px; height: 132px; margin: 6px auto; border-radius: 50%; border: 2px solid var(--border); background: radial-gradient(circle at 50% 35%, #ffffff22, #0b0b0b 70%); display: grid; place-items: center; transition: transform .15s, border-color .2s; }
.orb.listening { border-color: #fff; animation: pulse 1.6s infinite; } .orb.thinking { border-color: #888; animation: spin 2.2s linear infinite; border-style: dashed; } .orb.speaking { border-color: #fff; box-shadow: 0 0 40px #ffffff55; }
.orb.unavailable { opacity: .5; }
.level { height: 6px; border-radius: 99px; background: #202020; overflow: hidden; width: 70%; margin: 0 auto; } .level > i { display: block; height: 100%; width: 100%; transform-origin: left; transform: scaleX(0); background: #fff; transition: transform .08s linear; }
.transcript { text-align: left; background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; max-height: 210px; overflow-y: auto; display: grid; gap: 8px; font-size: 14px; }
.transcript .u { color: var(--text2); } .transcript .a { color: #fff; }
.voice-controls { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.talk { min-width: 160px; min-height: 52px; border-radius: 99px; font-weight: 600; }

/* ---------- Voice Studio ---------- */
.vgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.vcard { display: grid; gap: 10px; align-content: start; } .vcard h3 { margin: 0; font-size: 16px; overflow-wrap: anywhere; }
.vcard .meta { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; font-size: 13px; } .vcard .meta dt { color: var(--text3); } .vcard .meta dd { margin: 0; color: var(--text2); overflow-wrap: anywhere; }
.vcard .actions { display: flex; flex-wrap: wrap; gap: 6px; }
.states { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 6px; }
.state-pill { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text3); } .state-pill.on { color: #fff; }
.drop { border: 1px dashed #555; border-radius: 12px; padding: 18px; text-align: center; cursor: pointer; background: var(--bg2); } .drop:hover { border-color: #aaa; }
.empty-state { text-align: center; padding: 40px 16px; border: 1px dashed var(--border); border-radius: var(--radius); }
audio { width: 100%; height: 40px; filter: invert(1) grayscale(1) contrast(.9); }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; } dl.kv dt { color: var(--text3); } dl.kv dd { margin: 0; overflow-wrap: anywhere; }

/* ---------- responsif ---------- */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: min(86vw, 320px); transform: translateX(-102%); transition: transform .22s ease; box-shadow: 0 0 60px #000; }
  .shell.open .side { transform: none; }
  .shell.open .scrim { display: block; position: fixed; inset: 0; background: #000a; z-index: 20; }
  .menu-btn { display: inline-flex; }
  .content { padding: 16px; } .model-select { max-width: 150px; }
  .conv .acts { display: flex; }
  .msg.user .bubble { max-width: 94%; }
  .modal { border-radius: 16px; } .overlay { align-items: end; padding: 8px; } .modal.full { height: min(760px, calc(100dvh - 16px)); }
  .vgrid { grid-template-columns: 1fr; } .toasts { left: 16px; }
}

/* ---------- langganan, notifikasi, workspace, gambar ---------- */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; }
.plan { display: grid; gap: 12px; align-content: start; position: relative; }
.plan.current { border-color: #fff; box-shadow: 0 0 40px #ffffff10; }
.plan .price { font-size: 32px; font-weight: 700; letter-spacing: -.03em; } .plan .price small { font-size: 14px; color: var(--text2); font-weight: 400; }
.plan ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; font-size: 14px; color: var(--text2); } .plan li::before { content: "✓ "; color: #fff; }
.bell { position: relative; } .bell .cnt { position: absolute; top: 2px; right: 2px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 99px; background: #fff; color: #000; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.notif { display: grid; gap: 2px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg2); cursor: pointer; text-align: left; width: 100%; } .notif.unread { border-color: #777; background: var(--panel); } .notif b { font-size: 14px; }
.qris { display: grid; place-items: center; background: #fff; border-radius: 14px; padding: 12px; } .qris img { max-width: min(320px, 100%); height: auto; display: block; }
.steps { display: flex; gap: 6px; flex-wrap: wrap; } .step { padding: 4px 12px; border-radius: 99px; border: 1px solid var(--border); font-size: 12.5px; color: var(--text3); } .step.on { color: #000; background: #fff; border-color: #fff; } .step.bad { color: var(--danger); border-color: #5a2a2a; }
.usage-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; } .usage-row .bar { grid-column: 1 / -1; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; } .tab { background: none; border: 0; padding: 10px 16px; color: var(--text2); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; } .tab.on { color: #fff; border-bottom-color: #fff; }
.fm-row { display: grid; grid-template-columns: 24px 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; border-bottom: 1px solid #1c1c1c; } .fm-row:hover { background: #ffffff08; }
.fm-row .nm { background: none; border: 0; text-align: left; cursor: pointer; padding: 4px 0; overflow-wrap: anywhere; } .fm-row .meta { font-size: 12px; color: var(--text3); }
.crumbs { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-family: var(--mono); font-size: 13px; }
.termout { background: #000; border: 1px solid var(--border); border-radius: 12px; padding: 12px; height: min(52dvh, 460px); overflow: auto; font-family: var(--mono); font-size: 13px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.termout .cmd { color: #fff; font-weight: 600; } .termout .err { color: #ff9b9b; } .termout .ok { color: var(--text2); }
.termline { display: flex; gap: 8px; align-items: center; font-family: var(--mono); } .termline .input { font-family: var(--mono); }
.imggrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; } .imgcard { display: grid; gap: 8px; align-content: start; } .imgcard img { width: 100%; border-radius: 10px; border: 1px solid var(--border); background: var(--bg2); aspect-ratio: 1; object-fit: cover; }
.gen-img { margin: .6em 0; display: grid; gap: 8px; justify-items: start; } .gen-img img { max-width: min(100%, 512px); border-radius: 12px; border: 1px solid var(--border); }
.proof img { max-width: 100%; max-height: 70dvh; border-radius: 10px; border: 1px solid var(--border); }
.ta-code { font-family: var(--mono); font-size: 13px; min-height: 50dvh; }
.sparkline { display: flex; gap: 3px; align-items: end; height: 40px; }
@media (max-width: 860px) { .termout { height: 46dvh; } }
.grid { display: grid; gap: 12px; } .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; } @media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } }
.row.gap-s { gap: 6px; }
