/* ===== Feed kiểu Locket: mỗi khoản một màn, lướt dọc bắt dính từng thẻ =====
   Danh sách phủ cả khung app (từ sau status bar tới đáy) nên ảnh trượt lên dưới đầu trang và status bar;
   đầu trang là lớp nổi bên trên. Mỗi trang cao đúng khung app; thẻ nằm giữa vùng từ đáy đầu trang tới
   tab bar, nên lúc đứng yên không có gì bị che — chỉ khi đang lướt mới chạy qua dưới đầu trang. */
.scroll:has(> .feed) { overflow: hidden; }
.feed {
  /* --feed-top: mép trên đầu trang (dưới status bar); --feed-bottom: phần tab bar chiếm (như .scroll của app).
     --head-h tính từ cỡ chữ (theo Dynamic Type) với line-height cố định bên dưới. */
  --feed-top: calc(var(--top) + 16px);
  --feed-bottom: calc(env(safe-area-inset-bottom) + 100px);
  --head-h: max(44px, calc(30rem / 17 * 1.15 + 14rem / 17 * 1.4));
  position: absolute; inset: 0; /* .scroll không định vị nên phủ theo .app */
}
@media (min-width: 600px) { .feed { --feed-top: 56px; } }

.feed-head {
  position: absolute; top: 0; left: 0; right: 0; z-index: 1;
  display: flex; align-items: center; gap: 10px; padding: var(--feed-top) 20px 12px;
}
/* Scroll edge kiểu iOS: kính kem mờ sau đầu trang, nhạt dần xuống dưới — chỉ để chữ đọc được trên ảnh */
.feed-head::before {
  content: ""; position: absolute; inset: 0 0 -20px; z-index: -1; pointer-events: none;
  background: rgba(251, 246, 236, .82);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  mask-image: linear-gradient(#000 calc(100% - 20px), transparent);
}
@media (prefers-contrast: more), (prefers-reduced-transparency: reduce) {
  .feed-head::before { background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none; mask-image: none; inset: 0; border-bottom: 2px solid var(--ink); }
}
.feed-title { flex: 1; min-width: 0; }
.feed-head h1 { font-size: calc(30rem / 17); font-weight: 800; line-height: 1.15; }
.filter-btn { position: relative; }
.filter-btn .badge {
  position: absolute; top: -6px; right: -6px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px;
  display: grid; place-items: center; background: var(--orange); color: var(--ink); border: 2px solid var(--ink);
  font-size: 12px; font-weight: 900;
}
.feed-sum { display: flex; align-items: center; gap: 12px; color: var(--muted); font-weight: 700; font-size: calc(14rem / 17); line-height: 1.4; }
/* "Bỏ lọc" nằm gọn trong dòng tóm tắt; vùng chạm nới ra đủ 44pt bằng ::after */
.feed-sum button { position: relative; padding: 0; color: var(--orange-ink); font-weight: 800; }
.feed-sum button::after { content: ""; position: absolute; inset: -12px -10px; }

.feed-list {
  position: absolute; inset: 0; margin: 0; padding: 0; list-style: none;
  overflow-y: auto; overscroll-behavior-y: contain; scroll-snap-type: y mandatory; scrollbar-width: none;
}
.feed-list::-webkit-scrollbar { display: none; }
.feed-list li {
  height: 100%; padding: calc(var(--feed-top) + var(--head-h) + 32px) 20px calc(var(--feed-bottom) + 14px);
  scroll-snap-align: start; scroll-snap-stop: always;
  display: flex; align-items: center; justify-content: center;
}

/* Thẻ = polaroid to: ảnh bo tròn đồng tâm, số tiền + ghi chú + danh mục + giờ ở dải dưới */
.feed-card {
  width: 100%; max-width: 420px; max-height: 100%; display: flex; flex-direction: column; padding: 8px;
  background: var(--card); color: var(--ink); font-weight: inherit;
  border: 3px solid var(--ink); border-radius: 34px; box-shadow: 0 6px 0 var(--ink);
}
.feed-card.press:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--ink); }
/* Ảnh dọc 3:4 (như ảnh chụp điện thoại) khi đủ chỗ, máy thấp thì co lại (gần vuông) để cả thẻ vẫn nằm trọn trên tab bar */
.feed-photo {
  flex: 0 1 auto; min-height: 0; width: 100%; aspect-ratio: 3 / 4; margin: 0;
  border-radius: 26px; border: 2.5px solid var(--ink); overflow: hidden; background: var(--soft);
}
.feed-photo .photo { width: 100%; height: 100%; display: grid; place-items: center; object-fit: cover; background: var(--c, var(--soft)); }
.feed-photo .photo svg { width: 96px; height: 96px; }

.feed-info { display: flex; align-items: center; gap: 12px; padding: 12px 6px 4px; }
.feed-info .bubble { width: 44px; height: 44px; border-radius: 14px; }
.feed-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.feed-amt { font-size: calc(24rem / 17); font-weight: 800; line-height: 1.1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-meta { display: flex; gap: .3em; font-size: calc(14rem / 17); font-weight: 700; color: var(--muted); white-space: nowrap; }
.feed-note { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-weight: 800; color: var(--ink); }
.feed-meta .when { flex: none; }

.feed-empty { position: absolute; inset: 0; padding: calc(var(--feed-top) + var(--head-h)) 20px var(--feed-bottom); display: grid; place-content: center; justify-items: center; gap: 12px; text-align: center; }

/* ===== Bottom sheet bộ lọc ===== */
.sheet {
  position: fixed; inset: auto 0 0 0; margin: 0 auto; padding: 0; width: 100%; max-width: 430px; max-height: 88dvh;
  border: 0; background: transparent; color: var(--ink);
}
.sheet::backdrop { background: rgba(27, 35, 64, .4); }
.sheet[open] .sheet-body { animation: sheet-up .4s var(--spring); }
@keyframes sheet-up { from { transform: translateY(100%); } }
.sheet-body {
  max-height: 88dvh; overflow-y: auto; overscroll-behavior: contain;
  padding: 10px 20px calc(env(safe-area-inset-bottom) + 16px);
  background: var(--bg); border: var(--line); border-bottom: 0; border-radius: 30px 30px 0 0;
}
.grabber { display: block; width: 40px; height: 5px; margin: 0 auto 14px; border-radius: 3px; background: #D9D2C3; }
.sheet h2 { font-size: calc(22rem / 17); font-weight: 800; margin-bottom: 14px; }
.sheet fieldset { border: 0; margin: 0 0 18px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.sheet legend { padding: 0; margin-bottom: 10px; font-weight: 800; }
.sheet legend span { color: var(--muted); font-size: calc(13rem / 17); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; border-radius: 999px;
  background: var(--card); border: 2px solid var(--ink); box-shadow: 0 3px 0 var(--ink); font-weight: 800;
}
.chip .i { width: 18px; height: 18px; }
.chip[aria-pressed="true"] { background: var(--c, var(--orange)); transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.sheet-actions { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; margin-top: 6px; }
.btn.light { background: var(--card); }

@media (prefers-reduced-motion: reduce) { .sheet[open] .sheet-body { animation: none; } }
