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

html {
  scrollbar-gutter: stable;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-0);
  color: var(--fg-2);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 2rem;
}

.page-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 640px;
  margin: 2rem auto 0;
}

.page-shell--narrow {
  max-width: 420px;
}

.page-shell--wide {
  max-width: 1100px;
}

body.page--login .page-shell {
  margin-top: 10vh;
}

.page-content {
  flex: 1;
}

.container {
  max-width: 640px;
  width: 100%;
  margin-top: 2rem;
}

h1 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  color: var(--fg-0);
}

.subtitle {
  color: var(--fg-4);
  margin-bottom: 2rem;
  font-size: 0.95rem;
}

/* Stepper */
.stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 2rem;
}

.stepper-step {
  display: flex;
  align-items: center;
}

.stepper-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  background: var(--bg-2);
  color: var(--fg-5);
  transition: all 0.3s;
}

.stepper-dot.active { background: var(--accent); color: white; }
.stepper-dot.completed { background: var(--success); color: white; }

.stepper-line {
  width: 60px;
  height: 2px;
  background: var(--bg-2);
  margin: 0 0.5rem;
  transition: background 0.3s;
}

.stepper-line.active { background: var(--success); }

.card {
  background: var(--bg-1);
  border-radius: 12px;
  padding: 1.75rem;
  border: 1px solid var(--border);
}

.step-panel { display: none; }
.step-panel.active { display: block; }

.step-title {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  color: var(--fg-1);
}

label {
  display: block;
  font-size: 0.85rem;
  color: var(--fg-4);
  margin-bottom: 0.35rem;
}

input[type="text"], select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--fg-2);
  font-size: 0.95rem;
  line-height: 1.4;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 2.5rem;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'><path d='M1 1.5L6 6.5L11 1.5' stroke='%2394a3b8' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
  background-size: 12px 8px;
}

select::-ms-expand { display: none; }

input:focus, select:focus { border-color: var(--accent); }

.field { margin-bottom: 1rem; }

/* Video preview card */
.video-preview {
  display: flex;
  gap: 1rem;
  padding: 1rem;
  background: var(--bg-0);
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s;
  border: 1px solid var(--border);
}

.video-preview:hover { border-color: var(--accent); }

.video-preview img {
  width: 160px;
  height: 90px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}

.video-preview .vp-info { flex: 1; min-width: 0; }

.video-preview .vp-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--fg-1);
  margin-bottom: 0.35rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.video-preview .vp-duration {
  font-size: 0.8rem;
  color: var(--fg-4);
  margin-bottom: 0.5rem;
}

.video-preview .vp-link {
  font-size: 0.8rem;
  color: var(--accent);
}

/* Time inputs */
.time-inputs {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.time-group {
  flex: 1;
}

.time-group label {
  margin-bottom: 0.5rem;
}

.time-fields {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.time-fields input {
  width: 52px;
  padding: 0.55rem 0.4rem;
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--fg-2);
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
  text-align: center;
  outline: none;
  transition: border-color 0.2s;
}

.time-fields input:focus { border-color: var(--accent); }

.time-fields .sep {
  color: var(--fg-5);
  font-weight: 700;
  font-size: 1.1rem;
}

.time-group .marker-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  margin-left: 0.4rem;
  vertical-align: middle;
}

.marker-badge.a { background: rgba(34,197,94,0.15); color: var(--success); }
.marker-badge.b { background: rgba(239,68,68,0.15); color: var(--danger); }

/* Range bar */
.range-bar {
  position: relative;
  width: 100%;
  height: 8px;
  background: var(--bg-2);
  border-radius: 4px;
  margin-bottom: 0.5rem;
  overflow: hidden;
}

.range-bar-fill {
  position: absolute;
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: left 0.2s, width 0.2s;
}

.range-summary {
  font-size: 0.8rem;
  color: var(--fg-5);
  text-align: center;
}

.hint-text {
  font-size: 0.78rem;
  color: var(--fg-5);
  margin-top: 0.75rem;
  line-height: 1.5;
}

/* YouTube inline player for custom range */
.yt-embed-block {
  margin-bottom: 1rem;
}

.yt-player-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  color: var(--fg-5);
}

.yt-player-wrap::before {
  content: "Loading player…";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: var(--fg-5);
  pointer-events: none;
}

.yt-player-wrap iframe,
.yt-player-wrap > div {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  z-index: 1;
}

.yt-capture-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.6rem;
  flex-wrap: wrap;
}

.yt-capture-now {
  display: flex;
  flex-direction: column;
  padding: 0.45rem 0.75rem;
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 7.5rem;
}

.yt-capture-now-label {
  font-size: 0.7rem;
  color: var(--fg-5);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.yt-capture-now-val {
  font-family: var(--mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 0.95rem;
  color: var(--fg-2);
  font-weight: 600;
}

.btn-capture {
  flex: 1 1 140px;
  background: var(--bg-2);
  color: var(--fg-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.btn-capture:hover { background: var(--bg-3); }
.btn-capture .marker-badge { margin-right: 0; }

.yt-embed-error {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  flex-wrap: wrap;
}

.yt-embed-error[hidden] { display: none; }

.yt-embed-error-icon {
  color: var(--accent);
  flex-shrink: 0;
  padding-top: 0.1rem;
}

.yt-embed-error-body {
  flex: 1;
  min-width: 14rem;
}

.yt-embed-error-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--fg-2);
  margin-bottom: 0.2rem;
}

.yt-embed-error-msg {
  font-size: 0.8rem;
  color: var(--fg-5);
  line-height: 1.45;
}

.yt-embed-error-btn {
  flex: 0 0 auto;
  align-self: center;
  white-space: nowrap;
}

/* Buttons */
.nav-buttons {
  display: flex;
  gap: 0.6rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
  align-items: stretch;
}

.nav-buttons .btn {
  flex: 1 1 140px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  border: none;
  transition: background 0.2s, opacity 0.2s, transform 0.1s;
  flex: 1;
  text-decoration: none;
  white-space: nowrap;
  text-align: center;
  min-height: 2.6rem;
  font-family: inherit;
}

.btn:active:not(:disabled) { transform: scale(0.98); }

.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--bg-2); color: var(--fg-2); }
.btn-secondary:hover { background: var(--bg-3); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: var(--success-hover); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Input mode tabs */
.mode-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 1.25rem;
  background: var(--bg-0);
  border-radius: var(--radius);
  padding: 4px;
}

.mode-tab {
  flex: 1;
  padding: 0.55rem 1rem;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 6px;
  color: var(--fg-5);
  transition: all 0.2s;
  border: none;
  background: none;
}

.mode-tab.active {
  background: var(--bg-2);
  color: var(--fg-2);
}

.mode-tab:hover:not(.active) { color: var(--fg-4); }

.mode-panel { display: none; }
.mode-panel.active { display: block; }

/* File upload */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.upload-area:hover { border-color: var(--accent); background: rgba(99,102,241,0.05); }
.upload-area.has-file { border-color: var(--success); border-style: solid; }

.upload-area input[type="file"] { display: none; }

.upload-icon { font-size: 2rem; margin-bottom: 0.5rem; color: var(--fg-5); }
.upload-text { font-size: 0.9rem; color: var(--fg-4); }
.upload-filename { font-size: 0.85rem; color: var(--success); font-weight: 600; margin-top: 0.5rem; }

/* MP3 preview card (step 2 upload mode) */
.mp3-preview {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--bg-0);
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
  border: 1px solid var(--border);
}

.mp3-preview-icon { font-size: 2.5rem; flex-shrink: 0; color: var(--accent); }
.mp3-preview .vp-title { font-weight: 600; font-size: 0.9rem; color: var(--fg-1); margin-bottom: 0.25rem; word-break: break-all; }
.mp3-preview .vp-duration { font-size: 0.8rem; color: var(--fg-4); }

/* Progress */
.progress-steps {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}

.progress-step {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  background: var(--bg-0);
  border-radius: var(--radius);
  font-size: 0.85rem;
  color: var(--fg-5);
  transition: all 0.3s;
}

.progress-step.active {
  color: var(--fg-2);
  background: #1a2744;
  border: 1px solid var(--border);
}

.progress-step.done { color: var(--success); }
.progress-step.error { color: var(--danger); }

.progress-step .icon {
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--accent);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Download/Transcription progress detail */
.download-detail {
  margin-top: 0.5rem;
  padding: 0.75rem;
  background: var(--bg-0);
  border-radius: var(--radius);
  display: none;
}

.download-detail.visible { display: block; }

.download-elapsed {
  font-size: 0.78rem;
  color: var(--fg-4);
  font-variant-numeric: tabular-nums;
}

.transcribe-detail {
  margin-top: 0.5rem;
  padding: 0.75rem;
  background: var(--bg-0);
  border-radius: var(--radius);
  display: none;
}

.transcribe-detail.visible { display: block; }

.transcribe-progress-bar {
  width: 100%;
  height: 6px;
  background: var(--bg-2);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.transcribe-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.5s ease;
  width: 0%;
}

.transcribe-times {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--fg-4);
  font-variant-numeric: tabular-nums;
}

.hidden { display: none !important; }

/* Gemini Analysis Panel */
.btn-gemini { background: var(--info); color: white; }
.btn-gemini:hover { background: var(--info-hover); }
.btn-gemini:disabled { opacity: 0.5; cursor: not-allowed; }

.analysis-section { margin-bottom: 1.25rem; }
.analysis-section:last-child { margin-bottom: 0; }

.analysis-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-5);
  margin-bottom: 0.6rem;
}

.analysis-summary { font-size: 0.9rem; color: var(--fg-2); line-height: 1.6; }

.main-verse-badge {
  display: inline-block;
  background: rgba(99,102,241,0.15);
  border: 1px solid rgba(99,102,241,0.4);
  color: var(--accent-soft);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
}

.scripture-list { display: flex; flex-direction: column; gap: 0.5rem; }

.scripture-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  background: var(--bg-0);
  border-radius: 6px;
  font-size: 0.85rem;
}

.scripture-ref {
  font-weight: 600;
  color: var(--accent-soft);
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 80px;
}

.scripture-context { color: var(--fg-4); line-height: 1.5; }

.keyword-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.keyword-tag {
  background: var(--bg-2);
  color: var(--fg-3);
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
}

.question-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  counter-reset: question-counter;
}

.question-item {
  display: flex;
  gap: 0.75rem;
  font-size: 0.88rem;
  color: var(--fg-2);
  line-height: 1.5;
  counter-increment: question-counter;
}

.question-item::before {
  content: counter(question-counter) ".";
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
  width: 1.2rem;
}

.analysis-error {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  color: #fca5a5;
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
}

/* ───────────────────────── Teachings page filter panel ───────────────────── */

.teachings-searchbar {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
  margin-bottom: 0.75rem;
}

.teachings-searchbar input[type="search"] {
  flex: 1;
  padding: 0.6rem 0.85rem;
  background: var(--bg-0);
  color: var(--fg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  outline: none;
}

.teachings-searchbar input[type="search"]:focus {
  border-color: var(--accent);
}

.btn-ghost {
  background: var(--bg-0);
  color: var(--fg-3);
  border: 1px solid var(--border);
  padding: 0.55rem 0.9rem;
  font-size: 0.85rem;
}

.btn-ghost:hover:not(:disabled) { background: var(--bg-2); }

.teachings-filter-toggle {
  position: relative;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  gap: 0;
}

.teachings-filter-toggle svg {
  display: block;
}

.filter-badge {
  position: absolute;
  top: -0.4rem;
  right: -0.4rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.1rem;
  height: 1.1rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  background: var(--danger);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
  border: 2px solid var(--bg-1);
}

.filter-panel {
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.filter-panel[hidden] { display: none; }

.filter-section {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.filter-section__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.filter-section__title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--fg-2);
  letter-spacing: 0.02em;
}

.filter-reset,
.filter-clear-all {
  font-size: 0.78rem;
  color: var(--accent-soft);
  text-decoration: none;
  cursor: pointer;
}

.filter-reset:hover,
.filter-clear-all:hover { color: var(--accent); text-decoration: underline; }

.filter-section--footer {
  padding-top: 0.5rem;
  border-top: 1px dashed var(--border);
  align-items: flex-end;
}

.filter-scripture {
  display: grid;
  grid-template-columns: minmax(5rem, 1fr) minmax(0, 3fr) minmax(5rem, 1fr);
  gap: 0.5rem;
}

@media (max-width: 480px) {
  .filter-scripture {
    grid-template-columns: 1fr 1fr;
  }
  .filter-scripture > select[name="lang"] { grid-column: 1 / -1; }
}

.filter-scripture select {
  width: 100%;
  padding: 0.55rem 0.7rem;
  font-size: 0.85rem;
}

.filter-scripture select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.filter-chip {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--bg-1);
  color: var(--fg-3);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.filter-chip:hover {
  border-color: var(--accent-soft);
  color: var(--fg-1);
}

.filter-chip--active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.filter-chip--active:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: white;
}

.filter-date-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.filter-date {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.75rem;
  color: var(--fg-4);
  margin-bottom: 0;
}

.filter-date input[type="date"] {
  width: 100%;
  padding: 0.5rem 0.65rem;
  background: var(--bg-0);
  color: var(--fg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.85rem;
  color-scheme: dark;
}

.filter-date input[type="date"]:focus {
  outline: none;
  border-color: var(--accent);
}

.teaching-cover-preview {
  flex-shrink: 0;
  border-radius: 6px;
  background: linear-gradient(
    155deg,
    rgba(99, 102, 241, 0.16) 0%,
    rgba(15, 23, 42, 0.55) 50%,
    var(--bg-2) 100%
  );
  border: 1px solid rgba(99, 102, 241, 0.3);
  box-sizing: border-box;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
}

.teaching-cover-preview--list {
  width: 112px;
  height: 72px;
  padding: 0.42rem 0.48rem;
}

.teaching-cover-preview--card {
  width: 100%;
  height: 100%;
  min-height: 0;
  aspect-ratio: unset;
  border: none;
  border-radius: 0;
  padding: clamp(0.75rem, 3vw, 1.25rem);
  justify-content: flex-end;
  gap: 0.35rem;
}

.teaching-cover-preview--card .teaching-cover-preview__preacher {
  font-size: 0.62rem;
}

.teaching-cover-preview--card .teaching-cover-preview__title {
  font-size: clamp(0.72rem, 2.2vw, 0.95rem);
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.teaching-cover-preview--card .teaching-cover-preview__scripture {
  font-size: 0.58rem;
}

.teaching-cover-preview--detail {
  width: 100%;
  aspect-ratio: 16 / 9;
  margin-bottom: 1.5rem;
  padding: clamp(1.25rem, 4vw, 2.5rem);
  justify-content: center;
  gap: 0.65rem;
  border-radius: var(--radius);
}

.teaching-cover-preview__preacher {
  font-size: 0.52rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--fg-4);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.15;
}

.teaching-cover-preview--detail .teaching-cover-preview__preacher {
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: var(--fg-3);
}

.teaching-cover-preview__title {
  flex: 1;
  min-height: 0;
  font-size: 0.58rem;
  font-weight: 600;
  color: var(--fg-1);
  line-height: 1.28;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.teaching-cover-preview--detail .teaching-cover-preview__title {
  flex: unset;
  font-size: clamp(1.1rem, 2.8vw, 1.65rem);
  font-weight: 700;
  line-height: 1.3;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  max-width: 42rem;
}

.teaching-cover-preview__scripture {
  font-size: 0.52rem;
  font-weight: 600;
  color: var(--accent-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.15;
}

.teaching-cover-preview__scripture--badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  white-space: normal;
  overflow: visible;
  max-width: 42rem;
}

.teaching-cover-preview__ref {
  display: inline-block;
  background: rgba(99, 102, 241, 0.18);
  border: 1px solid rgba(99, 102, 241, 0.38);
  color: var(--accent-soft);
  font-weight: 600;
  font-size: 0.82rem;
  padding: 0.3rem 0.65rem;
  border-radius: 6px;
  line-height: 1.2;
}

.teaching-cover-preview__ref--more {
  background: rgba(99, 102, 241, 0.08);
  border-style: dashed;
  color: var(--fg-4);
}

.teachings-page__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.teachings-page__title {
  margin-bottom: 0.15rem;
}

.teachings-page__subtitle {
  color: var(--fg-5);
  font-size: 0.85rem;
}

.teachings-page__new {
  flex: 0 0 auto;
  padding: 0.55rem 1rem;
  font-size: 0.85rem;
  text-decoration: none;
}

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

  .teachings-page__new {
    text-align: center;
  }
}

.teachings-results__count {
  font-size: 0.82rem;
  color: var(--fg-4);
  margin-bottom: 0.75rem;
}

.teachings-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

/* Breakpoint must match TEACHINGS_GRID_BREAKPOINT_PX in app/core/constants.py */
@media (min-width: 768px) {
  .teachings-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.teaching-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
  min-width: 0;
}

.teaching-card:hover {
  border-color: rgba(99, 102, 241, 0.55);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

.teaching-card__media {
  aspect-ratio: 16 / 9;
  width: 100%;
  background: var(--bg-2);
  overflow: hidden;
  position: relative;
}

.teaching-card__media img,
.teaching-card__media .teaching-cover-preview--card {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.teaching-card__media .teaching-cover-preview--card {
  position: absolute;
  inset: 0;
  object-fit: unset;
}

.teaching-card__body {
  padding: 1rem 1.1rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  flex: 1;
  background: var(--bg-0);
}

.teaching-card__title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.teaching-card__title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--fg-1);
  line-height: 1.35;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.teaching-card__chevron {
  flex-shrink: 0;
  width: 1.1rem;
  height: 1.1rem;
  color: var(--fg-5);
  margin-top: 0.1rem;
}

.teaching-card__meta {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.teaching-card__meta-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--fg-4);
  min-width: 0;
}

.teaching-card__meta-row svg {
  flex-shrink: 0;
  width: 1rem;
  height: 1rem;
  color: var(--fg-5);
}

.teaching-card__meta-row > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.teaching-card__meta-row--split {
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
}

.teaching-card__meta-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}

.teaching-card__meta-item > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.teaching-card__badge {
  align-self: flex-start;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
}

.teaching-card__badge--private {
  color: var(--fg-5);
  background: var(--bg-2);
}

.teachings-empty {
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--fg-5);
  background: var(--bg-0);
  border-radius: var(--radius);
  border: 1px dashed var(--border);
  margin-top: 0.5rem;
}

.teachings-empty__icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  opacity: 0.6;
}

.teachings-empty__title {
  font-size: 0.95rem;
  color: var(--fg-4);
  margin-bottom: 0.35rem;
}

.teachings-empty__hint {
  font-size: 0.85rem;
}

.teachings-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1.25rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.teachings-pagination__indicator {
  font-size: 0.85rem;
  color: var(--fg-4);
  font-variant-numeric: tabular-nums;
}

/* --- App dialog (native <dialog>) --- */

.app-dialog {
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-0);
  color: var(--fg-1);
  max-width: 32rem;
  width: calc(100% - 2rem);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.app-dialog::backdrop {
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
}

.deny-reason-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.25rem 1.4rem;
}

.deny-reason-form__header {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.deny-reason-form__title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--fg-1);
}

.deny-reason-form__subtitle {
  font-size: 0.8rem;
  color: var(--fg-4);
  line-height: 1.5;
}

.deny-reason-form__quote {
  margin: 0.25rem 0;
  padding: 0.35rem 0 0.35rem 0.85rem;
  border-left: 3px solid rgba(239, 68, 68, 0.5);
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--fg-2);
  font-style: italic;
}

.deny-reason-form__label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fg-5);
}

.deny-reason-form__textarea {
  width: 100%;
  min-height: 6rem;
  padding: 0.7rem 0.85rem;
  background: var(--bg-2);
  color: var(--fg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.5;
  resize: vertical;
  box-sizing: border-box;
  outline: none;
}

.deny-reason-form__textarea:focus {
  border-color: rgba(239, 68, 68, 0.5);
}

.deny-reason-form__error {
  font-size: 0.8rem;
  color: #fca5a5;
  padding: 0.5rem 0.75rem;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: 6px;
}

.deny-reason-form__actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 0.25rem;
}

.btn-secondary-dialog {
  background: transparent;
  color: var(--fg-4);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  cursor: pointer;
}

.btn-secondary-dialog:hover {
  color: var(--fg-2);
  border-color: var(--fg-5);
}

.btn-deny-dialog {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.45);
  border-radius: 6px;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-deny-dialog:hover {
  background: rgba(239, 68, 68, 0.28);
}

/* Site header & footer */
.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-logo {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
}

.brand-text h1 {
  margin-bottom: 0.25rem;
}

.brand-text .subtitle {
  margin-bottom: 0;
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 2rem;
}

.site-nav {
  display: flex;
  gap: 0.9rem;
  flex-wrap: wrap;
  justify-content: flex-end;
  padding-top: 0.35rem;
  flex-shrink: 0;
}

.site-nav a {
  color: var(--fg-4);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
}

.site-nav a.site-nav__logout {
  color: var(--fg-5);
}

.lang-switch {
  display: flex;
  gap: 0.25rem;
  align-items: center;
  font-size: 0.82rem;
}

.lang-switch a {
  color: var(--fg-5);
  text-decoration: none;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}

.lang-switch a.active {
  color: var(--fg-2);
  background: var(--bg-2);
  font-weight: 600;
}

.lang-switch__sep {
  color: var(--fg-5);
}

.login-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.login-header__brand {
  display: inline-block;
  color: inherit;
  text-decoration: none;
}

.login-header__logo {
  display: block;
  margin: 0 auto 0.85rem;
  border-radius: 14px;
}

.login-header h1 {
  margin-bottom: 0.25rem;
}

.login-header__subtitle {
  margin-bottom: 0;
}

.site-footer {
  margin-top: auto;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  text-align: center;
}

.site-footer__row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.site-footer__login {
  font-size: 0.85rem;
  color: var(--fg-4);
  text-decoration: none;
  font-weight: 500;
}

.site-footer__login:hover {
  color: var(--fg-2);
}

.site-footer__copyright {
  font-size: 0.78rem;
  color: var(--fg-5);
}
