/* ─── Brand fonts (One Family Church branding kit, self-hosted like the website) ── */
@font-face { font-family: "Lequire"; src: url("/static/fonts/lequire.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Lequire Outline"; src: url("/static/fonts/lequire-outline.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Montserrat"; src: url("/static/fonts/montserrat-regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Montserrat"; src: url("/static/fonts/montserrat-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Montserrat"; src: url("/static/fonts/montserrat-medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Montserrat"; src: url("/static/fonts/montserrat-semibold.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Montserrat"; src: url("/static/fonts/montserrat-bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Montserrat"; src: url("/static/fonts/montserrat-extrabold.woff2") format("woff2"); font-weight: 800; font-display: swap; }

/* ─── Design tokens ────────────────────────────────────
   Mirrors the ofc-wp.sxtn.cc "onefamily" theme (base.css + .d-frontdoor
   overrides): white ground, neutral charcoal tints, orange for action,
   no blues on the identity layer. Status colors (--info/--danger/--warning)
   are app-only functional colors and intentionally sit outside the brand set. */
:root {
  /* Brand palette (One Family Church) */
  --charcoal: #20242a;
  --charcoal-2: #2b3139;
  --charcoal-3: #39424c;
  --orange: #ff953e;
  --peach: #ffb76b;
  --slate: #5e6c7a;
  --tint: #f2f3f4;
  --tint-2: #e6e8ea;

  --bg: #ffffff;
  --surface: var(--tint);
  --surface-raised: #ffffff;
  --border: #e1e4e7;
  --border-strong: rgba(32, 36, 42, 0.26);
  --ink: #20242a;
  --ink-soft: #39424c;
  --ink-muted: #5e6c7a;
  --accent: #ff953e;
  --accent-strong: #c25a12;
  --accent-ink: #20242a;
  --accent-hover: #ffb76b;
  --accent-soft: #ffe8d2;
  --accent-glow: rgba(255, 149, 62, 0.13);
  --info: #146a84;
  --info-soft: #d0ecf6;
  --warm: #c25a12;
  --warm-glow: rgba(255, 149, 62, 0.12);
  --danger: #b03a28;
  --warning: #a16912;

  /* Type */
  --font-ui: "Montserrat", system-ui, sans-serif;
  --font-display: "Lequire", "Montserrat", sans-serif;

  --text-xs: 0.72rem;
  --text-sm: 0.8rem;
  --text-base: 0.9rem;
  --text-lg: 1.05rem;
  --text-xl: 1.3rem;
  --text-2xl: 1.7rem;

  --topbar-h: 56px;
  --radius-sm: 4px;
  --radius-md: 5px;
  --radius-lg: 5px;
  --shadow-md: 0 8px 24px rgba(32, 36, 42, 0.1);
  --shadow-lg: 0 16px 40px rgba(9, 10, 13, 0.16);

  /* ROS aliases — the Run of Show sheet is intentionally frozen at its
     pre-overhaul (warm) design: it renders to a 1080p PNG for ProPresenter,
     so its colors must not track the global palette. Values are the literal
     4f382db resolution of the var() chain; do not retune with the brand. */
  --ros-ink: #1f1d1a;
  --ros-ink-soft: #5a4d40;
  --ros-muted: #8a7e72;
  --ros-line: rgba(44, 38, 30, 0.12);
  --ros-line-strong: rgba(44, 38, 30, 0.22);
  --ros-accent: #176b52;
  --ros-accent-soft: #c4e0d4;
  --ros-bg: #f2ede4;
  --ros-panel: rgba(255, 252, 247, 0.92);
  --ros-panel-strong: #fffaf3;
  --ros-shadow: 0 24px 64px rgba(51, 41, 24, 0.18);
  --ros-radius: 20px;
  --ros-warm: #d4c4a0;
  --ros-warm-soft: #e8dcc8;
  --ros-song: #176b52;
}

* {
  box-sizing: border-box;
  margin: 0;
}

/* Reserve the scrollbar's width on every page so the header doesn't shift
   sideways between pages that scroll (Songs) and ones that don't. */
html {
  scrollbar-gutter: stable;
}

body {
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

table {
  font-variant-numeric: tabular-nums;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* The four brand facets, as the strip under the header on the website */
.brand-strip {
  height: 6px;
  background: linear-gradient(90deg, var(--charcoal) 0 25%, var(--orange) 25% 50%, var(--peach) 50% 75%, var(--slate) 75% 100%);
}

/* ─── Topbar ─────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  background: #ffffff;
}

.topbar::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border);
}

.topbar__logo {
  height: 26px;
  width: auto;
  flex-shrink: 0;
}

.topbar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.topbar__wordmark {
  font-family: var(--font-ui);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
  color: var(--ink);
  padding-left: 10px;
  border-left: 1px solid var(--border);
}

.topbar__plan {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  border-left: 1px solid var(--border);
  padding-left: 14px;
}

.topbar__plan-select {
  border: 1px solid var(--border-strong);
  background: #ffffff;
  color: var(--ink);
  border-radius: var(--radius-sm);
  padding: 5px 9px;
  font: inherit;
  font-size: 0.86rem;
  max-width: 230px;
  /* Shrinkable so a crowded topbar (ROS has two selects + mode toggle)
     truncates the selects instead of spilling them under the actions. */
  flex: 0 1 auto;
  min-width: 120px;
  cursor: pointer;
}

.topbar__plan-select option {
  color: #111;
}

.topbar__plan-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 1px;
}

.topbar__plan-title {
  font-weight: 600;
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar__plan-date {
  font-size: 0.76rem;
  color: var(--ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.topbar__sep {
  display: block;
  width: 1px;
  height: 18px;
  background: var(--border-strong);
  margin: 0 4px;
}

/* ─── App nav strip (site header nav: orange underline on hover/active) ── */
.app-nav {
  display: flex;
  align-items: stretch;
  gap: 2px;
  padding: 0 10px;
  height: 38px;
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: var(--topbar-h);
  z-index: 99;
}

.app-nav__link {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-soft);
  text-decoration: none;
  padding: 0 10px;
  display: flex;
  align-items: center;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  transition: color 0.14s;
  white-space: nowrap;
  position: relative;
}

.app-nav__link:hover {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.45em;
  text-decoration-color: var(--orange);
}

.app-nav__link[aria-current="page"] {
  /* Same weight as inactive links: a bolder active tab is wider, which
     nudges every later link by a pixel or two on each tab switch. */
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.45em;
  text-decoration-color: var(--orange);
}

.app-nav__link--end {
  margin-left: auto;
  color: var(--ink-muted);
  font-size: 0.76rem;
}

/* Entrance used by overlays (help card) */
@keyframes page-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Page-to-page transitions ───────────────────────────
   Tabs are separate documents. Cross-document view transitions keep the
   chrome pinned and quickly crossfade the content instead of flashing a
   blank page (Chrome/Edge/Safari; other browsers just navigate). This
   replaces the old per-page slide-in, which re-ran on every tab switch. */
@media (prefers-reduced-motion: no-preference) {
  @view-transition {
    navigation: auto;
  }
}

.topbar { view-transition-name: app-topbar; }
.app-nav { view-transition-name: app-nav; }
.brand-strip { view-transition-name: app-brand-strip; }

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.14s;
}

/* Chrome that is identical across pages should not crossfade at all. */
::view-transition-group(app-nav),
::view-transition-group(app-brand-strip) {
  animation: none;
}

/* ─── Topbar buttons (site .btn shapes: orange fill / charcoal outline) ── */
.tb-btn {
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 6px 11px;
  transition: background-color 0.14s, color 0.14s, border-color 0.14s, opacity 0.14s;
  white-space: nowrap;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--ink);
}

.tb-btn--ghost {
  background: transparent;
  color: var(--ink-soft);
}

.tb-btn--ghost:hover {
  background: var(--tint);
  color: var(--ink);
  opacity: 1;
}

.tb-btn--outline {
  background: transparent;
  border: 2px solid var(--charcoal);
  padding: 4px 9px;
}

.tb-btn--outline:hover {
  background: var(--charcoal);
  color: #ffffff;
}

.tb-btn--primary {
  background: var(--accent);
  color: var(--accent-ink);
}

.tb-btn--primary:hover {
  background: var(--peach);
}

.tb-btn--teal {
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.tb-btn--teal:hover {
  background: var(--peach);
}

/* ─── Toast notifications ────────────────────────────── */
.toast-region {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.status-strip__message {
  padding: 11px 22px;
  border-radius: var(--radius-md);
  background: #ffffff;
  color: var(--ink);
  border: 1px solid var(--border-strong);
  font-size: 0.9rem;
  font-weight: 500;
  pointer-events: auto;
  box-shadow: var(--shadow-md);
  white-space: nowrap;
  animation: toast-in 0.2s ease;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.status-strip__message--success {
  border-color: rgba(23, 114, 69, 0.45);
  color: #0f5c31;
}

.status-strip__message--error {
  border-color: rgba(162, 69, 50, 0.45);
  color: #7a1f1f;
}

/* ─── Modal ──────────────────────────────────────────── */
.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 300;
}

.modal__scrim {
  position: absolute;
  inset: 0;
  background: rgba(9, 10, 13, 0.45);
}

.modal__card {
  position: relative;
  width: min(520px, calc(100vw - 28px));
  margin: 8vh auto 0;
  border-radius: var(--radius-md);
  padding: 22px;
  background: #ffffff;
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
}

.modal__card--wide {
  width: min(760px, calc(100vw - 28px));
}

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

.modal__form {
  display: grid;
  gap: 14px;
}

.modal__list {
  display: grid;
  gap: 7px;
  max-height: 48vh;
  overflow-y: auto;
  margin: 0 0 16px;
}

.modal__list button {
  background: var(--tint);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
  padding: 11px 13px;
  text-align: left;
  transition: background 0.13s, border-color 0.13s;
}

.modal__list button:hover {
  background: var(--tint-2);
  border-color: var(--border-strong);
}

.modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

/* ─── Form primitives ────────────────────────────────── */
.field-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

.field-control {
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: #ffffff;
  color: var(--ink);
  padding: 10px 12px;
  font: inherit;
  font-size: 0.9rem;
}

.field-control option {
  color: #111;
}

.field-control--textarea {
  min-height: 220px;
  resize: vertical;
}

.modal-note {
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  border: 1px solid var(--border-strong);
  background: var(--tint);
  color: var(--ink-soft);
  font-size: 0.88rem;
  line-height: 1.45;
}

.modal-note--error {
  border-color: rgba(162, 69, 50, 0.45);
  color: #7a1f1f;
  background: rgba(162, 69, 50, 0.08);
}

.primary-btn {
  background: var(--accent);
  color: var(--accent-ink);
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  padding: 9px 17px;
  transition: background-color 0.14s;
}

.primary-btn:hover {
  background: var(--peach);
}

.secondary-btn {
  background: transparent;
  color: var(--ink);
  border: 2px solid var(--charcoal);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  padding: 8px 14px;
  transition: background-color 0.14s, color 0.14s;
}

.secondary-btn:hover {
  background: var(--charcoal);
  color: #ffffff;
}

.icon-btn {
  background: rgba(32, 36, 42, 0.06);
  border: 0;
  border-radius: var(--radius-sm);
  color: var(--ink-muted);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 5px 9px;
  transition: background 0.13s, color 0.13s;
}

.icon-btn:hover {
  background: rgba(32, 36, 42, 0.1);
  color: var(--ink);
}

/* ─── Footer (site .site-foot: charcoal band, strip along the bottom edge) ── */
.app-footer {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 18px 16px 22px;
  margin-top: 2rem;
  font-size: var(--text-xs);
  color: rgba(255, 255, 255, 0.75);
  background: var(--charcoal);
}

.app-footer::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--charcoal-3) 0 25%, var(--orange) 25% 50%, var(--peach) 50% 75%, var(--slate) 75% 100%);
}

.app-footer__sep {
  color: rgba(255, 255, 255, 0.4);
}

.app-footer__link {
  color: #ffffff;
  text-decoration: underline;
  text-underline-offset: 0.3em;
  font-weight: 500;
}

.app-footer__link:hover {
  text-decoration-color: var(--orange);
  text-decoration-thickness: 2px;
}

@media print {
  .topbar,
  .app-footer,
  .app-nav,
  .brand-strip {
    display: none !important;
  }

  body {
    background: #ffffff;
    background-image: none;
    background-blend-mode: normal;
  }
}

/* ─── Responsive topbar ──────────────────────────────── */
@media (max-width: 680px) {
  .topbar {
    flex-wrap: wrap;
    height: auto;
    padding: 10px 14px;
    gap: 8px;
  }

  .topbar__brand {
    flex: 1;
  }

  .topbar__plan {
    border-left: 0;
    padding-left: 0;
    width: 100%;
    order: 3;
  }

  .topbar__actions {
    order: 2;
    flex-wrap: wrap;
  }

  .topbar__wordmark {
    display: none;
  }

  .topbar__sep {
    display: none;
  }

  .app-nav {
    height: 36px;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 0 10px;
    top: auto;
    position: static;
  }

  .app-nav::-webkit-scrollbar {
    display: none;
  }

  .app-nav__link--end {
    margin-left: 0;
  }
}
