.cashflow-page {
  width: 100%;
  min-height: 100vh;
  padding: 20px;
  color: var(--erp-text, #172033);
  background: var(--erp-bg, #f3f4f6);
}

.cashflow-hero,
.cashflow-toolbar,
.cashflow-summary article,
.cashflow-trend-card,
.cashflow-section,
.cashflow-reconcile {
  border: 1px solid var(--erp-border, #e5e7eb);
  border-radius: 16px;
  background: var(--erp-surface, #fff);
  box-shadow: 0 10px 28px rgba(15, 23, 42, .05);
}

.cashflow-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px;
  border-top: 4px solid var(--erp-primary, #2563eb);
}

.cashflow-kicker {
  display: inline-flex;
  padding: 5px 10px;
  border-radius: 999px;
  color: var(--erp-primary, #2563eb);
  background: color-mix(in srgb, var(--erp-primary, #2563eb) 9%, #fff);
  font-size: .86rem;
  font-weight: 800;
}

.cashflow-hero h1 {
  margin: 10px 0 6px;
  color: var(--erp-title, #172033);
  font-size: clamp(1.5rem, 2vw, 2.2rem);
  font-weight: 900;
}

.cashflow-hero p {
  max-width: 820px;
  margin: 0;
  color: var(--erp-muted, #64748b);
  line-height: 1.7;
}

.cashflow-hero small {
  display: block;
  margin-top: 8px;
  color: var(--erp-muted, #64748b);
  font-weight: 700;
}

.cashflow-actions,
.cashflow-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cashflow-actions {
  justify-content: flex-end;
}

.cashflow-actions .btn {
  border-radius: 10px;
  font-weight: 700;
}

.cashflow-toolbar {
  margin-top: 14px;
  padding: 12px;
}

.cashflow-input {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 230px;
  min-width: min(100%, 230px);
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--erp-border, #e5e7eb);
  border-radius: 12px;
  background: #fff;
}

.cashflow-input span {
  color: var(--erp-muted, #64748b);
  font-weight: 800;
  white-space: nowrap;
}

.cashflow-input input,
.cashflow-input select {
  width: 100%;
  min-height: 42px;
  border: 0;
  outline: 0;
  background: transparent;
}

.cashflow-input:focus-within {
  border-color: var(--erp-primary, #2563eb);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--erp-primary, #2563eb) 12%, transparent);
}

.cashflow-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.cashflow-summary article {
  padding: 16px;
}

.cashflow-summary span,
.cashflow-section-head span,
.cashflow-card-head p,
.cashflow-card-head span,
.cashflow-reconcile p {
  color: var(--erp-muted, #64748b);
  font-weight: 700;
}

.cashflow-summary strong {
  display: block;
  margin-top: 8px;
  direction: ltr;
  color: var(--erp-title, #172033);
  font-size: clamp(1.1rem, 1.6vw, 1.45rem);
  font-weight: 900;
}

.positive { color: var(--erp-success, #16a34a) !important; }
.negative { color: var(--erp-danger, #dc2626) !important; }
.muted { color: var(--erp-muted, #64748b) !important; }

.cashflow-trend-card,
.cashflow-reconcile,
.cashflow-sections {
  margin-top: 14px;
}

.cashflow-trend-card,
.cashflow-section {
  overflow: hidden;
}

.cashflow-card-head,
.cashflow-reconcile,
.cashflow-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--erp-border, #e5e7eb);
}

.cashflow-reconcile {
  border-bottom: 0;
}

.cashflow-card-head h2,
.cashflow-reconcile h2,
.cashflow-section-head h3 {
  margin: 0;
  color: var(--erp-title, #172033);
  font-size: 1.08rem;
  font-weight: 900;
}

.cashflow-card-head p,
.cashflow-reconcile p {
  margin: 4px 0 0;
  line-height: 1.6;
}

.cashflow-card-head span {
  font-size: .84rem;
  text-align: end;
}

.cashflow-trend {
  min-height: 230px;
  padding: 16px;
}

.cashflow-trend svg {
  width: 100%;
  min-height: 220px;
}

.cashflow-trend-line {
  fill: none;
  stroke: var(--erp-primary, #2563eb);
  stroke-width: 3;
}

.cashflow-trend-area {
  fill: color-mix(in srgb, var(--erp-primary, #2563eb) 10%, transparent);
}

.cashflow-axis {
  stroke: #cbd5e1;
}

.cashflow-sections {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.cashflow-section-head strong {
  direction: ltr;
  white-space: nowrap;
  font-weight: 900;
}

.cashflow-section-rows {
  max-height: 420px;
  overflow: auto;
}

.cashflow-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  border: 0;
  padding: 11px 14px;
  border-bottom: 1px solid var(--erp-border, #e5e7eb);
  color: var(--erp-text, #172033);
  background: #fff;
  text-decoration: none;
  text-align: inherit;
}

.cashflow-row:hover {
  background: var(--erp-table-hover, #eff6ff);
}

.cashflow-row strong {
  font-weight: 800;
  overflow-wrap: anywhere;
}

.cashflow-row span:last-child {
  direction: ltr;
  white-space: nowrap;
  font-weight: 900;
}

.cashflow-empty {
  padding: 24px;
  text-align: center;
  color: var(--erp-muted, #64748b);
}

#cfDrillRows td:nth-child(4),
#cfDrillRows td:nth-child(5),
#cfDrillRows td:nth-child(6) {
  direction: ltr;
  font-weight: 800;
}

.cashflow-reconcile {
  align-items: flex-start;
}

.cashflow-reconcile-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  min-width: min(100%, 620px);
}

.cashflow-reconcile-grid article {
  padding: 12px;
  border: 1px solid var(--erp-border, #e5e7eb);
  border-radius: 12px;
  background: var(--erp-bg, #f3f4f6);
}

.cashflow-reconcile-grid span {
  display: block;
  color: var(--erp-muted, #64748b);
  font-weight: 700;
}

.cashflow-reconcile-grid strong {
  display: block;
  margin-top: 6px;
  direction: ltr;
  font-weight: 900;
}

.cashflow-page.is-loading {
  opacity: .7;
  pointer-events: none;
}

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

@media (max-width: 760px) {
  .cashflow-page {
    padding: 12px;
  }

  .cashflow-hero,
  .cashflow-card-head,
  .cashflow-reconcile {
    align-items: stretch;
    flex-direction: column;
  }

  .cashflow-actions {
    justify-content: flex-start;
  }

  .cashflow-actions .btn,
  .cashflow-input {
    width: 100%;
  }

  .cashflow-summary,
  .cashflow-sections,
  .cashflow-reconcile-grid {
    grid-template-columns: 1fr;
  }
}

@media print {
  @page { size: A4 landscape; margin: 10mm; }
  .no-print, .acc-sidebar, .acc-sidebar-backdrop, .sidebar { display: none !important; }
  .cashflow-page { padding: 0 !important; background: #fff !important; }
  .cashflow-hero,
  .cashflow-summary article,
  .cashflow-trend-card,
  .cashflow-section,
  .cashflow-reconcile {
    box-shadow: none !important;
    break-inside: avoid;
  }
  .cashflow-section-rows { max-height: none; overflow: visible; }
}
