/* Michango — tokens and components. See DESIGN.md. */
@font-face {
  font-family: "Figtree";
  src: url("../fonts/figtree-var.202cfb54d4e6.woff2") format("woff2");
  font-weight: 300 900;
  font-display: swap;
}

:root {
  --ink: #5e2a5c; --ink-strong: #45203f; --ink-soft: #f2e7f0;
  --text: #1f2328; --text-2: #4a5059; --muted: #656b74;
  --line: #e2e4e8; --surface: #f5f6f7; --white: #fff;
  --ok: #1d6a3a; --ok-bg: #e4f2e8;
  --part: #855400; --part-bg: #fbefd6;
  --due: #a03424; --due-bg: #fbe8e4;
  --none: #4a5059; --none-bg: #eceef1;
  --t-sm: 14px; --t-base: 16px; --t-md: 18px; --t-lg: 22px; --t-xl: 28px; --t-hero: 36px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px; --s10: 40px;
  --r: 12px; --r-full: 999px;
  --shadow-sheet: 0 -2px 16px rgba(69, 32, 63, .12);
  --tabs-h: 64px;
  --ease: cubic-bezier(.2, .7, .3, 1);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: var(--t-base); line-height: 1.45; color: var(--text); background: var(--white);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { line-height: 1.2; margin: 0; font-weight: 600; }
h1 { font-size: var(--t-lg); }
h2 { font-size: var(--t-md); }
p { margin: 0 0 var(--s3); }
a { color: var(--ink); text-underline-offset: 3px; }
img { max-width: 100%; }
.icon { flex: none; display: block; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: var(--t-sm); }
.right { text-align: right; }
.stack > * + * { margin-top: var(--s4); }
.stack-sm > * + * { margin-top: var(--s2); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }

/* ---------- layout ---------- */
.page { max-width: 640px; margin: 0 auto; padding: var(--s4) var(--s4) calc(var(--tabs-h) + var(--s10) + env(safe-area-inset-bottom)); }
.page.no-tabs { padding-bottom: var(--s10); }
.topbar {
  display: flex; align-items: center; gap: var(--s3); min-height: 56px;
  max-width: 640px; margin: 0 auto; padding: var(--s2) var(--s4); border-bottom: 1px solid var(--line);
}
.topbar .brand { display: inline-flex; align-items: center; min-height: 48px; font-weight: 700; font-size: var(--t-md); color: var(--ink); text-decoration: none; letter-spacing: -.01em; }
.topbar .spacer { flex: 1; }
.topbar a.iconlink { display: inline-flex; align-items: center; gap: var(--s2); min-height: 48px; padding: 0 var(--s2); color: var(--text-2); text-decoration: none; font-weight: 600; }
.title-row { display: flex; align-items: center; gap: var(--s3); margin-bottom: var(--s4); }
.title-row h1 { flex: 1; }
.back { display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; margin-left: -12px; color: var(--text); border-radius: var(--r-full); }
.back:active { background: var(--surface); }
.event-head { padding-bottom: var(--s4); }
.event-head .meta { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s4); color: var(--text-2); font-size: var(--t-sm); margin-top: var(--s1); }
.event-head .meta span { display: inline-flex; align-items: center; gap: 6px; }
.section { margin-top: var(--s8); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: var(--s2); }
.section-head a { font-weight: 600; text-decoration: none; min-height: 48px; display: inline-flex; align-items: center; }

/* ---------- tab bar ---------- */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex;
  height: calc(var(--tabs-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--white); border-top: 1px solid var(--line);
}
.tabs a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 600; position: relative;
}
.tabs a[aria-current="page"] { color: var(--ink); }
.tabs .rail-brand { display: none; }
.tabs a[aria-current="page"]::before {
  content: ""; position: absolute; top: -1px; left: 28%; right: 28%; height: 3px; border-radius: 0 0 3px 3px; background: var(--ink);
}
@media (min-width: 960px) {
  .has-rail { padding-left: 200px; }
  .tabs {
    top: 0; right: auto; width: 200px; height: auto; flex-direction: column; justify-content: flex-start;
    gap: var(--s1); padding: var(--s6) var(--s3); border-top: 0; border-right: 1px solid var(--line);
  }
  .tabs .rail-brand { display: block; font-weight: 700; color: var(--ink); font-size: var(--t-md); padding: 0 var(--s3) var(--s4); text-decoration: none; }
  .tabs a { flex: none; flex-direction: row; justify-content: flex-start; gap: var(--s3); min-height: 48px; padding: 0 var(--s3); border-radius: var(--r); font-size: var(--t-base); }
  .tabs a[aria-current="page"] { background: var(--ink-soft); }
  .tabs a[aria-current="page"]::before { display: none; }
  .page { padding-bottom: var(--s10); }
}

/* ---------- buttons ---------- */
.btn, .btn-2, .btn-q, .btn-danger {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 52px; padding: 0 var(--s5); border-radius: var(--r); border: 1px solid transparent;
  font: inherit; font-size: var(--t-md); font-weight: 600; text-decoration: none; cursor: pointer;
  transition: background-color .15s var(--ease), transform .15s var(--ease);
}
.btn { background: var(--ink); color: var(--white); width: 100%; }
.btn:active { background: var(--ink-strong); transform: scale(.99); }
.btn-2 { background: var(--white); color: var(--ink); border-color: var(--line); }
.btn-2:active { background: var(--surface); }
.btn-q { background: none; color: var(--ink); padding: 0 var(--s3); min-height: 48px; }
.btn-danger { background: var(--white); color: var(--due); border-color: var(--line); }
.btn-sm { min-height: 48px; padding: 0 var(--s4); font-size: var(--t-base); }
.btn-block { width: 100%; }
.btn[disabled], .btn-2[disabled] { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: var(--s3); flex-wrap: wrap; }
.btn-row > * { flex: 1 1 140px; }
.btn-row > .btn-2 { white-space: nowrap; padding: 0 var(--s3); font-size: var(--t-base); }
.htmx-request .btn, .btn.htmx-request { opacity: .7; }
.fab {
  position: fixed; right: var(--s4); bottom: calc(var(--tabs-h) + var(--s4) + env(safe-area-inset-bottom)); z-index: 15;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  height: 56px; min-width: 56px; padding: 0 var(--s4); border-radius: var(--r-full);
  background: var(--ink); color: var(--white); text-decoration: none; font-weight: 600; font-size: var(--t-md);
  box-shadow: 0 2px 8px rgba(69, 32, 63, .25);
}
.fab .fab-label { display: none; }
@media (min-width: 960px) { .fab { bottom: var(--s6); right: max(var(--s6), calc(50% - 420px + 100px)); } .fab .fab-label { display: inline; } }

/* ---------- forms ---------- */
.field { display: block; margin-bottom: var(--s5); }
.field > label, .field > .label { display: block; font-weight: 600; margin-bottom: var(--s2); }
.input, .field input[type=text], .field input[type=tel], .field input[type=password], .field input[type=date],
.field input[type=time], .field input[type=datetime-local], .field input[type=search], .field input[type=number],
.field select, .field textarea {
  display: block; width: 100%; min-height: 52px; padding: var(--s3) var(--s4);
  font: inherit; font-size: var(--t-md); color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  transition: border-color .15s, box-shadow .15s;
}
.field textarea { min-height: 120px; resize: vertical; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--ink-soft); background: var(--white);
}
.field .hint { color: var(--muted); font-size: var(--t-sm); margin-top: 6px; }
.field .error, .form-error { color: var(--due); font-size: var(--t-base); margin-top: 6px; display: flex; gap: 6px; align-items: flex-start; }
.form-error { background: var(--due-bg); padding: var(--s3) var(--s4); border-radius: var(--r); margin-bottom: var(--s4); }
.field.has-error input, .field.has-error textarea { border-color: var(--due); }
.amount-input { font-size: var(--t-xl) !important; font-weight: 600; font-variant-numeric: tabular-nums; }
.live-amount { font-size: var(--t-md); font-weight: 600; color: var(--ink); margin-top: 6px; min-height: 26px; }
.searchbox { position: relative; }
.searchbox .icon { position: absolute; left: 14px; top: 14px; color: var(--muted); pointer-events: none; }
.searchbox input { padding-left: 46px !important; }
details.more { border-top: 1px solid var(--line); padding-top: var(--s2); margin-bottom: var(--s5); }
details.more summary { min-height: 48px; display: flex; align-items: center; font-weight: 600; color: var(--ink); cursor: pointer; list-style: none; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary::after { content: "+"; margin-left: var(--s2); font-weight: 400; }
details.more[open] summary::after { content: "–"; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); min-height: 52px; font-weight: 600; cursor: pointer; }
.switch input { width: 48px; height: 28px; appearance: none; -webkit-appearance: none; background: var(--line); border-radius: var(--r-full); position: relative; cursor: pointer; transition: background .15s; flex: none; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--white); transition: transform .15s var(--ease); }
.switch input:checked { background: var(--ink); }
.switch input:checked::after { transform: translateX(20px); }

/* ---------- chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: var(--s2); }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; margin: 0 calc(-1 * var(--s4)); padding: 2px var(--s4); scrollbar-width: none; }
.chip {
  position: relative; display: inline-flex; align-items: center; gap: 6px; min-height: 48px; padding: 0 var(--s4);
  border: 1px solid var(--line); border-radius: var(--r-full); background: var(--white);
  color: var(--text-2); font-weight: 600; font-size: var(--t-base); text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s;
}
.chip .icon { display: none; }
.chip[aria-current="true"], .chip.on, .chip:has(input:checked) { background: var(--ink-soft); border-color: var(--ink); color: var(--ink); }
.chip[aria-current="true"] .icon, .chip.on .icon, .chip:has(input:checked) .icon { display: block; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip:has(input:focus-visible) { outline: 3px solid var(--ink); outline-offset: 2px; }
.chips.big .chip { min-height: 52px; font-size: var(--t-md); flex: 1 1 0; justify-content: center; padding: 0 var(--s3); }

.status { display: inline-flex; align-items: center; min-height: 28px; padding: 0 10px; border-radius: var(--r-full); font-size: var(--t-sm); font-weight: 600; white-space: nowrap; }
.status-paid { background: var(--ok-bg); color: var(--ok); }
.status-partly { background: var(--part-bg); color: var(--part); }
.status-not_paid { background: var(--due-bg); color: var(--due); }
.status-no_pledge, .status-cancelled, .status-none { background: var(--none-bg); color: var(--none); }
.status-active { background: var(--ok-bg); color: var(--ok); }
.status-waiting { background: var(--part-bg); color: var(--part); }
.badge { display: inline-flex; align-items: center; min-height: 24px; padding: 0 8px; border-radius: var(--r-full); background: var(--surface); color: var(--text-2); font-size: var(--t-sm); font-weight: 600; border: 1px solid var(--line); }

/* ---------- lists ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.row { display: flex; align-items: center; gap: var(--s3); min-height: 68px; padding: var(--s2) 0; position: relative; }
.list > li + li .row, .list > .row + .row { border-top: 1px solid var(--line); }
.list.inset > li + li .row::before { content: none; }
.row-main { flex: 1; min-width: 0; color: inherit; text-decoration: none; display: flex; align-items: center; gap: var(--s3); min-height: 52px; }
.row-text { min-width: 0; flex: 1; }
.row-title { font-size: var(--t-md); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub { font-size: var(--t-sm); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub.wrap, .row-title.wrap { white-space: normal; }
/* My events: collected against pledged, echoing the event summary rule */
.event-money { display: block; margin-top: var(--s2); font-size: var(--t-sm); color: var(--text-2); }
.event-money strong { color: var(--text); font-weight: 600; }
.event-money .bar { display: block; margin-top: 6px; }
.event-money .bar > span { display: block; }
.bar-thin { height: 4px; }
.row-tags { display: flex; flex-wrap: wrap; gap: var(--s1); margin-top: var(--s2); }
.row-tags .badge { gap: 4px; }
.row-end { display: flex; align-items: center; gap: var(--s2); flex: none; text-align: right; }
.row-amount { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.row.void .row-title, .row.void .row-amount { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 1px; }
.row .chev { color: var(--muted); }
.row-add { min-height: 40px; min-width: 64px; padding: 0 var(--s3); border-radius: var(--r-full); border: 1px solid var(--line); background: var(--white); color: var(--ink); font: inherit; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 4px; text-decoration: none; }
.row-add::after { content: ""; position: absolute; inset: -4px; }
.row-add { position: relative; }
.avatar { width: 44px; height: 44px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex: none; font-weight: 600; font-size: var(--t-base); color: var(--text); }
.avatar.lg { width: 64px; height: 64px; font-size: var(--t-lg); }
.tint-0 { background: #e3ecf5; } .tint-1 { background: #e6f0e6; } .tint-2 { background: #f5eadb; }
.tint-3 { background: #efe4ee; } .tint-4 { background: #e2efef; } .tint-5 { background: #f2e6e1; }
.type-icon { width: 44px; height: 44px; border-radius: var(--r); background: var(--ink-soft); color: var(--ink); display: inline-flex; align-items: center; justify-content: center; flex: none; }

/* ---------- summary (the memorable bit) ---------- */
.summary { padding: var(--s5) 0 var(--s4); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.summary .label { color: var(--text-2); font-size: var(--t-sm); font-weight: 600; }
.summary .hero { font-size: var(--t-hero); font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.1; margin: 2px 0 var(--s3); }
.summary .hero small { font-size: var(--t-md); font-weight: 600; color: var(--text-2); letter-spacing: 0; margin-right: 4px; }
.bar { height: 8px; border-radius: var(--r-full); background: var(--line); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--ink); border-radius: inherit; transition: width .2s var(--ease); }
.tiles { display: grid; grid-template-columns: 1fr 1fr; margin-top: var(--s4); }
.tile + .tile { border-left: 1px solid var(--line); padding-left: var(--s4); }
.tile .label { display: block; }
.tile .fig { font-size: var(--t-lg); font-weight: 600; font-variant-numeric: tabular-nums; }
.pct { font-size: var(--t-sm); color: var(--text-2); margin-top: var(--s2); }

.kv { display: grid; grid-template-columns: auto 1fr; gap: var(--s2) var(--s4); margin: 0; }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- banners, toasts, checklist ---------- */
.banner { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3) var(--s4); border: 1px solid var(--line); border-radius: var(--r); background: var(--ink-soft); margin-bottom: var(--s4); }
.banner.attention { background: var(--part-bg); border-color: #f0dcae; }
.banner .icon { margin-top: 1px; color: var(--ink); }
.banner.attention .icon { color: var(--part); }
.banner p { margin: 0; }
.banner a { font-weight: 600; }
.checklist { border: 1px solid var(--line); border-radius: var(--r); padding: var(--s4); margin-top: var(--s6); }
.checklist ol { list-style: none; margin: var(--s3) 0 0; padding: 0; counter-reset: step; }
.checklist li { counter-increment: step; }
.checklist li a, .checklist li span.done { display: flex; align-items: center; gap: var(--s3); min-height: 48px; text-decoration: none; color: var(--text); font-weight: 600; }
.checklist li a::before, .checklist li span.done::before {
  content: counter(step); width: 28px; height: 28px; border-radius: 50%; border: 1.5px solid var(--ink); color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; font-size: var(--t-sm); flex: none;
}
.checklist li span.done { color: var(--muted); text-decoration: line-through; }
.checklist li span.done::before { content: "✓"; background: var(--ink); color: var(--white); }
.checklist .head { display: flex; justify-content: space-between; align-items: center; }

.toasts { position: fixed; left: var(--s4); right: var(--s4); bottom: calc(var(--tabs-h) + var(--s3) + env(safe-area-inset-bottom)); z-index: 40; display: flex; flex-direction: column; align-items: center; gap: var(--s2); pointer-events: none; }
.no-tabs-body .toasts { bottom: var(--s4); }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: var(--s3); max-width: 560px; width: 100%;
  min-height: 52px; padding: var(--s2) var(--s2) var(--s2) var(--s4); border-radius: var(--r);
  background: var(--text); color: var(--white); box-shadow: var(--shadow-sheet);
  animation: toast-in .18s var(--ease);
}
.toast p { margin: 0; flex: 1; }
.toast form { margin: 0; }
.toast button { background: none; border: 0; color: #e8c6e4; font: inherit; font-weight: 700; min-height: 48px; padding: 0 var(--s3); cursor: pointer; }
.toast.error { background: var(--due); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

.empty { padding: var(--s8) 0; }
.empty p { color: var(--text-2); font-size: var(--t-md); }
.empty .btn { max-width: 360px; }

/* ---------- sheet ---------- */
.sheet-page { background: rgba(31, 35, 40, .32); min-height: 100vh; min-height: 100dvh; display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  width: 100%; max-width: 560px; background: var(--white); border-radius: var(--r) var(--r) 0 0;
  padding: var(--s3) var(--s4) calc(var(--s6) + env(safe-area-inset-bottom)); box-shadow: var(--shadow-sheet);
  animation: sheet-in .18s var(--ease); max-height: 100dvh; overflow-y: auto;
}
.sheet .grab { width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 0 auto var(--s3); }
.sheet .title-row { margin-bottom: var(--s5); }
@keyframes sheet-in { from { transform: translateY(24px); opacity: .4; } }
@media (min-width: 640px) { .sheet-page { align-items: center; padding: var(--s6); } .sheet { border-radius: var(--r); } }

/* person picker */
.picker-results { border: 1px solid var(--line); border-radius: var(--r); margin-top: var(--s2); overflow: hidden; }
.picker-results button { display: flex; width: 100%; align-items: center; gap: var(--s3); min-height: 56px; padding: var(--s2) var(--s4); background: var(--white); border: 0; border-top: 1px solid var(--line); font: inherit; text-align: left; cursor: pointer; color: var(--text); }
.picker-results button:first-child { border-top: 0; }
.picker-results button:active { background: var(--surface); }
.picked { display: flex; align-items: center; gap: var(--s3); min-height: 60px; padding: var(--s2) var(--s3) var(--s2) var(--s3); border: 1px solid var(--ink); background: var(--ink-soft); border-radius: var(--r); }
.picked .row-text { flex: 1; }

/* share text */
.share-text { white-space: pre-wrap; word-wrap: break-word; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: var(--s4); font-size: var(--t-base); line-height: 1.5; margin: 0 0 var(--s4); font-family: inherit; max-height: 50vh; overflow: auto; }
.success-mark { width: 56px; height: 56px; border-radius: 50%; background: var(--ok-bg); color: var(--ok); display: inline-flex; align-items: center; justify-content: center; margin-bottom: var(--s3); }

/* tiles for event type picker */
.type-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
.type-tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: var(--s3); min-height: 112px; padding: var(--s4);
  border: 1px solid var(--line); border-radius: var(--r); text-decoration: none; color: var(--text); font-size: var(--t-md); font-weight: 600; background: var(--white);
}
.type-tile:active { border-color: var(--ink); background: var(--ink-soft); }
.type-tile .type-icon { width: 40px; height: 40px; }
.type-tile small { display: block; font-weight: 400; font-size: var(--t-sm); color: var(--muted); margin-top: 2px; }

/* plan options */
.plan-opt { display: flex; align-items: center; gap: var(--s4); min-height: 76px; padding: var(--s3) var(--s4); border: 1px solid var(--line); border-radius: var(--r); cursor: pointer; background: var(--white); width: 100%; font: inherit; color: var(--text); text-align: left; }
.plan-opt + .plan-opt { margin-top: var(--s3); }
.plan-opt .row-text { flex: 1; }
.plan-opt .price { font-size: var(--t-md); font-weight: 700; font-variant-numeric: tabular-nums; }
.plan-opt.current { border-color: var(--ink); background: var(--ink-soft); }
.plan-opt input { width: 22px; height: 22px; accent-color: var(--ink); }

.menu { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.menu li { border-bottom: 1px solid var(--line); }
.menu a, .menu button { display: flex; align-items: center; gap: var(--s3); min-height: 56px; width: 100%; color: var(--text); text-decoration: none; font: inherit; font-weight: 600; background: none; border: 0; padding: 0; cursor: pointer; text-align: left; }
.menu .icon { color: var(--text-2); }
.menu .grow { flex: 1; min-width: 0; }
.menu .row-sub { overflow: hidden; text-overflow: ellipsis; }
.menu .chev { color: var(--muted); }
.card { border: 1px solid var(--line); border-radius: var(--r); padding: var(--s4); }
.pre { white-space: pre-wrap; }
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: var(--s4); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); }
.preview-table { border-collapse: collapse; width: 100%; font-size: var(--t-sm); }
.preview-table th, .preview-table td { padding: var(--s2) var(--s3); border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.preview-table th { background: var(--surface); font-weight: 600; }
.preview-table tr.bad td { background: var(--due-bg); }
.preview-table tr.dup td { background: var(--part-bg); }

.auth { max-width: 420px; margin: 0 auto; padding: var(--s10) var(--s4); }
.auth .brand { font-weight: 700; color: var(--ink); font-size: var(--t-xl); letter-spacing: -.02em; margin-bottom: var(--s2); }
.auth .lead { color: var(--text-2); font-size: var(--t-md); margin-bottom: var(--s8); }

/* skeleton */
.skeleton { background: var(--surface); border-radius: var(--r); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; } }
.htmx-indicator { opacity: 0; transition: opacity .15s; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }
[data-hide-without-share] { display: none; }
.can-share [data-hide-without-share] { display: inline-flex; }
.can-share [data-only-without-share] { display: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media print {
  .tabs, .topbar, .fab, .toasts, .no-print, .btn, .btn-2, .btn-q, .chips, form { display: none !important; }
  .page { padding: 0; max-width: none; }
  .share-text { border: 0; background: none; max-height: none; overflow: visible; padding: 0; font-size: 12pt; }
  body { color: #000; }
}

/* ---------- Ops Console: same tokens, denser ---------- */
.ops { font-size: var(--t-base); }
.ops-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s6); padding: var(--s2) var(--s6); border-bottom: 1px solid var(--line); background: var(--white); position: sticky; top: 0; z-index: 10; }
.ops-bar .brand { display: inline-flex; align-items: center; gap: 6px; min-height: 48px; font-weight: 700; color: var(--ink); text-decoration: none; font-size: var(--t-md); }
.ops-bar nav { display: flex; flex-wrap: wrap; gap: var(--s1); }
.ops-bar nav a { display: inline-flex; align-items: center; min-height: 48px; padding: 0 var(--s3); border-radius: var(--r); color: var(--text-2); text-decoration: none; font-weight: 600; }
.ops-bar nav a[aria-current="page"] { background: var(--ink-soft); color: var(--ink); }
.ops-main { padding: var(--s6); max-width: 1400px; margin: 0 auto; }
.ops-main h1 { margin-bottom: var(--s4); }
.ops-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); border: 1px solid var(--line); border-radius: var(--r); }
.ops-stats > div { padding: var(--s4); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 0 -1px -1px 0; }
.ops-stats a { text-decoration: none; color: inherit; display: block; }
.ops-stats .label { display: block; color: var(--text-2); font-size: var(--t-sm); font-weight: 600; }
.ops-stats .fig { display: block; font-size: var(--t-lg); font-weight: 600; font-variant-numeric: tabular-nums; margin-top: var(--s1); }
.ops-filters { display: flex; flex-wrap: wrap; gap: 0 var(--s3); align-items: flex-start; }
.ops-filters .field { flex: 1 1 160px; margin-bottom: var(--s3); }
.ops-filters .field:first-child { flex: 2 1 260px; }
.ops-filters input, .ops-filters select { min-height: 48px !important; font-size: var(--t-base) !important; padding: var(--s2) var(--s3) !important; }
table.data { border-collapse: separate; border-spacing: 0; width: 100%; font-size: var(--t-sm); }
table.data th, table.data td { padding: var(--s2) var(--s3); border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; white-space: nowrap; }
table.data th { background: var(--surface); font-weight: 600; color: var(--text-2); position: sticky; top: 0; z-index: 1; }
table.data th.right, table.data td.right { text-align: right; }
table.data tbody tr:hover td { background: #fafbfc; }
table.data .status { min-height: 22px; font-size: 13px; padding: 0 8px; }
.table-wrap.sticky { max-height: 70vh; overflow: auto; }
.ops-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: var(--s4); margin-top: var(--s4); align-items: start; }
.ops-grid .card h3 { font-size: var(--t-base); }

/* People rows: on narrow phones the Add button shows only its icon so names and amounts fit */
@media (max-width: 420px) {
  .row-add { min-width: 44px; width: 44px; height: 44px; padding: 0; border-radius: 50%; }
  .row-add .lbl { display: none; }
  .row .status { padding: 0 8px; }
}
.done-flag { color: var(--ok) !important; font-weight: 600; }
.remind-card { padding: var(--s4) 0; border-top: 1px solid var(--line); }
.remind-card .share-text { max-height: 9.5em; font-size: var(--t-sm); margin: var(--s3) 0; }

/* ---------- invitations ---------- */
.counts { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-radius: var(--r); }
.counts > div { padding: var(--s3); text-align: left; }
.counts > div + div { border-left: 1px solid var(--line); }
.counts .label { display: block; font-size: var(--t-sm); color: var(--text-2); font-weight: 600; }
.counts .fig { display: block; font-size: var(--t-lg); font-weight: 600; font-variant-numeric: tabular-nums; }
@media (max-width: 380px) { .counts .label { font-size: 13px; } .counts > div { padding: var(--s2); } }
.card-canvas { display: block; width: 100%; height: auto; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); aspect-ratio: var(--ar, 3 / 4); }
.card-wrap { max-width: 380px; margin: 0 auto var(--s4); }
/* Card design picker: a swipeable strip of designs above one large preview */
.tpl-strip { display: flex; gap: var(--s3); overflow-x: auto; scroll-snap-type: x mandatory; margin: var(--s2) calc(-1 * var(--s4)) 0; padding: 4px var(--s4) var(--s3); scroll-padding: 0 var(--s4); scrollbar-width: thin; }
.tpl { position: relative; flex: none; width: 116px; scroll-snap-align: start; display: block; text-decoration: none; color: var(--text); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--white); }
.tpl img { display: block; width: 100%; height: auto; aspect-ratio: 3 / 4; object-fit: contain; background: var(--surface); padding: 4px; }
.tpl span { display: block; padding: var(--s2); font-weight: 600; font-size: var(--t-sm); line-height: 1.25; min-height: 48px; }
.tpl[aria-current="true"] { border-color: var(--ink); box-shadow: 0 0 0 2px var(--ink); }
.tpl-tag { position: absolute; top: 6px; left: 6px; background: var(--ink); color: var(--white); font-style: normal; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: var(--r-full); }
.design-preview { margin-top: var(--s3); }
.design-preview .card-canvas { width: auto; height: auto; max-width: 100%; max-height: 62vh; margin: 0 auto; aspect-ratio: auto; }
.preview-nav { display: flex; align-items: center; gap: var(--s3); margin-top: var(--s3); }
.preview-nav p { flex: 1; min-width: 0; margin: 0; text-align: center; line-height: 1.3; }
.preview-nav p > * { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn { width: 48px; min-width: 48px; padding: 0; flex: none; }
.flip .icon { transform: scaleX(-1); }
.progress-line { font-weight: 600; color: var(--text-2); }
.checkin-result { border-radius: var(--r); padding: var(--s5); margin-bottom: var(--s4); border: 1px solid var(--line); }
.checkin-result h2 { font-size: var(--t-xl); margin: var(--s1) 0; }
.checkin-result.ok { background: var(--ok-bg); border-color: #b9dcc5; }
.checkin-result.ok .badge-word { color: var(--ok); }
.checkin-result.already { background: var(--part-bg); border-color: #f0dcae; }
.checkin-result.already .badge-word { color: var(--part); }
.checkin-result.not_found { background: var(--due-bg); border-color: #f1c6be; }
.checkin-result.not_found .badge-word { color: var(--due); }
.badge-word { font-weight: 700; font-size: var(--t-md); }
.admits { font-size: var(--t-lg); font-weight: 600; }
#scanner { margin-bottom: var(--s4); }
#scanner video { width: 100%; max-height: 60vh; border-radius: var(--r); background: #000; object-fit: cover; }
.number-input { font-size: var(--t-xl) !important; font-weight: 600; letter-spacing: .05em; text-align: center; font-variant-numeric: tabular-nums; }
.check-row { display: flex; align-items: center; gap: var(--s3); min-height: 60px; border-top: 1px solid var(--line); cursor: pointer; }
.check-row input { width: 24px; height: 24px; accent-color: var(--ink); flex: none; }
.call-actions { display: flex; gap: var(--s2); flex-wrap: wrap; margin-top: var(--s2); }
@media print { .call-actions, .tel-link .icon { display: none !important; } .call-list .row { min-height: 0; padding: 4px 0; } }
.badge-word { display: inline-flex; align-items: center; gap: 6px; }
.tiles + .tiles { margin-top: var(--s3); }
.tile-link { display: block; color: inherit; text-decoration: none; min-height: 48px; }
.tile-link .label { color: var(--ink); display: flex; align-items: center; gap: 2px; font-weight: 600; }
.checkin-result.ask { background: var(--ink-soft); border-color: #c9d7e8; }
.checkin-result.ask .badge-word { color: var(--ink); }
.checkin-result .btn-row form { flex: 1 1 140px; }

/* Guests: secondary tools in an even 2-column grid under the one primary button */
.tool-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); }
.tool-grid > .btn-2 { padding: 0 var(--s3); font-size: var(--t-base); white-space: nowrap; }
/* Guests: the contribution rule as a small bordered strip */
.rule-box { border: 1px solid var(--line); border-radius: var(--r); padding: var(--s2) var(--s4) var(--s4); }
.rule-box .tiles { margin-top: var(--s1); }
.rule-box .fig { font-size: var(--t-md); }
/* Check-in: arrivals figure sits between the last result and the scan button */
.summary.arrivals { margin-bottom: var(--s5); }
.checkin-result + .summary.arrivals { margin-top: var(--s5); }

/* Ops: card designs list and the drag-the-boxes editor */
.ops-designs { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--s4); margin-top: var(--s4); }
.ops-design { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; color: inherit; text-decoration: none; background: var(--white); }
.ops-design img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: contain; background: var(--surface); padding: var(--s2); }
.ops-design.off img { opacity: .55; }
.ops-design-text { display: flex; flex-direction: column; gap: 2px; padding: var(--s3); }
.ops-design-meta { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; margin-top: var(--s1); }
.designer { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: var(--s6); align-items: start; }
@media (max-width: 960px) { .designer { grid-template-columns: minmax(0, 1fr); } }
.designer-stage-col { position: sticky; top: 72px; }
@media (max-width: 960px) { .designer-stage-col { position: static; } }
.designer-stage { position: relative; max-width: 640px; margin: 0 auto; touch-action: none; user-select: none; }
.designer-stage canvas { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.designer-box { position: absolute; padding: 0; margin: 0; background: rgba(94, 42, 92, .06); border: 1.5px dashed rgba(94, 42, 92, .55); border-radius: 4px; cursor: move; min-height: 12px; font: inherit; }
.designer-box.on { border: 2px solid var(--ink); background: rgba(94, 42, 92, .1); z-index: 2; }
.designer-box-label { position: absolute; left: -2px; bottom: 100%; background: var(--ink); color: var(--white); font-size: 12px; font-weight: 600; padding: 1px 6px; border-radius: 4px 4px 0 0; white-space: nowrap; opacity: 0; pointer-events: none; }
.designer-box.on .designer-box-label, .designer-box:hover .designer-box-label { opacity: 1; }
.designer-handle { position: absolute; right: -9px; bottom: -9px; width: 18px; height: 18px; border-radius: 50%; background: var(--white); border: 2px solid var(--ink); cursor: nwse-resize; display: none; }
.designer-box.on .designer-handle { display: block; }
.designer-panel h2 { margin-bottom: var(--s3); }
.designer-zones { display: flex; flex-wrap: wrap; gap: var(--s2); margin-bottom: var(--s4); }
.designer-zones .chip.off { color: var(--muted); border-style: dashed; }
.designer-props { padding: var(--s4); border: 1px solid var(--line); border-radius: var(--r); }
.designer-props h3 { margin-bottom: var(--s2); }
.designer-props input[type=color] { width: 100%; height: 48px; border: 1px solid var(--line); border-radius: var(--r); background: var(--white); padding: 4px; }
/* Event colours: user-chosen swatches (the one place colours come from data, via --c) */
.swatch { width: 22px; height: 22px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .22); flex: none; }
.colour-picked { list-style: none; counter-reset: colour; display: flex; flex-wrap: wrap; gap: var(--s2); margin: 0 0 var(--s3); padding: 0; }
.colour-picked li { counter-increment: colour; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 var(--s3) 0 var(--s2); border: 1px solid var(--line); border-radius: var(--r-full); font-weight: 600; font-size: var(--t-sm); }
.colour-picked li:not(.muted)::before { content: counter(colour); color: var(--muted); font-variant-numeric: tabular-nums; }
.colour-picked li.muted { font-weight: 400; border-style: dashed; }
.colour-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(136px, 1fr)); gap: var(--s2); }
.colour-opt { position: relative; display: flex; align-items: center; gap: var(--s2); min-height: 48px; padding: 0 var(--s3); border: 1px solid var(--line); border-radius: var(--r); cursor: pointer; font-size: var(--t-sm); font-weight: 600; }
.colour-opt input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.colour-opt:has(input:checked) { border-color: var(--ink); background: var(--ink-soft); color: var(--ink); }
.colour-opt:has(input:focus-visible) { outline: 3px solid var(--ink); outline-offset: 2px; }
.colour-own { margin-top: var(--s3); }
.colour-own summary { min-height: 48px; display: flex; align-items: center; color: var(--ink); font-weight: 600; cursor: pointer; }
.colour-own-row { display: flex; gap: var(--s3); align-items: flex-end; }
.colour-own input[type=color] { width: 72px; height: 52px; border: 1px solid var(--line); border-radius: var(--r); background: var(--white); padding: 4px; }
/* Event colours strip on the event home */
.event-colours { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s3); margin-top: var(--s2); font-size: var(--t-sm); color: var(--text-2); }
.event-colours span { display: inline-flex; align-items: center; gap: 6px; }
.event-colours .swatch { width: 16px; height: 16px; }
.designer-box.custom { border-color: rgba(31, 106, 58, .6); background: rgba(31, 106, 58, .05); }
.designer-zones .chip.custom { border-style: dotted; }
.designer-props code { font-size: 13px; background: var(--surface); padding: 0 4px; border-radius: 4px; }
