/* ============================================================
   components.css — Reusable component styles (.SLYstyles.*)
   Phase 1 ships only the components needed for the skeleton
   landing page + health view. Phase 3+ extends as features land.
   ============================================================ */

/* ---------- Cards -------------------------------------------- */
.SLYstyles.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
}

.SLYstyles.card--raised {
  box-shadow: var(--shadow-md);
}

/* ---------- Buttons ----------------------------------------- */
.SLYstyles.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-md);
  font-weight: var(--weight-semibold);
  font-size: var(--text-base);
  background: var(--color-brand-primary);
  color: var(--color-text-inverse);
  border: 1px solid transparent;
  transition: background var(--t-base) var(--ease), transform var(--t-fast) var(--ease);
}

.SLYstyles.btn:hover {
  background: var(--color-brand-secondary);
  text-decoration: none;
}

.SLYstyles.btn:active {
  transform: translateY(1px);
}

.SLYstyles.btn--ghost {
  background: transparent;
  color: var(--color-brand-primary);
  border-color: var(--color-brand-primary);
}

.SLYstyles.btn--ghost:hover {
  background: rgba(45, 106, 79, 0.08);
}


/* ---------- Google Sign-In button ----------------------------
   Colors are fixed hex, not theme tokens, on purpose: Google's brand
   guidelines specify the light (#FFF / #DADCE0 / #3C4043) and dark
   (#131314 / #8E918F / #E3E3E3) treatments, and the 4-color mark must
   sit on one of them to stay legible. */
.SLYstyles.btn--google {
  width: 100%;
  background: #FFFFFF;
  color: #3C4043;
  border: 1px solid #DADCE0;
  font-weight: var(--weight-medium);
}

.SLYstyles.btn--google:hover {
  background: #F7F8F8;
  border-color: #D2D5D9;
  text-decoration: none;
}

.SLYstyles.btn--google:focus-visible {
  outline: 2px solid var(--color-brand-primary);
  outline-offset: 2px;
}

.SLYstyles.btn__google-mark {
  flex: 0 0 auto;
}

:is([data-theme="dark"], [data-theme$="-dark"]) .SLYstyles.btn--google {
  background: #131314;
  color: #E3E3E3;
  border-color: #8E918F;
}

:is([data-theme="dark"], [data-theme$="-dark"]) .SLYstyles.btn--google:hover {
  background: #1E1F20;
}

/* ---------- "or" divider between auth methods ---------------- */
.SLYstyles.auth-divider {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.SLYstyles.auth-divider::before,
.SLYstyles.auth-divider::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  background: var(--color-border);
}

/* ---------- Stack / Cluster utilities ------------------------ */
.SLYstyles.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.SLYstyles.stack--lg {
  gap: var(--space-8);
}

.SLYstyles.cluster {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: center;
}

/* ---------- Headings ----------------------------------------- */
h1, h2, h3, h4, h5, h6,
.SLYstyles.h1, .SLYstyles.h2, .SLYstyles.h3 {
  color: var(--color-heading);
}

.SLYstyles.h1 {
  font-size: var(--text-4xl);
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  margin: 0;
}

.SLYstyles.h2 {
  font-size: var(--text-2xl);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-tight);
  margin: 0;
}

.SLYstyles.h3 {
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-tight);
  margin: 0;
}

.SLYstyles.lede {
  font-size: var(--text-lg);
  color: var(--color-text-secondary);
  line-height: var(--leading-relaxed);
}

/* ---------- Brand mark --------------------------------------- */
.SLYstyles.brand {
  font-family: var(--font-serif);
  font-weight: var(--weight-bold);
  font-size: var(--text-2xl);
  color: var(--color-brand-primary);
  letter-spacing: -0.01em;
}

.SLYstyles.brand__accent {
  color: var(--color-brand-gold);
}

/* ---------- Banking metaphor accent (deposit/withdrawal coin) */
.SLYstyles.coin {
  display: inline-block;
  width: 1em;
  height: 1em;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--color-brand-gold), color-mix(in srgb, var(--color-brand-gold) 72%, black));
  vertical-align: -0.1em;
}

/* ---------- Flash messages ---------------------------------- */
.SLYstyles.flash {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  margin-bottom: var(--space-4);
}

.SLYstyles.flash--success {
  background: #F0FDF4;
  border-color: #BBF7D0;
  color: #166534;
}

.SLYstyles.flash--error {
  background: #FEF2F2;
  border-color: #FECACA;
  color: #991B1B;
}

.SLYstyles.flash--info {
  background: #EFF6FF;
  border-color: #BFDBFE;
  color: #1E40AF;
}

/* ---------- Skeleton-build status pill ----------------------- */
.SLYstyles.status-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-pill);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  background: var(--color-bg-secondary);
  color: var(--color-text-secondary);
}

.SLYstyles.status-pill::before {
  content: "";
  width: 0.5em;
  height: 0.5em;
  border-radius: 50%;
  background: var(--color-success);
}

/* ============================================================
   Sidebar (desktop nav)
   ============================================================ */
.SLYstyles.sidebar {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: var(--space-4) 0;
}

.SLYstyles.sidebar__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 0 var(--space-5) var(--space-4) var(--space-5);
}

/* Drawer dismiss — only meaningful when the sidebar is off-canvas, so it is
   revealed by the tablet media query at the foot of this file. */
.SLYstyles.sidebar__close {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-right: calc(-1 * var(--space-2));
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-text-secondary);
  font-size: var(--text-2xl);
  line-height: 1;
}

.SLYstyles.sidebar__close:hover {
  background: var(--color-bg-secondary);
  color: var(--color-text-primary);
}

.SLYstyles.sidebar__nav {
  display: flex;
  flex-direction: column;
  padding: var(--space-1) var(--space-3);
  gap: 2px;
}

.SLYstyles.sidebar__divider {
  height: 1px;
  background: var(--color-border);
  margin: var(--space-3) var(--space-4);
}

.SLYstyles.sidebar__foot {
  margin-top: auto;
  padding: var(--space-4);
}

.SLYstyles.sidebar__link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  text-decoration: none;
  font-size: var(--text-sm);
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}

.SLYstyles.sidebar__link:hover {
  background: var(--color-bg-secondary);
  color: var(--color-text-primary);
  text-decoration: none;
}

.SLYstyles.sidebar__link--active {
  background: rgba(45, 106, 79, 0.08);
  color: var(--color-brand-primary);
  font-weight: var(--weight-semibold);
}

.SLYstyles.sidebar__link--disabled {
  opacity: 0.5;
  cursor: default;
}

.SLYstyles.sidebar__link--disabled:hover {
  background: transparent;
  color: var(--color-text-secondary);
}

.SLYstyles.sidebar__icon {
  display: inline-block;
  width: 1.25rem;
  text-align: center;
  opacity: 0.85;
}

.SLYstyles.sidebar__label {
  flex: 1;
}

.SLYstyles.sidebar__badge {
  font-size: var(--text-xs);
  background: var(--color-bg-secondary);
  color: var(--color-text-muted);
  padding: 1px 6px;
  border-radius: var(--radius-pill);
}

.SLYstyles.sidebar__signout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  width: 100%;
}

/* ============================================================
   Sidebar — compact (icon rail)
   State lives on <html>[data-sidebar-compact]; the width itself is in
   layout.css. Docked widths only: in drawer mode the labels stay.
   ============================================================ */
/* The toggle has to read clearly without shouting next to the wordmark:
   a brand-tinted chip with the chevron in full brand ink. A solid brand
   fill at rest made the head look like it carried a primary action; the
   fill is kept for hover, where it confirms the press target. */
.SLYstyles.sidebar__collapse {
  display: none;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  flex: 0 0 auto;
  border: 1px solid color-mix(in srgb, var(--color-brand-primary) 35%, transparent);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--color-brand-primary) 10%, var(--color-surface));
  color: var(--color-brand-primary);
  cursor: pointer;
  transition: color var(--t-fast) var(--ease), background var(--t-fast) var(--ease),
              border-color var(--t-fast) var(--ease), transform var(--t-base) var(--ease);
}

/* The glyph is small; 1.6 reads thin against the chip. */
.SLYstyles.sidebar__collapse svg {
  display: block;
}

.SLYstyles.sidebar__collapse svg path {
  stroke-width: 2;
}

.SLYstyles.sidebar__collapse:hover {
  background: var(--color-brand-primary);
  border-color: var(--color-brand-primary);
  color: var(--color-text-inverse);
}

.SLYstyles.sidebar__collapse:focus-visible {
  outline: 2px solid var(--color-brand-primary);
  outline-offset: 2px;
}

@media (min-width: 769px) {

  .SLYstyles.sidebar__collapse {
    display: inline-flex;
  }

  :root[data-sidebar-compact="true"] .SLYstyles.sidebar__collapse {
    /* The chevron points the other way once the rail is closed. */
    transform: rotate(180deg);
  }

  /* --- What the rail drops --- */
  :root[data-sidebar-compact="true"] .SLYstyles.sidebar__label,
  :root[data-sidebar-compact="true"] .SLYstyles.sidebar__badge,
  :root[data-sidebar-compact="true"] .SLYstyles.brand__word {
    display: none;
  }

  :root[data-sidebar-compact="true"] .SLYstyles.sidebar__head {
    flex-direction: column;
    gap: var(--space-2);
    padding-left: var(--space-2);
    padding-right: var(--space-2);
  }

  :root[data-sidebar-compact="true"] .SLYstyles.sidebar__nav {
    padding-left: var(--space-2);
    padding-right: var(--space-2);
  }

  :root[data-sidebar-compact="true"] .SLYstyles.sidebar__link,
  :root[data-sidebar-compact="true"] .SLYstyles.sidebar__signout {
    justify-content: center;
    gap: 0;
    padding-left: 0;
    padding-right: 0;
  }

  :root[data-sidebar-compact="true"] .SLYstyles.sidebar__icon {
    width: auto;
    font-size: var(--text-lg);
  }

  :root[data-sidebar-compact="true"] .SLYstyles.sidebar__divider {
    margin-left: var(--space-3);
    margin-right: var(--space-3);
  }

  :root[data-sidebar-compact="true"] .SLYstyles.sidebar__foot {
    padding-left: var(--space-2);
    padding-right: var(--space-2);
  }

  /* --- The label comes back as a hover tooltip ---
     data-tip is written by nav.sidebar.php. The rail is only 76px wide,
     so the tip is positioned outside it and must not be clipped. */
  :root[data-sidebar-compact="true"] .SLYstyles.sidebar__link,
  :root[data-sidebar-compact="true"] .SLYstyles.sidebar__signout {
    position: relative;
  }

  :root[data-sidebar-compact="true"] [data-tip]:hover::after,
  :root[data-sidebar-compact="true"] [data-tip]:focus-visible::after {
    content: attr(data-tip);
    position: absolute;
    left: calc(100% + var(--space-2));
    top: 50%;
    transform: translateY(-50%);
    z-index: 40;
    padding: var(--space-1) var(--space-3);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    box-shadow: var(--shadow-md);
    color: var(--color-text-primary);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    white-space: nowrap;
    pointer-events: none;
  }
}

/* ============================================================
   Top bar
   ============================================================ */
.SLYstyles.topbar__brand {
  display: none;
}

/* hidden on desktop — sidebar already shows it */
.SLYstyles.topbar__user {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.2;
}

.SLYstyles.topbar__name {
  font-weight: var(--weight-semibold);
  font-size: var(--text-sm);
}

.SLYstyles.topbar__role {
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Account switcher in the sidebar Account section. */
.SLYstyles.account-switcher {
  position: relative;
}

.SLYstyles.account-switcher__summary {
  cursor: pointer;
  list-style: none;
}

.SLYstyles.account-switcher__summary::-webkit-details-marker {
  display: none;
}

.SLYstyles.account-switcher__menu {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin: var(--space-1) 0 var(--space-2);
  padding: var(--space-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.SLYstyles.account-switcher__row {
  display: flex;
  align-items: stretch;
  gap: var(--space-1);
}

.SLYstyles.account-switcher__switch {
  flex: 1;
  min-width: 0;
  margin: 0;
}

.SLYstyles.account-switcher__account {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  min-width: 0;
  padding: var(--space-2);
  border: 0;
  border-radius: var(--radius-sm, var(--radius-md));
  background: transparent;
  color: var(--color-text-primary);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.SLYstyles.account-switcher__account:hover,
.SLYstyles.account-switcher__account:focus-visible {
  background: var(--color-bg-secondary);
}

.SLYstyles.account-switcher__name {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
}

.SLYstyles.account-switcher__email {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.SLYstyles.account-switcher__forget {
  min-width: 32px;
  border: 0;
  border-radius: var(--radius-sm, var(--radius-md));
  background: transparent;
  color: var(--color-text-muted);
  font-size: var(--text-lg);
  cursor: pointer;
}

.SLYstyles.account-switcher__forget:hover,
.SLYstyles.account-switcher__forget:focus-visible {
  background: var(--color-bg-secondary);
  color: var(--color-text-primary);
}

.SLYstyles.account-switcher__add {
  padding: var(--space-2);
  font-size: var(--text-sm);
}

.SLYstyles.account-switcher__hint {
  margin: 0;
  padding: 0 var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* Icon rail: open the menu beside the rail instead of inside it. */
@media (min-width: 769px) {
  /* WHY: an open switcher can make the full sidebar taller than a short
     screen; scroll inside it so Sign out stays reachable. The icon rail
     keeps overflow visible so its pop-out menu is not clipped. */
  :root:not([data-sidebar-compact="true"]) .SLYstyles.app-shell__sidebar.sidebar {
    overflow-y: auto;
  }

  :root[data-sidebar-compact="true"] .SLYstyles.account-switcher__menu {
    position: absolute;
    left: calc(100% + var(--space-2));
    top: 0;
    z-index: 30;
    width: 16rem;
    margin: 0;
    box-shadow: var(--shadow-md, 0 8px 24px rgba(0, 0, 0, 0.12));
  }
}

/* Marks an account holding a named test role. */
.SLYstyles.test-role-badge {
  display: inline-flex;
  align-items: center;
  max-width: 14rem;
  padding: 2px var(--space-2);
  border: 1px dashed var(--color-warning);
  border-radius: 9999px;
  color: var(--color-warning);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.SLYstyles.test-role-badge__name {
  overflow: hidden;
  text-overflow: ellipsis;
}

.SLYstyles.topbar__icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* 44px is the minimum comfortable touch target; these are the densest
     controls on the page and were previously ~34px tall. */
  min-width: 44px;
  min-height: 44px;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-lg);
  border-radius: var(--radius-md);
}

/* ---------- Color menu (header sun / moon) ------------------ */
.SLYstyles.theme-picker {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
}

.SLYstyles.theme-menu {
  position: absolute;
  top: calc(100% + var(--space-2));
  right: 0;
  z-index: 40;
  min-width: 13.5rem;
  max-height: min(70vh, 28rem);
  overflow-y: auto;
  padding: var(--space-2);
  background: var(--color-surface);
  color: var(--color-text-primary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}

.SLYstyles.theme-menu__label {
  display: block;
  padding: var(--space-2) var(--space-3) var(--space-1);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.SLYstyles.theme-menu__item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  margin: 0;
  padding: var(--space-2) var(--space-3);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-primary);
  text-align: left;
  font-size: var(--text-sm);
  line-height: 1.3;
}

.SLYstyles.theme-menu__item:hover,
.SLYstyles.theme-menu__variant:hover {
  background: var(--color-bg-secondary);
}

.SLYstyles.theme-menu__item:focus-visible,
.SLYstyles.theme-menu__variant:focus-visible {
  outline-offset: -2px;
}

.SLYstyles.theme-menu__item[aria-checked="true"] {
  background: color-mix(in srgb, var(--color-brand-primary) 14%, var(--color-surface));
}

.SLYstyles.theme-menu__item[aria-checked="true"]::after {
  content: "✓";
  margin-left: auto;
  color: var(--color-brand-primary);
  font-size: var(--text-sm);
}

.SLYstyles.theme-menu__row {
  display: flex;
  gap: var(--space-1);
}

.SLYstyles.theme-menu__variant {
  display: grid;
  place-items: center;
  flex: 0 0 44px;
  min-height: 38px;
  padding: 0;
}

.SLYstyles.theme-menu__variant-track {
  display: flex;
  align-items: center;
  width: 34px;
  height: 20px;
  padding-inline: 3px;
  border: 1px solid var(--color-text-muted);
  border-radius: 999px;
  background: var(--color-bg);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  line-height: 1;
}

.SLYstyles.theme-menu__variant[aria-checked="true"] .theme-menu__variant-track {
  justify-content: flex-end;
  border-color: var(--color-brand-primary);
  background: var(--color-brand-primary);
  color: var(--color-text-inverse);
}

.SLYstyles.theme-menu__swatch {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  flex: 0 0 auto;
}

.SLYstyles.theme-menu__swatch[data-swatch="light"]     { background: #FFFFFF; }
.SLYstyles.theme-menu__swatch[data-swatch="dark"]      { background: #1E1E22; }
.SLYstyles.theme-menu__swatch[data-swatch="parchment"] { background: #E7C98A; }
.SLYstyles.theme-menu__swatch[data-swatch="sage"]      { background: #8FBF9A; }
.SLYstyles.theme-menu__swatch[data-swatch="mist"]      { background: #8FB4D0; }
.SLYstyles.theme-menu__swatch[data-swatch="blush"]     { background: #E3A8A8; }
.SLYstyles.theme-menu__swatch[data-swatch="sand"]      { background: #D7B48A; }
.SLYstyles.theme-menu__swatch[data-swatch="lilac"]     { background: #C3A8DC; }
.SLYstyles.theme-menu__swatch[data-swatch="tide"]      { background: #7EC4B6; }

:is([data-theme="dark"], [data-theme$="-dark"]) .SLYstyles.theme-menu__item[aria-checked="true"] .theme-menu__swatch {
  background: var(--color-bg);
  border-color: var(--color-brand-primary);
}

/* The header keeps its brand at the left and everything else hard right,
   whichever of the left-hand items are currently displayed. */
.SLYstyles.topbar__right {
  margin-left: auto;
  gap: var(--space-3);
  /* WHY nowrap: the header is a fixed --header-height row. Letting the
     cluster wrap pushes the second line out of the bar entirely. */
  flex-wrap: nowrap;
}

/* Header wordmark — one step down from the sidebar's, and smaller again on
   a phone, where it shares a 64px row with four controls. */
.SLYstyles.topbar__wordmark {
  font-size: var(--text-xl);
}

/* ---------- Drawer trigger (hamburger) ---------------------- */
/* Hidden by default: above the breakpoint the sidebar is permanent and
   there is nothing to toggle. */
.SLYstyles.nav-toggle {
  display: none;
  flex: 0 0 auto;
  background: transparent;
  border: 1px solid transparent;
  color: var(--color-text-secondary);
}

.SLYstyles.nav-toggle:hover {
  background: var(--color-bg-secondary);
  color: var(--color-text-primary);
}

/* Three bars drawn from one element: the middle is the box, the outer two
   are its pseudo-elements. */
.SLYstyles.nav-toggle__bars,
.SLYstyles.nav-toggle__bars::before,
.SLYstyles.nav-toggle__bars::after {
  display: block;
  width: 20px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
}

.SLYstyles.nav-toggle__bars {
  position: relative;
}

.SLYstyles.nav-toggle__bars::before,
.SLYstyles.nav-toggle__bars::after {
  content: "";
  position: absolute;
  left: 0;
}

.SLYstyles.nav-toggle__bars::before { top: -6px; }
.SLYstyles.nav-toggle__bars::after  { top: 6px; }

@media (max-width: 768px) {
  .SLYstyles.topbar__brand {
    display: block;
    /* No min-width:0 — a shrunk box lets the wordmark spill out from under
       its own bounds and collide with the points pill. */
    flex: 0 0 auto;
  }

  .SLYstyles.topbar__wordmark {
    white-space: nowrap;
    font-size: var(--text-lg);
  }

  .SLYstyles.topbar__user {
    display: none;
  }

  .SLYstyles.test-role-badge__name {
    display: none;
  }

  .SLYstyles.nav-toggle {
    display: inline-flex;
  }

  .SLYstyles.sidebar__close {
    display: inline-flex;
  }

  /* Four controls plus the brand do not fit 375px at desktop spacing.
     Tighten the gaps and drop the points pill's "pts" suffix — the coin
     and the number still read as a balance. */
  .SLYstyles.topbar__right {
    gap: var(--space-1);
  }

  .SLYstyles.topbar__icon-btn {
    padding: var(--space-2);
  }

  .SLYstyles.topbar__points-suffix {
    display: none;
  }
}

/* Below ~400px the wordmark, points pill, bell and theme toggle cannot all
   fit one 64px row. The wordmark is the one that is redundant — the drawer
   carries the brand, and the hamburger already anchors the left edge. */
@media (max-width: 400px) {
  .SLYstyles.topbar__brand {
    display: none;
  }
}

/* ============================================================
   Mobile bottom nav
   ============================================================ */
.SLYstyles.mobile-nav {
  padding: var(--space-1) var(--space-2);
}

.SLYstyles.mobile-nav__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--space-2) var(--space-1);
  text-decoration: none;
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  border-radius: var(--radius-md);
}

.SLYstyles.mobile-nav__item:hover {
  text-decoration: none;
}

.SLYstyles.mobile-nav__item--active {
  color: var(--color-brand-primary);
  font-weight: var(--weight-semibold);
}

.SLYstyles.mobile-nav__item--disabled {
  opacity: 0.4;
}

.SLYstyles.mobile-nav__icon {
  font-size: var(--text-lg);
}

/* ============================================================
   Stat cards
   ============================================================ */
.SLYstyles.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--space-3);
}

.SLYstyles.stat-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-4);
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--color-text-primary);
  transition: transform var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}

.SLYstyles.stat-card:hover {
  border-color: var(--color-brand-accent);
  transform: translateY(-2px);
  text-decoration: none;
}

.SLYstyles.stat-card__value {
  font-size: var(--text-3xl);
  font-weight: var(--weight-bold);
  color: var(--color-brand-primary);
  line-height: 1;
}

.SLYstyles.stat-card__label {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

/* ============================================================
   Bank tabs
   ============================================================ */
.SLYstyles.bank-tabs {
  display: flex;
  gap: var(--space-1);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-1);
  overflow-x: auto;
}

.SLYstyles.bank-tabs__tab {
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  white-space: nowrap;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}

.SLYstyles.bank-tabs__tab:hover {
  background: var(--color-bg-secondary);
  text-decoration: none;
}

.SLYstyles.bank-tabs__tab--active {
  background: var(--color-brand-primary);
  color: var(--color-text-inverse);
}

.SLYstyles.bank-tabs__tab--active:hover {
  background: var(--color-brand-secondary);
}

/* ============================================================
   Passage card
   ============================================================ */
.SLYstyles.passage-card {
  padding: var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg-secondary);
}

.SLYstyles.passage-card__ref {
  font-family: var(--font-serif);
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--color-brand-primary);
}

.SLYstyles.passage-card__meta {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 2px;
}

.SLYstyles.passage-card__memo {
  margin-top: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-left: 3px solid var(--color-brand-accent);
  background: var(--color-surface);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  font-style: italic;
}

/* ============================================================
   Passage form fields
   ============================================================ */
.SLYstyles.passage-fields {
  display: grid;
  gap: var(--space-3);
}

.SLYstyles.passage-fields__selectors {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
}

.SLYstyles.passage-fields__verses {
  display: grid;
  grid-template-columns: repeat(2, minmax(90px, 1fr));
  gap: var(--space-3);
}

.SLYstyles.passage-fields__feedback {
  margin: 0;
  color: var(--color-brand-primary);
  font-size: var(--text-sm);
}

.SLYstyles.passage-chapter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  gap: var(--space-2);
}

.SLYstyles.passage-chapter-box {
  min-height: 44px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text-primary);
  cursor: pointer;
}

.SLYstyles.passage-chapter-box:hover,
.SLYstyles.passage-chapter-box.is-selected {
  border-color: var(--color-brand-primary);
  color: var(--color-brand-primary);
}

@media (max-width: 640px) {
  .SLYstyles.passage-fields__selectors {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   Bible reader
   ============================================================ */
.SLYstyles.reader-controls {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: flex-end;
}

.SLYstyles.reader-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-2);
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border);
}

.SLYstyles.reader-theme-select {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background-color: var(--color-surface);
  color: var(--color-text-primary);
}

.SLYstyles.reader-theme-select option {
  background-color: var(--color-surface);
  color: var(--color-text-primary);
}

.SLYstyles.reader-select {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-base);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background-color: var(--color-surface);
  color: var(--color-text-primary);
  cursor: pointer;
}

.SLYstyles.reader-select option {
  background-color: var(--color-surface);
  color: var(--color-text-primary);
}

.SLYstyles.reader h1,
.SLYstyles.reader h2,
.SLYstyles.reader h3,
.SLYstyles.reader h4,
.SLYstyles.reader h5,
.SLYstyles.reader h6 {
  color: inherit;
}

.SLYstyles.reader {
  background: var(--reader-bg-default);
  color: var(--reader-text);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-8);
  font-family: var(--font-serif);
  font-size: var(--reader-font-size);
  line-height: var(--leading-relaxed);
  transition: background var(--t-base) var(--ease), color var(--t-base) var(--ease);
}

.SLYstyles.reader[data-reader-theme="sepia"] {
  background: var(--reader-bg-sepia);
  color: #5b4a2a;
}

.SLYstyles.reader[data-reader-theme="night"] {
  background: var(--reader-bg-night);
  color: #e6e6f0;
}

.SLYstyles.reader[data-reader-theme="forest"] {
  background: var(--reader-bg-forest);
  color: #d8e6d6;
}

.SLYstyles.reader[data-reader-theme="dusk"] {
  background: var(--reader-bg-dusk);
  color: #e0d8ff;
}

.SLYstyles.reader__header {
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid currentColor;
  opacity: 1;
}

.SLYstyles.reader__header>* {
  opacity: 1;
}

.SLYstyles.reader__title {
  font-size: var(--text-3xl);
  font-weight: var(--weight-bold);
  margin: 0;
}

.SLYstyles.reader__subtitle {
  font-size: var(--text-sm);
  opacity: 0.7;
  margin-top: var(--space-1);
  font-family: var(--font-sans);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.SLYstyles.reader__verses {
  list-style: none;
  padding: 0;
  margin: 0;
}

.SLYstyles.reader__verse {
  margin-bottom: var(--space-3);
  display: grid;
  grid-template-columns: 2.5em 1fr;
  gap: var(--space-2);
  align-items: baseline;
}

.SLYstyles.reader__verse-num {
  display: inline-block;
  text-align: right;
  font-family: var(--font-sans);
  font-size: 0.7em;
  font-weight: var(--weight-bold);
  color: currentColor;
  opacity: 0.5;
  text-decoration: none;
  cursor: pointer;
  padding-right: var(--space-2);
  border-right: 1px solid currentColor;
  user-select: none;
}

.SLYstyles.reader__verse-num:hover {
  opacity: 1;
  color: var(--color-brand-gold);
  text-decoration: none;
}

.SLYstyles.reader__verse-text {
  display: inline;
}

@media (max-width: 768px) {
  .SLYstyles.reader {
    padding: var(--space-5);
    /* Room for the bottom-docked chapter rails to float over instead of
       covering the chapter's last verses. */
    padding-bottom: calc(48px + var(--space-8));
  }

  .SLYstyles.reader__title {
    font-size: var(--text-2xl);
  }
}

/* --- Reader: picker triggers + Read ready-state ------------- */
.SLYstyles.reader-picker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  width: 100%;
  min-height: 44px;
  padding: 0 var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text-primary);
  font: inherit;
  cursor: pointer;
  text-align: left;
}

.SLYstyles.reader-picker:hover {
  border-color: var(--color-brand-accent);
}

/* Read button is gray until a control changes, then turns brand-green. */
.SLYstyles.reader-read-btn {
  background: var(--color-bg-secondary);
  color: var(--color-text-muted);
  border-color: var(--color-border);
  box-shadow: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.SLYstyles.reader-read-btn.is-ready {
  background: var(--color-brand-primary);
  color: var(--color-text-inverse);
  border-color: var(--color-brand-primary);
}

/* --- Reader: modals (native <dialog>) ---------------------- */
.SLYstyles.reader-modal {
  width: 80vw;
  max-width: 960px;
  max-height: 85vh;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--color-text-primary);
}

.SLYstyles.reader-modal--sm {
  width: min(94vw, 460px);
}

.SLYstyles.reader-modal::backdrop {
  background: rgba(0, 0, 0, 0.55);
}

.SLYstyles.reader-modal__frame {
  display: flex;
  flex-direction: column;
  max-height: 85vh;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.SLYstyles.reader-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-border);
}

/* Draggable modals: the header is the grab handle. The dialog itself is
   repositioned via JS (position:fixed + clamped left/top); the ::backdrop
   stays put and unaffected — only the box moves. */
.SLYstyles.reader-modal__head--draggable {
  cursor: grab;
  touch-action: none;
}

.SLYstyles.reader-modal__head--draggable:active {
  cursor: grabbing;
}

.SLYstyles.reader-modal.is-dragging {
  user-select: none;
}

.SLYstyles.reader-modal__tabs {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5) 0;
}

.SLYstyles.reader-modal__body {
  padding: var(--space-5);
  overflow-y: auto;
}

.SLYstyles.reader-modal__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--color-border);
}

.SLYstyles.reader-tab {
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--color-border);
  border-bottom: none;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  background: var(--color-bg-secondary);
  color: var(--color-text-secondary);
  font-weight: var(--weight-semibold);
  cursor: pointer;
}

.SLYstyles.reader-tab.is-active {
  background: var(--color-surface);
  color: var(--color-brand-primary);
}

/* Book + translation grids */
.SLYstyles.reader-book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: var(--space-2);
}

/* Both testament grids share one cell. The inactive grid stays in the
   layout so the dialog keeps the taller list's size when the tab changes.
   reset.css forces [hidden] to display:none, which would drop that height. */
.SLYstyles.reader-modal__body--books {
  display: grid;
}

.SLYstyles.reader-modal__body--books > .SLYstyles.reader-book-grid {
  grid-area: 1 / 1;
  /* Don't stretch the shorter list's buttons to fill the taller one. */
  align-content: start;
}

.SLYstyles.reader-modal__body--books > .SLYstyles.reader-book-grid[hidden] {
  display: grid !important;
  visibility: hidden;
  pointer-events: none;
}

.SLYstyles.reader-trans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-3);
}

.SLYstyles.reader-book-box,
.SLYstyles.reader-trans-box {
  min-height: 52px;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text-primary);
  font: inherit;
  font-weight: var(--weight-semibold);
  cursor: pointer;
  text-align: center;
}

.SLYstyles.reader-trans-box {
  text-align: left;
}

.SLYstyles.reader-book-box:hover,
.SLYstyles.reader-trans-box:hover {
  border-color: var(--color-brand-accent);
}

.SLYstyles.reader-book-box.is-selected,
.SLYstyles.reader-trans-box.is-selected {
  border-color: var(--color-brand-primary);
  background: color-mix(in srgb, var(--color-brand-primary) 12%, var(--color-surface));
  color: var(--color-brand-primary);
}

/* --- Reader: persistent bar on scroll --------------------- */
.SLYstyles.reader-stickybar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  margin: 0 calc(-1 * var(--space-1));
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  /* Hidden until the passage header scrolls out of view. */
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.SLYstyles.reader-stickybar.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.SLYstyles.reader-stickybar strong {
  font-size: var(--text-base);
}

.SLYstyles.reader-stickybar__meta {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

/* The whole strip is a button back to the top of the chapter. */
.SLYstyles.reader-stickybar {
  text-align: left;
}

.SLYstyles.reader-stickybar:hover {
  border-color: var(--color-brand-primary);
  box-shadow: var(--shadow-md);
}

/* The affordance: an up-arrow that sits quietly at the left until the
   cursor enters the bar, then brightens and unfurls its label. Space for
   the arrow is permanently reserved, so only the label animates — the
   chapter reference never jumps on hover. */
.SLYstyles.reader-stickybar__totop {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  align-self: center;
  /* bar aligns to baseline; the icon shouldn't */
  color: var(--color-text-muted);
  opacity: 0.45;
  transition: opacity var(--t-base) var(--ease), color var(--t-base) var(--ease);
}

.SLYstyles.reader-stickybar__totop svg {
  flex: 0 0 auto;
}

.SLYstyles.reader-stickybar__totop-label {
  max-width: 0;
  overflow: hidden;
  white-space: nowrap;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  transition: max-width var(--t-base) var(--ease);
}

.SLYstyles.reader-stickybar:hover .SLYstyles.reader-stickybar__totop,
.SLYstyles.reader-stickybar:focus-within .SLYstyles.reader-stickybar__totop {
  opacity: 1;
  color: var(--color-brand-primary);
}

.SLYstyles.reader-stickybar:hover .SLYstyles.reader-stickybar__totop-label,
.SLYstyles.reader-stickybar:focus-within .SLYstyles.reader-stickybar__totop-label {
  max-width: 8rem;
}

/* Touch devices have no hover to reveal the hint, so keep it legible. */
@media (hover: none) {
  .SLYstyles.reader-stickybar__totop {
    opacity: 0.7;
  }
}

@media (prefers-reduced-motion: reduce) {

  .SLYstyles.reader-stickybar,
  .SLYstyles.reader-stickybar__totop,
  .SLYstyles.reader-stickybar__totop-label {
    transition: none;
  }
}

/* --- Reader: floating prev/next chapter rails --------------- */
/* position:fixed so they ride the viewport as the reader scrolls. The
   left offset clears the sidebar; below the tablet breakpoint the
   sidebar is gone, so they tuck against the screen edge instead. */
.SLYstyles.reader-chapternav__btn {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 4;
  /* under the sticky bar (5) */
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  /* 44px = comfortable touch target */
  height: 44px;
  padding: 0;
  border-radius: var(--radius-full, 999px);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  color: var(--color-text-secondary);
  /* Resting state: a faint ghost. Never fully invisible — a control you
     can only find by hovering blind isn't discoverable, and this also
     keeps them usable if the proximity script never runs. */
  opacity: 0.15;
  transition: opacity var(--t-base) var(--ease),
    color var(--t-base) var(--ease),
    border-color var(--t-base) var(--ease),
    box-shadow var(--t-base) var(--ease);
}

.SLYstyles.reader-chapternav__btn--prev {
  left: calc(var(--sidebar-width) + var(--space-4));
}

.SLYstyles.reader-chapternav__btn--next {
  right: var(--space-4);
}

/* Cursor is within range — JS adds .is-near. */
.SLYstyles.reader-chapternav__btn.is-near {
  opacity: 0.85;
}

.SLYstyles.reader-chapternav__btn:hover,
.SLYstyles.reader-chapternav__btn:focus-visible {
  opacity: 1;
  color: var(--color-brand-primary);
  border-color: var(--color-brand-primary);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}

/* No cursor to be near on touch, so leave them permanently legible. */
@media (hover: none) {
  .SLYstyles.reader-chapternav__btn {
    opacity: 0.7;
  }
}

@media (max-width: 768px) {
  /* On a phone there are no empty margins to sit in — vertically centred
     rails land squarely on top of the verse you are reading, and they are
     permanently 0.7 opacity on touch (no cursor to approach). Dock them at
     the bottom instead: clear of the text, clear of the bottom nav, and in
     the thumb's natural arc for page-turning. */
  .SLYstyles.reader-chapternav__btn {
    top: auto;
    bottom: calc(var(--mobile-nav-height) + var(--space-3) + env(safe-area-inset-bottom));
    transform: none;
    width: 48px;
    height: 48px;
    opacity: 0.92;
    background: var(--color-surface);
    box-shadow: var(--shadow-md);
  }

  .SLYstyles.reader-chapternav__btn--prev {
    left: max(var(--space-3), env(safe-area-inset-left));
  }

  .SLYstyles.reader-chapternav__btn--next {
    right: max(var(--space-3), env(safe-area-inset-right));
  }
}

@media (prefers-reduced-motion: reduce) {
  .SLYstyles.reader-chapternav__btn {
    transition: none;
  }
}

/* --- Reader: clickable verses + action accordion ---------- */
.SLYstyles.reader__colhead {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  padding: 0 var(--space-1) var(--space-2);
  margin-bottom: var(--space-2);
  border-bottom: 1px solid currentColor;
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.6;
}

.SLYstyles.reader__colhead span {
  padding-left: calc(2.5em + var(--space-2));
}

.SLYstyles.reader__vrow {
  margin-bottom: var(--space-1);
}

.SLYstyles.reader__verses[data-cols="2"] .SLYstyles.reader__vrow {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  align-items: start;
}

.SLYstyles.reader__vcell {
  min-width: 0;
}

.SLYstyles.reader__vline {
  display: grid;
  grid-template-columns: 2.5em 1fr;
  gap: var(--space-2);
  width: 100%;
  align-items: baseline;
  padding: var(--space-1);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.SLYstyles.reader__vline:hover,
.SLYstyles.reader__vline[aria-expanded="true"] {
  background: color-mix(in srgb, currentColor 8%, transparent);
}

.SLYstyles.reader__vnum {
  text-align: right;
  font-family: var(--font-sans);
  font-size: 0.7em;
  font-weight: var(--weight-bold);
  opacity: 0.5;
  padding-right: var(--space-2);
  border-right: 1px solid currentColor;
  user-select: none;
}

.SLYstyles.reader__vtext {
  display: block;
}

/* Per-version tag — hidden on desktop (column header covers it),
   shown when the two versions stack on small screens. */
.SLYstyles.reader__vtag {
  display: none;
}

.SLYstyles.reader__vactions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: var(--space-2) 0 var(--space-3) 2.5em;
  padding: var(--space-2);
  border-radius: var(--radius-md);
  /* Break out of the reader theme so the buttons read normally. */
  background: var(--color-surface);
  color: var(--color-text-primary);
  border: 1px solid var(--color-border);
  width: fit-content;
}

/* Compact bordered icon buttons; the native title shows what each does. */
.SLYstyles.reader__vaction {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0 var(--space-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text-primary);
  font-size: var(--text-base);
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
}

.SLYstyles.reader__vaction:hover {
  border-color: var(--color-brand-primary);
  color: var(--color-brand-primary);
}

/* Quick note: the passage being annotated, shown above the field so the
   writer can see what they are responding to. Same treatment as the copy
   range preview, with the quote rule a blockquote earns. */
.SLYstyles.reader-note-quote {
  max-height: 160px;
  overflow-y: auto;
  margin: 0;
  padding: var(--space-2) var(--space-3);
  border-left: 3px solid var(--color-brand-primary);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  background: var(--color-bg-secondary);
  color: var(--color-text-secondary);
  font-family: var(--font-serif);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
}

.SLYstyles.reader-note-quote:empty {
  display: none;
}

.SLYstyles.reader-range-preview {
  max-height: 180px;
  overflow-y: auto;
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg-secondary);
  color: var(--color-text-secondary);
  font-family: var(--font-serif);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
}

@media (max-width: 768px) {
  .SLYstyles.reader-modal {
    width: 94vw;
    /* dvh so the picker is not cut off by the mobile URL bar. */
    max-height: 85dvh;
  }

  .SLYstyles.reader-modal__frame {
    max-height: 85dvh;
  }

  /* The reader's four controls (translation / book / chapter / Read) wrapped
     into a ragged four-row stack at phone widths. Lay them out deliberately:
     translation and book full width, chapter and Read sharing the last row. */
  .SLYstyles.reader-controls {
    display: grid;
    grid-template-columns: 100px minmax(0, 1fr);
    gap: var(--space-3);
    align-items: end;
  }

  .SLYstyles.reader-controls > label {
    min-width: 0 !important;
    width: auto !important;
  }

  .SLYstyles.reader-controls > label:nth-of-type(1),
  .SLYstyles.reader-controls > label:nth-of-type(2) {
    grid-column: 1 / -1;
  }

  .SLYstyles.reader-read-btn {
    width: 100%;
  }

  /* The sticky bar is one line of book + translation on a 375px screen. */
  .SLYstyles.reader-stickybar {
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
  }

  .SLYstyles.reader-stickybar__meta {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
  }

  /* Verse action buttons were 38px — below the comfortable touch minimum,
     and they are the reader's primary interaction. */
  .SLYstyles.reader__vaction {
    min-width: 44px;
    height: 44px;
  }

  .SLYstyles.reader__vactions {
    /* A fit-content row of 44px buttons overflows the verse column; let it
       fill the width and wrap instead. */
    width: auto;
    margin-left: 0;
  }

  /* Stack the two versions; the column header no longer aligns. */
  .SLYstyles.reader__verses[data-cols="2"] .SLYstyles.reader__vrow {
    grid-template-columns: 1fr;
    gap: var(--space-2);
  }

  .SLYstyles.reader__colhead {
    display: none;
  }

  .SLYstyles.reader__vtag {
    display: block;
    margin-left: 2.5em;
    font-family: var(--font-sans);
    font-size: var(--text-xs);
    font-weight: var(--weight-bold);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    opacity: 0.6;
  }
}

/* ============================================================
   Dwelling — Phase 7
   ============================================================ */

/* --- Stats strip -------------------------------------------- */
.SLYstyles.dwelling-stats {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.SLYstyles.dwelling-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-6);
  flex: 1;
  min-width: 80px;
  box-shadow: var(--shadow-sm);
}

.SLYstyles.dwelling-stat__num {
  font-size: var(--text-3xl);
  font-weight: var(--weight-bold);
  line-height: 1;
  color: var(--color-text);
}

.SLYstyles.dwelling-stat__label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: var(--space-1);
  text-align: center;
}

/* --- Mood progress stepper ---------------------------------- */
.SLYstyles.mood-progress {
  display: flex;
  align-items: center;
  gap: 0;
}

.SLYstyles.mood-progress__step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-bg-subtle);
  border: 2px solid var(--color-border);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.SLYstyles.mood-progress__step--active {
  background: var(--color-brand-primary);
  border-color: var(--color-brand-primary);
  color: var(--color-text-inverse);
}

.SLYstyles.mood-progress__step--done {
  background: var(--color-success);
  border-color: var(--color-success);
  color: var(--color-text-inverse);
}

.SLYstyles.mood-progress__line {
  flex: 1;
  height: 2px;
  background: var(--color-border);
  min-width: 24px;
}

.SLYstyles.mood-progress__line--done {
  background: var(--color-success);
}

/* --- Mood category buttons (Step 1) ------------------------- */
.SLYstyles.mood-categories {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.SLYstyles.mood-cat-btn {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-6);
  border-radius: var(--radius-md);
  border: 2px solid var(--color-border);
  background: var(--color-surface);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
  width: 100%;
}

.SLYstyles.mood-cat-btn:hover,
.SLYstyles.mood-cat-btn:focus {
  border-color: var(--color-brand-primary);
  background: var(--color-bg-subtle);
  outline: none;
}

.SLYstyles.mood-cat-btn--positive:hover {
  border-color: var(--color-success);
}

.SLYstyles.mood-cat-btn--neutral:hover {
  border-color: var(--color-warning, #e6a817);
}

.SLYstyles.mood-cat-btn--negative:hover {
  border-color: var(--color-error);
}

.SLYstyles.mood-cat-btn__icon {
  font-size: var(--text-2xl);
  flex-shrink: 0;
}

.SLYstyles.mood-cat-btn__label {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--color-text);
}

.SLYstyles.mood-cat-btn__sub {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-top: 2px;
}

/* stack label + sub */
.SLYstyles.mood-cat-btn>span:not(.SLYstyles.mood-cat-btn__icon) {
  display: block;
}

/* --- Mood feeling buttons (Steps 2 & 3) --------------------- */
.SLYstyles.mood-feelings {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.SLYstyles.mood-feeling-btn {
  padding: var(--space-2) var(--space-5);
  border-radius: var(--radius-full, 9999px);
  border: 2px solid var(--color-border);
  background: var(--color-surface);
  font-size: var(--text-base);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  color: var(--color-text);
}

.SLYstyles.mood-feeling-btn:hover,
.SLYstyles.mood-feeling-btn:focus {
  border-color: var(--color-brand-primary);
  background: var(--color-brand-primary);
  color: var(--color-text-inverse);
  outline: none;
}

@media (max-width: 600px) {
  .SLYstyles.dwelling-stats {
    gap: var(--space-2);
  }

  .SLYstyles.dwelling-stat {
    padding: var(--space-3) var(--space-4);
    min-width: 70px;
  }

  .SLYstyles.mood-cat-btn {
    padding: var(--space-4);
  }
}

/* ============================================================
   Notes — Phase 8
   ============================================================ */

/* --- Generic form fields (also reusable elsewhere) ---------- */
.SLYstyles.field-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

.SLYstyles.field-input {
  display: block;
  width: 100%;
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--text-base);
  font-family: inherit;
  line-height: 1.5;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.SLYstyles.field-input:focus {
  outline: none;
  border-color: var(--color-brand-primary);
  box-shadow: 0 0 0 3px var(--color-brand-primary-subtle, rgba(0, 0, 0, 0.08));
}

/* --- Small button variant ----------------------------------- */
.SLYstyles.btn--sm {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
}

/* --- Note cards --------------------------------------------- */
.SLYstyles.note-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.SLYstyles.note-card__ref {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-accent);
  letter-spacing: 0.02em;
  margin: 0;
}

.SLYstyles.note-card__preview {
  font-size: var(--text-base);
  color: var(--color-text);
  margin: 0;
  line-height: 1.55;
  word-break: break-word;
  white-space: pre-wrap;
}

.SLYstyles.note-card__foot {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding-top: var(--space-2);
  border-top: 1px solid var(--color-border);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* ============================================================
   Notifications — Phase 9
   ============================================================ */

/* --- Bell icon + unread badge in topbar --------------------- */
.SLYstyles.notif-bell {
  position: relative;
  font-size: var(--text-lg);
  padding: var(--space-2) var(--space-3);
  text-decoration: none;
}

.SLYstyles.notif-bell__badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9999px;
  background: var(--color-error);
  color: var(--color-text-inverse);
  font-size: 10px;
  font-weight: var(--weight-bold);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-shadow: 0 0 0 2px var(--color-surface);
}

.SLYstyles.notif-bell__badge[hidden] {
  display: none;
}

/* --- Notification list rows -------------------------------- */
.SLYstyles.notif-row {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  padding: var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  list-style: none;
}

.SLYstyles.notif-row--unread {
  background: var(--color-bg-subtle, var(--color-surface));
  border-left: 3px solid var(--color-brand-primary);
}

.SLYstyles.notif-row__icon {
  font-size: var(--text-xl);
  flex-shrink: 0;
  line-height: 1;
  margin-top: 2px;
}

.SLYstyles.notif-row__body {
  flex: 1;
  min-width: 0;
}

.SLYstyles.notif-row__msg {
  font-size: var(--text-base);
  margin: 0;
  color: var(--color-text);
  word-break: break-word;
}

.SLYstyles.notif-row__meta {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin: var(--space-1) 0 0 0;
  font-family: var(--font-mono, monospace);
}

.SLYstyles.notif-row__actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  flex-shrink: 0;
}

@media (max-width: 600px) {
  .SLYstyles.notif-row {
    flex-wrap: wrap;
  }

  .SLYstyles.notif-row__actions {
    flex-direction: row;
    width: 100%;
    margin-top: var(--space-2);
  }
}

/* ============================================================
   Admin — Phase 10
   ============================================================ */

/* --- Tab strip --------------------------------------------- */
.SLYstyles.admin-tabs {
  display: flex;
  gap: var(--space-1);
  border-bottom: 1px solid var(--color-border);
  margin-top: var(--space-3);
  flex-wrap: wrap;
}

.SLYstyles.admin-tabs__link {
  padding: var(--space-3) var(--space-4);
  color: var(--color-text-muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  font-weight: var(--weight-semibold);
  font-size: var(--text-sm);
  transition: color 0.15s, border-color 0.15s;
}

.SLYstyles.admin-tabs__link:hover {
  color: var(--color-text);
}

.SLYstyles.admin-tabs__link--active {
  color: var(--color-brand-primary);
  border-bottom-color: var(--color-brand-primary);
}

/* --- Stat grid --------------------------------------------- */
.SLYstyles.admin-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--space-3);
}

.SLYstyles.admin-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-5);
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, transform 0.1s;
}

a.SLYstyles.admin-stat:hover {
  border-color: var(--color-brand-primary);
  transform: translateY(-1px);
}

.SLYstyles.admin-stat__num {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  color: var(--color-text);
  line-height: 1.1;
}

.SLYstyles.admin-stat__label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: var(--space-1);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* --- Admin tables ------------------------------------------ */
.SLYstyles.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.SLYstyles.admin-table thead th {
  text-align: left;
  font-weight: var(--weight-semibold);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  padding: var(--space-3);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg-subtle, transparent);
}

.SLYstyles.admin-table tbody td {
  padding: var(--space-3);
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

.SLYstyles.admin-table tbody tr:last-child td {
  border-bottom: none;
}

.SLYstyles.admin-table code {
  font-size: var(--text-xs);
  background: var(--color-bg-subtle, transparent);
  padding: 1px 5px;
  border-radius: var(--radius-sm, 4px);
}

/* --- Role pills -------------------------------------------- */
.SLYstyles.role-pill {
  display: inline-block;
  padding: 2px var(--space-2);
  border-radius: 9999px;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--color-bg-subtle, var(--color-surface));
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.SLYstyles.role-pill--free {
  color: var(--color-text-muted);
}

.SLYstyles.role-pill--plus {
  background: #dbeafe;
  color: #1e3a8a;
  border-color: #93c5fd;
}

.SLYstyles.role-pill--premium {
  background: #fef3c7;
  color: #78350f;
  border-color: #fcd34d;
}

.SLYstyles.role-pill--admin {
  background: #fee2e2;
  color: #7f1d1d;
  border-color: #fca5a5;
}

.SLYstyles.role-pill--superadmin {
  background: #312e81;
  color: #fff;
  border-color: #312e81;
}

:is([data-theme="dark"], [data-theme$="-dark"]) .SLYstyles.role-pill--plus {
  background: #1e3a8a;
  color: #dbeafe;
}

:is([data-theme="dark"], [data-theme$="-dark"]) .SLYstyles.role-pill--premium {
  background: #78350f;
  color: #fef3c7;
}

:is([data-theme="dark"], [data-theme$="-dark"]) .SLYstyles.role-pill--admin {
  background: #7f1d1d;
  color: #fee2e2;
}

/* --- Role rows --------------------------------------------- */
.SLYstyles.role-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

/* --- Config rows ------------------------------------------- */
.SLYstyles.config-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.SLYstyles.config-state {
  display: inline-block;
  padding: 2px var(--space-2);
  border-radius: 9999px;
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.SLYstyles.config-state--on {
  background: var(--color-success);
  color: var(--color-text-inverse);
}

.SLYstyles.config-state--off {
  background: var(--color-text-muted);
  color: var(--color-surface);
  opacity: 0.7;
}

.SLYstyles.config-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 0;
  padding: var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}

.SLYstyles.config-boxes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: var(--space-3);
  align-items: stretch;
}

.SLYstyles.config-box {
  min-width: 0;
  margin: 0;
  padding: var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.SLYstyles.config-box--master {
  border-top: 3px solid var(--color-brand-primary);
}

.SLYstyles.config-box__title {
  margin: 0;
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--color-heading);
}

.SLYstyles.config-box__hint {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.SLYstyles.config-box select {
  width: 100%;
  margin-top: var(--space-1);
}

.SLYstyles.config-savebar {
  position: sticky;
  bottom: var(--space-3);
  z-index: 4;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface-raised, var(--color-surface));
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.SLYstyles.config-savebar[hidden] { display: none; }

/* Visitor pages have neither the member sidebar nor the mobile bottom nav.
   Keep fixed reader arrows symmetric without changing member positioning. */
.SLYstyles.visitor-layout { --sidebar-width: 0px; --mobile-nav-height: 0px; }
.SLYstyles.visitor-header {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: var(--space-4); padding: var(--space-4);
  border-bottom: 1px solid var(--color-border);
}
.SLYstyles.visitor-header nav { flex-wrap: wrap; gap: var(--space-4); }
.SLYstyles.visitor-main { max-width: 1280px; margin: auto; padding: clamp(12px, 3vw, 32px); }
.SLYstyles.visitor-footer { text-align: center; padding: var(--space-6); color: var(--color-text-muted); }
.SLYstyles.niceverse-shared { max-width: 850px; margin: auto; }
.SLYstyles.niceverse-shared canvas { display: block; max-width: 100%; max-height: 75vh; width: auto; height: auto; margin: auto; }
.SLYstyles.niceverse-shared canvas[hidden], [data-nv-deposit][hidden] { display: none; }
.SLYstyles.reader__vrow.is-shared-passage { background: var(--color-surface-raised, #edf5ee); border-left: 3px solid var(--color-brand-primary); }

.SLYstyles.dwell-offers {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-4);
}

@media (max-width: 600px) {
  .SLYstyles.admin-table {
    font-size: var(--text-xs);
  }

  .SLYstyles.admin-table thead th,
  .SLYstyles.admin-table tbody td {
    padding: var(--space-2);
  }
}

/* ============================================================
   Nice Verse — image generator
   ============================================================ */
.SLYstyles.niceverse {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: var(--space-6);
  align-items: start;
}

.SLYstyles.niceverse__stage {
  background: var(--color-bg-subtle, #eee);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 480px;
  overflow: hidden;
}

.SLYstyles.niceverse__stage canvas {
  width: 100%;
  height: auto;
  max-height: 70vh;
  background: #fff;
  border-radius: var(--radius-sm, 6px);
  box-shadow: var(--shadow-sm);
  display: block;
  object-fit: contain;
}

.SLYstyles.niceverse__controls {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  /* tabs · body · footer */
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  position: sticky;
  top: var(--space-4);
  max-height: calc(100vh - var(--space-8));
  overflow: hidden;
}

/* Top-level tab strip */
.SLYstyles.nv-tabs {
  display: flex;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg-subtle, #f9fafb);
  padding: var(--space-1);
  gap: 2px;
  border-top-left-radius: var(--radius-md);
  border-top-right-radius: var(--radius-md);
}

.SLYstyles.nv-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--space-2) var(--space-1);
  border: 1px solid transparent;
  background: transparent;
  border-radius: var(--radius-sm, 6px);
  cursor: pointer;
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.SLYstyles.nv-tab:hover {
  background: var(--color-surface);
  color: var(--color-text);
}

.SLYstyles.nv-tab--active {
  background: var(--color-surface);
  border-color: var(--color-border);
  color: var(--color-brand-primary);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.SLYstyles.nv-tab__icon {
  font-size: var(--text-base);
  line-height: 1;
}

.SLYstyles.nv-tab__label {
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Scrollable body that hosts the active panel */
.SLYstyles.nv-tab-body {
  overflow-y: auto;
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
}

.SLYstyles.nv-tab-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* Sticky footer with save + share */
.SLYstyles.nv-controls-footer {
  border-top: 1px solid var(--color-border);
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  border-bottom-left-radius: var(--radius-md);
  border-bottom-right-radius: var(--radius-md);
}

.SLYstyles.nv-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.SLYstyles.nv-sep {
  border: 0;
  border-top: 1px solid var(--color-border);
  margin: 0;
}

/* Position row: text on the left, 9-zone grid on the right */
.SLYstyles.nv-position-row {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

/* Reusable disclosure styling */
.SLYstyles.nv-details {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg-subtle, #f9fafb);
  overflow: hidden;
}

.SLYstyles.nv-details>summary {
  list-style: none;
  cursor: pointer;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-text-secondary, var(--color-text));
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.SLYstyles.nv-details>summary::-webkit-details-marker {
  display: none;
}

.SLYstyles.nv-details>summary::after {
  content: '▾';
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  margin-left: var(--space-2);
  transition: transform 0.15s;
}

.SLYstyles.nv-details[open]>summary::after {
  transform: rotate(180deg);
}

.SLYstyles.nv-details>*:not(summary) {
  padding: var(--space-3);
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
}

/* Segmented button group */
.SLYstyles.nv-segments {
  display: flex;
  gap: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.SLYstyles.nv-segment {
  flex: 1;
  padding: var(--space-2) var(--space-2);
  background: var(--color-surface);
  border: none;
  border-right: 1px solid var(--color-border);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-text);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.SLYstyles.nv-segment:last-child {
  border-right: none;
}

.SLYstyles.nv-segment:hover {
  background: var(--color-bg-subtle, #f3f4f6);
}

.SLYstyles.nv-segment.nv-segment--active,
.SLYstyles .nv-segment--active {
  background: var(--color-brand-primary);
  color: var(--color-text-inverse);
}

/* Stage frame to keep canvas centered + give a backdrop */
.SLYstyles.nv-stage-frame {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.SLYstyles.nv-stage-hint {
  margin-top: var(--space-3);
  text-align: center;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* Locked reference badge */
.SLYstyles.nv-locked-ref {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3);
  background: var(--color-bg-subtle, #f3f4f6);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
}

/* Reference range row */
.SLYstyles.nv-range-row {
  display: flex;
  gap: var(--space-2);
  align-items: stretch;
}

/* Read-only verse text display */
.SLYstyles.nv-text-display {
  padding: var(--space-3);
  background: var(--color-bg-subtle, #f3f4f6);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  line-height: 1.55;
  max-height: 180px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* 9-zone position grid */
.SLYstyles.nv-zone-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  width: 96px;
  height: 96px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 4px;
  background: var(--color-bg-subtle, #f3f4f6);
}

.SLYstyles.nv-zone {
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  border-radius: 4px;
  cursor: pointer;
  padding: 0;
  transition: background 0.15s, border-color 0.15s;
}

.SLYstyles.nv-zone:hover {
  background: var(--color-brand-primary);
  opacity: 0.6;
}

.SLYstyles.nv-zone--active {
  background: var(--color-brand-primary);
  border-color: var(--color-brand-primary);
}

/* 12 gradient swatches */
.SLYstyles.nv-grad-swatches {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  margin-top: var(--space-2);
}

.SLYstyles.nv-grad-swatch {
  height: 32px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm, 6px);
  cursor: pointer;
  padding: 0;
  transition: transform 0.1s, box-shadow 0.1s;
}

.SLYstyles.nv-grad-swatch:hover {
  transform: scale(1.06);
  box-shadow: 0 0 0 2px var(--color-brand-primary);
}

/* Soft-solid HSL picker */
.SLYstyles.nv-soft-picker {
  display: grid;
  grid-template-columns: 1fr 1fr 32px;
  gap: var(--space-2);
  align-items: center;
  margin-top: var(--space-2);
}

.SLYstyles.nv-soft-picker input[type="range"] {
  width: 100%;
}

.SLYstyles.nv-soft-preview {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  display: inline-block;
}

/* Font picker — tabs + previewed rows */
.SLYstyles.nv-font-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: var(--space-2);
  max-height: 240px;
  overflow-y: auto;
  padding: 2px;
}

.SLYstyles.nv-font-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1.2;
  text-align: left;
  color: var(--color-text);
  transition: border-color 0.15s, background 0.15s;
}

.SLYstyles.nv-font-row:hover {
  border-color: var(--color-brand-primary);
  background: var(--color-bg-subtle, #f3f4f6);
}

.SLYstyles.nv-font-row--active {
  border-color: var(--color-brand-primary);
  background: var(--color-brand-primary);
  color: var(--color-text-inverse);
}

.SLYstyles.nv-font-tag {
  font-size: 10px;
  font-family: -apple-system, system-ui, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: 9999px;
  background: var(--color-bg-subtle, #f3f4f6);
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.SLYstyles.nv-font-row--active .SLYstyles.nv-font-tag,
.SLYstyles.nv-font-row--active .nv-font-tag {
  background: color-mix(in srgb, var(--color-text-inverse) 20%, transparent);
  color: var(--color-text-inverse);
}

/* Background image gallery */
.SLYstyles.nv-bg-gallery {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: var(--space-2);
  max-height: 280px;
  overflow-y: auto;
  padding: 2px;
}

.SLYstyles.nv-bg-thumb {
  aspect-ratio: 1 / 1;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm, 6px);
  cursor: pointer;
  padding: 0;
  background-size: cover;
  background-position: center;
  transition: transform 0.1s, border-color 0.15s;
}

.SLYstyles.nv-bg-thumb:hover {
  transform: scale(1.04);
}

.SLYstyles.nv-bg-thumb--active {
  border-color: var(--color-brand-primary);
  box-shadow: 0 0 0 2px var(--color-brand-primary);
}

/* Saved-designs list grid */
.SLYstyles.nv-saved-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-3);
}

.SLYstyles.nv-saved-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.SLYstyles.nv-saved-card__ref {
  font-weight: var(--weight-bold);
}

.SLYstyles.nv-saved-card__trans {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.SLYstyles.nv-saved-card__preview {
  font-size: var(--text-sm);
  color: var(--color-text-secondary, var(--color-text));
  line-height: 1.5;
  margin: 0;
}

.SLYstyles.nv-saved-card__foot {
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* Share popover (inside the sticky footer) */
.SLYstyles.nv-share-panel {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: var(--space-2);
  padding: var(--space-3);
  background: var(--color-bg-subtle, #f9fafb);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.SLYstyles.nv-share-panel button {
  text-align: left;
  justify-content: flex-start;
}

@media (max-width: 900px) {
  .SLYstyles.niceverse {
    grid-template-columns: 1fr;
  }

  .SLYstyles.niceverse__controls {
    position: static;
  }

  .SLYstyles.nv-grad-swatches {
    grid-template-columns: repeat(4, 1fr);
  }

  .SLYstyles.nv-bg-gallery {
    grid-template-columns: repeat(3, 1fr);
  }
}
/* --- Admin: check-in option forms ---------------------------
   Were inline grids whose fixed minimums (330px and 390px of columns
   before gaps) overflowed any phone. Fluid columns that stack instead. */
.SLYstyles.option-form {
  display: grid;
  grid-template-columns: minmax(180px, 2fr) minmax(150px, 1fr) auto;
  gap: var(--space-3);
  align-items: end;
}

.SLYstyles.option-form--row {
  grid-template-columns: minmax(160px, 2fr) minmax(140px, 1fr) 90px auto auto;
  gap: var(--space-2);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border);
}

@media (max-width: 768px) {

  .SLYstyles.option-form,
  .SLYstyles.option-form--row {
    grid-template-columns: minmax(0, 1fr);
  }

  /* The two trailing buttons share the last row rather than each taking a
     full-width line. */
  .SLYstyles.option-form--row button {
    grid-column: auto;
  }
}

/* ============================================================
   Mobile / touch conventions
   Cross-cutting rules that make every screen usable on a phone or
   tablet. Kept together at the end so the per-component sections
   above stay about their component.
   ============================================================ */

/* --- Horizontal-scroll wrapper for wide content -------------
   Tables, wide grids and code blocks must scroll inside their own box.
   The page body must never scroll sideways. Several admin tables sat in
   cards with `overflow: hidden`, which silently *clipped* the right-hand
   columns on a phone — the data was unreachable, not just off-screen. */
.SLYstyles.table-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

/* Below the wrapper's width the table stops collapsing and scrolls, so
   columns keep readable widths instead of crushing to one word per line. */
.SLYstyles.table-scroll > table {
  min-width: 640px;
}

/* --- Touch targets ------------------------------------------ */
@media (max-width: 768px) {
  /* Drawer rows: 36px at desktop density is tight for a thumb. */
  .SLYstyles.sidebar__link {
    min-height: 44px;
    padding: var(--space-3);
    font-size: var(--text-base);
  }

  .SLYstyles.mobile-nav__item {
    min-height: 44px;
  }

  .SLYstyles.btn {
    min-height: 44px;
  }

  .SLYstyles.btn--sm {
    min-height: 38px;
  }

  .SLYstyles.admin-tabs__link,
  .SLYstyles.bank-tabs__tab {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
}

/* --- Form controls: stop iOS auto-zoom ----------------------
   Mobile Safari zooms the whole page when a focused field's text is under
   16px. Several controls here are --text-sm (14px), so tapping them
   yanked the layout sideways and left it zoomed. Coarse-pointer only, so
   desktop keeps its denser type. */
@media (pointer: coarse) {

  input,
  select,
  textarea,
  .SLYstyles.field-input,
  .SLYstyles.reader-select,
  .SLYstyles.reader-theme-select {
    font-size: max(16px, 1em);
  }

  /* Native controls need real height to be tappable. */
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
  select,
  .SLYstyles.field-input {
    min-height: 44px;
  }
}

/* --- Long unbroken strings ----------------------------------
   Emails, URLs and passage references are the usual culprits behind a
   page that scrolls sideways on a 375px screen. */
@media (max-width: 768px) {

  .SLYstyles.card,
  .SLYstyles.notif-row__msg,
  .SLYstyles.note-card__preview,
  .SLYstyles.passage-card {
    overflow-wrap: break-word;
  }
}

/* --- Tap feedback -------------------------------------------
   Remove the grey iOS flash on our own controls; :hover/:active already
   carry the affordance. */
.SLYstyles.btn,
.SLYstyles.sidebar__link,
.SLYstyles.mobile-nav__item,
.SLYstyles.bank-tabs__tab,
.SLYstyles.stat-card,
.SLYstyles.nav-toggle,
.SLYstyles.sidebar__close {
  -webkit-tap-highlight-color: transparent;
}

/* ============================================================
   Bible reference search — page control, result grid, anchor flash
   ============================================================ */
/* Search lives in the middle of the reader toolbar — the gap between the
   chapter links and the display controls — so it grows into whatever space
   that row has left. */
.SLYstyles.reader-search {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex: 1 1 280px;
  min-width: 220px;
}

.SLYstyles.reader-search__field {
  position: relative;
  flex: 1;
  min-width: 0;
}

.SLYstyles.reader-search__icon {
  position: absolute;
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  pointer-events: none;
}

.SLYstyles.reader-search__input {
  width: 100%;
  min-height: 40px;
  padding: 0 var(--space-3) 0 calc(var(--space-3) + 22px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill, 999px);
  background: var(--color-bg-secondary);
  color: var(--color-text-primary);
  font: inherit;
  font-size: var(--text-sm);
  text-overflow: ellipsis;
}

.SLYstyles.reader-search__input:hover {
  border-color: var(--color-brand-accent);
}

.SLYstyles.reader-search__input:focus {
  outline: none;
  border-color: var(--color-brand-primary);
  background: var(--color-surface);
}

.SLYstyles.reader-search__field:focus-within .SLYstyles.reader-search__icon {
  color: var(--color-brand-primary);
}

/* Screen-reader-only helper text. */
.SLYstyles.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* --- Sticky bar: strip + its own search button ------------- */
.SLYstyles.reader-stickybar__main {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  flex: 1;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.SLYstyles.reader-stickybar__search {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  align-self: center;
  flex: 0 0 auto;
  min-height: 32px;
  padding: 0 var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill, 999px);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  font: inherit;
  font-size: var(--text-sm);
  cursor: pointer;
}

.SLYstyles.reader-stickybar__search:hover,
.SLYstyles.reader-stickybar__search:focus-visible {
  border-color: var(--color-brand-primary);
  color: var(--color-brand-primary);
}

/* --- Search modal: query form ------------------------------ */
.SLYstyles.bible-search-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.SLYstyles.bible-search-form__label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.SLYstyles.bible-search-form__input {
  flex: 1;
  min-width: 200px;
  min-height: 44px;
  padding: 0 var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text-primary);
  font: inherit;
}

.SLYstyles.bible-search-form__input:focus {
  outline: none;
  border-color: var(--color-brand-primary);
}

.SLYstyles.bible-search-summary {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.SLYstyles.bible-search-status {
  font-size: var(--text-sm);
  color: var(--color-brand-primary);
}

/* --- Search modal: results -------------------------------- */
.SLYstyles.bible-search-group__title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  margin: 0 0 var(--space-2);
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
}

.SLYstyles.bible-search-group__note {
  text-transform: none;
  letter-spacing: 0;
  font-weight: normal;
}

/* One tap per result: every card is the link to that passage. */
.SLYstyles.bible-search-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: var(--space-2);
}

.SLYstyles.bible-search-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 56px;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text-primary);
  text-decoration: none;
  justify-content: center;
}

.SLYstyles.bible-search-card:hover,
.SLYstyles.bible-search-card:focus-visible {
  border-color: var(--color-brand-accent);
  text-decoration: none;
}

.SLYstyles.bible-search-card.is-primary {
  border-color: var(--color-brand-primary);
  background: color-mix(in srgb, var(--color-brand-primary) 12%, var(--color-surface));
}

/* The card Enter opens. Keyboard-only: the cursor never moves it. */
.SLYstyles.bible-search-card.is-active {
  border-color: var(--color-brand-accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-brand-accent) 55%, transparent);
}

.SLYstyles.bible-search-card__ref {
  font-weight: var(--weight-semibold);
  overflow-wrap: break-word;
}

.SLYstyles.bible-search-card__meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.SLYstyles.bible-search-card__tag {
  padding: 0 var(--space-1);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* --- Verse the reader was sent to (#v16) ------------------- */
.SLYstyles.reader__vrow.is-targeted {
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--color-brand-gold, var(--color-brand-primary)) 18%, transparent);
  transition: background 0.4s ease;
}

@media (max-width: 640px) {

  .SLYstyles.reader-search {
    order: 3;
    flex-basis: 100%;
  }

  .SLYstyles.reader-stickybar__search-label {
    display: none;
  }

  .SLYstyles.bible-search-grid {
    grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  }
}

/* ============================================================
   Passage composer — type a reference, pick verses, save
   One pass: the reference field resolves as it is typed, the chapter
   renders below it, and (on deposit, which has a JSON endpoint) the
   saved card lands in the list without the page moving. Shared by the
   deposit, transfer, request and request-fulfilment forms.
   See assets/js/connector.passageComposer.js. The class prefix stays
   `deposit-` because that is where it was first built — renaming it
   would touch four views for no behavioural gain.
   ============================================================ */
.SLYstyles.deposit-composer__top {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: flex-end;
}

.SLYstyles.deposit-composer__refwrap {
  position: relative;
  flex: 1 1 320px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.SLYstyles.deposit-composer__translation {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  flex: 0 1 220px;
}

.SLYstyles.deposit-composer__label {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

/* The one field that matters: big enough to be the obvious first move. */
.SLYstyles.deposit-composer__ref {
  width: 100%;
  min-height: 52px;
  padding: 0 var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text-primary);
  font-family: var(--font-serif);
  font-size: var(--text-lg);
}

.SLYstyles.deposit-composer__ref:focus {
  outline: none;
  border-color: var(--color-brand-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-brand-primary) 18%, transparent);
}

/* Book suggestions hang over the content below rather than pushing it
   down — the page must not jump while someone is typing. */
.SLYstyles.deposit-suggest {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 20;
  margin: 0;
  padding: var(--space-1);
  list-style: none;
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: var(--shadow-lg);
}

.SLYstyles.deposit-suggest__item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-primary);
  font: inherit;
  font-weight: var(--weight-semibold);
  text-align: left;
  cursor: pointer;
}

.SLYstyles.deposit-suggest__item:hover,
.SLYstyles.deposit-suggest__item:focus-visible {
  background: var(--color-bg-secondary);
}

.SLYstyles.deposit-suggest__meta {
  font-size: var(--text-xs);
  font-weight: normal;
  color: var(--color-text-muted);
}

.SLYstyles.deposit-composer__hint {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.SLYstyles.deposit-composer__hint[data-tone="warn"] {
  color: var(--color-brand-gold);
}

/* --- The chapter, inline --------------------------------- */
.SLYstyles.deposit-passage {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg-secondary);
  overflow: hidden;
}

.SLYstyles.deposit-passage__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
  font-size: var(--text-sm);
}

.SLYstyles.deposit-verses {
  max-height: 320px;
  overflow-y: auto;
  margin: 0;
  padding: var(--space-2);
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.SLYstyles.deposit-verse__btn {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-text-secondary);
  font: inherit;
  font-family: var(--font-serif);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  text-align: left;
  cursor: pointer;
}

.SLYstyles.deposit-verse__btn:hover {
  background: var(--color-surface);
  color: var(--color-text-primary);
}

.SLYstyles.deposit-verse__no {
  flex: 0 0 1.75rem;
  text-align: right;
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* Picked verses read as one block, with the ends marked so a range is
   obvious at a glance. */
.SLYstyles.deposit-verse__btn.is-picked {
  background: color-mix(in srgb, var(--color-brand-primary) 12%, var(--color-surface));
  color: var(--color-text-primary);
}

.SLYstyles.deposit-verse__btn.is-picked.is-edge {
  border-color: var(--color-brand-primary);
}

.SLYstyles.deposit-verse__btn.is-picked .SLYstyles.deposit-verse__no {
  color: var(--color-brand-primary);
  font-weight: var(--weight-semibold);
}

/* --- Footer ---------------------------------------------- */
.SLYstyles.deposit-composer__foot {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.SLYstyles.deposit-composer__status {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.SLYstyles.deposit-composer__status[data-tone="ok"]    { color: var(--color-success); }
.SLYstyles.deposit-composer__status[data-tone="error"] { color: var(--color-error); }

/* A saved deposit arrives in a list the reader is already looking at —
   a brief tint says which row is new without moving anything. */
@keyframes sly-deposit-fresh {
  from { background: color-mix(in srgb, var(--color-brand-primary) 16%, var(--color-surface)); }
  to   { background: var(--color-surface); }
}

.SLYstyles.passage-card.is-fresh {
  animation: sly-deposit-fresh 1.6s var(--ease) 1;
}

@media (prefers-reduced-motion: reduce) {
  .SLYstyles.passage-card.is-fresh { animation: none; }
}

@media (max-width: 640px) {

  .SLYstyles.deposit-composer__translation {
    flex: 1 1 100%;
  }

  .SLYstyles.deposit-verses {
    max-height: 260px;
  }
}

/* ============================================================
   Dwelling — pacing, gradients, glow
   The check-in is the one flow that should never feel transactional.
   Steps ease in, an answer is allowed to land before the page moves,
   and the Scripture arrives under a slow breathing glow.
   Driven by assets/js/connector.dwellingFlow.js.
   ============================================================ */
:root {
  --dwell-fade: 1500ms;
  /* TWEAK: Step fade. Must match FADE_MS in connector.dwellingFlow.js. */

  --dwell-ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  /* TWEAK: Slow-out curve. Nothing in Dwelling should accelerate. */
}

/* --- The column ------------------------------------------
   WHY: every Dwelling page is a single narrow column. The mood pages
   set a max-width inline and never centred it, so the flow sat against
   the sidebar while the finance pages (which did set margin: 0 auto)
   sat in the middle. One class now owns it. */
.SLYstyles.dwell-column {
  width: 100%;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}

.SLYstyles.dwell-column--narrow {
  max-width: 520px;
}

.SLYstyles.dwell-column--wide {
  max-width: 720px;
}

/* --- Step transitions ------------------------------------- */
.SLYstyles.dwell-flow {
  transition: opacity var(--dwell-fade) var(--dwell-ease),
              transform var(--dwell-fade) var(--dwell-ease),
              filter var(--dwell-fade) var(--dwell-ease);
}

.SLYstyles.dwell-flow.is-entering {
  opacity: 0;
  transform: translateY(10px);
}

.SLYstyles.dwell-flow.is-ready {
  opacity: 1;
  transform: translateY(0);
}

/* The answered step dissolves rather than cutting out. */
.SLYstyles.dwell-flow.is-leaving {
  opacity: 0;
  transform: translateY(-6px);
  filter: blur(1.5px);
  pointer-events: none;
}

/* --- The ambient area -------------------------------------
   A wash of colour that drifts behind the card. Deliberately slow
   (a 28s cycle) and very low contrast: it should be noticed only if
   you look for it. */
.SLYstyles.dwell-ambient {
  position: relative;
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  overflow: hidden;
  isolation: isolate;
}

.SLYstyles.dwell-ambient::before {
  content: "";
  position: absolute;
  inset: -40%;
  z-index: -1;
  background:
    radial-gradient(42% 38% at 22% 28%, color-mix(in srgb, var(--color-brand-primary) 16%, transparent), transparent 70%),
    radial-gradient(38% 34% at 78% 32%, color-mix(in srgb, var(--color-brand-accent, var(--color-brand-secondary)) 14%, transparent), transparent 70%),
    radial-gradient(46% 40% at 50% 82%, color-mix(in srgb, var(--color-brand-gold) 10%, transparent), transparent 72%);
  animation: sly-dwell-drift 28s ease-in-out infinite alternate;
}

@keyframes sly-dwell-drift {
  0%   { transform: translate3d(-2%, -1%, 0) scale(1); }
  50%  { transform: translate3d(1%, 2%, 0) scale(1.06); }
  100% { transform: translate3d(2%, -2%, 0) scale(1.02); }
}

/* --- Entry buttons: soothing gradients --------------------- */
.SLYstyles.mood-cat-btn {
  /* Longer than the 0.15s it had: these are the first thing touched. */
  transition: border-color 600ms var(--dwell-ease),
              background 600ms var(--dwell-ease),
              box-shadow 600ms var(--dwell-ease),
              transform 600ms var(--dwell-ease),
              opacity var(--dwell-fade) var(--dwell-ease);
}

.SLYstyles.mood-cat-btn--positive {
  background:
    linear-gradient(135deg,
      color-mix(in srgb, var(--color-success) 10%, var(--color-surface)) 0%,
      color-mix(in srgb, var(--color-brand-gold) 7%, var(--color-surface)) 100%);
}

.SLYstyles.mood-cat-btn--neutral {
  background:
    linear-gradient(135deg,
      color-mix(in srgb, var(--color-brand-accent, var(--color-brand-secondary)) 9%, var(--color-surface)) 0%,
      color-mix(in srgb, var(--color-brand-primary) 6%, var(--color-surface)) 100%);
}

.SLYstyles.mood-cat-btn--negative {
  background:
    linear-gradient(135deg,
      color-mix(in srgb, var(--color-brand-primary) 10%, var(--color-surface)) 0%,
      color-mix(in srgb, var(--color-text-muted) 8%, var(--color-surface)) 100%);
}

.SLYstyles.mood-cat-btn:hover,
.SLYstyles.mood-cat-btn:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--color-brand-primary) 14%, transparent);
}

/* Feeling pills warm up instead of flipping to a solid fill. */
.SLYstyles.mood-feeling-btn {
  background:
    linear-gradient(135deg,
      color-mix(in srgb, var(--color-brand-primary) 5%, var(--color-surface)) 0%,
      var(--color-surface) 100%);
  transition: border-color 600ms var(--dwell-ease),
              background 600ms var(--dwell-ease),
              box-shadow 600ms var(--dwell-ease),
              color 600ms var(--dwell-ease),
              opacity var(--dwell-fade) var(--dwell-ease);
}

.SLYstyles.mood-feeling-btn:hover,
.SLYstyles.mood-feeling-btn:focus-visible {
  background:
    linear-gradient(135deg,
      color-mix(in srgb, var(--color-brand-primary) 22%, var(--color-surface)) 0%,
      color-mix(in srgb, var(--color-brand-gold) 12%, var(--color-surface)) 100%);
  color: var(--color-text-primary);
  box-shadow: 0 6px 20px color-mix(in srgb, var(--color-brand-primary) 12%, transparent);
}

/* --- Empty state (no Scripture matched) -------------------- */
.SLYstyles.dwell-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-5);
  text-align: center;
  padding: var(--space-8) var(--space-6);
}

.SLYstyles.dwell-empty__actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-3);
  width: min(100%, 320px);
}

/* The two ways out share a row; the ask stands alone above them. */
.SLYstyles.dwell-empty__alt {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
}

/* --- Entering a check-in from the dashboard ---------------- */
.SLYstyles.dwell-enter {
  background: linear-gradient(135deg,
      var(--color-brand-primary) 0%,
      color-mix(in srgb, var(--color-brand-primary) 72%, var(--color-brand-gold)) 100%);
  border-color: transparent;
  transition: box-shadow 600ms var(--dwell-ease),
              transform 600ms var(--dwell-ease),
              filter 600ms var(--dwell-ease);
}

.SLYstyles.dwell-enter--gold {
  background: linear-gradient(135deg,
      var(--color-brand-gold) 0%,
      color-mix(in srgb, var(--color-brand-gold) 70%, var(--color-brand-primary)) 100%);
}

.SLYstyles.dwell-enter:hover,
.SLYstyles.dwell-enter:focus-visible {
  transform: translateY(-1px);
  filter: brightness(1.04);
  box-shadow: 0 10px 26px color-mix(in srgb, var(--color-brand-primary) 22%, transparent);
}

/* --- The answer that was chosen ---------------------------- */
.SLYstyles.is-chosen {
  border-color: var(--color-brand-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-brand-primary) 22%, transparent),
              0 10px 28px color-mix(in srgb, var(--color-brand-primary) 16%, transparent);
}

/* The others step back rather than vanish. */
.SLYstyles.is-dimmed {
  opacity: 0.28;
}

/* Finance rows share the affordance. */
[data-dwelling-option] {
  transition: border-color 600ms var(--dwell-ease),
              background 600ms var(--dwell-ease),
              box-shadow 600ms var(--dwell-ease);
}

[data-dwelling-option].is-chosen {
  border-color: var(--color-brand-primary);
  background: linear-gradient(135deg,
      color-mix(in srgb, var(--color-brand-primary) 9%, var(--color-surface)) 0%,
      var(--color-surface) 100%);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-brand-primary) 18%, transparent);
}

/* --- The Scripture arriving -------------------------------- */
.SLYstyles.dwell-reveal {
  transition: opacity var(--dwell-fade) var(--dwell-ease),
              transform var(--dwell-fade) var(--dwell-ease);
}

.SLYstyles.dwell-reveal.is-revealing {
  opacity: 0;
  transform: translateY(12px);
}

.SLYstyles.dwell-reveal.is-revealed {
  opacity: 1;
  transform: translateY(0);
}

/* A border that breathes — six seconds out, six back. Slow enough to
   read as light rather than as animation. */
.SLYstyles.dwell-glow {
  border: 1px solid color-mix(in srgb, var(--color-brand-primary) 30%, var(--color-border));
}

.SLYstyles.dwell-glow.is-revealed {
  animation: sly-dwell-breathe 12s var(--dwell-ease) infinite;
}

@keyframes sly-dwell-breathe {
  0%, 100% {
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--color-brand-primary) 14%, transparent),
                0 0 18px color-mix(in srgb, var(--color-brand-primary) 8%, transparent);
  }
  50% {
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-brand-primary) 26%, transparent),
                0 0 34px color-mix(in srgb, var(--color-brand-primary) 18%, transparent);
  }
}

/* --- Stillness setting -------------------------------------
   Everything above is pacing, not information: with reduced motion the
   flow shows its final state immediately. */
@media (prefers-reduced-motion: reduce) {

  .SLYstyles.dwell-flow,
  .SLYstyles.dwell-reveal {
    transition: none;
    opacity: 1;
    transform: none;
    filter: none;
  }

  .SLYstyles.dwell-ambient::before,
  .SLYstyles.dwell-glow.is-revealed {
    animation: none;
  }

  .SLYstyles.mood-cat-btn,
  .SLYstyles.mood-feeling-btn,
  [data-dwelling-option] {
    transition: none;
  }
}

/* ============================================================
   Library — study-book shelf
   Cards are the whole link: one tap opens the book. The viewer is a
   plain <object>, so the browser's own PDF reader does the work and
   nothing here has to ship a renderer.
   ============================================================ */
.SLYstyles.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: var(--space-3);
}

.SLYstyles.book-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-height: 132px;
  padding: var(--space-4);
  padding-top: var(--space-6);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background:
    linear-gradient(135deg,
      color-mix(in srgb, var(--color-brand-primary) 7%, var(--color-surface)) 0%,
      var(--color-surface) 62%);
  color: var(--color-text-primary);
  text-decoration: none;
  transition: border-color var(--t-fast) var(--ease),
              box-shadow var(--t-fast) var(--ease),
              transform var(--t-fast) var(--ease);
}

.SLYstyles.book-card:hover,
.SLYstyles.book-card:focus-visible {
  border-color: var(--color-brand-accent);
  box-shadow: 0 8px 22px color-mix(in srgb, var(--color-brand-primary) 12%, transparent);
  transform: translateY(-2px);
  text-decoration: none;
}

/* The format is the first thing worth knowing: a PDF opens here, an
   EPUB has to be downloaded. */
.SLYstyles.book-card__badge {
  position: absolute;
  top: var(--space-3);
  left: var(--space-4);
  font-size: 10px;
  font-weight: var(--weight-semibold);
  letter-spacing: 0.08em;
  color: var(--color-brand-primary);
  background: color-mix(in srgb, var(--color-brand-primary) 12%, var(--color-surface));
  border-radius: var(--radius-sm);
  padding: 1px 6px;
}

/* The membership a book is for. Top-right so it never collides with
   the format badge at top-left, and only drawn above Free. */
.SLYstyles.book-card__tier {
  position: absolute;
  top: var(--space-3);
  right: var(--space-4);
  font-size: 10px;
  font-weight: var(--weight-semibold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  color: var(--color-brand-gold);
  background: color-mix(in srgb, var(--color-brand-gold) 14%, var(--color-surface));
}

.SLYstyles.book-card__tier[data-tier='admin'] {
  color: var(--color-error);
  background: color-mix(in srgb, var(--color-error) 12%, var(--color-surface));
}

.SLYstyles.book-card.has-cover .SLYstyles.book-card__tier {
  /* Over an image it needs its own ground, same as the format badge. */
  top: var(--space-2);
  right: var(--space-2);
  background: color-mix(in srgb, var(--color-surface) 88%, transparent);
  backdrop-filter: blur(2px);
}

.SLYstyles.book-card__title {
  font-weight: var(--weight-semibold);
  line-height: var(--leading-snug, 1.3);
  overflow-wrap: break-word;
}

.SLYstyles.book-card__author {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.SLYstyles.book-card__meta {
  margin-top: auto;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* --- Inline reader ---------------------------------------- */
.SLYstyles.book-viewer {
  display: block;
  width: 100%;
  height: min(78vh, 900px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg-secondary);
}

@media (max-width: 640px) {

  .SLYstyles.book-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }

  /* A phone-height PDF frame is unreadable; the download button above
     it is the better path, so keep the preview short. */
  .SLYstyles.book-viewer {
    height: 60vh;
  }
}

/* Keyword hits carry a line of the verse: a reference alone does not
   tell you whether it is the passage you meant. */
.SLYstyles.bible-search-card__snippet {
  font-family: var(--font-serif);
  font-size: var(--text-xs);
  line-height: var(--leading-relaxed);
  color: var(--color-text-muted);
}

/* --- Library covers ---------------------------------------
   A cover replaces the top of the card rather than squeezing in
   beside the text, so a shelf with mixed covered/uncovered books
   still lines up. */
.SLYstyles.book-card.has-cover {
  padding-top: 0;
  overflow: hidden;
}

.SLYstyles.book-card__cover {
  display: block;
  width: calc(100% + (2 * var(--space-4)));
  margin: 0 calc(-1 * var(--space-4)) var(--space-3);
  /* Taller than it was, and the whole cover is shown rather than
     cropped to fill: a book cover carries its title, and `cover` was
     slicing the top off it. The fixed height keeps a shelf of mixed
     covers lined up, and a portrait cover letterboxes against the
     card's own background instead of being cut. */
  height: 190px;
  object-fit: contain;
  object-position: center;
  background: var(--color-bg-secondary);
}

.SLYstyles.book-card.has-cover .SLYstyles.book-card__badge {
  /* Over an image the badge needs its own ground to sit on. */
  top: var(--space-2);
  left: var(--space-2);
  background: color-mix(in srgb, var(--color-surface) 88%, transparent);
  backdrop-filter: blur(2px);
}

.SLYstyles.book-detail__cover {
  flex: 0 0 auto;
  width: 120px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  object-fit: cover;
}

@media (max-width: 640px) {

  .SLYstyles.book-card__cover {
    height: 112px;
  }

  .SLYstyles.book-detail__cover {
    width: 84px;
  }
}

/* --- Segmented toggle --------------------------------------- */

.SLYstyles.seg-toggle {
  display: inline-flex;
  padding: 2px;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  gap: 2px;
}

.SLYstyles.seg-toggle__opt {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  text-decoration: none;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

.SLYstyles.seg-toggle__opt:hover { background: var(--color-bg-subtle); }

.SLYstyles.seg-toggle__opt[aria-current='true'] {
  background: var(--color-surface);
  color: var(--color-text);
  font-weight: var(--weight-semibold);
  box-shadow: var(--shadow-sm);
}

.SLYstyles.seg-toggle__count {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.SLYstyles.reader__comparison--wide {
  max-width: 100%;
  overflow-x: auto;
  padding-bottom: var(--space-2);
}
.SLYstyles.reader__comparison--wide .SLYstyles.reader__colhead,
.SLYstyles.reader__comparison--wide .SLYstyles.reader__vrow {
  display: grid;
  grid-template-columns: repeat(var(--reader-columns), minmax(0, 1fr));
  min-width: calc(var(--reader-columns) * 14rem);
  gap: var(--space-4);
}
