/* history: card history rows (swipe, confirm, chips, detail, edit mode, photo) */
.card-hist { position: relative; padding-top: .6875rem; transform-origin: top; display: grid; gap: .5rem; }
.card.open-hist { box-shadow: 0 .25rem 1rem color-mix(in srgb, var(--c) 18%, transparent); }
.hist-list { --lt: var(--brand); --lt-ink: var(--brand-ink); --lt-tint: 12%; display: grid; gap: .375rem; margin: 0; padding: 0; list-style: none; }
.hist-row { position: relative; border: 1px solid var(--line); border-radius: .75rem; background: var(--bg); overflow: hidden; }
.hist-rev { position: absolute; inset: 0; }
.hist-rev-in { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: .5rem; padding: .375rem .75rem; text-align: center; background: color-mix(in srgb, var(--bad) 14%, var(--bg)); color: var(--bad-ink); box-shadow: inset 0 .125rem .625rem -.25rem var(--lift); }
.hist-row:has(.hist-face.dir-l) .hist-rev-in, .hist-rev[data-side=strip] .hist-rev-in { display: none; } /* the red box shows only for a left-to-right drag */
.hist-acts { --acts-w: 12rem; position: absolute; inset: 0; display: flex; justify-content: flex-start; visibility: hidden; background: color-mix(in srgb, var(--brand) 10%, var(--bg)); box-shadow: inset 0 .125rem .625rem -.25rem var(--lift); }
.hist-row.acts-open .hist-acts, .hist-row:has(.hist-face.dir-l) .hist-acts { visibility: visible; }
.hist-act { flex: none; width: calc(var(--acts-w) / 3); min-height: var(--hit); padding: 0 .25rem; border: 0; border-inline-start: 1px solid var(--line); background: none; color: var(--brand-ink); font: inherit; font-size: var(--fs-s); font-weight: var(--fw-bold); cursor: pointer; }
.hist-row.confirming > .hist-acts { display: none; }
.hist-say { font-weight: var(--fw-reg); font-size: var(--fs-s); line-height: 1.5; text-wrap: balance; }
.hist-rev svg, .hist-ask svg { width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.hist-face { position: relative; background: var(--bg); touch-action: pan-y; overflow: hidden; border-radius: calc(.75rem - 1px); box-shadow: 0 0 0 1px var(--line), 0 .125rem .875rem var(--lift); }
.hist-fill { position: absolute; inset-block: 0; left: 0; z-index: 0; pointer-events: none; border-radius: 0 .75rem .75rem 0; background: linear-gradient(to right, color-mix(in srgb, var(--bad) 5%, var(--bg)), color-mix(in srgb, var(--fc) 12%, var(--bg))); transition: width var(--t-spring) var(--spring); }
.hist-head, .hist-detail { position: relative; z-index: 1; }
.hist-head, .hist-head:active { transform: none; transition: none; } /* a tap on a row head never squashes it */
.hist-fill ~ * { --muted: var(--text); } /* muted text would miss 4.5:1 on the tint (npm run contrast) */
.hist-paid.settled { color: var(--good-ink); font-weight: var(--fw-bold); }
.hist-paid { margin: 0; font-size: var(--fs-s); color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .hist-fill { transition: none; } }
.hist-face.spring-back { transition: transform var(--t-spring) var(--spring); }
.hist-face.swiping { transition: none; user-select: none; }
.hist-row.confirming { display: grid; }
.hist-row.confirming > * { grid-area: 1 / 1; }
.hist-row.confirming > .hist-rev { display: none; }
.hist-row.confirming > .hist-face { z-index: 1; }
.hist-confirm { position: relative; display: grid; place-items: center; min-height: var(--hit); background: color-mix(in srgb, var(--bad) 14%, var(--bg)); color: var(--bad-ink); transform-origin: top; }
.hist-confirm.collapsing { transition: transform var(--t-spring) var(--spring); transform: scaleY(0); }
.hist-ask { display: flex; align-items: center; justify-content: center; gap: .5rem; width: 100%; min-height: var(--hit); margin: 0; padding: .375rem .75rem; border: 0; background: none; font: inherit; font-weight: var(--fw-reg); text-align: center; color: var(--bad-ink); cursor: pointer; }
.hist-count { display: none; position: absolute; inset: auto 0 0 0; height: .375rem; overflow: hidden; background: color-mix(in srgb, var(--bad) 18%, var(--bg)); }
.hist-count i { display: block; height: 100%; width: 100%; background: var(--bad); transition: width 100ms linear; }
.hist-confirm.counting .hist-count { display: block; }
@media (prefers-reduced-motion: reduce) { .hist-confirm.counting .hist-count { display: none; } }
.hist-confirm .err:empty { display: none; }
.hist-head { display: grid; gap: .125rem; width: 100%; min-height: var(--hit); padding: .375rem .625rem; text-align: start; color: inherit; font: inherit; }
.hist-l1, .hist-l3 { display: flex; align-items: center; justify-content: space-between; gap: .5rem; min-width: 0; }
.hist-item { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-m); }
.hist-row[data-kind=pay] .hist-item { color: var(--good-ink); }
.hist-l3 small { color: var(--muted); font-size: var(--fs-s); white-space: nowrap; }
.hist-sum { display: inline-flex; gap: .125rem; flex: none; }
.hist-chip { flex: none; display: inline-flex; align-items: center; padding: .0625rem .625rem; border-radius: 1rem; border: 1px solid var(--line); background: var(--bg); color: var(--muted); font-size: var(--fs-s); font-weight: var(--fw-bold); white-space: nowrap; } /* status chip under the amount: plain, not tappable */
.hist-row:is(.lit, .rel) .hist-chip { border-color: currentColor; }
.hist-row:is(.lit, .rel) .hist-chip.good { color: var(--good-ink); background: color-mix(in srgb, var(--good) 9%, var(--bg)); }
.hist-row:is(.lit, .rel) .hist-chip.bad { color: var(--bad-ink); background: color-mix(in srgb, var(--bad) 14%, var(--bg)); }
.hist-row:is(.lit, .rel) .hist-chip.warn { color: var(--warn-ink); background: color-mix(in srgb, var(--warn) 14%, var(--bg)); }
.hist-row:is(.lit, .rel) .hist-chip.info { color: var(--brand-ink); background: color-mix(in srgb, var(--brand) 12%, var(--bg)); }
.hist-row[data-tone=bad] { --lt: var(--bad); --lt-ink: var(--bad-ink); --lt-tint: 14%; } /* the frame follows the row's OWN type, never the tapped row's */
.hist-row[data-tone=good] { --lt: var(--good); --lt-ink: var(--good-ink); --lt-tint: 9%; }
.hist-row.lit, .hist-row.rel { border-color: var(--lt); box-shadow: 0 0 0 1px var(--lt); }
.hist-row.rel .hist-face::after { content: ''; position: absolute; inset: 0; z-index: 0; pointer-events: none; width: 60%; background: linear-gradient(to right, transparent, color-mix(in srgb, var(--lt) 7%, transparent), transparent); animation: hist-shimmer 2.4s var(--ease) infinite; } /* calm light sweep inside the related card */
@keyframes hist-shimmer { from { transform: translateX(-100%); } to { transform: translateX(170%); } }
@media (prefers-reduced-motion: reduce) { .hist-row.rel .hist-face::after { animation: none; width: 100%; background: color-mix(in srgb, var(--lt) 6%, transparent); } }
.hist-sum.bad { color: var(--bad-ink); }
.hist-sum.good { color: var(--good-ink); }
.hist-detail { display: grid; gap: .375rem; padding: .375rem .625rem .625rem; border-top: 1px dashed var(--line); }
.hist-note { margin: 0; color: var(--muted); font-size: var(--fs-s); }
.hist-lines { display: grid; gap: .25rem; margin: 0; padding: 0; list-style: none; font-size: var(--fs-s); }
.hist-lines li { display: flex; justify-content: space-between; gap: .5rem; }
.hist-row.editing { border-color: var(--bad); box-shadow: 0 0 0 1px var(--bad); }
.hist-row.editing > :is(.hist-acts, .hist-rev) { display: none; }
.hist-edit { position: relative; z-index: 1; padding: .5rem .625rem .625rem; background: var(--bg); }
.hist-edit > .panel { padding: 0; margin: 0; border: 0; background: none; gap: .5rem; }
.edit-lines { margin: 0; padding: 0; list-style: none; }
.edit-line { touch-action: pan-y; background: var(--bg); } /* a horizontal swipe on a line deletes it: the browser must not scroll sideways */
.edit-line + .edit-line { padding-top: .5rem; border-top: 1px solid var(--line); }
.edit-line.swiping { transition: none; user-select: none; }
.edit-line.spring-back { transition: transform var(--t-spring) var(--spring); }
.hist-edit .btn[data-armed] { background: color-mix(in srgb, var(--bad) 14%, var(--bg)); color: var(--bad-ink); border: 1px solid var(--bad); }
.hist-photo { justify-self: start; padding: 0; border: 1px solid var(--line); border-radius: .75rem; overflow: hidden; background: var(--card); }
.hist-photo img { display: block; width: 5rem; height: 4rem; object-fit: cover; }
.hist-photo.big { justify-self: stretch; }
.hist-photo.big img { width: 100%; height: auto; max-height: 28rem; object-fit: contain; }