/* Kaalinta — attendant app
   Built for one hand at the pump: big targets (>= 52px), big numbers, one job per screen.
   Same family as the owner dashboard: warm ground, ink, Poppins.
   Colour = meaning: blue paid, orange deyn, aqua repayment, green sent, amber waiting, red needs attention. */

:root {
  --bg: #f2f1ee;
  --card: #ffffff;
  --card-2: #f7f6f3;
  --ink: #232728;
  --ink-2: #55565c;
  --ink-3: #6b6b72;
  --line: #e8e7e2;
  --line-2: #f0efeb;
  --paid: #2a78d6; --paid-bg: #e8f0fb; --paid-ink: #1c5cab;
  --deyn: #eb6834; --deyn-bg: #fdede5; --deyn-ink: #b23f12;
  --repay: #1baf7a; --repay-bg: #e2f5ed; --repay-ink: #0e6e4c;
  --partly-bg: #f8efe3; --partly-ink: #7a4a12;
  --good: #1b7348; --good-bg: #e5f2ea;
  --wait: #8a5a00; --wait-bg: #fbf0d9;
  --bad: #b4372b; --bad-bg: #fbe9e6;
  --sans: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --r: 22px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--sans); font-size: 15px; line-height: 1.45; color: var(--ink); background: #e7e6e1; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2.5px solid #23272880; outline-offset: 2px; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
.lbl { font-size: 11.5px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }

#app { max-width: 480px; min-height: 100dvh; margin: 0 auto; background: var(--bg); display: flex; flex-direction: column; position: relative; }
@media (min-width: 520px) { #app { box-shadow: 0 0 0 1px #0000000d, 0 30px 80px -40px #00000040; } }

/* ---------- sign in ---------- */
.signin { flex: 1; display: flex; flex-direction: column; padding: calc(40px + var(--safe-t)) 22px calc(24px + var(--safe-b)); gap: 26px; }
.logo { display: flex; align-items: center; gap: 12px; }
.logo svg { width: 48px; height: 48px; }
.logo b { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; display: block; line-height: 1.1; }
.logo span { font-size: 13px; color: var(--ink-3); }
.signin h1 { margin: 0; font-size: 30px; font-weight: 400; letter-spacing: -0.03em; line-height: 1.15; }
.signin p { margin: 6px 0 0; color: var(--ink-2); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.input { height: 56px; border: 0; border-radius: 16px; background: var(--card); padding: 0 16px; font-size: 16px; width: 100%; box-shadow: inset 0 0 0 1px var(--line); }
.input:focus { outline: none; box-shadow: inset 0 0 0 2px var(--ink); }
.err { font-size: 14px; color: var(--bad); background: var(--bad-bg); padding: 12px 14px; border-radius: 14px; }
.sample-box { background: var(--card); border: 1px dashed #cdc9bf; border-radius: 18px; padding: 14px; display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: var(--ink-2); }
.sample-box b { color: var(--ink); font-weight: 600; font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; }
.sample-acct { all: unset; cursor: pointer; display: flex; justify-content: space-between; gap: 8px; padding: 10px 12px; border-radius: 12px; background: var(--card-2); font-size: 13px; }
.sample-acct:hover, .sample-acct:focus-visible { box-shadow: inset 0 0 0 1.5px var(--ink); }
.sample-acct span:last-child { color: var(--ink-3); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 56px; padding: 0 22px; border-radius: 99px; border: 0; background: var(--card); box-shadow: inset 0 0 0 1px var(--line); font-weight: 500; font-size: 16px; white-space: nowrap; color: var(--ink); text-decoration: none; }
.btn.primary { background: var(--ink); color: #fff; box-shadow: none; }
.btn.primary:disabled { background: #bdbcb7; color: #f4f4f2; cursor: default; }
.btn.block { width: 100%; }
.btn.small { height: 40px; font-size: 14px; padding: 0 16px; }
.btn.danger { color: var(--bad); }
.icon-btn { all: unset; cursor: pointer; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--card); flex: none; }
.icon-btn:focus-visible { outline: 2.5px solid #23272880; }

/* ---------- top bar ---------- */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; padding: calc(12px + var(--safe-t)) 16px 12px; background: var(--bg); }
.avatar { all: unset; cursor: pointer; width: 44px; height: 44px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 14px; flex: none; }
.where { flex: 1; min-width: 0; }
.where b { display: block; font-weight: 600; font-size: 15.5px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.where span { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; }
.sync { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 12px 0 10px; border-radius: 99px; font-size: 12.5px; font-weight: 600; flex: none; }
.sync i { width: 9px; height: 9px; border-radius: 50%; background: currentColor; flex: none; }
.sync.ok { background: var(--good-bg); color: var(--good); }
.sync.wait { background: var(--wait-bg); color: var(--wait); }
.sync.off { background: #e6e5e0; color: var(--ink-2); }
.sync.off i { background: transparent; border: 2px solid currentColor; box-sizing: border-box; }
.sync.bad { background: var(--bad-bg); color: var(--bad); }
.sync.busy i { animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: 0.25; } }

/* ---------- home ---------- */
.home { flex: 1; display: flex; flex-direction: column; gap: 14px; padding: 4px 16px calc(28px + var(--safe-b)); }
.hello { font-size: 22px; font-weight: 400; letter-spacing: -0.025em; margin: 4px 2px 2px; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.action { all: unset; box-sizing: border-box; cursor: pointer; min-height: 132px; border-radius: var(--r); padding: 18px; display: flex; flex-direction: column; justify-content: space-between; gap: 14px; background: var(--card); }
.action.main { background: var(--ink); color: #fff; }
.action .ic { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: var(--line-2); }
.action.main .ic { background: var(--deyn); }
.action b { font-size: 18px; font-weight: 500; letter-spacing: -0.01em; display: block; }
.action small { font-size: 12.5px; opacity: 0.7; }
.action:focus-visible { outline: 3px solid #23272880; outline-offset: 2px; }
.banner { all: unset; box-sizing: border-box; cursor: pointer; display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-radius: 18px; font-size: 14px; }
.banner.bad { background: var(--bad-bg); color: var(--bad); }
.banner.wait { background: var(--wait-bg); color: var(--wait); }
.banner b { font-weight: 600; }
.banner .go { margin-left: auto; font-weight: 600; }
.card { background: var(--card); border-radius: var(--r); }
.shift { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.shift .top-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.big { font-size: 44px; font-weight: 300; letter-spacing: -0.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.big .c { font-size: 0.5em; color: var(--ink-3); letter-spacing: -0.01em; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.split div { background: var(--card-2); border-radius: 14px; padding: 10px 12px; display: flex; flex-direction: column; }
.split span { font-size: 12.5px; color: var(--ink-3); }
.split b { font-size: 18px; font-weight: 500; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line-2); padding-top: 12px; }
.stats div { display: flex; flex-direction: column; gap: 1px; }
.stats div + div { padding-left: 12px; border-left: 1px solid var(--line-2); }
.stats b { font-size: 17px; font-weight: 500; font-variant-numeric: tabular-nums; }
.stats span { font-size: 12px; color: var(--ink-3); }
.stats .owe b { color: var(--deyn-ink); }
.list-head { display: flex; justify-content: space-between; align-items: baseline; padding: 6px 4px 0; }
.list-head h2 { margin: 0; font-size: 16px; font-weight: 500; }
.rows { list-style: none; margin: 0; padding: 4px 0; }
.rows li + li { border-top: 1px solid var(--line-2); }
.row { all: unset; box-sizing: border-box; cursor: pointer; width: 100%; display: grid; grid-template-columns: 40px 1fr auto; gap: 2px 12px; align-items: center; padding: 12px 16px; min-height: 64px; }
.row .ri { grid-row: 1 / 3; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--line-2); }
.row .t { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .s { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .a { text-align: right; font-weight: 500; font-variant-numeric: tabular-nums; }
.row .st { text-align: right; display: flex; gap: 6px; align-items: center; justify-content: flex-end; }
.empty { padding: 26px 16px; text-align: center; color: var(--ink-3); font-size: 14px; }

.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px 2px 7px; border-radius: 99px; font-size: 11.5px; font-weight: 500; white-space: nowrap; }
.pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; box-sizing: border-box; flex: none; }
.pill.paid { color: var(--paid-ink); background: var(--paid-bg); }
.pill.paid::before { background: var(--paid); }
.pill.partly { color: var(--partly-ink); background: var(--partly-bg); }
.pill.partly::before { background: linear-gradient(90deg, var(--paid) 50%, var(--deyn) 50%); }
.pill.deyn { color: var(--deyn-ink); background: var(--deyn-bg); }
.pill.deyn::before { border: 2px solid var(--deyn); }
.pill.repayment { color: var(--repay-ink); background: var(--repay-bg); }
.pill.repayment::before { background: var(--repay); }
.mark { width: 18px; height: 18px; display: inline-grid; place-items: center; }

/* ---------- flow screens (sale, repayment) ---------- */
.flow { flex: 1; display: flex; flex-direction: column; }
.flow-top { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: calc(10px + var(--safe-t)) 16px 10px; display: flex; flex-direction: column; gap: 10px; }
.flow-top .bar { display: flex; align-items: center; gap: 12px; }
.flow-top h1 { margin: 0; font-size: 18px; font-weight: 500; flex: 1; }
.flow-top .stepno { font-size: 13px; color: var(--ink-3); }
.progress { display: grid; gap: 4px; }
.progress i { height: 4px; border-radius: 99px; background: #dcdad4; }
.progress i.on { background: var(--ink); }
.flow-body { flex: 1; padding: 6px 16px 24px; display: flex; flex-direction: column; gap: 18px; }
.q { margin: 4px 2px 0; font-size: 24px; font-weight: 400; letter-spacing: -0.025em; line-height: 1.2; }
.sub-q { margin: 0 2px; font-size: 13.5px; color: var(--ink-2); }
.choices { display: grid; gap: 10px; }
.choices.two { grid-template-columns: 1fr 1fr; }
.choice { all: unset; box-sizing: border-box; cursor: pointer; background: var(--card); border-radius: 18px; padding: 16px; min-height: 64px; display: flex; flex-direction: column; gap: 2px; box-shadow: inset 0 0 0 1.5px transparent; position: relative; }
.choice b { font-size: 17px; font-weight: 500; }
.choice span { font-size: 13px; color: var(--ink-3); }
.choice[aria-pressed="true"] { box-shadow: inset 0 0 0 2.5px var(--ink); }
.choice[aria-pressed="true"]::after { content: ''; position: absolute; top: 14px; right: 14px; width: 22px; height: 22px; border-radius: 50%; background: var(--ink) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4 8-9'/%3E%3C/svg%3E") center / 14px no-repeat; }
.choice:disabled, .choice[aria-disabled="true"] { opacity: 0.45; cursor: default; }
.choice:focus-visible { outline: 2.5px solid #23272880; }
.choice.fuel { min-height: 92px; justify-content: flex-end; }
.choice.fuel b { font-size: 20px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: #e6e5e0; border-radius: 99px; padding: 4px; }
.seg button { border: 0; background: transparent; height: 46px; border-radius: 99px; font-weight: 500; font-size: 15px; color: var(--ink-2); }
.seg button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px #0000001a; }
.amount { display: flex; align-items: center; gap: 6px; background: var(--card); border-radius: 20px; padding: 0 20px; height: 84px; box-shadow: inset 0 0 0 1px var(--line); }
.amount:focus-within { box-shadow: inset 0 0 0 2.5px var(--ink); }
.amount span { font-size: 30px; color: var(--ink-3); font-weight: 300; }
.amount input { flex: 1; min-width: 0; border: 0; background: transparent; font-size: 42px; font-weight: 400; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; outline: none; padding: 0; }
.amount input::placeholder { color: #c8c6c0; }
.quick { display: flex; gap: 8px; flex-wrap: wrap; }
.quick button { flex: 1 0 64px; height: 48px; border: 0; border-radius: 14px; background: var(--card); font-weight: 500; font-size: 15px; box-shadow: inset 0 0 0 1px var(--line); }
.quick button:active { background: var(--line-2); }
.calc { font-size: 15px; color: var(--ink-2); padding: 0 4px; min-height: 22px; }
.calc b { color: var(--ink); font-weight: 600; }
.search { position: relative; }
.search svg { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); }
.search .input { padding-left: 46px; }
.accts { list-style: none; margin: 0; padding: 0; background: var(--card); border-radius: 18px; overflow: hidden; }
.accts li + li { border-top: 1px solid var(--line-2); }
.acct { all: unset; box-sizing: border-box; cursor: pointer; width: 100%; display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 10px 16px; }
.acct .av { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--line-2); font-weight: 600; font-size: 13px; flex: none; }
.acct b { font-weight: 500; display: block; }
.acct span { font-size: 12.5px; color: var(--ink-3); }
.acct:focus-visible { outline: 2.5px solid #23272880; outline-offset: -3px; }
.picked { background: var(--card); border-radius: 18px; padding: 16px; display: flex; flex-direction: column; gap: 14px; box-shadow: inset 0 0 0 2.5px var(--ink); }
.picked .head { display: flex; align-items: center; gap: 12px; }
.picked .head b { font-size: 17px; font-weight: 500; display: block; }
.picked .head span { font-size: 13px; color: var(--ink-3); }
.picked .change { margin-left: auto; }
.plates { display: flex; gap: 8px; flex-wrap: wrap; }
.plates button { height: 40px; padding: 0 14px; border: 0; border-radius: 99px; background: var(--line-2); font-family: var(--mono); font-size: 13px; }
.plates button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.summary { background: var(--card); border-radius: 18px; padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.summary .line { display: flex; justify-content: space-between; gap: 12px; }
.summary .line span:first-child { color: var(--ink-3); }
.summary .line span:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.summary .total { border-top: 1px solid var(--line-2); padding-top: 8px; margin-top: 2px; font-weight: 600; font-size: 16px; }
.summary .total span:first-child { color: var(--ink); }
.note { font-size: 13.5px; padding: 12px 14px; border-radius: 14px; background: var(--card-2); color: var(--ink-2); }
.note.owe { background: var(--deyn-bg); color: var(--deyn-ink); }
.note b { font-weight: 600; }

.bottom { position: sticky; bottom: 0; z-index: 5; background: var(--bg); border-top: 1px solid var(--line); padding: 12px 16px calc(12px + var(--safe-b)); display: flex; align-items: center; gap: 12px; }
.bottom .tot { flex: 1; min-width: 0; }
.bottom .tot span { display: block; font-size: 12px; color: var(--ink-3); }
.bottom .tot b { font-size: 24px; font-weight: 500; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.bottom .tot small { display: block; font-size: 12.5px; color: var(--deyn-ink); font-weight: 500; }
.bottom .btn { min-width: 150px; }

/* ---------- saved ---------- */
.done { flex: 1; display: flex; flex-direction: column; padding: calc(48px + var(--safe-t)) 20px calc(20px + var(--safe-b)); gap: 22px; }
.done .badge { width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; }
.done .badge.ok { background: var(--good-bg); }
.done .badge.wait { background: var(--wait-bg); }
.done h1 { margin: 0; font-size: 30px; font-weight: 400; letter-spacing: -0.03em; }
.done p { margin: 6px 0 0; color: var(--ink-2); font-size: 15px; }
.done .btns { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }

/* ---------- sheets ---------- */
.scrim { position: fixed; inset: 0; background: #23272870; z-index: 30; display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 480px; max-height: 88dvh; overflow-y: auto; background: var(--bg); border-radius: 26px 26px 0 0; padding: 10px 18px calc(20px + var(--safe-b)); display: flex; flex-direction: column; gap: 14px; }
.sheet .grip { width: 40px; height: 5px; border-radius: 99px; background: #cfcdc7; margin: 0 auto 4px; }
.sheet h2 { margin: 0; font-size: 21px; font-weight: 500; letter-spacing: -0.02em; }
.sheet p { margin: 0; color: var(--ink-2); font-size: 14.5px; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--card); border-radius: 16px; padding: 12px 16px; min-height: 60px; }
.switch b { font-weight: 500; display: block; }
.switch span { font-size: 12.5px; color: var(--ink-3); }
.switch input { appearance: none; -webkit-appearance: none; width: 52px; height: 32px; border-radius: 99px; background: #d4d2cc; position: relative; flex: none; cursor: pointer; transition: background 0.15s; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; transition: left 0.15s; box-shadow: 0 1px 3px #00000033; }
.switch input:checked { background: var(--ink); }
.switch input:checked::after { left: 23px; }
.kv { background: var(--card); border-radius: 18px; padding: 4px 16px; }
.kv div { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; font-size: 14px; }
.kv div + div { border-top: 1px solid var(--line-2); }
.kv span:first-child { color: var(--ink-3); }
.kv span:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.menu-who { display: flex; align-items: center; gap: 12px; }
.menu-who .avatar { width: 52px; height: 52px; font-size: 16px; cursor: default; }
.menu-who b { display: block; font-size: 17px; font-weight: 500; }
.menu-who span { font-size: 13px; color: var(--ink-3); }

.toast { position: fixed; left: 50%; bottom: calc(24px + var(--safe-b)); transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 99px; font-size: 14px; transition: 0.2s; z-index: 40; max-width: 90vw; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
