:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --line: #e3e8f2;
  --ink: #1a2333;
  --muted: #64748b;
  --brand: #4f46e5;
  --brand-dark: #4338ca;
  --ok: #16a34a;
  --warn: #d97706;
  --bad: #dc2626;
  --console-bg: #0f172a;
  --console-ink: #d7e2f4;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.45;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.dot.gray { background: #94a3b8; }
.dot.green { background: var(--ok); }
.dot.red { background: var(--bad); }
.dot.orange { background: var(--warn); }
.dot.blue { background: #3b82f6; }
code { background: #eef1f7; padding: 1px 5px; border-radius: 5px; font-size: 12.5px; }

/* ── Login ── */
#login-view { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 36px 32px; width: 360px; max-width: 92vw; box-shadow: 0 12px 40px rgba(30,41,59,.08);
  text-align: center;
}
.login-logo { font-size: 40px; }
.login-card h1 { margin: 8px 0 4px; }
.login-card input { width: 100%; margin: 16px 0 10px; }
#login-err { color: var(--bad); min-height: 18px; }

/* ── Layout utama ── */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--card); border-bottom: 1px solid var(--line);
  padding: 10px 20px; position: sticky; top: 0; z-index: 5;
}
.brand { font-size: 17px; }
.brand .sub { color: var(--muted); font-weight: 400; font-size: 12px; margin-left: 8px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.chip {
  background: #eef2ff; border: 1px solid #c7d2fe; color: var(--brand-dark);
  border-radius: 999px; padding: 6px 14px; font-size: 13px; cursor: pointer; font-family: inherit;
}
.chip .dot { margin-right: 7px; }
.banner { margin: 10px 20px 0; padding: 8px 14px; border-radius: 10px; background: #fef3c7; border: 1px solid #fde68a; }

main#groups { max-width: 1080px; margin: 0 auto; padding: 18px 20px 60px; }
.group { margin-bottom: 26px; }
.group h2 { font-size: 15px; margin: 0 0 2px; }
.group .gdesc { color: var(--muted); font-size: 13px; margin: 0 0 12px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 13px 15px; cursor: pointer; transition: border .12s, box-shadow .12s, transform .05s;
  display: flex; flex-direction: column; gap: 3px; text-align: left; font-family: inherit;
}
.card:hover { border-color: var(--brand); box-shadow: 0 4px 14px rgba(79,70,229,.12); }
.card .clabel { font-weight: 600; font-size: 14px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card .cdesc { color: var(--muted); font-size: 12.5px; flex: 1; }
.card .ctag { font-size: 10.5px; border-radius: 6px; padding: 2px 7px; white-space: nowrap; }
.ctag.confirm { background: #fee2e2; color: #b91c1c; }
.ctag.direct { background: #dcfce7; color: #15803d; }
.foot { max-width: 1080px; margin: 0 auto; padding: 0 20px 30px; }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,.45); backdrop-filter: blur(2px);
  display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 16px; z-index: 20;
}
.modal {
  background: var(--card); border-radius: 16px; padding: 22px 24px; width: 440px; max-width: 96vw;
  box-shadow: 0 24px 70px rgba(0,0,0,.25); position: relative; max-height: 88vh; overflow-y: auto;
}
.modal.wide { width: 860px; }
.modal h3 { margin: 0 0 8px; }
.modal .close-x { position: absolute; top: 12px; right: 12px; }
.modal input[type=password], .modal input[type=text] { width: 100%; }
.row { display: flex; gap: 8px; margin: 12px 0 6px; flex-wrap: wrap; }
.help { margin-top: 14px; font-size: 13px; }
.help summary { cursor: pointer; color: var(--brand-dark); }
.help ol { padding-left: 20px; color: var(--muted); }

/* ── Job console ── */
.job-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.job-head h3 { margin-bottom: 2px; }
.job-actions { display: flex; gap: 6px; }
#job-stage { margin: 10px 0; }
.stage-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.stage-hint { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.extra-row { margin: 10px 0 4px; }
.extra-row label { font-size: 12.5px; color: var(--muted); display: block; margin-bottom: 4px; }
.extra-row input { width: 220px; }
.console-wrap { border: 1px solid #1e293b; border-radius: 10px; overflow: hidden; }
.console-head {
  display: flex; align-items: center; gap: 6px; background: #1e293b; color: #cbd5e1;
  font-size: 12.5px; padding: 7px 12px;
}
.console-head .spacer { flex: 1; }
.console {
  margin: 0; background: var(--console-bg); color: var(--console-ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.2px; line-height: 1.55; padding: 12px 14px;
  height: 46vh; min-height: 260px; overflow-y: auto; white-space: pre-wrap; word-break: break-word;
}
.console.empty { color: #64748b; font-style: italic; }
#job-note { margin-top: 8px; min-height: 16px; }

/* ── Tombol ── */
.btn {
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 9px; padding: 8px 15px; font-size: 14px; cursor: pointer; font-family: inherit;
  transition: background .12s, border .12s;
}
.btn:hover { border-color: #c3cad8; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.danger:hover { filter: brightness(.93); }
.btn.danger.ghost { background: transparent; color: var(--bad); border-color: #fecaca; }
.btn.ghost { background: transparent; }
.btn.block { width: 100%; }
.btn.small { padding: 5px 11px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Toast ── */
#toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 50; display: flex; flex-direction: column; gap: 6px; align-items: center; }
.toast-item {
  background: #1e293b; color: #f1f5f9; padding: 9px 18px; border-radius: 999px;
  font-size: 13.5px; box-shadow: 0 8px 24px rgba(0,0,0,.25); max-width: 80vw; animation: pop .15s ease;
}
.toast-item.err { background: #7f1d1d; }
@keyframes pop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; } }

input[type=password], input[type=text] {
  border: 1px solid var(--line); border-radius: 9px; padding: 9px 12px; font-size: 14px;
  font-family: inherit; background: #fbfcfe;
}
input:focus { outline: 2px solid #c7d2fe; border-color: var(--brand); }
