/* NALQIVO ERP — Receipts | المقبوضات (module receipts).

   Presentation only: the workspace reuses the existing white cards, badges,
   tabs, stat cards and tables. These rules add the amount hero, the monthly
   bars and the compact action lists used by the receipts app. */

.receipts-app .page-actions { flex-wrap: wrap; }

/* Page header: one navigation row lives in the shared context bar, so the page
   opens with a compact identity line, not a repeated tab strip. */
.receipts-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.receipts-head-main { display: flex; align-items: center; gap: 14px; min-width: 0; }
.receipts-head-icon {
  width: 48px; height: 48px; border-radius: 14px; flex: 0 0 auto;
  display: grid; place-items: center;
  background: var(--brand-50); color: var(--brand);
  border: 1px solid var(--brand-100);
}
.receipts-head-copy { min-width: 0; }
.receipts-head-copy h1 { margin: 0; font-size: clamp(22px, 2vw, 27px); line-height: 1.25; color: var(--ink); }
.receipts-head-copy p { margin: 5px 0 0; color: var(--muted); font-size: 13px; line-height: 1.65; max-width: 820px; }
.receipts-head .page-actions { align-self: center; }

/* Dashboard indicators, grouped by meaning instead of one long wall of cards. */
.receipts-kpis { display: grid; gap: 18px; margin-bottom: 18px; }
.receipts-kpi-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.receipts-kpi-head h2 { margin: 0; font-size: 14.5px; font-weight: 750; color: var(--ink); }
.receipts-kpi-head span { color: var(--muted); font-size: 11.5px; }
.receipts-kpis .stat-grid { gap: 12px; }
.receipts-kpis .stat-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.receipts-kpis .stat-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (max-width: 1100px) {
  .receipts-kpis .stat-grid.cols-3,
  .receipts-kpis .stat-grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .receipts-head { align-items: flex-start; }
  .receipts-head-icon { width: 42px; height: 42px; border-radius: 12px; }
  .receipts-head .page-actions { width: 100%; }
  .receipts-head .page-actions .btn { flex: 1 1 auto; justify-content: center; }
  .receipts-kpis .stat-grid.cols-3,
  .receipts-kpis .stat-grid.cols-4 { grid-template-columns: 1fr; }
}

/* Money is written left-to-right (digits, currency code), but a KPI value
   still starts on the reading edge of the card: right in Arabic, left in English. */
[dir="rtl"] .receipts-kpis .stat-value.receipt-money,
[dir="rtl"] .receipts-kpis .stat-note { text-align: right; }
[dir="ltr"] .receipts-kpis .stat-value.receipt-money,
[dir="ltr"] .receipts-kpis .stat-note { text-align: left; }

.receipt-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.receipt-hero .amount {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 4px;
}

.receipt-hero .meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.receipt-money {
  font-variant-numeric: tabular-nums;
  direction: ltr;
  unicode-bidi: embed;
  white-space: nowrap;
}

.receipt-note {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.7;
}

.receipt-chart {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  min-height: 170px;
  padding: 14px 6px 0;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.receipt-chart .col {
  flex: 1;
  min-width: 34px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.receipt-chart .bars {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  width: 100%;
  height: 132px;
}

.receipt-chart .bar {
  width: 10px;
  min-height: 3px;
  border-radius: 4px 4px 0 0;
  background: var(--brand-2);
}

.receipt-chart .bar.USD { background: #0e9f7e; }
.receipt-chart-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 110px;
  padding: 18px;
  color: var(--muted);
  font-size: 12.5px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: var(--surface-2, #f8fafc);
}
.receipt-chart-empty svg { color: var(--muted); opacity: .7; }
.receipt-chart .m {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

/* Nested balance-operation row: a quiet band under its receipt. */
.receipt-op-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-2); }
.receipt-op-row .badge { font-variant-numeric: tabular-nums; }

.receipt-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding: 8px 4px 0;
  font-size: 12px;
  color: var(--muted);
}

.receipt-legend .dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-inline-end: 5px;
}

.receipt-filters { flex-wrap: wrap; }
.receipt-filters .select,
.receipt-filters .input { min-width: 118px; width: auto; flex: 0 1 auto; }
.receipt-filters .search-inline { min-width: 240px; }

.receipt-action-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.receipt-action-list > .btn {
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  text-align: start;
}

.receipt-timeline {
  margin-top: 6px;
  border-top: 1px solid var(--line);
}

.receipt-timeline .ev {
  display: flex;
  gap: 12px;
  padding: 10px 2px;
  border-bottom: 1px solid var(--line);
}

.receipt-timeline .ev:last-child { border-bottom: 0; }

.receipt-timeline .when {
  min-width: 132px;
  font-size: 11.5px;
  color: var(--muted);
}

.receipt-timeline .what {
  font-size: 12.5px;
  line-height: 1.65;
}

.receipt-alloc input { width: 120px; }
.receipt-alloc .muted { font-size: 11.5px; }

.receipt-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  width: 100%;
}

.receipt-hero .neg,
.receipt-note .neg { color: var(--red); }

@media (max-width: 760px) {
  .receipt-hero { padding: 14px; }
  .receipt-hero .amount { font-size: 23px; }
  .receipt-filters .search-inline { min-width: 100%; }
  .receipt-timeline .ev { flex-direction: column; gap: 4px; }
  .receipt-timeline .when { min-width: 0; }
  .receipt-actions { justify-content: stretch; }
  .receipt-actions .btn { flex: 1 1 auto; }
}
