/* dashboard.css — Loans dashboard (CSP-safe: no inline styles). Uses theme.css tokens. */
.ld-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 14px; }
@media (min-width: 900px) { .ld-grid { grid-template-columns: repeat(4, 1fr); } }
.ld-section { margin-bottom: 14px; }
.ld-row { padding: 14px 0; border-top: 1px solid var(--border-color); }
.ld-row:first-child { border-top: 0; padding-top: 0; }
.ld-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; flex-wrap: wrap; }
.ld-title { font-weight: 650; }
.ld-meta { margin-top: 2px; font-size: .85rem; color: var(--text-muted); }
.ld-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

.ld-bar { width: 100%; height: 10px; margin: 10px 0 4px; border: 0; border-radius: 99px; overflow: hidden; appearance: none; -webkit-appearance: none; background: #e2eae6; }
.ld-bar::-webkit-progress-bar { background: #e2eae6; border-radius: 99px; }
.ld-bar::-webkit-progress-value { background: linear-gradient(90deg, var(--primary-500), #3aa077); border-radius: 99px; }
.ld-bar::-moz-progress-bar { background: linear-gradient(90deg, var(--primary-500), #3aa077); border-radius: 99px; }

.ld-steps { display: flex; gap: 4px; margin: 12px 0 4px; padding: 0; list-style: none; }
.ld-step { flex: 1; padding-top: 6px; border-top: 4px solid #e2eae6; border-radius: 2px; text-align: center; font-size: .7rem; color: var(--text-muted); }
.ld-step.done { border-top-color: var(--primary-500); color: var(--primary); }
.ld-step.current { border-top-color: var(--accent); color: var(--warning); font-weight: 650; }

.ld-pill { padding: 3px 10px; border-radius: 99px; background: #e6ede9; color: #3d4f46; font-size: .74rem; font-weight: 600; }
.ld-pill.warn { background: var(--warning-light); color: #7a4504; }
.ld-pill.bad { background: var(--danger-light); color: #8a1a10; font-weight: 700; animation: ld-pulse 1.8s ease-out infinite; }
.stat-sub { margin-top: 4px; font-size: .8rem; color: var(--text-muted); }

/* Overdue / warning rows: tinted background + accent edge + bold text so
   urgency does not depend on the small pill alone. */
.ld-row.ld-row--overdue { padding: 12px 12px 12px 14px; background: var(--danger-light); border: 0; border-left: 4px solid #d9392b; border-radius: 12px; margin-top: 8px; }
.ld-row.ld-row--warn { padding: 12px 12px 12px 14px; background: var(--warning-light); border: 0; border-left: 4px solid var(--accent); border-radius: 12px; margin-top: 8px; }
.ld-title--danger { color: #a01c10; font-weight: 700; }
.ld-meta--danger { color: #a01c10; }

@keyframes ld-pulse {
  0% { box-shadow: 0 0 0 0 rgba(217, 57, 43, .4); }
  70% { box-shadow: 0 0 0 8px rgba(217, 57, 43, 0); }
  100% { box-shadow: 0 0 0 0 rgba(217, 57, 43, 0); }
}

/* Loans dashboard tiles: scoped to .ld-grid so Home stat cards are not affected. */
.ld-grid .stat-card { position: relative; overflow: hidden; padding: 16px 16px 14px 18px; }
.ld-grid .stat-card::before { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 4px; background: var(--primary-500); }
.ld-grid .stat-card:nth-child(2)::before { background: var(--accent); }
.ld-grid .stat-card:nth-child(3)::before { background: #2a9d8f; }
.ld-grid .stat-card:nth-child(4)::before { background: #8a9a91; }
.ld-grid .stat-value { font-size: clamp(1.05rem, 4.4vw, 1.3rem); }

/* Danger state for tiles tied to something overdue (written last so it wins). */
.ld-grid .stat-card.stat-card--danger::before { background: #d9392b; }
.ld-grid .stat-card.stat-card--danger .stat-value { color: #c0301f; }

@media (prefers-reduced-motion: reduce) { .ld-pill.bad { animation: none; } }
