:root {
  --purple: #8f02ef;
  --purple-dark: #5c00a3;
  --purple-deep: #3a0068;
  --orange: #fb4901;
  --orange-dark: #d63c00;
  --cream: #fdfdef;
  --lilac: #f4e8fd;
  --ink: #1a1310;
  --ink-soft: #4a4038;
  --white: #ffffff;
  --line: rgba(26, 19, 16, 0.08);
  --shadow: 0 10px 30px rgba(58, 0, 104, 0.14);
  --radius: 18px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--purple-deep);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  height: 100%;
  /* Stop iOS from auto-inflating body text (Dynamic Type / "Larger Text") in the
     native WebView, which would otherwise read as the whole UI being zoomed in. */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

#app-shell {
  max-width: 480px;
  min-height: 100vh;
  margin: 0 auto;
  background: var(--white);
  position: relative;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  box-shadow: 0 0 60px rgba(0,0,0,0.35);
}

@media (min-width: 481px) {
  html, body { background: linear-gradient(160deg, #3a0068, #1a1310); }
  /* No transform here on purpose: a transform on this element would make it the
     positioning anchor for every `position: fixed` modal in the app (a CSS rule most
     people never hit), so a tall page (e.g. a long People list) would push modals
     off-screen below the anchor's bottom edge instead of the real screen's bottom edge. */
  #app-shell { min-height: 100vh; margin: 24px auto; border-radius: 28px; overflow: hidden; }
}

main#view {
  flex: 1;
  padding-top: var(--safe-top);
  padding-bottom: calc(84px + var(--safe-bottom));
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: var(--purple);
  color: var(--white);
}
.topbar .back-btn {
  background: rgba(255,255,255,0.16);
  border: none;
  color: var(--white);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.topbar .back-btn:active { background: rgba(255,255,255,0.3); }
.topbar-title {
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar-sub {
  font-size: 12px;
  opacity: 0.85;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

/* ---------- Hero (home) ---------- */
.hero {
  background: linear-gradient(150deg, var(--purple) 0%, var(--purple-dark) 65%, var(--purple-deep) 100%);
  color: var(--white);
  padding: 26px 20px 28px;
  position: relative;
}
.hero-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}
.logo-mark {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}
.logo-word {
  font-weight: 800;
  font-size: 15px;
  line-height: 1.05;
}
.logo-word small { display: block; font-weight: 600; font-size: 11px; opacity: 0.8; letter-spacing: 0.4px; text-transform: uppercase; }

.hero-badge {
  display: inline-block;
  background: var(--orange);
  color: var(--white);
  font-weight: 800;
  font-size: 26px;
  line-height: 1.15;
  padding: 14px 18px;
  border-radius: 14px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.hero-badge .rule {
  width: 70px;
  height: 3px;
  background: rgba(255,255,255,0.75);
  border-radius: 2px;
  margin-top: 8px;
}

.hero-tags {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.3px;
  opacity: 0.92;
  margin-bottom: 4px;
}
.hero-place {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.14);
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  margin-top: 10px;
}

.hero-progress {
  margin-top: 20px;
}
.hero-progress-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 7px;
  opacity: 0.9;
}
.progress-track {
  height: 8px;
  border-radius: 6px;
  background: rgba(255,255,255,0.22);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--orange);
  border-radius: 6px;
  transition: width 0.4s ease;
}

.continue-btn {
  margin-top: 16px;
  width: 100%;
  background: var(--orange);
  color: var(--white);
  border: none;
  padding: 14px;
  border-radius: 14px;
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(251, 73, 1, 0.35);
}
.continue-btn:active { transform: scale(0.98); }
.secondary-btn {
  margin-top: 10px;
  width: 100%;
  background: var(--white);
  color: var(--purple-dark);
  border: 1.5px solid var(--purple);
  padding: 12.5px;
  border-radius: 14px;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
}
.secondary-btn:active { background: var(--lilac); }

/* ---------- Session list ---------- */
.list-wrap { padding: 18px 16px 8px; }
.list-heading {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--purple-dark);
  margin: 18px 4px 10px;
}

.session-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.session-row:active { transform: scale(0.98); }
.session-row.done { background: var(--lilac); border-color: rgba(143,2,239,0.15); }

.session-num {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--lilac);
  color: var(--purple);
  font-weight: 800;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 2px solid var(--purple);
}
.session-row.done .session-num {
  background: var(--purple);
  color: var(--white);
  border-color: var(--purple);
}
.session-num.intro-num { font-size: 18px; }

.session-body { flex: 1; min-width: 0; }
.session-title {
  font-weight: 800;
  font-size: 14.5px;
  color: var(--ink);
  margin-bottom: 3px;
}
.session-title-edit {
  display: block;
  font-weight: 800;
  font-size: 14.5px;
  color: var(--ink);
  background: none;
  border: none;
  text-align: left;
  padding: 6px 8px 6px 0;
  margin: -6px 0 -3px -0px;
  cursor: pointer;
  font-family: inherit;
}
.session-title-edit span { font-size: 12px; opacity: 0.55; margin-left: 2px; }
.session-title-edit:active { opacity: 0.7; }
.session-blurb {
  font-size: 12.5px;
  color: var(--ink-soft);
  line-height: 1.35;
  margin-bottom: 6px;
}
.foundation-chip {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 3px 8px;
  border-radius: 999px;
}
.chip-creed { background: #f4e8fd; color: var(--purple-dark); }
.chip-commandments { background: #ffe9dd; color: var(--orange-dark); }
.chip-lordsprayer { background: #f4e8fd; color: var(--purple-dark); }
.chip-church { background: #ffe9dd; color: var(--orange-dark); }

.chevron { color: var(--purple); font-size: 20px; flex-shrink: 0; opacity: 0.6; }

/* ---------- Bottom nav ---------- */
.bottom-nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: 480px;
  display: flex;
  background: var(--white);
  border-top: 1px solid var(--line);
  padding: 8px 6px calc(8px + var(--safe-bottom));
  z-index: 30;
}
.nav-btn {
  flex: 1;
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 2px;
  cursor: pointer;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
}
.nav-btn .nav-icon { font-size: 20px; line-height: 1; }
.nav-btn.active { color: var(--purple); }

/* ---------- Session detail ---------- */
.session-header {
  background: var(--purple);
  color: var(--white);
  padding: 18px 18px 22px;
}
.session-header .foundation-chip { background: rgba(255,255,255,0.18); color: var(--white); margin-bottom: 10px; }
.session-header h1 { font-size: 22px; margin: 0 0 6px; font-weight: 800; line-height: 1.2; }
.session-header .part-progress { font-size: 12px; opacity: 0.85; font-weight: 700; }

.part-block { padding: 18px 16px 4px; }
.part-heading {
  font-size: 17px;
  font-weight: 800;
  color: var(--purple-dark);
  margin: 6px 0 6px;
}
.part-tagline {
  color: var(--orange-dark);
  font-weight: 700;
  font-size: 13px;
  line-height: 1.4;
  margin-bottom: 14px;
}
.session-badge-num {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--purple);
  background: var(--lilac);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 8px;
}

/* cards */
.card {
  border-radius: 14px;
  padding: 14px 15px;
  margin-bottom: 12px;
  border-left: 5px solid var(--orange);
  background: var(--cream);
}
.card.tone-b { border-left-color: var(--purple); background: var(--lilac); }

.card-heading {
  font-weight: 800;
  font-size: 15px;
  color: var(--ink);
  margin-bottom: 8px;
}
.card.tone-b .card-heading { color: var(--purple-dark); }
.card:not(.tone-b) .card-heading { color: var(--orange-dark); }

.card-q { font-weight: 800; font-size: 14.5px; color: var(--ink); margin-bottom: 6px; }
.card-q .qmark { color: var(--orange-dark); }
.card.tone-b .card-q .qmark { color: var(--purple-dark); }

.card-answer-label, .card-read-label, .card-jesus-label, .card-talk-label {
  font-weight: 800;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-right: 5px;
}
.card-answer-label { color: var(--ink); }
.card-read-label { color: var(--orange-dark); }
.card-jesus-label { color: var(--purple-dark); }
.card-talk-label { color: var(--orange-dark); }

.card p { margin: 0 0 8px; font-size: 13.5px; line-height: 1.5; color: var(--ink); }
.card p:last-child { margin-bottom: 0; }

.card ul { margin: 0 0 8px; padding-left: 18px; }
.card ul:last-child { margin-bottom: 0; }
.card li { font-size: 13.5px; line-height: 1.5; margin-bottom: 4px; color: var(--ink); }
.card li::marker { color: var(--orange); }
.card.tone-b li::marker { color: var(--purple); }

.jesus-line {
  background: rgba(255,255,255,0.55);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 13.5px;
  line-height: 1.5;
  margin: 8px 0;
}
.jesus-line b { color: var(--purple-dark); }

/* fulltext / read-together card */
.fulltext-card {
  background: linear-gradient(160deg, var(--purple) 0%, var(--purple-dark) 100%);
  color: var(--white);
  border-radius: 18px;
  padding: 20px 18px;
  margin: 4px 0 20px;
  box-shadow: var(--shadow);
}
.fulltext-tag {
  display: inline-block;
  background: var(--orange);
  color: var(--white);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
}
.fulltext-card h2 { font-size: 19px; margin: 0 0 10px; font-weight: 800; }
.fulltext-card .fulltext-intro { font-size: 12.5px; line-height: 1.5; opacity: 0.9; margin-bottom: 14px; }
.fulltext-body { background: rgba(255,255,255,0.1); border-radius: 12px; padding: 14px 16px; }
.fulltext-body p { margin: 0 0 10px; font-size: 14px; line-height: 1.5; }
.fulltext-body p:last-child { margin-bottom: 0; }
.fulltext-body ol { margin: 0; padding-left: 20px; }
.fulltext-body li { font-size: 14px; line-height: 1.6; margin-bottom: 8px; }
.fulltext-citation { font-size: 11.5px; opacity: 0.75; font-style: italic; margin-top: 10px; }

/* session footer nav */
.session-footer {
  padding: 6px 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.complete-btn {
  width: 100%;
  padding: 15px;
  border-radius: 14px;
  border: none;
  font-weight: 800;
  font-size: 14.5px;
  cursor: pointer;
  background: var(--purple);
  color: var(--white);
}
.complete-btn.is-done { background: var(--lilac); color: var(--purple-dark); border: 2px solid var(--purple); }
.footer-nav-row { display: flex; gap: 10px; }
.footer-nav-row button {
  flex: 1;
  padding: 12px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: var(--white);
  color: var(--ink);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}
.footer-nav-row button:disabled { opacity: 0.35; }
.footer-nav-row button.next-btn { background: var(--orange); color: var(--white); border-color: var(--orange); }

/* ---------- Foundations tab ---------- */
.foundation-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 16px;
  margin: 0 16px 14px;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(58,0,104,0.06);
}
.foundation-card-head {
  padding: 15px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}
.foundation-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  flex-shrink: 0;
  color: var(--white);
}
.foundation-card-title { font-weight: 800; font-size: 15px; color: var(--ink); }
.foundation-card-hint { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.foundation-toggle { margin-left: auto; color: var(--purple); font-size: 18px; transition: transform 0.2s ease; }
.foundation-card.open .foundation-toggle { transform: rotate(180deg); }
.foundation-card-body {
  display: none;
  padding: 0 16px 18px;
}
.foundation-card.open .foundation-card-body { display: block; }
.foundation-card-body p { font-size: 13px; color: var(--ink-soft); line-height: 1.5; margin: 0 0 12px; }
.foundation-card-body .text-block {
  background: var(--cream);
  border-radius: 12px;
  padding: 14px 15px;
  border-left: 4px solid var(--orange);
}
.foundation-card-body .text-block p { color: var(--ink); font-size: 13.5px; margin-bottom: 10px; }
.foundation-card-body .text-block p:last-child { margin-bottom: 0; }
.foundation-card-body .text-block ol,
.foundation-card-body .text-block ul { margin: 0; padding-left: 18px; }
.foundation-card-body li { font-size: 13.5px; line-height: 1.7; color: var(--ink); }
.foundation-card-body li::marker { color: var(--orange-dark); }
.foundation-card-body .citation { font-size: 11.5px; font-style: italic; color: var(--ink-soft); margin-top: 10px; }
.foundation-card-body .go-session {
  margin-top: 12px;
  display: inline-block;
  background: var(--lilac);
  color: var(--purple-dark);
  font-weight: 800;
  font-size: 12.5px;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
}

.page-title-block { padding: 20px 16px 6px; }
.page-title-block h1 { font-size: 22px; margin: 0 0 6px; font-weight: 800; color: var(--ink); }
.page-title-block p { font-size: 13px; color: var(--ink-soft); margin: 0; line-height: 1.4; }

/* ---------- About tab ---------- */
.about-section {
  margin: 0 16px 18px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 16px;
}
.about-section h3 {
  margin: 0 0 10px;
  font-size: 14.5px;
  font-weight: 800;
  color: var(--purple-dark);
}
.about-step { display: flex; gap: 10px; margin-bottom: 10px; }
.about-step:last-child { margin-bottom: 0; }
.about-step .dot {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--orange); color: var(--white);
  font-size: 12px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.about-step-text b { display: block; font-size: 13.5px; color: var(--ink); }
.about-step-text span { font-size: 12.5px; color: var(--ink-soft); line-height: 1.4; }
.aim-box {
  background: var(--lilac);
  border-radius: 12px;
  padding: 14px 15px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--ink);
}
.aim-box b { color: var(--purple-dark); }

.about-hero {
  background: linear-gradient(150deg, var(--purple) 0%, var(--purple-deep) 100%);
  color: var(--white);
  padding: 26px 20px;
  text-align: center;
}
.about-hero .logo-mark { width: 56px; height: 56px; margin: 0 auto 10px; }
.about-hero h2 { margin: 0 0 4px; font-size: 18px; font-weight: 800; }
.about-hero p { margin: 0; font-size: 12.5px; opacity: 0.85; }

.reset-btn {
  display: block;
  width: calc(100% - 32px);
  margin: 4px 16px 20px;
  padding: 12px;
  border-radius: 12px;
  border: 1.5px solid rgba(251,73,1,0.4);
  background: #fff5f0;
  color: var(--orange-dark);
  font-weight: 700;
  font-size: 12.5px;
  cursor: pointer;
}

.footer-credit {
  text-align: center;
  font-size: 11px;
  color: var(--ink-soft);
  padding: 4px 16px 8px;
}

::selection { background: var(--orange); color: var(--white); }

/* ================= Hamburger + Drawer ================= */
/* `top: var(--safe-top)` (not 0) so the sticky threshold itself clears the status bar/notch
   once scrolled — a plain `top: 0` would let this snap back under the notch on scroll even
   though it looks fine before scrolling, since sticky's threshold ignores an ancestor's
   padding and is only ever as safe as this value itself. */
.global-topbar { position: sticky; top: var(--safe-top); height: 0; z-index: 60; }
/* On booklet pages (where the language switcher shows), give the topbar real height
   so it pushes the hero/title below it down instead of floating over it — height:0
   only works for the hamburger alone because it's short and right-aligned; the
   switcher collides with left-aligned logos/headings that start flush at the top. */
.global-topbar.has-lang { height: 50px; }
.global-topbar.has-lang .hamburger-btn,
.global-topbar.has-lang .lang-select { top: 8px; }
.hamburger-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--orange);
  color: var(--white);
  border: none;
  font-size: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(251, 73, 1, 0.4);
}
.hamburger-btn:active { transform: scale(0.94); }
.lang-select {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 61;
  box-shadow: 0 4px 10px rgba(20, 10, 30, 0.12);
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 10, 30, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 200;
}
.drawer-backdrop.show { opacity: 1; pointer-events: auto; }

.drawer-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 84%;
  max-width: 320px;
  background: linear-gradient(165deg, var(--purple) 0%, var(--purple-deep) 100%);
  color: var(--white);
  z-index: 201;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  padding: 22px 18px;
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.3);
}
.drawer-panel.show { transform: translateX(0); }

.drawer-header { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.drawer-title { font-weight: 800; font-size: 15px; }
.drawer-sub { font-size: 11.5px; opacity: 0.75; }
.drawer-close {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: var(--white);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
}

.drawer-menu { display: flex; flex-direction: column; gap: 12px; }
.drawer-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  cursor: pointer;
  border: 1.5px solid transparent;
}
.drawer-item.active { background: rgba(255, 255, 255, 0.16); border-color: rgba(255, 255, 255, 0.45); }
.drawer-item-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  flex-shrink: 0;
  background: var(--orange);
}
.drawer-item-icon.booklet-icon { background: rgba(255, 255, 255, 0.22); }
.drawer-item-title { font-weight: 800; font-size: 14px; }
.drawer-item-hint { font-size: 11.5px; opacity: 0.75; margin-top: 1px; }
.drawer-check { margin-left: auto; font-size: 16px; flex-shrink: 0; }
.drawer-footer { margin-top: auto; font-size: 11px; opacity: 0.6; text-align: center; padding-top: 20px; }
.drawer-logout {
  margin-top: 18px;
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.08);
  color: var(--white);
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
}
.drawer-logout:active { background: rgba(255, 255, 255, 0.16); }

/* ================= Rota ================= */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 800;
  color: var(--white);
  flex-shrink: 0;
}
.avatar-purple { background: var(--purple); }
.avatar-orange { background: var(--orange); }
.avatar-ink { background: var(--ink); }

.session-num.cat-icon-num { font-size: 18px; }

.upcoming-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 12px;
}
.upcoming-date { font-weight: 800; font-size: 14px; color: var(--purple-dark); margin-bottom: 8px; }
.upcoming-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
}
.upcoming-row:first-of-type { border-top: none; }
.upcoming-cat { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 700; color: var(--ink); }
.upcoming-cat-icon { font-size: 15px; }
.upcoming-people { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.upcoming-person {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink);
  background: var(--lilac);
  padding: 3px 9px 3px 3px;
  border-radius: 999px;
}
.upcoming-unassigned { font-size: 11.5px; font-weight: 700; color: var(--ink-soft); font-style: italic; }

.cat-date-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px 14px;
  margin-bottom: 10px;
}
.cat-date-label { font-weight: 800; font-size: 13.5px; color: var(--purple-dark); margin-bottom: 9px; }
.assign-list { display: flex; flex-wrap: wrap; gap: 8px; }
.assign-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--lilac);
  border-radius: 999px;
  padding: 4px 6px 4px 4px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
}
.assign-chip em { font-style: normal; color: var(--ink-soft); font-weight: 600; }
.assign-remove {
  border: none;
  background: rgba(0, 0, 0, 0.1);
  color: var(--ink-soft);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  margin-left: 2px;
  flex-shrink: 0;
}
.empty-state { font-size: 13px; color: var(--ink-soft); font-style: italic; padding: 16px 4px; }

/* ================= Calendar ================= */
.event-card {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 12px;
}
.event-date-badge {
  width: 56px;
  flex-shrink: 0;
  border-radius: 12px;
  overflow: hidden;
  text-align: center;
  border: 1.5px solid var(--purple);
}
.event-day { background: var(--purple); color: var(--white); font-weight: 800; font-size: 20px; padding: 7px 0 3px; }
.event-month { background: var(--lilac); color: var(--purple-dark); font-weight: 800; font-size: 11px; letter-spacing: 0.5px; padding: 4px 0; }
.event-body { flex: 1; min-width: 0; }
.event-top-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.event-name { font-weight: 800; font-size: 15px; color: var(--ink); margin-bottom: 5px; line-height: 1.25; }
.event-meta { font-size: 12.5px; color: var(--ink-soft); font-weight: 700; margin-bottom: 3px; }
.event-full-date { font-size: 11.5px; color: var(--purple-dark); font-weight: 700; }
/* ================= Sermon Recordings ================= */
.sermon-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 12px;
}
.sermon-top-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.sermon-title { font-weight: 800; font-size: 15px; color: var(--ink); margin-bottom: 3px; line-height: 1.25; }
.sermon-meta { font-size: 12px; color: var(--purple-dark); font-weight: 700; }
.sermon-player { width: 100%; height: 36px; accent-color: var(--purple); margin-bottom: 8px; }
.sermon-file-meta { font-size: 11px; color: var(--ink-soft); }

.modal-hint { font-size: 11.5px; color: var(--ink-soft); line-height: 1.4; margin: 6px 2px 0; }
input[type="file"].modal-input { padding: 10px; font-size: 12.5px; }

.event-countdown {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--orange-dark);
  background: #ffe9dd;
  padding: 4px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

/* ================= Add-to-rota modal ================= */
.modal-backdrop { position: fixed; inset: 0; background: rgba(20, 10, 30, 0.55); z-index: 210; }
.modal-sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: var(--white);
  border-radius: 22px 22px 0 0;
  padding: 14px 20px calc(24px + var(--safe-bottom));
  z-index: 211;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.25);
}
.modal-handle { width: 40px; height: 4px; background: var(--line); border-radius: 4px; margin: 0 auto 14px; }
.modal-sheet h2 { margin: 0 0 4px; font-size: 18px; font-weight: 800; color: var(--ink); }
.modal-label {
  display: block;
  font-size: 11.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--purple-dark);
  margin: 16px 0 8px;
}
.modal-optional { text-transform: none; font-weight: 600; color: var(--ink-soft); letter-spacing: 0; }
.modal-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  font-size: 14px;
  font-family: inherit;
  color: var(--ink);
  background: #fdfdfd;
}
.modal-chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.modal-chip {
  border: 1.5px solid var(--line);
  background: var(--white);
  color: var(--ink);
  padding: 9px 13px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.modal-chip.selected { background: var(--lilac); border-color: var(--purple); color: var(--purple-dark); }
.modal-chip.person-chip.selected { background: #ffe9dd; border-color: var(--orange); color: var(--orange-dark); }
.modal-chip.person-chip-unavailable { background: #f7f5f3; border-color: var(--line); color: var(--ink-soft); opacity: 0.75; }
.modal-stepper { display: flex; align-items: center; gap: 18px; }
.stepper-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  background: var(--white);
  color: var(--purple-dark);
  font-size: 20px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.stepper-btn:active { background: var(--lilac); }
.stepper-value { font-size: 20px; font-weight: 800; color: var(--ink); min-width: 26px; text-align: center; }

.open-slot-chip {
  border: 1.5px dashed var(--orange);
  background: #fff5f0;
  color: var(--orange-dark);
  padding: 6px 13px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}
.open-slot-chip:active { background: #ffe4d5; }

.modal-actions { display: flex; gap: 10px; margin-top: 24px; }
.modal-cancel {
  flex: 1;
  padding: 13px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: var(--white);
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
}
.modal-save {
  flex: 2;
  padding: 13px;
  border-radius: 12px;
  border: none;
  background: var(--purple);
  color: var(--white);
  font-weight: 800;
  cursor: pointer;
}
.modal-save:disabled, .modal-cancel:disabled { opacity: 0.6; cursor: default; }

/* ================= Rota import wizard (admin portal) ================= */
textarea.modal-input { resize: vertical; font-family: inherit; }
.import-col-list { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.import-col-card {
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  background: #fdfdfd;
}
.import-col-label { font-weight: 800; font-size: 13.5px; color: var(--ink); }
.import-col-samples { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.import-col-select { border-radius: 10px; padding: 9px 10px; }
.import-row-list { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; max-height: 46vh; overflow-y: auto; }
.import-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 9px 12px;
  background: #fdfdfd;
}
.import-row-flag { border-color: var(--orange); background: #fff8f4; }
.import-row-main { min-width: 0; }
.import-row-date { font-weight: 800; font-size: 12.5px; color: var(--ink); }
.import-row-rota { font-size: 11.5px; color: var(--ink-soft); margin-top: 1px; }
.import-row-warning { font-size: 11px; font-weight: 700; color: var(--orange-dark); margin-top: 3px; }

/* ================= Loading / error states ================= */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 90px 20px;
  gap: 14px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 600;
}
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--lilac);
  border-top-color: var(--purple);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ================= Admin portal ================= */
.admin-topbar {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  padding: 14px 60px 14px 16px;
  background: var(--purple);
  color: var(--white);
}
.admin-topbar-brand { display: flex; align-items: center; gap: 10px; min-width: 0; max-width: 100%; }
.admin-topbar-user {
  font-size: 11.5px;
  font-weight: 700;
  opacity: 0.85;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.admin-logout-btn {
  background: rgba(255, 255, 255, 0.18);
  border: none;
  color: var(--white);
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 800;
  cursor: pointer;
}
.login-error {
  background: #ffe4d5;
  color: var(--orange-dark);
  font-size: 12.5px;
  font-weight: 700;
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 14px;
}

/* ================= People / role management (admin portal) ================= */
.role-select {
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: var(--white);
  color: var(--ink);
  font-weight: 700;
  font-size: 12.5px;
  padding: 7px 10px;
  flex-shrink: 0;
}
.role-select:disabled { opacity: 0.5; }

.verse-ref {
  color: var(--purple);
  text-decoration: underline dotted;
  text-decoration-thickness: 1px;
  cursor: pointer;
}
.verse-popover {
  position: fixed;
  width: 260px;
  max-width: calc(100vw - 20px);
  max-height: 240px;
  overflow-y: auto;
  background: var(--white);
  border-radius: 14px;
  box-shadow: 0 12px 28px rgba(20, 10, 30, 0.28);
  padding: 14px 16px;
  z-index: 220;
}
.verse-popover-ref { font-weight: 700; font-size: 13px; color: var(--purple); margin-bottom: 6px; }
.verse-popover-text { font-size: 13.5px; line-height: 1.5; color: var(--ink); }
.verse-popover-credit { font-size: 11px; color: var(--ink-soft); margin-top: 8px; }
.session-row[data-person-row] { cursor: default; }
.session-row[data-person-row]:active { transform: none; }
