:root {
  --bg: #0A0E14; --card: #121821; --card-2: #0D1320; --border: #1F2733;
  --text: #E6EDF3; --muted: #7D8590; --green: #2DE08E; --green-dim: #182E26;
  --cyan: #2DD4FF; --cyan-dim: #11202b; --red: #FF6B6B; --red-dim: #2E1414;
  --amber: #FFB02E; --amber-dim: #2A2008;
  --sans: 'Inter', system-ui, sans-serif; --mono: 'JetBrains Mono', ui-monospace, monospace;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { background: var(--bg); color: var(--text); font-family: var(--sans); -webkit-font-smoothing: antialiased; }
.app { display: flex; min-height: 100vh; }
::-webkit-scrollbar { width: 9px; height: 9px; } ::-webkit-scrollbar-thumb { background: #222b38; border-radius: 5px; } ::-webkit-scrollbar-track { background: transparent; }

.sidebar { width: 240px; flex-shrink: 0; background: var(--card-2); border-right: 1px solid var(--border); padding: 24px 16px 20px; display: flex; flex-direction: column; justify-content: space-between; position: sticky; top: 0; height: 100vh; }
.brand { font-weight: 700; font-size: 19px; color: var(--green); padding-left: 8px; letter-spacing: .3px; }
.brand-sub { font-size: 10px; color: var(--muted); letter-spacing: 1.5px; font-weight: 500; padding-left: 8px; margin-top: 3px; }
.nav { margin-top: 26px; display: flex; flex-direction: column; gap: 4px; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 8px; cursor: pointer; color: var(--muted); font-size: 13.5px; font-weight: 500; transition: .15s; user-select: none; }
.nav-item:hover { background: #11161f; color: var(--text); }
.nav-item .dot { width: 7px; height: 7px; border-radius: 2px; background: currentColor; opacity: .8; }
.nav-item.active { background: var(--green-dim); color: var(--text); font-weight: 600; }
.nav-item.active .dot { background: var(--green); opacity: 1; box-shadow: 0 0 8px var(--green); }
.status-card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 12px 13px; }
.status-row { display: flex; align-items: center; gap: 8px; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.pulse.on { background: var(--green); box-shadow: 0 0 6px var(--green); animation: pulse 1.8s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }
.status-run { font-weight: 600; font-size: 12.5px; flex: 1; }
.badge-dry { font-size: 10px; font-weight: 700; color: var(--amber); }
.status-wallet { font-family: var(--mono); font-size: 10.5px; color: var(--muted); margin-top: 9px; word-break: break-all; }
.status-src { font-size: 10px; color: #4b535d; margin-top: 7px; }

.content { flex: 1; padding: 22px 28px 40px; display: flex; flex-direction: column; gap: 22px; overflow: auto; }
.header { display: flex; justify-content: space-between; align-items: center; }
.title { font-size: 25px; font-weight: 700; }
.subtitle { font-size: 13px; color: var(--muted); margin-top: 4px; font-weight: 500; }
.actions { display: flex; align-items: center; gap: 10px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 7px; font-size: 12px; font-weight: 600; }
.chip-dry { background: var(--amber-dim); border: 1px solid #4d3a0d; color: var(--amber); }
.chip-dry .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); }
.chip-dry.live { background: var(--red-dim); border-color: #5a1f1f; color: var(--red); }
.chip-dry.live .dot { background: var(--red); }
.chip-sync { background: var(--cyan-dim); border: 1px solid #1c3a4a; color: var(--cyan); }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; border: 1px solid transparent; font-family: var(--sans); }
.btn-stop { background: var(--red-dim); border-color: #5a1f1f; color: var(--red); }
.btn-stop:hover { background: #3a1818; }
.btn-stop .sq { width: 9px; height: 9px; border-radius: 2px; background: var(--red); }
.btn-primary { background: var(--green-dim); border-color: #1f5540; color: var(--green); }
.btn-primary:hover { background: #1d3a2e; }
.btn-ghost { background: var(--cyan-dim); border-color: #1c3a4a; color: var(--cyan); }
.btn[disabled] { opacity: .4; cursor: not-allowed; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; }
.card-pad { padding: 17px 20px 18px; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.card-title { font-size: 15px; font-weight: 600; }
.src { font-size: 10.5px; color: #4b535d; font-family: var(--mono); }
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.kpi { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px 17px; }
.kpi-label { font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: .8px; display:flex; justify-content:space-between; }
.kpi-value { font-family: var(--mono); font-weight: 700; font-size: 27px; margin: 10px 0; }
.kpi-value.pos { color: var(--green); } .kpi-value.neg { color: var(--red); }
.kpi-delta { font-size: 12px; font-weight: 500; color: var(--muted); }
.kpi-delta.pos { color: var(--green); } .kpi-delta.neg { color: var(--red); }
.tag { font-size: 9px; font-weight: 700; letter-spacing: .5px; padding: 2px 5px; border-radius: 4px; }
.tag-live { background: var(--cyan-dim); color: var(--cyan); }
.tag-calc { background: #1a2230; color: var(--muted); }
.tag-snap { background: var(--amber-dim); color: var(--amber); }

.middle { display: grid; grid-template-columns: 1fr 340px; gap: 16px; }
.chart-bars { display: flex; align-items: flex-end; gap: 5px; height: 232px; }
.bar { flex: 1; border-radius: 3px 3px 0 0; background: var(--green); opacity: .9; min-height: 2px; }
.bar.down { background: var(--red); opacity: .8; }
.empty-inline { color: var(--muted); font-size: 13px; margin: auto; }

.panel-title { font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: .5px; margin-bottom: 14px; }
.ctrl-row { display: flex; justify-content: space-between; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--border); }
.ctrl-row:last-of-type { border-bottom: none; }
.ctrl-label { font-size: 13px; color: var(--text); font-weight: 500; }
.ctrl-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.seg { display: flex; background: #0a0e15; border: 1px solid var(--border); border-radius: 7px; padding: 2px; }
.seg span { padding: 4px 11px; border-radius: 5px; font-size: 11.5px; font-weight: 600; cursor: pointer; color: var(--muted); }
.seg span.on-dry { background: var(--amber); color: #1a1304; }
.seg span.on-live { background: var(--red); color: #fff; }
.toggle { width: 38px; height: 21px; border-radius: 11px; background: var(--green); position: relative; cursor: pointer; }
.toggle.off { background: #2a3340; } .toggle.off::after { left: 3px; right: auto; }
.toggle::after { content: ''; position: absolute; width: 15px; height: 15px; border-radius: 50%; background: #fff; top: 3px; right: 3px; }
.btn-wide { width: 100%; justify-content: center; margin-top: 14px; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; color: var(--muted); font-weight: 600; letter-spacing: .5px; padding: 0 0 12px; border-bottom: 1px solid var(--border); }
td { padding: 13px 0; border-bottom: 1px solid #161d27; font-size: 13px; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
.tk { font-family: var(--mono); font-weight: 500; }
.pill { display: inline-block; padding: 3px 9px; border-radius: 6px; font-size: 11px; font-weight: 600; }
.pill.deploy { background: var(--green-dim); color: var(--green); }
.pill.close { background: var(--red-dim); color: var(--red); }
.pill.skip { background: #1a2230; color: var(--muted); }
.pill.no_deploy, .pill.nodeploy { background: var(--amber-dim); color: var(--amber); }
.pill.note { background: #1a2230; color: var(--muted); }
.pill.range { background: var(--green-dim); color: var(--green); }
.pill.oor { background: var(--amber-dim); color: var(--amber); }
.actor { font-size: 10px; font-weight: 700; letter-spacing: .5px; padding: 2px 6px; border-radius: 4px; background:#1a2230; color:var(--muted); }
.actor.SCREENER { background: #11202b; color: var(--cyan); }
.actor.MANAGER { background: var(--green-dim); color: var(--green); }
.mono { font-family: var(--mono); }
.pos { color: var(--green); } .neg { color: var(--red); } .dim { color: var(--muted); }
.right { text-align: right; }

.logs { font-family: var(--mono); font-size: 12px; line-height: 2; max-height: 200px; overflow: auto; }
.logs.full { max-height: 540px; }
.logs .t { color: #56606b; } .logs .i { color: var(--cyan); } .logs .ok { color: var(--green); } .logs .w { color: var(--amber); } .logs .e { color: var(--red); }
.grid2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }

.page { display: none; flex-direction: column; gap: 22px; }
.page.active { display: flex; }

.pos-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.range-track { position: relative; height: 8px; background: #0a0e15; border: 1px solid var(--border); border-radius: 5px; margin: 10px 0 6px; }
.range-zone { position: absolute; top: 0; bottom: 0; background: var(--green-dim); border-radius: 4px; }
.range-marker { position: absolute; top: -4px; width: 3px; height: 16px; background: var(--cyan); border-radius: 2px; box-shadow: 0 0 6px var(--cyan); }
.row-2 { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; margin-top: 14px; }
.mini-label { font-size: 10.5px; color: var(--muted); font-weight: 600; letter-spacing: .5px; display:flex; align-items:center; gap:5px; }
.mini-val { font-family: var(--mono); font-size: 16px; margin-top: 4px; }
.empty-slot { border: 1px dashed #29333f; border-radius: 12px; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 13px; min-height: 220px; flex-direction: column; gap: 6px; grid-column: 1 / -1; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filter { padding: 6px 13px; border-radius: 7px; font-size: 12.5px; font-weight: 600; cursor: pointer; color: var(--muted); background: var(--card); border: 1px solid var(--border); }
.filter.active { background: var(--green-dim); color: var(--green); border-color: #1f5540; }

.cfg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field { display: flex; justify-content: space-between; align-items: center; padding: 11px 0; border-bottom: 1px solid #161d27; }
.field:last-child { border-bottom: none; }
.field-label { font-size: 13px; font-weight: 500; font-family: var(--mono); }
.input { background: #0a0e15; border: 1px solid var(--border); border-radius: 7px; padding: 7px 11px; color: var(--text); font-family: var(--mono); font-size: 13px; width: 120px; text-align: right; }
.input:focus { outline: none; border-color: var(--green); }
select.input { width: auto; min-width: 132px; text-align: left; cursor: pointer; }
select.input option { background: #0a0e15; color: var(--text); }
.input.wide { width: 230px; text-align: left; }
.ro-val { max-width: 230px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.field[title] .field-label { cursor: help; border-bottom: 1px dotted #2a3442; }
.warn-banner { display:flex; gap:10px; align-items:center; background: var(--amber-dim); border: 1px solid #4d3a0d; color: var(--amber); padding: 12px 16px; border-radius: 10px; font-size: 13px; }
.search { flex: 1; background: #0a0e15; border: 1px solid var(--border); border-radius: 7px; padding: 7px 11px; color: var(--text); font-size: 12.5px; font-family: var(--mono); }
.search:focus { outline: none; border-color: var(--green); }
.logbar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }

.legend { display:flex; gap:18px; flex-wrap:wrap; align-items:center; color: var(--muted); font-size: 11.5px; padding: 6px 2px; }
.legend b { color: var(--text); }
.empty-state { color: var(--muted); font-size: 13px; text-align: center; padding: 30px; }

/* ── pipeline page ── */
.progress { height: 9px; background: var(--card-2); border: 1px solid var(--border); border-radius: 99px; overflow: hidden; margin: 6px 0 10px; }
.progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--cyan), var(--green)); border-radius: 99px; transition: width .6s linear; }
.progress-fill.due { background: var(--amber); }
.progress.slim { height: 6px; margin: 8px 0 2px; max-width: 340px; }
.cycle-label { font-size: 12.5px; color: var(--cyan); }

.stepper { display: flex; align-items: flex-start; padding: 6px 0 2px; }
.step { flex: 1; text-align: center; min-width: 0; }
.step-ico { width: 32px; height: 32px; border-radius: 50%; margin: 0 auto 9px; display: flex; align-items: center; justify-content: center; font: 600 13px var(--mono); background: var(--card-2); border: 1px solid var(--border); color: var(--muted); }
.step-label { font-size: 12.5px; font-weight: 600; }
.step-sub { font-size: 11px; color: var(--muted); margin-top: 3px; padding: 0 8px; overflow-wrap: break-word; }
.step.pending .step-label { color: var(--muted); }
.step.done .step-ico { background: var(--green-dim); border-color: #1f5540; color: var(--green); }
.step.active .step-ico { background: var(--cyan-dim); border-color: var(--cyan); color: var(--cyan); animation: stepPulse 1.6s ease-in-out infinite; }
.step.active .step-label { color: var(--cyan); }
.step-line { flex: 0 0 26px; height: 1px; background: var(--border); margin-top: 16px; }
@keyframes stepPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(45,212,255,.35); } 50% { box-shadow: 0 0 0 6px rgba(45,212,255,0); } }
.pipe-decision { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); font-size: 12.5px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.mile { display: flex; gap: 14px; padding: 13px 2px; border-bottom: 1px solid var(--border); }
.mile:last-child { border-bottom: none; }
.mile-rail { display: flex; flex-direction: column; align-items: center; }
.mile-ico { width: 28px; height: 28px; border-radius: 50%; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; font: 600 12px var(--mono); background: var(--card-2); border: 1px solid var(--border); color: var(--muted); }
.mile-rail .rail { flex: 1; width: 1px; background: var(--border); margin-top: 4px; }
.mile:last-child .rail { display: none; }
.mile.done .mile-ico { background: var(--green-dim); border-color: #1f5540; color: var(--green); }
.mile.active .mile-ico { background: var(--cyan-dim); border-color: var(--cyan); color: var(--cyan); animation: stepPulse 1.6s ease-in-out infinite; }
.mile.locked .mile-ico { color: var(--red); }
.mile-title { font-size: 13.5px; font-weight: 600; display: flex; gap: 8px; align-items: center; }
.mile-desc { font-size: 12px; color: var(--muted); margin-top: 3px; }
.mile-prog-label { font-size: 11px; color: var(--muted); font-family: var(--mono); margin-top: 4px; }
.pill.done { background: var(--green-dim); color: var(--green); }
.pill.active { background: var(--cyan-dim); color: var(--cyan); }
.pill.pending { background: #1a2230; color: var(--muted); }
.pill.locked { background: var(--red-dim); color: var(--red); }
.pill.running { background: var(--cyan-dim); color: var(--cyan); }
.pill.idle { background: #1a2230; color: var(--muted); }

/* ── auth & pin overlay ── */
.auth-overlay { position: fixed; inset: 0; background: rgba(4,7,12,.82); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; z-index: 100; }
.auth-card { width: 340px; background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 28px 26px; text-align: center; box-shadow: 0 18px 60px rgba(0,0,0,.5); }
.auth-card .field-label { text-align: left; margin: 14px 0 6px; }
.auth-input { width: 100%; box-sizing: border-box; margin-bottom: 12px; padding: 10px 12px; font-size: 14px; text-align: center; letter-spacing: 1px; }
.auth-msg { margin-top: 12px; font-size: 12px; color: var(--amber); min-height: 16px; }
.pin-desc { font-size: 13px; color: var(--text); margin: 10px 0 14px; }

/* ── cycle diagram ── */
.cycle-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.cycle-ring { position: relative; width: 320px; height: 320px; }
.cycle-svg { width: 100%; height: 100%; }
.cycle-dotg { transform-origin: 150px 150px; animation: orbit 14s linear infinite; }
.cycle-svg.idle .cycle-dotg { animation-play-state: paused; opacity: .35; }
@keyframes orbit { to { transform: rotate(360deg); } }
.cnode { position: absolute; transform: translate(-50%, -50%); width: 92px; padding: 9px 6px 8px;
  background: var(--card-2); border: 1px solid var(--border); border-radius: 10px;
  text-align: center; font-size: 12px; font-weight: 600; color: var(--muted);
  cursor: pointer; user-select: none; transition: border-color .2s, color .2s, box-shadow .2s; }
.cnode:hover { border-color: var(--muted); color: var(--text); }
.cnode-ico { font-size: 16px; margin-bottom: 3px; }
.cnode.active { border-color: var(--cyan); color: var(--cyan); background: var(--cyan-dim);
  animation: stepPulse 1.6s ease-in-out infinite; }
.cnode.selected { border-color: var(--green); color: var(--green); }
.cnode.selected.active { border-color: var(--cyan); }
.cycle-status { font-size: 12.5px; min-height: 18px; text-align: center; max-width: 640px;
  display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap; }
.cycle-detail { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.detail-foot { margin-top: 12px; font-size: 11px; }
.sse-ind { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); }
.sse-ind .sdot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.sse-ind.ok .sdot { background: var(--green); }
.sse-ind.ok { color: var(--green); }
.sse-ind.bad .sdot { background: var(--red); }
.sse-ind.bad { color: var(--red); }

/* ── result pop-up (konfirmasi dinamis aksi ber-PIN) ── */
.result-card { width: 390px; }
.result-ico { width: 54px; height: 54px; margin: 0 auto 12px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 700; }
.result-card.success .result-ico { background: var(--green-dim); color: var(--green); border: 1px solid #1f5540; box-shadow: 0 0 20px rgba(45,224,142,.25); }
.result-card.error   .result-ico { background: var(--red-dim); color: var(--red); border: 1px solid #5a1f1f; box-shadow: 0 0 20px rgba(255,107,107,.2); }
.result-card.warn    .result-ico { background: var(--amber-dim); color: var(--amber); border: 1px solid #4d3a0d; }
.result-card.pending .result-ico { background: var(--cyan-dim); border: 1px solid #1c3a4a; }
.result-title { font-size: 15px; font-weight: 700; letter-spacing: .8px; margin-bottom: 6px; }
.result-card.success .result-title { color: var(--green); }
.result-card.error   .result-title { color: var(--red); }
.result-card.warn    .result-title { color: var(--amber); }
.result-card.pending .result-title { color: var(--cyan); }
.result-sub { font-size: 12.5px; color: var(--muted); line-height: 1.55; margin-bottom: 14px; white-space: pre-line; }
.result-rows { width: 100%; font-size: 12px; margin-bottom: 16px; border-collapse: collapse; }
.result-rows td { padding: 6px 4px; border-bottom: 1px solid var(--border); text-align: left; }
.result-rows td:last-child { text-align: right; }
.result-spin { width: 22px; height: 22px; border: 3px solid var(--border); border-top-color: var(--cyan); border-radius: 50%; animation: result-spin .8s linear infinite; }
@keyframes result-spin { to { transform: rotate(360deg); } }

/* ── toast (notifikasi non-blocking, mis. bot berhenti) ── */
#toast-host { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 10px; z-index: 120; max-width: 360px; }
.toast { background: var(--card); border: 1px solid var(--border); border-left: 3px solid var(--cyan); border-radius: 10px; padding: 12px 14px; box-shadow: 0 10px 34px rgba(0,0,0,.45); cursor: pointer; animation: toast-in .25s ease; }
.toast.error   { border-left-color: var(--red); }
.toast.success { border-left-color: var(--green); }
.toast.warn    { border-left-color: var(--amber); }
.toast-title { font-size: 12.5px; font-weight: 700; margin-bottom: 3px; }
.toast.error   .toast-title { color: var(--red); }
.toast.success .toast-title { color: var(--green); }
.toast.warn    .toast-title { color: var(--amber); }
.toast-msg { font-size: 12px; color: var(--muted); line-height: 1.5; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
