:root {
  --navy: #0f2a52;
  --navy-2: #14376b;
  --blue: #1d4ed8;
  --blue-l: #dbeafe;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f4f6fb;
  --card: #ffffff;
  --green: #16a34a;
  --amber: #d97706;
  --amber-l: #fef3c7;
  --red: #dc2626;
  --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 8px 24px rgba(15, 23, 42, .06);
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Plus Jakarta Sans', 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

/* ---- Topbar ---- */
.topbar {
  background: linear-gradient(120deg, var(--navy) 0%, var(--navy-2) 60%, #1e4a8f 100%);
  color: #fff;
  position: sticky; top: 0; z-index: 40;
  box-shadow: 0 2px 12px rgba(15, 42, 82, .25);
}
.topbar-inner {
  max-width: 1180px; margin: 0 auto; padding: 14px 22px;
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 13px; }
.brand-logo-img {
  height: 48px; width: auto; background: #fff; border-radius: 10px;
  padding: 5px 10px; box-shadow: 0 4px 10px rgba(0,0,0,.25);
}
.brand-title { font-weight: 800; font-size: 17px; letter-spacing: .3px; }
.brand-sub { font-size: 12px; color: #bcd0ee; margin-top: 1px; }
.topbar-actions { display: flex; gap: 8px; }

/* ---- Layout ---- */
.layout {
  max-width: 1180px; margin: 22px auto; padding: 0 22px;
  display: grid; grid-template-columns: 420px 1fr; gap: 22px; align-items: start;
}
.side { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 88px; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
}
.card h2 { margin: 0 0 14px; font-size: 15px; font-weight: 700; color: var(--navy); }
.field { margin-bottom: 12px; }
.field:last-child { margin-bottom: 0; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.inp {
  width: 100%; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 9px;
  font: inherit; font-size: 14.5px; background: #fff; color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.inp:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(29, 78, 216, .12); }
.inp.num { font-family: 'JetBrains Mono', ui-monospace, monospace; }
textarea.inp { resize: vertical; min-height: 84px; font-family: inherit; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.side-actions { display: flex; gap: 10px; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 16px; border-radius: 9px; border: 1px solid transparent;
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  transition: transform .06s, box-shadow .15s, background .15s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: #1e40af; }
.btn-ghost { background: #fff; color: var(--ink); border-color: #cbd5e1; }
.btn-ghost:hover { background: #f8fafc; }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn-danger { background: #fff; color: var(--red); border-color: #fecaca; }
.btn-danger:hover { background: #fef2f2; }
.topbar .btn-ghost { background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.25); }
.topbar .btn-ghost:hover { background: rgba(255,255,255,.2); }

/* ---- Dokumen (paper) ---- */
.doc-side { min-width: 0; }
.paper {
  background: #fff; border-radius: 4px;
  padding: 40px 44px; box-shadow: var(--shadow);
  border: 1px solid var(--line);
  font-size: 14px;
}
.doc-head { text-align: center; border-bottom: 2.5px solid var(--navy); padding-bottom: 14px; margin-bottom: 18px; }
.doc-logo { height: 84px; width: auto; margin-bottom: 10px; }
.doc-title { font-size: 21px; font-weight: 800; letter-spacing: .5px; color: var(--navy); }
.doc-co { font-size: 13px; color: var(--muted); margin-top: 3px; }
.doc-row { display: flex; gap: 8px; margin: 6px 0; line-height: 1.5; }
.doc-row .k { min-width: 190px; color: #475569; font-weight: 600; }
.doc-row .k2 { min-width: 190px; color: #475569; font-weight: 600; }
.doc-row .v { flex: 1; border-bottom: 1px dotted #cbd5e1; padding: 0 4px 2px; font-weight: 600; }
.doc-row .v.blank { color: #cbd5e1; }
.doc-sec { margin: 16px 0 4px; font-weight: 700; color: var(--navy); font-size: 13px; text-transform: uppercase; letter-spacing: .4px; }
.doc-line { border-top: 1px dashed #cbd5e1; margin: 14px 0; }
.doc-note-title { font-weight: 700; color: var(--navy); }
.doc-note { margin: 4px 0; color: #334155; }
.doc-ttd {
  display: flex; justify-content: space-between; margin-top: 36px; text-align: center; font-size: 12.5px; color: var(--muted);
}
.doc-ttd > div { width: 40%; }
.doc-ttd .sp { display: block; border-bottom: 1px solid #94a3b8; height: 34px; margin: 6px 0 4px; }
.doc-foot {
  margin-top: 34px; padding-top: 14px; border-top: 2.5px solid var(--navy);
  text-align: center; font-size: 13px;
}
.doc-foot .co { font-weight: 700; color: var(--navy); }
.doc-foot .rek { color: var(--muted); font-size: 12.5px; margin-top: 3px; }

/* ---- Ringkasan hitung ---- */
.doc-calc { background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin: 14px 0; }
.doc-calc .r { display: flex; justify-content: space-between; padding: 4px 0; font-size: 13.5px; }
.doc-calc .r span:last-child { font-weight: 700; font-family: 'JetBrains Mono', ui-monospace, monospace; }
.doc-calc .r.total { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 8px; font-size: 15px; color: var(--navy); }

/* ---- Riwayat ---- */
.riwayat { position: fixed; inset: 0; background: rgba(15, 23, 42, .55); z-index: 60; overflow: auto; padding: 40px 20px; }
.riwayat-inner { max-width: 720px; margin: 0 auto; background: #fff; border-radius: 14px; padding: 22px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.riwayat-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.riwayat-head h2 { margin: 0; font-size: 17px; color: var(--navy); }
.r-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px; }
.r-item .meta b { display: block; color: var(--ink); }
.r-item .meta span { font-size: 12.5px; color: var(--muted); }
.r-item .act { display: flex; gap: 6px; }
.r-empty { text-align: center; color: var(--muted); padding: 30px 10px; font-size: 14px; }

/* ---- Toast ---- */
.toast-wrap { position: fixed; bottom: 22px; right: 22px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast {
  background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 10px;
  font-size: 13.5px; box-shadow: 0 8px 24px rgba(0,0,0,.25); animation: slideIn .2s ease;
  max-width: 340px;
}
.toast.err { background: var(--red); }
@keyframes slideIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---- Responsive ---- */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: static; }
}
@media (max-width: 520px) {
  .doc-row { flex-direction: column; gap: 2px; }
  .doc-row .k, .doc-row .k2 { min-width: 0; }
  .paper { padding: 26px 18px; }
}

/* ---- Print: hanya dokumen ---- */
@media print {
  body { background: #fff; }
  .topbar, .side, .side-actions, .riwayat, .toast-wrap { display: none !important; }
  .layout { display: block; margin: 0; padding: 0; max-width: none; }
  .doc-side { margin: 0; }
  .paper { box-shadow: none; border: none; padding: 0; border-radius: 0; }
  @page { margin: 14mm; }
}
