/* ── Dues Ledger Page ── */
.dues-ledger-page {
  --dl-receivable: #16a34a;
  --dl-receivable-soft: #f0fdf4;
  --dl-payable: #dc2626;
  --dl-payable-soft: #fef2f2;
  min-height: 100%;
}

.dl-header-row,
.dl-page-header {
  margin-bottom: var(--space-md);
}

.dl-stat-card[data-filter] {
  cursor: pointer;
}

.dl-stat-card.is-active-filter {
  box-shadow: 0 0 0 2px var(--dl-receivable);
}

.dl-stat-card.is-payable.is-active-filter {
  box-shadow: 0 0 0 2px var(--dl-payable);
}

.dl-mobile-list {
  display: none;
  flex-direction: column;
  gap: var(--space-sm);
}

.dl-mobile-list.is-visible {
  display: flex;
}

.dl-mobile-card {
  padding: var(--space-md);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}

.dl-mobile-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.dl-mobile-card-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  font-family: var(--font-bn);
  font-size: var(--text-sm);
  margin-bottom: 4px;
}

.dl-mobile-card-meta {
  font-family: var(--font-bn);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.dl-title-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  border-left: 4px solid #f59e0b;
  padding-left: var(--space-sm);
}

.dl-title-wrap .page-title-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  transition: background 0.2s ease, color 0.2s ease;
}

.dl-title-wrap .page-title-back:hover {
  background: #fffbeb;
  color: #b45309;
}

.dl-title-wrap .page-title-back svg {
  width: 20px;
  height: 20px;
}

.dl-header-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.toolbar-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.toolbar-icon-btn:hover {
  border-color: #f59e0b;
  color: #b45309;
  background: #fffbeb;
}

.toolbar-icon-btn svg { width: 18px; height: 18px; }

.dl-header-link {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.dl-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
  margin-top: var(--space-lg);
}

.dl-stat-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.dl-stat-card.is-receivable { border-top: 3px solid var(--dl-receivable); }
.dl-stat-card.is-payable { border-top: 3px solid var(--dl-payable); }
.dl-stat-card.is-net.is-positive { border-top: 3px solid var(--dl-receivable); }
.dl-stat-card.is-net.is-negative { border-top: 3px solid var(--dl-payable); }

.dl-stat-label {
  display: block;
  font-family: var(--font-bn);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: 4px;
}

.dl-stat-value {
  font-family: var(--font-en);
  font-size: var(--text-xl);
  font-weight: 700;
}

.dl-stat-card.is-receivable .dl-stat-value { color: var(--dl-receivable); }
.dl-stat-card.is-payable .dl-stat-value { color: var(--dl-payable); }
.dl-stat-card.is-net.is-positive .dl-stat-value { color: var(--dl-receivable); }
.dl-stat-card.is-net.is-negative .dl-stat-value { color: var(--dl-payable); }

.dl-stat-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: #fffbeb;
  color: #b45309;
}

.dl-stat-icon svg { width: 22px; height: 22px; }

.dl-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: var(--space-lg);
  padding: var(--space-md);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}

.dl-filter-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.dl-filter-tab {
  padding: 8px 14px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  font-family: var(--font-bn);
  font-size: var(--text-sm);
  font-weight: 600;
  background: var(--color-surface);
  cursor: pointer;
  transition: all 0.2s ease;
}

.dl-filter-tab.is-active {
  background: #fffbeb;
  border-color: #f59e0b;
  color: #b45309;
}

.dl-date-range {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  min-width: 200px;
}

.dl-date-range-icon { width: 16px; height: 16px; color: var(--color-text-muted); }
.dl-date-range-label { font-family: var(--font-en); font-size: var(--text-sm); white-space: nowrap; }
.dl-date-range-inputs { position: absolute; inset: 0; opacity: 0; display: flex; }
.dl-date-range-inputs input { flex: 1; width: 50%; height: 100%; cursor: pointer; pointer-events: auto; }

.dl-search-wrap,
.dl-search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 180px;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}

.dl-search-wrap svg { width: 16px; height: 16px; color: var(--color-text-muted); }
.dl-search-input {
  flex: 1;
  border: none;
  outline: none;
  font-family: var(--font-bn);
  font-size: var(--text-sm);
  background: transparent;
}

.dl-table-meta {
  margin: var(--space-md) 0 var(--space-sm);
  font-family: var(--font-bn);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.dl-table-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.dl-table-card.is-hidden { display: none; }
.dl-table-scroll { overflow-x: auto; }

.dl-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}

.dl-table thead { background: #fffbeb; }
.dl-table th {
  padding: 12px 14px;
  font-family: var(--font-bn);
  font-size: var(--text-xs);
  font-weight: 700;
  color: #b45309;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

.dl-table td {
  padding: 12px 14px;
  font-family: var(--font-bn);
  font-size: var(--text-sm);
  border-bottom: 1px solid var(--color-border-light);
}

.dl-table tbody tr { cursor: pointer; transition: background 0.15s ease; }
.dl-table tbody tr:hover { background: #fffbeb; }

.dl-type-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: var(--text-xs);
  font-weight: 600;
}

.dl-type-badge.is-receivable {
  background: var(--dl-receivable-soft);
  color: var(--dl-receivable);
  border: 1px solid #bbf7d0;
}

.dl-type-badge.is-payable {
  background: var(--dl-payable-soft);
  color: var(--dl-payable);
  border: 1px solid #fecaca;
}

.dl-invoice-badge {
  padding: 2px 8px;
  font-family: var(--font-en);
  font-size: var(--text-xs);
  font-weight: 600;
  background: #f3f4f6;
  border-radius: var(--radius-sm);
}

.dl-cell-money {
  font-family: var(--font-en);
  font-weight: 600;
  white-space: nowrap;
}

.dl-cell-due.has-due { color: var(--dl-payable); font-weight: 700; }

.dl-empty-state { display: none; text-align: center; padding: var(--space-xl); }
.dl-empty-state.is-visible { display: block; }
.dl-empty-subtext { color: var(--color-text-muted); margin: 8px 0 var(--space-md); }
.dl-empty-links { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.dl-empty-links a { text-decoration: none; }

.dl-detail-summary {
  padding: var(--space-md);
  background: #fafafa;
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
}

.dl-detail-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-family: var(--font-bn);
  font-size: var(--text-sm);
}

.dl-detail-row span:last-child {
  font-family: var(--font-en);
  font-weight: 600;
}

.dl-detail-due.has-due { color: var(--dl-payable) !important; }

.dl-detail-link {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.dl-detail-link.is-hidden { display: none; }

.dl-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  z-index: 300;
  padding: 12px 20px;
  background: #111827;
  color: #fff;
  border-radius: var(--radius-md);
  font-family: var(--font-bn);
  font-size: var(--text-sm);
  transition: transform 0.3s ease;
}

.dl-toast.is-visible { transform: translateX(-50%) translateY(0); }

@media (max-width: 992px) {
  .dl-stats-grid { grid-template-columns: 1fr; }
  .dl-table-card { display: none !important; }
  .dl-mobile-list.is-visible { display: flex; }
  .dl-search-box,
  .dl-date-range { min-width: 0; }
}

@media (max-width: 768px) {
  .dl-toolbar { flex-direction: column; align-items: stretch; }
  .dl-date-range, .dl-search-box { width: 100%; min-width: 0; }
  .dl-table-card { display: none; }
  .dl-mobile-list.is-visible { display: flex; }
}
