
*{box-sizing:border-box}
:root{
  --bg:#eef2f7;
  --surface:#ffffff;
  --surface-soft:#f8fafc;
  --sidebar:#111827;
  --sidebar-2:#172033;
  --text:#172033;
  --muted:#64748b;
  --line:#e2e8f0;
  --accent:#ea580c;
  --accent-dark:#c2410c;
  --success:#15803d;
  --danger:#b91c1c;
  --shadow:0 10px 30px rgba(15,23,42,.08);
}
body{
  margin:0;
  font-family:Segoe UI,Arial,sans-serif;
  color:var(--text);
  background:
    radial-gradient(circle at 85% 0%,rgba(234,88,12,.08),transparent 28%),
    linear-gradient(180deg,#f8fafc 0%,var(--bg) 100%);
}
button,input,select{font:inherit}
button{transition:.16s ease}
button:hover{transform:translateY(-1px)}
.hidden{display:none!important}

.login-shell{
  min-height:100vh;display:grid;place-items:center;
  background:
    radial-gradient(circle at 78% 20%,rgba(249,115,22,.24),transparent 28%),
    linear-gradient(135deg,#111827,#1f2937 52%,#374151);
}
.login-card{
  width:390px;max-width:92vw;background:rgba(255,255,255,.98);
  padding:34px;border-radius:22px;box-shadow:0 30px 80px rgba(0,0,0,.28);
  text-align:center;border:1px solid rgba(255,255,255,.5)
}
.brand-icon{width:74px;height:74px;object-fit:contain}
.login-card h1{margin:8px 0 0;color:#111827;letter-spacing:.7px}
.login-card p{margin:4px 0 22px;color:var(--muted)}
.login-card input,.form input,.form select,.form textarea{
  width:100%;padding:12px 14px;border:1px solid #cbd5e1;border-radius:10px;
  margin:6px 0 12px;background:#fff;color:#0f172a;outline:none
}
.login-card input:focus,.form input:focus,.form select:focus,.form textarea:focus{
  border-color:#fb923c;box-shadow:0 0 0 3px rgba(251,146,60,.18)
}
.login-card button,.form button,.balance button,.page-title-row button{
  border:0;border-radius:10px;padding:11px 16px;background:var(--accent);
  color:#fff;font-weight:700;cursor:pointer;box-shadow:0 5px 14px rgba(234,88,12,.18)
}
.login-card button{width:100%}

.app{display:grid;grid-template-columns:250px 1fr;min-height:100vh}
aside{
  background:linear-gradient(180deg,var(--sidebar),var(--sidebar-2));
  color:#fff;padding:22px 16px;display:flex;flex-direction:column;
  box-shadow:8px 0 30px rgba(15,23,42,.08)
}
.brand{display:flex;gap:12px;align-items:center;padding:0 8px 24px}
.brand img{width:48px;height:48px;object-fit:contain}
.brand small{display:block;color:#94a3b8;margin-top:3px}
nav{display:grid;gap:7px}
.nav{
  text-align:left;padding:12px 14px;background:transparent;color:#cbd5e1;
  border:1px solid transparent;border-radius:10px;cursor:pointer
}
.nav:hover{background:rgba(255,255,255,.06);color:#fff;transform:none}
.nav.active{
  background:linear-gradient(90deg,#ea580c,#f97316);color:#fff;
  box-shadow:0 8px 20px rgba(234,88,12,.23)
}
.sidebar-note{margin-top:auto;color:#94a3b8;font-size:12px;line-height:1.5;padding:12px}

main{padding:24px 30px}
header{
  display:flex;justify-content:space-between;align-items:center;
  background:rgba(255,255,255,.96);padding:18px 22px;border-radius:16px;
  box-shadow:var(--shadow);border:1px solid rgba(226,232,240,.85);margin-bottom:22px
}
header h2{margin:0 0 5px;font-size:22px}
.status{font-size:12px;font-weight:800;color:#16a34a}
.balance{text-align:right}
.balance small{display:block;color:var(--muted)}
.balance b{font-size:24px;color:#0f172a;margin-right:12px}
.balance button{padding:8px 11px;font-size:12px}
.page{display:none}
.active-page{display:block}
.page>h2,.page-title-row h2{color:#0f172a;letter-spacing:-.3px}

.cards{display:grid;grid-template-columns:repeat(3,minmax(190px,1fr));gap:16px}
.card{
  background:linear-gradient(180deg,#fff,#fbfdff);padding:24px;border-radius:16px;
  box-shadow:var(--shadow);cursor:pointer;border:1px solid var(--line)
}
.card:hover{border-color:#fdba74;transform:translateY(-2px);box-shadow:0 14px 34px rgba(15,23,42,.10)}
.card b{display:block;font-size:20px;color:#0f172a;margin-bottom:7px}
.card b:before{content:"";display:inline-block;width:5px;height:18px;background:#f97316;border-radius:4px;margin-right:9px;vertical-align:-2px}
.card span{color:var(--muted)}

.form{
  max-width:650px;background:rgba(255,255,255,.98);padding:24px;border-radius:16px;
  box-shadow:var(--shadow);border:1px solid var(--line)
}
.form label{font-weight:650;color:#334155}
.row{display:flex;gap:10px}
.row button{flex:1}
.danger{background:var(--danger)!important}

.response{
  margin-top:22px;background:#0f172a;color:#e2e8f0;border-radius:16px;
  overflow:hidden;box-shadow:0 12px 32px rgba(15,23,42,.13)
}
.response-head{padding:11px 15px;background:#1e293b;display:flex;justify-content:space-between;align-items:center}
.response-head button{border:0;background:transparent;color:#fdba74;cursor:pointer;font-weight:600}
.response pre{white-space:pre-wrap;padding:16px;margin:0;min-height:90px;font-family:Consolas,monospace}
.response-actions{display:flex;gap:8px}

.close-btn{background:#475569!important;margin-left:6px;box-shadow:none!important}
.enter-hint{
  position:fixed;right:14px;bottom:10px;background:#0f172a;color:#cbd5e1;
  padding:7px 11px;border-radius:8px;font-size:11px;z-index:20;opacity:.9;
  box-shadow:0 5px 18px rgba(15,23,42,.18)
}

.overlay{
  position:fixed;inset:0;background:rgba(15,23,42,.72);display:flex;
  flex-direction:column;gap:14px;align-items:center;justify-content:center;color:white;z-index:99;
  backdrop-filter:blur(3px)
}
.loader{width:42px;height:42px;border:5px solid #ffffff55;border-top-color:white;border-radius:50%;animation:spin .8s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}
.msg{margin-top:10px;color:#b91c1c;font-size:13px}

.badge{display:inline-block;min-width:18px;padding:1px 5px;margin-left:5px;border-radius:999px;background:#ef4444;color:white;text-align:center;font-size:10px}
.page-title-row{display:flex;justify-content:space-between;align-items:center}
.report-wrap{background:#fff;border-radius:14px;overflow:auto;box-shadow:var(--shadow);border:1px solid var(--line)}
.report-table{width:100%;border-collapse:collapse;min-width:900px}
.report-table th,.report-table td{padding:11px 12px;border-bottom:1px solid var(--line);text-align:left;vertical-align:top}
.report-table th{background:#f8fafc;color:#334155}
.report-table td:last-child{font-family:Consolas,monospace;font-size:12px;max-width:520px;white-space:pre-wrap}
.status-success{font-weight:800;color:#16a34a}

.tx-stage{padding:8px 14px;background:#0f172a;color:#e5e7eb;font-weight:800;font-size:12px;letter-spacing:.4px;border-bottom:1px solid #334155}
.tx-stage.process{background:#9a5215}
.tx-stage.success{background:#166534}
.tx-stage.fail{background:#991b1b}
.focus-enter{outline:3px solid #fb923c!important;outline-offset:2px}

/* Popup hasil */
.modal{
  position:fixed;inset:0;z-index:150;background:rgba(15,23,42,.58);
  display:grid;place-items:center;padding:20px;backdrop-filter:blur(4px)
}
.modal-card{
  width:min(520px,94vw);background:#fff;border-radius:20px;padding:28px 30px;
  text-align:center;box-shadow:0 30px 90px rgba(15,23,42,.28);border:1px solid #e2e8f0
}
.modal-icon{
  width:68px;height:68px;border-radius:999px;margin:0 auto 14px;display:grid;place-items:center;
  font-size:36px;font-weight:900;background:#dcfce7;color:#15803d
}
.modal-card.fail .modal-icon{background:#fee2e2;color:#b91c1c}
.modal-card.info .modal-icon{background:#ffedd5;color:#c2410c}
.modal-card h2{margin:0 0 12px;color:#0f172a}
.modal-message{
  text-align:left;white-space:pre-wrap;background:#f8fafc;border:1px solid #e2e8f0;
  border-radius:12px;padding:14px 16px;color:#334155;max-height:250px;overflow:auto;line-height:1.45
}
.modal-actions{margin-top:18px}
.modal-primary{
  min-width:130px;border:0;border-radius:10px;padding:11px 20px;background:#0f172a;
  color:#fff;font-weight:800;cursor:pointer
}
.modal-print{
  min-width:150px;border:0;border-radius:10px;padding:11px 20px;background:#15803d;
  color:#fff;font-weight:800;cursor:pointer;margin-right:8px
}
.modal-card small{display:block;color:#94a3b8;margin-top:10px}

/* Struk khusus cetak - kertas A4 portrait, area struk 21 cm x 9 cm landscape */
.receipt-print{display:none}
.receipt-sheet{
  font-family:Arial,Helvetica,sans-serif;color:#000;background:#fff;
  position:relative;width:100%;height:100%;
}
.receipt-brand{
  text-align:center;font-weight:900;font-size:22pt;letter-spacing:1.2px;line-height:1.05
}
.receipt-subtitle{
  text-align:center;font-size:11pt;font-weight:700;margin-top:1.2mm;letter-spacing:.5px
}
.receipt-rule{border-top:1.4px dashed #000;margin:3mm 0}
.receipt-grid{
  display:grid;grid-template-columns:35mm 1fr;column-gap:6mm;row-gap:2.1mm;
  font-size:12.5pt;line-height:1.22
}
.receipt-grid>div:nth-child(odd){font-weight:800}
.receipt-grid>div:nth-child(even){font-weight:600;overflow-wrap:anywhere}
.receipt-token-wrap{text-align:center;margin:3mm 0 2mm}
.receipt-token-label{font-size:11pt;font-weight:800}
.receipt-token{
  font-family:Consolas,"Courier New",monospace;font-size:19pt;font-weight:900;
  letter-spacing:1.4px;margin-top:1.4mm
}
.receipt-footer{text-align:center;font-size:10.5pt;font-weight:700;margin-top:1.5mm}
.receipt-cut-line{
  position:absolute;left:0;right:0;bottom:1mm;border-top:1px dashed #000;height:1mm;
}

@media(max-width:900px){
  .app{grid-template-columns:190px 1fr}.cards{grid-template-columns:repeat(2,1fr)}main{padding:18px}
}

@media print{
  /* Kertas fisik tetap A4 PORTRAIT */
  @page{
    size:A4 portrait;
    margin:0;
  }

  html,body{
    margin:0!important;
    padding:0!important;
    width:21cm!important;
    height:29.7cm!important;
    min-width:21cm!important;
    min-height:29.7cm!important;
    max-width:21cm!important;
    max-height:29.7cm!important;
    background:#fff!important;
    overflow:hidden!important;
  }

  body{
    position:relative!important;
  }

  /* Hilangkan semua elemen aplikasi agar tidak membuat halaman kedua */
  body > *:not(#receiptPrint){
    display:none!important;
  }

  /* Area struk: LANDSCAPE 21 cm x 9 cm di bagian atas A4 */
  #receiptPrint{
    display:block!important;
    position:absolute!important;
    left:0!important;
    top:0!important;
    width:21cm!important;
    height:9cm!important;
    margin:0!important;
    padding:0!important;
    overflow:hidden!important;
    break-after:avoid!important;
    page-break-after:avoid!important;
  }

  #receiptPrint *{
    visibility:visible!important;
  }

  .receipt-sheet{
    width:21cm!important;
    height:9cm!important;
    padding:5mm 8mm 7mm!important;
    overflow:hidden!important;
    break-inside:avoid!important;
    page-break-inside:avoid!important;
  }
}

.settings-form textarea{
  width:100%;padding:12px 14px;border:1px solid #cbd5e1;border-radius:10px;
  margin:6px 0 12px;background:#fff;color:#0f172a;outline:none;resize:vertical
}
.setting-note{
  margin:-3px 0 14px;padding:10px 12px;border-radius:9px;background:#fff7ed;
  color:#9a3412;font-size:12px;line-height:1.45;border:1px solid #fed7aa
}
.setting-saved{
  margin-top:12px;color:#15803d;font-weight:700;font-size:13px
}
.receipt-address{
  text-align:center;font-size:9.5pt;font-weight:600;margin-top:1mm;line-height:1.15;
  white-space:pre-wrap
}

.collective-toolbar{max-width:none;margin-bottom:16px}
.collective-summary{display:flex;gap:22px;flex-wrap:wrap;margin-top:12px;padding:12px 14px;background:#f8fafc;border:1px solid #e2e8f0;border-radius:10px}
.collective-table input[type=checkbox]{width:18px;height:18px}
.collective-table input[type=text]{width:160px;padding:8px 9px;border:1px solid #cbd5e1;border-radius:8px}
.collective-table button,.report-table .reprint-btn{border:0;border-radius:8px;padding:7px 10px;background:#475569;color:#fff;font-weight:700;cursor:pointer}
.collective-table .check-one{background:#ea580c}
.collective-table .pay-one{background:#15803d}
.collective-status-success{color:#15803d;font-weight:800}
.collective-status-fail{color:#b91c1c;font-weight:800}

.collective-top-grid{
  display:grid;grid-template-columns:minmax(300px,.8fr) minmax(420px,1.2fr);
  gap:16px;align-items:start;margin-bottom:16px
}
.collective-group-card,.collective-entry-card{max-width:none}
.collective-group-card h3,.collective-entry-card h3{margin:0 0 14px;color:#0f172a}
.group-chip-list{display:flex;gap:8px;flex-wrap:wrap;margin-top:8px}
.group-chip{
  display:inline-flex;align-items:center;gap:7px;padding:7px 10px;border-radius:999px;
  background:#f1f5f9;border:1px solid #cbd5e1;font-size:12px;font-weight:700;color:#334155
}
.group-chip button{
  padding:0!important;background:transparent!important;color:#b91c1c!important;
  box-shadow:none!important;font-size:14px;line-height:1
}
.collective-entry-rows{
  height:168px;overflow:auto;border:1px solid #e2e8f0;border-radius:10px;
  padding:8px;background:#f8fafc;margin:6px 0 10px
}
.collective-entry-row{display:flex;gap:8px;align-items:center;margin-bottom:7px}
.collective-entry-row:last-child{margin-bottom:0}
.collective-entry-number{
  flex:1;margin:0!important;background:#fff!important
}
.collective-entry-status{
  width:92px;font-size:11px;font-weight:800;color:#64748b;text-align:right
}
.collective-entry-status.saved{color:#15803d}
.collective-filter-row{
  display:flex;align-items:end;justify-content:space-between;gap:14px;flex-wrap:wrap
}
.collective-filter-row>div:first-child{min-width:260px}
.collective-actions{display:flex;gap:10px}
.collective-list-wrap{max-height:370px;overflow:auto}
.collective-table th{position:sticky;top:0;z-index:1}
@media(max-width:1000px){
  .collective-top-grid{grid-template-columns:1fr}
}

/* ===== v2.9 PROFESSIONAL NAVY / WHITE / ORANGE THEME ===== */
:root{
  --dp-navy:#0f2747;
  --dp-navy-2:#173b68;
  --dp-bg:#f3f6fa;
  --dp-card:#ffffff;
  --dp-line:#dce4ee;
  --dp-text:#172033;
  --dp-muted:#64748b;
  --dp-orange:#f97316;
  --dp-orange-dark:#ea580c;
  --dp-success:#15803d;
  --dp-danger:#b91c1c;
}
html,body{background:var(--dp-bg);color:var(--dp-text)}
body{background:
  radial-gradient(circle at 88% 0%,rgba(15,39,71,.07),transparent 28%),
  linear-gradient(180deg,#f8fafc 0%,#f1f5f9 100%)}
.sidebar{
  background:linear-gradient(180deg,var(--dp-navy) 0%,#091a30 100%)!important;
  box-shadow:8px 0 26px rgba(15,23,42,.10)
}
.sidebar .nav{
  border-radius:10px!important;
  color:#dbeafe!important;
  transition:.15s ease
}
.sidebar .nav:hover{background:rgba(255,255,255,.09)!important;color:#fff!important}
.sidebar .nav.active{
  background:linear-gradient(90deg,var(--dp-orange),var(--dp-orange-dark))!important;
  color:#fff!important;
  box-shadow:0 8px 18px rgba(249,115,22,.20)
}
main,.content{background:transparent!important}
.page h2{color:var(--dp-navy);letter-spacing:-.02em}
.card,.form,.panel,.report-wrap{
  background:var(--dp-card)!important;
  border:1px solid var(--dp-line)!important;
  box-shadow:0 8px 24px rgba(15,23,42,.055)!important;
}
.card{
  border-radius:14px!important;
  transition:transform .15s ease,box-shadow .15s ease,border-color .15s ease
}
.card:hover{
  transform:translateY(-2px);
  border-color:#fdba74!important;
  box-shadow:0 12px 28px rgba(15,23,42,.09)!important
}
.card b{color:var(--dp-navy)!important}
button{
  border-radius:9px!important;
  font-weight:800!important;
  letter-spacing:.01em
}
button:not(.nav):not(.danger):not(.close):not(.group-chip button){
  background:linear-gradient(180deg,var(--dp-orange),var(--dp-orange-dark))!important;
  color:#fff!important;
  border:0!important
}
button.danger{background:var(--dp-danger)!important;color:#fff!important}
input,select,textarea{
  border:1px solid #cbd5e1!important;
  border-radius:9px!important;
  background:#fff!important;
  color:var(--dp-text)!important
}
input:focus,select:focus,textarea:focus{
  outline:0!important;
  border-color:var(--dp-orange)!important;
  box-shadow:0 0 0 3px rgba(249,115,22,.12)!important
}
.dashboard-hero{
  display:flex;justify-content:space-between;gap:24px;align-items:center;
  margin:0 0 20px;padding:22px 24px;border-radius:16px;
  background:linear-gradient(125deg,var(--dp-navy) 0%,var(--dp-navy-2) 72%,#20518a 100%);
  color:#fff;box-shadow:0 16px 34px rgba(15,39,71,.18)
}
.hero-eyebrow{font-size:11px;font-weight:900;letter-spacing:.14em;color:#fdba74;margin-bottom:6px}
.hero-title{font-size:23px;font-weight:900;line-height:1.15}
.hero-subtitle{font-size:13px;color:#dbeafe;margin-top:7px}
.hero-status{display:flex;gap:10px;flex-wrap:wrap;justify-content:flex-end}
.hero-status-item{
  min-width:110px;padding:10px 13px;border-radius:11px;
  background:rgba(255,255,255,.10);border:1px solid rgba(255,255,255,.14)
}
.hero-status-item span{display:block;font-size:10px;color:#bfdbfe;text-transform:uppercase;font-weight:800}
.hero-status-item b{display:block;margin-top:3px;color:#fff;font-size:13px}
.report-table thead th{
  background:#eef3f8!important;color:var(--dp-navy)!important;
  border-bottom:2px solid #d7e0eb!important
}
.collective-summary{
  background:#f8fafc!important;border-color:var(--dp-line)!important
}
.modal-card{border-top:4px solid var(--dp-orange)!important}
@media(max-width:1050px){
  .dashboard-hero{align-items:flex-start;flex-direction:column}
  .hero-status{justify-content:flex-start}
}
@media print{
  /* Cetak v2.3+ tetap dipertahankan tanpa tema aplikasi. */
  body{background:#fff!important}
}

.settings-divider{height:1px;background:#dce4ee;margin:22px 0}
.settings-form h3{margin:0 0 6px;color:#0f2747}
.check-row{display:flex!important;align-items:center;gap:9px;margin:8px 0 12px}
.check-row input{width:18px;height:18px;box-shadow:none!important}
.master-sync-status{
  display:inline-flex;align-items:center;min-height:36px;padding:0 10px;
  border-radius:8px;background:#eef3f8;color:#475569;font-size:12px;font-weight:800
}
.master-sync-status.ok{background:#ecfdf5;color:#15803d}
.master-sync-status.err{background:#fef2f2;color:#b91c1c}
