:root {
  --bg: #12151b;
  --panel: #1a1f27;
  --panel-2: #222833;
  --line: #2e3542;
  --text: #e7eaf0;
  --muted: #8d97a8;
  --accent: #5aa9ff;
  --ok: #3ccf8e;
  --warn: #f2b84b;
  --bad: #ff6b6b;
  --idle: #8d97a8;
  --radius: 10px;
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-size: 14px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Login ---------- */
.login-page { display: grid; place-items: center; padding: 16px; }
.login-card { width: min(360px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 28px; display: grid; gap: 10px; }
.login-card h1 { margin: 6px 0 0; font-size: 22px; }
.login-card p { margin: 0 0 8px; color: var(--muted); }
.login-card input { padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); }
.login-card button { margin-top: 6px; padding: 11px; border: 0; border-radius: 8px; background: var(--accent); color: #06121f; font-weight: 600; }
.login-err { color: var(--bad); min-height: 1.2em; }
.login-logo { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; width: 34px; height: 34px; }
.login-logo span { border-radius: 3px; background: var(--accent); }
.login-logo span:nth-child(2) { background: var(--ok); }
.login-logo span:nth-child(3) { background: var(--warn); }
.login-logo span:nth-child(4) { background: #e0779a; }
.login-logo.small { width: 26px; height: 26px; gap: 2px; }

/* ---------- Layout ---------- */
.topbar { height: 56px; display: flex; align-items: center; gap: 16px; padding: 0 16px; border-bottom: 1px solid var(--line); background: var(--panel); }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand strong { display: block; font-size: 15px; }
.brand small { color: var(--muted); }
.meters { display: flex; align-items: center; gap: 18px; margin-left: auto; }
.meter { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.meter .bar { width: 90px; height: 6px; border-radius: 3px; background: var(--panel-2); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: var(--ok); transition: width .4s; }
.meter b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; min-width: 34px; }
.q-age { color: var(--muted); font-size: 11px; white-space: nowrap; cursor: help; }
.q-age.stale { color: var(--warn); }
.pill { padding: 4px 10px; border-radius: 999px; background: var(--panel-2); font-size: 12px; color: var(--muted); white-space: nowrap; }
.pill.live { color: var(--ok); }
.ghost { text-decoration: none; background: transparent; border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; color: var(--muted); }
.ghost:hover { color: var(--text); border-color: var(--muted); }

.layout { display: grid; grid-template-columns: 1fr 400px; height: calc(100% - 56px); }
.office-wrap { position: relative; min-width: 0; overflow: hidden; background: #0d1015; }
#office { display: block; width: 100%; height: 100%; cursor: default; }
.ticker { position: absolute; left: 12px; top: 10px; display: grid; gap: 4px; pointer-events: none; max-width: min(560px, calc(100% - 24px)); }
.ticker div { background: rgba(18, 21, 27, .86); border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; animation: fadein .3s; }
.ticker b { margin-right: 6px; }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } }
.legend { position: absolute; left: 12px; bottom: 10px; display: flex; gap: 14px; flex-wrap: wrap; font-size: 11px; color: var(--muted); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: 0; }
.dot.idle { background: var(--idle); } .dot.queued { background: var(--warn); } .dot.running { background: var(--ok); } .dot.error { background: var(--bad); }

.side { border-left: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tabs button { flex: 1; background: none; border: 0; padding: 12px 6px; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); }
.panel { flex: 1; overflow: auto; padding: 16px; min-height: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; color: var(--muted); }

/* ---------- Form ---------- */
.form { display: grid; gap: 12px; }
.form label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; }
.form select, .form textarea, .detail textarea { width: 100%; padding: 9px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font-size: 14px; }
textarea { resize: vertical; }
.seg { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seg legend { color: var(--muted); font-size: 12px; margin-bottom: 6px; padding: 0; }
.seg label { display: block; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: grid; gap: 2px; padding: 9px 10px; border-radius: 8px; border: 1px solid var(--line); color: var(--text); font-size: 13px; cursor: pointer; }
.seg small { color: var(--muted); font-size: 11px; }
.seg input:checked + span { border-color: var(--accent); background: rgba(90, 169, 255, .1); }
.seg input:disabled + span { opacity: .4; cursor: not-allowed; }
.seg input:focus-visible + span { outline: 2px solid var(--accent); }
.primary { padding: 11px; border: 0; border-radius: 8px; background: var(--accent); color: #06121f; font-weight: 600; }
.primary:disabled { opacity: .5; cursor: wait; }
.hint { margin: -4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.form-err { color: var(--bad); margin: 0; min-height: 1em; }

/* ---------- Lists ---------- */
.list { display: grid; gap: 8px; }
.card { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; background: var(--panel-2); display: grid; gap: 4px; text-align: left; width: 100%; }
button.card:hover { border-color: var(--muted); }
.card .row { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.card .who { display: flex; align-items: center; gap: 8px; font-weight: 600; min-width: 0; }
.card p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.4; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.card small { color: var(--muted); font-size: 11px; }
.avatar { width: 22px; height: 22px; border-radius: 50%; flex: none; display: inline-grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff; }
.chip { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--bg); color: var(--muted); white-space: nowrap; }
.chip.running { color: var(--ok); } .chip.queued { color: var(--warn); } .chip.error { color: var(--bad); } .chip.done { color: var(--accent); }
.empty { color: var(--muted); text-align: center; padding: 30px 10px; }

/* ---------- Detail ---------- */
.detail { display: grid; gap: 14px; }
.detail h2 { margin: 0; font-size: 17px; display: flex; align-items: center; gap: 10px; }
.detail h3 { margin: 0 0 6px; font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; }
.prompt { background: var(--bg); border-radius: 8px; padding: 10px; white-space: pre-wrap; font-size: 13px; }
.log { background: #0d1015; border: 1px solid var(--line); border-radius: 8px; padding: 8px; max-height: 260px; overflow: auto; font: 12px/1.5 ui-monospace, "JetBrains Mono", Menlo, monospace; }
.log div { padding: 1px 0; white-space: pre-wrap; word-break: break-word; }
.log .k-tool { color: #9fc6ff; } .log .k-say { color: var(--text); } .log .k-err, .log .k-deny { color: var(--bad); }
.log .k-sys { color: var(--muted); } .log .k-done { color: var(--ok); } .log .k-ceo { color: var(--warn); }
.log time { color: #556070; margin-right: 6px; }
.md { font-size: 13px; line-height: 1.55; overflow-wrap: anywhere; }
.md h1, .md h2, .md h3, .md h4 { font-size: 14px; margin: 12px 0 4px; }
.md p { margin: 6px 0; } .md ul, .md ol { margin: 6px 0; padding-left: 20px; }
.md code { background: var(--bg); padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.md pre { background: var(--bg); padding: 10px; border-radius: 8px; overflow: auto; }
.md pre code { padding: 0; background: none; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.actions button { padding: 7px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); }
.actions button.go { background: var(--accent); border-color: var(--accent); color: #06121f; font-weight: 600; }
.actions button.danger { color: var(--bad); }
.plan { display: grid; gap: 8px; }
.plan .card select { padding: 4px 6px; border-radius: 6px; background: var(--bg); border: 1px solid var(--line); font-size: 12px; }
.back { background: none; border: 0; color: var(--accent); padding: 0; justify-self: start; }
a { color: var(--accent); }

dialog { width: min(1000px, 94vw); height: 84vh; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--text); padding: 0; }
dialog::backdrop { background: rgba(0, 0, 0, .6); }
.dlg-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.diff { margin: 0; padding: 12px 14px; height: calc(100% - 50px); overflow: auto; font: 12px/1.5 ui-monospace, Menlo, monospace; }
.diff .a { color: var(--ok); } .diff .d { color: var(--bad); } .diff .h { color: var(--accent); } .diff .f { color: var(--warn); font-weight: 700; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; grid-template-rows: auto 1fr; height: auto; min-height: calc(100% - 56px); }
  .office-wrap { height: calc(100vw * 34 / 56 + 34px); }
  #office { height: calc(100% - 34px); }
  .brand small { display: none; }
  .brand strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 38vw; }
  .topbar { gap: 10px; }
  .side { border-left: 0; border-top: 1px solid var(--line); }
  .meter span, .meter .bar { display: none; }
  .meters { gap: 8px; }
  .ticker { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- Keamanan ---------- */
.login-card[hidden], [hidden] { display: none !important; }
.sec-page { max-width: 560px; margin: 0 auto; padding: 32px 16px 48px; display: grid; gap: 16px; }
.sec-page header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sec-page h1 { margin: 0; font-size: 20px; }
.sec-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 20px; display: grid; gap: 12px; }
.sec-card h2 { margin: 0; font-size: 15px; }
.sec-card p, .sec-card li { color: var(--muted); margin: 0; line-height: 1.5; }
.sec-card ol { margin: 0; padding-left: 20px; display: grid; gap: 4px; }
.sec-card input { padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); width: 100%; }
.sec-card label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; }
.sec-row { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.qr { width: 184px; height: 184px; background: #fff; border-radius: 12px; padding: 6px; flex: none; }
.qr svg { width: 100%; height: 100%; display: block; }
.secret { font: 13px/1.5 ui-monospace, Menlo, monospace; background: var(--bg); padding: 8px 10px; border-radius: 8px; word-break: break-all; color: var(--text); }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; font: 14px ui-monospace, Menlo, monospace; background: var(--bg); padding: 12px; border-radius: 8px; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; background: var(--panel-2); }
.badge.on { color: var(--ok); } .badge.off { color: var(--warn); }
.ok-msg { color: var(--ok); margin: 0; }
.tok { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.tok div { display: flex; justify-content: space-between; gap: 8px; background: var(--bg); border-radius: 8px; padding: 7px 10px; font-size: 12px; color: var(--muted); }
.tok b { color: var(--text); font-variant-numeric: tabular-nums; font-weight: 600; }
.tok .tok-total { grid-column: 1 / -1; }
@media (max-width: 900px) { .q-age { display: none; } }
.actions + .hint { margin-top: 8px; }
.owner { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; margin-top: 4px; }
.owner select { flex: 1; min-width: 0; padding: 4px 6px; border-radius: 6px; background: var(--bg); border: 1px solid var(--line); font-size: 12px; }
.owner .ghost, .suggest .ghost { padding: 3px 8px; font-size: 11px; }
.suggest { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; color: var(--muted); background: rgba(90, 169, 255, .08); border-radius: 8px; padding: 6px 8px; }
.suggest b { color: var(--text); } .suggest .ghost { margin-left: auto; }
.muted { color: var(--muted); font-size: 11px; }
