/*
 * fotx.css — Consolidated FoTX stylesheet
 * Replaces: Bootstrap 3.3.7 + colors.css, layout.css, navigation.css,
 *           branding.css, footer.css, authentication.css, transitions.css,
 *           animations.css, fonts.css, rwd-mq.css
 *
 * UI colors: Navy var(--fotx-navy) | Blue var(--fotx-blue) | Light var(--fotx-light-blue)
 * Font-size: html 62.5% (1rem = ~10px), body 16px
 *
 * TABLE OF CONTENTS
 * =================
 *  1. CSS Custom Properties .......... :root (data colors)
 *  2. Box-sizing & Base .............. *, html, body
 *  3. Typography ..................... h1-h6, lists
 *  4. Links & Transitions ........... a, .base-link, transition rule
 *  5. Container & Grid .............. .container, .grid-row, .col-*
 *  6. Page Structure ................. #page-content, .login-warning
 *  7. Branding ....................... .branding, #fotx-logo, #site-title
 *  8. Navigation ..................... #navigation, .nav overrides
 *  9. Authentication ................. #profile-nav, .donate-link
 * 10. Footer ......................... #page-footer
 * 11. Tables ......................... .fotx-table, th, td, .listing
 * 12. Buttons & Badges .............. .btn, .badge, .btn-fotx
 * 13. Utility Classes ............... .pull-left, .text-center, etc.
 * 14. Nav Tabs ....................... .nav-tabs, .nav-justified
 * 15. Sidebar Navigation ............. .sidebar-nav
 * 16. Collapse / Accordion .......... .collapse, .panel-*
 * 17. Forms & Inputs ................ label, input, .form-control
 * 18. Search Filters ................. #institution_id, etc.
 * 19. Panels ........................ .panel-fotx
 * 20. Data Listing ................... .pagination, .filter
 * 21. Taxonomy Tree .................. #taxon_description, .rank-id
 * 22. Specimen Detail ................ .large, .expand-heading, .data-section
 * 23. Comments ....................... #comment_form, .comment
 * 24. Photos / Media ................. #primary_photo, #photo_thumbnails
 * 25. Map ............................ #map, #mini_map
 * 26. Loading Spinner ................ #loading
 * 27. Messages ...................... .message
 * 28. Icon Replacements .............. .icon-caret, etc.
 * 29. Documentation Pages & Statistics  .documentation-layout, .stat-card
 */


/* ==========================================================================
   1. CSS Custom Properties (from colors.css)
   ========================================================================== */

:root {
    /* FoTX brand colors */
    --fotx-navy: #02275E;
    --fotx-blue: #1573B3;
    --fotx-light-blue: #dce8f2;
    --fotx-red: #A01025;
    --fotx-light-red: #FA8072;
    --fotx-green: #03783F;
    --fotx-light-green: #d6f0e3;
    --fotx-yellow: #ffff55;

    /* FoTX gray scale (dark/mid/light to match blue triad) */
    --fotx-gray-dark: #333;
    --fotx-gray: #888;
    --fotx-gray-light: #efefef;

    /* Taxonomy rank colors */
    --rank-phylum-color: #E63946;
    --rank-class-color: #E07B00;
    --rank-order-color: #2A9D8F;
    --rank-family-color: #2374AB;
    --rank-genus-color: #7B2D8B;
    --rank-species-color: #457B3B;
    --rank-subspecies-color: #D4770B;

    /* Examination status colors (must match common/utilities.py) */
    --suspect-examined-color: #FF0000;
    --suspect-pending-color: #FFA500;
    --suspect-reexamine-color: #FFFF00;

    --not-suspect-examined-color: #008000;
    --not-suspect-pending-color: #48FAD7;
    --not-suspect-reexamine-color: #B642F5;
    --not-suspect-not-examined-color: #00008B;

    /* Border radius */
    --radius-border: 4px;
    --radius-pill: 8px;
    --radius-circle: 50%;

    /* Font-size scale (1rem = 10px via html 62.5%) */
    --font-xl: 2.4rem;    /* 24px — display headings */
    --font-lg: 2rem;      /* 20px — section headings */
    --font-base: 1.6rem;  /* 16px — body text */
    --font-sm: 1.3rem;    /* 13px — secondary text */
    --font-2xs: 1.2rem;   /* 12px — small headings */
    --font-xs: 1.1rem;    /* 11px — compact / nav */
    --font-xxs: 1rem;     /* 10px — controls, tables */

    /* Conservation status colors */
    --conservation-lv5-color: #2b9b00;
    --conservation-lv4-color: #82ad00;
    --conservation-lv3-color: #d78d00;
    --conservation-lv2-color: #d55f0e;
    --conservation-lv1-color: #d5210e;
    --conservation-extinct-color: #444;
    --conservation-unranked-color: #666;
}

/* ==========================================================================
   2. Box-sizing & Base
   ========================================================================== */

*, *::before, *::after {
    box-sizing: border-box;
}

html {
    width: 100%;
    min-height: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    font-size: 62.5%; /* 1rem = ~10px for easy math */
}
body {
    min-height: 100%;
    margin: 0;
    padding: 0;
}

body {
    background: #fff;
    color: var(--fotx-navy);
    font-size: 16px;
    font-family: Verdana, sans-serif;
}

/* Skip-to-content link — hidden until focused via keyboard */
.skip-to-content {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 9999;
    padding: 0.5rem 1rem;
    background: var(--fotx-navy);
    color: #fff;
    font-size: var(--font-sm);
    text-decoration: none;
}

.skip-to-content:focus {
    left: 0;
}

select, input, textarea, button {
    font-family: inherit;
}

select {
    color: var(--fotx-navy);
}

input[type="checkbox"],
input[type="radio"] {
    accent-color: var(--fotx-blue);
}

/* ==========================================================================
   3. Typography
   ========================================================================== */

h1 {
    font-size: var(--font-xl);
    margin: 1rem 0;
    padding: 0;
    font-weight: 900;
}

h1 a {
    text-decoration: none;
    color: #000;
}

h2 {
    font-size: var(--font-lg);
    font-weight: bold;
    margin-top: 0.75rem;
    margin-bottom: 0.25rem;
    padding: 0;
}

h3, h4 {
    font-size: var(--font-sm);
    font-weight: bold;
    color: var(--fotx-blue);
    padding: 0;
}

h3 { margin: 1rem 0 0.25rem; }
h4 { margin: 1.5rem 0 1rem; }

.text-note {
    font-size: var(--font-sm);
    font-style: italic;
}

h5 {
    font-size: var(--font-xs);
    font-weight: bold;
    margin-top: 1rem;
    padding: 0;
}

h6 {
    font-size: var(--font-xxs);
    font-weight: bold;
    color: var(--fotx-blue);
    margin-top: 1rem;
    padding: 0;
}

/* ==========================================================================
   4. Links & Transitions
   ========================================================================== */

a {
    color: var(--fotx-navy);
    text-decoration: underline;
}

.base-link {
    padding-top: 3px;
    text-decoration: none;
    border-top: 3px solid transparent;
}

.base-link:hover {
    text-decoration: none;
}

/* External link indicator — small icon after links that leave the site */
a[target="_blank"]::after {
    content: "\f35d";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 0.45em;
    margin-left: 0.25em;
    vertical-align: super;
    opacity: 0.45;
    text-decoration: none;
    display: inline-block;
}

a[target="_blank"].link-internal::after,
a[target="_blank"] > img + .fa-external-link::after {
    content: none;
}

/* Suppress icon on image-only links (footer fish, partner logos, photo thumbnails) */
a[target="_blank"]:has(> img):not(:has(> :not(img)))::after {
    content: none;
}

/* Simplified transitions (replaces transitions.css) */
a, .btn-fotx, .nav > li > a, .list-group-item {
    transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

/* ==========================================================================
   5. Container & Grid
   ========================================================================== */

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1rem;
}

.grid-row {
    display: flex;
    flex-wrap: wrap;
    margin-left: -15px;
    margin-right: -15px;
}

.grid-row > [class*="col-"] {
    padding-left: 15px;
    padding-right: 15px;
}

.col-2  { flex: 0 0 16.66%; max-width: 16.66%; }
.col-3  { flex: 0 0 25%; max-width: 25%; }
.col-4  { flex: 0 0 33.33%; max-width: 33.33%; }
.col-5  { flex: 0 0 41.66%; max-width: 41.66%; }
.col-6  { flex: 0 0 50%; max-width: 50%; }
.col-7  { flex: 0 0 58.33%; max-width: 58.33%; }
.col-8  { flex: 0 0 66.66%; max-width: 66.66%; }
.col-9  { flex: 0 0 75%; max-width: 75%; }

.section-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    z-index: 1;
}

.section-header-row h2 {
    margin: 0;
}
.col-full { flex: 0 0 100%; max-width: 100%; }

/* ==========================================================================
   6. Page Structure
   ========================================================================== */

#page-content {
    margin: 0;
    padding: 0;
    text-align: left;
}

.search-form > p, div.model-sdm > p {
    text-align: left;
    font-size: var(--font-sm);
}

.login-warning {
    margin: 1rem 0 0;
}

.login-warning > p {
    margin: 0;
    padding: 0.75rem 1rem;
    text-align: center;
    font-size: var(--font-sm);
    background: var(--fotx-blue);
    color: white;
    border: 1px solid var(--fotx-navy);
    border-radius: var(--radius-border);
}

.login-warning a {
    color: white;
    text-decoration: underline;
}

/* Django messages */
ul.message,
ul.messages {
    list-style: none;
    padding: 0.75rem 1rem;
    margin: 1rem 0;
    background: var(--fotx-light-blue);
    border: 1px solid var(--fotx-navy);
    border-radius: var(--radius-border);
    color: var(--fotx-red);
    font-style: italic;
}

/* Tooltips */
.tippy-content {
    font-weight: normal;
    font-size: var(--font-xxs);
    text-align: left;
}

.tippy-content p {
    margin: 0;
}

.tippy-content a {
    color: var(--fotx-light-blue);
    text-decoration: underline;
}

/* ==========================================================================
   7. Branding
   ========================================================================== */

.branding {
    padding: 1rem 1rem 0.8rem 1rem;
    display: flex;
    align-items: flex-end;
}

.branding a {
    text-decoration: none;
    flex-shrink: 0;
}

#fotx-logo {
    margin: 0;
    width: 220px;
    height: auto;
}

#site-title {
    margin: 0 0 3.8rem 3.5rem;
    padding-left: 0;
    font-family: 'Merriweather', Georgia, serif;
    font-size: var(--font-lg);
    font-weight: 900;
    font-style: italic;
    letter-spacing: 0.05em;
    color: var(--fotx-navy);
    white-space: nowrap;
}

/* ==========================================================================
   8. Navigation
   ========================================================================== */

#navigation {
    margin: 0;
    font-size: var(--font-xs);
    font-weight: 900;
}

.nav {
    list-style: none;
    padding: 0;
    margin: 0;
    border-bottom: 1px solid var(--fotx-navy);
    text-transform: uppercase;
    display: flex;
    align-items: stretch;
}

.nav > li {
    display: flex;
    align-items: stretch;
    flex: 1;
    justify-content: center;
}

ul.nav > li > a {
    min-height: 3rem;
    width: 100%;
    padding: 0.8rem 0.6rem;
    border: none;
    background: transparent;
    text-decoration: none;
    color: var(--fotx-blue);
    font-weight: 700;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* Vertical dividers between tabs — inset from top so they don't overlap rounding */
ul.nav > li + li > a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.5rem;
    bottom: 0.5rem;
    width: 1px;
    background: var(--fotx-light-blue);
}

/* Hide divider on active/hovered tab and the one immediately after it */
ul.nav > li.active > a::before,
ul.nav > li.active + li > a::before,
ul.nav > li > a:hover::before,
ul.nav > li:has(> a:hover) + li > a::before {
    background: transparent;
}

ul.nav > li > a:hover {
    background: var(--fotx-navy);
    color: #fff;
    border-radius: 4px 4px 0 0;
}

/* Active tab: navy background, white text */
ul.nav > li.active > a {
    color: #fff;
    font-weight: 900;
    background: var(--fotx-navy);
    border-radius: 4px 4px 0 0;
}

ul.nav > li.active > a:hover {
    color: #fff;
    background: var(--fotx-blue);
}


/* ==========================================================================
   9. Authentication
   ========================================================================== */

#profile-nav {
    text-align: right;
    float: right;
    margin: 1rem 0 0 0;
    font-size: var(--font-sm);
}

#profile-nav * {
    display: inline-block;
}

#profile-nav a {
    padding: 2px 0.5rem;
}

#profile-nav li.active a {
    background-color: var(--fotx-light-blue);
    border-top: 3px solid var(--fotx-navy);
    color: var(--fotx-navy);
    text-decoration: none;
}

#profile-nav li.active a:hover {
    background: var(--fotx-light-blue);
}

.logout-form {
    display: inline;
    margin: 0;
    padding: 0;
}

.logout-btn {
    background: none;
    border: none;
    border-top: 3px solid transparent;
    cursor: pointer;
    padding: 3px 0.5rem 0;
    color: var(--fotx-navy);
    text-decoration: underline;
    font-size: inherit;
    font-family: inherit;
}

a.admin-link:hover,
a.profile-link:hover,
a.nav-link:hover,
.logout-btn:hover {
    text-decoration: none;
    border-color: var(--fotx-blue);
    background: var(--fotx-light-blue);
}

.donate-link .icon-heart::before {
    color: var(--fotx-red);
}

a.donate-link:hover {
    text-decoration: none;
    border-color: var(--fotx-green);
    background: var(--fotx-light-green);
}

/* ==========================================================================
   10. Footer
   ========================================================================== */

#page-footer {
    margin-top: 1rem;
    min-height: 18rem;
    padding: 0.5rem 0 0;
    border-top: 1px solid var(--fotx-navy);
}

.footer-fish-img {
    max-width: 9rem;
    height: auto;
}


.footer-text {
    font-size: var(--font-xs);
}

.footer-text p {
    margin: 0.5rem 0;
}

.footer-text .support-us {
    margin-bottom: 0.3rem;
}

/* ==========================================================================
   11. Tables
   ========================================================================== */

.fotx-table {
    width: 100%;
    border-collapse: collapse;
}

.fotx-table th,
.fotx-table td {
    padding: 8px;
    font-size: var(--font-sm);
    vertical-align: middle;
}

.fotx-table-striped tbody tr:nth-child(odd) {
    background: var(--fotx-gray-light);
}

.fotx-table-bordered,
.fotx-table-bordered th,
.fotx-table-bordered td {
    border: 1px solid var(--fotx-navy);
}

.fotx-table-hover tbody tr:hover {
    background: var(--fotx-gray-light);
}

.table-responsive {
    overflow-x: auto;
    width: 100%;
}

th {
    padding: 10px 0;
    background: var(--fotx-navy);
    text-align: left;
    color: white;
    font-weight: 300;
    font-size: var(--font-xxs);
}

.fotx-table.listing th {
    background: var(--fotx-light-blue);
    color: var(--fotx-navy);
    font-weight: 600;
}


td {
    padding: 10px 0;
    vertical-align: middle;
}

table.listing {
    width: 100%;
    border-collapse: collapse;
    border-top: solid var(--fotx-navy) 1px;
    border-bottom: solid var(--fotx-navy) 1px;
}

tr.meta-header > th {
    background-color: var(--fotx-blue);
}

th.unused-header {
    background-color: var(--fotx-gray-light);
}

.no_records {
    padding: 100px;
    text-align: center;
    font-weight: bold;
}

td.photo {
    width: 128px;
    height: 80px;
    text-align: center;
}

/* Combined species column: common name beneath scientific name */
.common-name-sub {
    font-size: var(--font-xs);
    color: var(--fotx-gray-dark);
    padding-left: 0.8em;
}

/* Data type glyph colors (reusing taxonomy rank palette) */
.dtype-vouchered,
.dtype-observation,
.dtype-photo,
.dtype-molecular,
.dtype-audio,
.dtype-unknown    { font-size: var(--font-base); }
.dtype-vouchered  { color: var(--rank-family-color); }
.dtype-observation { color: var(--rank-order-color); }
.dtype-photo      { color: var(--rank-genus-color); }
.dtype-molecular  { color: var(--rank-phylum-color); }
.dtype-audio      { color: var(--rank-species-color); }
.dtype-unknown    { color: var(--fotx-gray); }

.scientific_name {
    font-style: italic;
}

/* ==========================================================================
   12. Buttons & Badges
   ========================================================================== */

.badge {
    display: inline-block;
    min-width: 10px;
    padding: 6px 10px;
    font-size: var(--font-sm);
    font-weight: bold;
    color: #fff;
    line-height: 1.3;
    vertical-align: middle;
    white-space: nowrap;
    text-align: center;
    background-color: var(--fotx-gray);
    border: 1px solid var(--fotx-navy);
    border-radius: var(--radius-pill);
}

.btn-fotx {
    margin-right: 0.5rem;
    background: var(--fotx-navy);
    color: #fff;
    text-decoration: none;
    text-shadow: none;
    font-size: var(--font-xxs);
    font-weight: bold;
    padding: 6px 12px;
    border-radius: var(--radius-border);
    border: 1px solid var(--fotx-navy);
    cursor: pointer;
}

.btn-fotx:hover {
    background: var(--fotx-blue);
    border-color: var(--fotx-blue);
    color: #fff;
}

/* ==========================================================================
   13. Utility Classes
   ========================================================================== */

.pull-left  { float: left; }
.pull-right { float: right; }
.text-center { text-align: center; }
.text-left   { text-align: left; }
.text-right  { text-align: right; }
.center-block { display: block; margin-left: auto; margin-right: auto; }
.img-responsive { max-width: 100%; height: auto; }
.js-hidden { display: none; }
.out-of-area { color: var(--fotx-gray); }

.col-reorder-right { order: 2; flex: 0 0 46%; max-width: 46%; }
.col-reorder-left  { order: 1; flex: 0 0 54%; max-width: 54%; }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
    padding: 0;
    margin: -1px;
}

.clearfix::after {
    content: "";
    display: table;
    clear: both;
}

/* ==========================================================================
   14. Nav Tabs
   ========================================================================== */

.nav-tabs {
    border-bottom: 1px solid var(--fotx-navy);
}

.nav-tabs > li > a {
    text-decoration: none;
}

.nav-justified {
    display: flex;
}

.nav-justified > li {
    flex: 1 0 auto;
    justify-content: center;
    white-space: nowrap;
}

/* ==========================================================================
   15. Sidebar Navigation (shared: documentation, statistics)
   ========================================================================== */

.sidebar-nav ul {
    list-style: none;
    padding-left: 0.1rem;
    margin: 0;
    font-size: var(--font-sm);
}

.sidebar-nav > ul {
    padding-left: 0;
}

.sidebar-nav li {
    padding-left: 0.75rem;
    border-bottom: 1px solid color-mix(in srgb, var(--fotx-navy) 15%, transparent);
}

.sidebar-nav li:has(> .section-header) {
    border-bottom: none;
}


.sidebar-nav a {
    display: block;
    padding: 0.35rem 0.4rem;
    text-decoration: none;
    color: var(--fotx-blue);
}

.sidebar-nav a:hover {
    background: color-mix(in srgb, var(--fotx-light-blue) 50%, transparent);
}

.sidebar-nav .current > a,
.sidebar-nav .current > .section-header > .section-link,
.sidebar-nav a.active {
    font-weight: bold;
    color: var(--fotx-navy);
}

/* Parent items: toggle + title row */
.sidebar-nav .section-header {
    display: flex;
    align-items: center;
    border-bottom: 1px solid color-mix(in srgb, var(--fotx-navy) 15%, transparent);
}

.sidebar-nav .section-link {
    flex: 1;
    padding: 0.35rem 0.4rem;
    color: var(--fotx-blue);
}

/* Caret sits in the section-header's left-padding gutter, out of flow */
.sidebar-nav .section-header {
    position: relative;
}

.sidebar-nav .section-toggle {
    position: absolute;
    left: -0.75rem;
    top: 0;
    bottom: 0;
    width: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
    user-select: none;
    color: var(--fotx-navy);
}

.sidebar-nav .section-toggle .icon-caret {
    display: inline-block;
    font-size: 0.65em;
    transition: transform 0.15s;
}

.sidebar-nav .section-toggle[aria-expanded="true"] .icon-caret {
    transform: rotate(90deg);
}

/* ==========================================================================
   16. Collapse / Accordion
   ========================================================================== */

.collapse {
    display: none;
}

.collapse.show {
    display: block;
}

.panel-group {
    margin-bottom: 20px;
}

.panel-collapse {
    overflow: hidden;
    padding-top: 2px;
}

/* ==========================================================================
   17. Forms & Inputs
   ========================================================================== */

.form-control {
    display: block;
    width: 100%;
    padding: 6px 12px;
    font-size: var(--font-sm);
    line-height: 1.42857;
    color: var(--fotx-gray-dark);
    background: #fff;
    border: 1px solid var(--fotx-gray-light);
    border-radius: var(--radius-border);
}

.form-control:focus {
    border-color: var(--fotx-blue);
    outline: 0;
    box-shadow: 0 0 0 2px var(--fotx-light-blue);
}

/* Keyboard-only focus indicator for buttons, links, and interactive elements */
a:focus-visible,
button:focus-visible,
.btn-fotx:focus-visible,
.btn-fotx-light:focus-visible,
.btn-clear-query:focus-visible,
[role="button"]:focus-visible {
    outline: 2px solid var(--fotx-light-blue);
    outline-offset: 2px;
}

.auth-form {
    margin-left: 1rem;
    display: inline-block;
}

.auth-form label {
    font-size: var(--font-sm);
    text-transform: lowercase;
}

label {
    display: block;
    font-weight: bold;
    padding: 5px 3px 1px 0;
}


label.inline_tooltip {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
    position: relative;
    top: -0.1em;
    padding: 0 3px;
    cursor: help;
}

.help-icon {
    display: inline-block;
    width: 14px;
    height: 14px;
    line-height: 14px;
    text-align: center;
    font-size: 9px;
    color: #fff;
    background-color: var(--fotx-blue);
    border-radius: var(--radius-circle);
    transition: background-color 0.15s ease;
}

label.inline_tooltip:hover .help-icon {
    background-color: var(--fotx-navy);
}

.help-icon-fa {
    color: var(--fotx-blue);
}
label.inline_tooltip:hover .help-icon-fa {
    color: var(--fotx-navy);
}

label[for*="status_"],
label[for*="captive_"] {
    display: inline;
    font-weight: normal;
}

label.sublabel {
    font-weight: normal;
    font-style: italic;
    padding: 0;
}

.field-label,
label.block {
    display: block;
    font-size: var(--font-sm);
    font-weight: bold;
    text-transform: lowercase;
}

#specimen label.block,
#specimen .field-label,
#locality_detail label.block,
#locality_detail .field-label {
    margin-left: -1rem;
}

#specimen .data-section > div,
#specimen .data-section > .custom_field {
    padding-left: 1rem;
}
#locality_detail > div:not(.panel-group) {
    padding-left: 2.5rem;
}

input[type=submit],
input[type=button],
button[type=submit]:not(.logout-btn) {
    display: inline-block;
    padding: 6px 12px;
    background: var(--fotx-navy);
    color: #fff;
    border: 1px solid var(--fotx-navy);
    border-radius: var(--radius-border);
    font-family: inherit;
    font-size: var(--font-xxs);
    font-weight: bold;
    line-height: 1;
    vertical-align: middle;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

input[type=submit]:hover,
input[type=button]:hover,
button[type=submit]:not(.logout-btn):hover {
    background: var(--fotx-blue);
    border-color: var(--fotx-blue);
}

#filter_form > fieldset > select {
    max-width: 100%;
    margin-bottom: 0.5rem;
}

#filter_form > fieldset > .sub-label {
    margin-left: 5px;
}

fieldset {
    margin: 0 0 30px 0;
    padding: 0;
    border: none;
    min-width: 0;
    width: 100%;
}

legend {
    font-size: var(--font-sm);
    font-weight: bold;
    line-height: 24px;
}

/* ==========================================================================
   18. Search Filters
   ========================================================================== */

#institution_id { width: 180px; }
#family_id { width: 182px; }
#genus_id { width: 182px; }
#species_id { width: 182px; }
#catalog_number { width: 180px; }
#collector_name { width: 180px; }
#ecoregion_id { width: 200px; }
#basin_id { width: 200px; }
#locality_contains { width: 200px; }
#subbasin_id { width: 200px; }
#error_radius_max { width: 100px; }
#records_per_page { width: 40px; }

.filter {
    margin-bottom: 5px;
}

.filter td {
    padding-top: 5px;
    padding-left: 0;
}


#page_heading {
    padding: 0.5rem 1rem;
    background-color: #fff;
    top: 0;
}

#taxon-detail,
#specimen {
    border: 1px solid var(--fotx-navy);
    border-radius: var(--radius-border);
    padding: 0 1rem 1rem;
    margin: 1.5rem 0;
}

#taxon-detail .col-6:last-child {
    padding-top: 1rem;
}

#taxon-detail .rank-icon {
    width: 20px;
    height: 20px;
    line-height: 20px;
    font-size: var(--font-xs);
}

#page_content .details {
    font-size: var(--font-xl);
    padding: 0;
    margin: 0;
    font-weight: normal;
}

.search-col-main {
    width: 50%;
    overflow: hidden;
}

.search-col-main select,
.search-col-main input[type=text],
.search-col-side select,
.search-col-side input[type=text] {
    max-width: 100%;
}

.search-col-main > select,
.search-col-main > input[type=text],
.search-col-main > div,
.search-col-main > table,
.search-col-side > select,
.search-col-side > input[type=text],
.search-col-side > div {
    margin-left: 5px;
}

.search-col-main table,
.search-col-side table {
    width: 100%;
}

/* Stack taxonomy dropdowns vertically */
#family_id,
#genus_id,
#species_id {
    display: block;
    width: 300px;
    margin-bottom: 2px;
}

/* Catalog number: source + input on one line */
#source_id,
#catalog_number {
    display: inline-block;
    vertical-align: middle;
}
label[for="catalog_number"] + div {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: nowrap;
}

/* Narrow dropdowns, expand on click */
#source_id,
#nfca_id {
    width: 250px;
}

#source_id:focus,
#nfca_id:focus {
    width: auto;
    max-width: 100%;
}

/* Stack basin dropdowns vertically */
#mrb_id,
#subbasin_id {
    display: block;
    margin-bottom: 2px;
}

.search-col-side {
    width: 50%;
    float: right;
}

.search-col-main > label.block,
.search-col-side > label.block {
    margin-top: 1rem;
}

.search-col-main > label.block:first-child,
.search-col-side > label.block:first-child {
    margin-top: 0;
}

.search-col-side h2 {
    margin-top: 0;
}

.search-col-side > label {
    font-weight: bold;
}

.search-col-side td:first-child {
    font-weight: bold;
    padding-right: 0.8rem;
}

/* ==========================================================================
   19. Panels / What's New
   ========================================================================== */

.panel.panel-fotx > .panel-heading {
    padding: 0.2rem 1rem;
    max-height: 4rem;
    background: var(--fotx-navy);
    color: #fff;
}

.panel-heading > h5 {
    color: #fff;
}

/* ==========================================================================
   20. Data Listing
   ========================================================================== */

.pagination {
    text-align: center;
    padding-top: 10px;
    padding-bottom: 10px;
    font-size: var(--font-base);
}

.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 0;
    font-size: var(--font-base);
}

.pagination-bar a {
    text-decoration: none;
    font-weight: bold;
    color: var(--fotx-navy);
}

.pagination-buttons {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.pagination-buttons .inline_tooltip {
    margin-right: 0.8rem;
}

.results-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    font-size: var(--font-sm);
    background: var(--fotx-navy);
    color: #fff;
}

.results-toolbar-top {
    border-radius: var(--radius-border) var(--radius-border) 0 0;
}

.results-toolbar-bottom {
    border-radius: 0 0 var(--radius-border) var(--radius-border);
}

.results-toolbar .step-links {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.results-toolbar .current {
    color: #fff;
}

.results-toolbar a {
    text-decoration: none;
}

.btn-fotx-light {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    font-size: var(--font-xxs);
    line-height: 1.4;
    vertical-align: middle;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    text-decoration: none;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: var(--radius-border);
    cursor: pointer;
}

.btn-fotx-light:hover {
    background: rgba(255, 255, 255, 0.3);
    color: #fff;
}

.btn-clear-query {
    display: inline-block;
    padding: 6px 12px;
    background: #fff;
    color: var(--fotx-navy);
    border: 1px solid var(--fotx-navy);
    border-radius: var(--radius-border);
    font-family: inherit;
    font-size: var(--font-xxs);
    font-weight: bold;
    line-height: 1;
    text-decoration: none;
    vertical-align: middle;
    cursor: pointer;
    vertical-align: middle;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.btn-clear-query:hover {
    background: var(--fotx-gray-light);
    border-color: var(--fotx-gray);
}

.search-form,
.auth-form {
    padding: 1rem;
    border: 1px solid var(--fotx-navy);
    border-radius: var(--radius-border);
    background: var(--fotx-light-blue);
}

.search-form {
    margin-bottom: 2rem;
}

.search-form > :first-child {
    margin-top: 0;
}

.required-marker {
    color: var(--fotx-red);
    font-size: 8px;
    vertical-align: super;
    margin-left: 2px;
}

.search-form input[type="text"],
.search-form textarea {
    max-width: 100%;
}

/* Sub-labels for taxonomy and basin dropdowns */
.sub-label {
    display: block;
    font-size: var(--font-xs);
    font-style: italic;
    font-weight: normal;
    margin-top: 3px;
    margin-left: 5px;
    color: var(--fotx-gray-dark);
}

.checkbox-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 0.5rem;
}

.checkbox-option {
    display: inline;
    font-weight: normal;
    white-space: nowrap;
}

.search-columns {
    overflow: hidden;
}

.show-hide-prefix ::before {
    content: "show ";
}

.show-hide-prefix[aria-expanded="true"] ::before {
    content: "hide ";
}

/* ==========================================================================
   21. Taxonomy Tree
   ========================================================================== */


#contributions_info {
    margin: 0.5em 0 0;
    font-size: var(--font-xxs);
    font-style: italic;
}

/* ==========================================================================
   22. Specimen Detail
   ========================================================================== */

.specimen-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 0;
}

.specimen-header h1 {
    margin: 0;
    padding: 0;
    flex-shrink: 0;
}

.specimen-header .badge {
    margin-left: auto;
}

.large {
    font-size: var(--font-xl);
    line-height: 32px;
    color: var(--fotx-blue);
    padding: 0.5rem 1rem 0.5rem 2.5rem;
    margin: 0 -1rem;
    background: var(--fotx-light-blue);
    border-top: 1px solid var(--fotx-light-blue);
    border-bottom: 1px solid var(--fotx-light-blue);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.large a {
    color: var(--fotx-blue);
}

.conservation-statuses {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    margin-left: auto;
}

.expand-heading {
    position: relative;
}

.expand-heading > :first-child::before {
    color: var(--fotx-gray-dark);
    content: "\25b6";
    margin-right: .5em;
}

.expand-heading[aria-expanded="true"] > :first-child::before {
    content: "\25bc";
}

#photos {
    line-height: 24px;
    margin-top: 0.5rem;
}

#locality_detail {
    line-height: 24px;
}

.map-remark {
    margin: .4rem 0;
    padding-left: 1.5rem;
}

.data-section,
#specimen .panel-collapse > div {
    line-height: 24px;
    margin: 0.25rem 0 .75rem;
    padding-left: 1.5rem;
}

.data-section ul {
    margin-top: 0;
    margin-bottom: 0;
    padding-left: 1.25rem;
}

#specimen .panel-collapse > .data-compact,
#specimen .panel-collapse > .determination-layout {
    line-height: 1.2;
    margin: 0;
    padding-left: 1.5rem;
}
#specimen .panel-collapse > .determination-layout + .determination-layout {
    margin-top: 0.75rem;
}

.data-compact {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0 2rem;
    font-size: var(--font-xs);
    line-height: 1.2;
}

.data-compact > div {
    margin-bottom: 0.15rem;
    overflow-wrap: anywhere;
}

.data-compact .field-label {
    font-size: var(--font-xs);
    margin-bottom: -0.1rem;
}

.donor-section-heading {
    font-size: var(--font-xs);
    font-weight: 700;
    color: var(--fotx-navy);
    background: var(--fotx-light-blue);
    margin: 0;
    padding: 0.2rem 1rem 0.2rem 0;
    line-height: 1.4;
    text-align: right;
}

#custom_details > .data-compact {
    margin: 0;
    line-height: 1.2;
}

/* ── Change Log ── */
#changelog-panel.show {
    border: 1px solid var(--fotx-gray);
    border-radius: var(--radius-border);
    overflow: hidden;
}

.changelog-entry {
    border-bottom: 1px solid var(--fotx-gray-light);
    padding: 0.35rem 1rem 0.35rem 1.5rem;
}

.changelog-entry:nth-child(even) {
    background-color: var(--fotx-gray-light);
}

.changelog-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
}

.changelog-category {
    font-size: var(--font-xs);
    font-weight: 700;
    color: var(--fotx-navy);
    text-transform: capitalize;
}

.changelog-meta {
    font-size: var(--font-xxs);
    color: var(--fotx-gray);
    white-space: nowrap;
}

.changelog-memo {
    font-size: var(--font-xs);
    line-height: 1.3;
    margin-top: 0.15rem;
    overflow-wrap: anywhere;
}

.changelog-details {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: 0.15rem;
}

.changelog-field {
    background: var(--fotx-gray-light);
    border-radius: var(--radius-border);
    padding: 0.15rem 0.5rem;
    font-size: var(--font-xxs);
    display: inline-block;
}

.changelog-field-block {
    background: var(--fotx-gray-light);
    border-radius: var(--radius-border);
    padding: 0.25rem 0.5rem;
    font-size: var(--font-xxs);
    flex-basis: 100%;
}

/* ── Taxonomy rank icons (colored circles with letter) ── */
.rank-icon {
    display: inline-block;
    width: 14px;
    height: 14px;
    line-height: 14px;
    border-radius: var(--radius-circle);
    text-align: center;
    font-family: Verdana, sans-serif;
    font-size: 9px;
    font-weight: bold;
    font-style: normal;
    color: #fff;
    vertical-align: middle;
}
.rank-icon-class      { background-color: var(--rank-class-color); }
.rank-icon-class::before      { content: "C"; }
.rank-icon-order      { background-color: var(--rank-order-color); }
.rank-icon-order::before      { content: "O"; }
.rank-icon-family     { background-color: var(--rank-family-color); }
.rank-icon-family::before     { content: "F"; }
.rank-icon-genus      { background-color: var(--rank-genus-color); }
.rank-icon-genus::before      { content: "G"; }
.rank-icon-species    { background-color: var(--rank-species-color); }
.rank-icon-species::before    { content: "S"; }
.rank-icon-subspecies { background-color: var(--rank-subspecies-color); font-size: 7px; }
.rank-icon-subspecies::before { content: "Ss"; }

/* ── Hydrography (HUC) rank icons (colored circles with HUC level number) ── */
.huc-icon {
    display: inline-block;
    width: 14px;
    height: 14px;
    line-height: 14px;
    border-radius: var(--radius-circle);
    text-align: center;
    font-family: Verdana, sans-serif;
    font-size: 9px;
    font-weight: bold;
    font-style: normal;
    color: #fff;
    vertical-align: text-bottom;
    position: relative;
    top: -1px;
    margin-right: 0.25rem;
}
.huc-icon-2  { background-color: var(--rank-phylum-color); }
.huc-icon-2::before  { content: "2"; }
.huc-icon-4  { background-color: var(--rank-class-color); }
.huc-icon-4::before  { content: "4"; }
.huc-icon-6  { background-color: var(--rank-order-color); }
.huc-icon-6::before  { content: "6"; }
.huc-icon-8  { background-color: var(--rank-family-color); }
.huc-icon-8::before  { content: "8"; }
.huc-icon-10 { background-color: var(--rank-genus-color); font-size: 7px; }
.huc-icon-10::before { content: "10"; }
.huc-icon-12 { background-color: var(--rank-species-color); font-size: 7px; }
.huc-icon-12::before { content: "12"; }

.compact-hierarchy .huc-entry { display: block; }
.compact-hierarchy .huc-2  { padding-left: 0; }
.compact-hierarchy .huc-4  { padding-left: 1rem; }
.compact-hierarchy .huc-6  { padding-left: 2rem; }
.compact-hierarchy .huc-8  { padding-left: 3rem; }
.compact-hierarchy .huc-10 { padding-left: 4rem; }
.compact-hierarchy .huc-12 { padding-left: 5rem; }

/* Determination: tree left, fields right */
.determination-layout {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0 2rem;
    font-size: var(--font-xs);
    line-height: 1.2;
    padding-left: 1.5rem;
}
.determination-layout h4 {
    grid-column: 1 / -1;
    font-weight: normal;
}
.compact-hierarchy {
    line-height: 1.4;
}
.compact-hierarchy .rank-icon {
    margin-right: 0.25rem;
}
.compact-hierarchy .rank-entry {
    display: block;
}
.compact-hierarchy .rank-class      { padding-left: 0; }
.compact-hierarchy .rank-order      { padding-left: 1rem; }
.compact-hierarchy .rank-family     { padding-left: 2rem; }
.compact-hierarchy .rank-genus      { padding-left: 3rem; }
.compact-hierarchy .rank-species    { padding-left: 4rem; }
.compact-hierarchy .rank-subspecies { padding-left: 5rem; }

.determination-fields {
    grid-column: 2;
    align-self: start;
}
.determination-fields .field-label {
    font-size: var(--font-xs);
    margin-bottom: -0.1rem;
}
.determination-fields > div {
    margin-bottom: 0.15rem;
}

.historical-data,
.historical-data a,
.historical-data h4,
.historical-data label {
    color: var(--fotx-gray-dark);
}

#custom_details {
    border: 1px solid var(--fotx-navy);
    border-radius: var(--radius-border);
    overflow: hidden;
    padding-top: 0;
}

#custom_details .data-compact {
    padding: 0.25rem 1rem 0.15rem 1.5rem;
    background-color: var(--fotx-gray-light);
}

.current-determination {
    position: relative;
    border: 1px solid var(--fotx-navy);
    padding: .5rem;
    background-color: #fff;
    border-radius: var(--radius-border);
}

.current-determination h4 {
    position: absolute;
    top: 0.35rem;
    right: 0.5rem;
    margin: 0;
    font-size: var(--font-xxs);
}

.current-determination + .previous-determination,
.previous-determination + .previous-determination {
    margin-top: 0.75rem;
}

.previous-determination {
    position: relative;
    border: 1px solid var(--fotx-gray);
    padding: .5rem;
    background-color: var(--fotx-gray-light);
    border-radius: var(--radius-border);
}

.previous-determination h4 {
    position: absolute;
    top: 0.35rem;
    right: 0.5rem;
    margin: 0;
    font-size: var(--font-xxs);
    color: var(--fotx-gray);
}

.mime-icon {
    margin-left: .5rem;
}

/* ==========================================================================
   23. Comments
   ========================================================================== */

#fotx_comments_form {
    background: var(--fotx-light-blue);
}

.comment {
    padding: 1rem;
    border: 1px solid var(--fotx-blue);
    border-radius: var(--radius-border);
    margin-bottom: 0.5rem;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.comment_user_name {
    font-weight: bold;
    font-size: var(--font-sm);
}

.comment_submit_date {
    font-size: var(--font-sm);
    color: var(--fotx-blue);
}

.comment_content {
    font-style: italic;
    line-height: 24px;
    white-space: pre-wrap;
}

#id_honeypot {
    display: none;
}

.comments-body {
    display: flex;
    align-items: flex-start;
    gap: 2rem;
}

.comments-content {
    flex: 1;
}

#comment_form {
    background: var(--fotx-light-blue);
    padding: 0.5rem 1rem;
    margin: 0;
    border: solid var(--fotx-blue) 1px;
    flex: 0 0 45%;
}

.comment-form-footer {
    display: flex;
    align-items: center;
    gap: 1rem;
    justify-content: space-between;
}

#comment_form table {
    padding: 0;
    margin: 0;
}

#comment_form th {
    text-align: left;
    padding: 5%;
}

#comment_form p {
    line-height: 24px;
    font-size: var(--font-sm);
}

#comment_form h3 {
    color: var(--fotx-navy);
    margin-top: 0;
    font-size: var(--font-lg);
}

#comment_form label {
    color: var(--fotx-navy);
    line-height: 30px;
}

#comment_form input {
    padding: 5px;
}

#comment_form input[type=submit] {
    width: auto;
    padding: 0.2rem 1.5rem;
    background: var(--fotx-navy);
    color: white;
}

#comment_form textarea {
    width: 100%;
    height: 7%;
}

#primary_photo_box {
    width: 96%;
    margin: 1rem;
}

#primary_photo {
    width: 99%;
    border-radius: var(--radius-border);
}

#primary_photo_title {
    padding: 5px;
}

/* ==========================================================================
   24. Photos / Media
   ========================================================================== */

.image-caption {
    text-align: center;
    font-size: var(--font-xxs);
    font-style: italic;
    color: var(--fotx-gray);
}

#photo_thumbnails,
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
    margin-top: 10px;
}

#photo_thumbnails a,
.photo-grid a {
    display: block;
    text-decoration: none;
    color: black;
}

#photo_thumbnails img,
.photo-grid img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    margin: 0 auto;
}

#photo_thumbnails .photo,
.photo-grid .photo {
    font-size: var(--font-xxs);
    color: var(--fotx-blue);
    min-width: 0;
}

.photo {
    position: relative;
}

.btn-attachment-delete {
    background: none;
    border: none;
    color: var(--fotx-gray);
    cursor: pointer;
    font-size: var(--font-xs);
    padding: 0.2rem;
}
.btn-attachment-delete:hover {
    color: var(--fotx-red);
}

.photo .attachment-delete-form {
    position: absolute;
    top: 2px;
    right: 2px;
}
.photo .btn-attachment-delete {
    background: rgba(255, 255, 255, 0.8);
    border-radius: var(--radius-border);
    padding: 0.15rem 0.3rem;
}

#photo_thumbnails .photo a,
.photo-grid .photo a {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 140px;
    border: 1px solid var(--fotx-navy);
    border-radius: var(--radius-border);
    overflow: hidden;
}

/* ==========================================================================
   25. Map
   ========================================================================== */

#map,
#mini_map {
    border: 1px solid var(--fotx-navy);
    border-radius: var(--radius-border);
}

/* Collection page: map sits between results toolbars, tuck it flush */
#map.map-flush {
    border-radius: 0;
    border: none;
    outline: none;
    margin: 0;
}

/* Hide pagination when map is active */
.map-mode .step-links { display: none; }

#map     { width: 100%; height: 640px; }
#mini_map { height: 300px; }

/* ── Leaflet layer control overrides ── */
.leaflet-control-layers {
    border: 1px solid var(--fotx-navy);
    border-radius: var(--radius-border);
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.2);
}

.leaflet-control-layers-expanded {
    padding: 8px 12px 8px 8px;
    color: var(--fotx-navy);
    font-family: Verdana, sans-serif;
    font-size: var(--font-sm);
}

.leaflet-control-layers label {
    font-family: Verdana, sans-serif;
    font-size: var(--font-sm);
    font-weight: bold;
    color: var(--fotx-navy);
}

.leaflet-control-layers-separator {
    border-top: 1px solid var(--fotx-gray-light);
}

/* ==========================================================================
   26. Loading Spinner
   ========================================================================== */

#loading {
    position: absolute;
    display: none;
    z-index: 9900;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

#page-loading-overlay {
    display: none;
    position: fixed;
    z-index: 9999;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.7);
}

#page-loading-overlay .spinner-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.spinner-ring {
    color: var(--fotx-blue);
    display: inline-block;
    position: relative;
    width: 175px;
    height: 175px;
}

.spinner-ring div {
    box-sizing: border-box;
    display: block;
    position: absolute;
    width: 140px;
    height: 140px;
    margin: 17.5px;
    border: 17px solid currentColor;
    border-radius: 50%;
    animation: spinner-ring 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
    border-color: var(--fotx-blue) transparent transparent transparent;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    transform: translateZ(0);
}

.spinner-ring div:nth-child(1) { animation-delay: -0.45s; }
.spinner-ring div:nth-child(2) { animation-delay: -0.3s; }
.spinner-ring div:nth-child(3) { animation-delay: -0.15s; }

@keyframes spinner-ring {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}


/* ==========================================================================
   27. Messages
   ========================================================================== */

.message {
    color: var(--fotx-red);
    font-style: italic;
    background: var(--fotx-light-blue);
    border: 1px solid var(--fotx-navy);
    padding: 1rem;
    border-radius: var(--radius-pill);
    margin: 1rem 0;
}


/* ==========================================================================
   28. Icon Replacements (replaces Font Awesome)
   ========================================================================== */

.icon-caret::before    { content: "\25B6"; }
.icon-close::before    { content: "\2716"; font-size: 1.4em; }
.icon-pdf::before      { content: "\1F4C4"; }
.icon-heart::before    { content: "\2665"; }

/* ==========================================================================
   29. Documentation Pages & Statistics
   ========================================================================== */

.documentation-layout {
    display: flex;
    gap: 2rem;
}

.documentation-sidebar {
    flex: 0 0 240px;
    padding-right: 1.5rem;
}

.documentation-breadcrumbs ol {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    padding: 0;
    margin: 0 0 0.5rem;
    font-family: Verdana, Geneva, sans-serif;
    font-size: var(--font-sm);
}
.documentation-breadcrumbs li + li::before {
    content: "›";
    margin: 0 0.4em;
    color: var(--fotx-gray);
}
.documentation-breadcrumbs li[aria-current="page"] {
    color: var(--fotx-gray);
}

.documentation-body {
    flex: 1;
    min-width: 0;
    font-family: 'EB Garamond', serif;
    font-size: var(--font-lg);
    line-height: 1.45;
    text-align: justify;
}

/* Page title — direct child h2 from the template */
.documentation-body > h2 {
    font-family: Verdana, Geneva, sans-serif;
    font-size: var(--font-lg);
    margin-bottom: 0;
    text-align: left;
}

.documentation-body span[style*="color"] {
    color: inherit !important;
}

.documentation-body a {
    text-decoration: none !important;
}

.documentation-body a:hover {
    text-decoration: underline !important;
}

.documentation-body > div:first-of-type > p:first-child,
.documentation-body > p:first-of-type {
    margin-top: 0.3rem;
}

/* Wiki content heading hierarchy (all smaller than the page title h2) */
.documentation-body h1 {
    font-family: Verdana, Geneva, sans-serif;
    font-size: var(--font-base);
    margin-top: 0.8rem;
    margin-bottom: 0;
    text-align: left;
}

.documentation-body h1 + p,
.documentation-body h1 + ul,
.documentation-body h1 + ol,
.documentation-body div h2 + p,
.documentation-body div h2 + ul,
.documentation-body div h2 + ol,
.documentation-body h3 + p,
.documentation-body h3 + ul,
.documentation-body h3 + ol,
.documentation-body h4 + p,
.documentation-body h4 + ul,
.documentation-body h4 + ol {
    margin-top: 0.2rem;
}

.documentation-body div h2 {
    font-family: Verdana, Geneva, sans-serif;
    font-size: var(--font-sm);
    margin-top: 1.2rem;
    margin-bottom: 0.2rem;
    text-align: left;
}

.documentation-body h3 {
    font-family: Verdana, Geneva, sans-serif;
    font-size: var(--font-sm);
    margin-top: 1rem;
    margin-bottom: 0.15rem;
    text-align: left;
}

.documentation-body h4 {
    font-family: Verdana, Geneva, sans-serif;
    font-size: var(--font-2xs);
    margin-top: 0.8rem;
    margin-bottom: 0.15rem;
    text-align: left;
}

.documentation-body table {
    border-collapse: collapse;
    margin: 1rem 0;
}

.documentation-body th,
.documentation-body td {
    border: 1px solid var(--fotx-navy);
    padding: 0.4rem 0.8rem;
}

.documentation-body img {
    max-width: 100%;
    height: auto;
}

/* Statistics page */
.stats-summary {
    display: flex;
    gap: 1em;
    flex-wrap: wrap;
    margin-bottom: 2em;
}

/* ── Sidebar filter (shared: documentation + statistics) ── */
.documentation-search-form,
.sidebar-filter-form {
    margin-top: 5px;
    margin-bottom: 0.75rem;
    padding: 0 0.25rem;
    display: flex;
    gap: 0.3rem;
}

.documentation-search-form .form-control,
.sidebar-filter-form .form-control {
    border-color: var(--fotx-gray);
    flex: 1;
    min-width: 0;
}

.documentation-search-form .btn-clear-query,
.sidebar-filter-form .btn-clear-query {
    padding: 3px 8px;
    white-space: nowrap;
}

.search-result-count {
    font-family: Verdana, Geneva, sans-serif;
    font-size: var(--font-sm);
    color: var(--fotx-gray-dark);
    margin-bottom: 1.5rem;
}

.documentation-search-results .search-result {
    margin-bottom: 1.25rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--fotx-gray-light);
}

.search-result h3 {
    font-family: Verdana, Geneva, sans-serif;
    font-size: var(--font-base);
    margin: 0 0 0.15rem;
}

.search-result-path {
    font-family: Verdana, Geneva, sans-serif;
    font-size: var(--font-xs);
    color: var(--fotx-gray);
}

.search-result-snippet {
    font-size: var(--font-sm);
    line-height: 1.4;
    margin-top: 0.3rem;
}

.search-result-snippet mark {
    background: var(--fotx-light-blue);
    padding: 0.1em 0.15em;
    border-radius: 2px;
}

.sidebar-nav li.filter-match > a,
.sidebar-nav li.filter-match > .section-header > .section-link {
    color: var(--fotx-navy);
    font-weight: 700;
}

.stat-card {
    flex: 1 1 0;
    min-width: 0;
    background: var(--fotx-gray-light);
    border: 1px solid var(--fotx-gray);
    border-radius: var(--radius-border);
    padding: 1em 0.5em;
    text-align: center;
}

.stat-card .stat-value {
    font-size: var(--font-base);
    font-weight: bold;
    color: var(--fotx-navy);
    white-space: nowrap;
}

.stat-card .stat-label {
    font-size: var(--font-sm);
    color: var(--fotx-gray);
    margin-top: 0.3em;
}

.chart-container {
    margin-bottom: 2.5em;
    position: relative;
}

.chart-container h3 {
    margin-bottom: 0.5em;
    color: var(--fotx-navy);
}

.chart-container canvas {
    max-height: 400px;
}

.collectors-chart canvas {
    max-height: 1100px;
}

.stats-loading {
    text-align: center;
    padding: 3em;
    color: var(--fotx-gray);
}

.stats-error {
    color: var(--fotx-red);
}
