/* Màn chi tiết khoản chi */
.detail { display: flex; flex-direction: column; gap: 18px; padding-bottom: calc(env(safe-area-inset-bottom) + 20px); }
.detail-photo { margin: 0; padding: 8px; border-radius: 26px; }
.detail-photo .photo { width: 100%; aspect-ratio: 1; border-radius: 18px; border: 2px solid var(--ink); display: grid; place-items: center; background: var(--c); color: var(--ink); }
.detail-photo .photo svg { width: 72px; height: 72px; }
.detail-photo img.photo { display: block; object-fit: cover; background: var(--soft); }
.detail-head { text-align: center; }
.detail-amount { font-size: 40px; font-weight: 800; line-height: 1.1; }
.detail-head h2 { margin-top: 4px; font-size: calc(19rem / 17); font-weight: 800; }
.detail-meta { margin: 0; padding: 4px 16px; }
.detail-meta > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; }
.detail-meta > div + div { border-top: 2px dashed var(--soft); }
.detail-meta dt { font-size: calc(14rem / 17); font-weight: 700; color: var(--muted); }
.detail-meta dd { margin: 0; display: flex; align-items: center; gap: 8px; font-weight: 800; text-align: right; }
/* Hành động xóa: chữ đỏ trên nền trắng (#B42318 / #FFF ≈ 6.5:1) */
.btn.danger { background: var(--card); color: #B42318; }
/* Đang sửa: ảnh thu thành dải thấp để form nằm trong màn hình */
.detail-photo.compact .photo { aspect-ratio: auto; height: 120px; }
.detail-photo.compact .photo svg { width: 44px; height: 44px; }

/* Món đã mua (màn thêm, sửa và chi tiết) */
.items { flex: none; padding: 12px 12px 8px; }
.items-head { display: flex; justify-content: space-between; gap: 8px; padding: 2px 4px 8px; font-weight: 800; }
.items-head span { font-size: calc(13rem / 17); color: var(--muted); }
.items ul { list-style: none; margin: 0; padding: 0; }
/* Bản sửa: tên chiếm cả dòng trên; số lượng + thành tiền ở dòng dưới */
.items li { display: grid; grid-template-columns: 64px 1fr 44px; gap: 6px; align-items: center; padding: 8px 0; }
.items li .item-name { grid-column: 1 / 3; }
.items li .item-del { grid-column: 3; grid-row: 1; }
.items li .item-qty { grid-column: 1; width: auto; }
.items li .item-price { grid-column: 2; width: auto; }
.items li + li { border-top: 2px dashed var(--soft); }
.items input {
  min-width: 0; height: 44px; padding: 0 8px; border: 2px solid var(--soft); border-radius: 10px;
  background: var(--card); color: var(--ink); font: inherit; font-weight: 700;
  font-size: max(16px, calc(16rem / 17)); /* < 16px thì iOS tự zoom khi gõ */
}
.items input:focus { border-color: var(--ink); outline: none; }
.items .item-qty { text-align: center; }
.items .item-price { text-align: right; }
.item-del { width: 44px; height: 44px; flex: none; display: grid; place-items: center; color: var(--muted); }
.item-del .i { width: 18px; height: 18px; }
.item-add { display: flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 4px; font-weight: 800; color: var(--orange-ink); }
.item-add .i { width: 20px; height: 20px; }
/* Bản chỉ xem */
.items-view li { display: flex; gap: 10px; min-height: 48px; padding: 0; }
.items-view .item-name { flex: 1; font-weight: 700; overflow-wrap: anywhere; }
.items-view .item-qty { font-weight: 800; color: var(--muted); }
.items-view .item-price { font-weight: 800; }

/* Đổi ảnh khi sửa: hai nút nổi trên ảnh */
.photo-edit { position: relative; }
.photo-actions { position: absolute; left: 0; right: 0; bottom: 18px; display: flex; justify-content: center; gap: 8px; }
.photo-actions .pill { min-height: 44px; padding: 0 14px; cursor: pointer; }
.photo-actions .i { width: 18px; height: 18px; }
