/* Shared components for the SaaS pages, built on tokens.css. */
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); font-size: 17px; line-height: 1.5; color: var(--ink); background: var(--bg); }
[hidden] { display: none !important; }
a { color: var(--primary); }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
button, input, select { font: inherit; color: inherit; }

/* Top bar */
.topbar { display: flex; align-items: center; gap: 12px; padding: 0 16px; min-height: 56px;
  background: var(--topbar); color: var(--topbar-ink); }
.topbar-brand { color: inherit; text-decoration: none; font-weight: 700; margin-right: auto; white-space: nowrap; }
.topbar-user { font-size: .9rem; opacity: .85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.topbar form { margin: 0; }
.topbar .btn-quiet { color: var(--topbar-ink); border-color: color-mix(in srgb, var(--topbar-ink) 40%, transparent); white-space: nowrap; }
@media (max-width: 480px) { .topbar-user { display: none; } }

.wrap { max-width: 880px; margin: 0 auto; padding: 28px 16px 64px; }
.narrow { max-width: 440px; margin: 0 auto; }
h1 { font-size: 1.8rem; line-height: 1.15; margin: 0 0 8px; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; margin: 0 0 12px; }
.lede { color: var(--muted); margin: 0 0 24px; }
.muted { color: var(--muted); }

/* Cards */
.card { background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius-lg); padding: 20px; margin-bottom: 20px; }

/* Forms */
label { display: block; font-weight: 700; margin-bottom: 6px; }
.field { margin-bottom: 16px; }
.hint { color: var(--muted); font-size: .9rem; margin: 4px 0 0; }
input[type=text], input[type=email], select {
  width: 100%; min-height: 48px; padding: 10px 12px; background: var(--surface);
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
}
input:focus, select:focus { border-color: var(--primary); outline: none; }
.prefixed { display: flex; align-items: stretch; }
.prefixed span { display: flex; align-items: center; padding: 0 10px; border: 1.5px solid var(--line); border-right: 0;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm); color: var(--muted); background: var(--bg); white-space: nowrap; }
.prefixed input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; min-width: 0; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.row > .grow { flex: 1 1 220px; }
.row .field { margin-bottom: 0; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px;
  border: 1.5px solid transparent; border-radius: var(--radius-sm); background: var(--primary); color: var(--primary-ink);
  font-weight: 700; text-decoration: none; cursor: pointer; }
.btn-block { width: 100%; }
.btn-line { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-quiet { background: transparent; color: var(--ink); border-color: var(--line); min-height: 40px; padding: 0 12px; }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--line); min-height: 40px; padding: 0 12px; }
.inline { display: inline; margin: 0; }

/* Alerts: color, text and an icon together */
.alert { padding: 12px 14px; border-radius: var(--radius-sm); border: 1.5px solid; font-weight: 700; margin: 0 0 20px; }
.alert::before { margin-right: 8px; }
.alert-danger { color: var(--danger); border-color: var(--danger); }
.alert-danger::before { content: "⚠"; }
.alert-success { color: var(--success); border-color: var(--success); }
.alert-success::before { content: "✓"; }

/* Chips */
.chip { display: inline-flex; align-items: center; min-height: 28px; padding: 0 10px; border-radius: 999px;
  border: 1.5px solid var(--line); font-size: .82rem; font-weight: 700; color: var(--muted); text-transform: capitalize; }

/* Org list */
.org-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.org-list a { display: flex; align-items: center; gap: 12px; padding: 14px 16px; min-height: 56px; text-decoration: none; color: var(--ink);
  background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius-lg); }
.org-list a:hover { border-color: var(--primary); }
.org-list .text { margin-right: auto; min-width: 0; }
.org-list .name { display: block; font-weight: 700; overflow-wrap: anywhere; }
.org-list .slug { display: block; color: var(--muted); font-size: .9rem; overflow-wrap: anywhere; }

/* People list */
.people { list-style: none; margin: 0; padding: 0; }
.people.card { padding: 4px 16px; } /* a list in a card: rows inset from its edge */
.people li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.people li:first-child { border-top: 0; }
.people .who { flex: 1 1 220px; min-width: 0; }
.people .who > b, .people .who > span:not(.avatar) { display: block; overflow-wrap: anywhere; }
.people .who > span:not(.avatar) { color: var(--muted); font-size: .9rem; }
.people .who b .chip { margin-left: 6px; vertical-align: 1px; min-height: 22px; font-size: .75rem; }
.people .actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.people select { width: auto; min-height: 40px; }
/* A session's location and its map link: side by side, the link wrapping under a long venue. */
.people .who > span.ws-where { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 12px; row-gap: 2px; }
.map-link { font-weight: 600; white-space: nowrap; text-underline-offset: 2px; }
.map-link:hover, .map-link:focus-visible { text-decoration-thickness: 2px; }

.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); margin: 20px 0; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.empty { text-align: center; padding: 28px 16px; color: var(--muted); }
.mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; }
.crumb { margin: 0 0 4px; color: var(--muted); }

/* ---- M2: org tabs, events home, event pages ---------------------------- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.org-title { margin-bottom: 12px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1.5px solid var(--line); margin: 0 0 20px; }
.tabs a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; color: var(--muted); text-decoration: none;
  font-weight: 700; border-bottom: 3px solid transparent; margin-bottom: -1.5px; }
.tabs a[aria-current="page"], .tabs a[aria-current="true"] { color: var(--ink); border-bottom-color: var(--primary); }
.alert-info { color: var(--ink); border-color: var(--line); font-weight: 400; }
.alert-info::before { content: "ℹ"; }
textarea { width: 100%; padding: 10px 12px; background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius-sm); font: inherit; color: inherit; }
textarea:focus { border-color: var(--primary); outline: none; }
input[type=search], input[type=url], input[type=datetime-local] {
  width: 100%; min-height: 48px; padding: 10px 12px; background: var(--surface);
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
}
fieldset.group { border: 0; padding: 0; margin: 4px 0 8px; }
fieldset.group legend { font-weight: 700; font-size: 1.05rem; margin-bottom: 8px; }
.row .field { margin-bottom: 16px; }
.check { display: flex; gap: 10px; align-items: center; font-weight: 400; min-height: 44px; }
.check input { width: 20px; height: 20px; }
.prewrap { white-space: pre-wrap; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 12px; }
.facts dt { font-weight: 700; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.event-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.event-head h1 { margin: 0; overflow-wrap: anywhere; }
.danger-zone { border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }

/* Status chips: color + icon + text */
.status { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 0 10px; border-radius: 999px;
  font-size: .82rem; font-weight: 700; border: 1.5px solid currentColor; white-space: nowrap; }
.status-draft, .status-finished, .status-archived { color: var(--muted); }
.status-published { color: var(--primary); }
.status-live { color: var(--success); }
.status-trash { color: var(--danger); }

/* Events home: views on the left, list on the right */
.home { display: grid; grid-template-columns: 200px 1fr; gap: 24px; align-items: start; }
.home > * { min-width: 0; } /* let the scrolling views row shrink instead of widening the page */
.views ul { list-style: none; margin: 14px 0 0; padding: 0; }
.views li a { display: flex; align-items: center; min-height: 44px; padding: 0 12px; border-radius: var(--radius-sm); color: var(--ink); text-decoration: none; }
.views li a[aria-current="page"] { background: color-mix(in srgb, var(--primary) 14%, transparent); font-weight: 700; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
.toolbar input[type=search] { flex: 1 1 220px; width: auto; }
.toolbar select { width: auto; min-height: 48px; }
.layout-switch { display: inline-flex; gap: 4px; }
.layout-switch [aria-current="true"] { border-color: var(--primary); color: var(--primary); }
.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.cards.grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.event-card { margin: 0; padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.event-card h3 { margin: 4px 0 0; font-size: 1.1rem; overflow-wrap: anywhere; }
.event-card h3 a { color: var(--ink); text-decoration: none; }
.event-card h3 a:hover { text-decoration: underline; }
.event-card p { margin: 0; }
.ec-top, .ec-foot { display: flex; align-items: center; gap: 8px; }
.ec-top { justify-content: space-between; }
.ec-foot { margin-top: auto; padding-top: 8px; flex-wrap: wrap; }
.ec-meta { display: flex; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: .9rem; }
.owner { display: inline-flex; align-items: center; gap: 6px; margin-right: auto; font-size: .9rem; min-width: 0; overflow-wrap: anywhere; }
.cards.list .event-card { display: grid; grid-template-columns: 120px 1fr auto; grid-template-areas: "status name foot" "status meta foot"; align-items: center; gap: 2px 16px; }
.cards.list .ec-top { grid-area: status; }
.cards.list h3 { grid-area: name; margin: 0; }
.cards.list .ec-meta, .cards.list .muted { grid-area: meta; }
.cards.list .ec-foot { grid-area: foot; margin: 0; padding: 0; }
.cards.list .ec-meta { display: none; }
.star { background: none; border: 0; font-size: 1.4rem; line-height: 1; min-width: 44px; min-height: 44px; cursor: pointer; color: var(--muted); }
.star.on { color: var(--warning); }
.avatar { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; flex: none;
  background: var(--primary); color: var(--primary-ink); font-size: .8rem; font-weight: 700; }
/* Grid only when the row leads with an avatar; without one, name and detail stack as blocks (see .people .who above). */
.people .who:has(> .avatar) { display: grid; grid-template-columns: auto 1fr; column-gap: 10px; align-items: center; }
.people .who .avatar { grid-row: span 2; }
.menu { position: relative; }
.menu summary { list-style: none; }
.menu summary::-webkit-details-marker { display: none; }
.menu-body { position: absolute; right: 0; top: calc(100% + 4px); z-index: 5; min-width: 180px; padding: 6px;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius-sm); box-shadow: 0 8px 24px rgba(0,0,0,.18); }
.menu-body form { margin: 0; }
.menu-body button { width: 100%; text-align: left; min-height: 44px; padding: 0 10px; background: none; border: 0; border-radius: 6px; cursor: pointer; font-weight: 700; }
.menu-body button:hover { background: var(--bg); }
.menu-body .danger { color: var(--danger); }
.audit { list-style: none; margin: 0; padding: 0; }
.audit li { padding: 10px 0; border-top: 1px solid var(--line); }
.audit li:first-child { border-top: 0; }
.audit time { color: var(--muted); font-size: .85rem; }
.audit p { margin: 2px 0 0; overflow-wrap: anywhere; }
@media (max-width: 720px) {
  .home { grid-template-columns: 1fr; }
  .views ul { display: flex; gap: 4px; overflow-x: auto; margin-top: 10px; }
  .views li a { white-space: nowrap; }
  .cards.list .event-card { grid-template-columns: 1fr; grid-template-areas: "status" "name" "meta" "foot"; }
}
.row.cols { align-items: flex-start; } /* form fields side by side, tops aligned */

/* ---- M3: registration, participants, public page ---------------------- */
.fields { list-style: none; margin: 0 0 16px; padding: 0; }
.fields > li { border-top: 1px solid var(--line); padding: 10px 0; }
.fields > li:first-child { border-top: 0; }
.field-row { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.field-row .who { flex: 1 1 220px; min-width: 0; }
.field-row .who > b, .field-row .who > span { display: block; overflow-wrap: anywhere; }
.field-row .who > span { color: var(--muted); font-size: .88rem; }
.field-row .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.fields details { margin-top: 8px; }
.fields summary, .add-field summary { cursor: pointer; font-weight: 700; color: var(--primary); min-height: 44px; display: inline-flex; align-items: center; }
.add-field summary { color: var(--ink); }
.add-field[open] summary { margin-bottom: 12px; }
.req { color: var(--danger); }
.btn:disabled { opacity: .45; cursor: default; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.filters a { display: inline-flex; gap: 6px; align-items: center; min-height: 40px; padding: 0 12px; border: 1.5px solid var(--line);
  border-radius: 999px; color: var(--ink); text-decoration: none; font-weight: 700; font-size: .9rem; }
.filters a[aria-current="page"] { border-color: var(--primary); color: var(--primary); }
.filters .count { color: var(--muted); font-weight: 400; }
.pstatus { display: inline-flex; align-items: center; min-height: 28px; padding: 0 10px; border-radius: 999px; font-size: .82rem; font-weight: 700; border: 1.5px solid currentColor; }
.pstatus-registered { color: var(--success); }
.pstatus-pending { color: var(--warning); }
.pstatus-waitlisted { color: var(--primary); }
.pstatus-cancelled { color: var(--danger); }
.people code { font-size: .85rem; }
.field-error { color: var(--danger); font-weight: 700; margin: 4px 0 0; font-size: .92rem; }
[aria-invalid="true"] { border-color: var(--danger) !important; }
.public h1 { margin-top: 4px; }
input[type=number], input[type=date], input[type=tel] {
  width: 100%; min-height: 48px; padding: 10px 12px; background: var(--surface);
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
}
.topbar-link { color: var(--topbar-ink); font-weight: 700; text-decoration: none; white-space: nowrap; }
.topbar-link:hover { text-decoration: underline; }
.past { opacity: .75; }
.pass-layout { display: grid; grid-template-columns: minmax(0, 340px) 1fr; gap: 24px; align-items: start; }
.pass-figure { margin: 0; }
.pass-figure img { display: block; width: 100%; height: auto; border-radius: var(--radius-lg); border: 1.5px solid var(--line); background: #fff; }
@media (max-width: 720px) { .pass-layout { grid-template-columns: 1fr; } }

/* ---- M4: scanner, dashboard ------------------------------------------- */
.tab-scan { color: var(--primary) !important; }
.scan-controls { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: flex-end; margin-bottom: 12px; }
.scan-controls .field { margin: 0; flex: 1 1 240px; }
.scan-controls .fast { min-height: 48px; }
.scan-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.reader { width: 100%; min-height: 0; border-radius: var(--radius-sm); overflow: hidden; margin-bottom: 12px; background: #000; }
.reader:empty { background: transparent; }
.paste { margin-top: 12px; }
.paste summary { cursor: pointer; color: var(--muted); min-height: 44px; display: flex; align-items: center; }
.paste input { flex: 1 1 200px; min-height: 44px; padding: 8px 10px; border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.result { padding: 0; overflow: hidden; }
.band { padding: 22px 20px; font-size: 1.6rem; font-weight: 700; color: #fff; }
.band-green { background: var(--success); }
.band-amber { background: var(--warning); }
.band-red { background: var(--danger); }
.result-body { padding: 16px 20px 20px; }
.result-body h2 { font-size: 1.6rem; margin: 4px 0 2px; overflow-wrap: anywhere; }
.detail { font-weight: 700; margin: 0 0 6px; }
.recent { list-style: none; margin: 0; padding: 0; }
.recent li { padding: 8px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.recent li:first-child { border-top: 0; }
.recent .undone b { text-decoration: line-through; }
.scan-toggles { display: flex; flex-wrap: wrap; gap: 0 16px; }
.viewfinder { position: relative; border-radius: var(--radius-sm); }
.viewfinder .reader { margin-bottom: 12px; }
/* The camera in a box of its own shape, whatever the camera sends: a
   phone's tall portrait stream or a laptop's wide one. The video keeps its
   true shape (the library sizes its decoding canvas from it: squash the
   video and codes stop reading) and the box crops it, centered. Our frame
   marks where to hold the pass; the library's overlay is hidden. */
.viewfinder.is-live { width: min(100%, 52vh); width: min(100%, 52dvh); margin: 0 auto 12px; aspect-ratio: 1; overflow: hidden; background: #000; }
.viewfinder.is-live .reader { position: absolute !important; inset: 0; width: auto !important; height: auto !important; margin: 0; padding: 0 !important; border: 0 !important; overflow: hidden; border-radius: 0; }
.viewfinder.is-live .reader video { position: absolute; left: 0; top: 50%; width: 100% !important; height: auto !important;
  transform: translateY(-50%); display: block; }
#qr-shaded-region { display: none !important; }
.scan-frame { display: none; }
.viewfinder.is-live .scan-frame { display: block; position: absolute; z-index: 1; left: 50%; top: 50%; width: 70%; aspect-ratio: 1;
  transform: translate(-50%, -50%); border-radius: 14px; pointer-events: none;
  box-shadow: 0 0 0 100vmax rgb(0 0 0 / .35); outline: 3px solid rgb(255 255 255 / .9); outline-offset: -3px; }
.viewfinder.flash-green { animation: flash-green .7s ease-out; }
.viewfinder.flash-amber { animation: flash-amber .7s ease-out; }
.viewfinder.flash-red { animation: flash-red .7s ease-out; }
@keyframes flash-green { from { box-shadow: 0 0 0 6px var(--success); } to { box-shadow: 0 0 0 6px transparent; } }
@keyframes flash-amber { from { box-shadow: 0 0 0 6px var(--warning); } to { box-shadow: 0 0 0 6px transparent; } }
@keyframes flash-red { from { box-shadow: 0 0 0 6px var(--danger); } to { box-shadow: 0 0 0 6px transparent; } }
.cam-tools { position: absolute; top: 8px; right: 8px; display: flex; gap: 8px; z-index: 2; }
.cam-tool { min-height: 44px; padding: 0 14px; border-radius: 999px; border: 0; font-weight: 700; cursor: pointer;
  color: #fff; background: rgb(0 0 0 / .55); backdrop-filter: blur(4px); }
.cam-tool[aria-pressed="true"] { color: #111; background: #FFD54A; }
#r-close { margin-left: auto; }
@media (max-width: 720px) {
  /* A phone in one hand: camera first, the result slides up over it. */
  main:has(> .scanner) { padding-top: 10px; }
  .scanner .crumb { font-size: .9rem; }
  .scan-controls { gap: 0 12px; margin-bottom: 8px; }
  .scan-controls .field { flex-basis: 100%; }
  .scanner .camera { padding: 10px; margin-bottom: 12px; }
  .result { position: fixed; z-index: 1000; left: 0; right: 0; bottom: 0; margin: 0; max-height: 78vh; max-height: 78dvh;
    overflow-y: auto; overscroll-behavior: contain; border: 0; border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    box-shadow: 0 -10px 32px rgb(0 0 0 / .35); padding-bottom: env(safe-area-inset-bottom, 0px); animation: sheet-up .18s ease-out; }
  .band { padding: 18px 16px; font-size: 1.5rem; }
  .result-body { padding: 12px 16px 16px; }
  .result-body h2 { font-size: 1.45rem; }
  #r-actions .btn { flex: 1 1 40%; min-height: 56px; font-size: 1.05rem; }
  #r-close { margin-left: 0; }
  .scanner.sheet-open { padding-bottom: 50vh; } /* the lists can still scroll clear of it */
}
@keyframes sheet-up { from { transform: translateY(40%); opacity: .4; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .result, .viewfinder[class*="flash-"] { animation: none !important; }
}
.live { display: flex; align-items: center; gap: 6px; }
.live .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--success); display: inline-block; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.tile { background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius-lg); padding: 16px; display: flex; flex-direction: column; }
.tile-n { font-size: 2.2rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.tile-l { color: var(--muted); }
.tile-ok .tile-n { color: var(--success); }
.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.bars li { display: grid; grid-template-columns: minmax(0, 180px) 1fr 48px; gap: 10px; align-items: center; }
.bar-label { overflow-wrap: anywhere; }
.bar { height: 14px; background: var(--bg); border-radius: 999px; overflow: hidden; }
.bar-fill { display: block; height: 100%; width: 0; background: var(--primary); border-radius: 999px; }
.bar-n { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
.spark { height: 90px; display: flex; align-items: flex-end; gap: 2px; border-bottom: 1.5px solid var(--line); }
.spark span { flex: 1; background: var(--primary); min-height: 1px; border-radius: 2px 2px 0 0; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 8px 6px; border-top: 1px solid var(--line); }
.table thead th { border-top: 0; color: var(--muted); font-size: .9rem; }
@media (min-width: 721px) {
  .viewfinder.is-live { width: 100%; aspect-ratio: 16 / 9; } /* a laptop webcam's shape */
  .viewfinder.is-live .scan-frame { width: auto; height: 70%; }
}
@media (max-width: 720px) {
  .scan-grid { grid-template-columns: 1fr; }
  .bars li { grid-template-columns: minmax(0, 1fr) 80px 40px; }
}

/* ---- M5: pass designer -------------------------------------------------- */
.designer-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 4px; }
.designer-bar #tpl-name { flex: 1 1 220px; width: auto; font-weight: 700; font-size: 1.2rem; }
.designer-bar select { width: auto; min-height: 44px; }
.problems { list-style: none; margin: 0 0 12px; padding: 0; color: var(--danger); font-weight: 700; }
.problems li::before { content: "⚠ "; }
.designer-grid { display: grid; grid-template-columns: 220px minmax(0, 1fr) 280px; gap: 16px; align-items: start; }
.stage-wrap { min-width: 0; }
.stage { position: relative; width: 100%; max-width: 420px; margin: 0 auto; background: #fff; border: 1.5px solid var(--line); border-radius: 8px; outline-offset: 4px; }
.stage img { display: block; width: 100%; height: 100%; border-radius: 6px; }
.overlay { position: absolute; inset: 0; touch-action: none; }
.sel { position: absolute; border: 1px dashed transparent; cursor: move; }
.sel:hover { border-color: color-mix(in srgb, var(--primary) 60%, transparent); }
.sel.on { border: 2px solid var(--primary); }
.sel.bad { border: 2px solid var(--danger); }
.handle { position: absolute; right: -7px; bottom: -7px; width: 14px; height: 14px; background: var(--primary); border: 2px solid #fff; border-radius: 3px; cursor: nwse-resize; }
.guide { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1px dashed color-mix(in srgb, var(--primary) 30%, transparent); pointer-events: none; }
.layer-list { list-style: none; margin: 0 0 12px; padding: 0; }
.layer-list li { display: flex; align-items: center; gap: 4px; border-radius: 6px; }
.layer-list li.on { background: color-mix(in srgb, var(--primary) 14%, transparent); }
.layer { flex: 1; text-align: left; background: none; border: 0; min-height: 40px; cursor: pointer; font-weight: 700; padding: 0 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.btn.mini { min-height: 32px; min-width: 32px; padding: 0 6px; }
.add-row { display: flex; flex-wrap: wrap; gap: 6px; }
.props .field { margin-bottom: 10px; }
.props input, .props select, .props textarea { min-height: 40px; }
.vars ul { padding-left: 18px; font-size: .85rem; }
.gallery .event-card h3 { margin: 0; }
@media (max-width: 1000px) { .designer-grid { grid-template-columns: 1fr; } }

/* ---- Integrations (M5) ---- */
.integrations { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); align-items: start; }
.integrations .row form { margin: 0; }
.integrations .card > .row { margin-top: 16px; }
.integrations .row input[type=url] { flex: 1 1 220px; min-width: 0; }
.integration-status { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; color: var(--muted); }
.chip-success { color: var(--success); border-color: var(--success); }
.chip-warning { color: var(--warning); border-color: var(--warning); }
.chip-danger { color: var(--danger); border-color: var(--danger); }
.map-table select { width: 100%; }
a.btn[aria-disabled=true] { opacity: .5; pointer-events: none; }

/* ---- Setup checklist (M6) ---- */
.checklist { margin-bottom: 24px; }
.checklist-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.checklist-head h2 { margin: 0; }
.checklist-head p { margin: 4px 0 0; }
.checklist progress { width: 100%; height: 8px; margin: 14px 0 6px; accent-color: var(--primary); }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px 24px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.steps li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; }
.step-mark { flex: none; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-weight: 700; font-size: .85rem; }
.steps li.done .step-mark { background: var(--success); border-color: var(--success); color: var(--surface); }
.steps li.next .step-mark { border-color: var(--primary); }
.step-text { display: grid; gap: 2px; min-width: 0; }
.step-title { font-weight: 700; }
.steps li.done .step-title { color: var(--muted); text-decoration: line-through; }
.steps .hint { margin: 0; }

/* ---- Help (M6) ---- */
.help { display: grid; gap: 32px; grid-template-columns: minmax(0, 220px) minmax(0, 1fr); align-items: start; }
.help-nav { position: sticky; top: 16px; font-size: .95rem; }
.help-nav h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 18px 0 6px; }
.help-nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.help-nav a { display: block; padding: 5px 8px; border-radius: var(--radius-sm); color: var(--ink); text-decoration: none; }
.help-nav a:hover { text-decoration: underline; }
.help-nav a[aria-current=page] { background: color-mix(in srgb, var(--primary) 12%, transparent); color: var(--primary); font-weight: 700; }
.help-home { font-weight: 700; }
.help-article { max-width: 70ch; line-height: 1.6; }
.help-article h1 { margin-top: 0; }
.help-article h2 { margin: 28px 0 8px; font-size: 1.2rem; }
.help-article .lead { font-size: 1.1rem; color: var(--muted); }
.help-article li { margin: 6px 0; }
.help-article code { font-size: .9em; background: color-mix(in srgb, var(--line) 50%, transparent); padding: 1px 5px; border-radius: 4px; overflow-wrap: anywhere; }
.help-steps { padding-left: 1.4em; }
.help-cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }
.help-card { display: grid; gap: 4px; height: 100%; color: var(--ink); text-decoration: none; }
.help-card:hover b { text-decoration: underline; }
.help-group h2 { font-size: 1.1rem; }
@media (max-width: 720px) {
  .help { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .help-nav { position: static; order: 2; border-top: 1px solid var(--line); padding-top: 8px; }
  .help-nav-index { display: none; } /* the index lists every topic already */
}

/* ---- Profiles and the participant map (beta) ---- */
.chip-beta { min-height: 20px; padding: 0 7px; font-size: .7rem; letter-spacing: .03em; text-transform: uppercase; color: var(--primary); border-color: var(--primary); vertical-align: middle; }
.profile-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.profile-head h2 { margin: 0; }
.profile-photo { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 8px; }
.profile-photo img, .avatar-empty { width: 120px; height: 120px; border-radius: 50%; object-fit: cover; flex: none; }
.avatar-empty { display: grid; place-items: center; background: color-mix(in srgb, var(--primary) 14%, transparent); color: var(--primary); font-size: 2.4rem; font-weight: 700; }
.profile-photo .field { flex: 1 1 220px; min-width: 0; }
.profile-form .check span { display: inline; }
.share-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.share-row .hint { margin: 0; flex: 1 1 240px; }
#share[aria-pressed=true] { background: var(--danger); border-color: var(--danger); }
.pmap-grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); margin: 16px 0; align-items: start; }
.map { height: min(70vh, 640px); min-height: 360px; border-radius: var(--radius-lg); border: 1.5px solid var(--line); z-index: 0; }
.people-card { max-height: min(70vh, 640px); overflow: auto; }
.people-card input[type=search] { width: 100%; margin-bottom: 8px; }
.map-people { list-style: none; margin: 0; padding: 0; }
.map-people li { padding: 10px 0; border-top: 1px solid var(--line); display: grid; gap: 6px; }
.person { display: flex; gap: 10px; align-items: flex-start; min-width: 0; }
.person > div { display: grid; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.person-photo { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex: none; }
.avatar-initials { display: grid; place-items: center; background: color-mix(in srgb, var(--primary) 14%, transparent); color: var(--primary); font-weight: 700; }
.person-links { display: flex; gap: 10px; flex-wrap: wrap; font-size: .9rem; }
.map-pin { width: 44px; height: 44px; border-radius: 50%; border: 3px solid var(--surface); box-shadow: 0 1px 4px rgb(0 0 0 / .35); overflow: hidden; background: var(--surface); }
.map-pin-me { border-color: var(--primary); }
.map-pin-photo { width: 100%; height: 100%; object-fit: cover; display: grid; place-items: center; font-size: .85rem; }
.leaflet-popup-content .person { min-width: 200px; }
.feedback-form { display: grid; gap: 10px; max-width: 560px; }
.feedback-form [aria-pressed=true] { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.map-rules { margin: 0 0 16px; padding-left: 1.2em; }
.map-rules li { margin: 4px 0; }
.feedback-list { list-style: none; margin: 0; padding: 0; }
.feedback-list li { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.feedback-list p { margin: 0 0 2px; }
.fb-rating { font-size: 1.3rem; }
@media (max-width: 820px) {
  .pmap-grid { grid-template-columns: minmax(0, 1fr); }
  .map { height: 55vh; }
  .people-card { max-height: none; }
}

/* ---- Under 18 ---- */
.chip-minor { min-height: 22px; padding: 0 8px; font-size: .75rem; font-weight: 700; color: var(--warning); border-color: var(--warning);
  background: color-mix(in srgb, var(--warning) 12%, transparent); vertical-align: middle; }
a.tile-minor { color: inherit; text-decoration: none; border-color: var(--warning); }
a.tile-minor:hover .tile-l { text-decoration: underline; }

/* Shared feedback for full-page navigation and form submissions. */
.loading-track { position: fixed; z-index: 1100; inset: 0 0 auto; height: 3px; overflow: hidden; background: transparent; }
.loading-track-bar { display: block; width: 35%; height: 100%; background: var(--primary); animation: loading-travel 1.1s ease-in-out infinite; }
.btn.is-loading { cursor: progress; }
.btn.is-loading::before {
  width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  content: ""; animation: loading-spin .7s linear infinite;
}
@keyframes loading-travel { from { transform: translateX(-110%); } to { transform: translateX(310%); } }
@keyframes loading-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .loading-track-bar { width: 100%; animation: none; }
  .btn.is-loading::before { border-right-color: currentColor; border-top-color: transparent; animation: none; }
}
.claims { list-style: none; padding: 0; margin: 0; }
.claims li { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; padding: .5rem 0; border-top: 1px solid var(--line, #ddd); }
.claims li:first-child { border-top: 0; }

/* ---- Participants: toolbar, rows, profile, side panel (htmx) ---------------- */
/* htmx's request indicator (its own stylesheet is off: includeIndicatorCSS). */
.htmx-indicator { opacity: 0; visibility: hidden; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; visibility: visible; transition: opacity .2s ease-in .2s; }
[hx-disable] button:disabled, a[disabled] { cursor: progress; }
.flash { position: sticky; top: 8px; z-index: 50; }
.flash .alert { box-shadow: 0 6px 20px rgb(0 0 0 / .12); background: var(--surface); }
.p-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; margin-bottom: 12px; }
.disclosure { position: relative; }
.disclosure > summary, .menu > summary { list-style: none; }
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure-body { position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; width: min(440px, calc(100vw - 32px));
  margin: 0; box-shadow: 0 12px 32px rgb(0 0 0 / .18); }
.disclosure-body .hint:last-child { margin-top: 12px; }
.menu-body a { display: flex; align-items: center; min-height: 44px; padding: 0 10px; border-radius: 6px; color: var(--ink);
  text-decoration: none; font-weight: 700; }
.menu-body a:hover, .menu-body a:focus-visible { background: var(--bg); }
.p-summary { margin: 0 0 8px; font-size: .92rem; }
.people .p-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px 12px; align-items: center; }
/* Organizers' rows start with a selection checkbox (form#p-bulk). */
.people .p-row-pick { grid-template-columns: 20px minmax(0, 1fr) auto auto; }
.p-row:focus { outline: none; }
.p-row:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.p-name { color: var(--ink); text-decoration: none; }
.p-name:hover, .p-name:focus-visible { color: var(--primary); text-decoration: underline; }
.p-state { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: flex-end; }
.people .p-more { display: flex; justify-content: center; }
.chip-ok { color: var(--success); border-color: var(--success); }
.chip-private { min-height: 20px; padding: 0 6px; font-size: .72rem; font-weight: 700; color: var(--muted); vertical-align: 1px; }
@media (max-width: 720px) {
  .people .p-row { grid-template-columns: minmax(0, 1fr) auto; }
  .people .p-row .who { grid-column: 1 / -1; }
  .people .p-row-pick { grid-template-columns: 20px minmax(0, 1fr) auto; }
  .people .p-row-pick .p-pick { grid-row: 1; grid-column: 1; }
  .people .p-row-pick .who { grid-row: 1; grid-column: 2 / -1; }
  .people .p-row-pick .p-state { grid-column: 2; }
  .p-state { justify-content: flex-start; }
  .disclosure { position: static; }
  .disclosure-body { left: 16px; right: 16px; width: auto; }
}

/* Side panel and confirmations */
dialog.drawer { margin: 0 0 0 auto; padding: 0; width: min(580px, 100vw); max-width: 100vw; height: 100vh; height: 100dvh;
  max-height: 100dvh; border: 0; background: var(--surface); color: var(--ink); box-shadow: -12px 0 40px rgb(0 0 0 / .25); }
dialog.drawer[open] { animation: drawer-in .18s ease-out; }
dialog::backdrop { background: rgb(0 0 0 / .45); }
.drawer-bar { position: sticky; top: 0; z-index: 2; display: flex; justify-content: flex-end; padding: 10px 12px;
  background: var(--surface); border-bottom: 1px solid var(--line); }
#drawer-body { padding: 16px 20px 40px; }
.drawer-link { margin: 0 0 8px; font-size: .9rem; }
@keyframes drawer-in { from { transform: translateX(40px); opacity: .5; } to { transform: none; opacity: 1; } }
.confirm-dialog { width: min(440px, calc(100vw - 32px)); padding: 20px; border: 0; border-radius: var(--radius-lg);
  background: var(--surface); color: var(--ink); box-shadow: 0 20px 50px rgb(0 0 0 / .3); }
.confirm-dialog p { margin: 0 0 16px; font-weight: 700; }
.confirm-dialog .row { justify-content: flex-end; }

/* Profile */
.profile:focus { outline: none; }
.pp-head { display: flex; gap: 14px; align-items: center; margin-bottom: 12px; }
.pp-head > div { min-width: 0; }
.pp-head .avatar { width: 52px; height: 52px; font-size: 1.3rem; }
.pp-head h2 { font-size: 1.45rem; margin: 0 0 4px; overflow-wrap: anywhere; }
.profile-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.profile-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0 8px; }
.profile-actions form.inline { display: flex; }
.profile-section { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 18px; }
.profile-section h3 { font-size: 1.05rem; margin: 0 0 10px; }
.profile .facts dd { white-space: pre-line; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 8px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.timeline li:first-child { border-top: 0; }
.timeline .undone b { text-decoration: line-through; }
.timeline .field-error { display: block; }
.mail-status { font-size: .85rem; font-weight: 700; margin: 0 4px; }
.mail-sent { color: var(--success); }
.mail-failed { color: var(--danger); }
.mail-queued, .mail-sending { color: var(--warning); }
@media (max-width: 560px) {
  .profile .facts { grid-template-columns: 1fr; gap: 2px; }
  .profile .facts dd { margin-bottom: 8px; }
  #drawer-body { padding: 12px 16px 32px; }
}
@media (prefers-reduced-motion: reduce) { dialog.drawer[open] { animation: none; } }

/* ---- Event navigation: groups, the current group's sections, Scan ---------- */
.event-nav { display: flex; align-items: flex-end; gap: 12px; border-bottom: 1.5px solid var(--line); margin: 0 0 8px; }
.event-nav .tabs { flex: 1; min-width: 0; border-bottom: 0; margin: 0; }
.event-nav .btn-scan { margin-bottom: 6px; min-height: 40px; padding: 0 16px; flex: none; }
.subtabs { display: flex; gap: 4px; margin: 0 0 20px; }
.subtabs a { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px; border-radius: 999px;
  color: var(--muted); font-weight: 700; text-decoration: none; white-space: nowrap; }
.subtabs a:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 6%, transparent); }
.subtabs a[aria-current="page"] { color: var(--primary); background: color-mix(in srgb, var(--primary) 12%, transparent); }
.event-nav + :not(.subtabs) { margin-top: 20px; }
/* One row each on a phone, scrolling sideways instead of wrapping. */
@media (max-width: 720px) {
  .tabs, .subtabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity; }
  .tabs::-webkit-scrollbar, .subtabs::-webkit-scrollbar { display: none; }
  .tabs a, .subtabs a { flex: none; white-space: nowrap; scroll-snap-align: start; }
  .tabs a { padding: 0 12px; }
}

/* Dashboard downloads */
.downloads { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 10px; }
.downloads li { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 4px 14px; align-items: center; }
.downloads .btn { justify-content: flex-start; }
.downloads span { color: var(--muted); font-size: .92rem; }
@media (max-width: 560px) { .downloads li { grid-template-columns: 1fr; } .downloads .btn { justify-content: center; } }

/* Profile: sessions */
.session-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.session-row > div { min-width: 0; }
.session-row > div > span { display: block; }
.session-row form { margin: 0; flex: none; }
.session-add { margin-top: 10px; align-items: center; }
.session-add select { flex: 1 1 220px; width: auto; min-height: 44px; }

/* Participant list selection bar (form#p-bulk) */
.bulk-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin: 0 0 12px; padding: 8px 12px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.bulk-bar.has-selection { position: sticky; top: 0; z-index: 5; border-color: currentColor; }
.bulk-bar .bulk-actions { display: flex; gap: 8px; margin-left: auto; }
.people .p-pick { width: 20px; height: 20px; margin: 0; }
.delete-list { margin: 0 0 20px; padding-left: 20px; max-height: 50vh; overflow: auto; }
.delete-list li { padding: 4px 0; overflow-wrap: anywhere; }
