*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; padding: 0; min-height: 100%; }

body {
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--maroon); text-decoration: none; }
a:hover { text-decoration: underline; }

button {
  font-family: inherit;
  font-size: 0.92rem;
  cursor: pointer;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

input, select, textarea {
  font-family: inherit;
  font-size: 0.95rem;
  padding: 8px 10px;
  border: 1px solid var(--stone);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--charcoal);
  width: 100%;
}

input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--saffron);
  outline-offset: 2px;
}

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

label {
  display: block;
  font-size: 0.82rem;
  color: var(--charcoal-soft);
  font-weight: 500;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.skip-link {
  position: absolute;
  left: -9999px;
}
.skip-link:focus {
  left: 8px; top: 8px;
  background: var(--maroon);
  color: var(--ivory);
  padding: 8px 12px;
  z-index: 1000;
  border-radius: var(--radius-sm);
}

/* ---------- Header ---------- */
.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  gap: 24px;
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 14px; }

.header-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--ivory);
  font-size: 0.9rem;
}

.event-name {
  color: var(--gold-soft);
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-style: italic;
}

.link-button {
  background: transparent;
  color: var(--ivory);
  border: 1px solid var(--gold);
  padding: 6px 14px;
}
.link-button:hover { background: var(--gold); color: var(--maroon-deep); }

/* ---------- Layout ---------- */
.layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: calc(100vh - 220px);
}

.side-nav {
  padding: 16px 0;
}
.side-nav ul { list-style: none; padding: 0; margin: 0; }
.side-nav li { margin: 0; }
.side-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px 8px 22px;
  font-size: 0.93rem;
  text-decoration: none;
}
.side-nav a:hover { text-decoration: none; }

.view {
  padding: 32px clamp(20px, 4vw, 48px);
  max-width: 1200px;
}

.view h2 {
  font-size: 2rem;
  margin: 0 0 6px;
}
.view .view-subtitle {
  color: var(--charcoal-soft);
  margin: 0 0 24px;
  font-size: 0.95rem;
}

/* ---------- Cards ---------- */
.card {
  padding: 20px;
  margin-bottom: 16px;
}

.card h3 {
  margin: 0 0 12px;
  font-size: 1.25rem;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.stat-card {
  background: #ffffff;
  border: 1px solid var(--stone);
  border-top: 3px solid var(--saffron);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-card);
}

.stat-label {
  color: var(--charcoal-soft);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0;
}

.stat-value {
  font-family: var(--font-serif);
  font-size: 2.2rem;
  color: var(--maroon);
  margin: 6px 0 0;
  line-height: 1.1;
  font-weight: 600;
}

.stat-sub {
  color: var(--charcoal-soft);
  font-size: 0.82rem;
  margin-top: 4px;
}

/* ---------- Progress bars ---------- */
.progress {
  width: 100%;
  height: 10px;
  background: var(--ivory-deep);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 8px;
}
.progress > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--saffron), var(--gold));
  transition: width 0.3s;
}

.stack-bar {
  width: 100%;
  height: 16px;
  background: var(--ivory-deep);
  border-radius: 999px;
  overflow: hidden;
  display: flex;
  margin-top: 8px;
}
.stack-bar span {
  display: block;
  height: 100%;
}
.stack-bar .seg-planned   { background: var(--gold-soft); }
.stack-bar .seg-committed { background: var(--saffron); }
.stack-bar .seg-spent     { background: var(--maroon); }

.legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 0.82rem;
  color: var(--charcoal-soft);
  margin-top: 8px;
}
.legend span::before {
  content: "";
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 2px;
  margin-right: 6px;
  vertical-align: middle;
}
.legend .l-planned::before   { background: var(--gold-soft); }
.legend .l-committed::before { background: var(--saffron); }
.legend .l-spent::before     { background: var(--maroon); }
.legend .l-remaining::before { background: var(--ivory-deep); border: 1px solid var(--stone); }

/* ---------- Forms ---------- */
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 16px;
}

/* ---------- Tables ---------- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--stone);
}

.data-table th,
.data-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--stone);
  font-size: 0.92rem;
  vertical-align: top;
}

.data-table th {
  background: var(--ivory-deep);
  color: var(--maroon);
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(212, 175, 55, 0.06); }

.data-table input,
.data-table select,
.data-table textarea {
  font-size: 0.88rem;
  padding: 5px 8px;
}

.row-actions { display: flex; gap: 6px; }

/* ---------- Tabs ---------- */
.tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  border-bottom: 2px solid var(--stone);
  margin-bottom: 18px;
}
.tab {
  background: transparent;
  border: none;
  padding: 10px 14px;
  color: var(--charcoal-soft);
  font-weight: 500;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  border-radius: 0;
}
.tab:hover { color: var(--maroon); }
.tab.active {
  color: var(--maroon);
  border-bottom-color: var(--saffron);
  font-weight: 600;
}

/* ---------- Timeline ---------- */
.timeline-list {
  position: relative;
  padding-left: 28px;
  margin: 0;
  list-style: none;
}
.timeline-list::before {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 8px;
  width: 2px;
  background: var(--gold-soft);
}
.timeline-list li {
  position: relative;
  margin-bottom: 18px;
  background: #ffffff;
  border: 1px solid var(--stone);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-soft);
}
.timeline-list li::before {
  content: "";
  position: absolute;
  left: -24px;
  top: 18px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--saffron);
  border: 2px solid var(--ivory);
  box-shadow: 0 0 0 2px var(--saffron);
}
.timeline-list li.done::before { background: var(--success); box-shadow: 0 0 0 2px var(--success); }
.timeline-list .ms-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  flex-wrap: wrap;
}
.timeline-list .ms-title { font-weight: 600; color: var(--maroon); font-size: 1.05rem; }
.timeline-list .ms-due { color: var(--charcoal-soft); font-size: 0.85rem; font-style: italic; }
.timeline-list .ms-notes { color: var(--charcoal-soft); font-size: 0.9rem; margin: 6px 0 0; }

/* ---------- Checklists ---------- */
.checklist {
  list-style: none;
  padding: 0;
  margin: 0;
}
.checklist li {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--stone);
  align-items: center;
}
.checklist li:last-child { border-bottom: none; }
.checklist li.done .task-text { text-decoration: line-through; color: var(--charcoal-soft); }
.checklist input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--saffron);
  margin: 0;
}
.task-text { font-size: 0.95rem; }
.task-meta { font-size: 0.78rem; color: var(--charcoal-soft); margin-top: 2px; }

.filter-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 14px;
}
.filter-bar input,
.filter-bar select {
  width: auto;
  min-width: 180px;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--charcoal-soft);
  background: var(--ivory-deep);
  border-radius: var(--radius-md);
  border: 1px dashed var(--stone);
}

/* ---------- Modal ---------- */
.modal-root {
  position: fixed;
  inset: 0;
  background: rgba(42, 31, 26, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal-root[hidden] { display: none; }
.modal-card {
  background: var(--ivory);
  border: 1px solid var(--gold);
  border-top: 4px solid var(--saffron);
  border-radius: var(--radius-lg);
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px 32px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.modal-card h2 { margin-top: 0; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--maroon-deep);
  color: var(--gold-soft);
  text-align: center;
  padding: 18px 24px;
  font-size: 0.82rem;
  font-style: italic;
}

/* ---------- Hero ---------- */
.dashboard-hero {
  background: linear-gradient(135deg, var(--maroon) 0%, var(--maroon-deep) 100%);
  color: var(--ivory);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  margin-bottom: 24px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 24px;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}
.dashboard-hero h2 { color: var(--ivory); margin: 0 0 6px; }
.dashboard-hero p { margin: 0; color: var(--gold-soft); }
.dashboard-hero .hero-motif {
  width: 96px;
  height: 96px;
  color: var(--gold);
  opacity: 0.85;
}

.countdown-box {
  display: flex;
  gap: 18px;
  margin-top: 14px;
}
.countdown-unit {
  background: rgba(255,248,231,0.10);
  border: 1px solid var(--gold);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  text-align: center;
  min-width: 64px;
}
.countdown-unit b {
  display: block;
  font-family: var(--font-serif);
  font-size: 1.8rem;
  color: var(--ivory);
}
.countdown-unit small {
  color: var(--gold-soft);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ---------- Run of show ---------- */
.runofshow-list .data-table td:first-child {
  white-space: nowrap;
  font-family: var(--font-serif);
  color: var(--maroon);
  font-weight: 600;
}

/* ---------- Green room ---------- */
.greenroom-section {
  margin-bottom: 18px;
}
.greenroom-section h3 {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ---------- Toast ---------- */
.toast-root {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1100;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.toast {
  background: var(--maroon);
  color: var(--ivory);
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(91, 31, 14, 0.25);
  border: 1px solid var(--gold);
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: auto;
  max-width: 90vw;
}
.toast.on { opacity: 1; transform: translateY(0); }
.toast-success { background: var(--success); border-color: var(--success); }
.toast-danger  { background: var(--danger);  border-color: var(--danger); }
.toast-info    { background: var(--maroon);  border-color: var(--gold); }

/* ---------- Spinner ---------- */
.spinner-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 36px 12px;
  gap: 10px;
}
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--ivory-deep);
  border-top-color: var(--saffron);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.spinner-label {
  margin: 0;
  color: var(--charcoal-soft);
  font-style: italic;
  font-size: 0.92rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- View transitions ---------- */
.view-enter {
  animation: viewEnter 0.32s ease;
}
@keyframes viewEnter {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .view-enter { animation: none; }
  .spinner { animation: none; border-top-color: var(--saffron); }
  .toast { transition: none; }
}

/* ---------- Header chrome additions ---------- */
.nav-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--gold-soft);
  border-radius: var(--radius-sm);
  width: 38px;
  height: 38px;
  padding: 0;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}
.nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--ivory);
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}
body.nav-open .nav-toggle span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
body.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
body.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; color: inherit; }
.brand:hover { text-decoration: none; }

.header-actions-slot {
  display: flex;
  align-items: center;
  gap: 10px;
}
.header-select {
  width: auto;
  background: rgba(255,248,231,0.12);
  border: 1px solid var(--gold-soft);
  color: var(--ivory);
  font-size: 0.88rem;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  max-width: 200px;
}
.header-select option { color: var(--charcoal); }
.header-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--maroon-deep);
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 700;
  border: 2px solid var(--gold-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: transform 0.15s;
}
.header-avatar:hover { transform: scale(1.05); }

.account-menu {
  position: fixed;
  background: #ffffff;
  border: 1px solid var(--stone);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 32px rgba(0,0,0,0.15);
  padding: 6px;
  z-index: 1000;
  min-width: 180px;
  display: flex;
  flex-direction: column;
}
.account-menu a, .account-menu button {
  display: block;
  text-align: left;
  width: 100%;
  background: transparent;
  border: none;
  padding: 10px 14px;
  font-size: 0.93rem;
  color: var(--charcoal);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
}
.account-menu a:hover, .account-menu button:hover {
  background: var(--ivory-deep);
  color: var(--maroon);
  text-decoration: none;
}
.account-menu button[data-act="signout"] { color: var(--danger); }

/* ---------- Nav groups + context-aware visibility ---------- */
.nav-group {
  font-size: 0.68rem;
  color: var(--charcoal-soft);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 18px 18px 6px;
  font-weight: 600;
  opacity: 0.7;
  list-style: none;
}
.nav-group:first-child { padding-top: 4px; }

body.local-mode .cloud-only { display: none !important; }
body.cloud-mode:not(.has-schools) .school-only { display: none !important; }
body.cloud-mode:not(.has-many-events) .multi-event-only { display: none !important; }

/* ---------- Tour banner ---------- */
.tour-banner {
  background: linear-gradient(135deg, #ffffff 0%, var(--ivory-deep) 100%);
  border: 1px solid var(--gold);
  border-left: 4px solid var(--saffron);
  border-radius: var(--radius-md);
  padding: 22px 28px 18px;
  margin-bottom: 20px;
  position: relative;
  box-shadow: var(--shadow-soft);
}
.tour-banner h3 {
  margin: 0 0 10px;
  font-size: 1.2rem;
  color: var(--maroon);
}
.tour-banner p {
  margin: 0 0 8px;
  color: var(--charcoal);
  line-height: 1.55;
}
.tour-banner ol {
  margin: 8px 0 12px;
  padding-left: 22px;
  color: var(--charcoal);
  line-height: 1.75;
}
.tour-banner ol li { margin-bottom: 4px; }
.tour-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: transparent;
  border: none;
  color: var(--charcoal-soft);
  font-size: 1.4rem;
  line-height: 1;
  padding: 4px 8px;
  cursor: pointer;
  border-radius: 50%;
}
.tour-close:hover { background: var(--ivory-deep); color: var(--maroon); }

/* ---------- Solo-parent invite nudge ---------- */
.invite-nudge {
  background: #ffffff;
  border: 1px solid var(--stone);
  border-top: 3px solid var(--gold);
  border-radius: var(--radius-md);
  padding: 18px 22px;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  box-shadow: var(--shadow-soft);
}
.invite-nudge-body h4 {
  margin: 0 0 4px;
  font-family: var(--font-serif);
  color: var(--maroon);
  font-size: 1.1rem;
  font-weight: 600;
}
.invite-nudge-body p {
  margin: 0;
  color: var(--charcoal-soft);
  font-size: 0.95rem;
}
.invite-nudge-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Auth landing (paths before sign-up) ---------- */
.auth-landing {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 24px 60px;
}
.auth-landing-header {
  text-align: center;
  padding: 24px 0 32px;
}
.auth-landing-header .auth-mark {
  display: inline-flex;
  justify-content: center;
}
.auth-landing-header .auth-mark svg {
  width: 64px;
  height: 64px;
  color: var(--maroon);
}
.auth-landing-header h1 {
  font-size: 3.2rem;
  margin: 12px 0 4px;
  letter-spacing: 0.02em;
}
.auth-landing-header .auth-tagline {
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--saffron);
  font-size: 1.25rem;
  margin: 0;
}
.auth-paths h2 {
  text-align: center;
  margin: 8px 0 22px;
  font-size: 1.4rem;
  color: var(--charcoal);
  font-weight: 500;
}
.path-card {
  display: block;
  background: #ffffff;
  border: 1px solid var(--stone);
  border-radius: var(--radius-md);
  padding: 22px 26px;
  text-align: left;
  cursor: pointer;
  width: 100%;
  font-family: inherit;
  margin: 0 0 14px;
  position: relative;
  transition: transform 0.15s, box-shadow 0.2s, border-color 0.2s;
  box-shadow: var(--shadow-soft);
}
.path-card:hover,
.path-card:focus-visible {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
  border-color: var(--gold);
  outline: none;
}
.path-card.primary {
  border-top: 4px solid var(--saffron);
  background: linear-gradient(135deg, #ffffff 0%, var(--ivory-deep) 100%);
  box-shadow: 0 6px 20px rgba(91, 31, 14, 0.10);
}
.path-card .path-card-body { display: block; }
.path-card h3 {
  margin: 0 0 8px;
  color: var(--maroon);
  font-size: 1.2rem;
}
.path-card p {
  margin: 0 0 14px;
  color: var(--charcoal);
  line-height: 1.55;
  font-size: 0.95rem;
}
.path-card-cta {
  color: var(--saffron);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
}
.path-card:hover .path-card-cta { color: var(--maroon); }
.path-card-badge {
  position: absolute;
  top: -10px;
  right: 18px;
  background: var(--saffron);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  box-shadow: 0 2px 8px rgba(227, 114, 34, 0.30);
}
.auth-signin-link {
  text-align: center;
  margin: 28px 0 0;
  color: var(--charcoal-soft);
  font-size: 0.95rem;
}

.auth-form-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}
.auth-form-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 40px 44px 36px;
  box-shadow: 0 24px 60px rgba(91, 31, 14, 0.15);
  border: 1px solid var(--stone);
  max-width: 460px;
  width: 100%;
  position: relative;
}
.auth-back {
  position: absolute;
  top: 14px;
  left: 14px;
  background: transparent;
  border: none;
  color: var(--charcoal-soft);
  font-size: 0.88rem;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-family: inherit;
}
.auth-back:hover {
  color: var(--maroon);
  background: var(--ivory-deep);
}
.auth-form-card h2 {
  margin: 24px 0 6px;
  font-size: 1.7rem;
}
.auth-sub {
  color: var(--charcoal-soft);
  margin: 0 0 22px;
  font-size: 0.95rem;
  font-style: italic;
}

@media (max-width: 600px) {
  .auth-landing-header h1 { font-size: 2.4rem; }
  .auth-landing { padding: 24px 16px 40px; }
  .auth-paths h2 { font-size: 1.15rem; }
  .path-card { padding: 20px 20px 18px; }
  .auth-form-card { padding: 32px 24px; }
}

/* ---------- Onboarding cards ---------- */
.onboard-primary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.onboard-card {
  background: #ffffff;
  border: 1px solid var(--stone);
  border-radius: var(--radius-md);
  padding: 24px 26px;
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.onboard-card.primary {
  border-top: 4px solid var(--saffron);
  background: linear-gradient(135deg, #ffffff 0%, var(--ivory-deep) 100%);
  box-shadow: var(--shadow-card);
}
.onboard-card h3 {
  margin: 0;
  font-size: 1.2rem;
  color: var(--maroon);
}
.onboard-card p {
  margin: 0 0 8px;
  color: var(--charcoal);
  line-height: 1.55;
}
.onboard-card button {
  align-self: flex-start;
}
.onboard-secondary {
  margin-top: 8px;
}
.onboard-secondary summary {
  cursor: pointer;
  color: var(--charcoal-soft);
  font-size: 0.95rem;
  padding: 8px 0;
  list-style-position: inside;
}
.onboard-secondary summary:hover { color: var(--maroon); }

/* ---------- Auth page ---------- */
body.no-chrome .site-header,
body.no-chrome .site-footer,
body.no-chrome .side-nav { display: none; }
body.no-chrome .layout { display: block; min-height: 100vh; background: linear-gradient(135deg, var(--ivory) 0%, var(--ivory-deep) 100%); }
body.no-chrome .view { padding: 0; max-width: none; }

.auth-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
}
.auth-hero {
  padding: 40px 8% 40px 10%;
  color: var(--charcoal);
  position: relative;
  overflow: hidden;
}
.auth-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at top left, rgba(212,175,55,0.12), transparent 60%);
  pointer-events: none;
}
.auth-mark svg {
  width: 80px;
  height: 80px;
  color: var(--maroon);
  opacity: 0.85;
}
.auth-hero h1 {
  font-size: 4rem;
  margin: 14px 0 4px;
  color: var(--maroon);
  letter-spacing: 0.02em;
}
.auth-tagline {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.4rem;
  color: var(--saffron);
  margin: 0 0 24px;
}
.auth-blurb {
  font-size: 1.05rem;
  color: var(--charcoal);
  max-width: 44ch;
  line-height: 1.65;
  margin: 0 0 24px;
}
.auth-bullets {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: var(--charcoal);
}
.auth-bullets li {
  padding-left: 24px;
  position: relative;
  line-height: 1.55;
}
.auth-bullets li::before {
  content: "◇";
  color: var(--gold);
  position: absolute;
  left: 0;
}
.auth-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 36px 40px;
  box-shadow: 0 24px 60px rgba(91, 31, 14, 0.15);
  border: 1px solid var(--stone);
  margin: 40px 8% 40px 0;
  max-width: 460px;
  justify-self: end;
  width: 100%;
}
.auth-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--stone);
  margin-bottom: 22px;
}
.auth-tab {
  background: transparent;
  border: none;
  padding: 10px 4px;
  margin-right: 18px;
  margin-bottom: -2px;
  border-bottom: 3px solid transparent;
  font-size: 0.95rem;
  color: var(--charcoal-soft);
  font-weight: 500;
  cursor: pointer;
}
.auth-tab.active {
  color: var(--maroon);
  border-bottom-color: var(--saffron);
  font-weight: 600;
}
.auth-help {
  color: var(--charcoal-soft);
  font-size: 0.88rem;
  margin: 14px 0 0;
}
.link-inline {
  background: transparent;
  border: none;
  color: var(--saffron);
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  font-size: inherit;
}
.link-inline:hover { text-decoration: underline; }
.hint { color: var(--charcoal-soft); font-weight: 400; font-size: 0.78rem; text-transform: none; letter-spacing: 0; }

/* ---------- Invite code box ---------- */
.invite-code-box {
  font-family: 'Courier New', monospace;
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  background: var(--ivory-deep);
  border: 2px dashed var(--gold);
  border-radius: var(--radius-md);
  padding: 16px 22px;
  text-align: center;
  margin: 14px 0;
  color: var(--maroon);
  user-select: all;
}

/* ---------- Mobile ---------- */
@media (max-width: 820px) {
  .nav-toggle { display: inline-flex; }
  .layout {
    grid-template-columns: 1fr;
    position: relative;
  }
  .side-nav {
    position: fixed;
    top: 0;
    left: -260px;
    bottom: 0;
    width: 240px;
    z-index: 900;
    border-right: 1px solid var(--stone);
    transition: left 0.25s ease, box-shadow 0.25s ease;
    overflow-y: auto;
    padding: 24px 0;
    box-shadow: none;
  }
  body.nav-open .side-nav { left: 0; box-shadow: 8px 0 24px rgba(0,0,0,0.18); }
  .nav-group { padding: 14px 18px 4px; }
  body.nav-open::after {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(42, 31, 26, 0.4);
    z-index: 800;
  }
  .masthead { padding: 10px 16px; gap: 12px; }
  .brand-text { display: none; }
  .brand-mark { width: 36px; height: 36px; }
  .event-name { font-size: 0.92rem; max-width: 50vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .header-select { max-width: 130px; }
  .view { padding: 20px 16px; }
  .dashboard-hero, .chapter-card {
    grid-template-columns: 1fr;
    padding: 22px;
  }
  .dashboard-hero .hero-motif { display: none; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-hero { padding: 40px 24px 20px; text-align: center; }
  .auth-hero h1 { font-size: 2.6rem; }
  .auth-mark { display: flex; justify-content: center; }
  .auth-card { margin: 0 16px 40px; max-width: none; justify-self: stretch; }
  .today-greeting { font-size: 1.3rem; }
  .data-table { font-size: 0.85rem; }
  .data-table th, .data-table td { padding: 8px 8px; }
  .form-row { grid-template-columns: 1fr; }
  .toast { font-size: 0.85rem; padding: 10px 18px; }
}

@media (max-width: 480px) {
  .brand-name { font-size: 1.4rem; }
  .stat-value { font-size: 1.6rem; }
  .auth-card { padding: 24px; }
}

/* ---------- Today / Companion ---------- */
.today-greeting {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  color: var(--maroon);
  margin: 0 0 4px;
  font-weight: 500;
  line-height: 1.3;
}
.today-greeting em {
  color: var(--saffron);
  font-style: normal;
}
.today-sub {
  color: var(--charcoal-soft);
  margin: 0 0 28px;
  font-size: 1rem;
  font-style: italic;
  max-width: 64ch;
  line-height: 1.6;
}

.chapter-card {
  background: linear-gradient(135deg, var(--maroon) 0%, var(--maroon-deep) 100%);
  color: var(--ivory);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}
.chapter-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at top right, rgba(212,175,55,0.18), transparent 60%);
  pointer-events: none;
}
.chapter-card .chapter-eyebrow {
  color: var(--gold-soft);
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin: 0;
  font-weight: 600;
}
.chapter-card .chapter-name {
  font-family: var(--font-serif);
  font-size: 2.4rem;
  margin: 6px 0 2px;
  color: var(--ivory);
  font-weight: 600;
  line-height: 1.1;
}
.chapter-card .chapter-translation {
  color: var(--gold-soft);
  font-style: italic;
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.1rem;
}
.chapter-card .chapter-tagline {
  margin: 16px 0 0;
  font-size: 1.05rem;
  color: var(--ivory);
  max-width: 56ch;
  line-height: 1.6;
}
.chapter-card .chapter-meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 18px;
  align-items: center;
}
.chapter-card .chapter-meta .pill {
  background: rgba(212,175,55,0.18);
  border: 1px solid var(--gold);
  color: var(--ivory);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
}

.focus-card {
  border-left: 3px solid var(--saffron);
  background: #ffffff;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 18px 22px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-soft);
}
.focus-card .focus-eyebrow {
  color: var(--charcoal-soft);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  margin: 0 0 4px;
  font-weight: 600;
}
.focus-card .focus-title {
  margin: 0;
  color: var(--maroon);
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 600;
}
.focus-card .focus-meta {
  color: var(--charcoal-soft);
  font-size: 0.85rem;
  margin: 4px 0 0;
  font-style: italic;
}

.wisdom-card {
  background: linear-gradient(135deg, var(--ivory-deep) 0%, #ffffff 100%);
  border: 1px solid var(--gold);
  border-left: 4px solid var(--gold);
  border-radius: var(--radius-md);
  padding: 22px 26px;
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-style: italic;
  color: var(--charcoal);
  line-height: 1.55;
  position: relative;
}
.wisdom-card::before {
  content: '\201C';
  position: absolute;
  top: -6px;
  left: 12px;
  font-size: 3rem;
  color: var(--gold);
  font-family: var(--font-serif);
  line-height: 1;
}
.wisdom-card .wisdom-attribution {
  display: block;
  margin-top: 12px;
  font-size: 0.82rem;
  font-style: normal;
  color: var(--charcoal-soft);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-family: var(--font-sans);
}

.reflection-card {
  background: #ffffff;
  border: 1px solid var(--stone);
  border-top: 3px solid var(--maroon);
  border-radius: var(--radius-md);
  padding: 22px 26px;
  box-shadow: var(--shadow-soft);
}
.reflection-card .reflection-eyebrow {
  color: var(--maroon);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin: 0 0 6px;
  font-weight: 600;
}
.reflection-card .reflection-prompt {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  color: var(--charcoal);
  margin: 0 0 16px;
  line-height: 1.35;
}

/* ---------- Journey map ---------- */
.journey-map {
  position: relative;
  padding-left: 36px;
  margin: 24px 0;
  list-style: none;
}
.journey-map::before {
  content: "";
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: 14px;
  width: 2px;
  background: linear-gradient(180deg, var(--gold-soft), var(--gold), var(--saffron), var(--maroon));
}
.journey-map > li {
  position: relative;
  margin-bottom: 18px;
  background: #ffffff;
  border: 1px solid var(--stone);
  border-radius: var(--radius-md);
  padding: 18px 22px;
  box-shadow: var(--shadow-soft);
}
.journey-map > li::before {
  content: "";
  position: absolute;
  left: -32px;
  top: 22px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--ivory);
  border: 3px solid var(--gold);
}
.journey-map > li.current::before {
  background: var(--saffron);
  border-color: var(--maroon);
  box-shadow: 0 0 0 4px rgba(227, 114, 34, 0.25);
}
.journey-map > li.past::before {
  background: var(--maroon);
  border-color: var(--maroon);
}
.journey-map > li.future {
  opacity: 0.7;
}
.journey-map .ch-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  flex-wrap: wrap;
}
.journey-map .ch-name {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  color: var(--maroon);
  margin: 0;
  font-weight: 600;
}
.journey-map .ch-translation {
  font-style: italic;
  color: var(--saffron);
  font-family: var(--font-serif);
}
.journey-map .ch-period {
  font-size: 0.82rem;
  color: var(--charcoal-soft);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.journey-map .ch-tagline {
  font-family: var(--font-serif);
  color: var(--maroon);
  margin: 8px 0 12px;
  font-size: 1.1rem;
}
.journey-map details {
  margin-top: 8px;
}
.journey-map summary {
  cursor: pointer;
  color: var(--maroon);
  font-weight: 600;
  font-size: 0.92rem;
  outline: none;
  padding: 4px 0;
}
.journey-map summary:hover { text-decoration: underline; }
.journey-map .ch-section {
  margin: 14px 0 0;
  color: var(--charcoal);
  line-height: 1.6;
}
.journey-map .ch-section h4 {
  margin: 14px 0 6px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--charcoal-soft);
  font-family: var(--font-sans);
  font-weight: 600;
}

/* ---------- Journal ---------- */
.journal-entry {
  background: #ffffff;
  border: 1px solid var(--stone);
  border-left: 3px solid var(--saffron);
  border-radius: var(--radius-md);
  padding: 18px 22px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-soft);
}
.journal-entry .je-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  color: var(--charcoal-soft);
  font-size: 0.82rem;
  margin-bottom: 8px;
}
.journal-entry .je-prompt {
  font-family: var(--font-serif);
  color: var(--maroon);
  font-style: italic;
  font-size: 1.05rem;
  margin: 0 0 10px;
}
.journal-entry .je-body {
  white-space: pre-wrap;
  color: var(--charcoal);
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.6;
}
.journal-entry .je-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

/* ---------- Wizard steps ---------- */
.wizard-dots {
  display: flex;
  gap: 8px;
  margin: 0 0 18px;
}
.wizard-dots span {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--stone);
}
.wizard-dots span.on { background: var(--saffron); }
.wizard-quote {
  border-left: 3px solid var(--gold);
  padding: 8px 0 8px 14px;
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--charcoal-soft);
  margin: 0 0 16px;
}

/* ---------- Print ---------- */
@media print {
  .site-header, .site-footer, .side-nav, .filter-bar, .form-actions, .row-actions, button {
    display: none !important;
  }
  body { background: #ffffff; color: #000; }
  .layout { display: block; }
  .view { padding: 0; max-width: none; }
  .card, .stat-card, .data-table { box-shadow: none; border: 1px solid #999; page-break-inside: avoid; }
  h2, h3 { color: #000; }
  .stat-value { color: #000; }
  .timeline-list::before { display: none; }
  .timeline-list { padding-left: 0; }
  .timeline-list li::before { display: none; }
}
