:root {
  --bg: #F7F4EE; --surface: #FFFFFF; --surface-2: #EFEAE1;
  --text: #2A2622; --text-muted: #6B6259; --border: #E2DBCF;
  --accent: #4A6B4F; --on-accent: #FFFFFF; --accent-soft: #E3EADF; --danger: #A4483A;
  --c-nature: #6E8B5E; --c-science: #5B7A8C; --c-art: #B0715A; --c-music: #8A6A8E;
  --c-sport: #B5823A; --c-crafts: #9C7B5B; --c-languages: #5E7F7A; --c-trips: #7A8455;
  --sh-1: 0 1px 2px rgba(42,38,34,.06); --sh-2: 0 6px 20px -8px rgba(42,38,34,.18);
  --r-sm: 8px; --r-md: 14px; --r-lg: 22px; --r-pill: 999px;
  --ease: cubic-bezier(.2,.8,.2,1);
  --tab-h: 64px;
  --display: 'Frank Ruhl Libre', Georgia, serif;
  --ui: 'Heebo', system-ui, -apple-system, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #171513; --surface: #211E1B; --surface-2: #2B2723;
    --text: #F1ECE4; --text-muted: #A69D92; --border: #38332D;
    --accent: #9DBB95; --on-accent: #171513; --accent-soft: #2A3428; --danger: #D98A7C;
    --c-nature: #9DB88C; --c-science: #8FB0C2; --c-art: #D79E88; --c-music: #B89BBC;
    --c-sport: #D9AE6C; --c-crafts: #C6A685; --c-languages: #8EB2AC; --c-trips: #AAB383;
    --sh-1: none; --sh-2: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #171513; --surface: #211E1B; --surface-2: #2B2723;
  --text: #F1ECE4; --text-muted: #A69D92; --border: #38332D;
  --accent: #9DBB95; --on-accent: #171513; --accent-soft: #2A3428; --danger: #D98A7C;
  --c-nature: #9DB88C; --c-science: #8FB0C2; --c-art: #D79E88; --c-music: #B89BBC;
  --c-sport: #D9AE6C; --c-crafts: #C6A685; --c-languages: #8EB2AC; --c-trips: #AAB383;
  --sh-1: none; --sh-2: none; color-scheme: dark;
}

[data-cat="nature"] { --cat: var(--c-nature); } [data-cat="science"] { --cat: var(--c-science); }
[data-cat="art"] { --cat: var(--c-art); } [data-cat="music"] { --cat: var(--c-music); }
[data-cat="sport"] { --cat: var(--c-sport); } [data-cat="crafts"] { --cat: var(--c-crafts); }
[data-cat="languages"] { --cat: var(--c-languages); } [data-cat="trips"] { --cat: var(--c-trips); }

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 400 16px/26px var(--ui); -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent; min-height: 100vh;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
.ic { flex: none; display: block; }
.ic.filled { fill: currentColor; }
.flip { transform: scaleX(-1); }
.num { font-variant-numeric: tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

#app { max-width: 480px; margin: 0 auto; min-height: 100vh; position: relative; background: var(--bg); }
@media (min-width: 520px) {
  body { background: var(--surface-2); }
  #app { border-inline: 1px solid var(--border); }
}
.view { padding: 0 20px calc(var(--tab-h) + 40px + env(safe-area-inset-bottom)); animation: enter .32s var(--ease); }
.view.no-tabs { padding-bottom: calc(120px + env(safe-area-inset-bottom)); }
@keyframes enter { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }

/* Type */
.display { font-family: var(--display); font-weight: 700; font-size: 28px; line-height: 34px; letter-spacing: -.01em; }
.h2 { font-family: var(--display); font-weight: 500; font-size: 21px; line-height: 28px; }
.h3 { font-weight: 600; font-size: 17px; line-height: 24px; }
.meta { font-size: 14px; line-height: 20px; color: var(--text-muted); }
.caption { font-size: 11px; line-height: 14px; font-weight: 500; letter-spacing: .01em; color: var(--text-muted); }
.lede { color: var(--text-muted); font-size: 15px; line-height: 22px; margin: 0 0 16px; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.section { margin-top: 32px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.link { color: var(--accent); font-weight: 500; font-size: 14px; }
.stack { display: grid; gap: 12px; }

/* App bar */
.appbar {
  position: sticky; top: 0; z-index: 20; background: var(--bg);
  display: flex; align-items: center; gap: 12px;
  min-height: 64px; padding: calc(12px + env(safe-area-inset-top)) 20px 8px; margin: 0 -20px 4px;
  border-bottom: 1px solid transparent; transition: border-color .22s var(--ease);
}
.appbar.scrolled { border-bottom-color: var(--border); }
.appbar .grow { flex: 1; min-width: 0; }
.appbar .title-sm { font-weight: 600; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.loc-pill {
  margin-inline-start: auto; display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding-inline: 12px; border-radius: var(--r-pill);
  background: var(--surface); border: 1px solid var(--border); font-size: 14px; font-weight: 500;
}
.icon-btn {
  width: 44px; height: 44px; display: inline-grid; place-items: center; border-radius: var(--r-pill);
  color: var(--text); transition: transform .15s var(--ease), background .15s;
}
.icon-btn:active { transform: scale(.94); }
.icon-btn.boxed { background: var(--surface); border: 1px solid var(--border); }
.icon-btn.on { color: var(--accent); }
.icon-btn.on .ic { animation: pop .22s var(--ease); }
@keyframes pop { 50% { transform: scale(1.15); } }

/* Search + chips */
.search {
  display: flex; align-items: center; gap: 10px; height: 48px; padding-inline: 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-pill);
  color: var(--text-muted); transition: border-color .15s, box-shadow .15s;
}
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--text); height: 100%; }
.search input::-webkit-search-cancel-button { display: none; }
.chips {
  display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none;
  margin: 12px -20px 0; padding: 2px 20px;
}
.chips::-webkit-scrollbar { display: none; }
.chips.wrap { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0; }
.chip {
  flex: none; scroll-snap-align: start; display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding-inline: 14px; border-radius: var(--r-pill);
  background: var(--surface); border: 1px solid var(--border);
  font-size: 14px; font-weight: 500; line-height: 20px; white-space: nowrap;
  transition: background .22s var(--ease), color .22s, border-color .22s;
}
.chip.on { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.chip .badge {
  min-width: 20px; height: 20px; padding-inline: 6px; border-radius: var(--r-pill);
  background: var(--accent); color: var(--on-accent); font-size: 12px; display: inline-grid; place-items: center;
}
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--cat, var(--accent)); display: inline-block; flex: none; }

/* Segmented control */
.seg {
  position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  background: var(--surface-2); border-radius: var(--r-pill); padding: 4px; height: 40px; margin-top: 16px;
}
.seg button { position: relative; z-index: 1; border-radius: var(--r-pill); font-weight: 500; font-size: 14px; color: var(--text-muted); transition: color .22s; }
.seg button.on { color: var(--text); }
.seg .thumb {
  position: absolute; top: 4px; bottom: 4px; inset-inline-start: 4px; border-radius: var(--r-pill);
  background: var(--surface); box-shadow: var(--sh-1); transition: transform .22s var(--ease);
}
:root[data-theme="dark"] .seg .thumb { border: 1px solid var(--border); }

/* Cards */
.card {
  display: block; position: relative; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); box-shadow: var(--sh-1); padding: 16px;
  transition: transform .15s var(--ease), box-shadow .15s;
}
a.card:active { transform: scale(.985); box-shadow: none; }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: -6px -10px 6px 0; }
.card-top .icon-btn { margin-inline-end: -10px; }
.card .h3 { margin-bottom: 8px; }
.meta-row { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 14px; line-height: 20px; color: var(--text-muted); margin-top: 4px; }
.meta-row > span { display: inline-flex; align-items: center; gap: 6px; }
.card-bottom { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.price { font-weight: 600; font-variant-numeric: tabular-nums; }
.price small { font-weight: 400; color: var(--text-muted); font-size: 13px; }
.price.free { color: var(--accent); }
.tag {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding-inline: 10px;
  border-radius: var(--r-sm); font-size: 13px; font-weight: 500;
  background: color-mix(in srgb, var(--cat, var(--accent)) 14%, transparent);
}
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.pill-note {
  display: inline-flex; align-items: center; gap: 4px; height: 24px; padding-inline: 8px;
  border-radius: var(--r-pill); font-size: 12px; font-weight: 500; background: var(--surface-2); color: var(--text-muted);
}
.pill-note.warn { background: color-mix(in srgb, var(--c-sport) 18%, transparent); color: var(--text); }
.pill-note.bad { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--text); }
.pill-note.good { background: var(--accent-soft); color: var(--accent); }
.count { margin: 20px 0 10px; }
.cards { display: grid; gap: 12px; }
.hscroll { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; margin: 0 -20px; padding: 2px 20px 4px; }
.hscroll::-webkit-scrollbar { display: none; }
.hscroll > * { flex: 0 0 82%; scroll-snap-align: start; }

/* Week view */
.day-head { display: flex; align-items: baseline; gap: 8px; margin: 24px 0 8px; }
.day-head .h3 { margin: 0; }
.row-link {
  display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--border);
}
.row-link:last-child { border-bottom: 0; }
.row-link .time { width: 48px; flex: none; font-weight: 600; font-variant-numeric: tabular-nums; font-size: 15px; }
.row-link .bar { width: 3px; align-self: stretch; border-radius: 2px; background: var(--cat, var(--accent)); flex: none; }
.row-link .body { flex: 1; min-width: 0; }
.row-link .body .t { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 0 16px; }

/* Activity detail */
.hero {
  height: 168px; margin: 0 -20px; position: relative; overflow: hidden;
  background: color-mix(in srgb, var(--cat) 20%, var(--bg));
  display: flex; align-items: flex-start; justify-content: space-between; padding: calc(12px + env(safe-area-inset-top)) 16px 0;
}
.hero .art { position: absolute; inset-inline-end: -20px; bottom: -36px; width: 200px; height: 200px; color: var(--cat); opacity: .35; }
.hero .icon-btn { background: var(--surface); box-shadow: var(--sh-1); position: relative; z-index: 1; }
.hero .actions { display: flex; gap: 8px; position: relative; z-index: 1; }
.detail-head { margin-top: 20px; }
.detail-head .display { margin: 10px 0 4px; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--border); border-radius: var(--r-md); overflow: hidden; margin-top: 20px; border: 1px solid var(--border); }
.fact { background: var(--surface-2); padding: 14px 16px; }
.fact .caption { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.fact .v { font-weight: 600; font-size: 15px; line-height: 22px; }
.fact .s { font-size: 13px; color: var(--text-muted); line-height: 18px; }
.prose { margin-top: 12px; white-space: pre-line; }
.bullets { list-style: none; display: grid; gap: 6px; margin-top: 8px; }
.bullets li { display: flex; gap: 10px; align-items: center; }
.bullets li::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); flex: none; }
.progress { height: 6px; border-radius: var(--r-pill); background: var(--surface-2); overflow: hidden; margin: 10px 0 6px; }
.progress > i { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width .32s var(--ease); }
.person { display: flex; align-items: center; gap: 12px; }
.person .body { flex: 1; min-width: 0; }
.avatar {
  width: 44px; height: 44px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-weight: 600; font-size: 15px; color: var(--text);
  background: color-mix(in srgb, var(--cat, var(--accent)) 22%, var(--surface));
}
.avatar.sm { width: 28px; height: 28px; font-size: 11px; border: 2px solid var(--surface); }
.avatars { display: flex; }
.avatars .avatar + .avatar { margin-inline-start: -8px; }
.verified { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); font-size: 13px; font-weight: 500; }
.notice {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-md);
  background: var(--surface-2); font-size: 14px; line-height: 20px; margin-top: 16px;
}
.notice.warn { background: color-mix(in srgb, var(--c-sport) 16%, var(--bg)); }
.notice.bad { background: color-mix(in srgb, var(--danger) 14%, var(--bg)); }
.notice .ic { margin-top: 1px; }

/* Bottom CTA bar */
.cta-bar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; z-index: 30;
  display: flex; gap: 10px; align-items: center;
  padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
}
.cta-bar .btn { flex: 1; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; padding-inline: 22px; border-radius: var(--r-pill);
  font-weight: 500; font-size: 15px; transition: transform .15s var(--ease), filter .15s, background .15s;
  border: 1px solid transparent; white-space: nowrap;
}
.btn:active { transform: scale(.98); filter: brightness(.92); }
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.secondary { border-color: var(--border); background: var(--surface); }
.btn.ghost { color: var(--accent); padding-inline: 8px; }
.btn.danger { color: var(--danger); border-color: var(--border); background: var(--surface); }
.btn.sm { height: 36px; padding-inline: 14px; font-size: 14px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn.done { background: var(--accent-soft); color: var(--accent); }

/* Forms */
.field { display: grid; gap: 6px; margin-top: 18px; }
.field > label, .field > .label { font-weight: 500; font-size: 14px; line-height: 20px; }
.field .help { font-size: 13px; color: var(--text-muted); line-height: 18px; }
.field .err { font-size: 13px; color: var(--danger); }
.input, .select, .textarea {
  width: 100%; height: 48px; padding-inline: 14px; border-radius: var(--r-sm);
  background: var(--surface); border: 1px solid var(--border); outline: 0;
  transition: border-color .15s, box-shadow .15s; appearance: none; -webkit-appearance: none;
}
.select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238a8178' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: left 14px center; padding-left: 36px;
}
.textarea { height: auto; min-height: 112px; padding: 12px 14px; resize: vertical; line-height: 24px; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.invalid { border-color: var(--danger) !important; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.switch-row:last-child { border-bottom: 0; }
.switch-row .body { flex: 1; }
.switch { position: relative; width: 48px; height: 28px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: var(--r-pill); background: var(--border); transition: background .22s var(--ease); }
.switch i::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .22s var(--ease); }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(-20px); }
[dir="ltr"] .switch input:checked + i::after { transform: translateX(20px); }
.stepper { height: 3px; background: var(--surface-2); margin: 0 -20px; }
.stepper i { display: block; height: 100%; background: var(--accent); transition: width .32s var(--ease); }
.kid-row { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.kid-row .select { flex: 1; }

/* Community */
.group-card .head { display: flex; align-items: flex-start; gap: 12px; justify-content: space-between; }
.group-card .desc { margin-top: 8px; font-size: 14px; line-height: 21px; color: var(--text-muted); }
.group-card .foot { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; }
.mini-group { padding: 14px; }
.mini-group .h3 { font-size: 15px; line-height: 21px; margin: 10px 0 2px; }
.date-badge {
  width: 52px; flex: none; text-align: center; border-radius: var(--r-sm); background: var(--surface-2); padding: 6px 0;
}
.date-badge b { display: block; font-family: var(--display); font-size: 22px; line-height: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.date-badge span { font-size: 11px; color: var(--text-muted); font-weight: 500; }
.meetup { display: flex; gap: 14px; align-items: flex-start; }
.meetup .body { flex: 1; min-width: 0; }

/* Chat */
.chat { display: flex; flex-direction: column; gap: 4px; padding-top: 8px; }
.msg { max-width: 78%; display: flex; flex-direction: column; }
.msg .bubble { padding: 9px 13px; border-radius: var(--r-md); font-size: 15px; line-height: 22px; word-wrap: break-word; white-space: pre-wrap; }
.msg.mine { align-self: flex-start; align-items: flex-start; }
.msg.mine .bubble { background: var(--accent-soft); border-start-start-radius: 4px; }
.msg.theirs { align-self: flex-end; align-items: flex-end; }
.msg.theirs .bubble { background: var(--surface-2); border-start-end-radius: 4px; }
.msg .from { font-size: 12px; color: var(--text-muted); font-weight: 500; margin: 8px 4px 2px; }
.msg .t { font-size: 11px; color: var(--text-muted); margin: 2px 4px 6px; font-variant-numeric: tabular-nums; }
.sys { align-self: center; font-size: 12px; color: var(--text-muted); background: var(--surface-2); padding: 4px 12px; border-radius: var(--r-pill); margin: 8px 0; text-align: center; }
.composer {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; z-index: 30;
  display: flex; gap: 8px; align-items: center; padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
}
.composer .input { border-radius: var(--r-pill); height: 44px; }
.composer .icon-btn { background: var(--accent); color: var(--on-accent); flex: none; }
.typing { align-self: flex-end; display: flex; gap: 4px; padding: 12px 14px; background: var(--surface-2); border-radius: var(--r-md); margin: 4px 0; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--text-muted); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }
.post { padding: 16px; }
.post + .post { margin-top: 12px; }

/* Profile */
.profile-head { padding: 8px 0 4px; }
.kid-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.settings { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 0 16px; }
.menu-row { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--border); width: 100%; text-align: start; }
.menu-row:last-child { border-bottom: 0; }
.menu-row .body { flex: 1; }
.menu-row .chev { color: var(--text-muted); }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 20px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 12px; text-align: center; }
.stat b { display: block; font-family: var(--display); font-size: 24px; line-height: 30px; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--text-muted); }

/* Empty state */
.empty { text-align: center; padding: 40px 12px; display: grid; justify-items: center; gap: 10px; }
.empty .circle { width: 88px; height: 88px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; color: var(--text-muted); margin-bottom: 6px; }
.empty p { color: var(--text-muted); max-width: 300px; font-size: 15px; line-height: 22px; }
.empty .btn { margin-top: 8px; }

/* Onboarding */
.onboard { padding-top: calc(40px + env(safe-area-inset-top)); }
.onboard .brand { display: flex; align-items: center; gap: 10px; color: var(--accent); margin-bottom: 28px; }
.onboard .brand b { font-family: var(--display); font-size: 20px; color: var(--text); }
.onboard .display { font-size: 34px; line-height: 40px; }
.onboard .lede { font-size: 17px; line-height: 26px; margin-top: 12px; }
.value-list { display: grid; gap: 14px; margin: 28px 0 8px; }
.value-list li { display: flex; gap: 14px; align-items: flex-start; list-style: none; }
.value-list .ico { width: 40px; height: 40px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex: none; }

/* Tab bar */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; z-index: 40;
  height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
}
.tabbar[hidden] { display: none; }
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--text-muted); font-size: 11px; font-weight: 500; position: relative; }
.tab.on { color: var(--text); }
.tab.on .ic { stroke-width: 2; }
.tab.on::after { content: ""; position: absolute; bottom: 5px; width: 4px; height: 4px; border-radius: 50%; background: var(--accent); }
.tab.add .plus { width: 44px; height: 44px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; box-shadow: var(--sh-2); }
.tab.add.on::after { display: none; }
.tab .count-dot { position: absolute; top: 9px; inset-inline-end: calc(50% - 18px); min-width: 16px; height: 16px; border-radius: 8px; background: var(--accent); color: var(--on-accent); font-size: 10px; display: grid; place-items: center; padding-inline: 4px; }

/* Bottom sheet */
#sheet-root .scrim { position: fixed; inset: 0; z-index: 50; background: rgba(23,21,19,.4); opacity: 0; transition: opacity .32s var(--ease); }
#sheet-root .sheet {
  position: fixed; bottom: 0; left: 50%; width: 100%; max-width: 480px; z-index: 51;
  transform: translate(-50%, 100%); transition: transform .32s var(--ease);
  background: var(--surface); border-radius: var(--r-lg) var(--r-lg) 0 0; max-height: 88vh; display: flex; flex-direction: column;
}
#sheet-root.open .scrim { opacity: 1; }
#sheet-root.open .sheet { transform: translate(-50%, 0); }
.sheet .handle { width: 36px; height: 4px; border-radius: 2px; background: var(--border); margin: 10px auto 4px; flex: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 20px 4px; flex: none; }
.sheet-body { padding: 4px 20px 24px; overflow-y: auto; flex: 1; }
.sheet-foot { display: flex; gap: 10px; padding: 12px 20px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); flex: none; }
.sheet-foot .btn.primary { flex: 1; }
.option-list { display: grid; }
.option { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid var(--border); text-align: start; width: 100%; }
.option.on { color: var(--accent); font-weight: 500; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tab-h) + 16px + env(safe-area-inset-bottom)); z-index: 60;
  transform: translate(-50%, 8px); opacity: 0; pointer-events: none;
  background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: var(--r-pill);
  font-size: 14px; font-weight: 500; transition: opacity .22s var(--ease), transform .22s var(--ease); white-space: nowrap;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-property: opacity !important; }
  #sheet-root .sheet { transition: none; }
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.count-dot[hidden] { display: none; }
.pill-note { white-space: nowrap; flex: none; }

/* ---------- v0.2: multilingual, both directions ---------- */
:root[lang="ru"] { --display: 'Lora', Georgia, serif; --ui: 'Rubik', system-ui, sans-serif; }
:root[lang="ar"] { --display: 'Amiri', 'Times New Roman', serif; --ui: 'IBM Plex Sans Arabic', system-ui, sans-serif; }
[dir="ltr"] .ltr-flip, [dir="rtl"] .rtl-flip { transform: scaleX(-1); }
[dir="ltr"] .select { background-position: right 14px center; padding-left: 14px; padding-right: 36px; }
.card-top { margin: -6px 0 6px; }
/* Own messages sit on the right in both directions */
[dir="ltr"] .msg.mine { align-self: flex-end; align-items: flex-end; }
[dir="ltr"] .msg.theirs { align-self: flex-start; align-items: flex-start; }
[dir="ltr"] .msg.mine .bubble { border-radius: var(--r-md); border-start-end-radius: 4px; }
[dir="ltr"] .msg.theirs .bubble { border-radius: var(--r-md); border-start-start-radius: 4px; }
.cta-bar.above-tabs { bottom: calc(var(--tab-h) + env(safe-area-inset-bottom)); border-bottom: 0; }
.inline-ic { display: inline-flex; align-items: center; gap: 4px; min-width: 0; }
.ic.accent { color: var(--accent); }
.tab-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-inline: 2px; }
.steps { margin: 16px 0 0; padding-inline-start: 22px; display: grid; gap: 10px; }
.steps li { padding-inline-start: 4px; }
.steps li::marker { color: var(--accent); font-weight: 600; }
.sources { list-style: none; display: grid; gap: 6px; margin-top: 8px; font-size: 14px; word-break: break-all; }
.country-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.btn.danger-fill { background: var(--danger); color: var(--on-accent); }
.card-bottom > * { min-width: 0; }
.meta-row > span { min-width: 0; }
.verified-date { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-variant-numeric: tabular-nums; }
.plans { display: grid; gap: 10px; }
.plan {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: start; padding: 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); transition: border-color .15s, box-shadow .15s;
}
.plan.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.plan .body { flex: 1; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.plan-radio { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--border); flex: none; position: relative; }
.plan.on .plan-radio { border-color: var(--accent); }
.plan.on .plan-radio::after { content: ""; position: absolute; inset: 4px; border-radius: 50%; background: var(--accent); }
.plan-price { display: grid; text-align: end; font-variant-numeric: tabular-nums; }
.plan-price b { font-size: 18px; }
.plan-price small { font-size: 12px; color: var(--text-muted); }
a.card.become .body { min-width: 0; }
/* Seats and bookings */
.enroll-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.enroll-num { font-size: 17px; font-weight: 600; color: var(--accent); }
.enroll-num.none { color: var(--danger); }
.progress.seats { position: relative; overflow: visible; }
.progress.seats > i { border-radius: var(--r-pill); }
.min-mark { position: absolute; top: -3px; bottom: -3px; width: 2px; border-radius: 1px; background: var(--text-muted); transform: translateX(-50%); }
[dir="rtl"] .min-mark { transform: translateX(50%); }
.qty-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.qty { display: flex; align-items: center; gap: 14px; }
.qty b { min-width: 28px; text-align: center; font-size: 18px; }
.qty .icon-btn { width: 40px; height: 40px; }
.qty .icon-btn[disabled] { opacity: .35; pointer-events: none; }
.seat-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 14px; padding: 12px 14px; border-radius: var(--r-md); background: var(--accent-soft); color: var(--accent); }
.seat-line .meta { margin-inline-start: auto; }
.seat-line.none { background: color-mix(in srgb, var(--danger) 14%, var(--bg)); color: var(--danger); }
/* Payment */
.pay-summary { margin-top: 10px; background: var(--surface-2); border-radius: var(--r-md); padding: 4px 16px; }
.pay-summary .row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.pay-summary .row:last-child { border-bottom: 0; }
.pay-summary .row.total { font-size: 17px; }
.pay-summary.receipt { margin-top: 16px; }
.plan .ic { color: var(--text-muted); }
.pay-wait { display: grid; justify-items: center; gap: 14px; padding: 48px 0; color: var(--text-muted); }
.spinner { width: 36px; height: 36px; border-radius: 50%; border: 3px solid var(--accent-soft); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.pay-ok { width: 64px; height: 64px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; margin: 8px auto 12px; }

/* Sign in */
.code-input { font-size: 24px; letter-spacing: .4em; text-align: center; font-variant-numeric: tabular-nums; }
.empty .spinner { margin: 8px auto; }
