:root {
  --bg: #f3f9fc;
  --surface: #ffffff;
  --surface-soft: #eaf7fc;
  --text: #172834;
  --muted: #607585;
  --line: #cfe8f2;
  --brand: #4aa6c8;
  --brand-dark: #277da1;
  --brand-deep: #155e75;
  --accent: #f8b84e;
  --danger: #dc2626;
  --shadow: 0 14px 34px rgba(39, 125, 161, 0.12);
  --shadow-soft: 0 8px 18px rgba(39, 125, 161, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(128, 202, 224, 0.26), transparent 34%),
    linear-gradient(180deg, #fbfdff 0%, var(--bg) 46%, #eef8fb 100%);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.loading-toast {
  position: fixed;
  top: calc(14px + env(safe-area-inset-top));
  left: 50%;
  z-index: 100;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: min(360px, calc(100vw - 28px));
  padding: 11px 14px;
  border: 1px solid rgba(74, 166, 200, 0.34);
  border-radius: 999px;
  color: var(--brand-deep);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  transform: translateX(-50%);
  font-size: 14px;
  font-weight: 800;
}

.loading-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(74, 166, 200, 0.24);
  border-top-color: var(--brand-dark);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.is-loading {
  position: relative;
}

.is-loading::before {
  content: "";
  display: inline-block;
  width: 13px;
  height: 13px;
  margin-right: 7px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  vertical-align: -2px;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.app-shell {
  max-width: 620px;
  min-height: 100vh;
  margin: 0 auto;
  background: rgba(243, 249, 252, 0.92);
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 12px;
  background: rgba(248, 253, 255, 0.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(207, 232, 242, 0.82);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.brand-mark {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border-radius: 14px;
  object-fit: cover;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.notification-button {
  position: relative;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--brand-deep);
  background: #fff;
  font-size: 13px;
  font-weight: 800;
  box-shadow: var(--shadow-soft);
}

.notification-button.has-unread {
  border-color: rgba(248, 184, 78, 0.72);
  background: #fff9ec;
}

.notification-button strong {
  position: absolute;
  top: -7px;
  right: -5px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border: 2px solid #fff;
  border-radius: 999px;
  color: #fff;
  background: var(--muted);
  font-size: 11px;
  line-height: 16px;
}

.notification-button.has-unread strong {
  background: var(--danger);
}

.notification-panel {
  position: absolute;
  top: 64px;
  right: 12px;
  left: 12px;
  z-index: 20;
  display: grid;
  gap: 10px;
  max-height: min(calc(100dvh - 88px - env(safe-area-inset-top)), 520px);
  overflow: auto;
  overscroll-behavior: contain;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow);
}

.notification-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.notification-list {
  display: grid;
  gap: 8px;
}

.notification-item {
  width: 100%;
  display: grid;
  grid-template-columns: 10px 1fr;
  gap: 10px;
  min-height: auto;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  background: var(--surface);
  text-align: left;
}

.notification-item.unread {
  border-color: rgba(74, 166, 200, 0.62);
  background: var(--surface-soft);
}

.notification-dot {
  width: 8px;
  height: 8px;
  margin-top: 7px;
  border-radius: 999px;
  background: transparent;
}

.notification-item.unread .notification-dot {
  background: var(--accent);
}

.notification-item span:last-child {
  display: grid;
  gap: 3px;
}

.notification-item small,
.notification-item em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 21px;
  letter-spacing: 0.01em;
}

h2 {
  font-size: 25px;
  line-height: 1.25;
}

h3 {
  font-size: 17px;
}

.eyebrow {
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.view {
  min-height: calc(100vh - 70px);
  padding: 14px 14px 18px;
  overflow-anchor: none;
}

.bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 10;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  max-width: 620px;
  margin: 0 auto;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.nav-item {
  min-height: 46px;
  border: 0;
  border-radius: 10px;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  font-weight: 700;
}

.nav-item.active {
  color: var(--brand-deep);
  background: var(--surface-soft);
}

.hero-panel,
.form-card,
.card,
.member-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.hero-panel {
  display: grid;
  gap: 12px;
  padding: 20px;
  margin-bottom: 14px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.96) 0%, rgba(224, 245, 252, 0.96) 100%);
  overflow: hidden;
}

.hero-panel p {
  color: var(--muted);
  line-height: 1.55;
}

.grid {
  display: grid;
  gap: 12px;
}

.two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.card,
.form-card,
.member-card {
  padding: 16px;
}

.card + .card,
.member-card + .card,
.summary-grid + .card,
.hero-panel + .card {
  margin-top: 12px;
}

.form-card + .form-card {
  margin-top: 12px;
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.stat {
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.stat strong {
  font-size: 24px;
  color: var(--brand-deep);
}

.onboarding-card,
.growth-card {
  display: grid;
  gap: 12px;
}

.progress-bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-soft);
}

.progress-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--brand-dark));
}

.onboarding-list {
  display: grid;
  gap: 8px;
}

.onboarding-step {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 2px 10px;
  width: 100%;
  min-height: auto;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  background: #fff;
  text-align: left;
}

.onboarding-step span {
  grid-row: span 2;
  color: var(--brand-dark);
  font-weight: 900;
}

.onboarding-step small {
  color: var(--muted);
}

.onboarding-step.done {
  background: var(--surface-soft);
}

.onboarding-collapsed {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
}

.growth-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.growth-stat {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}

.growth-stat span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.growth-stat strong {
  color: var(--brand-deep);
  font-size: 18px;
}

.pace-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}

.pace-preview strong {
  color: var(--brand-dark);
  white-space: nowrap;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 13px;
}

.list {
  display: grid;
  gap: 10px;
}

.timeline-list {
  display: grid;
  gap: 10px;
}

.timeline-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.timeline-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}

.timeline-divider span {
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
}

.list-item {
  display: grid;
  gap: 8px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.list-item.is-inactive {
  opacity: 0.68;
  background: #f8faf9;
}

.member-tools {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.admin-section {
  display: grid;
  gap: 10px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.admin-section-first {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.privacy-help,
.reply-list,
.reply-form,
.comment-list,
.comment-form {
  display: grid;
  gap: 8px;
}

.privacy-help {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--muted);
  line-height: 1.55;
}

.privacy-help strong {
  color: var(--brand-dark);
}

.form-hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.form-hint[data-status="success"] {
  border-color: rgba(22, 163, 74, 0.28);
  background: #ecfdf3;
  color: #166534;
}

.form-hint[data-status="error"] {
  border-color: rgba(220, 38, 38, 0.26);
  background: #fff1f2;
  color: var(--danger);
}

.form-hint[data-status="info"] {
  border-color: rgba(74, 166, 200, 0.3);
  background: #effaff;
  color: var(--brand-deep);
}

.issued-credential {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid rgba(22, 163, 74, 0.3);
  border-radius: 12px;
  background: #ecfdf3;
  color: #14532d;
}

.issued-credential p {
  margin: 4px 0 0;
}

.application-member-number {
  margin-top: 2px;
}

.member-number-change {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid rgba(220, 38, 38, 0.2);
  border-radius: 8px;
  background: #fff8f8;
}

.member-number-change summary {
  color: var(--danger);
  font-weight: 800;
  cursor: pointer;
}

.member-number-change[open] summary {
  margin-bottom: 8px;
}

.member-number-change .danger-button {
  margin-top: 4px;
}

.action-hint {
  align-items: flex-start;
}

.reply-list {
  margin-top: 4px;
}

.reply-box {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-left: 3px solid var(--brand);
  border-radius: 12px;
  background: var(--surface-soft);
}

.reply-form {
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.feed-item p {
  line-height: 1.55;
}

.activity-title {
  color: var(--brand-deep);
  font-size: 18px;
  line-height: 1.35;
}

.event-chip {
  color: var(--brand-deep);
  background: #e4f5fb;
}

.event-photo {
  width: 100%;
  max-height: 260px;
  border: 1px solid var(--line);
  border-radius: 12px;
  object-fit: cover;
  background: var(--surface-soft);
}

.event-photo-small {
  max-height: 180px;
}

.event-recap {
  display: grid;
  gap: 6px;
  padding: 11px 12px;
  border-left: 3px solid var(--brand);
  border-radius: 12px;
  background: var(--surface-soft);
}

.official-event-post {
  border-color: rgba(74, 166, 200, 0.42);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(234, 247, 252, 0.66));
}

.event-editor {
  padding-top: 4px;
}

.event-editor summary {
  color: var(--brand-deep);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.event-recap-form {
  margin-top: 10px;
}

.event-linked {
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.event-linked summary {
  color: var(--brand-deep);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.event-linked-list {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.event-attendance {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.event-attendance summary {
  color: var(--brand-deep);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.attendance-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.attendance-person {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.attendance-person span {
  display: grid;
  gap: 2px;
}

.attendance-person small,
.attendance-person time {
  color: var(--muted);
  font-size: 12px;
}

.linked-training-item {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface-soft);
}

.linked-training-item p {
  line-height: 1.5;
}

.feed-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 4px;
}

.compact-button {
  min-height: 36px;
  padding: 7px 12px;
}

.comment-list {
  margin-top: 2px;
}

.comment-box {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f8faf9;
}

.comment-form {
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.status-card {
  display: grid;
  align-content: center;
  gap: 4px;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
}

.status-card strong {
  color: var(--brand-dark);
}

.chip,
.pill-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 800;
}

.pill-button {
  white-space: nowrap;
}

#role-pill {
  min-height: 40px;
  padding: 8px 16px;
  border-color: var(--brand-deep);
  color: #fff;
  background: var(--brand-deep);
  box-shadow: 0 8px 18px rgba(21, 94, 117, 0.2);
}

form {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.check-row input {
  width: 18px;
  min-height: 18px;
}

.line-log-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
}

input[type="range"].range-input {
  min-height: 30px;
  padding: 6px 0;
  border: 0;
  accent-color: var(--brand-dark);
  background: transparent;
}

textarea {
  min-height: 92px;
  resize: vertical;
}

.inline-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.primary-button,
.secondary-button,
.danger-button,
.ghost-button {
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 800;
}

.primary-button {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: #fff;
  box-shadow: 0 8px 18px rgba(74, 166, 200, 0.28);
}

.secondary-button {
  background: var(--surface-soft);
  color: var(--brand-dark);
  border: 1px solid var(--line);
}

.danger-button {
  background: #fee2e2;
  color: var(--danger);
}

.ghost-button {
  background: transparent;
  color: var(--muted);
}

.tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.tab-button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--muted);
  font-weight: 800;
}

.tab-button.active {
  background: var(--brand-dark);
  color: #fff;
}

.question-tabs {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.member-card {
  display: grid;
  gap: 14px;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(21, 94, 117, 0.96) 0%, rgba(74, 166, 200, 0.94) 100%),
    url("assets/cyrc-logo.png") right -18px bottom -32px / 170px auto no-repeat;
  border: 0;
  position: relative;
  overflow: hidden;
}

.member-card .muted {
  color: rgba(255, 255, 255, 0.72);
}

.member-no {
  font-size: 27px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.profile-badge {
  display: grid;
  justify-items: center;
  align-content: center;
  place-items: center;
  gap: 4px;
  width: 104px;
  min-height: 104px;
  padding: 12px;
  border: 0;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--brand-deep);
  box-shadow: var(--shadow-soft);
  text-align: center;
}

.profile-badge img {
  width: 48px;
  height: 48px;
  border-radius: 999px;
  object-fit: cover;
}

.profile-badge strong {
  font-size: 16px;
  letter-spacing: 0.08em;
}

.profile-badge span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.member-card-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  align-items: end;
  padding: 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.member-card-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 35, 48, 0.42);
}

.member-card-sheet {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 10px;
  width: min(100%, 420px);
  max-height: calc(100dvh - 32px);
  margin: 0 auto;
  padding: 20px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--shadow);
}

.member-card-close {
  justify-self: end;
}

.member-card-sheet > img {
  width: 86px;
  height: 86px;
  border-radius: 999px;
  object-fit: cover;
  box-shadow: var(--shadow-soft);
}

.member-card-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
}

.member-card-facts span {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 13px;
}

.member-card-facts strong {
  color: var(--muted);
  font-size: 12px;
}

.member-card-goal {
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  background: #fffbeb;
  line-height: 1.5;
  text-align: center;
}

.notice {
  padding: 12px;
  border-radius: 12px;
  background: #fffbeb;
  color: #92400e;
  line-height: 1.5;
}

.empty {
  padding: 22px 14px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 12px;
}

.home-hero {
  grid-template-columns: 1fr;
}

.hero-copy {
  display: grid;
  gap: 10px;
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 4px;
}

.hero-metrics div {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid rgba(207, 232, 242, 0.9);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.74);
}

.hero-metrics span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.hero-metrics strong {
  color: var(--brand-deep);
}

.hero-photo {
  position: relative;
  height: 150px;
  min-height: 150px;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(207, 232, 242, 0.9);
}

.hero-photo img {
  width: 100%;
  height: 100%;
  min-height: 150px;
  display: block;
  object-fit: cover;
}

.hero-photo.is-empty img {
  padding: 28px;
  object-fit: contain;
  background: linear-gradient(145deg, #fff 0%, #eaf7fc 100%);
}

.hero-photo span {
  position: absolute;
  right: 10px;
  bottom: 10px;
  max-width: calc(100% - 20px);
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(21, 94, 117, 0.78);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.login-hero {
  justify-items: center;
  text-align: center;
  padding: 24px 20px;
}

.login-logo {
  width: 108px;
  height: 108px;
  border-radius: 28px;
  object-fit: cover;
  background: #fff;
  box-shadow: var(--shadow);
}

.rank-toggle {
  width: 100%;
  margin-top: 12px;
}

.rank-note {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.chat-hero {
  background:
    linear-gradient(135deg, rgba(74, 166, 200, 0.2), rgba(255, 255, 255, 0.92)),
    #f8fdff;
}

.chat-question-form {
  gap: 14px;
}

.chat-thread-list {
  gap: 14px;
}

.chat-thread-card {
  display: grid;
  gap: 12px;
}

.chat-bubble,
.reply-box {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #fff;
}

.member-bubble {
  background: #f3fbfe;
  border-color: rgba(74, 166, 200, 0.34);
}

.chat-bubble strong,
.reply-box strong {
  display: block;
  margin-bottom: 6px;
  color: var(--brand-deep);
}

.chat-bubble p,
.reply-box p {
  margin: 0;
  white-space: pre-line;
}

.chat-replies {
  display: grid;
  gap: 10px;
}

.ai-reply {
  background: linear-gradient(145deg, #ffffff, #eef9fd);
  border-color: rgba(74, 166, 200, 0.44);
}

.chat-action-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chat-followup-form {
  display: grid;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}

.chat-followup-form textarea {
  min-height: 78px;
}

.view[data-view="public"],
.view[data-view="public-events"] {
  padding: 0 0 32px;
  background: #fff;
}

.public-hero {
  position: relative;
  display: grid;
  align-items: end;
  min-height: 560px;
  overflow: hidden;
  color: #fff;
  background: var(--brand-deep);
}

.public-hero > img,
.public-hero-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.public-hero > img {
  object-fit: cover;
}

.public-hero-overlay {
  background: rgba(7, 39, 52, 0.58);
}

.public-hero-copy {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 16px;
  width: min(100%, 760px);
  padding: 38px 22px 48px;
}

.public-hero-copy h2 {
  max-width: 680px;
  margin: 0;
  color: #fff;
  font-size: 38px;
  line-height: 1.12;
}

.public-hero-copy > p:not(.eyebrow) {
  max-width: 620px;
  margin: 0;
  color: rgba(255, 255, 255, 0.88);
  font-size: 17px;
  line-height: 1.7;
}

.public-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.light-button,
.text-button {
  min-height: 44px;
  padding: 10px 15px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 8px;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  font-weight: 800;
}

.text-button {
  border-color: var(--line);
  color: var(--brand-dark);
  background: #fff;
}

.public-intro,
.public-section,
.public-feature-grid,
.public-heritage-teaser,
.public-values-section,
.public-history-opening,
.public-story-list,
.public-content-sections,
.public-history-closing,
.public-join-band,
.public-page-header {
  width: min(1180px, calc(100% - 36px));
  margin-right: auto;
  margin-left: auto;
}

.public-intro {
  display: grid;
  gap: 18px;
  padding: 64px 0 34px;
}

.public-intro h2,
.public-section h2,
.public-page-header h2,
.public-join-band h2 {
  margin: 4px 0 0;
  font-size: 28px;
  line-height: 1.25;
}

.public-intro > p,
.public-page-header > p,
.public-join-band p {
  margin: 0;
  color: var(--muted);
  line-height: 1.75;
}

.public-feature-grid,
.public-event-grid,
.public-recap-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.public-heritage-teaser {
  display: grid;
  gap: 22px;
  margin-top: 24px;
  padding: 28px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--brand);
  border-radius: 8px;
  background: var(--surface-soft);
}

.public-heritage-teaser h2 {
  margin: 4px 0 8px;
  font-size: 26px;
}

.public-heritage-teaser p:last-child {
  margin: 0;
  color: var(--muted);
}

.public-values-section {
  padding-top: 56px;
}

.public-values-grid {
  display: grid;
  gap: 10px;
}

.public-values-grid article {
  padding: 20px;
  border-top: 3px solid var(--brand);
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.public-values-grid span {
  color: var(--brand);
  font-size: 12px;
  font-weight: 900;
}

.public-values-grid h3 {
  margin: 12px 0 8px;
}

.public-values-grid p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.public-history-opening {
  display: grid;
  gap: 18px;
  padding-top: 58px;
  text-align: center;
}

.public-history-opening blockquote {
  max-width: 850px;
  margin: 0 auto;
  color: var(--brand-deep);
  font-size: clamp(30px, 5vw, 54px);
  font-weight: 950;
  line-height: 1.35;
}

.public-history-opening > p:last-child {
  max-width: 720px;
  margin: 0 auto;
  color: var(--muted);
  line-height: 1.8;
}

.public-story-list {
  display: grid;
  gap: 18px;
  padding-top: 68px;
}

.public-content-sections {
  display: grid;
  gap: 18px;
  padding-top: 52px;
}

.public-content-block {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.public-content-block.text-only {
  border-left: 5px solid var(--brand);
  background: var(--surface-soft);
}

.public-content-block figure {
  display: grid;
  grid-template-rows: minmax(250px, 1fr) auto;
  margin: 0;
  background: var(--surface-soft);
}

.public-content-block figure img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 250px;
  object-fit: cover;
}

.public-content-block figcaption {
  padding: 9px 14px;
  color: var(--muted);
  font-size: 12px;
}

.public-content-block > div {
  align-self: center;
  padding: clamp(24px, 5vw, 48px);
}

.public-content-block.text-only > div {
  max-width: 900px;
}

.public-content-block h2 {
  margin: 7px 0 14px;
  font-size: clamp(25px, 3vw, 36px);
}

.public-content-block > div > p:not(.eyebrow) {
  margin: 0;
  color: var(--muted);
  line-height: 1.85;
  white-space: pre-line;
}

.public-content-block blockquote {
  margin: 22px 0 0;
  padding-left: 18px;
  border-left: 3px solid var(--brand);
  color: var(--brand-deep);
  font-weight: 850;
  line-height: 1.65;
}

.public-story-chapter {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.public-story-chapter figure {
  margin: 0;
  background: var(--surface-soft);
}

.public-story-chapter figure img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 240px;
  max-height: 440px;
  object-fit: cover;
}

.public-story-chapter figcaption {
  padding: 10px 14px;
  color: var(--muted);
  font-size: 12px;
}

.public-story-copy {
  padding: clamp(24px, 5vw, 48px);
}

.public-story-copy h2 {
  margin: 8px 0 16px;
  font-size: clamp(25px, 3vw, 36px);
}

.public-story-copy > p:not(.eyebrow) {
  margin: 0;
  color: var(--muted);
  line-height: 1.85;
  white-space: pre-line;
}

.public-story-copy blockquote {
  margin: 24px 0 0;
  padding: 18px 0 0 20px;
  border-top: 1px solid var(--line);
  border-left: 3px solid var(--brand);
  color: var(--brand-deep);
  font-size: 18px;
  font-weight: 850;
  line-height: 1.6;
}

.public-history-closing {
  margin-top: 68px;
  padding: clamp(30px, 6vw, 64px);
  border-radius: 8px;
  color: #fff;
  background: var(--brand-deep);
  text-align: center;
}

.public-history-closing .eyebrow,
.public-history-closing > p {
  color: rgba(255, 255, 255, 0.78);
}

.public-history-closing h2 {
  margin: 8px auto 14px;
  color: #fff;
  font-size: clamp(28px, 4vw, 46px);
}

.public-history-closing > p {
  max-width: 760px;
  margin: 0 auto;
  line-height: 1.8;
}

.public-history-closing blockquote {
  margin: 28px 0 0;
  font-size: 20px;
  font-weight: 900;
}

.editor-photo-preview {
  position: relative;
  margin: 0;
}

.editor-photo-preview img {
  display: block;
  width: 100%;
  max-height: 260px;
  border-radius: 6px;
  object-fit: cover;
}

.editor-photo-preview button {
  position: absolute;
  right: 10px;
  bottom: 10px;
}

.public-feature-grid article,
.public-event-card,
.public-notice-list article,
.public-recap-card,
.public-empty {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.public-history {
  display: grid;
  gap: 28px;
  margin-top: 68px;
  padding: 38px 30px;
  border-radius: 8px;
  color: #fff;
  background: var(--brand-deep);
}

.public-history-heading {
  max-width: 680px;
}

.public-history-heading .eyebrow,
.public-history-heading p {
  color: rgba(255, 255, 255, 0.78);
}

.public-history-heading h2 {
  margin: 8px 0 12px;
  color: #fff;
}

.public-timeline {
  display: grid;
}

.public-timeline article {
  position: relative;
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 20px;
  padding: 4px 0 26px;
}

.public-timeline article:not(:last-child)::before {
  content: "";
  position: absolute;
  top: 28px;
  bottom: 0;
  left: 35px;
  width: 1px;
  background: rgba(255, 255, 255, 0.25);
}

.public-timeline time {
  z-index: 1;
  align-self: start;
  padding: 7px 8px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  background: var(--brand-deep);
  text-align: center;
  font-size: 12px;
  font-weight: 900;
}

.public-timeline h3 {
  margin: 3px 0 6px;
  color: #fff;
}

.public-timeline p {
  margin: 0;
  color: rgba(255, 255, 255, 0.76);
}

.app-shell[data-mode="admin"] {
  padding-bottom: 0;
}

.app-shell[data-mode="portal"] {
  padding-bottom: 24px;
}

.app-shell[data-mode="portal"] .bottom-nav,
.app-shell[data-mode="admin"] .bottom-nav {
  display: none;
}

.portal-back-button {
  width: auto;
  margin-top: 12px;
}

.member-public-return {
  color: var(--brand-deep);
  background: var(--surface-soft);
}

.public-feature-grid article {
  padding: 22px;
}

.public-feature-grid article > span {
  color: var(--brand);
  font-size: 13px;
  font-weight: 900;
}

.public-feature-grid h3,
.public-event-card h3,
.public-notice-list h3,
.public-recap-card h3 {
  margin: 8px 0;
}

.public-feature-grid p,
.public-event-card p,
.public-notice-list p,
.public-recap-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.public-section {
  padding-top: 64px;
}

.public-section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.public-event-card {
  min-height: 180px;
  padding: 22px;
  border-top: 4px solid var(--brand);
}

.public-event-card time,
.public-notice-list time,
.public-recap-card time {
  color: var(--brand-dark);
  font-size: 13px;
  font-weight: 800;
}

.public-event-card small {
  display: block;
  margin-top: 16px;
  color: var(--muted);
}

.public-notice-list {
  display: grid;
  gap: 10px;
}

.public-notice-list article {
  padding: 20px;
}

.public-recap-card {
  overflow: hidden;
}

.public-recap-card img,
.public-recap-placeholder {
  width: 100%;
  height: 190px;
  object-fit: cover;
}

.public-recap-placeholder {
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--brand-dark);
  font-weight: 900;
  letter-spacing: 0;
}

.public-recap-card > div:last-child {
  padding: 18px;
}

.public-page-header {
  padding: 58px 0 8px;
}

.public-join-band {
  display: grid;
  gap: 20px;
  margin-top: 72px;
  padding: 30px;
  border-radius: 8px;
  background: var(--surface-soft);
}

.public-join-band.compact {
  margin-bottom: 32px;
}

.public-empty {
  padding: 36px 20px;
  color: var(--muted);
  text-align: center;
}

.admin-workspace {
  display: grid;
  gap: 14px;
}

.admin-sidebar,
.admin-main {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.admin-sidebar {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.admin-sidebar h2 {
  margin: 4px 0 0;
}

.admin-sidebar nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.admin-sidebar nav button,
.admin-stat-grid button,
.admin-task-list button {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: #fff;
  text-align: left;
}

.site-content-editor form > details {
  margin-top: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.site-content-editor summary {
  padding: 14px 16px;
  cursor: pointer;
  font-weight: 900;
}

.editor-fields,
.editor-card-grid,
.visibility-grid {
  display: grid;
  gap: 12px;
  padding: 0 16px 16px;
}

.editor-card-grid fieldset {
  min-width: 0;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.editor-card-grid legend {
  padding: 0 6px;
  color: var(--brand-deep);
  font-weight: 900;
}

.summary-count {
  margin-left: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.repeat-subheading,
.repeat-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 10px;
}

.repeat-subheading {
  padding-bottom: 0;
  color: var(--brand-deep);
}

.content-repeat-list fieldset {
  position: relative;
}

.repeat-item-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin: -4px 0 12px;
}

.repeat-item-actions button {
  min-width: 58px;
}

.repeat-empty {
  grid-column: 1 / -1;
  padding: 22px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fff;
  text-align: center;
}

.visibility-grid .check-row {
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.editor-save-bar {
  position: sticky;
  bottom: 12px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 28px rgba(22, 76, 99, 0.12);
}

.admin-sidebar nav button {
  min-height: 44px;
  padding: 10px 12px;
  font-weight: 800;
}

.admin-sidebar nav button.active {
  border-color: var(--brand-dark);
  color: #fff;
  background: var(--brand-dark);
}

.admin-main {
  min-width: 0;
  padding: 18px;
}

.admin-page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.admin-page-heading h2 {
  margin: 4px 0 0;
}

.admin-content > form,
.admin-content > .admin-section,
.admin-overview-card {
  margin-top: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.admin-stat-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.admin-stat-grid button {
  display: grid;
  gap: 6px;
  padding: 18px;
}

.admin-stat-grid strong {
  color: var(--brand-deep);
  font-size: 30px;
}

.admin-stat-grid small,
.admin-task-list span {
  color: var(--muted);
}

.admin-task-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.admin-task-list button {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
}

@media (min-width: 700px) {
  body {
    background:
      radial-gradient(circle at top left, rgba(128, 202, 224, 0.34), transparent 32%),
      #e8f6fb;
  }

  .app-shell {
    border-right: 1px solid var(--line);
    border-left: 1px solid var(--line);
  }

  .home-hero {
    grid-template-columns: 1.05fr 0.95fr;
    align-items: stretch;
  }

  .hero-photo,
  .hero-photo img {
    height: 210px;
    min-height: 210px;
  }

  .public-intro {
    grid-template-columns: minmax(0, 0.9fr) minmax(320px, 1.1fr);
    align-items: start;
  }

  .public-feature-grid,
  .public-event-grid,
  .public-recap-grid,
  .admin-stat-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .public-join-band {
    grid-template-columns: 1fr auto;
    align-items: center;
  }

  .public-history {
    grid-template-columns: minmax(260px, 0.8fr) minmax(360px, 1.2fr);
    gap: 56px;
    padding: 50px;
  }

  .public-heritage-teaser {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .public-values-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .public-story-chapter.has-photo {
    grid-template-columns: minmax(280px, 0.9fr) minmax(360px, 1.1fr);
  }

  .public-story-chapter.has-photo:nth-child(even) figure {
    order: 2;
  }

  .public-content-block.has-photo {
    grid-template-columns: minmax(280px, 0.9fr) minmax(360px, 1.1fr);
  }

  .public-content-block.has-photo.media-right figure {
    order: 2;
  }

  .editor-card-grid,
  .visibility-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .public-hero-copy h2 {
    font-size: 56px;
  }
}

@media (min-width: 1024px) {
  html {
    scrollbar-gutter: stable;
  }

  body {
    padding: 0;
    background:
      radial-gradient(circle at 8% 0%, rgba(128, 202, 224, 0.3), transparent 30%),
      linear-gradient(145deg, #f7fcfe 0%, #e7f5fa 100%);
  }

  .app-shell {
    display: grid;
    grid-template-columns: 214px minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas:
      "sidebar topbar"
      "sidebar content";
    width: 100%;
    max-width: none;
    min-height: 100vh;
    margin: 0;
    padding-bottom: 0;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: rgba(247, 252, 254, 0.94);
    box-shadow: none;
  }

  .app-shell[data-mode="public"] {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto minmax(0, 1fr);
    grid-template-areas:
      "topbar"
      "sidebar"
      "content";
  }

  .app-shell[data-mode="admin"] {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "topbar"
      "content";
  }

  .app-shell[data-mode="portal"] {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "topbar"
      "content";
  }

  .app-shell[data-mode="portal"] .topbar .brand-mark {
    display: block;
  }

  .app-shell[data-mode="portal"] .view {
    width: min(100%, 980px);
    margin: 0 auto;
  }

  .app-shell[data-mode="admin"] .topbar .brand-mark {
    display: block;
  }

  .app-shell[data-mode="public"] .bottom-nav {
    top: 78px;
    z-index: 4;
    flex-direction: row;
    justify-content: center;
    height: auto;
    min-height: 58px;
    padding: 7px 24px;
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .app-shell[data-mode="public"] .bottom-nav::before {
    display: none;
  }

  .app-shell[data-mode="public"] .nav-item {
    width: auto;
    min-width: 130px;
    text-align: center;
  }

  .app-shell[data-mode="public"] .nav-item + .nav-item {
    margin-top: 0;
    margin-left: 6px;
  }

  .app-shell[data-mode="public"] .view {
    padding-top: 0;
  }

  .app-shell[data-mode="public"] .view[data-view="login"] {
    padding-top: 28px;
  }

  .topbar {
    grid-area: topbar;
    padding: 17px 26px;
  }

  .topbar .brand-mark {
    display: none;
  }

  .topbar h1 {
    font-size: 24px;
  }

  .bottom-nav {
    position: sticky;
    top: 0;
    grid-area: sidebar;
    display: flex;
    flex-direction: column;
    align-self: start;
    width: 100%;
    max-width: none;
    height: 100dvh;
    margin: 0;
    padding: 22px 14px;
    overflow-y: auto;
    border-top: 0;
    border-right: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(18px);
  }

  .bottom-nav::before {
    content: "CYRC\A RUNNING CLUB";
    display: flex;
    align-items: center;
    min-height: 62px;
    margin: 0 6px 20px;
    padding-left: 58px;
    color: var(--brand-deep);
    background: url("assets/cyrc-logo.png") left center / 48px 48px no-repeat;
    white-space: pre;
    font-size: 12px;
    font-weight: 900;
    line-height: 1.45;
    letter-spacing: 0;
  }

  .nav-item {
    flex: 0 0 auto;
    width: 100%;
    min-height: 48px;
    padding: 0 16px;
    border-radius: 8px;
    text-align: left;
    font-size: 15px;
  }

  .nav-item + .nav-item {
    margin-top: 4px;
  }

  .nav-item.active {
    color: #fff;
    background: var(--brand-dark);
    box-shadow: 0 8px 18px rgba(39, 125, 161, 0.2);
  }

  .view {
    grid-area: content;
    width: 100%;
    min-width: 0;
    padding: 24px 28px 42px;
  }

  .notification-panel {
    top: 74px;
    right: 24px;
    left: auto;
    width: min(420px, calc(100vw - 280px));
  }

  .view[data-view="login"] {
    display: grid;
    grid-template-columns: minmax(360px, 0.9fr) minmax(420px, 1.1fr);
    align-items: start;
    gap: 16px;
    max-width: 1080px;
    margin: 0 auto;
  }

  .view[data-view="login"] > * {
    margin-top: 0;
  }

  .view[data-view="login"] > .login-hero {
    position: static;
    grid-row: auto;
    min-height: 390px;
    align-content: center;
  }

  .view[data-view="login"] > #member-application-form {
    grid-column: 1 / -1;
  }

  .view[data-view="home"] {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
    align-items: start;
    gap: 14px;
  }

  .view[data-view="home"],
  .view[data-view="events"],
  .view[data-view="training"],
  .view[data-view="me"] {
    max-width: 1500px;
    margin-right: auto;
    margin-left: auto;
  }

  .view[data-view="home"] > * {
    margin-top: 0;
  }

  .view[data-view="home"] > .home-hero,
  .view[data-view="home"] > .summary-grid {
    grid-column: 1 / -1;
  }

  .view[data-view="home"] > .onboarding-card,
  .view[data-view="home"] > .onboarding-collapsed,
  .view[data-view="home"] > .home-announcements {
    grid-column: 1;
  }

  .view[data-view="home"] > .home-next-event {
    grid-column: 2;
    grid-row: 3 / span 2;
  }

  .home-hero {
    grid-template-columns: minmax(0, 1.1fr) minmax(360px, 0.9fr);
    padding: 24px;
  }

  .hero-photo,
  .hero-photo img {
    height: 250px;
    min-height: 250px;
  }

  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .view[data-view="events"],
  .view[data-view="training"],
  .view[data-view="me"] {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 16px;
  }

  .view[data-view="events"] > *,
  .view[data-view="training"] > *,
  .view[data-view="me"] > * {
    min-width: 0;
    margin-top: 0;
  }

  .view[data-view="events"] > :nth-child(3),
  .view[data-view="training"] > :nth-child(n + 3),
  .view[data-view="me"] > :nth-child(n + 5),
  .view[data-view="me"] > .member-card-modal {
    grid-column: 1 / -1;
  }

  .view[data-view="feed"],
  .view[data-view="chat"] {
    max-width: 900px;
    margin: 0 auto;
  }

  .view[data-view="ranking"] {
    max-width: 1040px;
    margin: 0 auto;
  }

  .view[data-view="admin"] {
    max-width: 1500px;
    margin: 0 auto;
  }

  .view[data-view="admin"] > .hero-panel {
    grid-template-columns: auto 1fr;
    align-items: center;
  }

  .view[data-view="admin"] > .hero-panel .eyebrow {
    grid-row: span 2;
    align-self: stretch;
    display: grid;
    place-items: center;
    padding: 14px;
    border-radius: 8px;
    background: var(--brand-dark);
    color: #fff;
    writing-mode: vertical-rl;
  }

  .admin-workspace {
    grid-template-columns: 220px minmax(0, 1fr);
    align-items: start;
  }

  .admin-sidebar {
    position: sticky;
    top: 18px;
    max-height: calc(100dvh - 36px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .admin-sidebar nav {
    grid-template-columns: 1fr;
  }

  .admin-main {
    padding: 24px;
  }

  .timeline-editor {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .member-tools {
    grid-template-columns: minmax(280px, 1fr) auto;
    align-items: end;
  }

  .member-tools p {
    grid-column: 1 / -1;
  }

  #member-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .member-card-modal {
    align-items: center;
  }
}

@media (max-width: 520px) {
  .repeat-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .repeat-toolbar button {
    width: 100%;
  }
}

@media (max-width: 420px) {
  .issued-credential {
    grid-template-columns: 1fr;
  }

  h2 {
    font-size: 22px;
  }

  .topbar {
    padding-right: 12px;
    padding-left: 12px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .inline-fields,
  .question-tabs {
    grid-template-columns: 1fr;
  }

  .member-no {
    font-size: 22px;
  }
}

/* Experience refresh: clear public sections, focused member navigation, gentle motion. */
.menu-button {
  min-height: 38px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--brand-deep);
  background: #fff;
  font-size: 13px;
  font-weight: 850;
}

.navigation-scrim {
  position: fixed;
  inset: 0;
  z-index: 18;
  background: rgba(11, 37, 48, 0.34);
  backdrop-filter: blur(2px);
}

body.navigation-open {
  overflow: hidden;
}

.public-event-grid > .public-empty:only-child {
  grid-column: 1 / -1;
  min-height: 120px;
}

.member-more-panel {
  position: fixed;
  right: 12px;
  bottom: calc(78px + env(safe-area-inset-bottom));
  left: 12px;
  z-index: 20;
  max-height: calc(100dvh - 102px - env(safe-area-inset-bottom));
  max-width: 560px;
  margin: 0 auto;
  padding: 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 22px 60px rgba(21, 94, 117, 0.22);
}

.member-more-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.member-more-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.member-more-grid > button {
  display: grid;
  gap: 4px;
  min-height: 84px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--surface-soft);
  text-align: left;
}

.member-more-grid > button span {
  color: var(--muted);
  font-size: 12px;
}

.member-quick-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.member-quick-actions button {
  display: grid;
  grid-template-columns: 34px 1fr;
  grid-template-rows: auto auto;
  gap: 2px 10px;
  min-width: 0;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: #fff;
  text-align: left;
  box-shadow: var(--shadow-soft);
}

.member-quick-actions button > span {
  grid-row: 1 / 3;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  color: #fff;
  background: var(--brand-dark);
  font-size: 13px;
  font-weight: 900;
}

.member-quick-actions small {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.public-page-hero {
  display: grid;
  align-content: end;
  min-height: 300px;
  padding: 52px clamp(20px, 5vw, 72px);
  color: #fff;
  background:
    linear-gradient(120deg, rgba(21, 94, 117, 0.98), rgba(39, 125, 161, 0.88)),
    url("assets/cyrc-logo.png") right 8% center / 190px no-repeat;
}

.public-page-hero .eyebrow,
.public-page-hero p {
  color: rgba(255, 255, 255, 0.82);
}

.public-page-hero h2 {
  max-width: 760px;
  margin: 8px 0 12px;
  color: #fff;
  font-size: clamp(34px, 5vw, 56px);
}

.public-page-hero > p:last-child {
  max-width: 680px;
  margin: 0;
  font-size: 17px;
  line-height: 1.7;
}

.public-intro-page {
  padding-top: 58px;
}

.public-section-first {
  padding-top: 48px;
}

.public-training-principles,
.public-join-steps {
  display: grid;
  gap: 12px;
  padding-top: 48px;
}

.public-training-principles article {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 16px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.public-training-principles article > span,
.public-join-steps article > span {
  color: var(--brand);
  font-weight: 900;
}

.public-training-principles h3,
.public-training-principles p,
.public-join-steps h3,
.public-join-steps p {
  margin-top: 0;
}

.public-join-steps article {
  padding: 22px;
  border-top: 4px solid var(--brand);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.public-join-steps article > span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-bottom: 16px;
  border-radius: 999px;
  color: #fff;
  background: var(--brand-dark);
}

.public-faq > div:last-child {
  display: grid;
  gap: 8px;
}

.public-faq details {
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.public-faq summary {
  padding: 17px 0;
  cursor: pointer;
  color: var(--text);
  font-weight: 850;
}

.public-faq details p {
  margin: 0;
  padding: 0 0 18px;
  color: var(--muted);
  line-height: 1.7;
}

.public-contact-band {
  display: grid;
  gap: 20px;
  margin-top: 64px;
  padding: 28px;
  border-radius: 8px;
  color: #fff;
  background: var(--brand-deep);
}

.view[data-view^="public"] {
  padding: 0 0 32px;
  background: #fff;
}

.public-history,
.public-training-principles,
.public-join-steps,
.public-contact-band {
  width: min(1180px, calc(100% - 36px));
  margin-right: auto;
  margin-left: auto;
}

.public-contact-band h2 {
  color: #fff;
}

.public-contact-band p {
  color: rgba(255, 255, 255, 0.78);
}

.public-event-card,
.public-recap-card,
.member-quick-actions button,
.public-feature-grid article {
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

@media (hover: hover) {
  .public-event-card:hover,
  .public-recap-card:hover,
  .member-quick-actions button:hover,
  .public-feature-grid article:hover {
    border-color: rgba(74, 166, 200, 0.58);
    box-shadow: 0 16px 34px rgba(39, 125, 161, 0.14);
    transform: translateY(-3px);
  }
}

@media (max-width: 1023px) {
  .app-shell[data-mode="public"] {
    padding-bottom: 0;
  }

  .app-shell[data-mode="public"] .bottom-nav {
    position: fixed;
    top: calc(70px + env(safe-area-inset-top));
    right: 12px;
    bottom: auto;
    left: 12px;
    z-index: 20;
    display: none;
    grid-auto-flow: row;
    grid-template-columns: 1fr;
    max-width: 520px;
    max-height: calc(100dvh - 94px - env(safe-area-inset-top));
    margin: 0 auto;
    padding: 10px;
    overflow-y: auto;
    overscroll-behavior: contain;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 22px 60px rgba(21, 94, 117, 0.22);
  }

  .app-shell[data-mode="public"].public-menu-open .bottom-nav {
    display: grid;
  }

  .app-shell[data-mode="public"] .nav-item {
    min-height: 46px;
    padding: 0 14px;
    text-align: left;
  }

  .app-shell[data-mode="public"] .nav-item.active {
    color: #fff;
    background: var(--brand-dark);
  }

  .app-shell[data-mode="member"] .bottom-nav {
    grid-auto-flow: column;
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .app-shell[data-mode="member"] .member-secondary {
    display: none !important;
  }

  .app-shell[data-mode="member"] .member-more-button {
    display: block !important;
  }

  .app-shell[data-mode="member"] .nav-record {
    color: #fff;
    background: var(--brand-dark);
  }

  .public-page-hero {
    min-height: 260px;
    background: linear-gradient(135deg, var(--brand-deep), var(--brand-dark));
  }
}

@media (min-width: 700px) {
  .member-quick-actions,
  .public-join-steps {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .public-join-steps {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .public-contact-band {
    grid-template-columns: 1fr auto;
    align-items: center;
    padding: 36px;
  }
}

@media (min-width: 1024px) {
  .menu-button,
  .member-more-button,
  .member-more-panel,
  .navigation-scrim {
    display: none !important;
  }

  .app-shell[data-mode="public"] .bottom-nav {
    justify-content: center;
    gap: 2px;
  }

  .app-shell[data-mode="public"] .topbar .brand-mark {
    display: block;
  }

  .app-shell[data-mode="public"] .nav-item {
    min-width: 112px;
    padding: 0 15px;
    border-radius: 6px;
  }

  .app-shell[data-mode="public"] .nav-item.active {
    color: var(--brand-deep);
    background: var(--surface-soft);
    box-shadow: inset 0 -3px 0 var(--brand-dark);
  }

  .public-training-principles {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .public-values-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (max-width: 799px) {
  .public-story-chapter.has-photo,
  .public-content-block.has-photo {
    grid-template-columns: 1fr;
  }

  .public-story-chapter.has-photo:nth-child(even) figure {
    order: initial;
  }

  .public-content-block.has-photo.media-right figure {
    order: initial;
  }
}

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