/* =====================================================================
   FLIP LEDGER — app styles
   Built on Flip OS V7 tokens (base.css). Phone-framed, mobile-first,
   purpose-built for one job: logging & reviewing flip expenses fast.
   ===================================================================== */

/* ---------------------------------------------------------------- full-screen app */
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-ui);
  min-height: 100dvh;
  overflow: hidden;
}

/* the app fills the whole device; on a wide screen it centers as a phone-width
   column with no chrome (never a device mock) */
.app {
  position: relative;
  width: 100%;
  max-width: 540px;
  margin: 0 auto;
  height: 100dvh;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  isolation: isolate;
}
@media (min-width: 560px) {
  body { background: #0c0a12; }
  .app { box-shadow: 0 0 0 1px var(--hair2), 0 30px 80px -30px rgba(0,0,0,.6); }
}

/* ---------------------------------------------------------------- app bar */
.appbar {
  flex: none; padding: calc(8px + env(safe-area-inset-top)) 18px 10px; display: flex; align-items: center; gap: 12px;
}
.appbar .ab-t { flex: 1; min-width: 0; }
.appbar .ab-t .lab { color: var(--mut); }
.appbar h1 { font-size: 25px; font-weight: 760; letter-spacing: -.03em; line-height: 1.05; margin-top: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar .ab-act {
  width: 42px; height: 42px; flex: none; border-radius: 14px; display: grid; place-items: center;
  background: var(--card); border: 1px solid var(--hair2); color: var(--ink2); box-shadow: var(--lift);
  transition: transform .12s var(--ease), background .12s;
}
.appbar .ab-act:active { transform: scale(.93); }
.appbar .ab-act .i { width: 20px; height: 20px; }
.appbar .ab-back { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
  margin-left: -6px; color: var(--ink); }
.appbar .ab-back:active { transform: scale(.9); }
.appbar .ab-ava { width: 40px; height: 40px; flex: none; font-size: 13px; }

/* segmented top control (used on a couple screens) */
.scope {
  display: flex; gap: 0; margin: 0 18px 12px; padding: 3px; flex: none;
  background: var(--card); border: 1px solid var(--hair2); border-radius: 13px; box-shadow: var(--lift);
}
.scope button {
  flex: 1; min-height: 34px; border-radius: 10px; font-size: 13px; font-weight: 650; color: var(--mut);
  white-space: nowrap; transition: color .12s;
}
.scope button.on { background: var(--brand); color: #fff; box-shadow: 0 6px 14px -6px var(--brand-ring); }

/* ---------------------------------------------------------------- screens */
.screens { flex: 1; min-height: 0; position: relative; }
.screen {
  position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden;
  padding: 2px 18px calc(112px + env(safe-area-inset-bottom));
  -webkit-overflow-scrolling: touch;
  display: none;
}
.screen.on { display: block; }
@keyframes scrIn { from { opacity: 0; transform: translateY(6px); } }
.screen::-webkit-scrollbar { width: 0; }

.sec-h { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 20px 2px 10px; }
.sec-h:first-child { margin-top: 6px; }
.sec-h .lab { color: var(--mut); }
.sec-h .link { font-size: 12.5px; font-weight: 650; color: var(--brand-ink); }
.sec-h .link:active { opacity: .6; }

.money { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

/* ---------------------------------------------------------------- dock / tabbar */
.tabbar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 50;
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: end;
  padding: 9px 12px calc(16px + env(safe-area-inset-bottom));
  overflow: visible;
  background: color-mix(in srgb, var(--card) 86%, transparent);
  backdrop-filter: blur(20px) saturate(1.4); -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border-top: 1px solid var(--hair2);
}
.tabbar button {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  color: var(--mut2); font-size: 10px; font-weight: 600; letter-spacing: .01em;
  padding: 4px 0; border-radius: 12px; transition: color .14s;
}
.tabbar button .i { width: 23px; height: 23px; stroke-width: 1.9; }
.tabbar button.on { color: var(--brand-ink); }
.tabbar button:active { transform: scale(.9); }
/* center add */
.tabbar .tab-add { margin-top: -18px; gap: 0; }
.tabbar .tab-add .ring {
  width: 58px; height: 58px; border-radius: 22px; display: grid; place-items: center;
  background: linear-gradient(150deg, var(--brand), var(--brand-deep)); color: #fff;
  box-shadow: 0 12px 26px -8px var(--brand-ring), 0 4px 10px -4px rgba(0,0,0,.25);
  transition: transform .14s var(--ease);
}
.tabbar .tab-add .i { width: 27px; height: 27px; stroke-width: 2.2; }
.tabbar .tab-add:active .ring { transform: scale(.92) rotate(90deg); }

/* ---------------------------------------------------------------- flip budget cards (home) */
.totals {
  background: linear-gradient(155deg, #221a44, #181230); color: #fff;
  border-radius: var(--rc); padding: 18px 20px 19px; box-shadow: var(--lift-lg);
  position: relative; overflow: hidden;
}
.totals::after { content: ""; position: absolute; right: -40px; top: -50px; width: 180px; height: 180px;
  border-radius: 99px; background: radial-gradient(circle, rgba(140,124,255,.35), transparent 70%); }
.totals .lab { color: rgba(255,255,255,.6); }
.totals .t-v { font-size: 37px; font-weight: 780; letter-spacing: -.035em; line-height: 1; margin-top: 9px; }
.totals .t-sub { font-size: 12.5px; color: rgba(255,255,255,.66); margin-top: 9px; display: flex; gap: 7px; align-items: center; }
.totals .t-bar { height: 7px; border-radius: 99px; background: rgba(255,255,255,.16); margin-top: 14px; overflow: hidden; display: flex; }
.totals .t-bar i { display: block; height: 100%; }
.totals .t-legend { display: flex; gap: 14px; margin-top: 11px; flex-wrap: wrap; }
.totals .t-legend span { font-size: 11.5px; color: rgba(255,255,255,.7); display: flex; align-items: center; gap: 6px; }
.totals .t-legend span i { width: 8px; height: 8px; border-radius: 3px; }

.flipcard {
  display: block; width: 100%; text-align: left; background: var(--card); border: 1px solid var(--hair2);
  border-radius: var(--rc); box-shadow: var(--lift); overflow: hidden; margin-bottom: 13px;
  transition: transform .12s var(--ease);
}
.flipcard:active { transform: scale(.985); }
.flipcard .fc-top { display: flex; gap: 13px; padding: 13px 14px 12px; align-items: center; }
.flipcard .fc-img { width: 56px; height: 56px; border-radius: 14px; object-fit: cover; flex: none; border: 1px solid var(--hair); }
.flipcard .fc-h { flex: 1; min-width: 0; }
.flipcard .fc-h b { display: block; font-size: 16px; font-weight: 720; letter-spacing: -.02em; }
.flipcard .fc-h .fc-meta { font-size: 12px; color: var(--mut); margin-top: 2px; display: flex; align-items: center; gap: 6px; }
.flipcard .fc-stage { font: 600 9.5px/1 var(--f-mono); letter-spacing: .1em; text-transform: uppercase;
  padding: 5px 8px; border-radius: 7px; background: var(--paper); color: var(--ink2); white-space: nowrap; }
.flipcard .fc-budget { padding: 0 14px 14px; }
.fc-line { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.fc-line .l { font-size: 12.5px; color: var(--mut); }
.fc-line .r { font-size: 14.5px; font-weight: 700; }
.fc-line .r small { font-weight: 500; color: var(--mut); font-size: 12px; }
.fc-line .r.over { color: var(--bad); }
.fc-line .r.tight { color: var(--warn); }
.meter.lg { height: 9px; }
.meter i.warnbar { background: var(--warn); }
.meter i.badbar { background: var(--bad); }
.meter i.okbar { background: var(--ok); }

/* ---------------------------------------------------------------- KPI / profitability */
.kpi2 { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.kpi {
  background: var(--card); border: 1px solid var(--hair2); border-radius: 16px; box-shadow: var(--lift);
  padding: 14px 14px 13px;
}
.kpi .lab { color: var(--mut); font-size: 9.5px; }
.kpi .k-v { font-size: 23px; font-weight: 760; letter-spacing: -.03em; margin-top: 7px; }
.kpi .k-v.ok { color: var(--ok); } .kpi .k-v.bad { color: var(--bad); }
.kpi .k-s { font-size: 11.5px; color: var(--mut); margin-top: 3px; }

/* profit waterfall */
.waterfall { background: var(--card); border: 1px solid var(--hair2); border-radius: var(--rc); box-shadow: var(--lift); padding: 6px 18px 10px; }
.wf-row { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--hair2); }
.wf-row:last-child { border-bottom: 0; }
.waterfall .wf-row:nth-last-child(2) { border-bottom: 0; }
.wf-row .wf-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.wf-row .wf-ic .i { width: 17px; height: 17px; }
.wf-row .wf-m { flex: 1; min-width: 0; }
.wf-row .wf-m b { font-size: 14px; font-weight: 600; display: block; }
.wf-row .wf-m span { font-size: 11.5px; color: var(--mut); }
.wf-row .wf-amt { font-size: 15px; font-weight: 700; }
.wf-row .wf-amt.neg { color: var(--ink2); }
.wf-row.total { border-top: 1.5px solid var(--hair); border-bottom: 0; margin-top: 2px; }
.wf-row.total .wf-m b { font-size: 15px; font-weight: 750; }
.wf-row.total .wf-amt { font-size: 20px; font-weight: 780; color: var(--ok); }
.wf-row.total .wf-amt.bad { color: var(--bad); }

/* category breakdown bars */
.catbreak { background: var(--card); border: 1px solid var(--hair2); border-radius: var(--rc); box-shadow: var(--lift); padding: 16px 18px 8px; }
.cb-row { padding: 9px 0 11px; border-bottom: 1px solid var(--hair2); }
.cb-row:last-child { border-bottom: 0; }
.cb-top { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; }
.cb-top .cb-dot { width: 11px; height: 11px; border-radius: 4px; flex: none; }
.cb-top .cb-n { flex: 1; font-size: 13.5px; font-weight: 600; }
.cb-top .cb-a { font-size: 13.5px; font-weight: 700; }
.cb-top .cb-p { font-size: 11px; color: var(--mut); font-weight: 600; width: 34px; text-align: right; }
.cb-bar { height: 7px; border-radius: 99px; background: var(--paper); overflow: hidden; }
:root[data-night="on"] .cb-bar { background: rgba(255,255,255,.07); }
.cb-bar i { display: block; height: 100%; border-radius: 99px; }

/* ---------------------------------------------------------------- expense feed */
.searchbar {
  display: flex; align-items: center; gap: 9px; padding: 11px 14px; margin-bottom: 12px;
  background: var(--card); border: 1px solid var(--hair2); border-radius: 14px; box-shadow: var(--lift); color: var(--mut);
}
.searchbar:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3.5px var(--brand-ring); }
.searchbar .i { width: 18px; height: 18px; flex: none; }
.searchbar input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--ink); font-size: 15px; }
.searchbar input::placeholder { color: var(--mut2); }
.searchbar .sb-clear { color: var(--mut2); width: 20px; height: 20px; display: grid; place-items: center; }

.filtrow { display: flex; gap: 8px; overflow-x: auto; padding: 1px 0 13px; margin: 0 -18px; padding-left: 18px; padding-right: 18px; scrollbar-width: none; }
.filtrow::-webkit-scrollbar { display: none; }
.fchip {
  flex: none; display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 13px; border-radius: 99px;
  font-size: 12.5px; font-weight: 600; white-space: nowrap; color: var(--ink2);
  background: var(--card); border: 1px solid var(--hair); box-shadow: var(--lift);
}
.fchip .i { width: 14px; height: 14px; }
.fchip .fc-dot { width: 9px; height: 9px; border-radius: 3px; }
.fchip.on { background: var(--brand); border-color: transparent; color: #fff; }
.fchip.on .fc-dot { background: #fff !important; }
.fchip .cnt { font: 600 10px/1 var(--f-mono); opacity: .7; }

.daygroup { margin-bottom: 6px; }
.dayhead { display: flex; align-items: baseline; justify-content: space-between; padding: 14px 2px 7px; position: sticky; top: 0;
  background: linear-gradient(var(--paper) 70%, transparent); z-index: 2; }
.dayhead .d { font: 600 10px/1 var(--f-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--mut); }
.dayhead .s { font-size: 12px; font-weight: 700; color: var(--ink2); }

.exprow {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: var(--card); border: 1px solid var(--hair2); border-radius: 15px; box-shadow: var(--lift);
  padding: 11px 13px; margin-bottom: 8px; transition: transform .1s var(--ease);
}
.exprow:active { transform: scale(.985); }
.catav { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; color: #fff; }
.catav.brand { background: #fff; border: 1px solid var(--hair2); overflow: hidden; }
.catav.brand img { width: 100%; height: 100%; object-fit: cover; }
.catav .i { width: 20px; height: 20px; stroke-width: 1.9; }
.catav.sm { width: 30px; height: 30px; border-radius: 9px; }
.catav.sm .i { width: 15px; height: 15px; }
.exprow .ex-m { flex: 1; min-width: 0; }
.exprow .ex-m b { display: block; font-size: 14.5px; font-weight: 650; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.exprow .ex-m .ex-s { font-size: 12px; color: var(--mut); margin-top: 2px; display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.exprow .ex-m .ex-s .sep { width: 3px; height: 3px; border-radius: 99px; background: var(--mut2); flex: none; }
.exprow .ex-r { text-align: right; flex: none; }
.exprow .ex-r .ex-a { font-size: 15.5px; font-weight: 750; letter-spacing: -.01em; }
.exprow .ex-r .ex-rc { display: inline-flex; align-items: center; gap: 3px; font-size: 10.5px; color: var(--mut); margin-top: 3px; justify-content: flex-end; }
.exprow .ex-r .ex-rc .i { width: 12px; height: 12px; }
.exprow .ex-r .ex-rc.no { color: var(--warn); }

.emptyline { text-align: center; padding: 50px 20px; color: var(--mut); }
.emptyline .ei { width: 58px; height: 58px; border-radius: 99px; background: var(--brand-soft); color: var(--brand-ink); display: grid; place-items: center; margin: 0 auto 14px; }
.emptyline .ei .i { width: 28px; height: 28px; }
.emptyline b { display: block; color: var(--ink); font-size: 16px; font-weight: 700; }
.emptyline p { font-size: 13px; margin-top: 5px; }

/* ---------------------------------------------------------------- receipts inbox */
.inbox-note {
  display: flex; gap: 11px; align-items: center; background: var(--warn-soft); color: var(--warn);
  border-radius: 14px; padding: 12px 14px; margin-bottom: 14px; font-size: 12.5px; line-height: 1.4; font-weight: 600;
}
.inbox-note .i { width: 19px; height: 19px; flex: none; }
.rgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.rcard { background: var(--card); border: 1px solid var(--hair2); border-radius: 16px; box-shadow: var(--lift); overflow: hidden; text-align: left; }
.rcard:active { transform: scale(.97); }
.rthumb { height: 116px; position: relative; display: grid; place-items: center; overflow: hidden; }
.rthumb .paper { width: 60px; background: #fff; border-radius: 4px; padding: 9px 8px; box-shadow: 0 6px 16px -6px rgba(0,0,0,.4); transform: rotate(-4deg); }
.rthumb .paper .pl { height: 3px; border-radius: 2px; background: #d8d4e0; margin-bottom: 4px; }
.rthumb .paper .pl.t { height: 5px; background: #b3aec2; margin-bottom: 7px; }
.rthumb .paper .pl.amt { height: 7px; width: 60% !important; background: #2a2440; margin-top: 7px; }
.rthumb .rbadge { position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,.5); color: #fff; font: 600 9px/1 var(--f-mono); padding: 4px 6px; border-radius: 6px; backdrop-filter: blur(4px); }
.rcard .rc-b { padding: 10px 12px 12px; }
.rcard .rc-b b { display: block; font-size: 13.5px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rcard .rc-b .rc-amt { font-size: 16px; font-weight: 750; margin-top: 2px; }
.rcard .rc-b .rc-amt.q { color: var(--mut); font-weight: 600; font-size: 13px; }
.rcard .rc-b .rc-go { margin-top: 9px; display: flex; align-items: center; justify-content: center; gap: 6px;
  height: 33px; border-radius: 9px; background: var(--brand-soft); color: var(--brand-ink); font-size: 12.5px; font-weight: 700; }
.rcard .rc-b .rc-go .i { width: 14px; height: 14px; }

/* matched receipt gallery thumb */
.gthumb { aspect-ratio: 3/4; border-radius: 13px; overflow: hidden; position: relative; display: grid; place-items: center; box-shadow: var(--lift); border: 1px solid var(--hair2); }
.gthumb .paper { width: 56%; background: #fff; border-radius: 3px; padding: 8px 7px; transform: rotate(-3deg); box-shadow: 0 4px 12px -4px rgba(0,0,0,.35); }
.gthumb .paper .pl { height: 2.5px; border-radius: 2px; background: #d8d4e0; margin-bottom: 3.5px; }
.gthumb .paper .pl.t { height: 4px; background: #b3aec2; margin-bottom: 6px; }
.gthumb .gcap { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 8px 7px; background: linear-gradient(transparent, rgba(0,0,0,.6)); color: #fff; font: 700 11px/1.1 var(--f-ui); }
.gthumb .gcap span { display: block; font-weight: 500; font-size: 9.5px; opacity: .85; }

/* ---- realistic receipt placeholder ---- */
.rcpt-svg { width: 100%; height: auto; display: block; }
.rcpt-photo { display: block; width: 100%; }
.rcpt-thumb .rcpt-photo, .gthumb-crop .rcpt-photo { width: 100%; height: 100%; object-fit: cover; }
.rcpt-thumb { background: #fbfaf7; }
.lb-paper .rcpt-photo { width: 100%; border-radius: 7px; }
/* gallery + inbox crops show the top of the receipt like a photo thumbnail */
.gthumb { background: #fbfaf7; }
.gthumb-crop { position: absolute; inset: 0; overflow: hidden; }
.gthumb-crop .rcpt-svg { width: 100%; }
.rthumb { align-items: flex-start; }
.rthumb-crop { position: absolute; left: 50%; top: 8px; transform: translateX(-50%); width: 78%; overflow: hidden; height: 130px; border-radius: 4px 4px 0 0; box-shadow: 0 6px 16px -8px rgba(0,0,0,.35); }
.rthumb-crop .rcpt-svg { width: 100%; }

/* expense-detail receipt card (thumbnail + enlarge) */
.rcpt-card { display: flex; gap: 14px; align-items: center; width: 100%; text-align: left;
  background: var(--card); border: 1px solid var(--hair2); border-radius: 16px; box-shadow: var(--lift); padding: 12px 14px; }
.rcpt-card:active { transform: scale(.985); }
.rcpt-thumb { width: 84px; height: 110px; flex: none; overflow: hidden; border-radius: 11px; background: #fbfaf7;
  box-shadow: 0 6px 16px -8px rgba(0,0,0,.3); border: 1px solid var(--hair2); }
.rcpt-thumb .rcpt-svg { width: 100%; }
.rcpt-thumb.tilt { transform: rotate(-2deg); }
.rcpt-meta { min-width: 0; }
.rcpt-meta b { display: block; font-size: 14.5px; font-weight: 650; }
.rcpt-meta span { display: block; font-size: 12.5px; color: var(--mut); margin-top: 2px; }
.rcpt-meta .rcpt-link { display: inline-flex; align-items: center; gap: 5px; margin-top: 10px; color: var(--brand-ink); font-weight: 650; font-size: 12.5px; }
.rcpt-meta .rcpt-link .i { width: 13px; height: 13px; }

.rcpt-replace { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; margin-top: 9px;
  min-height: 44px; border-radius: 13px; background: var(--paper); color: var(--ink2); font-size: 13.5px; font-weight: 650; border: 1px solid var(--hair); }
:root[data-night="on"] .rcpt-replace { background: rgba(255,255,255,.05); }
.rcpt-replace:active { transform: scale(.98); }
.rcpt-replace .i { width: 16px; height: 16px; }

.rcpt-add { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px; border-radius: 14px;
  border: 1.5px dashed var(--hair); background: var(--paper); text-align: left; }
:root[data-night="on"] .rcpt-add { background: rgba(255,255,255,.03); }
.rcpt-add:active { transform: scale(.99); }
.rcpt-add .ra-ic { width: 42px; height: 42px; border-radius: 12px; background: var(--card); display: grid; place-items: center;
  color: var(--brand-ink); box-shadow: var(--lift); flex: none; }
.rcpt-add .ra-ic .i { width: 21px; height: 21px; }
.rcpt-add .ra-m { flex: 1; min-width: 0; }
.rcpt-add .ra-m b { display: block; font-size: 14px; font-weight: 650; }
.rcpt-add .ra-m span { font-size: 12px; color: var(--mut); }
.rcpt-add .chev { color: var(--mut2); }

/* lightbox — full-size receipt */
.lightbox { position: absolute; inset: 0; z-index: 120; background: rgba(8,6,14,.82);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  padding: 30px 24px calc(26px + env(safe-area-inset-bottom)); opacity: 0; transition: opacity .22s var(--ease); }
.lightbox.on { opacity: 1; }
.lb-paper { width: min(290px, 80%); max-height: 74%; overflow-y: auto; border-radius: 7px;
  box-shadow: 0 30px 70px -18px rgba(0,0,0,.8); transform: scale(.9) translateY(8px); transition: transform .28s var(--ease); scrollbar-width: none; }
.lb-paper::-webkit-scrollbar { display: none; }
.lightbox.on .lb-paper { transform: scale(1) translateY(0); }
.lb-paper .rcpt-svg { width: 100%; border-radius: 7px; }
.lb-x { position: absolute; top: calc(14px + env(safe-area-inset-top)); right: 16px; width: 40px; height: 40px;
  border-radius: 99px; display: grid; place-items: center; background: rgba(255,255,255,.16); color: #fff; }
.lb-x .i { width: 20px; height: 20px; }
.lb-replace { display: inline-flex; align-items: center; gap: 8px; flex: none; height: 46px; padding: 0 20px; border-radius: 14px;
  background: rgba(255,255,255,.16); color: #fff; font-size: 14px; font-weight: 650; backdrop-filter: blur(6px); }
.lb-replace:active { transform: scale(.96); }
.lb-replace .i { width: 17px; height: 17px; }

/* camera capture flash when retaking */
.cam-flash { position: absolute; inset: 0; z-index: 130; background: #fff; opacity: 0; pointer-events: none; }
.cam-flash.on { animation: camflash .36s var(--ease); }
@keyframes camflash { 0% { opacity: 0; } 18% { opacity: .92; } 100% { opacity: 0; } }

/* ---------------------------------------------------------------- vendors */
.vfilt-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.vfilt-row .filtrow { flex: 1; min-width: 0; margin: 0; padding: 1px 0 1px; }
.v-add { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px 0 11px;
  border-radius: 11px; background: var(--brand); color: #fff; font-size: 13px; font-weight: 650; white-space: nowrap;
  box-shadow: 0 8px 20px -8px var(--brand-ring), var(--lift); }
.v-add .i { width: 16px; height: 16px; }
.v-add:active { transform: scale(.95); background: var(--brand-deep); }
.vrow {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: var(--card); border: 1px solid var(--hair2); border-radius: 15px; box-shadow: var(--lift);
  padding: 12px 13px; margin-bottom: 8px;
}
.vrow:active { transform: scale(.985); }
.vmark { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; flex: none;
  font: 750 15px/1 var(--f-ui); color: #fff; overflow: hidden; }
.vmark.brand { background: #fff !important; border: 1px solid var(--hair2); }
.vmark img, .ava img { width: 100%; height: 100%; object-fit: cover; }
.ava.photo { color: transparent; overflow: hidden; }
.vrow .v-m { flex: 1; min-width: 0; }
.vrow .v-m b { display: block; font-size: 14.5px; font-weight: 650; display: flex; align-items: center; gap: 7px; }
.vrow .v-m .v-s { font-size: 12px; color: var(--mut); margin-top: 2px; }
.vrow .v-r { text-align: right; flex: none; }
.vrow .v-r .v-a { font-size: 15px; font-weight: 750; }
.vrow .v-r .v-c { font-size: 11px; color: var(--mut); margin-top: 2px; }
.star { color: var(--warn); display: inline-flex; }
.star .i { width: 13px; height: 13px; fill: currentColor; stroke: none; }
.vcall { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: none;
  background: var(--ok-soft); color: var(--ok); }
.vcall .i { width: 18px; height: 18px; }

/* ---------------------------------------------------------------- bottom sheet (add expense + detail) */
.scrim { position: absolute; inset: 0; background: rgba(10,8,18,.5); opacity: 0; pointer-events: none;
  transition: opacity .28s var(--ease); z-index: 70; }
.scrim.on { opacity: 1; pointer-events: auto; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 80;
  background: var(--card); border-radius: 28px 28px 0 0; box-shadow: 0 -20px 60px -20px rgba(0,0,0,.5);
  transform: translateY(100%); transition: transform .34s var(--ease);
  display: flex; flex-direction: column; max-height: 94%;
}
.sheet.on { transform: translateY(0); }
.sheet .sh-grab { width: 38px; height: 5px; border-radius: 99px; background: var(--mut2); opacity: .5; margin: 9px auto 2px; flex: none; }
.sheet .sh-h { display: flex; align-items: center; gap: 12px; padding: 8px 18px 10px; flex: none; }
.sheet .sh-h h3 { flex: 1; font-size: 18px; font-weight: 740; letter-spacing: -.02em; }
.sheet .sh-x { width: 34px; height: 34px; border-radius: 99px; display: grid; place-items: center; background: var(--paper); color: var(--mut); flex: none; }
:root[data-night="on"] .sheet .sh-x { background: rgba(255,255,255,.07); }
.sheet .sh-x .i { width: 18px; height: 18px; }
.sheet .sh-b { overflow-y: auto; padding: 4px 18px 14px; flex: 1; min-height: 0; position: relative; }
.sheet .sh-f { flex: none; padding: 12px 18px calc(18px + env(safe-area-inset-bottom)); border-top: 1px solid var(--hair2); background: var(--card); }
.sheet .sh-f .b { min-height: 52px; border-radius: 16px; font-size: 16px; font-weight: 700; }

/* ---- add-expense form ---- */
.amount-hero { text-align: center; padding: 6px 0 14px; }
.amount-hero .ah-lab { font: 600 10px/1 var(--f-mono); letter-spacing: .15em; text-transform: uppercase; color: var(--mut); }
.amount-hero .ah-val { font-size: 52px; font-weight: 780; letter-spacing: -.04em; line-height: 1; margin-top: 10px; color: var(--ink); display: inline-flex; align-items: flex-start; }
.amount-hero .ah-val .cur { font-size: 26px; font-weight: 700; color: var(--mut); margin-right: 3px; margin-top: 6px; }
.amount-hero .ah-input { display: inline-flex; align-items: baseline; justify-content: center; gap: 1px; margin-top: 9px; position: relative; }
.amount-hero .ah-input .cur { font-size: 27px; font-weight: 700; color: var(--mut); }
.amount-hero .ah-input input {
  font: 780 52px/1 var(--f-ui); letter-spacing: -.04em; border: 0; outline: 0; background: none;
  color: var(--ink); width: auto; min-width: 1ch; max-width: 240px; text-align: left; padding: 0;
  font-variant-numeric: tabular-nums;
}
.amount-hero .ah-input input::placeholder { color: var(--mut2); }

/* ---- amount header band (concept: Amount header band) ---- */
.add-band { position: relative; background: linear-gradient(155deg, #6f5ef3, #5b4ce0); color: #fff;
  border-radius: 0; padding: 15px 18px 18px; flex: none; overflow: hidden; }
.add-band::after { content: ""; position: absolute; right: -50px; top: -60px; width: 200px; height: 200px; border-radius: 99px;
  background: radial-gradient(circle, rgba(255,255,255,.16), transparent 70%); pointer-events: none; }
.add-band .ab-grab { width: 38px; height: 5px; border-radius: 99px; background: rgba(255,255,255,.45); margin: 0 auto 14px; }
.add-band .ab-x { position: absolute; right: 14px; top: 16px; width: 33px; height: 33px; border-radius: 99px;
  background: rgba(255,255,255,.18); color: #fff; display: grid; place-items: center; z-index: 2; }
.add-band .ab-x .i { width: 17px; height: 17px; }
.add-band .ab-title { font: 600 10px/1 var(--f-mono); letter-spacing: .15em; text-transform: uppercase; color: rgba(255,255,255,.78); }
.add-band .ab-amt { display: flex; align-items: flex-start; gap: 2px; margin-top: 9px; }
.add-band .ab-amt .cur { font-size: 27px; font-weight: 700; color: rgba(255,255,255,.82); margin-top: 6px; margin-right: 1px; }
.add-band .ab-amt input { font: 780 50px/1 var(--f-ui); letter-spacing: -.04em; border: 0; outline: 0; background: none;
  color: #fff; width: auto; min-width: 1ch; max-width: 230px; padding: 0; font-variant-numeric: tabular-nums; }
.add-band .ab-amt input::placeholder { color: rgba(255,255,255,.5); }
.add-band.found { background: linear-gradient(155deg, #1f9d63, #168a54); }
.pickchip .pf-thumb { width: 22px; height: 22px; border-radius: 6px; object-fit: cover; flex: none; }

/* tall bottom sheet — fills to 94% height so the strip above matches the other sheets exactly */
.sheet.fullsheet { bottom: 0 !important; top: auto !important; height: 94% !important; max-height: 94% !important; border-radius: 26px 26px 0 0; background: var(--paper); }
.sheet.fullsheet .sh-f { background: var(--paper); }
.lf-grab { width: 38px; height: 5px; border-radius: 99px; background: var(--mut2); opacity: .5; margin: 2px auto 9px; }
.lf-head { position: relative; flex: none; padding: 9px 18px 11px; text-align: center; background: var(--paper); border-radius: 26px 26px 0 0; }
.lf-head .lf-back { position: absolute; left: 14px; top: 9px; width: 40px; height: 40px; border-radius: 12px; background: var(--card); box-shadow: var(--lift); display: grid; place-items: center; color: var(--ink); }
.lf-head .lf-back .i { width: 20px; height: 20px; }
.lf-head h3 { font-size: 19px; font-weight: 760; letter-spacing: -.02em; }
.lf-head p { font-size: 12.5px; color: var(--mut); margin-top: 3px; }
.cseg-ic.thumb { padding: 0; overflow: hidden; background: var(--paper); }
.cseg-ic.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cseg-ic.av { background: none; padding: 0; }
.cseg-ic.brandchip { padding: 0; overflow: hidden; background: #fff; border: 1px solid var(--hair2); }
.cseg-ic.brandchip img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cseg-ic.av .ava { width: 36px; height: 36px; font-size: 12px; }

/* custom dropdown: whole field opens it; menu options carry icons/thumbs/avatars */
.ddcard { width: 100%; cursor: pointer; }
.ddval2 { flex: 1; min-width: 0; text-align: left; font-size: 15px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ddval2.ph { color: var(--mut2); font-weight: 500; }
.ddchev.up { transform: rotate(-90deg); }
.ddmenu { position: absolute; left: 18px; right: 18px; top: auto; z-index: 40; background: var(--card); border: 1px solid var(--hair); border-radius: 13px; box-shadow: var(--lift-lg); margin-top: 7px; padding: 5px; max-height: 252px; overflow-y: auto; animation: ddIn .15s var(--ease); }
@keyframes ddIn { from { opacity: 0; transform: translateY(-5px); } }
:root[data-night="on"] .ddmenu { background: #262232; }
.ddopt { display: flex; align-items: center; gap: 11px; width: 100%; text-align: left; padding: 9px 10px; border-radius: 10px; font-size: 14.5px; font-weight: 600; color: var(--ink); }
.ddopt:active { transform: scale(.99); }
.ddopt.sel { background: var(--brand-soft); color: var(--brand-ink); }
.ddopt .ddo-ic { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex: none; overflow: hidden; }
.ddopt .ddo-ic svg { width: 16px; height: 16px; }
.ddopt .ddo-ic img { width: 100%; height: 100%; object-fit: cover; }
.ddopt .ddo-ic .ava, .ddopt .ddo-ic .vmark { width: 30px; height: 30px; font-size: 11px; border-radius: 8px; }
.datecard { position: relative; }
.dd-dateinput { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; border: 0; padding: 0; margin: 0; cursor: pointer; }

/* inline Paid-to input + chevron toggle */
.dd-inline { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-size: 15px; font-weight: 600; color: var(--ink); padding: 15px 0; }
.dd-inline::placeholder { color: var(--mut2); font-weight: 500; }
.ddchev-btn { color: var(--mut2); transform: rotate(90deg); flex: none; padding: 6px 0; display: grid; place-items: center; }
/* all dropdown chevrons share one box so they line up across every field */
.ddcard .ddchev, .ddcard .ddchev-btn { width: 18px; height: 18px; padding: 0; display: grid; place-items: center; flex: none; }
.ddcard .ddchev .i, .ddcard .ddchev-btn .i { width: 16px; height: 16px; }
/* Paid-to chevron: keep the icon aligned (18px), expand only the hit area */
.ddcard .ddchev-btn { position: relative; }
.ddcard .ddchev-btn::before { content: ""; position: absolute; inset: -16px -8px -16px -42px; }
.ddchev-btn.up { transform: rotate(-90deg); }
.ddchev-btn .i { width: 16px; height: 16px; }
/* dropdown menu extras */
.dd-typehint { font: 600 9px/1 var(--f-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--mut2); padding: 8px 6px 6px; }
.ddo-check { width: 16px; height: 16px; color: var(--brand-ink); flex: none; stroke-width: 2.4; }
/* calendar popover */
.calmenu { max-height: none; padding: 10px; }
.cal-h { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 8px; }
.cal-h b { font-size: 14px; font-weight: 700; }
.cal-nav { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: var(--ink2); }
.cal-nav:active { transform: scale(.9); }
.cal-nav .i { width: 17px; height: 17px; }
.cal-dow { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; margin-bottom: 4px; }
.cal-dow span { text-align: center; font: 600 10px/1 var(--f-mono); color: var(--mut2); padding: 4px 0; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-d { height: 36px; border-radius: 9px; font-size: 13.5px; font-weight: 600; color: var(--ink); display: grid; place-items: center; }
.cal-d.empty { visibility: hidden; }
.cal-d.today { color: var(--brand-ink); font-weight: 800; box-shadow: inset 0 0 0 1.5px var(--brand-ring); }
.cal-d.sel { background: var(--brand); color: #fff; box-shadow: none; }

/* ---- field-card language for the whole add sheet ---- */
.catgrid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.catseg { display: flex; align-items: center; gap: 10px; min-height: 54px; padding: 0 12px; border-radius: 14px;
  background: var(--card); border: 1.5px solid var(--hair2); box-shadow: var(--lift); font-size: 13.5px; font-weight: 650;
  color: var(--ink2); text-align: left; transition: transform .1s var(--ease); }
.catseg:active { transform: scale(.97); }
.catseg .cseg-ic { width: 32px; height: 32px; border-radius: 9px; background: var(--brand-soft); color: var(--brand-ink); display: grid; place-items: center; flex: none; }
.catseg .cseg-ic .i { width: 17px; height: 17px; }
.catseg .cseg-n { flex: 1; min-width: 0; line-height: 1.18; }
.catseg.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-ink); }
.catseg.on .cseg-ic { background: var(--brand); color: #fff; }

.ddcard { display: flex; align-items: center; gap: 11px; background: var(--card); border: 1px solid var(--hair); border-radius: 13px; box-shadow: var(--lift); padding: 0 13px; min-height: 54px; }
:root[data-night="on"] .ddcard { background: rgba(255,255,255,.05); }
.ddcard .cseg-ic { width: 36px; height: 36px; border-radius: 10px; background: var(--brand-soft); color: var(--brand-ink); display: grid; place-items: center; flex: none; }
.ddcard .cseg-ic .i { width: 19px; height: 19px; }
.ddcard .ddsel { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-size: 15px; font-weight: 600; color: var(--ink); appearance: none; -webkit-appearance: none; padding: 15px 0; }
.ddcard .ddval { flex: 1; font-size: 15px; font-weight: 600; color: var(--ink); }
.ddcard .ddchev { color: var(--mut2); transform: rotate(90deg); flex: none; } .ddcard .ddchev .i { width: 16px; height: 16px; }

.notecard { display: flex; align-items: flex-start; gap: 11px; background: var(--card); border: 1px solid var(--hair); border-radius: 13px; box-shadow: var(--lift); padding: 13px; }
:root[data-night="on"] .notecard { background: rgba(255,255,255,.05); }
.notecard .cseg-ic { width: 36px; height: 36px; border-radius: 10px; background: var(--brand-soft); color: var(--brand-ink); display: grid; place-items: center; flex: none; }
.notecard .cseg-ic .i { width: 19px; height: 19px; }
.notecard .ddnote { flex: 1; min-width: 0; border: 0; outline: 0; background: none; resize: none; min-height: 46px; font-family: inherit; font-size: 15px; font-weight: 600; color: var(--ink); padding-top: 7px; }
.notecard .ddnote::placeholder { color: var(--mut2); }

.flab { font: 600 10px/1 var(--f-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--mut); margin: 16px 2px 9px; display: block; }
.flab:first-child { margin-top: 4px; }

.catpick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; }
.catopt { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 11px 4px 9px; border-radius: 14px;
  background: var(--paper); border: 1.5px solid transparent; transition: all .12s var(--ease); }
:root[data-night="on"] .catopt { background: rgba(255,255,255,.04); }
.catopt .catav { width: 38px; height: 38px; }
.catopt span { font-size: 10px; font-weight: 600; color: var(--ink2); text-align: center; line-height: 1.2; }
.catopt.on { border-color: var(--brand); background: var(--brand-soft); }
.catopt.on span { color: var(--brand-ink); }
.catopt:active { transform: scale(.93); }

.pickrow { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin: 0 -2px; scrollbar-width: none; }
.pickrow::-webkit-scrollbar { display: none; }
.pickchip { flex: none; display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 15px; border-radius: 12px;
  background: var(--paper); border: 1.5px solid transparent; font-size: 13.5px; font-weight: 600; color: var(--ink2); white-space: nowrap; }
:root[data-night="on"] .pickchip { background: rgba(255,255,255,.04); }
.pickchip .vmark { width: 24px; height: 24px; border-radius: 7px; font-size: 9px; }
.pickchip.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-ink); }
.pickchip.add { color: var(--brand-ink); }
.pickchip:active { transform: scale(.95); }

.field { width: 100%; min-height: 50px; border: 1px solid var(--hair); background: var(--card); border-radius: 13px;
  padding: 12px 14px; font-size: 16px; outline: 0; color: var(--ink); }
:root[data-night="on"] .field { background: rgba(255,255,255,.05); }
.field:focus { border-color: var(--brand); box-shadow: 0 0 0 3.5px var(--brand-ring); }
textarea.field { min-height: 64px; resize: none; }
.field-row { display: flex; gap: 9px; }
.field-row > * { flex: 1; }

.toggle-row { display: flex; align-items: center; gap: 12px; padding: 13px 2px; }
.toggle-row .tr-m { flex: 1; min-width: 0; }
.toggle-row .tr-m b { display: block; font-size: 14px; font-weight: 600; }
.toggle-row .tr-m span { font-size: 12px; color: var(--mut); }
.swt { width: 50px; height: 30px; border-radius: 99px; background: var(--mut2); position: relative; flex: none; transition: background .18s; }
.swt::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 99px; background: #fff; transition: transform .2s var(--ease); box-shadow: 0 2px 5px rgba(0,0,0,.25); }
.swt.on { background: var(--brand); }
.swt.on::after { transform: translateX(20px); }

.whorow { display: flex; gap: 8px; }
.whoopt { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 9px 2px; border-radius: 12px;
  background: var(--paper); border: 1.5px solid transparent; }
:root[data-night="on"] .whoopt { background: rgba(255,255,255,.04); }
.whoopt .ava { width: 32px; height: 32px; font-size: 11px; }
.whoopt span { font-size: 10px; font-weight: 600; color: var(--ink2); }
.whoopt.on { border-color: var(--brand); background: var(--brand-soft); }

/* receipt attach */
.attach { display: flex; width: 100%; align-items: center; gap: 12px; padding: 13px 14px; border-radius: 13px; border: 1px solid var(--hair);
  background: var(--card); color: var(--ink2); box-shadow: var(--lift); }
:root[data-night="on"] .attach { background: rgba(255,255,255,.05); }
.attach .at-ic { width: 36px; height: 36px; border-radius: 10px; background: var(--brand-soft); display: grid; place-items: center; color: var(--brand-ink); flex: none; }
.attach .at-m { flex: 1; }
.attach .at-m b { display: block; font-size: 13.5px; font-weight: 650; }
.attach .at-m span { font-size: 11.5px; color: var(--mut); }
.attach.has { border-style: solid; border-color: var(--ok); background: var(--ok-soft); color: var(--ok); }
.attach.has .at-ic { color: var(--ok); }
.attach.has .at-m b { color: var(--ink); }
/* attached real photo: thumbnail + remove */
.attach.photo { padding: 9px 12px; border-style: solid; border-color: var(--ok); background: var(--ok-soft); }
.attach .attach-thumb { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; flex: none; border: 1px solid var(--hair); }
.attach.photo .at-m { flex: 1; }
.attach.photo .at-m b { color: var(--ink); }
.attach.photo .at-m span { color: var(--ok); }
.attach .attach-x { width: 32px; height: 32px; border-radius: 99px; display: grid; place-items: center; flex: none; background: var(--card); color: var(--mut); box-shadow: var(--lift); }
.attach .attach-x .i { width: 16px; height: 16px; }
.attach .attach-x:active { transform: scale(.9); }

/* ---- AI scan workflow ---- */
.scan-zone { padding: 8px 0 6px; }
.scan-frame { aspect-ratio: 4/5; border-radius: 22px; background: #0d0b16; position: relative; overflow: hidden;
  display: grid; place-items: center; }
.scan-frame .scan-paper { width: 64%; background: #fbfaf7; border-radius: 6px; padding: 18px 16px; transform: rotate(-2deg);
  box-shadow: 0 20px 50px -16px rgba(0,0,0,.6); }
.scan-frame .scan-paper .pl { height: 5px; border-radius: 3px; background: #ddd8e6; margin-bottom: 7px; }
.scan-frame .scan-paper .pl.t { height: 9px; width: 70%; background: #2a2440; margin-bottom: 13px; }
.scan-frame .scan-paper .pl.amt { height: 12px; width: 50%; background: #1b8a5a; margin-top: 12px; }
.scan-frame .corner { position: absolute; width: 30px; height: 30px; border: 3px solid var(--brand); }
.scan-frame .corner.tl { top: 18px; left: 18px; border-right: 0; border-bottom: 0; border-radius: 8px 0 0 0; }
.scan-frame .corner.tr { top: 18px; right: 18px; border-left: 0; border-bottom: 0; border-radius: 0 8px 0 0; }
.scan-frame .corner.bl { bottom: 18px; left: 18px; border-right: 0; border-top: 0; border-radius: 0 0 0 8px; }
.scan-frame .corner.br { bottom: 18px; right: 18px; border-left: 0; border-top: 0; border-radius: 0 0 8px 0; }
.scan-frame .scanline { position: absolute; left: 18px; right: 18px; height: 3px; border-radius: 99px;
  background: linear-gradient(90deg, transparent, var(--brand), transparent); box-shadow: 0 0 16px 3px var(--brand-ring);
  top: 18px; animation: scanmove 1.5s var(--ease) infinite; }
@keyframes scanmove { 0% { top: 22px; } 50% { top: calc(100% - 26px); } 100% { top: 22px; } }
.scan-cap { text-align: center; margin-top: 16px; }
.scan-cap b { display: block; font-size: 16px; font-weight: 720; }
.scan-cap span { font-size: 13px; color: var(--mut); display: block; margin-top: 4px; }
.scan-dots { display: inline-flex; gap: 5px; margin-top: 12px; }
.scan-dots i { width: 7px; height: 7px; border-radius: 99px; background: var(--brand); animation: dotpulse 1.2s infinite; }
.scan-dots i:nth-child(2) { animation-delay: .2s; } .scan-dots i:nth-child(3) { animation-delay: .4s; }
@keyframes dotpulse { 0%,100% { opacity: .25; transform: scale(.8); } 50% { opacity: 1; transform: scale(1); } }

.found-banner { display: flex; align-items: center; gap: 10px; background: var(--ok-soft); color: var(--ok); border-radius: 14px;
  padding: 12px 14px; margin-bottom: 14px; font-size: 13px; font-weight: 650; animation: scrIn .3s var(--ease); }
.found-banner .i { width: 19px; height: 19px; flex: none; }
.found-field { position: relative; }
.found-field .glow { position: absolute; inset: -2px; border-radius: 15px; border: 1.5px solid var(--ok); opacity: 0; animation: foundglow 1.4s var(--ease) 1; pointer-events: none; }
@keyframes foundglow { 0% { opacity: .9; } 100% { opacity: 0; } }

/* ---- save success ---- */
.saved { position: absolute; inset: 0; z-index: 90; background: var(--card); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center; padding: 30px; }
.saved .ring { width: 92px; height: 92px; border-radius: 99px; background: var(--ok-soft); display: grid; place-items: center; color: var(--ok); margin-bottom: 18px; animation: savepop .4s var(--ease); }
.saved .ring .i { width: 46px; height: 46px; stroke-width: 2.4; }
@keyframes savepop { 0% { transform: scale(.5); opacity: 0; } 60% { transform: scale(1.08); } 100% { transform: scale(1); opacity: 1; } }
.saved b { font-size: 22px; font-weight: 760; letter-spacing: -.02em; }
.saved p { font-size: 14px; color: var(--mut); margin-top: 6px; }
.saved .amt { font-size: 15px; font-weight: 700; color: var(--ink2); margin-top: 14px; background: var(--paper); padding: 8px 16px; border-radius: 99px; }

/* ---- detail sheet rows ---- */
.dh-hero { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 4px 0 16px; }
.dh-hero .catav { width: 60px; height: 60px; border-radius: 18px; margin-bottom: 13px; }
.dh-hero .catav .i { width: 30px; height: 30px; }
.dh-hero .dh-a { font-size: 40px; font-weight: 780; letter-spacing: -.03em; }
.dh-hero .dh-v { font-size: 15px; font-weight: 600; color: var(--ink2); margin-top: 4px; }
.drow { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-top: 1px solid var(--hair2); }
.drow .dl { font-size: 13px; color: var(--mut); width: 92px; flex: none; }
.drow .dv { flex: 1; font-size: 14px; font-weight: 600; text-align: right; display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.drow .dv .ava { width: 22px; height: 22px; font-size: 9px; }

/* settings list */
.setgroup { background: var(--card); border: 1px solid var(--hair2); border-radius: 16px; box-shadow: var(--lift); overflow: hidden; margin-bottom: 14px; }
.setrow { display: flex; align-items: center; gap: 13px; padding: 14px 16px; border-top: 1px solid var(--hair2); width: 100%; text-align: left; }
.setrow:first-child { border-top: 0; }
.setrow .st-ic { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; flex: none; background: var(--brand-soft); color: var(--brand-ink); }
.setrow .st-ic .i { width: 18px; height: 18px; }
.setrow .st-m { flex: 1; min-width: 0; }
.setrow .st-m b { display: block; font-size: 14.5px; font-weight: 600; }
.setrow .st-m span { font-size: 12px; color: var(--mut); }
.setrow .chev { color: var(--mut2); width: 18px; height: 18px; flex: none; }

.workflow-pick { display: flex; flex-direction: column; gap: 10px; }
.wfopt { display: flex; gap: 13px; align-items: flex-start; padding: 15px; border-radius: 16px; background: var(--card);
  border: 1.5px solid var(--hair); box-shadow: var(--lift); text-align: left; width: 100%; }
.wfopt .wf-ico { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; flex: none; background: var(--paper); color: var(--ink2); }
:root[data-night="on"] .wfopt .wf-ico { background: rgba(255,255,255,.05); }
.wfopt .wf-ico .i { width: 22px; height: 22px; }
.wfopt .wf-tx { flex: 1; min-width: 0; }
.wfopt .wf-tx b { display: block; font-size: 15px; font-weight: 700; }
.wfopt .wf-tx p { font-size: 12.5px; color: var(--mut); margin-top: 3px; line-height: 1.45; }
.wfopt .wf-rad { width: 22px; height: 22px; border-radius: 99px; border: 2px solid var(--mut2); flex: none; margin-top: 2px; display: grid; place-items: center; }
.wfopt.on { border-color: var(--brand); }
.wfopt.on .wf-ico { background: var(--brand-soft); color: var(--brand-ink); }
.wfopt.on .wf-rad { border-color: var(--brand); background: var(--brand); }
.wfopt.on .wf-rad::after { content: ""; width: 8px; height: 8px; border-radius: 99px; background: #fff; }

/* toast */
.toast { position: absolute; left: 18px; right: 18px; bottom: calc(100px + env(safe-area-inset-bottom)); z-index: 95;
  background: #1c1830; color: #fff; border-radius: 14px; padding: 13px 16px; display: flex; align-items: center; gap: 10px;
  font-size: 13.5px; font-weight: 600; box-shadow: var(--lift-lg); transform: translateY(20px); opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .25s var(--ease); }
.toast.on { opacity: 1; transform: translateY(0); }
.toast .i { width: 18px; height: 18px; color: var(--ok); flex: none; }

/* ---------------------------------------------------------------- global search overlay */
.search-ov { position: absolute; inset: 0; z-index: 110; background: var(--paper);
  display: flex; flex-direction: column; opacity: 0; transform: translateY(8px);
  transition: opacity .18s var(--ease), transform .18s var(--ease); }
.search-ov.on { opacity: 1; transform: translateY(0); }
.so-head { flex: none; display: flex; align-items: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 12px; }
.so-box { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 13px;
  border-radius: 14px; background: var(--card); border: 1px solid var(--hair); box-shadow: var(--lift); }
.so-box .i { width: 20px; height: 20px; color: var(--mut2); flex: none; }
.so-box input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-family: inherit;
  font-size: 16px; font-weight: 600; color: var(--ink); }
.so-box input::placeholder { color: var(--mut2); font-weight: 500; }
.so-clear { width: 24px; height: 24px; border-radius: 99px; display: grid; place-items: center;
  background: var(--paper); color: var(--mut2); flex: none; }
.so-clear .i { width: 13px; height: 13px; color: var(--mut); }
.so-cancel { flex: none; font-size: 14.5px; font-weight: 650; color: var(--brand-ink); padding: 4px; }
.so-results { flex: 1; overflow-y: auto; padding: 4px 16px calc(20px + env(safe-area-inset-bottom)); scrollbar-width: none; }
.so-results::-webkit-scrollbar { display: none; }
.so-sec { margin-bottom: 14px; }
.so-lab { font: 600 10.5px/1 var(--f-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--mut2);
  padding: 6px 2px 9px; }
.so-row { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: var(--card); border: 1px solid var(--hair2); border-radius: 14px; box-shadow: var(--lift);
  padding: 10px 12px; margin-bottom: 8px; transition: transform .1s var(--ease); }
.so-row:active { transform: scale(.985); }
.so-ic { width: 40px; height: 40px; border-radius: 11px; overflow: hidden; flex: none; display: grid; place-items: center; background: var(--paper); }
.so-ic.thumb img { width: 100%; height: 100%; object-fit: cover; }
.so-ic.mk { background: none; }
.so-ic.act { background: var(--brand-wash, #ECEBFD); color: var(--brand, #5A4AD6); }
.so-ic.act svg { width: 21px; height: 21px; }
.so-ic.mk .vmark, .so-ic.mk .catav { width: 40px; height: 40px; border-radius: 11px; }
.so-m { flex: 1; min-width: 0; }
.so-m b { display: block; font-size: 14.5px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.so-m span { display: block; font-size: 12px; color: var(--mut); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.so-chev { color: var(--mut2); width: 17px; height: 17px; flex: none; }
.so-chev .i { width: 17px; height: 17px; }
.so-empty { text-align: center; padding: 50px 24px; color: var(--mut); }
.so-empty .ei { width: 52px; height: 52px; border-radius: 16px; background: var(--card); border: 1px solid var(--hair2);
  display: grid; place-items: center; margin: 0 auto 14px; color: var(--mut2); box-shadow: var(--lift); }
.so-empty .ei .i { width: 24px; height: 24px; }
.so-empty b { display: block; font-size: 15px; font-weight: 700; color: var(--ink); }
.so-empty p { font-size: 13px; margin-top: 5px; }
