/* หน้า Dashboard: toolbar ช่วงเวลา, การ์ดสรุป, กราฟ, รายการ, ปุ่มเพิ่ม */
.toolbar { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.nav { display: flex; align-items: center; gap: 10px; }
.period-label { font-weight: 600; font-size: 20px; margin: 0 0 16px 4px; }

.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 20px; }
.stat .k { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 8px; }
.stat .k .stat-ico svg { display: block; }
.stat .k i { width: 28px; height: 28px; border-radius: 10px; display: grid; place-items: center; font-style: normal; box-shadow: var(--in); font-size: 13px; }
.stat .v { font-size: 22px; font-weight: 700; margin-top: 8px; font-variant-numeric: tabular-nums; }
.grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; margin-bottom: 20px; }
/* min-width: 0 ให้ card หดตามจอได้ (ไม่งั้น canvas ของกราฟที่วาดไว้กว้างจะดันจนล้นจอตอนย่อหน้าต่าง) */
.grid > *, .cards > * { min-width: 0; }
.chart-box { position: relative; height: 260px; }
.list-head { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.list-head h3 { flex: 1; }
.list-head input { width: 220px; padding: 9px 14px; }
.day-head { display: flex; justify-content: space-between; padding: 16px 4px 6px; color: var(--muted); font-size: 13px; }
.tx { display: flex; align-items: center; gap: 14px; padding: 10px 12px; border-radius: 16px; transition: box-shadow .15s; }
.tx { cursor: pointer; }
@media (hover: hover) { .tx:hover { box-shadow: var(--out-sm); } }
.tx:active { box-shadow: var(--in); }
.tx .ico { position: relative; width: 42px; height: 42px; border-radius: 14px; flex: none; display: grid; place-items: center; font-size: 20px; box-shadow: var(--in); }
.tx .badge { position: absolute; right: -4px; bottom: -4px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; background: var(--bg); box-shadow: var(--out-sm); }
.tx .info { flex: 1; min-width: 0; }
.tx .cat { font-weight: 500; }
.tx .note { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx .amt { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tx .acts { display: flex; gap: 2px; }

.fab { display: grid; place-items: center; position: fixed; right: calc(24px + env(safe-area-inset-right)); bottom: calc(24px + env(safe-area-inset-bottom)); width: 60px; height: 60px; border-radius: 20px; font-size: 30px; line-height: 1; padding: 0; z-index: 10; }
.stat .v { overflow-wrap: anywhere; }
.stat-sub { margin-top: 4px; font-size: 12px; line-height: 1.5; color: var(--muted); }
.stat-sub span { display: block; }
.stat-sub b { font-weight: 500; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- ยืม-คืน ในรายการ + แถบสรุปยอดค้าง ---------- */
.tx .ico.loan, .tx .badge.loan { color: var(--loan); }
.tag { display: inline-block; margin-right: 8px; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; color: var(--loan); box-shadow: var(--in); vertical-align: 1px; white-space: nowrap; }
.loan-banner { width: 100%; display: flex; align-items: center; gap: 22px; margin: 0 0 20px; padding: 14px 20px; border: 0; cursor: pointer; text-align: left; font: inherit; color: inherit; }
.loan-banner:hover .lb-go { color: var(--primary); }
.lb-ico { width: 36px; height: 36px; flex: none; border-radius: 12px; display: grid; place-items: center; box-shadow: var(--in); color: var(--loan); }
.lb-item { display: flex; flex-direction: column; min-width: 0; }
.lb-item small { font-size: 12px; color: var(--muted); }
.lb-item b { color: var(--loan); font-variant-numeric: tabular-nums; white-space: nowrap; }
.lb-go { margin-left: auto; display: inline-flex; align-items: center; gap: 2px; color: var(--muted); font-size: 14px; white-space: nowrap; }
