/* ════════════════════════════════════════
   CUSTOM DATEPICKER
   ════════════════════════════════════════ */
.dp-popup {
  position: fixed;
  z-index: 9999;
  background: #fff;
  border: 1px solid #E2E8F0;
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(15,23,42,.12), 0 4px 16px rgba(15,23,42,.06);
  width: 288px;
  font-family: 'Inter', 'Source Sans 3', sans-serif;
  font-size: 14px;
  user-select: none;
  display: none;
  overflow: hidden;
}
.dp-popup.open { display: block; }
.dp-header {
  background: linear-gradient(135deg, #1E6FD9 0%, #2563EB 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  gap: 6px;
}
.dp-header select, .dp-header input {
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 6px;
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  padding: 4px 8px;
  outline: none;
  cursor: pointer;
  font-weight: 600;
}
.dp-header input { width: 62px; text-align: center; }
.dp-header select option { background: #1E3A8A; color: #fff; }
.dp-nav {
  background: none; border: none; color: rgba(255,255,255,.85);
  font-size: 18px; cursor: pointer; padding: 3px 7px; line-height: 1;
  border-radius: 6px; flex-shrink: 0; transition: background .12s;
}
.dp-nav:hover { background: rgba(255,255,255,.2); }
.dp-weekdays {
  display: grid; grid-template-columns: repeat(7, 1fr);
  background: #F8FAFC;
  border-bottom: 1px solid #E2E8F0;
}
.dp-weekdays span {
  text-align: center; padding: 7px 0;
  font-size: 11px; font-weight: 700;
  color: #94A3B8; text-transform: uppercase; letter-spacing: .4px;
}
.dp-days {
  display: grid; grid-template-columns: repeat(7, 1fr);
  padding: 8px;
  gap: 2px;
}
.dp-day {
  text-align: center; padding: 7px 2px;
  border-radius: 7px; cursor: pointer;
  font-size: 13px; color: #1E293B;
  border: 1.5px solid transparent;
  transition: all .1s;
  font-weight: 500;
}
.dp-day:hover { background: #EFF6FF; color: #2563EB; }
.dp-day.today { border-color: #F59E0B; color: #B45309; font-weight: 700; }
.dp-day.selected { background: #2563EB; color: #fff; border-color: #2563EB; font-weight: 700; }
.dp-day.selected:hover { background: #1D4ED8; }
.dp-day.other-month { color: #CBD5E1; font-weight: 400; }
.dp-day.other-month:hover { background: #F8FAFC; color: #94A3B8; }

/* ════════════════════════════════════════
   DESIGN TOKENS
   ════════════════════════════════════════ */
:root {
  --bg:           #F1F5F9;
  --surface:      #FFFFFF;
  --surface2:     #F8FAFC;
  --surface3:     #F1F5F9;
  --border:       #E2E8F0;
  --border2:      #CBD5E1;
  --text:         #0F172A;
  --text2:        #334155;
  --text3:        #64748B;
  --text4:        #94A3B8;

  --blue:         #2563EB;
  --blue-light:   #EFF6FF;
  --blue-border:  #BFDBFE;
  --blue-dark:    #1D4ED8;

  --green:        #059669;
  --green-light:  #ECFDF5;
  --green-border: #A7F3D0;
  --green-dark:   #047857;

  --red:          #DC2626;
  --red-light:    #FEF2F2;
  --red-border:   #FECACA;

  --amber:        #D97706;
  --amber-light:  #FFFBEB;
  --amber-border: #FDE68A;

  --sidebar-w:    240px;

  --fz-xs:   12px;
  --fz-sm:   14px;
  --fz-base: 15px;
  --fz-lg:   18px;
  --fz-xl:   22px;
  --fz-2xl:  28px;

  --radius:    12px;
  --radius-sm: 8px;
  --radius-xs: 5px;

  --shadow-xs: 0 1px 3px rgba(15,23,42,.06), 0 1px 2px rgba(15,23,42,.04);
  --shadow:    0 4px 12px rgba(15,23,42,.06), 0 1px 4px rgba(15,23,42,.04);
  --shadow-lg: 0 16px 48px rgba(15,23,42,.10), 0 4px 16px rgba(15,23,42,.06);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', 'Source Sans 3', 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: var(--fz-base);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ════════════════════════════════════════
   SIDEBAR
   ════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-w);
  background: #fff;
  border-right: 1px solid var(--border);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  transition: transform .3s ease;
}
.sidebar-logo {
  padding: 24px 20px 18px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo h1 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.3px;
  display: flex;
  align-items: center;
  gap: 9px;
}
.sidebar-logo h1::before {
  content: '';
  display: inline-block;
  width: 28px; height: 28px;
  background: linear-gradient(135deg, #2563EB, #7C3AED);
  border-radius: 7px;
  flex-shrink: 0;
}
.sidebar-logo p {
  font-size: var(--fz-xs);
  color: var(--text4);
  margin-top: 4px;
  font-weight: 400;
  padding-left: 37px;
}
.nav-list { list-style: none; padding: 14px 10px; flex: 1; }
.nav-item + .nav-item { margin-top: 2px; }
.nav-item a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text3);
  text-decoration: none;
  font-size: var(--fz-sm);
  font-weight: 500;
  transition: all .15s;
}
.nav-item a:hover { background: var(--surface3); color: var(--text2); }
.nav-item.active a {
  background: var(--blue-light);
  color: var(--blue);
  font-weight: 600;
}
.nav-item a svg { flex-shrink: 0; }
.nav-item.active a svg { color: var(--blue); }
.sidebar-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  font-size: var(--fz-xs);
  color: var(--text4);
}

/* ════════════════════════════════════════
   MAIN WRAP
   ════════════════════════════════════════ */
.main-wrap {
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding-bottom: 88px;
}

/* ════════════════════════════════════════
   TOPBAR
   ════════════════════════════════════════ */
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-title {
  font-size: var(--fz-lg);
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.3px;
}
.topbar-divider {
  width: 1px; height: 20px;
  background: var(--border);
}
.hamburger {
  display: none;
  background: none; border: none;
  cursor: pointer;
  flex-direction: column;
  gap: 5px;
  padding: 6px;
  border-radius: var(--radius-xs);
}
.hamburger:hover { background: var(--surface3); }
.hamburger span {
  display: block; width: 20px; height: 2px;
  background: var(--text3);
  border-radius: 2px;
  transition: background .15s;
}

/* ════════════════════════════════════════
   BUTTONS
   ════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: var(--fz-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  letter-spacing: .1px;
  line-height: 1;
}
.btn-primary {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
  box-shadow: 0 1px 3px rgba(37,99,235,.25);
}
.btn-primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); }
.btn-secondary {
  background: #fff;
  color: var(--text2);
  border-color: var(--border2);
}
.btn-secondary:hover { background: var(--surface3); border-color: var(--border2); }
.btn-danger {
  background: var(--red-light);
  color: var(--red);
  border-color: var(--red-border);
}
.btn-danger:hover { background: #FEE2E2; }
.btn-amber {
  background: var(--amber-light);
  color: var(--amber);
  border-color: var(--amber-border);
}
.btn-amber:hover { background: #FEF3C7; }
.btn-ghost {
  background: transparent;
  color: var(--text3);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--surface3); color: var(--text2); }
.btn-sm { padding: 6px 12px; font-size: var(--fz-xs); border-radius: var(--radius-xs); }
.btn-icon { padding: 7px; border-radius: var(--radius-xs); }
.btn:disabled { opacity: .4; cursor: not-allowed; pointer-events: none; }

/* ════════════════════════════════════════
   TOOLBAR (filter bar)
   ════════════════════════════════════════ */
.toolbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.toolbar-label {
  font-size: var(--fz-xs);
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: .6px;
  white-space: nowrap;
}
.toolbar select,
.toolbar input[type="month"],
.toolbar input[type="date"] {
  padding: 8px 12px;
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: var(--fz-sm);
  color: var(--text);
  background: var(--surface2);
  outline: none;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
  height: 36px;
}
.toolbar select:focus,
.toolbar input[type="month"]:focus,
.toolbar input[type="date"]:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.toolbar-sep {
  width: 1px; height: 24px;
  background: var(--border);
  margin: 0 2px;
}
.period-badge {
  font-size: var(--fz-xs);
  color: var(--blue);
  background: var(--blue-light);
  border: 1px solid var(--blue-border);
  border-radius: 20px;
  padding: 4px 10px;
  font-weight: 600;
  white-space: nowrap;
}

/* ════════════════════════════════════════
   PAGE
   ════════════════════════════════════════ */
.page { display: none; padding: 20px 24px; }
.page.active { display: block; }

/* ════════════════════════════════════════
   STATS ROW
   ════════════════════════════════════════ */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
.stat-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-xs);
  position: relative;
  overflow: hidden;
  transition: box-shadow .15s;
}
.stat-card:hover { box-shadow: var(--shadow); }
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
}
.stat-card.blue::before  { background: linear-gradient(90deg, #2563EB, #7C3AED); }
.stat-card.green::before { background: linear-gradient(90deg, #059669, #10B981); }
.stat-card.red::before   { background: linear-gradient(90deg, #DC2626, #F87171); }
.stat-card.amber::before { background: linear-gradient(90deg, #D97706, #F59E0B); }
.stat-label {
  font-size: var(--fz-xs);
  color: var(--text3);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .7px;
  margin-bottom: 10px;
}
.stat-value {
  font-size: var(--fz-2xl);
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
  letter-spacing: -.5px;
}
.stat-value.blue  { color: var(--blue); }
.stat-value.green { color: var(--green); }
.stat-value.red   { color: var(--red); }
.stat-value.amber { color: var(--amber); }

/* ════════════════════════════════════════
   TABLE CARD
   ════════════════════════════════════════ */
.table-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
  position: relative;
}
.table-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  background: var(--surface2);
}
.table-header h2 {
  font-size: var(--fz-base);
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.2px;
}
.table-scroll {
  overflow-x: auto;
  max-height: calc(100vh - 360px);
  overflow-y: auto;
}

/* ════════════════════════════════════════
   TABLE
   ════════════════════════════════════════ */
table { width: 100%; border-collapse: collapse; min-width: 960px; }
thead {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--surface2);
  border-bottom: 2px solid var(--border);
}
thead th {
  padding: 11px 14px;
  text-align: left;
  font-size: var(--fz-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .7px;
  white-space: nowrap;
  color: var(--text3);
}
thead th.right  { text-align: right; }
thead th.center { text-align: center; }

tbody tr { border-bottom: 1px solid var(--border); transition: background .1s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #FAFBFF; }
tbody tr.saldo-awal-row { background: var(--amber-light); }
tbody tr.saldo-awal-row:hover { background: #FEF3C7; }

td { padding: 0; vertical-align: middle; }
td input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: var(--fz-sm);
  color: var(--text);
  padding: 11px 14px;
  line-height: 1.4;
}
td input:focus {
  background: var(--blue-light);
  box-shadow: inset 0 0 0 2px var(--blue);
  border-radius: 4px;
}
td input.right { text-align: right; }
td.readonly-cell {
  padding: 11px 14px;
  font-size: var(--fz-sm);
  text-align: right;
  white-space: nowrap;
  font-weight: 700;
}
td.total-col  { color: var(--text); }
td.selisih-col { color: var(--amber); }
td.actions-cell {
  padding: 5px 8px;
  text-align: center;
  width: 76px;
  white-space: nowrap;
}
td.num-col {
  width: 46px; padding: 11px 8px;
  text-align: center;
  font-size: var(--fz-xs);
  color: var(--text4);
  font-weight: 600;
}

td input.debet-input.has-value   { color: var(--green); font-weight: 700; }
td input.kredit-input.has-value  { color: var(--red);   font-weight: 700; }
td input.setoran-input.has-value { color: var(--amber); font-weight: 700; }

/* ════════════════════════════════════════
   SAVE INDICATOR
   ════════════════════════════════════════ */
.save-indicator {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: var(--fz-xs);
  color: var(--text4);
  font-weight: 500;
}
.save-indicator.saving { color: var(--amber); }
.save-indicator.saved  { color: var(--green); }
.save-indicator.error  { color: var(--red); }
.dot-spinner {
  width: 10px; height: 10px;
  border: 2px solid var(--amber-border);
  border-top-color: var(--amber);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}

/* ════════════════════════════════════════
   ADD ROW
   ════════════════════════════════════════ */
.add-row-tr td {
  padding: 10px 14px;
  text-align: center;
  border-top: 2px dashed var(--border);
}
.add-row-btn {
  background: none;
  border: 1.5px dashed var(--border2);
  border-radius: var(--radius-sm);
  padding: 9px 22px;
  font-size: var(--fz-sm);
  font-weight: 600;
  color: var(--text3);
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
}
.add-row-btn:hover {
  border-color: var(--blue);
  color: var(--blue);
  background: var(--blue-light);
}

/* ════════════════════════════════════════
   STICKY SALDO
   ════════════════════════════════════════ */
.sticky-saldo {
  position: fixed;
  bottom: 0;
  left: var(--sidebar-w);
  right: 0;
  background: #fff;
  border-top: 1px solid var(--border);
  padding: 12px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 50;
  box-shadow: 0 -4px 20px rgba(15,23,42,.06);
}
.saldo-meta  {
  font-size: var(--fz-xs);
  color: var(--text4);
  margin-top: 2px;
}
.saldo-label {
  font-size: var(--fz-xs);
  color: var(--text3);
  font-weight: 700;
  letter-spacing: .6px;
  text-transform: uppercase;
}
.saldo-value {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -.6px;
  transition: color .3s;
}
.saldo-value.positive { color: var(--green); }
.saldo-value.negative { color: var(--red); }

/* ════════════════════════════════════════
   MODAL
   ════════════════════════════════════════ */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.4);
  backdrop-filter: blur(6px);
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: #fff;
  border-radius: var(--radius);
  width: 100%;
  max-width: 640px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  border: 1px solid var(--border);
}
.modal-head {
  padding: 18px 22px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface2);
}
.modal-head h3 {
  font-size: var(--fz-lg);
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.2px;
}
.modal-close {
  background: none; border: none; cursor: pointer;
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text3); font-size: 20px;
  transition: background .15s;
}
.modal-close:hover { background: var(--border); }
.modal-body { padding: 20px 22px; overflow-y: auto; flex: 1; }

/* History */
.history-empty {
  text-align: center; color: var(--text3);
  padding: 40px 0; font-size: var(--fz-sm);
}
.history-timeline { position: relative; padding-left: 24px; }
.history-timeline::before {
  content: ''; position: absolute;
  left: 7px; top: 0; bottom: 0;
  width: 2px; background: var(--border);
}
.history-item { position: relative; margin-bottom: 20px; }
.history-item::before {
  content: ''; position: absolute;
  left: -24px; top: 5px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--green);
}
.history-item.initial::before { border-color: var(--amber); }
.history-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--green-light);
  border: 1px solid var(--green-border);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: var(--fz-xs);
  color: var(--green-dark);
  font-weight: 700;
  margin-bottom: 6px;
}
.history-badge.initial {
  background: var(--amber-light);
  border-color: var(--amber-border);
  color: var(--amber);
}
.history-item-date {
  font-size: var(--fz-xs);
  color: var(--text4);
  margin-bottom: 8px;
  font-weight: 500;
}
.history-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
}
.history-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px 20px;
}
.history-field { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.history-field-label {
  color: var(--text4); font-size: var(--fz-xs);
  font-weight: 600; text-transform: uppercase; letter-spacing: .4px;
}
.history-field-value { font-weight: 700; color: var(--text); font-size: var(--fz-sm); }
.history-uraian {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-size: var(--fz-sm);
  color: var(--text2);
}

/* ════════════════════════════════════════
   TOAST
   ════════════════════════════════════════ */
.toast-container {
  position: fixed; top: 16px; right: 16px;
  z-index: 9999;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--text);
  color: #fff;
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  font-size: var(--fz-sm);
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastIn .2s ease;
  max-width: 320px;
  border-left: 3px solid rgba(255,255,255,.25);
  display: flex;
  align-items: center;
  gap: 8px;
}
.toast.success { background: var(--green-dark); border-color: var(--green-border); }
.toast.error   { background: #B91C1C; border-color: var(--red-border); }
.toast.info    { background: var(--blue-dark); border-color: var(--blue-border); }
@keyframes toastIn {
  from { opacity:0; transform:translateY(-8px) scale(.96); }
  to   { opacity:1; transform:translateY(0) scale(1); }
}

/* ════════════════════════════════════════
   LOADING
   ════════════════════════════════════════ */
.loading-overlay {
  position: absolute; inset: 0;
  background: rgba(255,255,255,.8);
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius);
  z-index: 20;
  backdrop-filter: blur(2px);
}
.spinner {
  width: 28px; height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ════════════════════════════════════════
   INIT BANNER
   ════════════════════════════════════════ */
.init-banner {
  background: var(--amber-light);
  border: 1px solid var(--amber-border);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 18px;
  display: none;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.init-banner p {
  font-size: var(--fz-sm);
  color: var(--amber);
  flex: 1; font-weight: 500;
}

/* ════════════════════════════════════════
   SIDEBAR OVERLAY
   ════════════════════════════════════════ */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(15,23,42,.3);
  z-index: 150;
}

/* ════════════════════════════════════════
   ABOUT PAGE
   ════════════════════════════════════════ */
.about-content { max-width: 580px; }
.about-content h2 {
  font-size: var(--fz-2xl);
  font-weight: 800;
  color: var(--text);
  margin-bottom: 12px;
  letter-spacing: -.5px;
}
.about-content p {
  color: var(--text2);
  line-height: 1.75;
  margin-bottom: 14px;
  font-size: var(--fz-base);
}
.feature-list { list-style: none; margin: 14px 0 18px; }
.feature-list li {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: var(--fz-sm);
  color: var(--text2);
}
.feature-list li::before {
  content: '✓';
  display: flex; align-items: center; justify-content: center;
  width: 20px; height: 20px;
  background: var(--green-light);
  color: var(--green);
  border-radius: 50%;
  font-size: 11px;
  font-weight: 800;
  flex-shrink: 0;
}

/* ════════════════════════════════════════
   HITUNG UANG
   ════════════════════════════════════════ */
.hu-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}
.hu-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}
.hu-card-head {
  padding: 14px 20px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  font-size: var(--fz-sm);
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.hu-card-head .hu-badge {
  font-size: var(--fz-xs);
  background: var(--blue-light);
  color: var(--blue);
  border: 1px solid var(--blue-border);
  border-radius: 20px;
  padding: 2px 8px;
  font-weight: 600;
}
.hu-card-head .hu-badge.kertas { background: var(--green-light); color: var(--green-dark); border-color: var(--green-border); }
.hu-card-head .hu-badge.koin   { background: var(--amber-light); color: var(--amber); border-color: var(--amber-border); }
.hu-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.hu-table tr { border-bottom: 1px solid var(--border); }
.hu-table tr:last-child { border-bottom: none; }
.hu-table td { padding: 9px 16px; font-size: var(--fz-sm); vertical-align: middle; overflow: hidden; }
.hu-table td:first-child { color: var(--text2); font-weight: 500; width: 140px; }
.hu-table td:nth-child(2) { width: 90px; }
.hu-table td:last-child { text-align: right; font-weight: 700; color: var(--text); }
.hu-table input[type=number] {
  width: 100%;
  border: 1px solid var(--border2);
  border-radius: var(--radius-xs);
  padding: 6px 10px;
  font-family: inherit;
  font-size: var(--fz-sm);
  color: var(--text);
  background: var(--surface2);
  outline: none;
  text-align: center;
  transition: border-color .15s, box-shadow .15s;
  -moz-appearance: textfield;
}
.hu-table input[type=number]::-webkit-inner-spin-button,
.hu-table input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; }
.hu-table input[type=number]:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
  background: #fff;
}
.hu-subtotal {
  padding: 10px 16px;
  background: var(--surface3);
  border-top: 2px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--fz-sm);
  font-weight: 700;
}
.hu-subtotal span:last-child { color: var(--blue); font-size: var(--fz-base); }

.hu-result-card {
  position: fixed;
  bottom: 0;
  left: var(--sidebar-w);
  right: 0;
  background: #fff;
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 20px rgba(15,23,42,.08);
  z-index: 50;
  display: none; /* ditampilkan hanya saat di halaman hitung-uang */
}
.hu-result-head {
  display: none; /* sembunyikan header di mode sticky */
}
.hu-result-grid {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 10px 28px;
  border-bottom: 1px solid var(--border);
}
.hu-result-item {
  padding: 6px 32px 6px 0;
  border-right: 1px solid var(--border);
  margin-right: 32px;
  flex-shrink: 0;
}
.hu-result-item:last-child { border-right: none; margin-right: 0; padding-right: 0; }
.hu-result-label {
  font-size: var(--fz-xs);
  color: var(--text3);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .6px;
  margin-bottom: 2px;
  white-space: nowrap;
}
.hu-result-value {
  font-size: var(--fz-lg);
  font-weight: 800;
  letter-spacing: -.4px;
  white-space: nowrap;
}
.hu-match-banner {
  padding: 10px 28px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--fz-sm);
  font-weight: 600;
}
.hu-match-banner.match   { background: var(--green-light); color: var(--green-dark); }
.hu-match-banner.nomatch { background: var(--red-light);   color: var(--red); }
.hu-match-banner.neutral { background: var(--surface2);    color: var(--text3); }
.hu-match-icon { font-size: 20px; }

.hu-period-bar {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.hu-period-bar label { font-size: var(--fz-xs); font-weight: 700; color: var(--text3); text-transform: uppercase; letter-spacing: .6px; white-space: nowrap; }
.hu-period-bar select, .hu-period-bar input[type=month], .hu-period-bar input[type=date] {
  padding: 8px 12px;
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: var(--fz-sm);
  color: var(--text);
  background: var(--surface2);
  outline: none;
  cursor: pointer;
  height: 36px;
  transition: border-color .15s, box-shadow .15s;
}
.hu-period-bar select:focus, .hu-period-bar input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.hu-debet-info {
  margin-left: auto;
  text-align: right;
}
.hu-debet-info .label { font-size: var(--fz-xs); color: var(--text3); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.hu-debet-info .value { font-size: var(--fz-xl); font-weight: 800; color: var(--green); letter-spacing: -.4px; }

/* ════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════ */
@media (max-width: 1200px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .hu-layout { grid-template-columns: 1fr; }
  .hu-result-grid { grid-template-columns: 1fr; }
  .hu-result-item { border-right: none; border-bottom: 1px solid var(--border); }
  .hu-result-item:last-child { border-bottom: none; }
}
@media (max-width: 800px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-240px); width: 240px; }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .sidebar-overlay.open { display: block; }
  .main-wrap { margin-left: 0; }
  .sticky-saldo { left: 0; padding: 10px 16px; }
  .hamburger { display: flex; }
  .topbar { padding: 12px 16px; }
  .page { padding: 14px 16px; }
  .toolbar { padding: 10px 16px; }
  .stats-row { gap: 10px; }
  .stat-value { font-size: var(--fz-xl); }
  .table-scroll { max-height: calc(100vh - 300px); }
  .hu-result-card { left: 0; }
  .hu-result-grid { padding: 8px 16px; flex-wrap: wrap; }
  .hu-match-banner { padding: 8px 16px; }
}
@media (max-width: 480px) {
  .stats-row { grid-template-columns: 1fr 1fr; gap: 8px; }
  .saldo-value { font-size: 20px; }
}
