/* ══════════════════════════════════════════════════════════════
   KUDOS — Components
   ══════════════════════════════════════════════════════════════ */

/* ── App shell ─────────────────────────────────────────────── */
/* One child now. The sidebar was the other one — see the launcher at the
   foot of this file for where the navigation went. */
.shell { display: flex; min-height: 100dvh; }


/* Only the sign-in art panel uses this now — the sidebar that used to was
   removed in v4.2. `flex: none` came from a shared rule that went with it;
   .auth-art is a flex column and without it the mark squashes on a short
   viewport. */
.brand {
  position: relative; flex: none;
  display: flex; align-items: center; gap: .6rem;
  padding: 0 .6rem; margin-bottom: 2rem;
}
/* The tile the whole identity hangs off — sidebar, topbar, sign-in, the
   splash in index.html, and the home-screen icons cut by
   icons/make-icons.py. Built by UI.mark().
   It is the logo photograph, not a drawing of it: the mark is folded paper,
   and the fold shadows are what make it read as paper rather than as a
   shape. Rounded here rather than in the pixels so one file serves the
   square icon and the rounded tile alike. */
.brand-mark {
  width: 34px; height: 34px; flex: none;
  border-radius: 10px; overflow: hidden;
  box-shadow: 0 6px 18px -8px rgba(253,104,8,.6);
}
.brand-mark img { width: 100%; height: 100%; display: block; object-fit: cover; }
/* Topbar. Was an inline style on the element, which meant the size lived in
   two files and the SVG could not follow it. */
.brand-mark-sm { width: 30px; height: 30px; border-radius: 9px; }
/* Set to stand as tall as the 34px tile beside it, since the "Retail
   Development" line that used to fill that height is gone. */
.brand-name {
  font-family: var(--font-display);
  font-size: 1.85rem; font-weight: 600;
  letter-spacing: -.03em; line-height: 1;
}
.brand-sub  { font-size: var(--t-micro); letter-spacing: .13em; text-transform: uppercase; color: var(--ink-3); margin-top: 3px; }


/* Secondary wallet: points you RECEIVED, spendable in the rewards shop */
.wallet-mini {
  display: flex; align-items: center; gap: .6rem;
  margin-top: .5rem; padding: .65rem .8rem;
  border: 1px solid var(--rule); border-radius: var(--r-md);
  background: var(--surface);
  transition: border-color .25s var(--ease), transform .25s var(--ease-out), box-shadow .25s;
}
.wallet-mini:hover { border-color: var(--clay); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.wallet-mini .wm-ico {
  width: 32px; height: 32px; flex: none;
  display: grid; place-items: center; border-radius: 10px;
  background: var(--clay-soft); color: var(--clay-deep);
}
:root[data-theme="dark"] .wallet-mini .wm-ico { color: var(--clay); }
/* Explicit size: the icon inherited the caption's 0.69rem font-size and
   rendered at 12px inside a 30px tile, which read as badly aligned. */
.wallet-mini .wm-ico svg { width: 17px; height: 17px; }
.wallet-mini b { display: block; font-size: .85rem; font-weight: 700; line-height: 1.2; }
/* Scoped to the caption — a bare `.wallet-mini span` also hit the icon tile. */
.wallet-mini .wm-sub { display: block; font-size: var(--t-micro); color: var(--ink-3); line-height: 1.3; }
.wallet-mini > svg:last-child { color: var(--ink-4); flex: none; }

/* ── Main column ───────────────────────────────────────────── */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 1rem;
  padding: .85rem clamp(1rem, 3vw, 2.5rem);
  border-bottom: 1px solid var(--rule);
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
}

/* A guard, and inert as things stand. index.html deliberately omits
   viewport-fit=cover, so both iOS and Android keep the app inside the safe
   area and these insets resolve to 0. It is kept because Android has been
   moving towards drawing installed apps edge-to-edge regardless, and if that
   reaches PWAs — or if anyone reinstates viewport-fit=cover — this is what
   stops the header sliding under the status bar again.
   Scoped to display-mode so a browser tab can never pick up stray padding. */
@media (display-mode: standalone) {
  .topbar { padding-top: calc(.85rem + env(safe-area-inset-top, 0px)); }
}

.page { padding: clamp(1.5rem, 3.5vw, 3rem) clamp(1rem, 3vw, 2.5rem) 6rem; max-width: var(--page-max); width: 100%; margin-inline: auto; }
.page-head { margin-bottom: 2rem; }
.page-title { font-size: var(--t-h1); margin-top: .4rem; }
.page-sub { color: var(--ink-3); max-width: 56ch; margin-top: .6rem; }

/* ── Search ────────────────────────────────────────────────── */
.search {
  flex: 1; max-width: 420px;
  display: flex; align-items: center; gap: .55rem;
  padding: .5rem .85rem;
  border: 1px solid var(--rule); border-radius: var(--r-pill);
  background: var(--surface);
  transition: border-color .2s, box-shadow .2s;
}
.search:focus-within { border-color: var(--clay); box-shadow: 0 0 0 3px var(--clay-soft); }
.search input { border: 0; outline: 0; background: none; flex: 1; font-size: .9rem; min-width: 0; }
.search svg { width: 16px; height: 16px; color: var(--ink-4); flex: none; }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .62rem 1.15rem;
  border-radius: var(--r-pill);
  font-size: .875rem; font-weight: 600; letter-spacing: .01em;
  white-space: nowrap;
  border: 1px solid transparent;
  transition: transform .18s var(--ease-back), box-shadow .25s var(--ease), background .2s, color .2s, border-color .2s;
}
.btn svg { width: 16px; height: 16px; }
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .45; pointer-events: none; }

/* A light sweep that crosses the button on hover. */
.btn-primary, .btn-clay { position: relative; overflow: hidden; isolation: isolate; }
.btn-primary::after, .btn-clay::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(100deg, transparent 20%, rgba(255,255,255,.32) 50%, transparent 80%);
  background-size: 220% 100%;
  background-position: -180% 0;
  opacity: 0;
  transition: opacity .2s var(--ease);
}
.btn-primary:hover::after, .btn-clay:hover::after {
  opacity: 1;
  animation: shimmer .9s var(--ease) 1;
}

.btn-primary { background: var(--ink); color: var(--paper); box-shadow: var(--shadow-sm); }
.btn-primary:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.btn-clay {
  background: var(--grad-warm);
  background-size: 160% 160%;
  color: #fff;
  box-shadow: var(--shadow-glow);
  transition: transform .18s var(--ease-back), box-shadow .25s var(--ease), background-position .6s var(--ease);
}
.btn-clay:hover {
  transform: translateY(-2px);
  background-position: 100% 50%;
  box-shadow: 0 14px 36px -10px rgba(191,91,60,.65);
}

/* Birthday gift — deliberately not clay, so it reads as its own occasion */
.btn-birthday {
  background: linear-gradient(140deg, var(--plum), var(--clay) 60%, var(--amber));
  background-size: 160% 160%;
  color: #fff;
  box-shadow: 0 8px 24px -10px rgba(122, 78, 99, .6);
  transition: transform .18s var(--ease-back), box-shadow .25s var(--ease), background-position .6s var(--ease);
}
.btn-birthday:hover:not(:disabled) { transform: translateY(-2px); background-position: 100% 50%; }

.bday-gift-hero {
  display: flex; align-items: center; gap: 1rem;
  padding: 1.1rem 1.2rem;
  border-radius: var(--r-lg);
  background: linear-gradient(135deg, var(--plum-soft), var(--amber-soft));
}
.bday-gift-hero b { display: block; font-size: 1rem; }
.bday-gift-hero span { font-size: var(--t-xs); color: var(--ink-3); }
.bday-gift-amt {
  margin-left: auto; flex: none;
  font-family: var(--font-display); font-weight: 700; font-size: 1.6rem;
  color: var(--clay-deep);
}
:root[data-theme="dark"] .bday-gift-amt { color: var(--clay); }

.btn-ghost { border-color: var(--rule-strong); color: var(--ink-2); background: var(--surface); }
.btn-ghost:hover { border-color: var(--ink); color: var(--ink); }

.btn-quiet { color: var(--ink-3); padding: .5rem .8rem; }
.btn-quiet:hover { color: var(--ink); background: var(--paper-3); }

.btn-sm { padding: .42rem .85rem; font-size: var(--t-xs); }
.btn-lg { padding: .85rem 1.6rem; font-size: .95rem; }
.btn-block { width: 100%; }

.icon-btn {
  width: 38px; height: 38px; flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  color: var(--ink-2);
  transition: background .2s, color .2s, transform .2s var(--ease-back);
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { background: var(--paper-3); color: var(--ink); }
.icon-btn:active { transform: scale(.9); }
.icon-btn.has-dot::after {
  content: ""; position: absolute; margin: -14px 0 0 14px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--clay); border: 1.5px solid var(--paper);
}

/* ── Notifications ─────────────────────────────────────────── */
.notif-btn { position: relative; }
.notif-count {
  position: absolute; top: 2px; right: 0;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 99px;
  background: var(--clay); color: #fff;
  font-size: 9px; font-weight: 800; line-height: 16px;
  text-align: center;
  border: 1.5px solid var(--paper);
}
.notif-count.static { position: static; border: 0; display: inline-block; margin-left: .35rem; }

.notif-panel {
  position: fixed;
  top: var(--nt, 64px); right: var(--nr, 24px);
  width: min(390px, calc(100vw - 2rem));
  max-height: min(560px, 75dvh);
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  z-index: 150;
  overflow: hidden;
  animation: modal-in .28s var(--ease-out) both;
}
.notif-head {
  display: flex; align-items: center; gap: .5rem;
  padding: .9rem 1rem;
  border-bottom: 1px solid var(--rule);
  background: var(--surface-sunk);
}
.notif-head h3 { font-size: 1.05rem; flex: 1; }
.notif-close { display: none; }
.notif-list { overflow-y: auto; overscroll-behavior: contain; }

.notif-item {
  position: relative;
  display: flex; align-items: flex-start; gap: .7rem;
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--rule);
  transition: background .18s var(--ease);
}
.notif-item:last-child { border-bottom: 0; }
.notif-item:hover { background: var(--surface-sunk); }
.notif-item.unread { background: color-mix(in srgb, var(--clay-soft) 55%, transparent); }
.notif-item.unread:hover { background: var(--clay-soft); }
.notif-media { flex: none; }
.notif-body { font-size: .86rem; line-height: 1.45; color: var(--ink-2); min-width: 0; }
.notif-body b { color: var(--ink); font-weight: 600; }
.notif-pts { font-weight: 700; color: var(--clay); }
.notif-time { display: block; font-size: var(--t-micro); color: var(--ink-4); margin-top: .3rem; }
.notif-dot {
  position: absolute; top: 1.1rem; right: .9rem;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--clay); flex: none;
}
.notif-ico {
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--paper-3); color: var(--ink-3);
}
.notif-ico.t-clay  { background: var(--clay-soft);  color: var(--clay-deep); }
.notif-ico.t-amber { background: var(--amber-soft); color: #8A5D12; }
.notif-ico.t-olive { background: var(--olive-soft); color: #4C5A38; }
:root[data-theme="dark"] .notif-ico.t-clay  { color: var(--clay); }
:root[data-theme="dark"] .notif-ico.t-amber { color: var(--amber); }
:root[data-theme="dark"] .notif-ico.t-olive { color: var(--olive); }

/* ── Shell pieces that used to be mobile-only ──────────────────
   The brand and the wallet chips are on every size now: with the sidebar
   gone this bar carries the identity and the only always-visible balance.
   The search link and the FAB stay mobile-only — on desktop there is a real
   search field and a real "Bagi points" button in the same bar. */
.topbar-search-link, .fab { display: none; }

.topbar-brand { display: block; flex: none; }
.wallet-chips { display: flex; align-items: center; gap: .35rem; }
.wchip {
  display: inline-flex; align-items: center; gap: .28rem;
  padding: .3rem .55rem;
  border-radius: var(--r-pill);
  background: var(--paper-3); color: var(--ink-2);
  font-size: var(--t-xs); font-weight: 700;
  white-space: nowrap;
}
.wchip svg { width: 13px; height: 13px; opacity: .75; }
.wchip-clay { background: var(--clay-soft); color: var(--clay-deep); }
:root[data-theme="dark"] .wchip-clay { color: var(--clay); }

.fab {
  position: fixed; right: 1rem; z-index: 61;
  bottom: calc(4.4rem + env(safe-area-inset-bottom));
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--grad-warm);
  color: #fff;
  box-shadow: 0 10px 26px -8px rgba(191,91,60,.65), var(--shadow-md);
  /* No `display` here — it would override the hide rule above and the FAB
     would show on desktop. The media query turns it on. */
  place-items: center;
  transition: transform .22s var(--ease-back);
}
.fab svg { width: 24px; height: 24px; }
.fab:active { transform: scale(.9); }

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  padding: 1.35rem;
  box-shadow: var(--shadow-xs);
  transition: box-shadow .35s var(--ease), transform .35s var(--ease-out), border-color .3s;
}
.card-hover:hover { box-shadow: var(--shadow-md); transform: translateY(-3px); border-color: var(--rule-strong); }

/* Gradient hairline that lights up on hover, drawn with a mask so it
   stays a 1px ring rather than a filled background. */
.card-glow::before {
  content: ""; position: absolute; inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: var(--grad-warm);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
          mask-composite: exclude;
  opacity: 0;
  transition: opacity .35s var(--ease);
  pointer-events: none;
}
.card-glow:hover::before { opacity: .85; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.card-title { font-size: var(--t-h3); }

/* ── Avatars ───────────────────────────────────────────────── */
.avatar {
  position: relative; flex: none;
  border-radius: 50%;
  overflow: hidden;
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 600;
  color: #fff;
  user-select: none;
  background: var(--ink-4);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.06);
}
/* object-position, not just cover. A phone portrait is typically 3:4 or
   taller, and centring a 266x480 photo in a circle crops the top of the
   person's head off while filling the bottom with their chest. Faces sit in
   the upper third of a portrait, so bias the crop upwards. Fixes every photo
   already uploaded, with no re-upload. */
.avatar img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 25%; }
.avatar.xs { width: 26px; height: 26px; font-size: .62rem; }
.avatar.sm { width: 36px; height: 36px; font-size: .8rem; }
.avatar.md { width: 48px; height: 48px; font-size: 1rem; }
.avatar.lg { width: 68px; height: 68px; font-size: 1.4rem; }
.avatar.xl { width: 108px; height: 108px; font-size: 2.2rem; }
.avatar.xxl { width: 148px; height: 148px; font-size: 3rem; }
.avatar-ring { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--clay); }

/* Anonymous giver */
.avatar-anon {
  background: var(--paper-3);
  color: var(--ink-4);
  border: 1px dashed var(--rule-strong);
  font-family: var(--font-body);
  font-weight: 700;
}

.avatar-stack { display: flex; }
.avatar-stack .avatar { margin-left: -9px; box-shadow: 0 0 0 2px var(--surface); }
.avatar-stack .avatar:first-child { margin-left: 0; }

/* ── Pills / chips / tags ──────────────────────────────────── */
.chip {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .22rem .6rem;
  border-radius: var(--r-pill);
  font-size: var(--t-xs); font-weight: 600;
  background: var(--paper-3); color: var(--ink-2);
  white-space: nowrap;
  /* Never wider than whatever holds it — a long label used to burst out
     of narrow cards and get clipped by their overflow. */
  max-width: 100%;
}
.chip svg { width: 13px; height: 13px; }
.chip-clay  { background: var(--clay-soft);  color: var(--clay-deep); }
.chip-amber { background: var(--amber-soft); color: #8A5D12; }
.chip-olive { background: var(--olive-soft); color: #4C5A38; }
.chip-plum  { background: var(--plum-soft);  color: #5E3A4B; }
.chip-teal  { background: var(--teal-soft);  color: #2C5253; }
:root[data-theme="dark"] .chip-amber { color: var(--amber); }
:root[data-theme="dark"] .chip-olive { color: var(--olive); }
:root[data-theme="dark"] .chip-plum  { color: var(--plum); }
:root[data-theme="dark"] .chip-teal  { color: var(--teal); }

.filter-bar { display: flex; gap: .45rem; flex-wrap: wrap; }

/* Long chip sets (the seven team names) stacked five rows deep on a phone.
   Only swipe below the breakpoint — on desktop there is room to wrap, and
   forcing nowrap there clipped the last chip off the right edge. */
@media (max-width: 880px) {
  .filter-bar.scroller {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
  }
  .filter-bar.scroller::-webkit-scrollbar { display: none; }
  .filter-bar.scroller .filter { flex: none; }
}
.filter {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .4rem .9rem;
  border-radius: var(--r-pill);
  border: 1px solid var(--rule);
  background: var(--surface);
  font-size: var(--t-xs); font-weight: 600; color: var(--ink-3);
  white-space: nowrap;
  transition: all .2s var(--ease);
}
/* Inline SVGs carry no intrinsic size — without this they expand to fill. */
.filter svg { width: 14px; height: 14px; flex: none; }
.filter:hover { border-color: var(--ink-4); color: var(--ink); }
.filter.active { background: var(--ink); border-color: var(--ink); color: var(--paper); }

/* ── Points badge ──────────────────────────────────────────── */
.points {
  display: inline-flex; align-items: baseline; gap: .2rem;
  font-family: var(--font-display); font-weight: 700;
  color: var(--clay);
}
.points span { font-size: .68em; font-weight: 600; letter-spacing: .04em; opacity: .8; }

/* ── Forms ─────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: .4rem; }
.label { font-size: var(--t-xs); font-weight: 600; letter-spacing: .04em; color: var(--ink-2); }
.hint  { font-size: var(--t-xs); color: var(--ink-4); }

.input, .textarea, .select {
  width: 100%;
  padding: .7rem .9rem;
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  font-size: .92rem;
  outline: 0;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.input::placeholder, .textarea::placeholder { color: var(--ink-4); }
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--clay);
  box-shadow: 0 0 0 3px var(--clay-soft);
}
.textarea { resize: vertical; min-height: 96px; line-height: 1.55; font-family: inherit; }

/* ── Password boxes with an eye ────────────────────────────────
   Built by UI.passwordField(). The padding on the input is what keeps a long
   password from running underneath the button; without it the last characters
   sit behind the icon exactly when someone is trying to read them. */
.pw-wrap { position: relative; display: block; }
.pw-wrap .input { padding-right: 2.9rem; }
.pw-eye {
  position: absolute; top: 50%; right: .35rem;
  transform: translateY(-50%);
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: var(--r-sm);
  color: var(--ink-4);
  transition: color .18s var(--ease), background .18s var(--ease);
}
.pw-eye:hover { color: var(--ink-2); background: var(--paper-3); }
.pw-eye svg { width: 17px; height: 17px; }
/* Both icons ship; the pressed state decides which one is real. Swapping
   innerHTML instead would drop the element the click handler is bound to. */
.pw-eye .ic:nth-child(2) { display: none; }
.pw-eye[aria-pressed="true"] .ic:nth-child(1) { display: none; }
.pw-eye[aria-pressed="true"] .ic:nth-child(2) { display: block; }
.pw-eye[aria-pressed="true"] { color: var(--clay); }

/* ── Admin flag ────────────────────────────────────────────────
   Replaced a switch in a sideways-scrolling table, where a stray click
   removed somebody's admin with no confirmation. This one opens a confirm. */
.admin-flag {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .3rem .6rem;
  border: 1px solid var(--rule-strong); border-radius: var(--r-pill);
  font-size: var(--t-xs); font-weight: 600;
  color: var(--ink-3); background: var(--surface);
  white-space: nowrap;
  transition: border-color .18s var(--ease), color .18s var(--ease), background .18s var(--ease);
}
.admin-flag svg { width: 13px; height: 13px; }
.admin-flag:hover { border-color: var(--ink-4); color: var(--ink); }
.admin-flag[aria-pressed="true"] {
  color: var(--clay-deep); background: var(--clay-soft); border-color: transparent;
}
:root[data-theme="dark"] .admin-flag[aria-pressed="true"] { color: var(--clay); }
.admin-flag[aria-pressed="true"]:hover { border-color: var(--clay); }
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%237A6F65' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .9rem center;
  padding-right: 2.3rem;
}
/* 16px EXACTLY, on touch screens. Safari zooms the page in whenever a focused
   field is smaller than 16px and does not zoom back out afterwards, which is
   why typing in a form left the layout half off-screen. This is the documented
   way to stop it — a viewport with maximum-scale would also work and would
   break pinch-zoom for anyone who needs it.
   Desktop keeps the smaller, denser .92rem. */
@media (hover: none) and (pointer: coarse) {
  .input, .textarea, .select { font-size: 16px; }
  .search input { font-size: 16px; }
}

.field-error .input, .field-error .textarea, .field-error .select { border-color: #C0392B; }
.error-text { font-size: var(--t-xs); color: #C0392B; font-weight: 500; }

/* Range slider */
.range { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: 99px; background: var(--paper-3); outline: 0; }
.range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 26px; height: 26px; border-radius: 50%;
  background: linear-gradient(140deg, var(--clay), var(--clay-deep));
  border: 3px solid var(--surface);
  box-shadow: var(--shadow-md); cursor: grab;
  transition: transform .2s var(--ease-back);
}
.range::-webkit-slider-thumb:active { transform: scale(1.18); cursor: grabbing; }
.range::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--clay); border: 3px solid var(--surface);
  box-shadow: var(--shadow-md); cursor: grab;
}

/* Toggle */
.switch { position: relative; width: 42px; height: 24px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 2; }
.switch i {
  position: absolute; inset: 0;
  background: var(--paper-3); border-radius: 99px;
  transition: background .25s var(--ease);
}
.switch i::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--surface); box-shadow: var(--shadow-sm);
  transition: transform .28s var(--ease-back);
}
.switch input:checked + i { background: var(--clay); }
.switch input:checked + i::after { transform: translateX(18px); }

/* Toggle + explanation, used for privacy options */
.toggle-row {
  display: flex; align-items: flex-start; gap: .85rem;
  padding: .9rem 1rem;
  border: 1px solid var(--rule); border-radius: var(--r-md);
  background: var(--surface-sunk);
  cursor: pointer;
  transition: border-color .2s var(--ease);
}
.toggle-row:hover { border-color: var(--ink-4); }
.toggle-row .switch { margin-top: 2px; }
.toggle-row b { display: block; font-size: .9rem; }
.toggle-row .muted { display: block; font-size: var(--t-xs); line-height: 1.5; margin-top: .15rem; }

/* ── Modal ─────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 200;
  background: color-mix(in srgb, var(--ink) 42%, transparent);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: grid; place-items: center;
  padding: 1rem;
  animation: fade .25s var(--ease) both;
  overflow-y: auto;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  width: min(560px, 100%);
  max-height: 92dvh;
  display: flex; flex-direction: column;
  animation: modal-in .42s var(--ease-out) both;
  overflow: hidden;
}
.modal-wide { width: min(860px, 100%); }
.modal-head { padding: 1.5rem 1.6rem 1rem; display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.modal-body { padding: 0 1.6rem 1.6rem; overflow-y: auto; }
.modal-foot {
  padding: 1.1rem 1.6rem;
  border-top: 1px solid var(--rule);
  background: var(--surface-sunk);
  display: flex; justify-content: flex-end; gap: .6rem; flex-wrap: wrap;
}

@keyframes fade { from { opacity: 0 } }
@keyframes modal-in { from { opacity: 0; transform: translateY(24px) scale(.97) } }

/* ── Toasts ────────────────────────────────────────────────── */
.toast-stack {
  position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%);
  z-index: 300; display: flex; flex-direction: column-reverse; gap: .5rem;
  pointer-events: none; width: min(420px, calc(100vw - 2rem));
}
.toast {
  display: flex; align-items: center; gap: .7rem;
  padding: .8rem 1.1rem;
  border-radius: var(--r-pill);
  background: var(--ink); color: var(--paper);
  box-shadow: var(--shadow-lg);
  font-size: .875rem; font-weight: 500;
  animation: toast-in .45s var(--ease-back) both;
  pointer-events: auto;
}
.toast svg { width: 17px; height: 17px; flex: none; }
.toast.out { animation: toast-out .3s var(--ease) forwards; }
.toast-good svg { color: #8FCB9B; }
.toast-bad  svg { color: #F09B8C; }
@keyframes toast-in  { from { opacity: 0; transform: translateY(20px) scale(.9) } }
@keyframes toast-out { to   { opacity: 0; transform: translateY(10px) scale(.95) } }

/* ── Empty state ───────────────────────────────────────────── */
.empty { text-align: center; padding: 3.5rem 1.5rem; color: var(--ink-3); }
.empty-mark { font-size: 2.4rem; margin-bottom: .6rem; opacity: .55; }
.empty h3 { font-size: 1.15rem; color: var(--ink-2); margin-bottom: .3rem; }
.empty p { font-size: .9rem; max-width: 38ch; margin-inline: auto; }

/* ── Section rule with label ───────────────────────────────── */
.rule-head { display: flex; align-items: center; gap: 1rem; margin: 2.5rem 0 1.25rem; }
.rule-head::after { content: ""; flex: 1; height: 1px; background: var(--rule); }

/* ── Mobile bottom nav ─────────────────────────────────────── */
.mobile-nav { display: none; }

@media (max-width: 880px) {

  /* ── Topbar rebuild ──────────────────────────────────────
     The desktop bar packed a search field, a labelled button and three
     icons into 390px, which clipped "Bagi points" to "gi po" and pushed
     the avatar off the edge. On mobile: brand, wallets, icons only —
     giving moves to the floating button, search to the directory. */
  /* Scrolls away with the page rather than staying pinned. Sticky was fine
     when the browser's own chrome sat above it, but installed there is
     nothing above it — the bar just hangs over the content as you scroll,
     next to the clock. The bottom nav already keeps navigation within reach
     on a phone, so nothing is lost by letting this one go. Desktop keeps its
     sticky bar; there is room for it there. */
  .topbar { gap: .4rem; padding: .6rem .75rem; position: static; }
  .topbar .search { display: none; }
  .topbar-give { display: none; }
  .topbar-search-link { display: grid; }
  .fab { display: grid; }
  .topbar .icon-btn { width: 36px; height: 36px; }

  /* Full-height sheet rather than a dropdown hanging off the corner. */
  .notif-panel {
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100%; max-height: none;
    border-radius: 0; border: 0;
    animation: fade .2s var(--ease) both;
  }
  .notif-head { padding: 1rem 1rem calc(1rem); padding-top: max(1rem, env(safe-area-inset-top)); }
  .notif-close { display: grid; }
  .notif-list { padding-bottom: 3rem; }
  .mobile-nav {
    display: flex;
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 60;
    background: color-mix(in srgb, var(--paper) 88%, transparent);
    backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
    border-top: 1px solid var(--rule);
    padding: .4rem .3rem calc(.4rem + env(safe-area-inset-bottom));
  }
  .mobile-nav a {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: .45rem .2rem; border-radius: var(--r-sm);
    font-size: .62rem; font-weight: 600; letter-spacing: .02em;
    color: var(--ink-4);
    transition: color .2s;
  }
  .mobile-nav a svg, .mobile-nav button svg { width: 21px; height: 21px; }
  .mobile-nav a.active, .mobile-nav button.active { color: var(--clay); }
  .mobile-nav button {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: .45rem .2rem; border-radius: var(--r-sm);
    font-size: .62rem; font-weight: 600; letter-spacing: .02em;
    color: var(--ink-4);
  }
  .page { padding-bottom: 7rem; }
}

/* ── Mobile "More" sheet ───────────────────────────────────── */
.more-sheet {
  position: fixed; inset: 0; z-index: 200;
  background: color-mix(in srgb, var(--ink) 45%, transparent);
  backdrop-filter: blur(5px);
  display: flex; align-items: flex-end;
  animation: fade .22s var(--ease) both;
}
.more-panel {
  width: 100%;
  background: var(--surface);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: .5rem .75rem calc(1rem + env(safe-area-inset-bottom));
  box-shadow: var(--shadow-lg);
  animation: sheet-up .32s var(--ease-out) both;
  max-height: 82dvh; overflow-y: auto;
}
@keyframes sheet-up { from { transform: translateY(100%); } }
.more-head { display: flex; align-items: center; justify-content: space-between; padding: .6rem .5rem .4rem; }
.more-head h3 { font-size: 1.1rem; }
.more-item {
  display: flex; align-items: center; gap: .8rem;
  width: 100%; text-align: left;
  padding: .8rem .6rem;
  border-radius: var(--r-md);
  border-bottom: 1px solid var(--rule);
  transition: background .18s var(--ease);
}
.more-item:last-child { border-bottom: 0; }
.more-item:active { background: var(--surface-sunk); }
.more-item b { font-size: .95rem; font-weight: 600; }
.more-sub { display: block; font-size: var(--t-xs); color: var(--ink-3); }
.more-ico {
  width: 36px; height: 36px; flex: none;
  display: grid; place-items: center; border-radius: 50%;
  background: var(--paper-3); color: var(--ink-2);
}
.more-ico svg { width: 17px; height: 17px; }
.more-item.danger b { color: #C0392B; }
.more-item.danger .more-ico { background: color-mix(in srgb, #C0392B 14%, transparent); color: #C0392B; }

/* ── Animations used by views ──────────────────────────────── */
@keyframes rise { from { opacity: 0; transform: translateY(18px) } }
.rise { animation: rise .6s var(--ease-out) both; }

@keyframes pop { from { opacity: 0; transform: scale(.94) } }
.pop { animation: pop .45s var(--ease-back) both; }

/* ── Demo mode banner ──────────────────────────────────────────
   Deliberately loud. The entire risk of a populated demo is that
   somebody in the room takes it for the real department, so this
   sits above everything and does not scroll away. */
.demo-bar {
  position: sticky; top: 0; z-index: 45;
  display: flex; align-items: center; gap: .75rem;
  padding: calc(.55rem + env(safe-area-inset-top, 0px)) clamp(.75rem, 3vw, 1.5rem) .55rem;
  background: linear-gradient(90deg, var(--clay-deep), var(--clay) 60%, var(--amber));
  color: #fff;
  font-size: var(--t-xs); line-height: 1.4;
}
.demo-bar b { font-weight: 700; }
.demo-msg { min-width: 0; }
.demo-as {
  display: flex; align-items: center; gap: .4rem;
  margin-left: auto; flex: none;
  font-size: var(--t-micro); text-transform: uppercase; letter-spacing: .08em;
}
.demo-as select {
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.35);
  color: #fff;
  border-radius: var(--r-pill);
  padding: .25rem 1.5rem .25rem .6rem;
  font-size: var(--t-xs); font-weight: 600;
  max-width: 190px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23ffffff' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .5rem center;
}
/* The options render in the OS menu, which does not inherit the bar's
   colours — without this they are white-on-white on some platforms. */
.demo-as select option { color: var(--ink); background: var(--surface); }
.demo-bar .btn { margin-left: .5rem; }
.demo-bar span { min-width: 0; }
.demo-bar .btn {
  flex: none;
  background: rgba(255,255,255,.16); color: #fff;
  border-color: rgba(255,255,255,.35);
}
.demo-bar .btn:hover { background: rgba(255,255,255,.28); }
.demo-dot {
  flex: none; width: 8px; height: 8px; border-radius: 50%;
  background: #fff; box-shadow: 0 0 0 0 rgba(255,255,255,.7);
  animation: demo-pulse 2s var(--ease) infinite;
}
@keyframes demo-pulse {
  70%  { box-shadow: 0 0 0 7px rgba(255,255,255,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,255,255,0); }
}
@media (max-width: 880px) {
  .demo-bar { font-size: var(--t-micro); gap: .5rem; }
  .demo-bar .btn { padding: .3rem .6rem; font-size: var(--t-micro); }
}

/* ── Field pairs that actually stack ───────────────────────────
   Two-up rows (Birthday/Based in, Phone/Email, and the same pattern in the
   admin and give modals) stayed side by side on a phone and squeezed each
   field to about half a word wide, with the hint text wrapping under only one
   column.

   `wrap` was already on most of those rows and did nothing, because .grow is
   `flex: 1 1 0%` — with a zero basis the two fields shrink indefinitely
   rather than ever overflowing, so the wrap never triggers. Giving them a
   real flex-basis is what makes wrapping possible at all. */
.row > .field.grow { flex: 1 1 210px; min-width: 0; }

@media (max-width: 640px) {
  /* Below this width two fields never sit comfortably together, so stop
     negotiating and stack them — including rows that were never marked
     `wrap`. Scoped to rows that actually contain fields, so button rows and
     avatar+name rows are left horizontal. */
  .row.gap-3, .row.gap-4 { flex-wrap: wrap; }
  /* `.field.grow` must be named again here. The basis rule above is
     `.row > .field.grow` (0,3,0) and would otherwise outrank a plain
     `.row > .field` (0,2,0), leaving the fields side by side — which is the
     bug this whole block exists to fix. */
  .row > .field,
  .row > .field.grow { flex: 1 1 100%; }

  /* The modal itself needs the room back that the stacked fields now take. */
  .modal { max-height: 94dvh; }
  .modal-head { padding: 1.15rem 1.15rem .75rem; }
  .modal-body { padding: 0 1.15rem 1.15rem; }
  .modal-foot { padding: .9rem 1.15rem calc(.9rem + env(safe-area-inset-bottom, 0px)); }
}

/* ══ The launcher ══════════════════════════════════════════════
   Replaced the sidebar in v4.2. One button in the topbar; the page
   blurs back and a grid of destinations comes forward, each carrying a
   live number so the menu is worth the click a sidebar never charged.

   It is a sibling of .shell, NOT a child. Anything with a transform,
   filter, clip-path or mask on it becomes the containing block for its
   position:fixed descendants — and .launcher backdrop-filters the whole
   viewport. Nested inside .shell it would trap the mobile nav and the FAB.
   ══════════════════════════════════════════════════════════════ */

/* The button. Desktop only — on a phone the bottom bar is the navigation
   and this would be a second door to the same room in a bar with no space
   for it. */
.menu-btn {
  display: flex; align-items: center; gap: .6rem; flex: none;
  padding: .5rem .95rem .5rem .75rem;
  border: 1px solid var(--rule-strong); border-radius: var(--r-pill);
  background: transparent; color: var(--ink); cursor: pointer;
  font-family: var(--font-body); font-size: .82rem; font-weight: 600;
  letter-spacing: .01em; white-space: nowrap;
  transition: background .2s var(--ease), border-color .2s var(--ease);
}
.menu-btn:hover { background: var(--paper-3); border-color: var(--ink-4); }
.menu-btn .bars { display: grid; gap: 3px; }
.menu-btn .bars i { display: block; width: 15px; height: 1.6px; background: currentColor; border-radius: 2px; }
/* The "where am I" half. A sidebar answered this for free by highlighting a
   row; this is what replaces that. */
.menu-btn em { font-style: normal; font-weight: 500; color: var(--ink-3); }

.launcher {
  position: fixed; inset: 0; z-index: 210;
  display: grid; place-items: center;
  padding: clamp(1rem, 4vw, 3rem);
  background: color-mix(in srgb, var(--paper) 72%, transparent);
  backdrop-filter: blur(22px) saturate(1.3);
  -webkit-backdrop-filter: blur(22px) saturate(1.3);
  animation: fade .22s var(--ease) both;
}
.launcher[hidden] { display: none; }

.lx-panel { width: min(920px, 100%); max-height: 100%; overflow-y: auto; }
.lx-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .9rem; }

.lx-grid {
  display: grid; gap: .75rem;
  grid-template-columns: repeat(auto-fit, minmax(178px, 1fr));
}
.lx-tile {
  display: block; padding: 1.05rem 1.1rem;
  border: 1px solid var(--rule); border-radius: var(--r-lg);
  background: var(--surface); color: var(--ink); text-decoration: none;
  opacity: 0; transform: translateY(14px) scale(.97);
  animation: lx-tile-in .4s var(--ease-out) forwards;
  transition: border-color .2s var(--ease), background .2s var(--ease),
              transform .2s var(--ease-out), box-shadow .2s var(--ease);
}
@keyframes lx-tile-in { to { opacity: 1; transform: none; } }
/* Stagger. Nine hard-coded steps rather than a variable per tile: the list
   is fixed by ROUTES and this keeps the markup free of style. */
.lx-tile:nth-child(1) { animation-delay: 0ms }
.lx-tile:nth-child(2) { animation-delay: 30ms }
.lx-tile:nth-child(3) { animation-delay: 60ms }
.lx-tile:nth-child(4) { animation-delay: 90ms }
.lx-tile:nth-child(5) { animation-delay: 120ms }
.lx-tile:nth-child(6) { animation-delay: 150ms }
.lx-tile:nth-child(7) { animation-delay: 180ms }
.lx-tile:nth-child(8) { animation-delay: 210ms }
.lx-tile:nth-child(9) { animation-delay: 240ms }
.lx-tile:nth-child(n+10) { animation-delay: 270ms }

.lx-tile:hover, .lx-tile:focus-visible {
  border-color: var(--clay); background: var(--paper-2);
  transform: translateY(-3px); box-shadow: var(--shadow-md);
}
.lx-tile.active { border-color: var(--clay); background: var(--clay-soft); }
.lx-ico {
  display: grid; place-items: center; width: 38px; height: 38px;
  border-radius: 11px; background: var(--paper-3); color: var(--clay-deep);
}
:root[data-theme="dark"] .lx-ico { color: var(--clay); }
.lx-tile.active .lx-ico { background: var(--clay); color: #fff; }
.lx-ico svg { width: 19px; height: 19px; }
.lx-tile b { display: block; margin-top: .7rem; font-size: .97rem; font-weight: 600; }
.lx-tile > span:last-child {
  display: block; margin-top: .15rem;
  font-size: var(--t-xs); color: var(--ink-3); line-height: 1.35;
}

.lx-foot {
  display: flex; align-items: center; gap: .75rem;
  margin-top: 1.1rem; padding-top: 1rem; border-top: 1px solid var(--rule);
}
.lx-me { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--ink); flex: 1; min-width: 0; }
.lx-me b { display: block; font-size: .87rem; font-weight: 600; line-height: 1.2; }
.lx-me .muted { display: block; font-size: var(--t-micro); }

@media (max-width: 880px) {
  .menu-btn { display: none; }
  .lx-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .55rem; }
  .lx-tile { padding: .85rem .9rem; }
}
@media (prefers-reduced-motion: reduce) {
  .lx-tile { animation: none; opacity: 1; transform: none; }
  .lx-tile:hover { transform: none; }
}
