/* Member layouts share Bootstrap and semantic tokens with the management console. */
:root {
  --bg: var(--ui-bg);
  --surface: var(--ui-surface);
  --surface-muted: var(--ui-surface-muted);
  --text: var(--ui-text);
  --muted: var(--ui-muted);
  --primary: var(--ui-primary);
  --primary-hover: var(--ui-primary-hover);
  --border: var(--ui-border);
  --danger: var(--ui-danger);
  --danger-bg: var(--ui-danger-bg);
  --warning: var(--ui-warning);
  --warning-bg: var(--ui-warning-bg);
  --focus: var(--ui-focus);
  --radius: var(--ui-radius-panel);
  --shadow: var(--ui-shadow);
  --account-nav-height: 80px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
.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; }
html { scroll-padding-bottom: calc(var(--account-nav-height) + 24px); }
body { margin: 0; min-height: 100vh; min-height: 100dvh; background: var(--bg); color: var(--text); font-family: var(--ui-font-sans); line-height: 1.6; }
h1, h2, h3, h4, h5, h6 { font-weight: 700; }
a { color: var(--primary); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; }
button, a, summary, label { touch-action: manipulation; }
.skip-link { position: absolute; left: -9999px; top: 8px; }
.skip-link:focus { left: 8px; z-index: 60; background: var(--surface); padding: 8px 12px; }
.site-header { min-height: 64px; display: flex; align-items: center; max-width: 920px; margin: auto; padding: 8px 16px; }
.brand { min-width: 48px; min-height: 48px; display: inline-flex; align-items: center; color: var(--text); font-size: 1.25rem; font-weight: 800; text-decoration: none; white-space: nowrap; }
.page-shell { width: min(100% - 32px, 760px); margin: 24px auto 64px; }
.has-member-nav .page-shell { padding-bottom: calc(var(--account-nav-height) + 24px + env(safe-area-inset-bottom)); }

.account-nav {
  position: fixed;
  z-index: 20;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  padding: 4px 4px max(4px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 -4px 16px rgb(15 75 69 / 10%);
}
.account-nav-link {
  position: relative;
  min-width: 0;
  min-height: 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 2px;
  color: var(--muted);
  font-size: max(.78rem, 12px);
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
}
.account-nav-link::before { content: ""; position: absolute; top: 0; left: 24%; width: 52%; height: 3px; border-radius: 0 0 3px 3px; background: transparent; }
.account-nav-link.is-active { color: var(--primary); font-weight: 800; }
.account-nav-link.is-active::before { background: currentColor; }
.nav-icon { width: 22px; height: 22px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nav-icon-wrap { position: relative; display: inline-flex; }
.nav-label { white-space: nowrap; }
.nav-badge { position: absolute; top: -7px; left: 15px; min-width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; padding: 0 5px; border: 2px solid var(--surface); border-radius: 999px; background: var(--danger); color: white; font-size: 10px; font-weight: 800; line-height: 1; }

.hero { padding: 40px 0 24px; }
.hero h1 { font-weight: 800; margin: 4px 0 16px; font-size: clamp(2rem, 8vw, 3.5rem); line-height: 1.18; letter-spacing: -.04em; }
.page-heading h1, .form-card h1, .empty-state h1, .detail-card h1 { margin: 4px 0 12px; font-size: 1.5rem; line-height: 1.34; letter-spacing: -.02em; }
h2 { line-height: 1.4; }
.lead { max-width: 34rem; color: var(--muted); font-size: 1.1rem; margin-bottom: 28px; }
.eyebrow { color: var(--primary); font-weight: 750; letter-spacing: .04em; font-size: .8rem; }
.button { min-height: var(--ui-control-height); display: inline-flex; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: var(--ui-radius-control); padding: 10px 18px; font-weight: 700; text-decoration: none; cursor: pointer; }
.primary { color: var(--ui-on-primary); background: var(--primary); }
.primary:hover { color: var(--ui-on-primary); background: var(--primary-hover); }
.secondary { color: var(--primary); background: var(--surface); border-color: var(--border); }
.secondary:hover { color: var(--primary-hover); background: var(--surface-muted); }
.site-management-link { margin-left: auto; }
.danger { color: white; background: var(--danger); border-color: var(--danger); }
.danger:hover { filter: brightness(.92); }
.secondary-danger { color: var(--danger); background: var(--surface); }
.button:disabled, button:disabled { opacity: .5; cursor: not-allowed; }
.button:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible, a:focus-visible, dialog:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.secondary-action, .help { color: var(--muted); font-size: .9rem; }
.boundary-card, .form-card, .empty-state, .status-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.boundary-card h2, .form-card h2, .empty-state h2, .empty-state h3 { margin-top: 0; }
.narrow { max-width: 520px; margin-inline: auto; }
.page-heading { margin-bottom: 24px; }
.field { margin: 20px 0; scroll-margin: 24px 0 calc(var(--account-nav-height) + 24px); }
.field > label:not(.check-label) { display: block; font-weight: 700; margin-bottom: 7px; }
.field input:not([type="checkbox"]):not([type="radio"]), .field select, .field textarea { width: 100%; min-height: 48px; border: 1px solid var(--border); border-radius: var(--ui-radius-control); padding: 10px 12px; background: var(--surface); color: var(--text); font-size: 1rem; }
.check-label { min-height: 48px; display: flex; gap: 10px; align-items: center; cursor: pointer; }
.check-label input { width: 22px; height: 22px; flex: 0 0 auto; }
.field-error, .form-error { color: var(--danger); }
.field-error ul, .form-error ul { margin: 6px 0; padding-left: 20px; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--danger) !important; }
.form-error-summary { margin-bottom: 16px; padding: 16px; border: 1px solid var(--danger); border-radius: 10px; background: var(--danger-bg); color: var(--text); }
.form-error-summary h2 { margin: 0 0 8px; color: var(--danger); font-size: 1.1rem; }
.form-error-summary ul { margin: 0; padding-left: 22px; }
.form-error-summary a { color: var(--danger); font-weight: 700; }
.messages { margin-bottom: 16px; }
.message { border-radius: 10px; padding: 12px 16px; background: var(--surface-muted); }
.network-status { position: sticky; z-index: 30; top: 8px; width: min(100% - 32px, 760px); margin: 0 auto 12px; box-shadow: var(--shadow); }
.status-grid { display: grid; gap: 12px; margin-bottom: 20px; }
.status-card { box-shadow: none; }
.status-card span, .status-card strong { display: block; }
.status-card strong { font-size: 1.15rem; margin-top: 4px; }
.status-card p { color: var(--muted); margin-bottom: 0; }
.secondary-form { margin-top: 12px; }
.logout-form { margin-top: 24px; text-align: center; }
.text-button { min-height: 48px; border: 0; background: transparent; color: var(--primary); text-decoration: underline; cursor: pointer; padding: 12px; }

.hall-heading { display: block; }
.filter-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 4px 16px; margin-bottom: 20px; }
.filter-card summary { min-height: 48px; display: flex; align-items: center; cursor: pointer; font-weight: 750; }
.filter-grid, .field-grid { display: grid; gap: 0 16px; }
.filter-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin: 12px 0; }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 16px; scroll-margin-bottom: calc(var(--account-nav-height) + 24px); }
.compact { margin: 10px 0; }
.compact select, .compact input { width: 100%; min-height: 48px; border: 1px solid var(--border); border-radius: var(--ui-radius-control); padding: 10px 12px; background: var(--surface); color: var(--text); }
.trip-list { display: grid; gap: 12px; }
.trip-card { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; color: var(--text); text-decoration: none; }
a.trip-card:hover { border-color: var(--primary); }
.trip-card h2 { margin: 12px 0 6px; font-size: 1.2rem; }
.trip-card p { color: var(--muted); margin: 3px 0; }
.trip-card-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.role-badge, .status-pill, .short-code { border-radius: 999px; padding: 3px 9px; font-size: .78rem; font-weight: 750; }
.role-badge { background: var(--surface-muted); color: var(--primary); }
.short-code { border: 1px solid var(--border); }
.status-pill { margin-left: auto; background: var(--surface-muted); }
.card-next { display: inline-flex; min-height: 44px; align-items: center; margin-top: 8px; color: var(--primary); font-weight: 700; }
.notification-route { color: var(--text) !important; font-weight: 700; }
.publish-form { display: grid; gap: 16px; }
.publish-form fieldset { margin: 0; }
.publish-form legend { font-size: 1.15rem; font-weight: 800; padding: 0 6px; }
.choice-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.choice-card { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; }
.choice-card:has(input:checked) { border-color: var(--primary); background: var(--surface-muted); color: var(--primary); font-weight: 750; }
.now-choice { margin: 12px 0; }
.full-width { width: 100%; }
.detail-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.detail-list { display: grid; gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.detail-list div { display: grid; grid-template-columns: minmax(88px, 32%) 1fr; background: var(--surface); padding: 12px; }
.detail-list dt { color: var(--muted); }
.detail-list dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.notice { background: var(--surface-muted); border-radius: 10px; padding: 14px; }
.warning { background: var(--warning-bg); color: var(--warning); border: 1px solid currentColor; border-radius: 10px; padding: 14px; }
.share-card { margin-top: 20px; }
.share-card textarea { width: 100%; resize: vertical; border: 1px solid var(--border); border-radius: 8px; padding: 12px; background: var(--surface); color: var(--text); margin-bottom: 12px; }
.back-link { width: fit-content; min-height: 48px; display: inline-flex; align-items: center; gap: 4px; margin: -8px 0 12px; padding: 8px 4px; font-weight: 700; text-decoration: none; }
.back-link svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.settings-card { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); text-decoration: none; }
.settings-card strong, .settings-card small { display: block; }
.settings-card small { color: var(--muted); margin-top: 2px; }
.settings-card > span:last-child { color: var(--primary); font-size: 1.8rem; }
.my-trips-section > h2 { font-size: 1.25rem; }

.confirm-dialog { width: min(100% - 24px, 520px); max-height: calc(100dvh - 24px); margin: auto auto 0; padding: 0; border: 1px solid var(--border); border-radius: 20px 20px 0 0; background: var(--surface); color: var(--text); box-shadow: 0 -8px 32px rgb(15 23 42 / 22%); }
.confirm-dialog::backdrop { background: rgb(15 23 42 / 56%); }
.confirm-dialog-content { padding: 24px; }
.confirm-dialog h2 { margin: 4px 0 12px; font-size: 1.35rem; }
.confirm-dialog form { margin: 0; }

@media (min-width: 640px) {
  .status-grid { grid-template-columns: 1fr 1fr; }
  .filter-grid, .field-grid { grid-template-columns: 1fr 1fr; }
  .page-shell { margin-top: 40px; }
}

@media (min-width: 768px) and (hover: hover) and (pointer: fine) {
  body.has-member-nav { padding-left: 216px; }
  .has-member-nav .site-header { position: fixed; z-index: 20; top: 0; bottom: 0; left: 0; width: 216px; display: block; margin: 0; padding: 24px 16px; border-right: 1px solid var(--border); background: var(--surface); }
  .has-member-nav .brand { margin-bottom: 24px; }
  .account-nav { position: static; display: grid; grid-template-columns: 1fr; gap: 4px; padding: 0; border: 0; background: transparent; box-shadow: none; }
  .account-nav-link { min-height: 52px; flex-direction: row; justify-content: flex-start; gap: 10px; padding: 10px 12px; border-radius: 10px; font-size: .9rem; }
  .account-nav-link::before { top: 14%; bottom: 14%; left: 0; width: 3px; height: auto; border-radius: 0 3px 3px 0; }
  .account-nav-link.is-active { background: var(--surface-muted); }
  .has-member-nav .page-shell { padding-bottom: 40px; }
  .confirm-dialog { margin: auto; border-radius: 16px; }
}

@media (prefers-reduced-motion: no-preference) {
  .button, .account-nav-link, .trip-card { transition: background-color 150ms ease, border-color 150ms ease, opacity 150ms ease; }
  .button:active, .account-nav-link:active, a.trip-card:active { opacity: .78; }
}

@media (prefers-color-scheme: dark) {
  .danger { color: var(--ui-on-primary); }
  .secondary-danger { color: var(--danger); background: var(--surface); }
  .nav-badge { color: var(--ui-bg); }
}
