:root {
  --bg: #0e1116;
  --bg-soft: #151a22;
  --card: #1a2029;
  --line: #2a323d;
  --txt: #e8edf4;
  --muted: #8b97a7;
  --accent: #5b8cff;
  --green: #34d399;
  --green-bg: rgba(52, 211, 153, 0.12);
  --amber: #fbbf24;
  --amber-bg: rgba(251, 191, 36, 0.12);
  --red: #f87171;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Sora', sans-serif;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(91,140,255,0.14), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(52,211,153,0.10), transparent 60%),
    var(--bg);
  color: var(--txt);
  min-height: 100vh;
  padding: 28px 16px 60px;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 640px; margin: 0 auto; }

/* header */
.app-header { text-align: center; margin-bottom: 24px; }
.logo-badge {
  width: 56px; height: 56px; border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px;
  font-family: 'IBM Plex Mono', monospace; font-weight: 700; font-size: 20px;
  letter-spacing: 0.05em;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  color: white; box-shadow: 0 10px 30px rgba(91,140,255,0.35);
}
.app-title {
  font-weight: 800; font-size: clamp(22px, 5.5vw, 30px);
  letter-spacing: -0.02em; line-height: 1.1;
}
.app-sub { color: var(--muted); font-weight: 300; margin-top: 8px; font-size: 14px; }

/* card */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 24px 22px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.4);
}

/* professional voucher document header */
.voucher-doc-head {
  margin-bottom: 24px; padding-bottom: 20px;
  border-bottom: 2px solid var(--line);
}
.vdoc-title-row {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 18px;
}
.voucher-tag {
  font-family: 'IBM Plex Mono', monospace; font-size: 13px;
  letter-spacing: 0.22em; color: var(--txt); font-weight: 700;
}

/* top row: rekap + tanggal */
.vdoc-meta-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
  padding: 14px 16px; margin-bottom: 14px;
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 12px;
}
.vdoc-meta-item { display: flex; flex-direction: column; gap: 6px; }
.vdoc-meta-right { align-items: flex-end; text-align: right; }
.vdoc-meta-label {
  font-family: 'IBM Plex Mono', monospace; font-size: 10px;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
}
.vdoc-meta-input {
  width: 100%; background: transparent; border: none;
  border-bottom: 1px solid var(--line); border-radius: 0;
  padding: 4px 0; color: var(--txt);
  font-family: 'Sora', sans-serif; font-size: 15px; font-weight: 600;
  outline: none; transition: border-color .2s;
}
.vdoc-meta-input.mono { font-family: 'IBM Plex Mono', monospace; }
.vdoc-meta-input::placeholder { color: #40495a; }
.vdoc-meta-input:focus { border-bottom-color: var(--accent); }
.vdoc-meta-right .vdoc-meta-input { text-align: right; }
.vdoc-meta-err { font-size: 10px; color: var(--red); }

/* payment voucher number */
.vdoc-vno-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 12px 16px;
  background: linear-gradient(135deg, rgba(91,140,255,0.10), rgba(124,58,237,0.08));
  border: 1px solid rgba(91,140,255,0.25); border-radius: 12px;
}
.vdoc-vno {
  font-family: 'IBM Plex Mono', monospace; font-size: 20px;
  font-weight: 700; color: var(--txt); letter-spacing: 0.02em;
}
@media (max-width: 480px) {
  .vdoc-meta-grid { grid-template-columns: 1fr; }
  .vdoc-meta-right { align-items: flex-start; text-align: left; }
  .vdoc-meta-right .vdoc-meta-input { text-align: left; }
  .vdoc-vno-row { flex-direction: column; align-items: flex-start; gap: 6px; }
}

.prio-pill {
  font-family: 'IBM Plex Mono', monospace; font-size: 11px; font-weight: 600;
  padding: 5px 12px; border-radius: 999px; letter-spacing: 0.05em;
}
.prio-low { background: rgba(148,163,184,0.15); color: #cbd5e1; }
.prio-normal { background: rgba(91,140,255,0.15); color: #9bb6ff; }
.prio-high { background: rgba(251,191,36,0.15); color: var(--amber); }
.prio-urgent { background: rgba(248,113,113,0.15); color: var(--red); }

/* form fields */
.form-field { margin-bottom: 18px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-2 .form-field { margin-bottom: 18px; }

.field-label {
  display: block; font-size: 12px; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--muted);
  font-weight: 600; margin-bottom: 8px;
}
.req-star { color: var(--accent); }
.field-hint { font-size: 11px; color: var(--red); margin-top: 6px; }

.inp {
  width: 100%;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 14px;
  color: var(--txt); font-family: 'Sora', sans-serif; font-size: 15px;
  outline: none; transition: border-color .2s, box-shadow .2s;
}
.inp::placeholder { color: #40495a; }
.inp:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(91,140,255,0.12);
}
.inp.mono { font-family: 'IBM Plex Mono', monospace; }
.inp-area { resize: vertical; line-height: 1.5; }
.inp-err { border-color: var(--red) !important; box-shadow: 0 0 0 3px rgba(248,113,113,0.12); }
select.inp { cursor: pointer; }

/* amount input */
.amount-wrap {
  display: flex; align-items: center;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 12px; padding: 2px 16px;
  transition: border-color .2s, box-shadow .2s;
}
.amount-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(91,140,255,0.15);
}
.rp-prefix {
  font-family: 'IBM Plex Mono', monospace;
  color: var(--muted); font-size: 20px; font-weight: 500; margin-right: 10px;
}
.amount-input {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--txt); font-family: 'IBM Plex Mono', monospace;
  font-size: 26px; font-weight: 600; padding: 10px 0; width: 100%;
}
.amount-input::placeholder { color: #40495a; }

/* segmented category */
.seg { display: flex; gap: 10px; }
.seg-3 { flex-wrap: wrap; }
.seg-3 .seg-btn { flex: 1 1 30%; min-width: 100px; }
.seg-btn {
  flex: 1; text-align: left;
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 14px; cursor: pointer;
  transition: all .18s; color: var(--muted);
}
.seg-btn:hover { border-color: #3a4655; }
.seg-active {
  border-color: var(--accent);
  background: rgba(91,140,255,0.10);
  box-shadow: 0 0 0 3px rgba(91,140,255,0.12);
  color: var(--txt);
}
.seg-label { display: block; font-weight: 700; font-size: 13px; }
.seg-sub { display: block; font-size: 10px; color: var(--muted); margin-top: 3px; }

/* priority pills */
.pill-row { display: flex; gap: 8px; flex-wrap: wrap; }
.pill-opt {
  flex: 1; min-width: 64px;
  background: var(--bg-soft); border: 1px solid var(--line);
  color: var(--muted); border-radius: 10px; padding: 9px 8px;
  font-family: 'IBM Plex Mono', monospace; font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all .15s;
}
.pill-opt:hover { border-color: #3a4655; }
.pill-active { border-color: var(--accent); color: var(--txt); }
.pill-active.pill-low { background: rgba(148,163,184,0.12); }
.pill-active.pill-normal { background: rgba(91,140,255,0.12); border-color: var(--accent); }
.pill-active.pill-high { background: rgba(251,191,36,0.12); border-color: var(--amber); color: var(--amber); }
.pill-active.pill-urgent { background: rgba(248,113,113,0.12); border-color: var(--red); color: var(--red); }

/* status preview inline */
.preview {
  display: flex; align-items: center; gap: 10px;
  border-radius: 12px; padding: 12px 14px; margin-bottom: 18px;
  font-size: 13px; line-height: 1.4;
  border: 1px solid var(--line); background: var(--bg-soft);
}
.preview b { font-weight: 700; }
.preview .preview-dot {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
  background: var(--muted);
}
.preview.ok { background: var(--green-bg); border-color: rgba(52,211,153,0.3); }
.preview.ok .preview-dot { background: var(--green); box-shadow: 0 0 10px var(--green); }
.preview.ok b { color: var(--green); }
.preview.warn { background: var(--amber-bg); border-color: rgba(251,191,36,0.3); }
.preview.warn .preview-dot { background: var(--amber); box-shadow: 0 0 10px var(--amber); }
.preview.warn b { color: var(--amber); }
.preview.neutral { color: var(--muted); }

/* actions */
.actions { margin-top: 22px; }
.btn {
  border: none; cursor: pointer; border-radius: 14px;
  font-family: 'Sora', sans-serif; font-weight: 700; font-size: 15px;
  transition: transform .12s, filter .2s;
}
.btn:active { transform: scale(.98); }
.btn-primary {
  width: 100%; padding: 15px;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  color: white; box-shadow: 0 10px 30px rgba(91,140,255,0.3);
}
.btn-primary:hover { filter: brightness(1.08); }

/* result badge (shared) */
.result-badge {
  display: inline-block; font-family: 'IBM Plex Mono', monospace;
  font-weight: 600; font-size: 16px; letter-spacing: 0.03em;
  padding: 8px 16px; border-radius: 999px;
}
.badge-green { background: var(--green); color: #06281c; }
.badge-amber { background: var(--amber); color: #3b2a02; }
.result-reason { font-size: 13px; color: var(--muted); margin-top: 12px; font-family: 'IBM Plex Mono', monospace; line-height: 1.5; }

/* modal */
.modal-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(6,9,13,0.72); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fade .2s ease;
}
.modal-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 24px; padding: 30px 26px; max-width: 420px; width: 100%;
  text-align: center; box-shadow: 0 30px 80px rgba(0,0,0,0.6);
}
.modal-vhead {
  text-align: left; background: var(--bg-soft);
  border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 16px; margin-bottom: 18px;
}
.modal-vhead-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 5px 0; font-size: 13px;
}
.modal-vk {
  font-family: 'IBM Plex Mono', monospace; font-size: 10px;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
}
.modal-vv { color: var(--txt); font-weight: 600; }
.modal-vhead-pv {
  margin-top: 4px; padding-top: 10px;
  border-top: 1px dashed var(--line);
}
.modal-vhead-pv .modal-vv { font-size: 15px; color: var(--accent); }
.modal-badge { margin-bottom: 16px; }
.modal-title { font-size: 18px; font-weight: 700; }
.modal-amount {
  font-family: 'IBM Plex Mono', monospace; font-size: 28px;
  font-weight: 700; color: var(--txt); margin-top: 6px;
}
.modal-close { margin-top: 22px; }

/* routing visualization */
.route-row {
  display: flex; align-items: center; justify-content: center;
  gap: 16px; margin-top: 18px; flex-wrap: wrap;
}
.avatars { display: flex; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #3b2a02; font-family: 'IBM Plex Mono', monospace; font-weight: 600; font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--card); margin-left: -8px;
}
.avatar:first-child { margin-left: 0; }
.channels { display: flex; gap: 8px; }
.chan {
  font-size: 12px; font-weight: 500; padding: 6px 12px; border-radius: 999px;
  font-family: 'IBM Plex Mono', monospace;
}
.chan-tg { background: rgba(56,189,248,0.15); color: #7dd3fc; }
.chan-mail { background: rgba(232,237,244,0.10); color: var(--txt); }

/* mini rules */
.rules-mini {
  display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; justify-content: center;
}
.rule-chip {
  font-family: 'IBM Plex Mono', monospace; font-size: 11px; font-weight: 500;
  padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line);
}
.rule-chip.ok { background: var(--green-bg); color: var(--green); border-color: rgba(52,211,153,0.3); }
.rule-chip.warn { background: var(--amber-bg); color: var(--amber); border-color: rgba(251,191,36,0.3); }

/* submissions list */
.history { margin-top: 22px; }
.history-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.list-toggle {
  background: none; border: none; color: var(--txt);
  font-family: 'Sora', sans-serif; font-weight: 600; font-size: 14px; cursor: pointer;
  display: flex; align-items: center;
}
.chev { transition: transform .2s; color: var(--muted); }
.chev-open { transform: rotate(180deg); }
.clear-btn {
  background: none; border: none; color: var(--red);
  font-size: 12px; cursor: pointer; font-family: 'Sora', sans-serif; font-weight: 500;
}
.history-empty { color: var(--muted); font-size: 13px; font-weight: 300; }

.sub-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.sub-item {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 14px 16px;
}
.sub-main { flex: 1; min-width: 0; }
.sub-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.sub-vno { font-size: 12px; color: var(--muted); }
.sub-name { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.sub-meta {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  font-size: 12px; color: var(--muted);
}
.sub-amt { font-weight: 600; color: var(--txt); }
.sub-dot { color: #3a4655; }
.sub-bank { font-size: 11px; color: var(--muted); margin-top: 5px; }
.prio-tiny {
  font-family: 'IBM Plex Mono', monospace; font-size: 10px; font-weight: 600;
  padding: 2px 7px; border-radius: 6px;
}
.hi-status {
  font-size: 11px; padding: 3px 9px; border-radius: 6px; font-weight: 600;
  font-family: 'IBM Plex Mono', monospace;
}
.s-green { background: var(--green-bg); color: var(--green); }
.s-amber { background: var(--amber-bg); color: var(--amber); }
.del-btn {
  background: none; border: 1px solid var(--line); color: var(--muted);
  width: 28px; height: 28px; border-radius: 8px; cursor: pointer;
  font-size: 18px; line-height: 1; flex-shrink: 0; transition: all .15s;
}
.del-btn:hover { color: var(--red); border-color: var(--red); }

/* footer */
.app-footer { text-align: center; margin-top: 34px; color: var(--muted); font-size: 12px; font-weight: 300; }
.teaser { margin-bottom: 8px; color: #6b7688; }
.remix { color: var(--accent); text-decoration: none; font-weight: 500; }
.remix:hover { text-decoration: underline; }

/* animations */
@keyframes fade { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.pop { animation: pop .3s cubic-bezier(.34,1.56,.64,1); }
@keyframes pop { 0% { transform: scale(.94); opacity: .4; } 100% { transform: scale(1); opacity: 1; } }

.confetti-piece {
  position: fixed; width: 9px; height: 9px; z-index: 999; border-radius: 2px;
  pointer-events: none;
  animation: confetti 1.2s ease-out forwards;
}
@keyframes confetti {
  0% { transform: translate(0,0) rotate(0); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)); opacity: 0; }
}

@media (max-width: 480px) {
  .grid-2 { grid-template-columns: 1fr; gap: 0; }
  .seg-3 { flex-direction: column; }
  .seg-3 .seg-btn { flex: 1 1 100%; }
}