:root {
  color-scheme: light;
  --ink: #30383d;
  --muted: #59636a;
  --line: #dce3e8;
  --paper: #ffffff;
  --panel: #ffffff;
  --blue: #3673b7;
  --blue-dark: #254e73;
  --gold: #bb9759;
  --gold-dark: #78633f;
  --rose: #a44848;
  --mist: #f4f6f8;
  --shadow: 0 2px 12px rgba(37, 78, 115, 0.04);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
  font-family:
    Montserrat, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
}

.app-shell.hidden {
  display: none;
}

.login-panel {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #f4f7fa;
}

.login-panel.hidden {
  display: none;
}

.login-card {
  display: grid;
  gap: 18px;
  width: min(100%, 420px);
  padding: 34px;
  background: white;
  border: 1px solid var(--line);
  border-top: 5px solid var(--blue);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-card h1 {
  margin: 0;
  color: var(--blue);
  font-size: 2rem;
  font-weight: 500;
}

.login-message {
  min-height: 1.2em;
  margin: 0;
  color: var(--rose);
  font-size: 0.9rem;
}

.top-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  padding: 18px 34px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 10px 28px rgba(54, 115, 183, 0.08);
  backdrop-filter: blur(16px);
}

.brand {
  display: block;
  text-align: center;
  min-width: 0;
}

.brand h1,
.editor-header h3,
.section-heading h3 {
  margin: 0;
  letter-spacing: 0;
}

.brand h1 {
  color: var(--blue);
  font-size: clamp(1.55rem, 2.2vw, 2.15rem);
  font-weight: 500;
  line-height: 1.08;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--gold);
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.toolbar {
  display: grid;
  gap: 10px;
  width: 100%;
  max-width: 940px;
  margin: 0 auto;
  padding: 12px;
  background: #f7f9fb;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.toolbar-row {
  display: grid;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.passage-row {
  grid-template-columns: 38px minmax(170px, 240px) 74px 74px 38px;
  justify-content: center;
}

.book-field {
  min-width: 0;
}

.chapter-field {
  min-width: 0;
}

.verse-field {
  min-width: 0;
}

#previousButton {
  grid-column: 1;
}

#nextButton {
  grid-column: 5;
}

.support-row {
  grid-template-columns: minmax(260px, 360px) minmax(220px, 300px) auto;
  justify-content: center;
}

.toolbar-range-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 74px;
  gap: 6px;
  align-items: center;
  min-width: 0;
}

.toolbar-range-controls.hidden {
  display: none;
}

.toolbar-range-controls .range-toggle {
  width: 100%;
  min-width: 0;
}

.toolbar-range-controls #rangeEndField {
  width: 74px;
  min-width: 0;
}

.toolbar-range-controls #rangeEndField.hidden {
  display: none;
}

.toolbar-range-controls:has(#rangeEndField.hidden) {
  grid-template-columns: minmax(0, 1fr);
}

.segmented-control {
  display: grid;
  gap: 4px;
  padding: 4px;
  background: white;
  border: 1px solid #dce3e9;
  border-radius: 999px;
  width: min(100%, 520px);
}

.view-toggle {
  grid-template-columns: repeat(3, 1fr);
  min-width: 0;
}

.range-toggle {
  grid-template-columns: repeat(4, 1fr);
  width: 100%;
}

.view-button,
.range-button {
  display: grid;
  place-items: center;
  min-height: 30px;
  min-width: 0;
  padding: 0 8px;
  color: var(--blue);
  background: transparent;
  border: 0;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
}

.view-button.active,
.range-button.active {
  color: white;
  background: var(--blue);
}

.field,
.search-field,
.editor-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 600;
}

.editor-field {
  position: relative;
}

.toolbar .field span,
.toolbar .search-field span {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.compact-field {
  width: 100%;
  min-width: 0;
}

.small-field {
  width: 100%;
  min-width: 0;
}

.toolbar-search {
  width: 100%;
  min-width: 0;
}

select,
input,
textarea {
  width: 100%;
  color: var(--ink);
  background: white;
  border: 1px solid #dce3e9;
  border-radius: 4px;
  outline: none;
}

select,
input {
  height: 38px;
  padding: 0 12px;
}

textarea {
  min-height: 300px;
  resize: vertical;
  padding: 16px;
  line-height: 1.65;
}

.rich-note-editor {
  position: relative;
  min-height: 300px;
  padding: 16px;
  color: var(--ink);
  background: white;
  border: 1px solid #dce3e9;
  border-radius: 4px;
  outline: none;
  font-weight: 400;
  line-height: 1.65;
  white-space: normal;
}

.rich-note-editor[data-empty="true"]::before {
  content: attr(data-placeholder);
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  color: #7c8791;
  pointer-events: none;
}

.rich-note-editor:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(54, 115, 183, 0.15);
}

.rich-note-editor p,
.rich-note-editor blockquote,
.rich-note-editor ul,
.rich-note-editor ol {
  margin: 0 0 12px;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.65;
}

.rich-note-editor > :first-child {
  margin-top: 0;
}

.rich-note-editor h5 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.rich-note-editor ul,
.rich-note-editor ol {
  padding-left: 22px;
}

.rich-note-editor blockquote {
  margin-left: 0;
  padding-left: 14px;
  color: #52616d;
  border-left: 3px solid var(--gold);
  font-style: italic;
}

.note-format-toolbar {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px;
  background: #f7f9fb;
  border: 1px solid #dce3e9;
  border-radius: 6px;
}

.format-button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 30px;
  color: var(--blue);
  background: white;
  border: 1px solid #d6e0e8;
  border-radius: 4px;
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1;
}

.heading-icon {
  font-size: 0.72rem;
}

.format-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.format-button:hover,
.format-button:focus-visible,
.format-button.active {
  color: white;
  background: var(--blue);
  border-color: var(--blue);
}

.format-button.active {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28);
}

select:focus,
input:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(54, 115, 183, 0.15);
}

.utility-actions,
.editor-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.primary-button,
.accent-button,
.danger-button,
.secondary-button,
.icon-button {
  min-height: 38px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 600;
}

.primary-button,
.accent-button,
.danger-button,
.secondary-button {
  padding: 0 16px;
}

.primary-button,
.icon-button {
  color: white;
  background: var(--blue);
}

.primary-button:hover,
.icon-button:hover {
  background: var(--blue-dark);
}

.accent-button {
  color: white;
  background: var(--gold);
}

.accent-button:hover {
  background: var(--gold-dark);
}

.danger-button {
  color: var(--rose);
  background: #fff7f7;
  border-color: #efcccc;
}

.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--blue);
  background: white;
  border-color: #d6e0e8;
}

.secondary-button:hover {
  border-color: var(--blue);
}

.toolbar .secondary-button {
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  white-space: nowrap;
}

.toolbar-menu {
  position: relative;
  justify-self: end;
  min-width: 0;
}

.toolbar-menu summary {
  display: inline-grid;
  place-items: center;
  min-height: 34px;
  padding: 0 14px;
  color: var(--blue);
  background: white;
  border: 1px solid #d6e0e8;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  list-style: none;
  white-space: nowrap;
  cursor: pointer;
}

.toolbar-menu summary::-webkit-details-marker {
  display: none;
}

.toolbar-menu summary:hover {
  border-color: var(--blue);
}

.toolbar-menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 20;
  display: grid;
  gap: 6px;
  min-width: 170px;
  padding: 8px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.menu-button {
  display: grid;
  place-items: center;
  min-height: 34px;
  padding: 0 12px;
  color: var(--blue);
  background: #f7f9fb;
  border: 1px solid #d6e0e8;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  text-align: center;
}

.menu-button:hover {
  border-color: var(--blue);
}

.viewer-mode .toolbar {
  max-width: min(100%, 820px);
}

.viewer-mode .brand {
  display: none;
}

.studio-mode .view-toggle {
  display: none;
}

.studio-mode .support-row {
  grid-template-columns: minmax(260px, 360px) auto;
  justify-content: center;
}

.viewer-mode .passage-row {
  grid-template-columns: 38px minmax(170px, 1fr) 74px 74px 38px;
}

.viewer-mode .toolbar-range-controls,
.viewer-mode .toolbar-menu {
  display: none;
}

.viewer-mode .support-row {
  grid-template-columns: minmax(260px, 360px);
  justify-content: center;
}

.file-button input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.icon-button {
  width: 38px;
  padding: 0;
  font-size: 1.35rem;
  line-height: 1;
}

.content {
  width: min(100%, 1080px);
  margin: 0 auto;
  padding: 28px 28px 58px;
}

.teacher-panel,
.scripture-panel,
.chapter-notes,
.manuscript-panel,
.import-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.scripture-panel {
  display: grid;
  gap: 16px;
  margin-bottom: 24px;
  padding: 28px;
  border-top: 5px solid var(--blue);
}

.scripture-text {
  margin: 0;
  color: var(--ink);
  font-family: Lora, Georgia, serif;
  font-size: max(10pt, calc(clamp(1.22rem, 2vw, 1.55rem) * var(--scripture-scale, 1)));
  line-height: 1.78;
}

.scripture-tools {
  display: flex;
  align-items: center;
  gap: 12px;
}

.text-size-controls {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  background: #f7f9fb;
  border: 1px solid #dce3e9;
  border-radius: 999px;
}

.text-size-button {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: var(--blue);
  background: white;
  border: 0;
  border-radius: 50%;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
}

.text-size-button:hover {
  color: white;
  background: var(--blue);
}

.teacher-panel {
  display: grid;
  gap: 18px;
  margin-bottom: 24px;
  padding: 28px;
  border-top: 5px solid var(--gold);
}

.hidden {
  display: none;
}

.teacher-panel.hidden,
.utility-actions.hidden,
.chapter-notes.hidden,
.import-panel.hidden {
  display: none;
}

.editor-header,
.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.section-heading h3,
.editor-header h3 {
  color: var(--blue);
  font-size: 1.35rem;
  font-weight: 500;
}

.save-status,
#filterSummary,
#scriptureStatus {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
}

.save-status.confirmed {
  color: #2f7d4a;
  font-weight: 700;
}

.related-range-panel {
  display: grid;
  gap: 12px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.related-range-panel.hidden {
  display: none;
}

.related-range-list {
  display: grid;
  gap: 10px;
}

.related-range-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  text-align: left;
  background: #fbfcfd;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.related-range-button {
  justify-self: start;
  min-height: 32px;
  padding: 0 12px;
  color: var(--blue);
  background: white;
  border: 1px solid #d6e0e8;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 650;
}

.related-range-button:hover {
  color: white;
  background: var(--blue);
  border-color: var(--blue);
}

.chapter-notes {
  padding: 28px;
}

.manuscript-panel {
  display: grid;
  gap: 18px;
  margin-top: 24px;
  padding: 28px;
  border-top: 5px solid var(--blue);
}

.manuscript-panel.hidden {
  display: none;
}

.manuscript-frame {
  width: 100%;
  min-height: 680px;
  background: #f4f7fa;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.import-panel {
  display: grid;
  gap: 16px;
  margin-bottom: 24px;
  padding: 28px;
  border-top: 5px solid var(--blue);
  text-align: left;
}

.import-warnings {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  color: #6b4d10;
  background: #fff8e8;
  border: 1px solid #ead39a;
  border-radius: 8px;
  font-size: 0.86rem;
}

.import-warnings.hidden {
  display: none;
}

.import-warnings p {
  margin: 0;
}

.import-list {
  display: grid;
  gap: 8px;
}

.import-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  background: #fbfcfd;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.import-card.skipped {
  opacity: 0.68;
}

.import-card h4 {
  margin: 0 0 3px;
  color: var(--ink);
  font-size: 0.94rem;
  font-weight: 650;
}

.import-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.notes-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.note-card {
  padding: 20px 0;
  background: white;
  border-top: 1px solid var(--line);
  border-radius: 0;
}

.note-card h4 {
  margin: 0 0 10px;
  color: var(--blue);
  font-size: 1.12rem;
  font-weight: 600;
}

.overview-card {
  margin-bottom: 8px;
  padding: 22px;
  background: #f7f9fb;
  border: 1px solid var(--line);
  border-top: 5px solid var(--gold);
  border-radius: 8px;
}

.chapter-divider {
  margin: 18px 0 4px;
  color: var(--gold);
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.note-card p {
  margin: 0;
  color: var(--ink);
  line-height: 1.66;
  white-space: pre-wrap;
}

.note-scripture {
  margin: 0 0 12px;
  color: #52616d;
  font-family: Lora, Georgia, serif;
  font-size: 1rem;
  line-height: 1.62;
}

.note-body {
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--ink);
  font-weight: 400;
  line-height: 1.66;
}

.note-body.no-divider {
  padding-top: 0;
  border-top: 0;
}

.note-body h5 {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 700;
}

.note-body p,
.note-body blockquote,
.note-body ul,
.note-body ol {
  margin: 0 0 12px;
}

.note-body blockquote {
  padding-left: 14px;
  color: #52616d;
  border-left: 3px solid var(--gold);
  font-style: italic;
}

.note-body ul,
.note-body ol {
  padding-left: 22px;
}

.note-body li {
  margin: 4px 0;
  line-height: 1.66;
}

.note-body > :last-child {
  margin-bottom: 0;
}

.chapter-link-button {
  min-height: 34px;
  margin-top: 14px;
  padding: 0 14px;
  color: var(--blue);
  background: white;
  border: 1px solid #d6e0e8;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
}

.chapter-link-button:hover {
  color: white;
  background: var(--blue);
  border-color: var(--blue);
}

.bibleref,
.rtBibleRef {
  color: var(--blue);
  font-style: normal;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: rgba(54, 115, 183, 0.35);
  text-underline-offset: 3px;
  cursor: pointer;
}

.note-meta {
  display: inline-flex;
  align-items: center;
  margin-top: 13px;
  padding: 5px 10px;
  color: white;
  background: var(--gold);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
}

.empty-state {
  padding: 34px;
  color: var(--muted);
  text-align: center;
  background: var(--mist);
  border: 1px dashed #cbd7e1;
  border-radius: 8px;
}

@media (max-width: 1080px) {
  .toolbar {
    max-width: 720px;
  }

  .support-row {
    grid-template-columns: minmax(250px, 1fr) minmax(200px, 0.9fr) auto;
  }

  .toolbar-menu summary {
    padding: 0 12px;
  }

  .viewer-mode .support-row {
    grid-template-columns: minmax(260px, 360px);
  }

  .studio-mode .support-row {
    grid-template-columns: minmax(250px, 1fr) auto;
  }
}

@media (max-width: 620px) {
  .top-bar,
  .content,
  .scripture-panel,
  .teacher-panel,
  .chapter-notes,
  .manuscript-panel,
  .import-panel {
    padding: 18px 14px;
  }

  .top-bar {
    gap: 14px;
  }

  .brand {
    min-width: 0;
  }

  .brand h1 {
    font-size: 1.85rem;
  }

  .toolbar {
    max-width: none;
    padding: 8px;
  }

  .passage-row {
    grid-template-columns: 36px minmax(54px, 0.55fr) minmax(54px, 0.55fr) 36px;
    gap: 8px;
  }

  .book-field {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .chapter-field {
    grid-column: 2;
    grid-row: 2;
  }

  .verse-field {
    grid-column: 3;
    grid-row: 2;
  }

  #previousButton {
    grid-column: 1;
    grid-row: 2;
    justify-self: stretch;
    margin-right: 0;
  }

  #nextButton {
    grid-column: 4;
    grid-row: 2;
    justify-self: stretch;
    margin-left: 0;
  }

  .support-row {
    grid-template-columns: minmax(245px, 1fr) auto;
    gap: 6px;
  }

  .toolbar-range-controls {
    grid-template-columns: minmax(0, 1fr) 58px;
    gap: 4px;
  }

  .support-row:has(#rangeEndField:not(.hidden)) {
    grid-template-columns: minmax(290px, 1.2fr) auto;
  }

  .support-row:has(#rangeEndField:not(.hidden)) .toolbar-search {
    display: none;
  }

  .toolbar-range-controls #rangeEndField {
    width: 58px;
  }

  .view-button,
  .range-button {
    min-height: 28px;
    padding: 0 5px;
    font-size: 0.68rem;
  }

  .toolbar-menu summary {
    min-height: 32px;
    padding: 0 10px;
    font-size: 0.72rem;
  }

  .viewer-mode .support-row {
    grid-template-columns: minmax(245px, 1fr);
  }

  .viewer-mode .passage-row,
  .studio-mode .passage-row {
    grid-template-columns: 36px minmax(54px, 0.55fr) minmax(54px, 0.55fr) 36px;
  }

  .studio-mode .support-row {
    grid-template-columns: minmax(235px, 1fr) auto;
  }

  select,
  input,
  .primary-button,
  .accent-button,
  .danger-button,
  .secondary-button,
  .icon-button {
    min-height: 36px;
    height: 36px;
  }

  .import-card {
    align-items: flex-start;
    flex-direction: column;
  }

}

/* Embedded in the AFL site and protected admin workspace. */
body {min-height:0;background:#fff;} .app-shell {max-width:none;margin:0;padding:12px;} .brand {display:none;} #logoutButton {display:none;} #platformError {padding:12px;background:#fff4e0;color:#753a00;} .topbar {padding-top:0;}

.app-shell {min-height:0;} .top-bar {position:static;padding-top:12px;}

/* Match the host site's editorial type while preserving reader scaling controls. */
.note-body {font-family:Lora,Georgia,serif;line-height:1.8}
.note-body p {line-height:1.8}
.note-body h2,.note-body h3,.note-body h4,.note-body h5 {font-family:Lora,Georgia,serif;color:var(--blue-dark)}
.note-scripture,.note-body blockquote {color:var(--ink)}

/* Match the public site's reading hierarchy while preserving study controls. */
#scriptureTitle,#editorTitle,#listTitle,.note-body h2,.note-body h3,.note-body h4{font-family:Lora,Georgia,serif;color:var(--blue-dark)}
.panel,.scripture-panel,.commentary-panel{border-color:var(--line);border-radius:8px;box-shadow:var(--shadow)}
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible{outline-color:var(--blue)}

.eyebrow{font-size:12px;color:var(--blue-dark)}
