/* AfricanSpring staff app — "Ice & cold light", calm working form. */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --night: #071a2c;
  --night-2: #0b2740;
  --ink: #0c2033;
  --ink-soft: #4a6880;
  --ink-faint: #6d8599;
  --on-night: #e9f3fb;
  --on-night-soft: #a8c6de;
  --bg: #f4f9fd;
  --surface: #ffffff;
  --ice-100: #e7f1f9;
  --ice-200: #d4e6f3;
  --line: #d8e6f1;
  --action: #0a6aa3;
  --action-hover: #073f68;
  --glacier: #35c6f4;
  --ok: #157a4b;     --ok-bg: #e3f4ec;
  --warn: #8a5a00;   --warn-bg: #fdf1d8;
  --bad: #b3261e;    --bad-bg: #fbe7e5;
  --info: #0a6aa3;   --info-bg: #e2f0fa;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(7,26,44,.06), 0 4px 14px rgba(7,26,44,.05);
  --display: "Clash Display", system-ui, sans-serif;
  --sans: "Satoshi", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --tabbar-h: 64px;
  --appbar-h: 56px;
}

html { -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }

body {
  font-family: var(--sans); font-size: 16px; line-height: 1.5; color: var(--ink);
  background: var(--bg); -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100dvh;
}
a { color: var(--action); text-decoration: none; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--glacier); color: var(--night); }
:focus-visible { outline: 2.5px solid var(--action); outline-offset: 2px; border-radius: 6px; }
input, textarea, select { caret-color: var(--action); }
* { scrollbar-color: #a9c4d8 transparent; }
.num { font-variant-numeric: tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- App bar ---------- */
.appbar {
  position: sticky; top: 0; z-index: 40; height: var(--appbar-h);
  display: flex; align-items: center; gap: .75rem; padding: 0 16px;
  padding-top: env(safe-area-inset-top); height: calc(var(--appbar-h) + env(safe-area-inset-top));
  background: var(--night); color: var(--on-night);
}
.brand { display: inline-flex; align-items: center; gap: .55rem; color: #fff; }
.brand svg { width: 30px; height: 30px; flex-shrink: 0; }
.brand b { font-family: var(--display); font-weight: 600; font-size: 1.12rem; letter-spacing: -.02em; }
.brand b span { color: var(--glacier); }
.appbar .back { display: inline-flex; align-items: center; gap: .3rem; color: var(--on-night); font-weight: 500; padding: .4rem .2rem; }
.appbar .back svg { width: 20px; height: 20px; }
.appbar .spacer { flex: 1; }
.iconbtn {
  position: relative; display: inline-grid; place-items: center; width: 40px; height: 40px;
  border-radius: 12px; color: var(--on-night); background: transparent; border: 0; cursor: pointer;
}
.iconbtn:hover { background: rgba(255,255,255,.08); }
.iconbtn svg { width: 22px; height: 22px; }
.iconbtn .dot {
  position: absolute; top: 6px; right: 6px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 999px; background: var(--glacier); color: var(--night); font-size: 11px; font-weight: 700;
  display: grid; place-items: center; line-height: 1;
}
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: var(--night-2); color: var(--glacier); font-weight: 700; font-size: .9rem;
  border: 1px solid rgba(255,255,255,.14);
}

/* ---------- Layout ---------- */
.shell { display: flex; }
.main { flex: 1; min-width: 0; padding: 20px 16px calc(var(--tabbar-h) + 28px + env(safe-area-inset-bottom)); max-width: 880px; margin: 0 auto; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 18px; }
.page-title { font-family: var(--display); font-weight: 600; font-size: 1.75rem; letter-spacing: -.025em; line-height: 1.1; }
.page-sub { color: var(--ink-soft); margin-top: .25rem; font-size: .95rem; }
.section { margin-top: 26px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.section-head h2 { font-size: 1.02rem; font-weight: 700; }
.section-head a { font-size: .92rem; font-weight: 600; }

/* ---------- Tab bar (phone) / rail (desktop) ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: rgba(255,255,255,.96); backdrop-filter: blur(10px); border-top: 1px solid var(--line);
}
.tabbar a {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--ink-faint); font-size: .72rem; font-weight: 600;
}
.tabbar a svg { width: 23px; height: 23px; }
.tabbar a.on { color: var(--action); }
.tabbar a.on::before { content: ''; position: absolute; top: 0; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--action); }
.tabbar .badge-dot { position: absolute; top: 8px; left: calc(50% + 6px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--action); color: #fff; font-size: 10px; display: grid; place-items: center; }

@media (min-width: 900px) {
  .tabbar {
    position: sticky; top: var(--appbar-h); height: calc(100dvh - var(--appbar-h)); width: 220px;
    display: flex; flex-direction: column; gap: 2px; padding: 16px 10px; border-top: 0; border-right: 1px solid var(--line);
    background: var(--surface);
  }
  .tabbar a { flex-direction: row; justify-content: flex-start; gap: 12px; padding: 10px 12px; border-radius: 10px; font-size: .95rem; }
  .tabbar a.on { background: var(--info-bg); }
  .tabbar a.on::before { display: none; }
  .tabbar .badge-dot { position: static; margin-left: auto; }
  .main { padding: 28px 32px 48px; }
}

/* ---------- Cards, stats, lists ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 640px) { .stats.four { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat .k { font-size: .82rem; color: var(--ink-soft); font-weight: 500; }
.stat .v { font-family: var(--display); font-weight: 600; font-size: 1.55rem; letter-spacing: -.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .s { font-size: .8rem; color: var(--ink-faint); margin-top: 2px; }
.stat.hero { background: var(--night); border-color: var(--night); color: var(--on-night); }
.stat.hero .k, .stat.hero .s { color: var(--on-night-soft); }
.stat.hero .v { color: #fff; }
.spark { display: block; width: 100%; height: 34px; margin-top: 8px; }

.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.row {
  display: flex; align-items: center; gap: 12px; padding: 13px 16px; min-height: 60px; color: var(--ink);
  border-top: 1px solid var(--line);
}
.row:first-child { border-top: 0; }
a.row { transition: background .15s var(--ease); }
a.row:hover { background: #f9fcfe; }
a.row:active { background: var(--ice-100); }
.row .lead { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--ice-100); color: var(--action); flex-shrink: 0; font-weight: 700; }
.row .lead svg { width: 20px; height: 20px; }
.row .lead img { width: 40px; height: 40px; border-radius: 12px; object-fit: cover; }
.row .body { flex: 1; min-width: 0; }
.row .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .sub { font-size: .86rem; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .end { text-align: right; flex-shrink: 0; }
.row .end .amt { font-weight: 700; font-variant-numeric: tabular-nums; }
.row .end .meta { font-size: .8rem; color: var(--ink-faint); }
.row .chev { color: #a9c0d2; width: 18px; height: 18px; flex-shrink: 0; }
.amt.pos { color: var(--ok); }
.amt.neg { color: var(--bad); }

.empty { text-align: center; padding: 34px 20px; color: var(--ink-soft); background: var(--surface); border: 1px dashed var(--ice-200); border-radius: var(--radius); }
.empty svg { width: 34px; height: 34px; color: #9fbcd2; margin: 0 auto 10px; }
.empty b { display: block; color: var(--ink); margin-bottom: 2px; }

.day { font-size: .8rem; font-weight: 700; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .06em; margin: 20px 4px 8px; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: .74rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; background: var(--ice-100); color: var(--ink-soft); }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.mono { font-variant-numeric: tabular-nums; letter-spacing: .02em; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  min-height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid transparent;
  font-weight: 600; font-size: .96rem; cursor: pointer; white-space: nowrap;
  transition: background .15s var(--ease), transform .12s var(--ease), border-color .15s var(--ease);
}
.btn:active { transform: scale(.98); }
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--action); color: #fff; }
.btn-primary:hover { background: var(--action-hover); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--action); color: var(--action); }
.btn-danger { background: var(--surface); color: var(--bad); border-color: #f0c9c5; }
.btn-danger:hover { background: var(--bad-bg); }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: .88rem; border-radius: 10px; }
.btn-block { width: 100%; }
.btn-link { background: none; border: 0; color: var(--action); font-weight: 600; cursor: pointer; padding: 0; min-height: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.add { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; font-size: .92rem; color: var(--action); }
.add svg { width: 17px; height: 17px; }
.fab-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }

/* ---------- Forms ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-size: .86rem; font-weight: 600; color: var(--ink); }
.field .hint { font-size: .8rem; color: var(--ink-faint); }
.input, .field input:not([type=checkbox]):not([type=radio]):not([type=file]), .field select, .field textarea {
  width: 100%; min-height: 48px; padding: 11px 14px; border-radius: 12px;
  border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); font-size: 16px; /* 16px stops iOS zoom */
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.field textarea { min-height: 96px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { outline: none; border-color: var(--action); box-shadow: 0 0 0 4px rgba(10,106,163,.12); }
.field input::placeholder, .field textarea::placeholder { color: #6f879b; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.check input { width: 20px; height: 20px; accent-color: var(--action); }
.seg { display: flex; background: var(--ice-100); border-radius: 12px; padding: 4px; gap: 4px; }
.seg label { flex: 1; text-align: center; padding: 9px 6px; border-radius: 9px; font-weight: 600; font-size: .9rem; color: var(--ink-soft); cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg input:checked + span { color: var(--action); }
.seg label:has(input:checked) { background: var(--surface); color: var(--action); box-shadow: var(--shadow); }
.error { background: var(--bad-bg); color: var(--bad); border-radius: 12px; padding: 11px 14px; font-weight: 500; font-size: .92rem; }
.notice { background: var(--info-bg); color: var(--ink); border-radius: 12px; padding: 12px 14px; font-size: .92rem; }
.line-items .li { display: grid; grid-template-columns: 1fr 120px; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); }
.line-items .li:first-child { border-top: 0; }
.line-items .li .p { font-weight: 600; }
.line-items .li .pp { font-size: .82rem; color: var(--ink-soft); }
.total-bar { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; background: var(--ice-100); font-weight: 700; }
.qty { display: flex; align-items: center; border: 1.5px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); }
.qty button { width: 40px; height: 44px; border: 0; background: transparent; font-size: 1.2rem; color: var(--action); cursor: pointer; }
.qty input { width: 100%; min-width: 0; text-align: center; border: 0 !important; min-height: 44px !important; padding: 0 !important; box-shadow: none !important; font-weight: 700; }

/* ---------- Order cards ---------- */
.order { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.order + .order { margin-top: 10px; }
.order .top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.order .who { font-weight: 700; margin-right: auto; }
.order .lines { margin: 10px 0 0; padding: 10px 0 0; border-top: 1px solid var(--line); font-size: .92rem; color: var(--ink-soft); }
.order .lines div { display: flex; justify-content: space-between; gap: 10px; }
.order .lines .tot { color: var(--ink); font-weight: 700; margin-top: 4px; }
.order .note { margin-top: 8px; font-size: .9rem; color: var(--ink-soft); white-space: pre-wrap; }
.order .trail { margin-top: 8px; font-size: .84rem; color: var(--ok); font-weight: 600; }
.order .actions { margin-top: 12px; }
.steps { display: flex; gap: 4px; margin-top: 10px; }
.steps i { flex: 1; height: 4px; border-radius: 4px; background: var(--ice-200); }
.steps i.done { background: var(--action); }

/* ---------- Login / PIN ---------- */
.auth { min-height: 100dvh; display: flex; flex-direction: column; background: var(--night); color: var(--on-night); }
.auth-top { padding: calc(28px + env(safe-area-inset-top)) 24px 8px; }
.auth-body { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 16px 24px 32px; max-width: 420px; width: 100%; margin: 0 auto; }
.auth h1 { font-family: var(--display); font-weight: 600; font-size: 2rem; letter-spacing: -.025em; color: #fff; line-height: 1.1; }
.auth p { color: var(--on-night-soft); margin-top: 6px; }
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-top: 26px; }
.person { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 18px 10px; border-radius: 16px; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.1); color: #fff; font-weight: 600; cursor: pointer; transition: background .15s var(--ease), transform .12s var(--ease); }
.person:hover { background: rgba(255,255,255,.09); }
.person:active { transform: scale(.97); }
.person .av { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: var(--night-2); color: var(--glacier); font-size: 1.25rem; font-weight: 700; border: 1px solid rgba(255,255,255,.16); }
.pin-dots { display: flex; justify-content: center; gap: 14px; margin: 26px 0 22px; }
.pin-dots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--on-night-soft); transition: background .12s, border-color .12s, transform .12s; }
.pin-dots i.on { background: var(--glacier); border-color: var(--glacier); transform: scale(1.1); }
.pin-dots.shake { animation: shake .36s; }
@keyframes shake { 20%,60% { transform: translateX(-8px); } 40%,80% { transform: translateX(8px); } }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.keypad button { height: 64px; border-radius: 16px; border: 0; background: rgba(255,255,255,.07); color: #fff; font-size: 1.5rem; font-weight: 600; cursor: pointer; font-variant-numeric: tabular-nums; transition: background .12s; }
.keypad button:active { background: rgba(255,255,255,.16); }
.keypad button.ghost { background: transparent; font-size: 1rem; color: var(--on-night-soft); }
.auth .error { background: rgba(179,38,30,.18); color: #ffd9d5; text-align: center; }
.auth .field > label { color: var(--on-night); }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 18px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60; background: var(--night); color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 600; font-size: .92rem; box-shadow: 0 10px 30px rgba(7,26,44,.25); animation: toastIn .35s var(--ease), toastOut .3s var(--ease) 3.2s forwards; max-width: calc(100% - 32px); }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px); } }
@keyframes toastOut { to { opacity: 0; transform: translate(-50%, 10px); } }
@media (min-width: 900px) { .toast { bottom: 28px; } }

/* ---------- Misc ---------- */
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: .94rem; }
.kv dt { color: var(--ink-soft); }
.kv dd { text-align: right; font-weight: 600; }
.balance { display: flex; justify-content: space-between; align-items: flex-end; }
.balance .v { font-family: var(--display); font-size: 2rem; font-weight: 600; letter-spacing: -.02em; }
.photo-box { display: flex; align-items: center; gap: 14px; }
.photo-box img, .photo-box .ph { width: 84px; height: 84px; border-radius: 14px; object-fit: cover; background: var(--ice-100); display: grid; place-items: center; color: var(--action); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.switch { position: relative; width: 50px; height: 30px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--ice-200); transition: background .2s var(--ease); cursor: pointer; }
.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,.2); transition: transform .2s var(--ease); }
.switch input:checked + span { background: var(--action); }
.switch input:checked + span::after { transform: translateX(20px); }
.reveal-box { background: var(--night); color: var(--on-night); border-radius: var(--radius); padding: 16px; }
.reveal-box code { display: block; font-size: 1.6rem; font-weight: 700; letter-spacing: .08em; color: #fff; margin: 6px 0 10px; font-family: ui-monospace, Menlo, Consolas, monospace; }

.fade-in { animation: fadeIn .25s var(--ease); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
