/* Project cashflow workspace: summary → entry → history. */
.finance-detail-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0 18px;
  padding: 8px;
  border: 1px solid #d9e6eb;
  border-radius: 16px;
  background: rgba(255,255,255,.76);
  box-shadow: 0 10px 28px rgba(8,49,71,.05);
}
.finance-detail-tabs.manager-cashbook-only { grid-template-columns: 1fr; }
.finance-detail-tabs button {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 70px;
  padding: 12px 15px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: #617985;
  text-align: left;
  transition: background .18s ease, border-color .18s ease, box-shadow .18s ease, color .18s ease;
}
.finance-detail-tabs button:hover { border-color: #d4e3e9; background: #f6fafb; }
.finance-detail-tabs button > span:first-child {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 11px;
  background: #eaf3f7;
  color: #46778e;
}
.finance-detail-tabs button > span:first-child svg { width: 18px; height: 18px; }
.finance-detail-tabs button > span:last-child { display: grid; gap: 4px; min-width: 0; }
.finance-detail-tabs button b { font-size: 12px; }
.finance-detail-tabs button small { color: #80939c; font-size: 10px; line-height: 1.35; }
.finance-detail-tabs button.active {
  border-color: #90c8df;
  background: linear-gradient(135deg, #eef8fc, #fff);
  color: #0d5b80;
  box-shadow: 0 8px 20px rgba(25,115,157,.09);
}
.finance-detail-tabs button.active > span:first-child { background: #d9f0fa; color: #1477a5; }
.cashflow-card { padding: 24px; }
.cashflow-card-head { align-items: flex-start; margin-bottom: 20px; }
.cashflow-head-actions { display: flex; align-items: center; gap: 10px; }
.cashflow-head-actions .primary-button { min-height: 42px; white-space: nowrap; }
.cashflow-head-actions .primary-button svg { width: 16px; }
.cashflow-subtitle {
  max-width: 650px;
  margin: 7px 0 0;
  color: #70858f;
  font-size: 12px;
  line-height: 1.55;
}

.cashflow-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 18px;
}
.cashflow-summary .cashflow-stat {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 112px;
  padding: 14px;
  border: 1px solid #d9e6eb;
  border-radius: 15px;
  background: linear-gradient(145deg, #fff, #f8fbfc);
}
.cashflow-stat.income { border-color: #b5dfca; background: linear-gradient(145deg, #eef9f4, #fff); }
.cashflow-stat.kbb { border-color: #bcddec; background: linear-gradient(145deg, #eff8fc, #fff); }
.cashflow-stat.expense { border-color: #efc9c4; background: linear-gradient(145deg, #fff4f2, #fff); }
.cashflow-stat.balance { border-color: #cfc7ec; background: linear-gradient(145deg, #f6f3ff, #fff); }
.cashflow-stat.balance.negative { border-color: #e7aaa2; background: linear-gradient(145deg, #fff0ee, #fff); }
.cashflow-stat-icon {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 13px;
  background: #dff1f9;
  color: #1978a6;
}
.cashflow-stat.income .cashflow-stat-icon { background: #dcf3e8; color: #168158; }
.cashflow-stat.kbb .cashflow-stat-icon { background: #dff1f9; color: #1978a6; }
.cashflow-stat.expense .cashflow-stat-icon { background: #fee8e4; color: #bd4b40; }
.cashflow-stat.balance .cashflow-stat-icon { background: #ece8fb; color: #6f58ad; }
.cashflow-stat-icon svg { width: 19px; height: 19px; }
.cashflow-stat > div { display: grid; min-width: 0; gap: 5px; }
.cashflow-summary .cashflow-stat small { color: #667e89; font-size: 12px; font-weight: 800; }
.cashflow-summary .cashflow-stat b {
  overflow: hidden;
  color: #163a4b;
  font-size: clamp(15px, 1.1vw, 20px);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.025em;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cashflow-stat.income b { color: #168158; }
.cashflow-stat.kbb b { color: #1978a6; }
.cashflow-stat.expense b { color: #b7443a; }
.cashflow-stat.balance b { color: #67449a; }
.cashflow-stat.balance.negative b { color: #b7443a; }
.cashflow-stat > div > span { color: #83969f; font-size: 12px; line-height: 1.4; }

.cashflow-workspace {
  display: grid;
  grid-template-columns: minmax(390px, .86fr) minmax(0, 1.14fr);
  gap: 16px;
  align-items: stretch;
}
.cashflow-workspace.history-only { grid-template-columns: 1fr; }
.cashflow-entry-modal { width: min(720px, calc(100vw - 24px)); }
.cashflow-entry-modal .cashflow-form { padding: 24px; border: 0; border-radius: 20px; background: #fff; }
.cashflow-entry-modal .modal-head { align-items: flex-start; margin: 0 0 4px; }
.cashflow-entry-modal .modal-head h2 { margin: 4px 0 7px; font-size: 22px; }
.cashflow-entry-modal .modal-head p:last-child { max-width: 430px; margin: 0; color: #70858f; font-size: 13px; line-height: 1.5; }
.cashflow-entry-modal .modal-actions { margin-top: 6px; }
.cashflow-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  gap: 14px;
  margin: 0;
  padding: 20px;
  border: 1px solid #d9e6eb;
  border-radius: 16px;
  background: #f3f8fa;
}
.cashflow-form-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 3px;
}
.cashflow-form-heading > div { display: grid; gap: 4px; }
.cashflow-form-heading h4,
.cashflow-history-head h4 {
  margin: 0;
  color: #173746;
  font-size: 17px;
  letter-spacing: -.02em;
}
.cashflow-form-heading > span { max-width: 190px; color: #7c919b; font-size: 10px; line-height: 1.45; text-align: right; }
.cashflow-form label { display: grid; gap: 8px; color: #536f7c; font-size: 13px; font-weight: 800; }
.cashflow-form input,
.cashflow-form select {
  width: 100%;
  min-height: 48px;
  padding: 11px 13px;
  border: 1px solid #ccdde4;
  border-radius: 11px;
  background: #fff;
  color: #193a49;
  font: inherit;
  font-size: 14px;
  outline: 0;
}
.cashflow-form input:focus,
.cashflow-form select:focus { border-color: #4a9ac7; box-shadow: 0 0 0 4px rgba(54,150,205,.1); }
.cashflow-form .full { grid-column: 1 / -1; }
.cashflow-return-plan { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; padding:16px; border:1px solid #c3dee9; border-radius:14px; background:#f0f8fb; min-width:0; }
.cashflow-return-plan[hidden] { display:none; }
.cashflow-return-plan label[hidden], .cashflow-form label[hidden], .return-plan-table th[hidden] { display:none; }
.return-plan-heading { grid-column:1/-1; display:grid; gap:5px; }
.return-plan-heading b { font-size:15px; color:#173746; }
.return-plan-heading small,.return-plan-note { font-size:12px; color:#607d89; line-height:1.5; margin:0; }
.return-plan-note.return-plan-error { color:#b83f39; font-weight:700; }
.return-plan-totals { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
.return-plan-totals div { display:grid; gap:4px; background:white; border:1px solid #dce9ee; border-radius:10px; padding:12px; min-width:0; }
.return-plan-totals small { font-size:12px;color:#607d89; }
.return-plan-totals b { color:#087b60; font-size:16px; overflow-wrap:anywhere; font-variant-numeric:tabular-nums; }
.return-plan-table { overflow-x:auto; border:1px solid #dce9ee; border-radius:10px; background:white; }
.return-plan-table table { border-collapse:collapse; width:100%; font-size:11px; min-width:690px; }
.return-plan-table th,.return-plan-table td { padding:8px; border-bottom:1px solid #e2edf0; text-align:right; white-space:nowrap; }
.return-plan-table th { background:#eaf3f6; color:#536f7c; }
.return-plan-table th:first-child,.return-plan-table td:first-child { text-align:left; white-space:normal; min-width:100px; }
.cashflow-return-detail { color:#087b60; font-weight:700; }
@media(max-width:560px) { .cashflow-return-plan { grid-template-columns:1fr; padding:12px; } }
.cashflow-proof-field > span:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.cashflow-proof-field em {
  padding: 4px 8px;
  border-radius: 99px;
  background: #edf5f8;
  color: #627b87;
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
}
.cashflow-proof-picker {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 66px;
  padding: 11px 13px;
  border: 1px dashed #9bc9dc;
  border-radius: 12px;
  background: linear-gradient(135deg, #f2f9fc, #fff);
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}
.cashflow-proof-picker:hover {
  border-color: #3290bc;
  background: #eef8fc;
  box-shadow: 0 8px 18px rgba(20, 115, 157, .08);
}
.cashflow-proof-picker > span:first-child {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 11px;
  background: #dff1f9;
  color: #1978a6;
}
.cashflow-proof-picker svg { width: 18px; height: 18px; }
.cashflow-proof-picker > span:last-child { display: grid; min-width: 0; gap: 4px; }
.cashflow-proof-picker b {
  overflow: hidden;
  color: #1e566f;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cashflow-proof-picker small { color: #79909a; font-size: 10px; font-weight: 600; line-height: 1.35; }
.cashflow-form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-top: 3px;
}
.cashflow-form-actions small { max-width: 250px; color: #768c96; font-size: 10px; line-height: 1.45; }
.cashflow-form-actions button { min-width: 162px; }
.cashflow-form-actions button svg { width: 15px; height: 15px; }

.cashflow-history {
  overflow: hidden;
  min-height: 100%;
  border: 1px solid #d9e6eb;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 14px 36px rgba(8, 49, 71, .055);
}
.cashflow-history-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 20px 16px;
}
.cashflow-history-head > div { display: grid; gap: 4px; }
.cashflow-history-tools {
  display: flex !important;
  align-items: center;
  gap: 8px !important;
}
.cashflow-history-tools > span {
  padding: 6px 9px;
  border-radius: 99px;
  background: #edf5f8;
  color: #53717f;
  font-size: 10px;
  font-weight: 800;
}
.cashflow-swipe-hint { display: none; }
.cashflow-table-scroll {
  position: relative;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-inline: contain;
  touch-action: pan-x pan-y;
  scrollbar-color: #b9ced8 #edf4f7;
  scrollbar-width: thin;
}
.cashflow-table-scroll:focus-visible { outline: 3px solid rgba(43, 151, 205, .25); outline-offset: -3px; }
.cashflow-table-scroll::-webkit-scrollbar { height: 9px; }
.cashflow-table-scroll::-webkit-scrollbar-track { background: #edf4f7; }
.cashflow-table-scroll::-webkit-scrollbar-thumb { border: 2px solid #edf4f7; border-radius: 999px; background: #b9ced8; }
.cashflow-table-head,
.cashflow-row {
  display: grid;
  grid-template-columns:
    106px
    136px
    minmax(260px, 1fr)
    122px
    122px
    122px
    112px
    116px;
  min-width: 1180px;
  align-items: center;
  column-gap: 14px;
}
.cashflow-table-head {
  min-height: 44px;
  padding: 0 18px;
  border-block: 1px solid #e1eaee;
  background: #f2f7f9;
  color: #728893;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .09em;
  text-transform: uppercase;
}
.cashflow-table-head::after { display: none; content: none; }
.cashflow-table-head > span,
.cashflow-row > * { min-width: 0; }
.cashflow-table-head > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cashflow-table-head span:nth-child(n + 4):nth-child(-n + 6) { text-align: right; }
.cashflow-table-head span:nth-child(n + 7) { text-align: center; }
.cashflow-list { display: grid; margin: 0; }
.cashflow-row {
  min-height: 66px;
  padding: 10px 18px;
  border-top: 1px solid #edf2f4;
  transition: background .18s ease;
}
.cashflow-row:first-child { border-top: 0; }
.cashflow-row:hover { background: #f8fbfc; }
.cashflow-kind {
  width: max-content;
  max-width: 100%;
  padding: 6px 8px;
  overflow: hidden;
  border-radius: 9px;
  font-size: 10px;
  font-weight: 850;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cashflow-kind.violet { background: #f0e9fb; color: #704b9f; }
.cashflow-kind.blue { background: #e6f3f9; color: #176f98; }
.cashflow-kind.green { background: #e5f6ed; color: #168158; }
.cashflow-kind.amber { background: #fff1d8; color: #9d6516; }
.cashflow-kind.red { background: #fee9e5; color: #b7443a; }
.cashflow-detail { display: grid; min-width: 0; gap: 3px; padding-right: 4px; }
.cashflow-date { display: grid; gap: 3px; color: #294d5e; font-style: normal; }
.cashflow-row .cashflow-date b { font-size: 10px; font-weight: 850; white-space: nowrap; }
.cashflow-row .cashflow-date small { color: #82949d; font-size: 9px; font-weight: 700; white-space: nowrap; }
.cashflow-row b {
  display: block;
  overflow: hidden;
  color: #203e4c;
  font-size: 12px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cashflow-row small {
  display: block;
  flex: 1 1 auto;
  overflow: hidden;
  color: #7b9099;
  font-size: 9px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cashflow-row strong {
  overflow: hidden;
  min-width: 0;
  color: #173b4c;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cashflow-row .cashflow-in { color: #168158; }
.cashflow-row .cashflow-out { color: #b7443a; }
.cashflow-row .cashflow-balance { color: #315d71; }
.cashflow-row .cashflow-balance.negative { color: #b7443a; }
.cashflow-row .cashflow-balance.administrative {
  justify-self: end;
  width: max-content;
  max-width: 100%;
  padding: 5px 8px;
  border-radius: 999px;
  background: #edf4f7;
  color: #607986;
  font-size: 10px;
  font-weight: 800;
  text-overflow: clip;
}
.cashflow-proof-cell {
  display: grid;
  justify-items: center;
  gap: 4px;
  min-width: 0;
}
.cashflow-proof-cell a {
  display: inline-flex;
  max-width: 100%;
  min-height: 28px;
  align-items: center;
  padding: 5px 8px;
  overflow: hidden;
  border: 1px solid #cfe5ef;
  border-radius: 8px;
  background: #eaf6fb;
  color: #136f99;
  font-size: 8px;
  font-weight: 850;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cashflow-proof-cell a:hover { border-color: #9ecde0; background: #d8eef7; }
.cashflow-proof-empty,
.cashflow-empty-cell { color: #9babb2; font-size: 11px; font-weight: 750; }
.cashflow-row-actions {
  display: flex !important;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  min-width: 0;
  padding-inline: 3px;
  border-inline: 1px solid #e5edf1;
  white-space: nowrap;
}
.cashflow-row-actions[hidden] { display: none !important; }
.cashflow-row-actions button {
  min-width: 46px;
  min-height: 30px;
  padding: 5px 6px;
  border: 1px solid #d6e3e9;
  border-radius: 9px;
  background: #fff;
  color: #1d627f;
  font: inherit;
  font-size: 9px;
  font-weight: 800;
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}
.cashflow-row-actions button:hover { border-color: #95c7dc; background: #f1f9fc; transform: translateY(-1px); }
.cashflow-row-actions .cashflow-delete { border-color: #f1c8c3; color: #b7443a; }
.cashflow-row-actions .cashflow-delete { min-width: 48px; }
.cashflow-row-actions .cashflow-delete:hover { border-color: #e8a8a0; background: #fff5f3; }
.cashflow-empty {
  display: grid;
  min-height: 220px;
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 24px;
  color: #7d929b;
  text-align: center;
}
.cashflow-empty > span { display: grid; width: 44px; height: 44px; place-items: center; border-radius: 13px; background: #edf6fa; color: #2b83ad; }
.cashflow-empty svg { width: 20px; }
.cashflow-empty b { color: #3b5967; font-size: 12px; }
.cashflow-empty p { margin: 0; font-size: 10px; }

@media (max-width: 1450px) {
  .cashflow-workspace { grid-template-columns: 1fr; }
  .cashflow-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1350px) {
  .cashflow-table-scroll::after {
    content: 'Geser tabel untuk melihat seluruh kolom';
    display: block;
    position: sticky;
    left: 0;
    width: max-content;
    padding: 7px 16px 9px;
    color: #78909a;
    font-size: 9px;
    font-weight: 750;
  }
}

@media (max-width: 700px) {
  .finance-detail-tabs { grid-template-columns: 1fr; margin: 11px 0 15px; padding: 6px; }
  .finance-detail-tabs button { min-height: 62px; padding: 10px 12px; }
  .finance-detail-tabs button > span:first-child { width: 36px; height: 36px; }
  .cashflow-card { padding: 17px; }
  .cashflow-card-head { gap: 12px; }
  .cashflow-head-actions { width: 100%; align-items: stretch; flex-direction: column; }
  .cashflow-head-actions .realtime-pill { align-self: flex-start; }
  .cashflow-head-actions .primary-button { width: 100%; }
  .cashflow-summary { grid-template-columns: 1fr; }
  .cashflow-summary .cashflow-stat { min-height: 96px; }
  .cashflow-summary .cashflow-stat b { font-size: 20px; }
  .cashflow-form { grid-template-columns: 1fr; padding: 16px; }
  .cashflow-entry-modal .cashflow-form { padding: 18px; }
  .cashflow-form .full { grid-column: auto; }
  .cashflow-return-plan .full { grid-column:1/-1; }
  .cashflow-form-heading { align-items: flex-start; flex-direction: column; gap: 6px; }
  .cashflow-form-heading > span { max-width: none; text-align: left; }
  .cashflow-form-actions { align-items: stretch; flex-direction: column; }
  .cashflow-form-actions button { width: 100%; }
  .cashflow-history-head { align-items: flex-start; flex-direction: column; padding: 17px 16px 14px; }
  .cashflow-history-tools { width: 100%; justify-content: space-between; }
  .cashflow-swipe-hint {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 5px 8px;
    border-radius: 999px;
    background: #eaf6fb;
    color: #176f98;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .02em;
    white-space: nowrap;
  }
  .cashflow-table-scroll::after { display: none; content: none; }
  .cashflow-table-head,
  .cashflow-row {
    grid-template-columns: 100px 132px 280px 118px 118px 118px 108px 112px;
    min-width: 1160px;
    column-gap: 12px;
  }
}

@media (max-width: 430px) {
  .cashflow-history-head h4 { font-size: 16px; }
}
