/* ===========================================================================
   ScripturesNote — stylesheet
   =========================================================================== */

:root {
    --green: #4a5d3a;
    --rust:  #b5651d;
    --ink:   #2c2c2c;
    --paper: #faf9f5;
    --edge:  #e0ddd5;
    --muted: #888;
}

* { box-sizing: border-box; }

body {
    font-family: Georgia, 'Times New Roman', serif;
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px 60px;
    color: var(--ink);
    line-height: 1.6;
    background: #fff;
}

/* --- Navigation ---------------------------------------------------------- */
.mainnav {
    display: flex; justify-content: space-between; align-items: center;
    flex-wrap: wrap; gap: 10px;
    padding: 16px 0; margin-bottom: 28px;
    border-bottom: 1px solid var(--edge);
    /* Stay pinned to the top while scrolling (turned off on phones below). */
    position: sticky; top: 0; z-index: 1000;
    background: var(--paper, #f7f5f0);
}
.mainnav .brand {
    font-size: 1.3em; font-weight: bold; color: var(--green);
    text-decoration: none; letter-spacing: .5px;
}
.navlinks a {
    color: var(--green); text-decoration: none;
    margin-left: 16px; font-size: .92em;
}
.navlinks a:hover { text-decoration: underline; }
.navlinks .cta {
    background: var(--green); color: #fff;
    padding: 6px 14px; border-radius: 4px;
}
.navlinks .cta:hover { text-decoration: none; background: #3d4d30; }
.admin-link { color: #a33 !important; font-weight: bold; }

/* Hamburger toggle — hidden on desktop, shown on small screens */
.nav-toggle {
    display: none; flex-direction: column; justify-content: center; gap: 5px;
    width: 42px; height: 38px; padding: 0; margin: 0;
    background: none; border: 1px solid var(--edge); border-radius: 6px;
    cursor: pointer;
}
.nav-toggle span {
    display: block; width: 22px; height: 2px; margin: 0 auto;
    background: var(--green); transition: transform .2s ease, opacity .2s ease;
}
.nav-toggle.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.is-open span:nth-child(2) { opacity: 0; }
.nav-toggle.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* --- Marketing pages ----------------------------------------------------- */
.hero { text-align: center; padding: 40px 0 30px; }
.hero h1 { font-size: 2.4em; margin: 0 0 12px; }
.lead { font-size: 1.15em; color: #555; max-width: 660px; margin: 0 auto 24px; }

.btn-primary, .btn-secondary {
    display: inline-block; padding: 11px 26px;
    border-radius: 5px; text-decoration: none; margin: 6px;
}
.btn-primary   { background: var(--green); color: #fff; }
.btn-primary:hover { background: #3d4d30; }
.btn-secondary { background: #fff; color: var(--green); border: 1px solid var(--green); }
.btn-secondary:hover { background: var(--paper); }

.screenshot-frame {
    background: var(--paper); border: 1px solid var(--edge);
    border-radius: 8px; padding: 14px; margin: 28px 0;
}
.screenshot-frame img { width: 100%; display: block; border-radius: 4px; }
.caption {
    font-size: .85em; color: var(--muted); text-align: center;
    margin: 10px 0 0; font-style: italic;
}

.three-up { display: flex; gap: 24px; flex-wrap: wrap; margin: 36px 0; }
.feature { flex: 1; min-width: 220px; }
.feature h2 { font-size: 1.15em; border: none; color: var(--green); margin-bottom: 6px; }

.explainer, .doc-section { margin: 36px 0; }
.cta-band {
    background: var(--paper); border-left: 4px solid var(--green);
    padding: 24px; border-radius: 6px; margin: 36px 0; text-align: center;
}
.cta-band h2 { border: none; margin-top: 0; }

/* --- FAQ ----------------------------------------------------------------- */
.faq-list { margin: 16px 0 28px; }
.faq-item { border-bottom: 1px solid var(--edge); padding: 12px 0; }
.faq-item summary { cursor: pointer; font-weight: bold; color: var(--green); }
.faq-item summary:hover { text-decoration: underline; }
.faq-item p { margin: 10px 0 0; color: #555; }

/* --- Headings and text --------------------------------------------------- */
h1 { margin: 14px 0; }
h2 { border-bottom: 1px solid var(--edge); padding-bottom: 4px; margin-top: 32px; }
h3 { color: #555; margin: 18px 0 6px; }
.vol { font-size: .85em; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.message { color: #b00; font-weight: bold; }
.message.success { color: #2f7d32; }
.success { color: #2f7d32; }
.empty { color: #999; font-style: italic; }
.count { font-size: .7em; color: var(--muted); font-weight: normal; }
.search-hint { color: #999; font-style: italic; margin-top: 16px; }
.small { font-size: .85em; color: var(--muted); }
.field-hint { font-size: .85em; color: var(--muted); margin: 4px 0 0 122px; }

/* --- Auth pages ---------------------------------------------------------- */
.auth-wrap { max-width: 540px; margin: 0 auto; }
.auth-alt { text-align: center; font-size: .9em; margin-top: 14px; }
.auth-alt a { color: var(--green); }
.lockout-note {
    background: #fdf3f3; border-left: 4px solid #a33;
    padding: 14px 18px; border-radius: 4px; color: #633;
}
.lockout-note a { color: #a33; }

/* --- Forms --------------------------------------------------------------- */
form { background: #f7f5f0; padding: 22px; border-radius: 8px; margin: 18px 0; }
.field-row { display: flex; align-items: center; gap: 12px; margin: 12px 0; }
.field-row label {
    font-weight: bold; width: 110px; flex: 0 0 auto;
    text-align: right; margin: 0;
}
.field-row input, .field-row select {
    flex: 1; padding: 9px; font-family: inherit; font-size: 1em;
    border: 1px solid #ccc; border-radius: 3px;
}
.field-row input:disabled { background: #eee; color: #777; }
.field-row-top { align-items: flex-start; }
.field-row-top label { padding-top: 9px; }
.field-row textarea {
    flex: 1; height: 110px; padding: 9px;
    font-family: inherit; font-size: 1em;
    border: 1px solid #ccc; border-radius: 3px;
}
.cv-row .cv-input { flex: 0 0 auto; width: 70px; text-align: center; }
.cv-row #verseLabel, .cv-row label[for="ref_verse"] { width: auto; }
.cv-colon { font-size: 1.4em; font-weight: bold; color: var(--green); }
/* When the chapter is hidden (Doctrine and Covenants), the verse label becomes
   the first item in the row — give it the same label-column width so the verse
   lines up under Volume and Section above it instead of drifting left. Covers
   both the Add page (#verseLabel) and the view page reference form (ref_verse). */
.cv-row.dc-mode #verseLabel,
.cv-row.dc-mode label[for="ref_verse"] {
    width: 110px; flex: 0 0 auto; text-align: right;
}

.captcha-row { align-items: flex-start; }
.captcha-row label { padding-top: 20px; }
.captcha-row .g-recaptcha { flex: 0 0 auto; }

button {
    margin-top: 14px; padding: 10px 22px;
    background: var(--green); color: #fff; border: none;
    border-radius: 4px; cursor: pointer; font-size: 1em;
    font-family: inherit;
}
button:hover { background: #3d4d30; }
.small-btn { margin-top: 8px; padding: 4px 12px; font-size: .85em; }
.danger-btn { background: #a33; }
.danger-btn:hover { background: #922; }
.delete-form { background: none; padding: 0; margin-top: 10px; }
.inline-form { background: none; padding: 0; margin: 0; display: inline; }
.inline-form button { margin-top: 0; }
.link-btn {
    background: none; color: var(--rust); border: none;
    padding: 0 0 0 8px; font-size: .8em; cursor: pointer;
    text-decoration: underline; margin: 0;
}
.link-btn:hover { background: none; color: #922; }
.rel-note-input { display: block; width: 100%; margin-top: 6px; padding: 6px;
                  border: 1px solid #ccc; border-radius: 3px; font-family: inherit; }
.inline-attach { background: none; padding: 0; margin: 0; }

/* --- Search bar ---------------------------------------------------------- */
.search { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.search input[type="text"] {
    flex: 1; min-width: 200px; padding: 9px;
    border: 1px solid #ccc; border-radius: 3px; font-family: inherit; font-size: 1em;
}
.search select { padding: 9px; border: 1px solid #ccc; border-radius: 3px;
                 font-family: inherit; font-size: 1em; }
.search button { margin-top: 0; }
.clear { color: var(--rust); text-decoration: none; }
.result-count { color: #666; font-size: .9em; margin: 8px 0 12px; }

/* --- Stat bar ------------------------------------------------------------ */
.stat-row {
    display: flex; gap: 22px; flex-wrap: wrap;
    background: var(--paper); padding: 14px 18px;
    border-radius: 6px; margin-bottom: 20px;
}
.stat { font-size: .9em; color: #666; }
.stat strong { color: var(--green); font-size: 1.2em; }
.stat a { color: var(--green); text-decoration: none; }

/* --- Verse display ------------------------------------------------------- */
.verse-text {
    font-size: 1.15em; background: var(--paper);
    padding: 18px; border-left: 4px solid var(--green); border-radius: 4px;
}
.vnum { color: var(--green); font-weight: bold; margin-right: 4px; }

.verse-list { list-style: none; padding-left: 0; }
.verse-item { padding: 6px 0; border-bottom: 1px dotted #eee; }
.verse-head { display: flex; align-items: baseline; gap: 10px; }
.verse-head .ref {
    color: var(--green); font-weight: bold; text-decoration: none;
    flex: 0 0 64px; text-align: right;
}
.verse-head .preview {
    color: var(--muted); font-size: .9em; flex: 1;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.badge {
    background: var(--rust); color: #fff; font-size: .7em;
    padding: 1px 7px; border-radius: 8px; flex: 0 0 auto; align-self: center;
}
.note-gist {
    margin: 3px 0 0 74px; font-size: .85em;
    color: #6a6a6a; font-style: italic; line-height: 1.4;
}

/* --- Notes and links ----------------------------------------------------- */
.notes-list li { margin: 8px 0; }
.links-list { list-style: none; padding-left: 0; }
.links-list li { padding: 9px 0; border-bottom: 1px dotted #eee; }
.links-list a { color: var(--green); font-weight: bold; text-decoration: none; }
.links-list a:hover { text-decoration: underline; }
.reverse-tag {
    font-size: .7em; background: var(--rust); color: #fff;
    padding: 1px 6px; border-radius: 8px; margin-left: 6px;
}
.link-note {
    font-size: .9em; color: #666; margin-top: 3px;
    padding-left: 10px; border-left: 2px solid var(--edge);
}

/* --- Adages -------------------------------------------------------------- */
.adage-box {
    background: #f7f5f0; padding: 6px 18px 14px;
    border-radius: 8px; margin: 16px 0;
}
.adage-box h2 { margin-top: 14px; }
.adage-result { padding: 10px 0; border-bottom: 1px dotted var(--edge); }
.adage-head {
    display: flex; justify-content: space-between;
    align-items: baseline; gap: 10px; flex-wrap: wrap;
}
.adage-title {
    color: var(--green); font-weight: bold;
    text-decoration: none; font-size: 1.05em;
}
.adage-title:hover { text-decoration: underline; }
.adage-meta { font-size: .8em; color: #999; }
.adage-snippet { margin-top: 4px; font-size: .9em; color: #555; line-height: 1.4; }
.adage-card {
    background: var(--paper); border-left: 4px solid var(--green);
    border-radius: 4px; padding: 16px 20px; margin: 14px 0;
}
.adage-card p { margin: 6px 0; }
.adage-full { font-size: 1.2em; line-height: 1.6; margin-bottom: 16px; }
.adage-label { font-weight: bold; color: var(--green); }
.adage-intro {
    background: #e8e6e0; padding: 16px 20px;
    border-radius: 6px; margin-bottom: 20px;
}

.edit-link {
    font-size: .8em; color: var(--rust);
    text-decoration: none; display: inline-block; margin-top: 4px;
}
.edit-link:hover { text-decoration: underline; }
.action-row { margin-top: 20px; }
.action-row a { color: var(--green); text-decoration: none; }
.meta-line { font-size: .8em; color: #999; margin-top: 24px; }
.meta-line a { color: var(--green); }
mark { background: #f5e08c; color: inherit; padding: 0 1px; border-radius: 2px; }

/* --- Admin --------------------------------------------------------------- */
.admin-badge {
    display: inline-block; background: #a33; color: #fff;
    font-size: .5em; padding: 3px 9px; border-radius: 8px;
    letter-spacing: .5px; text-transform: uppercase; vertical-align: middle;
}
.admin-table { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: .9em; }
.admin-table th {
    text-align: left; border-bottom: 2px solid var(--edge);
    padding: 8px 6px; color: var(--green);
}
.admin-table td { border-bottom: 1px dotted #eee; padding: 8px 6px; vertical-align: middle; }
.admin-table a { color: var(--green); }
.pill { display: inline-block; font-size: .75em; padding: 2px 9px; border-radius: 9px; }
.pill-ok  { background: #e3f0e3; color: #2f7d32; }
.pill-bad { background: #fdeaea; color: #a33; }
.user-card {
    background: var(--paper); border-left: 4px solid var(--green);
    padding: 16px 20px; border-radius: 4px; margin: 14px 0;
}
.user-card h3 { margin: 0 0 8px; }

/* --- Footer -------------------------------------------------------------- */
.sitefooter { border-top: 1px solid var(--edge); margin-top: 60px; padding-top: 24px; }
.footcols { display: flex; gap: 40px; flex-wrap: wrap; }
.footcols a {
    display: block; color: var(--green);
    text-decoration: none; font-size: .9em; margin: 4px 0;
}
.footcols a:hover { text-decoration: underline; }
.copyright { text-align: center; margin-top: 24px; }

/* --- Responsive ---------------------------------------------------------- */
@media (max-width: 600px) {
    .nav-toggle { display: flex; }
    .mainnav { flex-wrap: nowrap; position: static; }
    .navlinks {
        display: none;
        flex-basis: 100%; width: 100%;
        flex-direction: column; align-items: stretch;
        margin-top: 12px;
    }
    .navlinks.is-open { display: flex; }
    .navlinks a {
        margin: 0; padding: 12px 6px; font-size: 1.05em;
        border-bottom: 1px solid var(--edge);
    }
    .navlinks a:last-child { border-bottom: none; }
    .navlinks .cta {
        margin-top: 8px; text-align: center; border-radius: 4px;
        border-bottom: none;
    }
    .navlinks .inbox-link { display: flex; align-items: center; gap: 6px; }
    .field-row { flex-direction: column; align-items: stretch; }
    .field-row label { width: auto; text-align: left; }
    .field-hint { margin-left: 0; }
    .cv-row { flex-direction: row; align-items: center; flex-wrap: wrap; }
    .cv-row label { width: auto; }
    .three-up { flex-direction: column; }
    .hero h1 { font-size: 1.8em; }
    .navlinks a { margin-left: 0; margin-right: 12px; display: inline-block; }
    .note-gist { margin-left: 0; }
    .g-recaptcha { transform: scale(0.85); transform-origin: 0 0; }
}

/* --- Sharing ------------------------------------------------------------- */
.inbox-link { position: relative; }
.nav-badge {
    display: inline-block; background: var(--rust); color: #fff;
    font-size: .7em; font-weight: bold; line-height: 1;
    padding: 2px 6px; border-radius: 9px; margin-left: 3px; vertical-align: top;
}
.share-panel {
    background: #f7f5f0; border: 1px solid var(--edge);
    border-radius: 8px; padding: 12px 18px; margin: 16px 0;
}
.share-panel summary {
    cursor: pointer; font-weight: bold; color: var(--green);
}
.share-panel summary:hover { text-decoration: underline; }
.share-panel form { background: none; padding: 10px 0 0; margin: 0; }
.inbox-banner {
    background: #fff6ec; border-left: 4px solid var(--rust);
    padding: 12px 16px; border-radius: 4px; margin: 14px 0;
}
.inbox-banner a { color: var(--rust); font-weight: bold; }

/* --- Admin tool cards ---------------------------------------------------- */
.admin-cards {
    display: flex; gap: 12px; flex-wrap: wrap; margin: 14px 0 26px;
}
.admin-card {
    flex: 1; min-width: 200px;
    display: flex; flex-direction: column; gap: 4px;
    background: #f7f5f0; border: 1px solid var(--edge);
    border-left: 4px solid var(--green);
    border-radius: 6px; padding: 12px 16px;
    text-decoration: none; color: inherit;
    transition: background .12s ease;
}
.admin-card:hover { background: #efece4; }
.admin-card-title { font-weight: bold; color: var(--green); }
.admin-card-desc { font-size: .85em; color: #666; line-height: 1.4; }
.admin-card.is-current {
    background: #fff; border-left-color: var(--rust); cursor: default;
}
.admin-card.is-current .admin-card-title { color: var(--rust); }
.admin-card-danger { border-left-color: #a33; }
.admin-card-danger .admin-card-title { color: #a33; }
.admin-card-danger.is-current { border-left-color: #a33; }
@media (max-width: 700px) {
    .admin-cards { flex-direction: column; }
}

/* --- Registration library offer ------------------------------------------ */
.library-offer {
    background: #fff; border: 1px solid var(--edge);
    border-left: 4px solid var(--green);
    border-radius: 6px; padding: 12px 16px; margin: 14px 0;
}
.checkbox-row { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.checkbox-row input[type="checkbox"] { margin-top: 4px; flex: 0 0 auto; }
.checkbox-row > span { display: flex; flex-direction: column; gap: 3px; }
.checkbox-row .small { color: #666; line-height: 1.4; }

/* --- Library access grant table ------------------------------------------ */
.grant-table td, .grant-table th { vertical-align: middle; }
.grant-table input[type="checkbox"] { transform: scale(1.15); cursor: pointer; }
.grant-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.grant-actions button { margin-top: 0; }

/* --- Inline editing ------------------------------------------------------ */
.inline-edit { display: inline-block; margin-left: 8px; }
.inline-edit > summary {
    cursor: pointer; color: var(--rust); font-size: .8em;
    text-decoration: underline; display: inline;
}
.inline-edit > summary:hover { color: #922; }
.inline-edit form {
    background: #fff; border: 1px solid var(--edge); border-radius: 5px;
    padding: 10px 12px; margin: 8px 0; display: block;
}
.inline-edit textarea {
    width: 100%; min-height: 70px; padding: 8px;
    font-family: inherit; font-size: .95em;
    border: 1px solid #ccc; border-radius: 3px;
}
.inline-edit .inline-form { background: none; border: none; padding: 0; margin: 4px 0 0; }

.edit-panel {
    background: #f7f5f0; border: 1px solid var(--edge);
    border-radius: 6px; padding: 10px 16px; margin: 12px 0 20px;
}
.edit-panel > summary {
    cursor: pointer; font-weight: bold; color: var(--green); font-size: .9em;
}
.edit-panel > summary:hover { text-decoration: underline; }
.edit-panel form { background: none; padding: 10px 0 0; margin: 0; }

.verse-stub { border-left-color: #d9c48a; background: #fdfaf2; }
.stub-note { color: #8a7a4a; font-size: .95em; }

/* --- Keep me signed in --------------------------------------------------- */
.remember-row {
    background: #fff; border: 1px solid var(--edge);
    border-left: 4px solid var(--green);
    border-radius: 6px; padding: 12px 14px; margin: 14px 0;
}

/* --- Definitions & Names of Christ --------------------------------------- */
.entry-list { list-style: none; padding-left: 0; }
.entry-item {
    padding: 10px 0; border-bottom: 1px dotted var(--edge);
}
.entry-item:last-child { border-bottom: none; }
.entry-term {
    font-weight: bold; color: var(--green); text-decoration: none;
    font-size: 1.05em; margin-right: 8px;
}
.entry-term:hover { text-decoration: underline; }
.entry-body { color: #555; }
.entry-definition {
    font-size: 1.1em; line-height: 1.6; border-left: 3px solid var(--green);
    padding-left: 16px; margin: 12px 0 24px;
}
.inline-link-form {
    display: inline-flex; gap: 6px; margin-top: 4px; background: none; padding: 0;
}
.inline-link-form input[type="text"] {
    padding: 4px 8px; border: 1px solid #ccc; border-radius: 3px; font-size: .9em;
}

/* --- Importer preview tables: scroll on narrow screens ------------------- */
@media (max-width: 600px) {
    .preview-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
        font-size: .85em;
    }
    .preview-table thead, .preview-table tbody, .preview-table tr { display: table; width: 100%; }
    /* Study page: tighten spacing and let summary pills wrap comfortably */
    .study-summary { padding: 12px 14px; }
    .summary-pills { gap: 6px; }
    .summary-pill { font-size: .82em; padding: 3px 10px; }
    .study-section h2 { font-size: 1.15em; }
    .verse-text, .study-note p, .study-adage p { font-size: .95em; }
    /* Definitions / names / patterns list items */
    .entry-item { padding: 12px 0; }
    .entry-term { display: inline-block; margin-bottom: 3px; }
    /* Import example code blocks shouldn't force the page wide */
    .import-example code { font-size: .8em; }
}

/* --- Mobile polish pass: tap targets, field widths, share controls ------- */
@media (max-width: 600px) {
    /* Comfortable tap targets (~44px) */
    button, .btn-yes, .btn-no {
        padding: 12px 22px; min-height: 44px; width: 100%;
        box-sizing: border-box; margin-top: 12px;
    }
    .small-btn { width: auto; min-height: 0; padding: 8px 16px; }
    .search button, .study-search button { width: auto; }
    .inline-form button, .inline-link-form button { width: auto; min-height: 0; }
    /* Buttons that sit inline next to a Cancel link shouldn't both be full-width */
    .clear { display: inline-block; margin-top: 12px; padding: 10px 0; }

    /* Inputs and textareas fill the width and are easy to tap */
    input[type="text"], input[type="email"], input[type="password"],
    input[type="date"], textarea, select {
        width: 100%; box-sizing: border-box; font-size: 16px; /* 16px stops iOS zoom */
        padding: 11px 12px;
    }
    .search input[type="text"] { width: 100%; }
    .search-bar { flex-direction: column; gap: 8px; }
    .search-bar button { width: 100%; }

    /* Share-as-image: stack controls above the preview, full width */
    .share-layout { flex-direction: column; }
    .share-controls, .share-preview { width: 100%; box-sizing: border-box; }
    .bg-picker { justify-content: space-between; }
    .format-picker { gap: 6px; }

    /* Tables of content (browse tiles, admin) stack */
    .stat-row { flex-wrap: wrap; gap: 8px 16px; }

    /* Headings a touch smaller so long ones don't wrap awkwardly */
    h1 { font-size: 1.6em; }
}

/* --- Volume selection ---------------------------------------------------- */
.volume-choices {
    display: flex; flex-direction: column; gap: 4px;
    background: #f7f5f0; border: 1px solid var(--edge);
    border-radius: 6px; padding: 14px 18px; margin: 12px 0;
}
.volume-choices .checkbox-row { margin: 0; padding: 5px 0; }
#volumes { scroll-margin-top: 16px; }

/* ===========================================================================
 * Scripture view page — collapsible panels
 * ========================================================================= */
.vpanel {
    border: 1px solid var(--edge); border-radius: 10px;
    margin: 0 0 18px; background: #fff; overflow: hidden;
}
.vpanel-fixed { border-color: var(--green); }
.vpanel-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 20px; background: var(--green); color: #fff;
    cursor: pointer; list-style: none; user-select: none;
}
.vpanel-head-fixed { cursor: default; }
.vpanel-head::-webkit-details-marker { display: none; }
.vpanel-title { font-size: 1.15em; font-weight: bold; }
.vpanel-chevron { transition: transform .2s ease; font-size: 1.1em; }
.vpanel-toggle[open] .vpanel-chevron { transform: rotate(180deg); }
.vpanel-body { padding: 18px 20px 22px; }

.scripture-ref { margin-top: 4px; }

/* Category blocks inside the fixed panel */
.cat { margin: 20px 0 0; padding-top: 6px; }
.cat-head {
    display: flex; align-items: center; gap: 8px;
    font-size: 1.05em; color: var(--ink, #2c2c2c);
    border-bottom: 1px solid var(--edge); padding-bottom: 5px; margin-bottom: 10px;
}
.cat-dot { width: 11px; height: 11px; border-radius: 50%; flex: 0 0 auto; }
.cat-refs   .cat-dot { background: #4a7a9d; }
.cat-indirect .cat-dot { background: #4a7a9d; }
.cat-notes  .cat-dot { background: #c98a2b; }
.cat-adages .cat-dot { background: #8a5a9d; }
.cat-defs   .cat-dot { background: #4a9d6a; }
.cat-names  .cat-dot { background: #a8541c; }
.cat-talks  .cat-dot { background: #5a6e8c; }

/* Add-to-this-page block */
.add-block {
    margin-top: 26px; padding: 16px 18px;
    background: #f7f5f0; border: 1px solid var(--edge); border-radius: 8px;
}
.add-block-title { margin: 0 0 4px; color: var(--green); }
.add-block-intro { margin: 0 0 12px; }
.add-item { border-top: 1px solid var(--edge); padding: 4px 0; }
.add-item:first-of-type { border-top: none; }
.add-item > summary {
    cursor: pointer; padding: 9px 4px; font-weight: bold; color: var(--green);
}
.add-item[open] > summary { margin-bottom: 8px; }
.add-new-box {
    margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--edge);
}

/* --- Add Scripture: paste box and verse range --------------------------- */
.paste-box {
    background: #f2f7ee; border: 1px solid var(--green);
    border-radius: 10px; padding: 14px 18px; margin: 0 0 22px;
}
.paste-label { font-weight: bold; color: var(--green); display: block; }
.paste-hint { margin: 3px 0 10px; }
.paste-input {
    width: 100%; box-sizing: border-box; min-height: 70px;
    padding: 9px 11px; border: 1px solid #ccc; border-radius: 6px;
    font-family: inherit; font-size: 1em;
}
.paste-actions { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.paste-msg { font-size: .88em; color: var(--green); }
.cv-dash { padding: 0 2px; color: #888; }
#verse_end { max-width: 5em; }
.paste-gl {
    margin: 12px 0 0; padding-top: 10px; border-top: 1px dashed var(--edge);
    font-size: .9em; color: #555;
}
.paste-gl .gl-link {
    display: inline-block; background: var(--green); color: #fff;
    padding: 5px 12px; border-radius: 5px; text-decoration: none;
    font-weight: bold; margin: 0 2px;
}
.paste-gl .gl-link:hover { background: #3d4d30; }
.gl-app-line { display: inline-block; margin-left: 8px; color: #777; }
.gl-app-line .gl-app-link { color: var(--green); font-weight: bold; white-space: nowrap; }

/* --- Logos --------------------------------------------------------------- */
.hero-logo {
    display: block; max-width: 340px; width: 100%; height: auto;
    margin: 0 auto 18px;
}
.brand-logo { display: block; height: 34px; width: auto; }
.mainnav .brand { display: inline-flex; align-items: center; }
@media (max-width: 600px) {
    .hero-logo { max-width: 260px; }
    .brand-logo { height: 28px; }
}

/* --- Add Scripture: instructions ---------------------------------------- */
.intro-note { color: #666; margin-top: -4px; }
.paste-format { margin: 10px 0 4px; color: #555; }
.paste-examples { margin: 0 0 10px; padding-left: 20px; color: #555; }
.paste-examples li { margin: 3px 0; }
.paste-examples code {
    background: #fff; border: 1px solid var(--edge); border-radius: 3px;
    padding: 1px 6px; color: var(--green); font-size: .95em;
}

/* Reference paste box inside the view-page add-a-reference form */
.ref-paste-box {
    background: #f2f7ee; border: 1px solid var(--green);
    border-radius: 8px; padding: 12px 14px; margin: 0 0 14px;
}

/* --- Signup tier choice -------------------------------------------------- */
.tier-choice { border: 1px solid var(--edge); border-radius: 8px; padding: 14px 16px; margin: 18px 0; }
.tier-choice legend { font-weight: bold; color: var(--green); padding: 0 6px; }
.tier-option {
    display: flex; align-items: flex-start; gap: 10px; padding: 10px;
    border: 1px solid var(--edge); border-radius: 6px; margin-bottom: 8px; cursor: pointer;
}
.tier-option:hover { background: #f7f5f0; }
.tier-option input { margin-top: 3px; }
.tier-name { font-weight: bold; display: block; }
.tier-desc { font-size: .9em; color: #666; display: block; margin-top: 2px; }

/* --- Front-page showcase (live examples) -------------------------------- */
.showcase { padding: 40px 20px; text-align: center; }
.showcase-intro { max-width: 620px; margin: 0 auto 26px; color: #555; }
.showcase-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px; max-width: 1000px; margin: 0 auto; text-align: left;
}
.showcase-card {
    background: #fff; border: 1px solid var(--edge); border-radius: 10px;
    padding: 16px 18px; border-top: 4px solid var(--green);
}
.sc-scripture { border-top-color: #4a7a9d; }
.sc-adage     { border-top-color: #8a5a9d; }
.sc-def       { border-top-color: #4a9d6a; }
.sc-name      { border-top-color: #a8541c; }
.sc-pattern   { border-top-color: #5a6e8c; }
.sc-tag {
    display: inline-block; font-size: .72em; text-transform: uppercase;
    letter-spacing: 1px; color: #888; margin-bottom: 6px;
}
.sc-ref { display: block; font-weight: bold; color: var(--green); font-size: 1.05em; }
.sc-text { margin: 8px 0 0; color: #333; line-height: 1.5; font-size: .95em; }
.sc-by { display: block; margin-top: 8px; font-style: italic; color: #777; font-size: .9em; }
.showcase-cta { margin-top: 30px; }

/* --- Batch attach: checkbox selection of search results ------------------ */
.batch-attach { background: none; padding: 0; margin: 0; }
.pick-row {
    display: flex; align-items: flex-start; gap: 10px; cursor: pointer;
    padding: 4px 0;
}
.pick-row input[type="checkbox"] { margin-top: 4px; flex: 0 0 auto; }
.pick-body { display: block; }
.batch-attach .links-list { margin: 0 0 12px; }
.batch-attach button { margin-top: 4px; }
#ref_verse_end { max-width: 5em; }

/* --- AI study block ------------------------------------------------------- */
.ai-block { margin: 18px 0; }
.ai-ask-form { background: none; padding: 0; }
.ai-btn {
    background: linear-gradient(135deg, #4a5d3a, #3a6a5d); color: #fff; border: none;
    padding: 11px 20px; border-radius: 8px; font-size: 1em; cursor: pointer;
}
.ai-btn:hover { opacity: .93; }
.ai-disclosure { color: #777; margin: 8px 0 0; max-width: 640px; line-height: 1.5; }
.ai-result {
    background: #f2f7ee; border: 1px solid var(--green); border-left: 4px solid var(--green);
    border-radius: 8px; padding: 16px 20px; margin: 18px 0;
}
.ai-result h2 { margin-top: 0; color: var(--green); }
.ai-result.ai-error { background: #faf4f2; border-color: #c98a2b; border-left-color: #c98a2b; }
.ai-text { line-height: 1.6; white-space: normal; }
.ai-foot { color: #888; margin-top: 12px; font-style: italic; }

/* --- Indirect connections & pattern links --------------------------------- */
.cat-indirect .cat-hint { color: #888; margin: 2px 0 8px; }
.via-tag { font-size: .8em; color: #7a8a6a; background: #eef2e8; padding: 1px 6px;
    border-radius: 3px; margin-left: 6px; }
.cat-patterns .cat-dot { background: #8a6d9a; }

/* --- Admin page cleanup: intro, notes, access panel ---------------------- */
.admin-intro { background: #f2f7ee; border: 1px solid var(--edge); border-radius: 8px;
    padding: 14px 18px; margin: 0 0 22px; }
.admin-intro p { margin: 0 0 8px; line-height: 1.55; }
.admin-intro p:last-child { margin-bottom: 0; }
.section-note { color: #666; font-size: .92em; line-height: 1.5; margin: -6px 0 14px;
    max-width: 680px; }
.access-panel { background: #faf9f6; border: 1px solid var(--edge); border-radius: 8px;
    padding: 14px 16px; margin-top: 14px; }
.access-panel h4 { margin: 0 0 4px; color: var(--green); }
.access-row { display: flex; align-items: center; justify-content: space-between;
    gap: 12px; padding: 8px 0; border-bottom: 1px solid #eee; }
.access-row:last-of-type { border-bottom: none; }
.access-label { font-weight: 600; }
.small-btn.danger { background: #b5432b; }
.small-btn.danger:hover { background: #97361f; }
.pill { display: inline-block; background: #e6e6e6; color: #555; border-radius: 10px;
    padding: 1px 9px; font-size: .8em; font-weight: normal; margin-left: 4px; }
.pill-ok { background: #d6ecd2; color: #2f6d32; }
.pill-bad { background: #f2d2cc; color: #a3311c; }

/* --- Feature switches table ---------------------------------------------- */
.switch-table { width: 100%; border-collapse: collapse; margin: 8px 0 14px;
    background: #faf9f6; border: 1px solid var(--edge); border-radius: 8px; overflow: hidden; }
.switch-table th, .switch-table td { padding: 10px 12px; text-align: left;
    border-bottom: 1px solid #eee; vertical-align: top; }
.switch-table thead th { background: #f2f7ee; color: var(--green); font-size: .9em; }
.switch-table tr:last-child td { border-bottom: none; }
.switch-table .sw-on { width: 42px; text-align: center; }
.switch-table .sw-on input { transform: scale(1.3); }
.switch-table .sw-label { font-weight: 600; white-space: nowrap; }
.switch-table .sw-what { color: #666; font-size: .9em; line-height: 1.45; }
.sw-state { display: inline-block; font-size: .72em; font-weight: normal; margin-left: 6px;
    padding: 1px 7px; border-radius: 9px; vertical-align: middle; }
.sw-state.is-on  { background: #d6ecd2; color: #2f6d32; }
.sw-state.is-off { background: #e6e6e6; color: #777; }
@media (max-width: 560px) { .switch-table .sw-what { display: none; } }

/* --- Install App menu link + instructions dialog ------------------------- */

/* Bottom "Close" button in the install dialog — always visible, easy to tap. */

/* --- Access Grid (users × access types) ---------------------------------- */
.grid-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 10px 0; }
.access-grid { border-collapse: collapse; min-width: 520px; width: 100%;
    background: #fff; border: 1px solid var(--edge); border-radius: 8px; }
.access-grid th, .access-grid td { border: 1px solid #eee; padding: 8px 10px; text-align: center; }
.access-grid thead th { background: #f2f7ee; color: var(--green); font-size: .88em;
    vertical-align: bottom; }
.access-grid .ag-user { text-align: left; white-space: nowrap; }
.access-grid td.ag-user { font-size: .92em; }
.ag-email { display: block; color: #999; font-size: .82em; }
.ag-all { display: block; font-weight: normal; font-size: .78em; color: #888; margin-top: 4px; }
.ag-box { transform: scale(1.3); cursor: pointer; }
.ag-box:disabled { cursor: not-allowed; opacity: .6; }
.access-grid tbody tr:nth-child(even) { background: #faf9f6; }

/* --- Test/staging site banner -------------------------------------------- */
.test-banner {
    background: repeating-linear-gradient(45deg, #b5432b, #b5432b 18px, #9c3722 18px, #9c3722 36px);
    color: #fff; text-align: center; padding: 10px 14px; font-size: .95em;
    font-weight: 600; letter-spacing: .3px; line-height: 1.5;
    border-bottom: 3px solid #7d2b18; position: sticky; top: 0; z-index: 2000;
    box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.test-banner strong { text-decoration: underline; }
.test-banner-link { color: #ffe; text-decoration: underline; margin-left: 8px;
    white-space: nowrap; }
.test-banner-link:hover { color: #fff; }
/* A subtle page tint on test so even the body looks different from live. */
body.is-test-body { box-shadow: inset 0 0 0 3px #b5432b; }

/* --- "TEST SITE" label inside the nav bar --------------------------------- */
.nav-test-label {
    color: #d81f1f; font-weight: 800; letter-spacing: 1px; font-size: 1.05em;
    margin-left: 12px; white-space: nowrap; align-self: center;
    text-shadow: 0 0 1px rgba(216,31,31,.4);
}

/* --- JST passage shown below a verse -------------------------------------- */
.jst-block { background: #f2f0f7; border-left: 3px solid #8a6d9a; border-radius: 0 6px 6px 0;
    padding: 10px 14px; margin: 4px 0 14px; }
.jst-label { display: inline-block; background: #8a6d9a; color: #fff; font-size: .72em;
    font-weight: 700; letter-spacing: 1px; padding: 1px 8px; border-radius: 3px; margin-bottom: 6px; }
.jst-text { margin: 4px 0 0; line-height: 1.6; }

/* --- Inline "Edit this..." link right under an entry ---------------------- */
.edit-inline { margin: -4px 0 18px; }
.edit-link { display: inline-block; background: #f2f7ee; border: 1px solid var(--green);
    color: var(--green); padding: 4px 12px; border-radius: 6px; text-decoration: none;
    font-size: .9em; font-weight: 600; }
.edit-link:hover { background: var(--green); color: #fff; }

/* --- Teach page ----------------------------------------------------------- */
.teach-wrap { max-width: 760px; margin: 0 auto; padding: 0 16px; }
.teach-range { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap;
    background: #faf9f6; border: 1px solid var(--edge); border-radius: 8px; padding: 14px 16px; }
.teach-range .field-row { margin: 0; flex: 1; min-width: 160px; }
.teach-summary { background: #f2f7ee; border: 1px solid var(--edge); border-radius: 8px;
    padding: 12px 16px; margin: 16px 0; }
.teach-summary p { margin: 0 0 8px; line-height: 1.55; }
.teach-actions { margin: 4px 0 0 !important; }
.teach-sheet { margin-top: 18px; }
.teach-verse { border: 1px solid var(--edge); border-radius: 8px; padding: 16px 20px;
    margin-bottom: 16px; background: #fff; }
.tv-ref { color: var(--green); margin: 0 0 6px; border-bottom: 2px solid var(--green);
    padding-bottom: 4px; }
.tv-text { font-style: italic; color: #444; line-height: 1.6; margin: 0 0 12px; }
.tv-block { margin: 10px 0; }
.tv-block h3 { font-size: .82em; text-transform: uppercase; letter-spacing: .5px;
    color: #8a7a5a; margin: 0 0 4px; }
.tv-block p { margin: 0 0 6px; line-height: 1.55; }
.print-title { color: var(--green); margin-bottom: 2px; }
.print-range { color: #666; margin-top: 0; font-size: 1.1em; }
@media print {
    nav, .teach-range, .teach-summary, .ai-block, .btn-secondary { display: none !important; }
    .teach-verse { border: 1px solid #ccc; break-inside: avoid; page-break-inside: avoid; }
    body { background: #fff; }
}

/* --- Nav dropdowns (Collections, Account) -------------------------------- */
.nav-drop { position: relative; display: inline-block; }
.nav-drop-btn { background: none; border: none; font: inherit; color: inherit;
    cursor: pointer; padding: 6px 10px; text-decoration: none; }
.nav-drop-btn:hover { opacity: .8; text-decoration: underline; }
.nav-drop-arrow { font-size: .7em; margin-left: 2px; }
.nav-drop-menu { display: none; position: absolute; top: 100%; left: 0; z-index: 500;
    background: #fff; border: 1px solid var(--edge); border-radius: 8px; min-width: 180px;
    box-shadow: 0 6px 20px rgba(0,0,0,.12); padding: 6px 0; }
.nav-drop.is-open .nav-drop-menu { display: block; }
.nav-drop-menu a { display: block; padding: 8px 16px; white-space: nowrap; }
.nav-drop-menu a:hover { background: #f2f7ee; }

/* On mobile, the whole nav is a vertical stack; dropdowns expand inline. */
@media (max-width: 820px) {
    .nav-drop { display: block; }
    .nav-drop-menu { position: static; box-shadow: none; border: none; border-radius: 0;
        background: rgba(0,0,0,.03); min-width: 0; padding: 0; }
    .nav-drop.is-open .nav-drop-menu { display: block; }
    .nav-drop-menu a { padding-left: 28px; }
}

/* --- Teach: AI question box ----------------------------------------------- */
.ai-question-form { margin-top: 14px; }
.ai-q-row { display: flex; gap: 8px; margin-top: 4px; }
.ai-q-row input[type="text"] { flex: 1; min-width: 0; }
.ai-asked { background: #eef2e8; border-radius: 6px; padding: 8px 12px; margin: 0 0 12px;
    font-style: italic; }

/* --- Add Scripture page: condensed two-card layout ----------------------- */
.add-layout { max-width: 680px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.add-card { background: #fff; border: 1px solid var(--edge); border-radius: 10px; padding: 18px 20px; }
.add-card h2 { margin: 0 0 10px; color: var(--green); font-size: 1.15em; }
.add-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
    flex-wrap: wrap; }
.add-card-head h2 { margin-bottom: 4px; }
.add-multi { font-size: .88em; white-space: nowrap; }
.add-paste .paste-input { width: 100%; min-height: 80px; margin: 6px 0 8px; }
.add-paste .paste-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.add-help { margin-top: 10px; border-top: 1px solid #eee; padding-top: 8px; }
.add-help summary { cursor: pointer; color: var(--green); font-size: .9em; }
.add-help .paste-examples { margin: 8px 0; line-height: 1.8; }
.add-help .paste-gl { color: #666; }
.fields-grid { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.add-fields .field-row-top { margin-top: 4px; }
.add-fields textarea { width: 100%; }
.add-fields #text { min-height: 70px; }
.add-fields #note { min-height: 50px; }

/* --- "Add to this page" opener button ------------------------------------ */
.add-open-row { margin: 18px 0; text-align: center; }
.add-open-btn { background: var(--green); color: #fff; border: none; padding: 12px 28px;
    border-radius: 8px; font-size: 1.02em; cursor: pointer; }
.add-open-btn:hover { opacity: .93; }
/* Inside the modal, the add-items stack cleanly. */
.add-modal .add-block { border: none; padding: 0; margin: 0; }
.add-modal .add-item { border: 1px solid var(--edge); border-radius: 6px; margin-bottom: 8px; }
.add-modal .add-item summary { padding: 10px 14px; cursor: pointer; font-weight: 600; }
.add-modal .add-item[open] summary { border-bottom: 1px solid var(--edge); }
.add-modal .add-item > form, .add-modal .add-item > .search { padding: 12px 14px; }

/* --- Condensed Scriptures & References panel ------------------------------ */
.vpanel-fixed .vpanel-head { padding: 9px 16px; }
.vpanel-fixed .vpanel-title { font-size: 1.02em; }
.vpanel-fixed .vpanel-body { padding: 12px 16px 14px; }
.vpanel-fixed .vol { font-size: .72em; margin-bottom: 2px; }
.vpanel-fixed .scripture-ref { font-size: 1.35em; margin: 0 0 6px; }
.vpanel-fixed .verse-text { font-size: 1.02em; padding: 10px 12px; margin: 0 0 10px; line-height: 1.5; }
.vpanel-fixed .cat { margin: 12px 0 0; padding-top: 4px; }
.vpanel-fixed .cat-head { font-size: .92em; margin: 0 0 4px; }
.vpanel-fixed .links-list, .vpanel-fixed .entry-list { margin: 4px 0; }
.vpanel-fixed .edit-panel { margin-top: 8px; }
.vpanel-fixed .edit-panel summary { font-size: .9em; }

/* --- Collapsible category sections (arrow-twist) -------------------------- */
.cat-head::before {
    content: "▾"; display: inline-block; font-size: 1.1em; margin-right: 8px;
    transition: transform .15s ease; color: var(--green); vertical-align: middle;
}
.cat.is-collapsed .cat-head::before { transform: rotate(-90deg); }
/* When collapsed, hide everything in the category except its heading. */
.cat.is-collapsed > *:not(.cat-head) { display: none; }
.cat-head { user-select: none; }

/* --- Back-to-top button (bottom-right on long pages) ---------------------- */
#backToTop {
    position: fixed; bottom: 22px; right: 22px; z-index: 1200;
    width: 46px; height: 46px; border-radius: 50%; border: none;
    background: var(--green); color: #fff; font-size: 1.4em; line-height: 1;
    cursor: pointer; box-shadow: 0 3px 12px rgba(0,0,0,.28);
    align-items: center; justify-content: center;
}
#backToTop:hover { opacity: .9; }
@media print { #backToTop { display: none !important; } }
/* On the test site, the sticky test banner sits above; push the sticky nav
   down so they don't overlap. (The banner only appears on the test site.) */
.test-banner + .mainnav { top: 46px; }

/* --- Browse: collapsible chapter groups ---------------------------------- */
.chapter-group { border: 1px solid var(--edge); border-radius: 6px; margin-bottom: 8px; }
.chapter-group > summary { padding: 10px 14px; cursor: pointer; font-weight: 600; color: var(--green); }
.chapter-group[open] > summary { border-bottom: 1px solid var(--edge); }
.chapter-group .verse-list { margin: 0; padding: 6px 12px; }
.chapter-tools { margin: 4px 0 12px; }

/* --- Subject tags -------------------------------------------------------- */
.verse-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 4px; }
.tag-chip { display: inline-flex; align-items: center; background: #eef2e8;
    border: 1px solid #cdd8c2; border-radius: 12px; padding: 2px 4px 2px 10px; font-size: .85em; }
.tag-chip a { color: var(--green); text-decoration: none; }
.tag-chip .tag-remove { display: inline; margin: 0 0 0 4px; background: none; }
.tag-chip .tag-remove button { background: none; border: none; color: #999; cursor: pointer;
    font-size: 1.1em; line-height: 1; padding: 0 4px; }
.tag-chip .tag-remove button:hover { color: #b5432b; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.tag-cloud-item { background: #f2f7ee; border: 1px solid var(--edge); border-radius: 16px;
    padding: 6px 14px; text-decoration: none; color: var(--green); font-weight: 600; }
.tag-cloud-item:hover { background: var(--green); color: #fff; }
.tc-count { color: #888; font-weight: normal; font-size: .85em; }
.tag-cloud-item:hover .tc-count { color: #dfe7d8; }

/* --- Consistent collection-page pattern (match the adage card) ------------ */
.entry-card {
    background: var(--paper); border-left: 4px solid var(--green);
    border-radius: 4px; padding: 16px 20px; margin: 14px 0;
}
.entry-card .entry-definition { font-size: 1.12em; line-height: 1.6; margin: 0; }
/* Smaller edit button (overrides the larger one above) */
.edit-inline { margin: -2px 0 16px; }
.edit-link { display: inline-block; background: #f2f7ee; border: 1px solid var(--green);
    color: var(--green); padding: 2px 10px; border-radius: 5px; text-decoration: none;
    font-size: .8em; font-weight: 600; margin-top: 4px; }
.edit-link:hover { background: var(--green); color: #fff; }

/* --- Collection list items, matching the adage list layout ---------------- */
.entry-results { margin: 8px 0; }
.entry-result { padding: 12px 0; border-bottom: 1px dotted var(--edge); }
.entry-result-head { display: flex; justify-content: space-between; align-items: baseline;
    gap: 10px; flex-wrap: wrap; }
.entry-result-title { color: var(--green); font-weight: bold; text-decoration: none; font-size: 1.05em; }
.entry-result-title:hover, .entry-result-title:visited, .entry-result-title:focus {
    color: var(--green); text-decoration: none; }
.entry-result-meta { font-size: .8em; color: #999; }
.entry-result-body { margin-top: 4px; font-size: .95em; color: #444; line-height: 1.5; }
.entry-result .edit-link { margin-top: 8px; }

/* --- Free/paid gating: locked nav items ---------------------------------- */
.nav-lock { font-size: .8em; opacity: .7; }

/* --- Collection sort bar (clickable field headers above a card list) ------ */
.sort-bar {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
    margin: 10px 0 14px; padding: 8px 4px;
    border-top: 1px solid var(--edge); border-bottom: 1px solid var(--edge);
    font-size: .9em;
}
.sort-bar-label {
    color: #888; text-transform: uppercase; letter-spacing: .04em;
    font-size: .82em; margin-right: 4px;
}
.sort-opt {
    display: inline-flex; align-items: center; gap: 2px;
    padding: 4px 10px; border-radius: 999px;
    color: var(--green); text-decoration: none; white-space: nowrap;
    border: 1px solid transparent;
}
.sort-opt:hover { background: #f2f7ee; }
.sort-opt.is-active {
    background: var(--green); color: #fff; font-weight: 600;
    border-color: var(--green);
}
.sort-opt.is-active:hover { background: #3d4d30; }
.sort-arrow { font-size: .75em; line-height: 1; }
@media (max-width: 560px) {
    .sort-bar { gap: 4px; }
    .sort-opt { padding: 4px 8px; }
}

/* --- Grouped collection view (collapsible by author / subject / basis) ---- */
.group-list { margin: 4px 0 16px; }
.group {
    border: 1px solid var(--edge); border-radius: 8px;
    margin: 0 0 6px; background: #fff; overflow: hidden;
}
/* Name + count sit together on the left (not pushed apart). The arrow is the
   only thing before them; count is plain "(N)" right after the name. */
.group-head {
    display: flex; align-items: baseline; gap: 6px;
    padding: 9px 14px; cursor: pointer;
    font-weight: 600; color: var(--green); list-style: none;
    user-select: none;
}
.group-head::-webkit-details-marker { display: none; }  /* hide default triangle */
.group-head::before {
    content: "▸"; display: inline-block; margin-right: 4px;
    font-size: .8em; color: #999; transition: transform .15s ease;
    align-self: center;
}
.group[open] > .group-head::before { transform: rotate(90deg); }
.group-head:hover { background: #f6f8f2; }
.group-count { font-weight: 400; color: #999; font-size: .92em; }
.group-body { padding: 2px 14px 8px; border-top: 1px solid var(--edge); }
/* Collapse the stray vertical whitespace from card margins inside a group. */
.group-body > .adage-result,
.group-body > .entry-result { margin: 8px 0; }
.group-body > .adage-result:first-child,
.group-body > .entry-result:first-child { margin-top: 8px; }
.group-body > .adage-result:last-child,
.group-body > .entry-result:last-child { margin-bottom: 2px; }
.group-body .hymn-browse { margin: 4px 0 0; }
.group-body .hymn-row:last-child { border-bottom: none; }
