/* MingleUp — mobile first (works from 320 px), light and dark, big tap targets, plain system fonts. */
:root {
  --bg: #fbf8f3;
  --card: #ffffff;
  --ink: #17252b;
  --muted: #5d6b70;
  --line: #e6dfd4;
  --brand: #0e6f78;
  --brand-ink: #ffffff;
  --brand-soft: #dff1f1;
  --accent: #e8553a;
  --accent-soft: #fde6df;
  --sun: #ffc145;
  --ok: #1f7a3f;
  --ok-soft: #dcf2e3;
  --warn: #8a5a00;
  --warn-soft: #fff1cc;
  --danger: #b3261e;
  --shadow: 0 1px 2px rgb(23 37 43 / 6%), 0 4px 14px rgb(23 37 43 / 6%);
  --r: 14px;
  --tab-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0d1b20; --card: #15262c; --ink: #e8f0f1; --muted: #9db0b5; --line: #24393f; --brand: #4fc3c9; --brand-ink: #062226;
    --brand-soft: #143a3f; --accent: #ff8a70; --accent-soft: #3d2420; --ok: #6ed69a; --ok-soft: #173826; --warn: #ffd27a; --warn-soft: #3a2f12;
    --danger: #ff8b84; --shadow: 0 1px 2px rgb(0 0 0 / 30%); color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --bg: #0d1b20; --card: #15262c; --ink: #e8f0f1; --muted: #9db0b5; --line: #24393f; --brand: #4fc3c9; --brand-ink: #062226;
  --brand-soft: #143a3f; --accent: #ff8a70; --accent-soft: #3d2420; --ok: #6ed69a; --ok-soft: #173826; --warn: #ffd27a; --warn-soft: #3a2f12;
  --danger: #ff8b84; --shadow: 0 1px 2px rgb(0 0 0 / 30%); color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
.ic { width: 20px; height: 20px; flex: none; vertical-align: -4px; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 17px/1.45 system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom));
  overflow-x: hidden;
}
a { color: var(--brand); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; }
h1 { font-size: 1.6rem; letter-spacing: -.01em; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }
p { margin: .3em 0 .8em; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
.skip { position: absolute; left: -999px; top: 0; background: var(--card); padding: 8px; z-index: 50; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; }
.loading, .empty { color: var(--muted); text-align: center; padding: 2rem 1rem; }
.noscript { padding: 1rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- top bar & tabs ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px;
  padding: calc(8px + env(safe-area-inset-top)) 16px 8px; background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.2rem; color: var(--ink); text-decoration: none; }
.brand-mark { width: 30px; height: 30px; color: var(--brand); }
.topbar-gap { flex: 1; }
.city-chip { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 12px; font-size: .9rem; max-width: 55vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.city-chip .ic { width: 16px; height: 16px; flex: none; }
.tabbar {
  position: fixed; inset: auto 0 0 0; z-index: 20; display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--card); border-top: 1px solid var(--line);
}
.tabbar a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); text-decoration: none; font-size: .78rem; font-weight: 600; }
.tabbar svg { width: 26px; height: 26px; fill: currentColor; }
.tabbar a[aria-current='page'] { color: var(--brand); }
.badge { position: absolute; top: 6px; left: calc(50% + 6px); min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: #fff; font-size: .72rem; line-height: 20px; text-align: center; }

main { max-width: 760px; margin: 0 auto; padding: 16px 16px 24px; outline: none; }
.page-head { display: flex; align-items: center; gap: 10px; margin: 4px 0 12px; }
.page-head h1 { flex: 1; margin: 0; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); text-decoration: none; font-size: .95rem; margin-bottom: 8px; background: none; border: 0; padding: 4px 0; cursor: pointer; }
.back .ic { width: 18px; height: 18px; }
.section { margin: 22px 0 8px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.section-head h2 { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 10px; }
.hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; padding: 10px 18px;
  border-radius: 12px; border: 1px solid transparent; background: var(--brand); color: var(--brand-ink); font-weight: 700;
  text-decoration: none; cursor: pointer; -webkit-tap-highlight-color: transparent; text-align: center;
}
.btn:disabled { opacity: .55; cursor: default; }
.btn.secondary { background: var(--card); color: var(--ink); border-color: var(--line); }
.btn.ghost { background: transparent; color: var(--brand); border-color: transparent; }
.btn.danger { background: var(--card); color: var(--danger); border-color: var(--line); }
.btn.accent { background: var(--accent); color: #fff; }
.btn.small { min-height: 38px; padding: 6px 12px; font-size: .92rem; border-radius: 10px; }
.btn.block { display: flex; width: 100%; }
.btn .ic { width: 20px; height: 20px; }
.btn-icon { min-width: 44px; min-height: 44px; padding: 8px; }
.linkbtn { background: none; border: 0; color: var(--brand); font-weight: 600; padding: 6px 4px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; }
.btns > .btn { flex: 1 1 auto; }

/* ---------- chips ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: none; margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 999px; padding: 8px 14px; font-size: .92rem; cursor: pointer; min-height: 40px; }
.chip[aria-pressed='true'] { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); font-weight: 700; }
.wrap-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { display: inline-block; font-size: .78rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); }
.tag.demo { background: var(--warn-soft); color: var(--warn); }
.tag.bad { background: var(--accent-soft); color: var(--accent); }
.tag.ok { background: var(--ok-soft); color: var(--ok); }

/* ---------- cards ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 14px; }
.list { display: grid; gap: 10px; }
.ev-card { display: flex; gap: 12px; align-items: stretch; text-decoration: none; color: inherit; padding: 12px; }
.ev-date { flex: none; width: 58px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 6px 0; }
.ev-date .mon { font-size: .74rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.ev-date .day { font-size: 1.5rem; font-weight: 800; line-height: 1; }
.ev-date .dow { font-size: .74rem; font-weight: 600; }
.ev-body { flex: 1; min-width: 0; }
.ev-title { font-weight: 800; font-size: 1.05rem; line-height: 1.25; margin: 0 0 2px; overflow-wrap: anywhere; }
.ev-meta { color: var(--muted); font-size: .9rem; overflow-wrap: anywhere; }
.ev-foot { display: flex; align-items: center; gap: 8px; margin-top: 6px; flex-wrap: wrap; font-size: .86rem; }
.ev-thumb { flex: none; width: 76px; height: 76px; border-radius: 12px; object-fit: cover; }
.ev-card.cancelled .ev-title { text-decoration: line-through; }
.faces { display: inline-flex; }
.faces .avatar { width: 28px; height: 28px; font-size: .6rem; letter-spacing: -.02em; border: 2px solid var(--card); margin-left: -8px; }
.faces .avatar:first-child { margin-left: 0; }
.avatar { flex: none; width: 40px; height: 40px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: .9rem; overflow: hidden; object-fit: cover; }
.avatar.big { width: 72px; height: 72px; font-size: 1.4rem; }
.group-card { display: flex; gap: 12px; align-items: center; text-decoration: none; color: inherit; padding: 12px; }
.group-pic { flex: none; width: 56px; height: 56px; border-radius: 12px; object-fit: cover; display: flex; align-items: center; justify-content: center; font-weight: 800; color: #fff; font-size: 1.2rem; }
.cover { position: relative; border-radius: var(--r); overflow: hidden; aspect-ratio: 2 / 1; background: var(--brand); margin-bottom: 14px; }
.cover img { width: 100%; height: 100%; object-fit: cover; }
.cover .cover-art { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 3rem; font-weight: 900; letter-spacing: -.02em; padding: 16px; text-align: center; }
.g0 { background: linear-gradient(135deg, #0e6f78, #1aa6a0); }
.g1 { background: linear-gradient(135deg, #e8553a, #ffb347); }
.g2 { background: linear-gradient(135deg, #3d5a98, #6a8fd8); }
.g3 { background: linear-gradient(135deg, #7a3e9d, #c86dd7); }
.g4 { background: linear-gradient(135deg, #2f7d32, #8bc34a); }
.g5 { background: linear-gradient(135deg, #b8860b, #f0c040); }

/* ---------- event page ---------- */
.facts { display: grid; gap: 2px; margin: 12px 0; }
.fact { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.fact:last-child { border-bottom: 0; }
.fact .ic { width: 24px; height: 24px; flex: none; color: var(--brand); margin-top: 2px; }
.fact b { display: block; }
.about { white-space: pre-wrap; overflow-wrap: anywhere; }
.rsvp-bar {
  position: sticky; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 8px); z-index: 10; margin: 16px 0;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 6px 24px rgb(0 0 0 / 14%); padding: 12px;
}
.rsvp-choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.rsvp-choices .btn { padding: 8px 6px; min-height: 52px; font-size: .95rem; }
.rsvp-choices .btn[aria-pressed='true'] { outline: 3px solid var(--sun); }
.status-line { font-weight: 700; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 12px 8px; }
.person { display: flex; flex-direction: column; align-items: center; text-align: center; font-size: .82rem; gap: 4px; overflow-wrap: anywhere; }
.person .avatar { width: 52px; height: 52px; }
.comments { display: grid; gap: 12px; }
.comment { display: flex; gap: 10px; }
.comment .avatar { width: 34px; height: 34px; font-size: .78rem; }
.comment-body { flex: 1; min-width: 0; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; }
.comment-body p { margin: 2px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.replies { margin-left: 44px; display: grid; gap: 10px; margin-top: 8px; }
.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.photos button { padding: 0; border: 0; background: none; cursor: pointer; aspect-ratio: 1; }
.photos img { width: 100%; height: 100%; object-fit: cover; border-radius: 6px; }
.note { border-radius: 12px; padding: 10px 12px; background: var(--warn-soft); color: var(--warn); font-weight: 600; }
.note.ok { background: var(--ok-soft); color: var(--ok); }
.note.info { background: var(--brand-soft); color: var(--brand); }
.note.bad { background: var(--accent-soft); color: var(--accent); }
.msg { border-left: 4px solid var(--brand); padding: 6px 10px; background: var(--card); border-radius: 0 10px 10px 0; }

/* ---------- forms ---------- */
form.stack-form, .stack-form { display: grid; gap: 12px; }
label { font-weight: 700; font-size: .95rem; }
.field { display: grid; gap: 4px; }
.hint { color: var(--muted); font-size: .86rem; font-weight: 400; }
input[type='text'], input[type='email'], input[type='url'], input[type='number'], input[type='date'], input[type='time'], input[type='search'], select, textarea {
  width: 100%; min-height: 48px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--card);
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); outline: 2px solid color-mix(in srgb, var(--brand) 35%, transparent); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 600; min-height: 44px; }
.check input { width: 22px; height: 22px; }
.code-input { font-size: 1.6rem; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; }
.photo-pick { display: flex; align-items: center; gap: 12px; }
.photo-pick img { width: 72px; height: 72px; object-fit: cover; border-radius: 12px; }
.error { color: var(--danger); font-weight: 600; }

/* ---------- sheet (dialog) ---------- */
.sheet { border: 0; padding: 0; width: min(560px, 100vw); max-height: 92vh; margin: auto auto 0; border-radius: 20px 20px 0 0; background: var(--bg); color: var(--ink); }
.sheet::backdrop { background: rgb(0 0 0 / 45%); }
.sheet-inner { padding: 16px 16px calc(20px + env(safe-area-inset-bottom)); overflow-y: auto; max-height: 92vh; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.sheet-head h2 { margin: 0; }
@media (min-width: 640px) { .sheet { margin: auto; border-radius: 20px; } }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tab-h) + 14px + env(safe-area-inset-bottom)); z-index: 60;
  background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 12px; max-width: calc(100vw - 32px); display: flex; gap: 12px; align-items: center;
  box-shadow: 0 6px 20px rgb(0 0 0 / 25%); font-weight: 600;
}
.toast .linkbtn { color: var(--sun); }

/* ---------- inbox ---------- */
.inbox-item { display: flex; gap: 12px; padding: 12px; text-decoration: none; color: inherit; align-items: flex-start; }
.inbox-item .ic { width: 26px; height: 26px; flex: none; color: var(--brand); }
.inbox-item.unread { border-left: 4px solid var(--accent); }
.inbox-item b { display: block; }

/* ---------- host tools ---------- */
.tabs { display: flex; gap: 6px; margin: 8px 0 14px; border-bottom: 1px solid var(--line); }
.tabs button { flex: 1; background: none; border: 0; border-bottom: 3px solid transparent; padding: 10px 4px; font-weight: 700; color: var(--muted); cursor: pointer; min-height: 44px; }
.tabs button[aria-selected='true'] { color: var(--brand); border-bottom-color: var(--brand); }
.att { display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.att .grow b { display: block; overflow-wrap: anywhere; }
.check-btn { min-width: 108px; }
.check-btn.done { background: var(--ok); color: #fff; border-color: var(--ok); }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px; text-align: center; }
.stat b { display: block; font-size: 1.4rem; }
.scanner video { width: 100%; border-radius: 12px; background: #000; aspect-ratio: 1; object-fit: cover; }
.big-ok { font-size: 1.4rem; font-weight: 800; text-align: center; padding: 18px; border-radius: 16px; }
.big-ok.ok { background: var(--ok-soft); color: var(--ok); }
.big-ok.bad { background: var(--accent-soft); color: var(--accent); }

/* ---------- ticket ---------- */
.ticket { text-align: center; }
.ticket .qr { background: #fff; padding: 16px; border-radius: 16px; display: inline-block; margin: 12px auto; }
.ticket .qr svg { width: min(72vw, 300px); height: auto; display: block; }
.ticket-code { font-family: ui-monospace, Consolas, monospace; font-size: 1.1rem; letter-spacing: .12em; }

/* ---------- event templates (New event) ---------- */
.tpl-head { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; }
.tpl-head h2 { margin: 0; }
.lang-toggle { display: inline-flex; gap: 6px; }
.lang-toggle .chip { min-height: 40px; padding: 6px 12px; }
.tpl-list { display: grid; gap: 10px; }
.tpl-card { display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; color: inherit; font: inherit; cursor: pointer; padding: 12px; }
.tpl-card:hover { border-color: var(--brand); }
.tpl-card b { display: block; overflow-wrap: anywhere; }
.tpl-sum { display: block; font-size: .92rem; overflow-wrap: anywhere; }
.tpl-meta { display: block; color: var(--muted); font-size: .84rem; margin-top: 2px; }
.tpl-mark { flex: none; width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-weight: 800; color: #fff; }
.tpl-mark.blank { background: var(--brand-soft); color: var(--brand); }
.tpl-mark .ic { width: 24px; height: 24px; }
.tpl-bar { display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; padding: 10px 12px; margin-bottom: 12px; }
.tpl-bar .grow > * { display: block; overflow-wrap: anywhere; }
.tpl-note { flex-basis: 100%; margin: 0; }
.venue-ideas { background: var(--brand-soft); border-radius: 12px; padding: 10px 12px; overflow-wrap: anywhere; }
.venue-ideas ul { margin: 6px 0 8px; padding-left: 1.2em; }
.venue-ideas li { margin-bottom: 4px; }
.venue-ideas .hint { display: block; }
@media (min-width: 640px) { .tpl-list { grid-template-columns: 1fr 1fr; } }

/* ---------- home hero ---------- */
.hero { border-radius: 20px; padding: 22px 18px; background: linear-gradient(140deg, #0e6f78 0%, #138f94 55%, #f59f6b 140%); color: #fff; margin-bottom: 18px; }
.hero h1 { font-size: 1.75rem; }
.hero p { opacity: .95; }
.hero .btn.secondary { background: #fff; color: #0e6f78; border-color: #fff; }
.hero .btn.ghost { color: #fff; }

.table-wrap { overflow-x: auto; }
details > summary { cursor: pointer; font-weight: 700; padding: 8px 0; min-height: 44px; display: flex; align-items: center; gap: 6px; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: "\25B8"; color: var(--brand); }
details[open] > summary::before { content: "\25BE"; }
ol.steps { padding-left: 1.3em; }
ol.steps li { margin-bottom: 6px; }

@media (min-width: 700px) {
  .people { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
  .photos { grid-template-columns: repeat(4, 1fr); }
}
@media (prefers-reduced-motion: no-preference) {
  .card, .btn, .chip { transition: background-color .15s, border-color .15s, transform .1s; }
  .btn:active { transform: scale(.98); }
}
