/* Happy Bites: shared styles. Same design family as Hisab-Kitab / Job-manage / Salary-manage / Uber-manage
   (cards, round + in the bottom bar, sheets, number pad), coloured like the Happy Bites menu: chocolate, berry, pink. */
:root {
  --p: #A3123A; --p-soft: #FDE7EE; --p-deep: #7A0C2B; --lav: #F7B9CB;
  --ink: #2B1216; --ink2: #4A2A30; --muted: #8E7A7E; --faint: #C4B3B7;
  --line: rgba(60, 15, 25, .09); --line-soft: rgba(60, 15, 25, .05);
  --surface: #F8F3F4; --card: #FFFFFF; --field: #F8F3F4;
  --inc: #15803D; --inc-soft: #DCFCE7; --danger: #E11D48; --danger-soft: #FFE4E9; --warn: #D97706; --warn-soft: #FEF3C7;
  --upi: #5B3FD0; --upi-soft: #EDE9FE; --cash: #15803D; --cash-soft: #DCFCE7;
  --choc: #3B1A12; --fab: #3B1A12;
  --shadow: 0 8px 24px rgba(70, 20, 30, .07), 0 1px 2px rgba(70, 20, 30, .05);
  --shadow-pop: 0 16px 40px rgba(70, 20, 30, .2);
  --r: 24px; --r-field: 16px;
  --font: "Plus Jakarta Sans", -apple-system, system-ui, "Roboto", sans-serif;
  --brand: "Anek Latin", "Plus Jakarta Sans", system-ui, sans-serif;
  --tabs-bottom: max(10px, calc(env(safe-area-inset-bottom) - 14px));
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; touch-action: manipulation; overscroll-behavior: none; background: #fff; }
body {
  font-family: var(--font); color: var(--ink); min-height: 100dvh; -webkit-font-smoothing: antialiased;
  background: #fff linear-gradient(180deg, #F9C3D2 0%, #FCDCE5 35%, rgba(255, 241, 245, .6) 70%, rgba(255, 255, 255, 0) 100%) no-repeat top / 100% 300px;
  -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
input, textarea, select { -webkit-user-select: text; user-select: text; }
body.sheet-open { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
img { display: block; -webkit-user-drag: none; }
button { touch-action: manipulation; cursor: pointer; }
svg { display: block; flex: none; }
@media (display-mode: standalone) { html { min-height: min(100lvh, calc(100% + env(safe-area-inset-top))); } }

.app { max-width: 480px; margin: 0 auto; min-height: 100dvh; padding-bottom: calc(110px + var(--tabs-bottom)); }
.page { padding: calc(12px + env(safe-area-inset-top)) 18px 0; display: flex; flex-direction: column; gap: 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

body::before {
  content: ""; position: fixed; left: 0; right: 0; top: 0; z-index: 30; pointer-events: none; height: env(safe-area-inset-top, 0px);
  background: linear-gradient(180deg, rgba(255, 255, 255, .82), rgba(255, 255, 255, 0));
  -webkit-backdrop-filter: blur(20px) saturate(1.8); backdrop-filter: blur(20px) saturate(1.8); opacity: 0; transition: opacity .2s;
}
html.scrolled body::before { opacity: 1; }

/* ---------- headers ---------- */
.topbar { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.topbar h1 { flex: 1; text-align: center; font-size: 18px; font-weight: 800; letter-spacing: -.3px; }
.page-title { font-size: 26px; font-weight: 800; letter-spacing: -.6px; flex: 1; }
.brand { display: flex; flex-direction: column; line-height: .9; color: var(--p-deep); text-decoration: none; }
.brand b { font-family: var(--brand); font-stretch: 75%; font-weight: 800; font-size: 26px; letter-spacing: .5px; }
.brand span { font-family: var(--brand); font-stretch: 75%; font-weight: 700; font-size: 13px; letter-spacing: 5px; color: var(--ink2); }
.icon-btn {
  width: 40px; height: 40px; flex: none; border: 0; border-radius: 50%; background: #fff; color: var(--ink);
  display: grid; place-items: center; text-decoration: none; box-shadow: var(--shadow); transition: transform .12s;
}
.icon-btn:active { transform: scale(.92); }
.icon-btn:focus-visible, .btn:focus-visible, .chip:focus-visible { outline: 3px solid var(--lav); outline-offset: 2px; }
.spacer { width: 40px; flex: none; }
.spinning svg { animation: spin .9s linear infinite; }

/* ---------- cards, sections ---------- */
.card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px; }
.sec { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 4px 2px -6px; }
.sec h2 { font-size: 16px; font-weight: 800; letter-spacing: -.2px; }
.sec a, .sec button { border: 0; background: none; font-size: 13px; font-weight: 700; color: var(--p); text-decoration: none; }
.muted { color: var(--muted); }
.empty { text-align: center; padding: 26px 16px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.empty b { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }
.amt { font-variant-numeric: tabular-nums; white-space: nowrap; }
.amt small { font-size: .62em; font-weight: 700; opacity: .75; }
.in { color: var(--inc); } .neg { color: var(--danger); }

/* hero number */
.hero { text-align: center; padding: 4px 0 0; }
.hero .lbl { font-size: 12px; font-weight: 800; letter-spacing: .8px; color: var(--ink2); text-transform: uppercase; }
.hero .big { font-size: clamp(38px, 11vw, 46px); font-weight: 800; letter-spacing: -1.5px; margin-top: 4px; }
.hero .sub { margin-top: 2px; font-size: 13px; font-weight: 700; color: var(--ink2); }

/* stat tiles */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile { padding: 14px; text-decoration: none; color: inherit; }
.tile .h { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.tile .h i { width: 26px; height: 26px; border-radius: 9px; display: grid; place-items: center; background: var(--p-soft); color: var(--p); }
.tile.cash .h i { background: var(--cash-soft); color: var(--cash); }
.tile.upi .h i { background: var(--upi-soft); color: var(--upi); }
.tile.exp .h i { background: var(--warn-soft); color: var(--warn); }
.tile b { display: block; margin-top: 8px; font-size: 19px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile small { display: block; margin-top: 2px; font-size: 11.5px; color: var(--muted); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- list rows ---------- */
.list { display: flex; flex-direction: column; }
.tx { display: flex; align-items: center; gap: 12px; padding: 11px 0; text-decoration: none; color: inherit; width: 100%; border: 0; background: none; text-align: left; }
.tx + .tx { border-top: 1px solid var(--line-soft); }
.tx .t { flex: 1; min-width: 0; }
.tx .t b { display: block; font-size: 14.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx .t small { display: flex; gap: 6px; align-items: center; margin-top: 3px; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; }
.tx .v { text-align: right; font-size: 15px; font-weight: 800; }
.ico { width: 42px; height: 42px; flex: none; border-radius: 14px; display: grid; place-items: center; background: var(--p-soft); color: var(--p); font-size: 13px; font-weight: 800; }
.ico.cash { background: var(--cash-soft); color: var(--cash); } .ico.upi { background: var(--upi-soft); color: var(--upi); } .ico.exp { background: var(--warn-soft); color: var(--warn); }
.tag { display: inline-block; padding: 1px 7px; border-radius: 6px; font-size: 10.5px; font-weight: 800; background: var(--surface); color: var(--ink2); }
.tag.cash { background: var(--cash-soft); color: var(--cash); } .tag.upi { background: var(--upi-soft); color: var(--upi); } .tag.galla { background: var(--warn-soft); color: #92400E; }
.day-head { display: flex; justify-content: space-between; align-items: baseline; padding: 14px 2px 4px; font-size: 12.5px; font-weight: 800; color: var(--muted); }

/* ---------- chips, switches ---------- */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; margin: 0 -18px; padding: 2px 18px; scrollbar-width: none; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 7px; min-height: 38px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: #fff; font-size: 13.5px; font-weight: 700; color: var(--ink2); }
.chip[aria-pressed="true"] { background: var(--p); border-color: var(--p); color: #fff; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 4px; border-radius: 999px; background: #fff; box-shadow: var(--shadow); }
.seg button { min-height: 40px; border: 0; border-radius: 999px; background: none; font-size: 14.5px; font-weight: 800; color: var(--ink2); padding: 0 8px; white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--p); color: #fff; box-shadow: 0 6px 14px -6px rgba(163, 18, 58, .8); }
.seg.sm button { min-height: 34px; font-size: 13px; }
.seg.flat { box-shadow: none; border: 1px solid var(--line); }

/* ---------- buttons, fields ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 20px; border: 0; border-radius: 999px; font-size: 15.5px; font-weight: 800; text-decoration: none; transition: transform .12s; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--p); color: #fff; box-shadow: 0 10px 22px -10px rgba(163, 18, 58, .9); }
.btn.dark { background: var(--choc); color: #fff; box-shadow: 0 10px 22px -10px rgba(59, 26, 18, .9); }
.btn:disabled { opacity: .5; box-shadow: none; }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn.soft { background: var(--p-soft); color: var(--p-deep); }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn.block { width: 100%; }
.btn.sm { min-height: 38px; padding: 0 14px; font-size: 13px; }
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field > label, .field > .label { font-size: 13px; font-weight: 800; color: var(--ink2); }
.input { width: 100%; min-width: 0; min-height: 50px; padding: 0 14px; border-radius: var(--r-field); border: 1px solid var(--line); background: var(--field); font-size: 16px; font-weight: 600; }
textarea.input { min-height: 80px; padding: 12px 14px; resize: none; }
.input:focus { outline: none; border-color: var(--p); background: #fff; box-shadow: 0 0 0 3px var(--p-soft); }
.hint { font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.form-msg { min-height: 18px; font-size: 13.5px; font-weight: 700; color: var(--danger); }
.form-msg:empty { display: none; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* settings rows */
.rows { background: #fff; border-radius: var(--r); box-shadow: var(--shadow); padding: 0 16px; }
.row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 58px; padding: 10px 0; border: 0; background: none; text-align: left; text-decoration: none; color: inherit; }
.row + .row { border-top: 1px solid var(--line-soft); }
.row .ri { width: 36px; height: 36px; flex: none; border-radius: 11px; display: grid; place-items: center; background: var(--p-soft); color: var(--p); }
.row .rt { flex: 1; min-width: 0; } .row .rt b { display: block; font-size: 14.5px; font-weight: 700; } .row .rt small { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); }
.row .rv { font-size: 13px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.row .chev { color: var(--faint); }
.row.danger .ri { background: var(--danger-soft); color: var(--danger); } .row.danger .rt b { color: var(--danger); }

/* bars */
.bar { height: 8px; border-radius: 8px; background: var(--surface); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 8px; background: var(--p); }

/* ---------- bottom bar with the dark round + ---------- */
body:has(.tabs)::after { content: ""; position: fixed; left: 0; right: 0; bottom: 0; z-index: 19; pointer-events: none; height: calc(60px + var(--tabs-bottom)); background: linear-gradient(180deg, rgba(255, 255, 255, 0), #fff 60%); }
.tabs { position: fixed; z-index: 20; left: 50%; transform: translateX(-50%); bottom: var(--tabs-bottom); width: min(440px, calc(100% - 24px)); height: 68px; background: #fff; border-radius: 30px; box-shadow: 0 12px 34px rgba(70, 20, 30, .15), 0 0 0 1px var(--line-soft); }
.tabs ul { list-style: none; height: 100%; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: center; }
.tabs li { display: flex; justify-content: center; min-width: 0; }
.tabs a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 2px; color: var(--muted); text-decoration: none; font-size: 10.5px; font-weight: 700; white-space: nowrap; }
.tabs a[aria-current="page"] { color: var(--p); }
.add { width: 60px; height: 60px; margin-top: -34px; border: 4px solid #fff; border-radius: 50%; display: grid; place-items: center; color: #fff; background: var(--fab); text-decoration: none;
  box-shadow: 0 12px 28px rgba(59, 26, 18, .35), 0 4px 10px rgba(59, 26, 18, .2); transition: transform .15s; }
.add:active { transform: scale(.92); }

/* ---------- bottom sheets ---------- */
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(43, 18, 22, .42); opacity: 0; pointer-events: none; transition: opacity .25s; }
.scrim.open { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; z-index: 41; left: 50%; width: min(480px, 100%); bottom: 0;
  max-height: calc(min(92dvh, var(--vvh, 100dvh)) - 12px - env(safe-area-inset-top)); overflow-y: auto; overscroll-behavior: contain;
  transform: translate(-50%, 105%); transition: transform .3s cubic-bezier(.2, .8, .2, 1);
  background: #fff; border-radius: 28px 28px 0 0; padding: 10px 18px calc(20px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 14px; visibility: hidden;
}
.sheet.open { transform: translate(-50%, 0); bottom: var(--kb, 0px); visibility: visible; }
.grab { width: 40px; height: 5px; border-radius: 9px; background: #E6DADD; align-self: center; flex: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sheet-head h2 { font-size: 19px; font-weight: 800; }
.close { width: 36px; height: 36px; border: 0; border-radius: 50%; background: var(--surface); display: grid; place-items: center; flex: none; }

/* number pad */
.keypad { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.keypad button { height: clamp(44px, 6.4dvh, 56px); border: 0; border-radius: 16px; background: var(--surface); font-size: 24px; font-weight: 700; display: grid; place-items: center; transition: background .1s, transform .1s; }
.keypad button:active { background: var(--p-soft); transform: scale(.96); }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(96px + var(--tabs-bottom)); transform: translate(-50%, 16px); z-index: 60;
  display: flex; align-items: center; gap: 10px; padding: 8px 18px 8px 8px; border-radius: 24px; background: var(--ink); color: #fff;
  font-size: 14.5px; font-weight: 700; box-shadow: var(--shadow-pop); opacity: 0; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); transition: opacity .25s, transform .25s;
}
.toast-ic { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--inc); color: #fff; flex: none; }
.toast.warn { background: var(--danger); padding-left: 18px; } .toast.warn .toast-ic { display: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
body:not(:has(.tabs)) .toast { bottom: calc(30px + env(safe-area-inset-bottom)); }
body.has-cart .toast { bottom: calc(150px + env(safe-area-inset-bottom)); }

/* ---------- switch ---------- */
.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: #E6DADD; transition: background .2s; pointer-events: none; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s; }
.switch input:checked + span { background: var(--p); } .switch input:checked + span::after { transform: translateX(20px); }

/* offline / waiting banner */
.banner { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 16px; background: var(--warn-soft); color: #92400E; font-size: 13px; font-weight: 700; }
.banner.err { background: var(--danger-soft); color: #9F1239; }
.banner .grow { flex: 1; }
.banner button { border: 0; background: #fff; border-radius: 999px; padding: 6px 12px; font-size: 12.5px; font-weight: 800; color: inherit; }

/* full-screen loader */
.loader { display: grid; place-items: center; padding: 60px 0; }
.loader i { width: 34px; height: 34px; border-radius: 50%; border: 4px solid rgba(0, 0, 0, .08); border-top-color: var(--p); animation: spin .9s linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .sheet, .scrim, .toast, .switch span, .switch span::after { transition: none; } }
