/* RSVPkey. Layout: one phone-width column, an immersive colour-washed cover per event,
   quiet glass cards underneath, and a paper ticket for the kitchen. */
:root {
  --bg: #120d14;
  --ink: #f6f1f4;
  --muted: #b3a8b4;
  --card: rgba(255, 255, 255, 0.065);
  --card-strong: rgba(255, 255, 255, 0.11);
  --line: rgba(255, 255, 255, 0.11);
  --good: #7ddc9a;
  --bad: #ff8d8d;
  --paper: #fbf7ee;
  --paper-ink: #1d1a17;
  /* theme, overridden per event */
  --c1: #ff6a3d;
  --c2: #c2185b;
  --c3: #3b0a45;
  --cover-ink: #fff4ec;
  --display: 'Bricolage Grotesque', 'Avenir Next', 'Segoe UI', system-ui, sans-serif;
  --body: 'Instrument Sans', -apple-system, 'Segoe UI', Roboto, system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --r: 22px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.45 var(--body);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
body.no-scroll { overflow: hidden; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3, .cover-title { font-family: var(--display); text-wrap: balance; letter-spacing: -0.02em; line-height: 1.05; }
h1 { font-size: 2rem; font-weight: 800; }
.h2 { font-size: 1.35rem; font-weight: 700; }
.h3 { font-size: 1.05rem; font-weight: 700; margin-top: 10px; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--c1); outline-offset: 2px; }

.muted { color: var(--muted); }
.center { text-align: center; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
.lead { font-size: 1.15rem; font-weight: 600; }
.prose { white-space: pre-wrap; }
.error { color: var(--bad); font-size: 0.92rem; }
.note { background: var(--card); border: 1px dashed var(--line); border-radius: 14px; padding: 10px 14px; font-size: 0.92rem; color: var(--muted); white-space: pre-wrap; }
.eyebrow, .mini-label { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; }
.mini-label { color: var(--muted); display: flex; justify-content: space-between; gap: 12px; }
.mini-label span { text-align: end; }

/* ---------- layout ---------- */
.page {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding-block: calc(16px + env(safe-area-inset-top, 0px)) calc(110px + env(safe-area-inset-bottom, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.center-page { min-height: 100dvh; justify-content: center; align-items: center; }
.event, .wizard { min-height: 100dvh; background:
  radial-gradient(90% 50% at 15% 0%, color-mix(in srgb, var(--c2) 34%, transparent), transparent 70%),
  radial-gradient(70% 40% at 100% 12%, color-mix(in srgb, var(--c1) 22%, transparent), transparent 70%),
  var(--bg); }
.row { display: flex; align-items: center; }
.gap { gap: 8px; }
.wrap { flex-wrap: wrap; }
.end { justify-content: flex-end; }
.between { justify-content: space-between; }
.grow { flex: 1 1 0; min-width: 0; }
.two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.block { width: 100%; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.pad { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.pad.center { align-items: center; }
.list > * + * { border-top: 1px solid var(--line); }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 46px; padding: 0 18px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card-strong);
  font-weight: 600; text-decoration: none; white-space: nowrap;
  transition: transform 0.12s ease, background 0.15s ease;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.primary { background: var(--ink); color: #17111a; border-color: transparent; }
.btn.ghost { background: transparent; }
.btn.danger { background: transparent; color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, transparent); }
.btn.ok, .btn.on { background: color-mix(in srgb, var(--good) 22%, transparent); border-color: color-mix(in srgb, var(--good) 50%, transparent); }
.btn.sm { min-height: 38px; padding: 0 14px; font-size: 0.9rem; }
.btn.xs { min-height: 32px; padding: 0 12px; font-size: 0.82rem; }
.btn.big { min-height: 56px; padding: 0 30px; font-size: 1.08rem; }
.icon-btn { flex: none; width: 38px; height: 38px; border-radius: 50%; border: 0; background: transparent; color: var(--muted); font-size: 0.95rem; }
.icon-btn:hover { background: var(--card-strong); color: var(--ink); }
.pill { border: 0; border-radius: 999px; padding: 8px 14px; background: rgba(0, 0, 0, 0.32); color: #fff; font-weight: 600; font-size: 0.9rem; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 0.88rem; font-weight: 600; }
.field-hint { font-size: 0.84rem; color: var(--muted); }
.input {
  width: 100%; min-width: 0; min-height: 48px; padding: 11px 14px;
  background: rgba(0, 0, 0, 0.28); border: 1px solid var(--line); border-radius: 14px;
}
.input::placeholder { color: color-mix(in srgb, var(--muted) 70%, transparent); }
.input:focus { outline: none; border-color: var(--c1); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c1) 28%, transparent); }
textarea.input { resize: vertical; }
.input.big { font-size: 1.15rem; min-height: 56px; }
.input.price { width: 84px; flex: none; text-align: end; font-variant-numeric: tabular-nums; }
.input.title-input { font-family: var(--display); font-weight: 700; font-size: 1.1rem; }
.input.code-input { font-family: var(--mono); letter-spacing: 0.14em; text-transform: uppercase; }
select.input { appearance: none; }

.seg { display: flex; padding: 4px; gap: 4px; background: rgba(0, 0, 0, 0.3); border-radius: 999px; border: 1px solid var(--line); }
.seg button { flex: 1; min-height: 40px; border: 0; border-radius: 999px; background: transparent; font-weight: 600; font-size: 0.92rem; color: var(--muted); }
.seg button.on { background: var(--ink); color: #17111a; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 42px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); font-weight: 500; }
.chip.on { background: var(--ink); color: #17111a; border-color: transparent; font-weight: 600; }
.chip-price { opacity: 0.7; font-size: 0.86em; }

.stepper { display: flex; align-items: center; gap: 4px; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--line); border-radius: 999px; padding: 4px; }
.step-btn { width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--card-strong); font-size: 1.2rem; line-height: 1; }
.step-btn:disabled { opacity: 0.35; }
.step-val { min-width: 28px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }

.toggle { flex: none; width: 54px; height: 32px; border-radius: 999px; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.35); padding: 3px; display: flex; transition: background 0.2s; }
.toggle.on { background: var(--good); }
.toggle-knob { width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform 0.2s; }
.toggle.on .toggle-knob { transform: translateX(22px); }
[dir="rtl"] .toggle.on .toggle-knob { transform: translateX(-22px); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.switch-row > div:first-child { display: flex; flex-direction: column; min-width: 0; }
.switch-row .muted { font-size: 0.88rem; }

.tag { display: inline-block; align-self: flex-start; padding: 2px 9px; border-radius: 999px; background: var(--card-strong); font-size: 0.76rem; font-weight: 600; white-space: nowrap; }
.tag.ok { background: color-mix(in srgb, var(--good) 24%, transparent); color: var(--good); }
.avatar { flex: none; width: 38px; height: 38px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 0.82rem; font-weight: 700; color: #fff; background: hsl(var(--h) 55% 42%); border: 2px solid var(--bg); }
.chev { color: var(--muted); font-size: 1.3rem; }

.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--ink); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- cover ---------- */
.cover {
  position: relative; border-radius: 32px; overflow: hidden; color: var(--cover-ink);
  min-height: min(64dvh, 500px); display: flex; isolation: isolate;
  background:
    radial-gradient(80% 60% at 20% 15%, var(--c1), transparent 65%),
    radial-gradient(90% 70% at 90% 30%, var(--c2), transparent 70%),
    var(--c3);
  box-shadow: 0 30px 60px -30px color-mix(in srgb, var(--c2) 70%, transparent);
}
.cover-sm { min-height: 230px; border-radius: 26px; }
.cover-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; }
.cover-art { position: absolute; inset: 0 0 34% 0; display: grid; place-items: center; z-index: -2; }
.cover-emoji { font-size: clamp(110px, 38vw, 190px); line-height: 1; filter: drop-shadow(0 24px 30px rgba(0, 0, 0, 0.35)); animation: float 6s ease-in-out infinite; }
.cover-sm .cover-art { inset: 0 0 0 46%; }
.cover-sm .cover-emoji { font-size: 96px; }
@keyframes float { 50% { transform: translateY(-10px) rotate(-4deg); } }
.cover-shade { position: absolute; inset: 0; z-index: -1; background: linear-gradient(to top, color-mix(in srgb, var(--c3) 92%, #000) 4%, transparent 62%); }
.cover.has-img .cover-shade { background: linear-gradient(to top, rgba(0, 0, 0, 0.82) 8%, rgba(0, 0, 0, 0.05) 60%, rgba(0, 0, 0, 0.3)); }
.cover-body { position: relative; flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 6px; padding: 18px 20px 22px; min-width: 0; }
.cover-top { position: absolute; top: 14px; left: 14px; right: 14px; display: flex; justify-content: space-between; }
.cover-title { font-size: clamp(2.2rem, 10vw, 3.3rem); font-weight: 800; overflow-wrap: anywhere; }
.cover-sm .cover-title { font-size: 1.9rem; max-width: 62%; }
.cover-meta { font-weight: 500; opacity: 0.92; }

/* ---------- home ---------- */
.home { background: radial-gradient(80% 36% at 50% 0%, rgba(124, 58, 237, 0.38), transparent 70%); gap: 20px; }
.hero { position: relative; isolation: isolate; overflow: hidden; border-radius: 32px; min-height: min(78dvh, 600px); display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-start; gap: 12px; padding: 22px 20px 24px; background: #1a0f1c; }
.hero-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top; z-index: -2; }
.hero::after { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(to top, #120d14 30%, rgba(18, 13, 20, 0.9) 48%, rgba(18, 13, 20, 0.35) 66%, transparent 80%); }
.hero h1 { font-size: clamp(2.6rem, 12vw, 3.6rem); }
.hero-sub { color: var(--muted); font-size: 1.08rem; max-width: 34ch; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-family: var(--display); font-weight: 700; letter-spacing: 0.02em; color: #e9d5ff; }
.brand img { width: 28px; height: 28px; border-radius: 8px; }
.mine { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.mine-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 20px; border: 0; text-align: start; color: var(--cover-ink);
  background: linear-gradient(110deg, color-mix(in srgb, var(--c2) 80%, #000), var(--c3)); }
.mine-emoji { font-size: 1.9rem; }
.mine-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mine-text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mine-text span { font-size: 0.86rem; opacity: 0.85; }
.mine-card .tag { align-self: center; background: rgba(0, 0, 0, 0.3); font-family: var(--mono); }
.features { display: grid; gap: 14px; padding: 6px 4px; }
.feature { display: flex; gap: 14px; align-items: flex-start; }
.feature > span { font-size: 1.5rem; width: 34px; text-align: center; }
.feature p { font-size: 0.92rem; }

/* ---------- wizard ---------- */
.wizard { max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px;
  padding-block: calc(12px + env(safe-area-inset-top, 0px)) calc(120px + env(safe-area-inset-bottom, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.wiz-top { display: flex; justify-content: space-between; align-items: center; }
.wiz-count { color: var(--muted); font-size: 0.88rem; font-variant-numeric: tabular-nums; }
.progress { height: 5px; border-radius: 99px; background: var(--card-strong); overflow: hidden; }
.progress-bar { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--c1), var(--c2)); transition: width 0.35s ease; }
.wiz-nav { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.wiz-nav .chip { flex: none; }
.wiz-head { display: flex; flex-direction: column; gap: 6px; padding-top: 6px; }
.wiz-body { display: flex; flex-direction: column; gap: 16px; }
.wiz-foot { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; gap: 10px; justify-content: center;
  padding: 12px max(16px, env(safe-area-inset-right, 0px)) calc(12px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  background: linear-gradient(to top, var(--bg) 62%, transparent); }
.wiz-foot .btn.grow { max-width: 420px; }
.kind-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.kind { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 16px; min-height: 150px; border-radius: 24px; border: 2px solid transparent; text-align: start; color: var(--cover-ink);
  background: radial-gradient(90% 80% at 10% 0%, var(--c1), transparent 70%), radial-gradient(90% 80% at 100% 40%, var(--c2), transparent 75%), var(--c3); }
.kind.on { border-color: #fff; }
.kind-emoji { font-size: 2.6rem; line-height: 1; margin-bottom: auto; filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.3)); }
.kind-name { font-family: var(--display); font-weight: 700; font-size: 1.12rem; }
.kind-hint { font-size: 0.84rem; opacity: 0.88; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { width: 44px; height: 44px; border-radius: 50%; border: 3px solid transparent; background: linear-gradient(135deg, var(--c1), var(--c2) 60%, var(--c3)); }
.swatch.on { border-color: #fff; }
.emoji-row { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
.emoji-btn { flex: none; width: 48px; height: 48px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); font-size: 1.5rem; }
.emoji-btn.on { background: var(--ink); }
.callout { font-family: var(--display); font-weight: 700; font-size: 1.25rem; padding: 16px; border-radius: 18px; background: var(--card); border: 1px solid var(--line); }
.hits { list-style: none; margin: -8px 0 0; padding: 0; border-radius: 16px; overflow: hidden; border: 1px solid var(--line); background: #1e1622; }
.hits li + li { border-top: 1px solid var(--line); }
.hits button { width: 100%; padding: 12px 14px; border: 0; background: transparent; text-align: start; display: flex; flex-direction: column; }
.hits button:hover { background: var(--card-strong); }
.hits span { font-size: 0.86rem; color: var(--muted); }
.map { aspect-ratio: 16 / 10; max-width: 100%; border-radius: 18px; overflow: hidden; background: #1e1622; }
.card > .map { border-radius: 0; }
.map iframe { width: 100%; height: 100%; border: 0; display: block; }
.editor { padding: 14px; display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
.editor > .btn { align-self: flex-start; white-space: normal; text-align: start; min-height: 38px; padding-block: 8px; }
.edit-row { display: flex; gap: 6px; align-items: center; }
.mod-edit { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 16px; background: rgba(0, 0, 0, 0.22); border: 1px dashed var(--line); }
.mod-edit > .btn { align-self: flex-start; }
.review-row { width: 100%; display: grid; grid-template-columns: 96px 1fr auto; gap: 10px; align-items: center; padding: 14px 16px; border: 0; background: transparent; text-align: start; }
.review-row > span:nth-child(2) { min-width: 0; overflow-wrap: anywhere; font-weight: 500; }

/* ---------- event ---------- */
.tabbar { position: fixed; z-index: 6; left: 50%; transform: translateX(-50%); bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  display: flex; gap: 2px; padding: 6px; border-radius: 999px; max-width: calc(100vw - 20px);
  background: rgba(30, 22, 34, 0.82); border: 1px solid var(--line); backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px); box-shadow: 0 18px 40px -12px #000; }
.tab { display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 62px; padding: 7px 10px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font-size: 0.72rem; font-weight: 600; }
.tab-icon { font-size: 1.15rem; line-height: 1.2; filter: grayscale(1) opacity(0.75); }
.tab.on { background: var(--ink); color: #17111a; }
.tab.on .tab-icon { filter: none; }
.act-as { position: sticky; top: 0; z-index: 7; display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 16px 8px; background: var(--c1); color: #17111a; }
.tab-head { display: flex; flex-direction: column; gap: 4px; padding: 14px 4px 2px; }
.announce { border-color: color-mix(in srgb, var(--c1) 60%, transparent); background: color-mix(in srgb, var(--c1) 14%, transparent); }
.host-bar { flex-direction: row; flex-wrap: wrap; justify-content: space-between; align-items: center; }
.next-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.next { align-items: flex-start; text-align: start; gap: 4px; color: inherit; }
.next .muted { font-size: 0.86rem; }
.next-icon { font-size: 1.6rem; }
.who { flex-direction: row; align-items: center; width: 100%; color: inherit; font-weight: 600; text-align: start; }
.who > span:nth-child(2) { flex: 1; }
.avatars { display: flex; }
.avatars .avatar { margin-inline-end: -10px; }
.avatars:not(:empty) { margin-inline-end: 14px; }
.rsvp-btns { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 8px; }
.rsvp-btns .btn { padding: 0 8px; }

.lines { list-style: none; margin: 0; padding: 0; }
.line { display: flex; align-items: center; gap: 8px; padding: 8px 0; }
.line + .line { border-top: 1px solid var(--line); }
.line-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; align-items: flex-start; text-align: start; border: 0; background: transparent; padding: 0; }
.line-main .muted, .guest-text .muted, .bring-text .muted, .menu-text .muted { font-size: 0.86rem; }
.gone { color: var(--muted); text-decoration: line-through; }
.bill-row { display: flex; justify-content: space-between; gap: 14px; }
.bill-row .muted { font-size: 0.84rem; }
.bill-row.total { padding-top: 10px; border-top: 1px solid var(--line); font-family: var(--display); font-size: 1.3rem; font-weight: 700; }
.menu-sec { display: flex; flex-direction: column; gap: 8px; }
.menu-item { width: 100%; display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 0; background: transparent; text-align: start; }
.menu-item:not(:disabled):hover { background: var(--card); }
.menu-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.add { flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--ink); color: #17111a; font-weight: 700; font-size: 1.2rem; }
.menu-item:disabled .add { display: none; }

.bring-item, .guest { display: flex; align-items: center; gap: 12px; padding: 12px 16px; }
.guest { align-items: flex-start; }
.bring-text, .guest-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; overflow-wrap: break-word; }
.count { font-family: var(--mono); font-size: 0.86rem; padding: 3px 8px; border-radius: 8px; background: var(--card-strong); }
.count.ok { background: color-mix(in srgb, var(--good) 24%, transparent); color: var(--good); }
.bring-item.full strong { color: var(--muted); }
.guest-tools { margin-top: 6px; }

/* ---------- sheets + toasts ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-end; justify-content: center; background: rgba(0, 0, 0, 0.6); animation: fade 0.18s ease; }
.sheet { width: 100%; max-width: 560px; max-height: 92dvh; display: flex; flex-direction: column; background: #1c1520; border: 1px solid var(--line); border-bottom: 0; border-radius: 28px 28px 0 0; animation: rise 0.26s cubic-bezier(0.2, 0.9, 0.3, 1); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 12px 6px 20px; }
.sheet-head h2 { font-size: 1.3rem; }
.sheet-body { overflow-y: auto; padding: 8px 20px calc(22px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 14px; }
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
@media (min-width: 700px) { .sheet-wrap { align-items: center; } .sheet { border-radius: 28px; border-bottom: 1px solid var(--line); } }
.share-qr { align-self: center; padding: 10px; background: #fff; border-radius: 20px; line-height: 0; }
.code { text-align: center; font-family: var(--mono); font-weight: 700; font-size: 1.7rem; letter-spacing: 0.14em; }
.share-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.host-link { background: rgba(0, 0, 0, 0.25); }
.host-link .btn { align-self: flex-start; }
.toasts { position: fixed; z-index: 40; left: 0; right: 0; top: calc(14px + env(safe-area-inset-top, 0px)); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { padding: 10px 18px; border-radius: 999px; background: var(--ink); color: #17111a; font-weight: 600; font-size: 0.92rem; box-shadow: 0 12px 30px -8px #000; animation: rise 0.25s ease; }

/* ---------- kitchen ticket ---------- */
.ticket { background: var(--paper); color: var(--paper-ink); font-family: var(--mono); font-size: 0.92rem; line-height: 1.4; padding: 22px 18px 26px; border-radius: 6px;
  --notch: radial-gradient(circle at 8px -2px, transparent 7px, #000 7.5px);
  -webkit-mask: var(--notch) 0 100% / 16px 100%; mask: var(--notch) 0 100% / 16px 100%;
  display: flex; flex-direction: column; gap: 16px; }
.ticket p { margin: 0; }
.ticket-head { text-align: center; padding-bottom: 14px; border-bottom: 2px dashed currentColor; }
.ticket-title { font-family: var(--display); font-weight: 800; font-size: 1.5rem; letter-spacing: -0.01em; }
.ticket-sec { display: flex; flex-direction: column; gap: 10px; padding-top: 14px; border-top: 1px dashed currentColor; }
.ticket-head + .ticket-sec { border-top: 0; padding-top: 0; }
.ticket-label { font-size: 0.74rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; }
.ticket-item { display: flex; flex-direction: column; gap: 6px; break-inside: avoid; }
.ticket-dish { font-weight: 700; font-size: 1.2em; }
.qty { display: inline-block; min-width: 2.2em; font-weight: 700; }
.ticket-variant { display: flex; gap: 4px; padding-inline-start: 1.2em; }
.ticket-variant .qty { min-width: 1.6em; }
.ticket-who { opacity: 0.68; font-size: 0.9em; }
.ticket-people { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.ticket-person { border: 1.5px dashed currentColor; border-radius: 4px; padding: 12px; display: flex; flex-direction: column; gap: 8px; break-inside: avoid; }
.ticket-line { display: flex; gap: 8px; }
.box { flex: none; width: 1em; height: 1em; margin-top: 0.2em; border: 1.5px solid currentColor; }
.ticket-alert { font-weight: 700; }
.ticket-bring { display: flex; justify-content: space-between; gap: 12px; }
.ticket-bring .ticket-who { text-align: end; }
.ticket-empty { text-align: center; padding: 20px 0; opacity: 0.7; }
.ticket-foot { text-align: center; font-size: 0.74rem; opacity: 0.6; padding-top: 12px; border-top: 2px dashed currentColor; }
.ticket-big { font-size: 1.3rem; }

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

@media print {
  @page { margin: 10mm; }
  body, .event { background: #fff !important; min-height: 0; }
  .no-print, .tabbar, .act-as, .toasts, .sheet-wrap { display: none !important; }
  .page { max-width: none; padding: 0; }
  .ticket { -webkit-mask: none; mask: none; background: #fff; color: #000; padding: 0; font-size: 11pt; }
  .ticket-big { font-size: 15pt; }
  .ticket-people { grid-template-columns: repeat(3, 1fr); }
}

.kitchen-tools { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kitchen-tools .seg { grid-column: 1 / -1; }

/* photo art */
.kind.kind-art { position: relative; overflow: hidden; isolation: isolate; background: radial-gradient(90% 80% at 10% 0%, color-mix(in srgb, var(--c1) 45%, transparent), transparent 70%), var(--c3); }
.kind-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 30%; z-index: -2; }
.kind.kind-art::after { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(to top, rgba(0, 0, 0, 0.88) 18%, transparent 68%); }
.art-btn { flex: none; width: 48px; height: 48px; padding: 0; border-radius: 14px; border: 2px solid var(--line); overflow: hidden; background: var(--card); }
.art-btn img { width: 100%; height: 100%; object-fit: cover; object-position: center 35%; display: block; }
.art-btn.on { border-color: #fff; }
.mine-thumb { flex: none; width: 44px; height: 44px; border-radius: 12px; overflow: hidden; background: rgba(0, 0, 0, 0.3); }
.mine-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: center 35%; display: block; }

/* pin-drop map */
.pinmap { aspect-ratio: 4 / 3; z-index: 0; cursor: crosshair; font: inherit; }
.pinmap .leaflet-control-attribution { font-size: 10px; }
.pin { background: none; border: 0; }
.pin span { display: block; width: 34px; height: 34px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--c1); border: 3px solid #fff; box-shadow: 0 6px 14px rgba(0, 0, 0, 0.45); position: relative; }
.pin span::after { content: ''; position: absolute; inset: 8px; border-radius: 50%; background: #fff; }

/* polls */
.poll-opts { display: flex; flex-direction: column; gap: 8px; }
.poll-opt { position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 2px; padding: 11px 14px; border-radius: 14px; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.25); text-align: start; }
.poll-opt:disabled { cursor: default; }
.poll-opt.on { border-color: var(--ink); }
.poll-opt.win { border-color: var(--good); }
.poll-bar { position: absolute; inset: 0 auto 0 0; background: color-mix(in srgb, var(--c1) 30%, transparent); transition: width 0.3s ease; }
.poll-row, .poll-who { position: relative; }
.poll-row { display: flex; justify-content: space-between; gap: 12px; }
.poll-who { font-size: 0.82rem; color: var(--muted); }

.seg button:disabled { cursor: default; opacity: 0.55; }
.seg button.on:disabled { opacity: 1; }

/* offline notice */
.offline { position: sticky; top: calc(8px + env(safe-area-inset-top, 0px)); z-index: 8; box-shadow: 0 10px 24px -10px #000; display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 16px; background: #3a2a06; border: 1px solid #a37a12; color: #ffe8a3; font-size: 0.9rem; }
.offline strong { color: #fff3c9; }

/* ---------- Arabic / right-to-left ---------- */
[dir="rtl"] {
  --display: 'Readex Pro', 'IBM Plex Sans Arabic', 'Geeza Pro', 'Segoe UI', system-ui, sans-serif;
  --body: 'IBM Plex Sans Arabic', 'Geeza Pro', 'Segoe UI', Tahoma, system-ui, sans-serif;
}
[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3, [dir="rtl"] .cover-title, [dir="rtl"] .ticket-title { letter-spacing: 0; line-height: 1.25; }
[dir="rtl"] .eyebrow, [dir="rtl"] .mini-label, [dir="rtl"] .ticket-label { letter-spacing: 0; }
[dir="rtl"] .chev { transform: scaleX(-1); }
/* Codes, links, phone numbers and prices stay left-to-right inside Arabic text. */
.code, .code-input, .count, .num { unicode-bidi: plaintext; }
.lang { font-family: 'IBM Plex Sans Arabic', var(--body); }

/* ---------- small shared helpers ---------- */
.self-start { align-self: flex-start; }
.small { font-size: 0.86rem; }
.tag.warn { background: color-mix(in srgb, #f5b300 26%, transparent); color: #ffd56b; }
.warn-text { color: #ffd56b; }
.hero-top { position: absolute; top: 14px; inset-inline-end: 14px; z-index: 2; }

/* messages */
.msgs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.msg { display: flex; align-items: flex-start; gap: 10px; }
.msg .avatar { width: 32px; height: 32px; font-size: 0.72rem; }
.msg-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.msg-meta { font-size: 0.86rem; }
.msg-text { white-space: pre-wrap; overflow-wrap: anywhere; }

/* invite list */
.invite-rows { border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.invite-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.invite-row + .invite-row { border-top: 1px solid var(--line); }

/* payment details */
.pay-note { display: flex; flex-direction: column; gap: 6px; padding: 12px; border-radius: 14px; background: rgba(0, 0, 0, 0.25); border: 1px dashed var(--line); }

/* Text people type (names, titles, messages) takes its own direction, so English inside Arabic and
   Arabic inside English both read correctly. */
.msg-text, .msg-meta strong, .prose, .cover-title, .announce p:last-child, .guest-text strong, .bring-text strong, .menu-text strong, .poll-row strong, .line-main strong, .mine-text strong, .ticket-dish, .ticket-title { unicode-bidi: plaintext; }
/* Full-width buttons may wrap instead of running off the screen. */
.btn.block { white-space: normal; text-align: center; padding-block: 10px; line-height: 1.25; }

/* Smallest phones (320px wide): five tabs still fit. */
@media (max-width: 360px) {
  .tabbar { padding: 4px; gap: 0; }
  .tab { min-width: 0; padding: 6px 8px; font-size: 0.66rem; }
}

.phone { direction: ltr; unicode-bidi: isolate; white-space: nowrap; }

/* photos fade in once fully loaded */
.photo { opacity: 0; transition: opacity 0.35s ease; }
.photo.ready { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .photo { transition: none; } }
.kind.kind-art { background-clip: padding-box; }

/* date and time fields (see DateTime in wizard.js) */
.two > * { min-width: 0; }
.dt { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; cursor: pointer; }
.dt:focus-within { border-color: var(--c1); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c1) 28%, transparent); }
.dt-value, .dt-hint { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dt-hint { color: color-mix(in srgb, var(--muted) 75%, transparent); }
.dt-icon { flex: none; font-size: 0.95em; opacity: 0.7; }
.dt-native { position: absolute; inset: 0; width: 100%; height: 100%; min-width: 0; margin: 0; padding: 0; border: 0; opacity: 0; cursor: pointer; -webkit-appearance: none; appearance: none; font-size: 16px; }
.dt-off { opacity: 0.45; cursor: default; }
.dt-off .dt-native { cursor: default; }
@media (max-width: 400px) { .dt:not(.big) .dt-icon, .two .dt-icon { display: none; } .dt { padding-inline: 12px; } }

/* Belt and braces for iPhone: the invisible native picker can never widen or spill out of its box. */
.dt { overflow: hidden; contain: inline-size; width: 100%; max-width: 100%; box-sizing: border-box; }
.dt-native { max-width: 100%; box-sizing: border-box; color: transparent; background: transparent; }
.field { min-width: 0; max-width: 100%; }
.version { text-align: center; font-size: 0.72rem; color: var(--muted); opacity: 0.7; padding-top: 8px; }
