/* KUSMIS FRONTEND-1A — public consumer web styles (no framework, Inter only). */
:root {
  --primary: #FF2D55;          /* decorative accent only (3.6:1 on white) */
  --primary-strong: #E12246;   /* text/buttons on white (4.6:1) */
  --primary-soft: #FFE8EC;
  --secondary: #0066FF;
  --bg: #F8F9FA;
  --surface: #FFFFFF;
  --muted-surface: #E9ECEF;
  --text: #111827;
  --text-2: #4B5563;
  --text-3: #6B7280;
  --border: #E5E7EB;
  --focus: #0066FF;
  --error: #B42318;
  --error-soft: #FEF3F2;
  --warning: #8A5A00;
  --warning-soft: #FFF7E0;
  --success: #067647;
  --success-soft: #ECFDF3;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(17, 24, 39, .06);
  --shadow: 0 4px 16px rgba(17, 24, 39, .08);
  --shadow-lg: 0 12px 32px rgba(17, 24, 39, .16);
  --nav-h: 64px;
  /* System fonts only: no third-party font requests (privacy) and no font licensing. */
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
a { color: var(--primary-strong); }
h1, h2, h3 { margin: 0; line-height: 1.25; }
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--text); color: #fff; padding: 10px 14px; border-radius: var(--radius-sm); text-decoration: none; font-weight: 600;
}
.skip-link:focus { top: 12px; }

.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon--small { width: 16px; height: 16px; }

/* ---------- Header ---------- */
.app-header {
  position: sticky; top: 0; z-index: 30;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--border);
}
.app-header__inner {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: "brand actions" "search search";
  align-items: center;
  gap: 8px 12px;
  padding: 10px 16px 12px;
  max-width: 1600px;
  margin: 0 auto;
}
.brand { grid-area: brand; display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text); min-height: 44px; }
.brand__mark { width: 22px; height: 30px; }
.brand__word { font-weight: 800; font-size: 21px; letter-spacing: .02em; }
.desktop-nav { display: none; }
.header-actions { grid-area: actions; display: flex; justify-content: flex-end; align-items: center; gap: 8px; min-width: 0; }
.area-btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; max-width: 100%;
  padding: 0 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
  font-weight: 600; font-size: 14px;
}
.area-btn .icon { color: var(--primary-strong); }
.area-btn__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.language-select {
  min-height: 44px; padding: 0 8px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); font-weight: 600; font-size: 13px;
}
.country-select { max-width: 9.5rem; text-overflow: ellipsis; flex: none; }
/* Phones: the country is chosen in the area sheet (Kogu Eesti / Kogu Läti / Kõik
   riigid) and shown on the area button, so the header keeps room for the wordmark. */
@media (max-width: 639.98px) {
  .country-select { display: none; }
}
.search-box {
  grid-area: search; position: relative; display: flex; align-items: center;
  background: var(--muted-surface); border-radius: 999px; min-height: 46px; padding: 0 6px 0 14px;
}
.search-box__icon { color: var(--text-3); }
.search-box input {
  flex: 1; min-width: 0; border: 0; background: transparent; padding: 0 8px; height: 46px; font-size: 15px;
}
.search-box input::placeholder { color: var(--text-3); }
.search-box input:focus { outline: none; }
.search-box:focus-within { box-shadow: 0 0 0 3px var(--focus); background: var(--surface); }
.search-box input::-webkit-search-cancel-button { display: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 999px; border: 1px solid transparent;
  font-weight: 600; font-size: 15px; text-decoration: none; white-space: nowrap;
}
.btn--primary { background: var(--primary-strong); color: #fff; }
.btn--primary:hover { background: #C81D3D; }
.btn--secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn--secondary:hover { border-color: #CBD2D9; background: #FBFBFC; }
.btn--ghost { background: transparent; color: var(--text); }
.btn--small { min-height: 40px; padding: 0 14px; font-size: 14px; }
.btn--block { width: 100%; }
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 999px;
  border: 0; background: transparent; color: var(--text);
}
.icon-btn:hover { background: var(--muted-surface); }
.icon-btn--small { width: 36px; height: 36px; }
.link-btn { border: 0; background: none; padding: 8px 0; color: var(--primary-strong); font-weight: 600; min-height: 44px; }

/* ---------- Chips / controls ---------- */
.controls { background: var(--surface); border-bottom: 1px solid var(--border); padding: 10px 0 2px; }
.chip-row {
  display: flex; gap: 8px; overflow-x: auto; padding: 2px 16px 10px;
  scrollbar-width: none; scroll-snap-type: x proximity; scroll-padding-inline: 16px;
}
.chip-row::-webkit-scrollbar { display: none; }
.chip-wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px;
  border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-size: 14px; font-weight: 500; white-space: nowrap; scroll-snap-align: start;
}
.chip:hover { border-color: #CBD2D9; }
.chip[aria-pressed="true"] { background: var(--primary-strong); border-color: var(--primary-strong); color: #fff; font-weight: 600; }
.chip--category .icon { color: var(--primary-strong); }
.chip[aria-pressed="true"] .icon { color: #fff; }
.chip--ghost { background: var(--bg); }
.chip__count {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--text); color: #fff; font-size: 12px; font-weight: 700;
}
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 3px rgba(255, 45, 85, .22); flex: none; }
.chip[aria-pressed="true"] .live-dot { background: #fff; box-shadow: 0 0 0 3px rgba(255, 255, 255, .3); }

/* Event detail is a focused view on every breakpoint: discovery controls step aside. */
body[data-detail="open"] .controls { display: none; }

/* ---------- List pane ---------- */
.layout { position: relative; }
.list-pane { padding: 0 0 calc(var(--nav-h) + 24px); }
.list-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 16px 8px; }
.list-title { font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
.list-meta { margin: 4px 0 0; color: var(--text-2); font-size: 14px; }
.list-head__map {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 600; text-decoration: none; font-size: 14px;
}
.loading-bar { position: relative; height: 3px; overflow: hidden; background: var(--primary-soft); margin: 0 16px; border-radius: 3px; }
.loading-bar span { position: absolute; inset: 0 auto 0 0; width: 35%; background: var(--primary-strong); border-radius: 3px; animation: loading 1.1s ease-in-out infinite; }
@keyframes loading { from { transform: translateX(-100%); } to { transform: translateX(300%); } }
.status-region { padding: 0 16px; }
.notice {
  display: flex; align-items: center; gap: 10px; margin: 8px 0; padding: 10px 12px; border-radius: var(--radius-sm);
  font-size: 14px; border: 1px solid transparent;
}
.notice > span { flex: 1; }
.notice--info { background: #EEF4FF; border-color: #C7D7FE; color: #1E3A8A; }
.notice--error { background: var(--error-soft); border-color: #FECDCA; color: var(--error); }
.notice--warning { background: var(--warning-soft); border-color: #F5D98B; color: var(--warning); }
.feed { padding: 4px 0 8px; }

.feed-section { padding: 12px 0 8px; }
.feed-section__head { display: flex; align-items: baseline; gap: 8px; padding: 0 16px 10px; }
.feed-section__title { display: inline-flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 700; }
.feed-section__count { color: var(--text-3); font-size: 13px; font-weight: 600; }
.rail {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(220px, 72%); gap: 12px;
  overflow-x: auto; padding: 2px 16px 10px; scroll-snap-type: x mandatory; scroll-padding-inline: 16px; scrollbar-width: thin;
}
.rail > * { scroll-snap-align: start; min-width: 0; }
.card-list { display: grid; gap: 10px; padding: 0 16px; }
.feed-more { display: grid; justify-items: center; gap: 8px; padding: 16px; }
.feed-more__count { margin: 0; color: var(--text-2); font-size: 14px; }

/* ---------- Event card ---------- */
.event-card {
  display: flex; flex-direction: column; height: 100%; color: inherit; text-decoration: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow-sm); transition: box-shadow .15s ease, border-color .15s ease, transform .15s ease;
}
.event-card:hover { box-shadow: var(--shadow); border-color: #D7DCE1; }
.event-card.is-selected { border-color: var(--primary-strong); box-shadow: 0 0 0 2px var(--primary-strong); }
.event-card__media { position: relative; aspect-ratio: 16 / 10; background: var(--muted-surface); overflow: hidden; }
.event-card__img, .detail__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.event-card__body { display: grid; gap: 6px; padding: 12px; align-content: start; }
.event-card__title {
  font-size: 16px; font-weight: 700; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.event-card__meta { display: flex; align-items: center; gap: 6px; margin: 0; color: var(--text-2); font-size: 14px; min-width: 0; }
.event-card__meta span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.event-card__meta .icon { color: var(--text-3); }
.event-card__chips { display: flex; flex-wrap: wrap; gap: 6px; }
.badge {
  position: absolute; left: 10px; top: 10px; display: inline-flex; align-items: center; gap: 6px; max-width: calc(100% - 20px);
  padding: 5px 10px; border-radius: 999px; background: rgba(17, 24, 39, .82); color: #fff; font-size: 13px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.badge--live { background: var(--primary-strong); }
.badge--live .live-dot { background: #fff; box-shadow: 0 0 0 3px rgba(255, 255, 255, .3); }
.tag {
  display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--primary-soft); color: #B0153A;
}
.tag--free { background: var(--success-soft); color: var(--success); }
.tag--distance { background: #EEF4FF; color: #1D4ED8; }
.tag--quiet { background: var(--muted-surface); color: var(--text-2); }

.event-card--row { flex-direction: row; align-items: stretch; }
.event-card--row .event-card__media { flex: none; width: 112px; aspect-ratio: auto; min-height: 104px; }
.event-card--row .event-card__body { flex: 1; min-width: 0; padding: 10px 12px; }
.event-card__time { margin: 0; color: var(--primary-strong); font-size: 13px; font-weight: 700; }
.event-card--tile .event-card__time { display: none; }
.event-card--row .event-card__media .badge,
.event-card--compact .event-card__media .badge { display: none; }
.event-card__time { display: flex; align-items: center; gap: 6px; }
.event-card--compact { flex-direction: row; box-shadow: none; }
.event-card--compact .event-card__media { flex: none; width: 76px; aspect-ratio: auto; min-height: 76px; }
.event-card--compact .event-card__body { padding: 8px 10px; gap: 4px; min-width: 0; }
.event-card--compact .event-card__title { font-size: 15px; }

/* Deterministic, image-free fallback artwork by category. */
.media-fallback {
  position: absolute; inset: 0; display: grid; place-items: center; color: rgba(255, 255, 255, .92);
  background: linear-gradient(135deg, #FF5C7A, #E12246);
}
.media-fallback .icon { width: 40%; height: 40%; max-width: 56px; max-height: 56px; stroke-width: 1.5; }
.media-fallback--music { background: linear-gradient(135deg, #7C3AED, #E12246); }
.media-fallback--theatre { background: linear-gradient(135deg, #9F1239, #F43F5E); }
.media-fallback--exhibition { background: linear-gradient(135deg, #0F766E, #14B8A6); }
.media-fallback--museum { background: linear-gradient(135deg, #374151, #6B7280); }
.media-fallback--family { background: linear-gradient(135deg, #F59E0B, #F97316); }
.media-fallback--sport { background: linear-gradient(135deg, #1D4ED8, #0EA5E9); }
.media-fallback--party { background: linear-gradient(135deg, #DB2777, #7C3AED); }
.media-fallback--fair { background: linear-gradient(135deg, #B45309, #F59E0B); }
.media-fallback--film { background: linear-gradient(135deg, #111827, #4B5563); }
.media-fallback--food { background: linear-gradient(135deg, #C2410C, #F97316); }
.media-fallback--nature { background: linear-gradient(135deg, #15803D, #4ADE80); }
.media-fallback--education { background: linear-gradient(135deg, #1E40AF, #6366F1); }
.media-fallback--other { background: linear-gradient(135deg, #E12246, #FF7A59); }

/* ---------- Loading / empty / error ---------- */
.skeleton-list { display: grid; gap: 12px; padding: 12px 16px; }
.skeleton-card { display: flex; gap: 12px; padding: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.skeleton-card__body { flex: 1; display: grid; gap: 10px; align-content: center; }
.skeleton { border-radius: 8px; background: linear-gradient(90deg, #ECEEF1 0%, #F6F7F9 50%, #ECEEF1 100%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
.skeleton--media { width: 96px; height: 84px; flex: none; border-radius: 10px; }
.skeleton--line { height: 14px; }
.skeleton--short { width: 60%; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.state-card {
  margin: 16px; padding: 28px 20px; text-align: center; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
}
.state-card h2 { font-size: 18px; margin-top: 10px; }
.state-card p { margin: 6px auto 0; color: var(--text-2); max-width: 36ch; }
.state-card__icon { display: inline-grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-strong); }
.state-card--error .state-card__icon { background: var(--error-soft); color: var(--error); }
.state-card__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 18px; }

/* ---------- Event detail (in-session) ---------- */
.detail { background: var(--surface); min-height: 60vh; }
.detail:focus { outline: none; }
.detail__bar { position: static; z-index: 2; display: flex; align-items: center; padding: 6px 8px; background: rgba(255, 255, 255, .96); border-bottom: 1px solid var(--border); }
.detail__back { padding: 0 12px; }
.detail__media { position: relative; aspect-ratio: 16 / 9; background: var(--muted-surface); overflow: hidden; }
.detail__media .badge { top: auto; bottom: 12px; left: 12px; }
.detail__body { display: grid; gap: 16px; padding: 16px 16px 24px; }
.detail__chips { display: flex; flex-wrap: wrap; gap: 6px; }
.detail__title { font-size: 24px; font-weight: 800; letter-spacing: -.01em; }
.detail__title:focus { outline: none; }
.detail__title:focus-visible { outline: 3px solid var(--focus); }
.detail__facts { display: grid; gap: 12px; margin: 0; }
.detail__fact { display: flex; gap: 12px; align-items: flex-start; }
.detail__fact > .icon { margin-top: 2px; color: var(--primary-strong); }
.detail__fact dt { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); }
.detail__fact dd { margin: 2px 0 0; font-weight: 600; }
.detail__sub { display: block; font-weight: 400; color: var(--text-2); font-size: 14px; margin-top: 2px; }
.detail__sub--warn { color: var(--warning); }
.detail__actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.action-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 12px;
  border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-weight: 600; font-size: 14px; text-decoration: none; text-align: center;
}
.action-btn:hover { border-color: #CBD2D9; background: #FBFBFC; }
.action-btn .icon { color: var(--primary-strong); }
.detail__desc { color: var(--text); font-size: 15px; line-height: 1.6; }
.detail__desc p { margin: 0 0 10px; }
.detail__desc.is-clamped { max-height: 9.6em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 60%, transparent); mask-image: linear-gradient(#000 60%, transparent); }
.detail__genres { display: flex; flex-wrap: wrap; gap: 6px; }
.detail__sources h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); margin-bottom: 6px; }
.detail__sources ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.detail__sources a { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; font-weight: 600; }
.detail__note { margin: 0; color: var(--text-3); font-size: 13px; }
.detail__note--warn { color: var(--warning); font-size: 14px; }
/* P3 "Is this your event?" entry (only when the server enables organizers). */
.detail__claim { display: grid; gap: 6px; justify-items: start; margin-top: 4px; padding: 14px; border: 1px dashed var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.detail__claim-title { display: flex; align-items: center; gap: 8px; margin: 0; }
.detail__claim-body { margin: 0; color: var(--text-2); font-size: 14px; }

/* ---------- Map ---------- */
.map-pane { display: none; position: relative; background: #E8EEF2; }
.map { position: absolute; inset: 0; }
.map-error {
  position: absolute; inset: 0; z-index: 3; display: grid; place-content: center; justify-items: center; gap: 8px;
  padding: 24px; text-align: center; background: #EEF1F4; color: var(--text-2);
}
.map-error .icon { width: 36px; height: 36px; color: var(--text-3); }
.map-error strong { color: var(--text); font-size: 16px; }
.map-search-area {
  position: absolute; z-index: 4; top: 14px; left: 50%; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 999px;
  border: 0; background: var(--text); color: #fff; font-weight: 600; box-shadow: var(--shadow-lg); white-space: nowrap;
}
.map-tools { position: absolute; z-index: 4; top: 14px; right: 12px; display: grid; gap: 8px; }
/* Status copy for the mobile map view, where the list (and its status region) is hidden. */
.map-status { display: none; position: absolute; z-index: 6; top: 66px; left: 12px; right: 68px; }
.map-status .notice { margin: 0 0 8px; box-shadow: var(--shadow); }
.notice--loading { background: var(--surface); border-color: var(--border); color: var(--text-2); }
.map-tool {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; border: 0;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow);
}
.map-preview {
  position: absolute; z-index: 5; left: 12px; right: 12px; bottom: 76px; padding: 12px;
  background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); max-height: 50%; overflow: auto;
}
.map-preview__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 8px; }
.map-preview__head strong { display: block; font-size: 15px; }
.map-preview__head span { display: block; color: var(--text-2); font-size: 13px; }
.map-preview__list { display: grid; gap: 8px; }
.map-preview__more { margin: 8px 0 0; color: var(--text-2); font-size: 13px; text-align: center; }
.map-list-toggle {
  position: absolute; z-index: 4; left: 50%; bottom: 16px; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 999px;
  background: var(--text); color: #fff; font-weight: 600; text-decoration: none; box-shadow: var(--shadow-lg);
}
.user-dot {
  width: 18px; height: 18px; border-radius: 50%; background: var(--secondary); border: 3px solid #fff;
  box-shadow: 0 0 0 6px rgba(0, 102, 255, .2), 0 2px 6px rgba(0, 0, 0, .25);
}
.maplibregl-ctrl-group button { width: 36px; height: 36px; }

/* ---------- Bottom navigation (anonymous: only real destinations) ---------- */
.bottom-nav {
  position: fixed; z-index: 40; left: 0; right: 0; bottom: 0;
  display: grid; grid-template-columns: repeat(3, 1fr);
  height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px)); padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(255, 255, 255, .98); border-top: 1px solid var(--border);
}
.bottom-nav a {
  display: grid; justify-items: center; align-content: center; gap: 2px; min-height: 44px;
  color: var(--text-3); text-decoration: none; font-size: 12px; font-weight: 600;
}
.bottom-nav a[aria-current="page"] { color: var(--primary-strong); }
.bottom-nav a[aria-current="page"] .icon { stroke-width: 2.2; }
.bottom-nav .icon { width: 24px; height: 24px; }

/* ---------- Sheets / dialogs ---------- */
.sheet {
  padding: 0; border: 0; color: var(--text); background: var(--surface);
  width: 100%; max-width: 100%; max-height: 88dvh; margin: auto 0 0; border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: var(--shadow-lg);
}
.sheet::backdrop { background: rgba(17, 24, 39, .45); }
.sheet__inner { display: flex; flex-direction: column; max-height: 88dvh; }
.sheet__head { display: flex; align-items: center; justify-content: space-between; padding: 12px 8px 8px 20px; border-bottom: 1px solid var(--border); }
.sheet__head h2 { font-size: 18px; font-weight: 700; }
.sheet__head form { margin: 0; }
.sheet__body { padding: 16px 20px; overflow: auto; display: grid; gap: 16px; }
.sheet__foot { display: flex; justify-content: space-between; gap: 12px; padding: 12px 20px calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--border); }
.sheet__foot .btn--primary { flex: 1; }
.sheet__group { border: 0; padding: 0; margin: 0; display: grid; gap: 10px; }
.sheet__group legend, .sheet__subhead { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); padding: 0; margin-bottom: 8px; }
.sheet__subhead { margin: 4px 0 0; }
.sheet__note { margin: 0; color: var(--text-2); font-size: 14px; }
.date-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.date-fields label, .share-field { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.date-fields input, .share-field input {
  min-height: 44px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); font-size: 15px; color: var(--text);
}
.switch { display: flex; align-items: center; gap: 12px; min-height: 44px; font-weight: 500; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch__track { position: relative; flex: none; width: 46px; height: 28px; border-radius: 999px; background: #CBD2D9; transition: background .15s; }
.switch__track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .15s; }
.switch input:checked + .switch__track { background: var(--primary-strong); }
.switch input:checked + .switch__track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch__track { outline: 3px solid var(--focus); outline-offset: 2px; }
.area-option {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 8px 12px; text-align: left;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); font-weight: 600;
}
.area-option small { display: block; font-weight: 400; color: var(--text-2); font-size: 13px; }
.area-option .icon { color: var(--primary-strong); }
.area-option[aria-pressed="true"] { border-color: var(--primary-strong); box-shadow: inset 0 0 0 1px var(--primary-strong); background: #FFF6F8; }
.area-option--near { border-style: dashed; }
.area-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.area-list--single { grid-template-columns: 1fr; }
.radius-row { display: grid; gap: 8px; font-size: 14px; font-weight: 600; color: var(--text-2); }
.option-list { display: grid; gap: 8px; }
.option {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 0 14px; text-align: left;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font-weight: 600; text-decoration: none;
}
.option > span { flex: 1; }
.option .icon:first-child { color: var(--primary-strong); }

/* ---------- Toasts ---------- */
.toast-region {
  position: fixed; z-index: 60; left: 50%; bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  display: grid; gap: 8px; width: min(92vw, 420px); pointer-events: none;
}
.toast { padding: 12px 16px; border-radius: var(--radius-sm); background: var(--text); color: #fff; font-size: 14px; font-weight: 500; box-shadow: var(--shadow-lg); text-align: center; }

/* ---------- Mobile: map view fills the space between controls and bottom nav ---------- */
@media (max-width: 1023.98px) {
  body[data-view="map"]:not([data-detail="open"]) { height: 100dvh; overflow: hidden; display: flex; flex-direction: column; }
  body[data-view="map"]:not([data-detail="open"]) .app-header { flex: none; }
  body[data-view="map"]:not([data-detail="open"]) .app { flex: 1; min-height: 0; display: flex; flex-direction: column; padding-bottom: var(--nav-h); }
  body[data-view="map"]:not([data-detail="open"]) .controls { flex: none; }
  body[data-view="map"]:not([data-detail="open"]) .layout { flex: 1; min-height: 0; }
  body[data-view="map"]:not([data-detail="open"]) .list-pane { display: none; }
  body[data-view="map"]:not([data-detail="open"]) .map-pane { display: block; height: 100%; }
  body[data-view="map"]:not([data-detail="open"]) .map-status { display: block; }
  .map-tools { top: 70px; }
}

/* ---------- Tablet tweaks ---------- */
@media (min-width: 640px) and (max-width: 1023.98px) {
  .rail { grid-auto-columns: minmax(240px, 42%); }
  .card-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sheet { max-width: 560px; margin: auto; border-radius: var(--radius-lg); }
}

/* ---------- Desktop: list + map side by side ---------- */
@media (min-width: 1024px) {
  body { height: 100vh; overflow: hidden; display: flex; flex-direction: column; }
  .app-header { flex: none; }
  .app-header__inner {
    grid-template-columns: auto auto minmax(220px, 440px) 1fr;
    grid-template-areas: "brand nav search actions";
    padding: 10px 20px; gap: 16px;
  }
  .desktop-nav { grid-area: nav; display: flex; gap: 4px; }
  .desktop-nav a {
    display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px; border-radius: 999px;
    color: var(--text-2); text-decoration: none; font-weight: 600; font-size: 14px;
  }
  .desktop-nav a:hover { background: var(--muted-surface); color: var(--text); }
  .desktop-nav a[aria-current="page"] { background: var(--primary-soft); color: #B0153A; }
  .app {
    flex: 1; min-height: 0; display: grid;
    grid-template-columns: minmax(420px, 36vw) 1fr; grid-template-rows: auto minmax(0, 1fr);
    max-width: none;
  }
  .controls { grid-column: 1; grid-row: 1; border-right: 1px solid var(--border); padding-top: 12px; }
  .chip-row { flex-wrap: wrap; overflow: visible; padding: 2px 16px 10px; }
  .layout { display: contents; }
  .list-pane { grid-column: 1; grid-row: 2; overflow-y: auto; min-height: 0; padding-bottom: 24px; border-right: 1px solid var(--border); background: var(--bg); }
  .map-pane { display: block; grid-column: 2; grid-row: 1 / span 2; }
  .list-head__map, .map-list-toggle, .bottom-nav { display: none; }
  .rail { grid-auto-columns: 232px; }
  .detail { min-height: 100%; }
  .detail__bar { position: sticky; top: 0; }
  .detail__media { margin: 16px 16px 0; border-radius: var(--radius); }
  .detail__actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .map-preview { left: 16px; right: auto; bottom: 24px; width: 380px; }
  .map-tools { top: 14px; }
  .sheet { max-width: 520px; margin: auto; border-radius: var(--radius-lg); }
  .toast-region { bottom: 24px; }
}
@media (min-width: 1440px) {
  .app { grid-template-columns: 520px 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ---------- AUTH-1 login UI (rendered by auth.js only when public auth is enabled) ---------- */
.auth-mount { position: relative; display: flex; align-items: center; }
.auth-btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 600; font-size: 14px; white-space: nowrap;
}
.auth-btn:hover { border-color: #CBD2D9; }
.auth-avatar-btn { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: transparent; }
.auth-avatar {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  background: var(--primary-strong); color: #fff; font-weight: 700; font-size: 14px; letter-spacing: .02em;
}
.auth-avatar--large { width: 52px; height: 52px; font-size: 18px; flex: none; }
.auth-menu {
  position: absolute; z-index: 50; top: calc(100% + 6px); right: 0; min-width: 220px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.auth-menu__who { display: grid; gap: 2px; padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; font-size: 14px; }
.auth-menu__who span { color: var(--text-2); font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.auth-menu__item {
  display: block; width: 100%; min-height: 44px; padding: 0 10px; text-align: left; border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--text); font-weight: 600; font-size: 14px;
}
.auth-menu__item:hover, .auth-menu__item:focus-visible { background: var(--muted-surface); }
.auth-google { gap: 10px; }
.auth-google__mark {
  display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  border: 1px solid var(--border); font-weight: 800; font-size: 13px; color: var(--text);
}
.auth-divider { margin: 0; text-align: center; color: var(--text-3); font-size: 13px; text-transform: uppercase; letter-spacing: .06em; }
.auth-email-form { display: grid; gap: 8px; }
.auth-label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.auth-email-form input {
  min-height: 44px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); font-size: 15px; color: var(--text);
}
.auth-status { margin: 0; font-size: 14px; color: var(--text-2); }
.auth-status:empty { display: none; }
.auth-status--ok { color: var(--success); }
.auth-status--error { color: var(--error); }
.auth-profile { display: flex; align-items: center; gap: 12px; }
.auth-profile p { margin: 0; }
.auth-profile__label { font-size: 12px; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; font-weight: 700; }
.auth-profile__name { font-weight: 700; }
.auth-profile__email { color: var(--text-2); font-size: 14px; }
.auth-danger { display: grid; gap: 10px; padding-top: 12px; border-top: 1px solid var(--border); }
.auth-check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 14px; }
.auth-check input { width: 20px; height: 20px; }
.btn--danger { background: var(--error); color: #fff; }
.btn--danger:disabled { opacity: .5; }
/* With the auth control present, let the area button truncate instead of pushing the
   header actions over the wordmark on narrow phones (no effect while auth is hidden). */
.header-actions:has(> .auth-mount:not([hidden])) .area-btn { min-width: 0; }
@media (max-width: 639.98px) {
  .auth-btn { width: 44px; padding: 0; justify-content: center; }
  .auth-btn__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .header-actions:has(> .auth-mount:not([hidden])) { gap: 6px; }
  .header-actions:has(> .auth-mount:not([hidden])) .area-btn { padding: 0 10px; gap: 4px; }
  .header-actions:has(> .auth-mount:not([hidden])) .area-btn .icon--small { display: none; }
}

/* Country selector next to the area button: on desktop the area label stays readable. */
@media (min-width: 1024px) {
  .header-actions .area-btn, .header-actions:has(> .auth-mount:not([hidden])) .area-btn { min-width: 9.75rem; flex: 0 1 auto; }
}

/* P4 sponsored slots: always visibly labelled (EU DSA Art. 26). */
.sponsored-slot { border: 1px solid #e3c770; border-radius: 14px; padding: 8px; background: #fffaf0; }
.sponsored-slot__label { margin: 0 0 6px; font-size: 12px; color: #6b5300; }
.sponsored-slot__why { margin-top: 6px; font-size: 12px; color: #555; }
.sponsored-slot__why summary { cursor: pointer; }
/* The card inside a slot must not stretch to 100% of the slot (it would cover the label
   and the "why" explanation below it). */
.sponsored-slot .event-card { height: auto; }

/* Privacy footer (consent choices stay reachable on every list/detail view). */
.site-footer { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 24px 16px 8px; color: var(--text-3); font-size: 13px; }
.site-footer a { color: var(--text-2); text-decoration: underline; text-underline-offset: 2px; min-height: 44px; display: inline-flex; align-items: center; }
.site-footer .link-btn { color: var(--text-2); font-weight: 500; text-decoration: underline; text-underline-offset: 2px; font-size: 13px; }
.action-btn--save[aria-pressed="true"] { border-color: var(--primary-strong); background: var(--primary-soft); }
.action-btn--save[aria-pressed="true"] .icon { fill: currentColor; }
a.auth-menu__item { display: flex; align-items: center; text-decoration: none; color: var(--text); }
/* Sign in with Apple (HIG: black button, white logo + title, same size as the other providers). */
.auth-apple { gap: 8px; background: #000; color: #fff; border-color: #000; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif; }
.auth-apple:hover { background: #1d1d1f; border-color: #1d1d1f; color: #fff; }
.auth-apple:focus-visible { outline: 3px solid var(--focus, #2563eb); outline-offset: 2px; }
.auth-apple__mark { width: 18px; height: 18px; flex: none; margin-top: -2px; }
