/* ---------- page scaffolding ---------- */
.page { padding: 6px 16px 28px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-content: start; }
.page > * { min-width: 0; }
.topbar { display: flex; align-items: center; gap: 10px; padding: 4px 0 2px; min-height: 48px; }
.page > .topbar:first-child { position: sticky; top: 0; z-index: 4; background: var(--canvas); margin: -6px -16px -4px; padding: 8px 16px 8px; transition: background-color .25s; }
.topbar .grow { flex: 1; min-width: 0; }
.topbar h1 { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: -.01em; line-height: 1.15; }
.topbar .sub { margin: 2px 0 0; font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.title-sm { font-size: 18px !important; font-weight: 600 !important; }
.iconbtn { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--card); color: var(--ink); display: grid; place-items: center; position: relative; flex: none; transition: transform .12s ease, background-color .2s; }
.iconbtn svg { width: 22px; height: 22px; }
.iconbtn.brand { background: var(--brand); color: var(--on-brand); }
.iconbtn .badge { position: absolute; top: 5px; inset-inline-end: 4px; min-width: 19px; height: 19px; border-radius: 10px; background: var(--bad); color: #FFFFFF; font-size: 12px; font-weight: 600; display: grid; place-items: center; padding: 0 4px; border: 2px solid var(--card); }
.avatar { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 15px; flex: none; background: var(--brand-soft); color: var(--brand-text); border: 0; }
.avatar.lg { width: 64px; height: 64px; font-size: 22px; }
.avatar.sm { width: 34px; height: 34px; font-size: 12.5px; }
.sec { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 8px 2px -2px; }
.sec h2 { margin: 0; font-size: 19px; font-weight: 600; }
.sec .link { border: 0; background: none; color: var(--brand-text); font-size: 15px; font-weight: 600; padding: 13px 6px; margin: -13px -6px; min-width: 44px; text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.num { font-variant-numeric: tabular-nums; }
.row { display: flex; align-items: center; gap: 10px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stack { display: grid; gap: 10px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.grid2 > *, .grid3 > *, .kpis > *, .cats > * { min-width: 0; }

/* page enter animation (only on navigation) */
@media (prefers-reduced-motion: no-preference) {
  .screen.enter > * { animation: pagein .2s cubic-bezier(.2,.8,.2,1); }
  @keyframes pagein { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
}

/* ---------- cards & lists ---------- */
.card { background: var(--card); border-radius: var(--r-card); padding: 16px; display: grid; gap: 12px; transition: background-color .25s; }
.card.tight { padding: 14px; gap: 8px; }
.list { background: var(--card); border-radius: var(--r-card); overflow: hidden; transition: background-color .25s; }
.item { display: flex; align-items: center; gap: 12px; padding: 13px 16px; width: 100%; background: none; border: 0; text-align: start; position: relative; color: var(--ink); transition: background-color .15s; }
.item + .item::before { content: ""; position: absolute; top: 0; inset-inline-start: 68px; inset-inline-end: 0; height: 1px; background: var(--line); }
.item.noico + .item.noico::before { inset-inline-start: 16px; }
button.item:active { background: var(--card-press); }
.ico { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; flex: none; background: var(--brand-soft); color: var(--brand-text); }
.ico svg { width: 22px; height: 22px; }
.ico.round { border-radius: 50%; }
.ico.plain { background: var(--field); color: var(--ink-2); }
.item .body { flex: 1; min-width: 0; display: grid; gap: 2px; }
.item .t { font-size: 16px; font-weight: 500; line-height: 1.3; overflow-wrap: break-word; }
.item .s { font-size: 14px; color: var(--muted); line-height: 1.35; }
.item .end { display: grid; gap: 4px; justify-items: end; text-align: end; flex: none; }
.item .amt { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.chev { width: 18px; height: 18px; color: var(--chev); flex: none; }
[dir="rtl"] .chev { transform: scaleX(-1); }

.k-vaad { background: var(--c-vaad-soft); color: var(--c-vaad); }
.k-arnona { background: var(--c-arnona-soft); color: var(--c-arnona); }
.k-water { background: var(--c-water-soft); color: var(--c-water); }
.k-power { background: var(--c-power-soft); color: var(--c-power); }
.k-gas { background: var(--c-gas-soft); color: var(--c-gas); }
.k-net { background: var(--c-net-soft); color: var(--c-net); }
.k-ok { background: var(--ok-soft); color: var(--ok); }
.k-due { background: var(--due-soft); color: var(--due); }
.k-bad { background: var(--bad-soft); color: var(--bad); }
.k-info { background: var(--info-soft); color: var(--info); }

.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 600; border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.pill.dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.due { background: var(--due-soft); color: var(--due); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.info { background: var(--info-soft); color: var(--info); }
.pill.brand { background: var(--brand-soft); color: var(--brand-text); }
.pill.gray { background: var(--field); color: var(--ink-2); }

/* ---------- buttons ---------- */
.btn { border: 0; border-radius: var(--r-btn); padding: 14px 18px; min-height: 48px; font-weight: 600; font-size: 16px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; line-height: 1.2; transition: transform .12s ease, filter .15s, background-color .2s; }
.btn svg { width: 19px; height: 19px; }
.btn.primary { background: var(--brand); color: var(--on-brand); }
.btn.light { background: #FFFFFF; color: #0B3A2F; }
.btn.ghost { background: rgba(255,255,255,.15); color: #FFFFFF; }
.btn.soft { background: var(--brand-soft); color: var(--brand-text); }
.btn.plain { background: var(--field); color: var(--ink); }
.btn.danger { background: var(--bad-soft); color: var(--bad); }
.btn.block { width: 100%; }
.btn.sm { padding: 8px 14px; min-height: 44px; font-size: 14.5px; border-radius: 12px; }
.btn:disabled { opacity: .45; cursor: default; }
@media (hover: hover) { .btn.primary:hover { filter: brightness(1.08); } }

/* tactile press feedback, like native banking apps */
.btn:active, .iconbtn:active, .qa:active .ico, .cat:active, .widget:active, .chip:active, .apt:active,
.family-card:active, .alert-card:active, .choice:active, .svc:active, .upload:active, .composer .send:active, .tabbar button:active .tb-ico { transform: scale(.96); }

/* ---------- forms ---------- */
.field { display: grid; gap: 6px; }
.field > label, .label { font-size: 14.5px; color: var(--ink); font-weight: 600; }
.input, select.input, textarea.input { border: 1.5px solid var(--input-border); background: var(--card); color: var(--ink); border-radius: 14px; padding: 14px; font-size: 16px; width: 100%; outline: none; transition: border-color .15s, background-color .15s; }
.input::placeholder { color: var(--muted); opacity: .75; font-weight: 400; }
.composer .input { background: var(--field); border-color: transparent; }
.input:focus { border-color: var(--brand-2); background: var(--field-focus); }
textarea.input { min-height: 92px; resize: none; line-height: 1.4; }
.input.big { font-size: 22px; font-weight: 600; letter-spacing: .02em; }
.otp { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; direction: ltr; }
.otp input { text-align: center; font-size: 26px; font-weight: 600; padding: 14px 0; }
.chips { display: flex; gap: 7px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chips.wrap { flex-wrap: wrap; overflow: visible; }
.chip { border: 1.5px solid var(--input-border); background: var(--card); color: var(--ink); border-radius: 999px; padding: 8px 16px; min-height: 44px; min-width: 44px; font-size: 15px; white-space: nowrap; transition: transform .12s ease, background-color .15s; }
.chip[aria-pressed="true"] { background: var(--chip-on-bg); border-color: var(--chip-on-bg); color: var(--chip-on-fg); }
.segment { display: flex; background: var(--segment-bg); border-radius: 14px; padding: 3px; }
.segment button { flex: 1; border: 0; background: none; color: var(--ink-2); border-radius: 11px; padding: 10px 6px; min-height: 44px; font-size: 15px; transition: background-color .15s, color .15s; }
.segment button[aria-pressed="true"] { background: var(--segment-on); color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.choice { display: flex; gap: 12px; align-items: flex-start; background: var(--card); color: var(--ink); border: 2px solid transparent; border-radius: 18px; padding: 14px; width: 100%; text-align: start; transition: transform .12s ease, border-color .15s, background-color .15s; }
.choice[aria-pressed="true"] { border-color: var(--brand-2); background: var(--choice-on); }
.choice .t { font-weight: 600; font-size: 16px; }
.choice .s { font-size: 14px; color: var(--muted); margin-top: 3px; line-height: 1.35; }
.switch { width: 50px; height: 30px; border-radius: 999px; border: 0; background: var(--switch-off); position: relative; flex: none; margin: 7px 0; transition: background-color .18s; }
.switch::before { content: ""; position: absolute; inset: -7px -4px; }
.switch::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 24px; height: 24px; border-radius: 50%; background: #FFFFFF; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: inset-inline-start .18s cubic-bezier(.3,.7,.3,1); }
.switch[aria-checked="true"] { background: var(--brand-2); }
.switch[aria-checked="true"]::after { inset-inline-start: 23px; }
.check { width: 24px; height: 24px; border-radius: 8px; border: 2px solid var(--check-border); display: grid; place-items: center; flex: none; color: #FFFFFF; transition: background-color .15s, border-color .15s; }
.check[aria-checked="true"] { background: var(--brand-2); border-color: var(--brand-2); }
.check svg { width: 15px; height: 15px; }

/* ---------- progress & stats ---------- */
.progress { height: 9px; background: var(--line); border-radius: 999px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--brand-2); border-radius: 999px; }
.progress.on-dark { background: rgba(255,255,255,.18); }
.progress.on-dark > i { background: var(--mint); }
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.kpi .v, .kpi .l { overflow-wrap: anywhere; }
.kpi { background: var(--card); border-radius: 18px; padding: 14px; display: grid; gap: 2px; transition: background-color .25s; }
.kpi .v { font-size: 21px; font-weight: 600; font-variant-numeric: tabular-nums; }
.kpi .l { font-size: 13.5px; color: var(--muted); line-height: 1.3; }
.kpi.bad .v { color: var(--bad); }
.kpi.ok .v { color: var(--ok); }

/* ---------- tab bar ---------- */
.tabbar { flex: none; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--tabbar-bg); border-top: 1px solid var(--line); padding: 6px 4px calc(16px + env(safe-area-inset-bottom, 0px)); transition: background-color .25s; }
.tabbar button { border: 0; background: none; display: grid; justify-items: center; gap: 2px; min-height: 52px; font-size: 12.5px; color: var(--muted); padding: 2px 0 4px; position: relative; }
.tabbar .tb-ico { width: 54px; height: 30px; border-radius: 15px; display: grid; place-items: center; transition: background-color .2s, transform .12s ease; }
.tabbar svg { width: 23px; height: 23px; }
.tabbar button[aria-current="true"] { color: var(--brand-text); font-weight: 600; }
.tabbar button[aria-current="true"] .tb-ico { background: var(--brand-soft); }
.tabbar .tb-badge { position: absolute; top: 0; inset-inline-start: calc(50% + 8px); min-width: 18px; height: 18px; border-radius: 9px; background: var(--bad); color: #FFFFFF; font-size: 12px; font-weight: 600; display: grid; place-items: center; padding: 0 4px; border: 2px solid var(--tabbar-bg); box-sizing: content-box; }

/* ---------- overlay, sheet, modal, toast ---------- */
.overlay { position: absolute; inset: 0; background: var(--overlay); z-index: 20; }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; z-index: 21; background: var(--canvas); color: var(--ink); border-radius: 28px 28px 0 0; padding: 10px 16px calc(26px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 12px; max-height: 90%; overflow-y: auto; overscroll-behavior: contain; }
.sheet .grab { width: 42px; height: 5px; border-radius: 3px; background: var(--grab); margin: 0 auto 2px; }
.sheet h2 { margin: 0; font-size: 21px; font-weight: 600; }
.sheet .lead { margin: -4px 0 0; font-size: 14px; color: var(--muted); line-height: 1.45; }
.modal { position: absolute; left: 24px; right: 24px; top: 50%; transform: translateY(-50%); z-index: 22; background: var(--modal-bg); color: var(--ink); border-radius: 28px; padding: 26px 22px 20px; display: grid; gap: 10px; text-align: center; justify-items: center; box-shadow: var(--shadow-lg); }
.modal .art { width: 92px; height: 92px; border-radius: 50%; background: radial-gradient(circle at 30% 30%, #6FE0BF, #12936F); display: grid; place-items: center; color: #FFFFFF; margin-bottom: 6px; }
.modal .art svg { width: 46px; height: 46px; }
.modal h2 { margin: 0; font-size: 24px; font-weight: 700; }
.modal p { margin: 0 0 8px; color: var(--ink-2); font-size: 15px; line-height: 1.45; }
.toast { position: absolute; left: 14px; right: 14px; bottom: 98px; z-index: 30; background: var(--toast-bg); color: var(--toast-fg); border-radius: 16px; padding: 13px 15px; font-size: 14.5px; display: flex; gap: 10px; align-items: center; line-height: 1.35; box-shadow: 0 10px 30px -10px rgba(0,0,0,.35); }
.toast svg { width: 20px; height: 20px; color: var(--brand-2); }
@media (prefers-reduced-motion: no-preference) {
  .sheet:not([hidden]) { animation: up .26s cubic-bezier(.2,.8,.2,1); }
  .modal:not([hidden]) { animation: pop .22s ease-out; }
  .toast:not([hidden]) { animation: fade .2s ease-out; }
  .overlay:not([hidden]) { animation: fadein .2s; }
  @keyframes up { from { transform: translateY(60px); opacity: .4; } to { transform: none; opacity: 1; } }
  @keyframes pop { from { transform: translateY(-50%) scale(.92); opacity: 0; } to { transform: translateY(-50%) scale(1); opacity: 1; } }
  @keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
  @keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
