:root {
    --bg: #f5f7f3;
    --surface: #ffffff;
    --border: #dde3d8;
    --text: #2a3028;
    --text-muted: #6b7364;
    --accent: #4a6741;
    --accent-light: #5b7b4f;
    --gold: #8b7d4a;
    --gold-light: #f0ecdc;
    --evangelistic: #3d6b4f;
    --evangelistic-bg: #eef4ef;
    --prophetic: #6b4a7a;
    --prophetic-bg: #f4eff7;
    --shepherdly: #8b5e3c;
    --shepherdly-bg: #faf3eb;
    --priestly: #6b4a7a;
    --priestly-bg: #f4eff7;
    --sunday-school: #c07830;
    --sunday-school-bg: #fdf6ef;
    --play: #7a4a6b;
    --play-bg: #f7eff4;
    --sidebar-w: 280px;
    --radius: 8px;
  }
  * { margin: 0; padding: 0; box-sizing: border-box; }
  body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Georgia", "Times New Roman", serif;
    background: var(--bg);
    color: var(--text);
    display: flex;
    min-height: 100vh;
  }
  .sidebar {
    width: var(--sidebar-w);
    background: #1c2319;
    color: #c4cebc;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    overflow-y: auto;
    z-index: 10;
  }
  .sidebar-header {
    padding: 28px 24px 20px;
    border-bottom: 1px solid #2a3326;
  }
  .sidebar-header h1 {
    font-size: 1.15rem;
    font-weight: 600;
    color: #8fa87a;
    letter-spacing: 0.03em;
    line-height: 1.4;
  }
  .sidebar-header .subtitle {
    font-size: 0.72rem;
    color: #6b7a5e;
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
  }
  .lang-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    padding: 6px 12px;
    border: 1px solid #3a4a32;
    border-radius: 4px;
    background: #26301f;
    color: #b8c9a0;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.72rem;
    transition: all 0.15s;
    width: 100%;
  }
  .lang-toggle:hover {
    background: #2e3a26;
    border-color: #8fa87a;
  }
  .lang-flag { font-size: 1rem; }
  .sidebar-nav { flex: 1; padding: 12px 0; }
  .sidebar-nav .year-group { margin-bottom: 4px; }
  .sidebar-nav .year-label {
    padding: 10px 24px 6px;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #5a6b4e;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
  }
  .sidebar-nav .year-label:hover { color: #8fa87a; }
  .sidebar-nav .month-item {
    display: block;
    padding: 8px 24px 8px 36px;
    font-size: 0.85rem;
    color: #a0ae94;
    text-decoration: none;
    cursor: pointer;
    border-left: 2px solid transparent;
    transition: all 0.15s;
    line-height: 1.4;
  }
  .sidebar-nav .month-item:hover {
    color: #d4dccc;
    background: rgba(255,255,255,0.03);
  }
  .sidebar-nav .month-item.active {
    color: #b8c9a0;
    border-left-color: #8fa87a;
    background: rgba(143,168,122,0.08);
  }
  .sidebar-footer {
    padding: 16px 24px;
    font-size: 0.68rem;
    color: #4a5a3e;
    border-top: 1px solid #252e20;
  }
  .main {
    margin-left: var(--sidebar-w);
    flex: 1;
    padding: 40px 48px;
    max-width: 920px;
  }
  .teaching-header { margin-bottom: 28px; }
  .teaching-header .badge {
    display: inline-block;
    padding: 4px 12px;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: #e8ede2;
    color: #5b7b4f;
    border-radius: 4px;
    margin-bottom: 10px;
    font-weight: 500;
  }
  .teaching-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #2a3824;
    line-height: 1.3;
  }
  .teaching-header .meta { font-size: 0.8rem; color: var(--text-muted); margin-top: 6px; }
  .scripture-refs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 24px; }
  .scripture-refs span {
    font-size: 0.73rem;
    background: #eef2ea;
    color: #4a5e3e;
    padding: 3px 10px;
    border-radius: 4px;
    font-family: "SF Mono", "Fira Code", "Consolas", monospace;
    cursor: pointer;
    transition: background 0.15s;
    border: 1px solid transparent;
  }
  .scripture-refs span:hover {
    background: #dde6d4;
    border-color: #a0b890;
  }
  .ref-link {
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
  }
  .teaching-body {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px 32px;
    margin-bottom: 32px;
    line-height: 1.85;
    font-size: 0.93rem;
    white-space: pre-wrap;
    color: #3a4036;
  }
  .meanings-section { margin-top: 8px; }
  .meaning-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 0;
  }
  .meaning-tab {
    padding: 12px 22px;
    font-size: 0.84rem;
    cursor: pointer;
    border: none;
    background: none;
    color: var(--text-muted);
    font-family: inherit;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.15s;
    font-weight: 500;
  }
  .meaning-tab:hover { color: var(--text); }
  .meaning-tab.active { color: var(--text); font-weight: 600; }
  .meaning-tab.evangelistic.active { color: var(--evangelistic); border-bottom-color: var(--evangelistic); }
  .meaning-tab.prophetic.active { color: var(--prophetic); border-bottom-color: var(--prophetic); }
  .meaning-tab.shepherdly.active { color: var(--shepherdly); border-bottom-color: var(--shepherdly); }
  .meaning-tab.priestly.active { color: var(--priestly); border-bottom-color: var(--priestly); }
  .meaning-tab.sundaySchool.active { color: var(--sunday-school); border-bottom-color: var(--sunday-school); }
  .meaning-tab.play.active { color: var(--play); border-bottom-color: var(--play); }
  .meaning-panel {
    display: none;
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    padding: 28px 32px;
  }
  .meaning-panel.active { display: block; }
  .meaning-panel h3 {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
  }
  .meaning-panel.evangelistic h3 { color: var(--evangelistic); }
  .meaning-panel.prophetic h3 { color: var(--prophetic); }
  .meaning-panel.shepherdly h3 { color: var(--shepherdly); }
  .meaning-panel.priestly h3 { color: var(--priestly); }
  .meaning-panel.sundaySchool h3 { color: var(--sunday-school); }
  .meaning-panel.play h3 { color: var(--play); }
  .service-card {
    background: #fafbf9;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
    margin-bottom: 14px;
    transition: box-shadow 0.15s;
  }
  .service-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  }
  .service-card h4 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .service-card .service-icon {
    width: 8px; height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
  }
  .service-card.evangelistic .service-icon { background: var(--evangelistic); }
  .service-card.evangelistic h4 { color: var(--evangelistic); }
  .service-card.prophetic .service-icon { background: var(--prophetic); }
  .service-card.prophetic h4 { color: var(--prophetic); }
  .service-card.shepherdly .service-icon { background: var(--shepherdly); }
  .service-card.shepherdly h4 { color: var(--shepherdly); }
  .service-card.priestly .service-icon { background: var(--priestly); }
  .service-card.priestly h4 { color: var(--priestly); }
  .service-card.sundaySchool .service-icon { background: var(--sunday-school); }
  .service-card.sundaySchool h4 { color: var(--sunday-school); }
  .service-card.play .service-icon { background: var(--play); }
  .service-card.play h4 { color: var(--play); }
  .service-card .service-text { font-size: 0.87rem; line-height: 1.75; color: #4a5044; }
  .service-card .service-scriptures { margin-top: 12px; font-size: 0.76rem; color: var(--text-muted); font-style: italic; }
  .pdf-download-btn {
    display: inline-block;
    padding: 8px 20px;
    margin-bottom: 20px;
    background: var(--play);
    color: #fff;
    border: none;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.82rem;
    cursor: pointer;
    transition: background 0.15s;
  }
  .pdf-download-btn:hover {
    background: #5e3a52;
  }
  .service-card .service-application {
    margin-top: 10px;
    padding: 12px 16px;
    background: #fdfdfc;
    border-left: 3px solid #8b7d4a;
    font-size: 0.82rem;
    color: #5a5440;
    border-radius: 0 4px 4px 0;
  }
  .empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
  .empty-state .icon { font-size: 2.5rem; margin-bottom: 16px; }

  /* ── Scripture Modal ── */
  .scripture-modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.45);
    z-index: 100;
    justify-content: center;
    align-items: center;
  }
  .scripture-modal-overlay.active { display: flex; }
  .scripture-modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 28px 32px;
    max-width: 620px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  }
  .scripture-modal h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #2a3824;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
  }
  .scripture-modal .verse {
    margin-bottom: 12px;
    line-height: 1.7;
    font-size: 0.9rem;
    color: #3a4036;
  }
  .scripture-modal .verse .vnum {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-right: 6px;
    vertical-align: super;
  }
  .scripture-modal .close-btn {
    display: inline-block;
    margin-top: 16px;
    padding: 8px 20px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.82rem;
    color: var(--text-muted);
    transition: all 0.15s;
  }
  .scripture-modal .close-btn:hover {
    background: var(--bg);
    color: var(--text);
  }
  .scripture-modal .error {
    color: #a04040;
    font-size: 0.85rem;
  }

  @media (max-width: 768px) {
    .sidebar { width: 100%; position: relative; height: auto; }
    .main { margin-left: 0; padding: 24px 16px; }
    body { flex-direction: column; font-size: 15px; }
    .sidebar-header { padding: 14px 16px 10px; }
    .sidebar-header h1 { font-size: 1rem; }
    .sidebar-nav { padding: 6px 0; }
    .sidebar-nav .year-label { padding: 6px 16px; }
    .sidebar-nav .month-item {
      padding: 10px 16px 10px 24px;
      font-size: 0.92rem;
      min-height: 44px;
      display: flex;
      align-items: center;
    }
    .sidebar-footer { padding: 10px 16px; font-size: 0.65rem; }
    .teaching-header h2 { font-size: 1.3rem; }
    .teaching-body { padding: 18px 16px; font-size: 0.88rem; }
    .meaning-tabs {
      flex-wrap: nowrap;
      overflow-x: auto;
      -webkit-overflow-scrolling: touch;
    }
    .meaning-tab {
      padding: 10px 14px;
      font-size: 0.8rem;
      white-space: nowrap;
      flex-shrink: 0;
    }
    .meaning-panel { padding: 18px 16px; }
    .service-card { padding: 14px 16px; }
    .service-card h4 { font-size: 0.9rem; }
    .service-card .service-text { font-size: 0.84rem; }
    .service-card .service-application { font-size: 0.8rem; padding: 8px 10px; }
    .scripture-refs span { font-size: 0.7rem; padding: 2px 6px; }
  }