/* NAK Portal — tema gelap, hand-rolled, font sistem. */
:root {
  --bg: #0b0f14;
  --bg-2: #10161d;
  --surface: #141c25;
  --surface-2: #1a232e;
  --border: #243040;
  --border-2: #2e3b4d;
  --text: #e6edf3;
  --text-dim: #9fb0c3;
  --muted: #6b7d92;
  --accent: #2dd4a7;
  --accent-2: #1f9d7c;
  --accent-ink: #04140f;
  --blue: #4aa3ff;
  --amber: #f0a848;
  --red: #f2637e;
  --green: #46c98b;
  --violet: #a78bfa;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: radial-gradient(1200px 600px at 80% -10%, #16202b 0%, var(--bg) 55%) fixed;
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.dim { color: var(--text-dim); }

/* ---------- Login ---------- */
.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 28px;
  box-shadow: var(--shadow);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}
.brand .logo {
  width: 40px; height: 40px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-ink);
  display: grid; place-items: center;
  font-weight: 800; font-size: 18px;
  letter-spacing: -0.5px;
}
.brand h1 { font-size: 19px; margin: 0; letter-spacing: -0.3px; }
.brand .sub { font-size: 12px; color: var(--muted); margin: 0; }
.login-card p.hint { color: var(--text-dim); font-size: 13px; margin: 6px 0 22px; }
label { display: block; font-size: 12.5px; color: var(--text-dim); margin: 14px 0 6px; font-weight: 600; }
input, select {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(45, 212, 167, 0.15);
}
.password-field { position: relative; }
.password-field input { padding-right: 104px; }
.password-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  min-width: 84px;
  border: 0;
  background: transparent;
  color: var(--accent-2);
  padding: 7px 8px;
  border-radius: 7px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.password-toggle:hover { background: var(--surface-2); }
.password-toggle:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 1px;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-ink);
  border: none;
  border-radius: var(--radius-sm);
  padding: 11px 16px;
  font-size: 14px; font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: filter 0.15s, transform 0.05s;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(1px); }
.btn.secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border-2);
}
.btn.block { width: 100%; margin-top: 20px; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.form-msg { font-size: 13px; margin-top: 14px; min-height: 18px; }
.form-msg.err { color: var(--red); }
.form-msg.ok { color: var(--green); }

/* ---------- Shell ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  padding: 12px 22px;
  background: rgba(11, 15, 20, 0.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar .brand { margin: 0; }
.topbar .spacer { flex: 1; }
.topbar .who { font-size: 13px; color: var(--text-dim); }
.topbar .who b { color: var(--text); }
.linkbtn {
  background: transparent; border: 1px solid var(--border-2);
  color: var(--text-dim); border-radius: 8px; padding: 7px 12px;
  font-size: 13px; cursor: pointer; font-family: inherit;
}
.linkbtn:hover { color: var(--text); border-color: var(--accent-2); text-decoration: none; }
.linkbtn[hidden] { display: none; }

.wrap { max-width: 1240px; margin: 0 auto; padding: 22px; }
.updated { font-size: 12px; color: var(--muted); margin: 0 0 16px; }

/* ---------- Nav tiles ---------- */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 22px;
}
.tile {
  display: flex; align-items: center; gap: 11px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  color: var(--text);
  transition: transform 0.08s, border-color 0.15s, background 0.15s;
}
.tile:hover { text-decoration: none; border-color: var(--accent-2); background: var(--surface-2); transform: translateY(-1px); }
.tile .ico {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--border-2);
}
.nak-icon { width: 19px; height: 19px; display: block; }
.heading-icon { display: inline-grid; place-items: center; color: var(--accent); }
.heading-icon .nak-icon { width: 18px; height: 18px; }
.tile .t-name { font-size: 13.5px; font-weight: 650; }
.tile .t-sub { font-size: 11px; color: var(--muted); }

/* ---------- Monitors grid ---------- */
.monitors {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 900px) { .monitors { grid-template-columns: 1fr; } }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.card > h2 {
  font-size: 15px; margin: 0 0 2px; letter-spacing: -0.2px;
  display: flex; align-items: center; gap: 9px;
}
.card > h2 .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.card .card-sub { font-size: 12px; color: var(--muted); margin: 0 0 15px; }

.section-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); font-weight: 700; margin: 18px 0 9px;
}

/* Stat pills (status penawaran) */
.statgrid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
}
.stat {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 11px;
}
.stat .k { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-dim); font-weight: 700; }
.stat .v { font-size: 20px; font-weight: 750; letter-spacing: -0.5px; margin-top: 2px; }
.stat .n { font-size: 11px; color: var(--muted); margin-top: 1px; }
.stat.accent { border-color: var(--accent-2); box-shadow: inset 0 0 0 1px rgba(45,212,167,0.12); }

.kpirow { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 4px; }
.kpi {
  background: linear-gradient(135deg, var(--surface-2), var(--bg-2));
  border: 1px solid var(--border-2); border-radius: var(--radius-sm);
  padding: 12px 13px;
}
.kpi .k { font-size: 11px; color: var(--text-dim); font-weight: 650; }
.kpi .v { font-size: 22px; font-weight: 800; letter-spacing: -0.6px; margin-top: 2px; }
.kpi .v.accent { color: var(--accent); }

/* Lists */
.rowlist { display: flex; flex-direction: column; gap: 7px; }
.rowitem {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.rowitem .main { flex: 1; min-width: 0; }
.rowitem .l1 { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rowitem .l2 { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rowitem .val { font-size: 12.5px; font-weight: 700; text-align: right; white-space: nowrap; }

/* Badges */
.badge {
  display: inline-block; font-size: 10.5px; font-weight: 700;
  padding: 2px 8px; border-radius: 999px; letter-spacing: 0.02em;
  border: 1px solid transparent; white-space: nowrap;
}
.badge.b-draft   { background: rgba(107,125,146,0.16); color: #b6c4d4; border-color: rgba(107,125,146,0.3); }
.badge.b-sent    { background: rgba(74,163,255,0.15); color: #7cbcff; border-color: rgba(74,163,255,0.32); }
.badge.b-followup{ background: rgba(240,168,72,0.15); color: #f4bd74; border-color: rgba(240,168,72,0.32); }
.badge.b-accepted{ background: rgba(70,201,139,0.15); color: #6fdca8; border-color: rgba(70,201,139,0.32); }
.badge.b-rejected{ background: rgba(242,99,126,0.15); color: #f6899e; border-color: rgba(242,99,126,0.32); }
.badge.b-expired { background: rgba(167,139,250,0.14); color: #bda9fb; border-color: rgba(167,139,250,0.32); }
.badge.bl { background: var(--surface-2); color: var(--text-dim); border-color: var(--border-2); }

/* Progress bars */
.bar { height: 7px; border-radius: 999px; background: var(--bg); overflow: hidden; margin-top: 6px; border: 1px solid var(--border); }
.bar > span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent-2), var(--accent)); }
.bar.low > span { background: linear-gradient(90deg, #c0455f, var(--red)); }
.bar.mid > span { background: linear-gradient(90deg, #c98a2f, var(--amber)); }
.progitem { padding: 9px 11px; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.progitem .top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.progitem .top .pct { font-weight: 750; }

/* Type/status chips row */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-size: 11.5px; padding: 4px 9px; border-radius: 8px;
  background: var(--bg-2); border: 1px solid var(--border); color: var(--text-dim);
}
.chip b { color: var(--text); font-weight: 750; }

/* Expiring strip */
.strip {
  margin-top: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--amber);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.strip h2 { font-size: 14px; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.expgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 720px) { .expgrid { grid-template-columns: 1fr; } .statgrid { grid-template-columns: repeat(2,1fr);} }
.exp {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 11px 12px;
}
.exp .t { font-size: 13px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.exp .c { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.exp .d { font-size: 12px; font-weight: 700; margin-top: 6px; }
.exp .d.warn { color: var(--amber); }
.exp .d.over { color: var(--red); }

.empty { font-size: 12.5px; color: var(--muted); padding: 10px 0; }
.err-note {
  font-size: 12.5px; color: var(--red);
  background: rgba(242,99,126,0.08); border: 1px solid rgba(242,99,126,0.25);
  border-radius: var(--radius-sm); padding: 10px 12px;
}
.skeleton { color: var(--muted); font-size: 13px; padding: 8px 0; }

/* ---------- Settings ---------- */
.settings-wrap { max-width: 720px; margin: 0 auto; padding: 22px; }
.field-help { font-size: 12px; color: var(--muted); margin: 5px 0 0; }
.rowflex { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.rowflex > div { flex: 1; min-width: 180px; }
.card.settings { margin-top: 4px; }
.testout { margin-top: 12px; font-size: 13px; min-height: 18px; }
.testout.ok { color: var(--green); }
.testout.err { color: var(--red); }
.actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }

/* ---------- Docs ---------- */
.docs-body { padding: 0; }
.docs-wrap { max-width: 860px; margin: 0 auto; padding: 34px 22px; }
.docs-wrap h1 { font-size: 24px; letter-spacing: -0.4px; }
.doclist { line-height: 2; }
.md h1, .md h2, .md h3 { letter-spacing: -0.3px; margin-top: 1.4em; }
.md h1 { font-size: 24px; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.md h2 { font-size: 19px; }
.md h3 { font-size: 16px; }
.md code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 5px; padding: 1px 5px; font-family: var(--mono); font-size: 0.88em; }
.md pre { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; overflow-x: auto; }
.md pre code { background: none; border: none; padding: 0; }
.md blockquote { border-left: 3px solid var(--accent-2); margin: 1em 0; padding: 2px 14px; color: var(--text-dim); background: var(--bg-2); border-radius: 0 8px 8px 0; }
.md ul { padding-left: 22px; }
.md a { text-decoration: underline; }
.back { font-size: 13px; color: var(--text-dim); }

/* ---------- Manajemen Akun ---------- */
.akun-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 12px;
}
.note-timeline {
  font-size: 12.5px; color: var(--text-dim);
  background: rgba(74,163,255,0.08); border: 1px solid rgba(74,163,255,0.22);
  border-radius: var(--radius-sm); padding: 9px 12px; margin: 0 0 16px;
}
.note-timeline b { color: var(--text); }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.acctable { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 720px; }
.acctable thead th {
  text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); font-weight: 700; padding: 12px 14px; border-bottom: 1px solid var(--border);
  background: var(--bg-2);
}
.acctable tbody td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.acctable tbody tr:last-child td { border-bottom: none; }
.acctable tbody tr:hover { background: var(--surface-2); }
.ta-right { text-align: right; }
.mono { font-family: var(--mono); font-size: 12.5px; color: var(--text); }
.actions-cell { white-space: nowrap; }
.actions-cell .linkbtn { margin-left: 5px; }

.linkbtn.xs { padding: 4px 9px; font-size: 12px; border-radius: 7px; }

.badge.b-admin { background: rgba(167,139,250,0.16); color: #bda9fb; border-color: rgba(167,139,250,0.34); margin-left: 6px; }
.badge.b-active { background: rgba(70,201,139,0.15); color: #6fdca8; border-color: rgba(70,201,139,0.32); }
.badge.b-inactive { background: rgba(107,125,146,0.16); color: #b6c4d4; border-color: rgba(107,125,146,0.3); }

.acc-chip { display: inline-flex; align-items: center; gap: 6px; color: var(--text); }
.acc-chip.off { color: var(--muted); border-style: dashed; }
.dot-status { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--muted); }
.dot-status.ok { background: var(--green); box-shadow: 0 0 0 3px rgba(70,201,139,0.14); }
.dot-status.fail { background: var(--red); box-shadow: 0 0 0 3px rgba(242,99,126,0.14); }
.dot-status.pending { background: var(--muted); }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(4, 8, 12, 0.66); backdrop-filter: blur(3px);
  display: grid; place-items: center; padding: 20px;
}
.modal-backdrop[hidden] { display: none; }
.modal-card {
  width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border-2);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px 24px;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.modal-head h2 { font-size: 18px; margin: 0; letter-spacing: -0.3px; }
.icon-x {
  background: transparent; border: none; color: var(--text-dim);
  font-size: 24px; line-height: 1; cursor: pointer; padding: 0 4px;
}
.icon-x:hover { color: var(--text); }
.check-line {
  display: flex; align-items: center; gap: 9px;
  font-size: 13.5px; color: var(--text); font-weight: 500;
  margin: 10px 0 0; cursor: pointer;
}
.check-line input[type="checkbox"] { width: auto; margin: 0; }
.acc-checks { display: flex; flex-direction: column; gap: 2px; }
.belanja-role { margin: 10px 0 0 26px; }
.belanja-role[hidden] { display: none; }
.belanja-role label { margin-top: 0; }
.belanja-role select { max-width: 200px; }

/* ---------- Outbox + Webhook (event hub / approval) ---------- */
.hbadge {
  display: inline-block; min-width: 17px; text-align: center;
  font-size: 10.5px; font-weight: 800; line-height: 1;
  padding: 3px 6px; border-radius: 999px; margin-left: 4px;
  background: var(--amber); color: #241704;
}
.hbadge[hidden] { display: none; }

.filterbar { display: flex; flex-wrap: wrap; gap: 7px; margin: 4px 0 16px; }
.filter-chip { cursor: pointer; font-family: inherit; }
.filter-chip.active { border-color: var(--accent-2); color: var(--text); background: var(--surface-2); }
.filter-chip b { color: var(--text); }

.ob-row { cursor: pointer; }
.chip.xs, .btn.xs, .btn.secondary.xs { padding: 4px 9px; font-size: 12px; border-radius: 7px; }

/* Status badges tambahan */
.badge.b-approved { background: rgba(70,201,139,0.15); color: #6fdca8; border-color: rgba(70,201,139,0.32); }
.badge.b-failed { background: rgba(242,99,126,0.15); color: #f6899e; border-color: rgba(242,99,126,0.32); }

/* Modal lebar utk preview email */
.modal-card.modal-lg { max-width: 640px; }

/* Key/value list (detail email, status SMTP) */
.kvlist { display: flex; flex-direction: column; gap: 6px; margin-bottom: 6px; }
.kv { display: flex; gap: 12px; font-size: 13px; align-items: baseline; }
.kv > span:first-child {
  flex: none; width: 120px; color: var(--muted); font-size: 11.5px;
  text-transform: uppercase; letter-spacing: 0.04em; font-weight: 700;
}
.kv > span:last-child { flex: 1; min-width: 0; word-break: break-word; }
.kv .err { color: var(--red); }

/* Pratinjau email (iframe sandbox) */
.mail-preview {
  width: 100%; height: 320px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: #fff; margin-top: 4px;
}

/* Baris lampiran di compose */
.att-row { display: flex; gap: 8px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.att-row select, .att-row input { width: auto; flex: 1; min-width: 120px; }
.att-row .att-del { flex: none; }
textarea {
  width: 100%; background: var(--bg-2); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius-sm); padding: 11px 12px; font-size: 13px;
  font-family: var(--mono); line-height: 1.5; resize: vertical;
}
textarea:focus { outline: none; border-color: var(--accent-2); box-shadow: 0 0 0 3px rgba(45,212,167,0.15); }
