/* =============================================================================
   CWA Local 3410 – Custom Stylesheet
   =============================================================================

   BRAND COLORS – Edit the values in this block to change the site's palette.
   ─────────────────────────────────────────────────────────────────────────── */

:root {
    /* ── BRAND COLOR: Primary (CWA Red) ────────────────────────────────────── */
    --cwa-red:          #CC0000;
    --cwa-red-dark:     #990000;
    --cwa-red-light:    #E53935;

    /* ── BRAND COLOR: Secondary (White / light accent) ─────────────────────── */
    --cwa-white:        #FFFFFF;
    --cwa-off-white:    #F8F8F8;
    --cwa-light-gray:   #EEEEEE;

    /* ── Supporting palette ─────────────────────────────────────────────────── */
    --cwa-dark:         #1A1A1A;
    --cwa-text-muted:   #6c757d;
    --cwa-footer-bg:    #1A1A1A;

    /* ── Typography ─────────────────────────────────────────────────────────── */
    --cwa-font-family:  'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* ── Brand color utility classes ─────────────────────────────────────────── */

.bg-cwa-red  { background-color: var(--cwa-red) !important; }
.text-cwa-red { color: var(--cwa-red) !important; }

/* ── Base ─────────────────────────────────────────────────────────────────── */

html, body {
    height: 100%;
    font-family: var(--cwa-font-family);
    color: var(--cwa-dark);
    background-color: var(--cwa-off-white);
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1;
}

/* ── Footer ───────────────────────────────────────────────────────────────── */

.cwa-footer {
    background-color: var(--cwa-footer-bg);
    color: var(--cwa-white);
}

.footer-link {
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
    text-decoration: none;
}

.cwa-footer a.footer-link,
.cwa-footer a.footer-link:link,
.cwa-footer a.footer-link:visited,
.cwa-footer a.footer-link:active {
    color: rgba(255, 255, 255, 0.8) !important;
    display: inline-block;
    text-decoration: none !important;
}

.cwa-footer a.footer-link:hover,
.cwa-footer a.footer-link:focus {
    color: var(--cwa-red-light) !important;
    text-decoration: underline !important;
}

/* ── Navbar ───────────────────────────────────────────────────────────────── */

/* BRAND COLOR: Navbar background ↓ */
.cwa-navbar {
    background-color: var(--cwa-red) !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.cwa-navbar .navbar-brand,
.cwa-navbar .nav-link {
    color: var(--cwa-white) !important;
}

.cwa-navbar .nav-link:hover,
.cwa-navbar .nav-link.active {
    color: var(--cwa-white) !important;
    text-decoration: underline;
    text-underline-offset: 4px;
}

.contract-banner {
    background: linear-gradient(135deg, #fff4f4 0%, #fff 100%);
    border-bottom: 1px solid rgba(204, 0, 0, 0.15);
}

/* When Contract Watch is placed under header, keep it visibly below fixed nav. */
.cwa-navbar + .contract-banner {
    margin-top: 0.75rem;
}

.contract-banner-shell {
    padding: 1rem 0 1.25rem;
}

.contract-banner-kicker {
    color: var(--cwa-red);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.contract-timer-card {
    background: var(--cwa-white);
    border: 1px solid rgba(204, 0, 0, 0.12);
    border-radius: 0.85rem;
    box-shadow: 0 8px 24px rgba(26, 26, 26, 0.06);
    padding: 1rem;
}

.contract-timer-label {
    color: var(--cwa-red);
    font-size: 1rem;
    font-weight: 700;
}

.contract-timer-unit,
.contract-timer-meta {
    color: var(--cwa-text-muted);
    font-size: 0.875rem;
}

.contract-timer-clock {
    color: var(--cwa-dark);
    font-size: clamp(1.1rem, 2vw, 1.35rem);
    font-weight: 800;
    letter-spacing: 0.03em;
}

/* Logo badge (small "CWA" pill) */
.cwa-logo-badge {
    display: inline-block;
    background-color: var(--cwa-white);
    /* BRAND COLOR: badge text ↓ */
    color: var(--cwa-red);
    font-weight: 800;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    padding: 2px 7px;
    border-radius: 4px;
}

.cwa-brand-logo {
    background: #fff;
    border-radius: 6px;
    display: inline-block;
    height: 26px;
    object-fit: contain;
    padding: 2px 4px;
    width: auto;
}

.cwa-brand-logo-footer {
    height: 22px;
    vertical-align: middle;
}

/* ── Hero Section ─────────────────────────────────────────────────────────── */

.cwa-hero {
    /* BRAND COLOR: Hero gradient ↓ */
    background: linear-gradient(135deg, var(--cwa-red-dark) 0%, var(--cwa-red) 60%, var(--cwa-red-light) 100%);
    color: var(--cwa-white);
    padding: 5rem 0 4rem;
    position: relative;
    overflow: hidden;
}

.cwa-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80'%3E%3Ccircle cx='40' cy='40' r='35' fill='none' stroke='rgba(255,255,255,0.05)' stroke-width='2'/%3E%3C/svg%3E") repeat;
    pointer-events: none;
}

.cwa-hero h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 800;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.cwa-hero .lead {
    font-size: clamp(1rem, 2.5vw, 1.3rem);
    opacity: 0.92;
}

/* ── Hero two-column layout helpers ──────────────────────────────────────────
   These classes work together to create the logo-left / text-right hero layout
   on the homepage (index.php). Bootstrap's grid (col-lg-4 / col-lg-8) handles
   the column split; these classes handle fine-grained positioning and styling.
   ─────────────────────────────────────────────────────────────────────────── */

/* Stacking context wrapper – keeps content above the ::before pattern overlay */
.cwa-hero-layout {
    position: relative;
    z-index: 1;
}

/* Centres the logo on mobile; shifts it left-aligned on desktop via the
   @media (min-width: 992px) rule at the bottom of this file. */
.cwa-hero-logo-wrap {
    display: flex;
    justify-content: center;
}

/* The uploaded brand logo card in the hero.
   – White background + rounded corners frame the logo against the red gradient.
   – object-fit: contain preserves the aspect ratio regardless of image dimensions.
   – max-height / width: min() clamp the size so it never overwhelms the layout.
   To adjust logo size: change max-height and/or the second value in width: min(). */
.cwa-hero-logo {
    background: rgba(255, 255, 255, 0.96);
    border-radius: 0.85rem;
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.18);
    display: block;
    max-height: 230px;
    object-fit: contain;
    padding: 0.85rem 1rem;
    width: min(100%, 320px);
}

/* Enlarged variant of the .cwa-logo-badge pill used as the hero fallback
   when no brand logo has been uploaded yet. */
.cwa-logo-badge-hero {
    border-radius: 0.85rem;
    font-size: clamp(1rem, 2.2vw, 1.35rem);
    padding: 0.8rem 1.5rem;
}

/* Caps the text column width so long lines stay comfortable to read on
   ultra-wide screens; Bootstrap handles gutters and column widths. */
.cwa-hero-copy {
    max-width: 760px;
}

/* ── Meetings page ───────────────────────────────────────────────────────── */

/*
   Bulk download bar at the top of meetings.php.
   Provides a single-click "Download All (.ics)" action for members who
   want to import the full 2026 schedule into their calendar app at once.
*/
.meetings-bulk-bar {
    background: var(--cwa-off-white);
    border: 1px solid rgba(204, 0, 0, 0.15);
    border-left: 5px solid var(--cwa-red);
}

/*
   Individual meeting card used in the upcoming-meetings grid on meetings.php.
   Structured as a flex column so the calendar buttons always sit at the
   bottom of the card regardless of how much description text is present.
*/
.meeting-list-card {
    background: var(--cwa-white);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 0.6rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.07);
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.meeting-list-card:hover {
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}

/* Padded header region containing the date badge and meeting title */
.meeting-list-card-header {
    background: rgba(204, 0, 0, 0.04);
    border-bottom: 1px solid rgba(204, 0, 0, 0.1);
    padding: 0.9rem 1rem;
}

/* Scrollable body area for time, location, and description text */
.meeting-list-card-body {
    padding: 0.75rem 1rem 0;
}

/* Footer holds the Google / Apple calendar action buttons.
   The flex-wrap allows the two buttons to stack on very narrow cards. */
.meeting-list-card-footer {
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
}

/* ── Section Headings ─────────────────────────────────────────────────────── */

.section-title {
    font-weight: 700;
    /* BRAND COLOR: Section title underline ↓ */
    border-left: 5px solid var(--cwa-red);
    padding-left: 0.75rem;
    margin-bottom: 1.5rem;
    color: var(--cwa-dark);
}

/* ── Cards ────────────────────────────────────────────────────────────────── */

.cwa-card {
    border: none;
    border-radius: 0.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    background-color: var(--cwa-white);
}

.cwa-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

.cwa-card .card-header {
    /* BRAND COLOR: Card header background ↓ */
    background-color: var(--cwa-red);
    color: var(--cwa-white);
    font-weight: 600;
    border-radius: 0.5rem 0.5rem 0 0 !important;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */

/* BRAND COLOR: Primary button ↓ */
.btn-cwa {
    background-color: var(--cwa-red);
    border-color:     var(--cwa-red);
    color:            var(--cwa-white);
    font-weight: 600;
}

.btn-cwa:hover,
.btn-cwa:focus {
    background-color: var(--cwa-red-dark);
    border-color:     var(--cwa-red-dark);
    color:            var(--cwa-white);
}

.btn-cwa-outline {
    border: 2px solid var(--cwa-white);
    color: var(--cwa-white);
    font-weight: 600;
    background: transparent;
}

.btn-cwa-outline:hover {
    background-color: var(--cwa-white);
    color: var(--cwa-red);
}

/* ── Meeting / Next-Event card ────────────────────────────────────────────── */

.meeting-card {
    border-left: 5px solid var(--cwa-red);
    border-radius: 0.5rem;
    background: var(--cwa-white);
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
    padding: 1.5rem;
}

.meeting-date-badge {
    /* BRAND COLOR: date badge ↓ */
    background-color: var(--cwa-red);
    color: var(--cwa-white);
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    text-align: center;
    min-width: 60px;
    font-weight: 700;
    line-height: 1.2;
}

/* ── Document / Stewards page ─────────────────────────────────────────────── */

.doc-row {
    display: flex;
    align-items: center;
    padding: 0.85rem 1rem;
    border-radius: 0.4rem;
    background: var(--cwa-white);
    box-shadow: 0 1px 4px rgba(0,0,0,0.07);
    margin-bottom: 0.75rem;
    gap: 1rem;
}

.doc-row:hover {
    background-color: #fff5f5;   /* BRAND COLOR: hover tint ↓ */
}

.doc-icon {
    /* BRAND COLOR: doc icon ↓ */
    color: var(--cwa-red);
    font-size: 1.6rem;
    flex-shrink: 0;
}

/* ── Leadership grid ──────────────────────────────────────────────────────── */

.leader-card {
    border: none;
    border-radius: 0.75rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    overflow: hidden;
    background: var(--cwa-white);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

.leader-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
}

.leader-card:focus-visible {
    outline: 3px solid rgba(204, 0, 0, 0.35);
    outline-offset: 3px;
}

.leader-card .card-img-top {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 50%;
    border: 4px solid var(--cwa-red);   /* BRAND COLOR: photo border ↓ */
    margin: 1.5rem auto 0;
    display: block;
}

/* Avatar placeholder – mirrors the circular photo style for leaders without a photo. */
.avatar-placeholder {
    align-items: center;
    background-color: var(--cwa-light-gray);
    border: 4px solid var(--cwa-red);   /* BRAND COLOR: placeholder border ↓ */
    border-radius: 50%;
    color: var(--cwa-text-muted);
    display: flex;
    font-size: 3rem;
    height: 120px;
    justify-content: center;
    margin: 1.5rem auto 0;
    width: 120px;
}

/* Larger variant used inside the contact-card modal. */
.leader-contact-photo--placeholder {
    font-size: 3.5rem;
    height: 132px;
    width: 132px;
}

.leader-card .card-title {
    font-weight: 700;
    margin-top: 0.75rem;
}

.leader-card .leader-title-badge {
    /* BRAND COLOR: role badge ↓ */
    background-color: var(--cwa-red);
    color: var(--cwa-white);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 20px;
    display: inline-block;
    margin-bottom: 0.5rem;
}

/* ── Admin / Dashboard ────────────────────────────────────────────────────── */

.admin-sidebar {
    min-height: calc(100vh - 56px);
    background-color: var(--cwa-dark);
    color: var(--cwa-white);
    padding-top: 1.5rem;
}

.admin-sidebar .nav-link {
    color: rgba(255,255,255,0.75);
    padding: 0.5rem 1.25rem;
    border-radius: 0.3rem;
    margin-bottom: 2px;
}

.admin-sidebar .nav-link:hover,
.admin-sidebar .nav-link.active {
    /* BRAND COLOR: admin sidebar active ↓ */
    background-color: var(--cwa-red);
    color: var(--cwa-white);
}

.admin-header {
    background-color: var(--cwa-red);
    color: var(--cwa-white);
    padding: 0.6rem 1.25rem;
}

.admin-dashboard-main {
    --top-nav-offset: 0;
}

.admin-quick-nav {
    background: rgba(26, 26, 26, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 0.75rem;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.16);
    position: sticky;
    top: var(--top-nav-offset);
    z-index: 1025;
}

.admin-quick-nav-shell {
    padding-bottom: 0.45rem;
    padding-top: 0.45rem;
}

.admin-quick-nav-head {
    align-items: center;
    display: grid;
    gap: 0.35rem;
    grid-template-columns: minmax(0, 1fr) auto auto;
    min-height: 36px;
}

.admin-quick-title {
    color: rgba(255, 255, 255, 0.92);
    font-size: 0.95rem;
    min-width: 0;
}

.admin-health-center-btn {
    align-items: center;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 999px;
    color: rgba(255, 255, 255, 0.92);
    display: inline-flex;
    font-weight: 600;
    grid-column: 2 / 3;
    justify-content: center;
    min-height: 40px;
    padding: 0.35rem 0.85rem;
    position: static;
    text-decoration: none;
    transform: none;
    white-space: nowrap;
}

.admin-health-center-btn:hover,
.admin-health-center-btn:focus {
    background: var(--cwa-red);
    color: #fff;
}

.admin-quick-toggle {
    border-color: rgba(255, 255, 255, 0.35);
    grid-column: 3 / 4;
    margin-left: 0;
}

.admin-quick-toggle:focus {
    box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.2);
}

.admin-quick-links {
    border-top: 1px solid rgba(255, 255, 255, 0.16);
    padding-top: 0.45rem;
}

.admin-quick-links-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    overflow-x: visible;
    padding-bottom: 0.2rem;
    white-space: normal;
}

.admin-quick-link {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    color: rgba(255, 255, 255, 0.9);
    display: inline-flex;
    flex: 0 0 auto;
    font-size: 0.9rem;
    min-height: 44px;
    padding: 0.5rem 0.9rem;
    text-decoration: none;
}

.admin-quick-link:hover,
.admin-quick-link:focus {
    background: var(--cwa-red);
    color: #fff;
}

.admin-quick-link-danger {
    color: #ffb3b3;
}

.admin-main-content {
    padding-top: 1rem;
}

/* Login page shell: let main consume remaining body space without forcing
   oversized viewport math that can overflow on short landscape screens. */
.admin-login-main {
    padding-bottom: 2rem;
    padding-top: 2rem;
}

/* Prevent section headings from hiding behind fixed top + page nav bars. */
.admin-main-content section[id],
.health-main section[id] {
    scroll-margin-top: 112px;
}

.health-main {
    --health-nav-top: 56px;
}

.health-sidebar {
    background-color: var(--cwa-dark);
    color: var(--cwa-white);
    padding-top: 1.5rem;
}

.health-sidebar .nav-link {
    border-radius: 0.3rem;
    color: rgba(255, 255, 255, 0.75);
    margin-bottom: 2px;
    padding: 0.5rem 1.25rem;
}

.health-sidebar .nav-link:hover,
.health-sidebar .nav-link.active {
    background-color: var(--cwa-red);
    color: var(--cwa-white);
}

.health-quick-nav {
    background: rgba(26, 26, 26, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 0.75rem;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.16);
    position: sticky;
    top: var(--health-nav-top);
    z-index: 1025;
}

.health-quick-nav-shell {
    padding: 0.4rem 0.6rem;
}

.health-quick-nav-head {
    align-items: center;
    display: flex;
    flex-wrap: nowrap;
    gap: 0.4rem;
    justify-content: space-between;
    min-height: 40px;
}

.health-quick-head-left,
.health-quick-head-center,
.health-quick-head-right {
    align-items: center;
    display: flex;
}

.health-quick-head-left {
    flex: 1 1 auto;
    justify-content: center;
    min-width: 0;
}

.health-quick-head-center {
    flex: 0 1 auto;
    gap: 0.4rem;
    justify-content: center;
}

.health-quick-head-right {
    flex: 1 1 auto;
    justify-content: flex-end;
}

.health-quick-title {
    color: rgba(255, 255, 255, 0.95) !important;
    font-size: 0.95rem;
    font-weight: 700;
}
.health-nav-action {
    align-items: center;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 999px;
    color: rgba(255, 255, 255, 0.92);
    display: inline-flex;
    font-weight: 600;
    justify-content: center;
    min-height: 40px;
    padding: 0.38rem 0.85rem;
    text-decoration: none;
    white-space: nowrap;
}

.health-nav-action:hover,
.health-nav-action:focus {
    background: var(--cwa-red);
    color: #fff;
}

.health-quick-toggle {
    border-color: rgba(255, 255, 255, 0.35);
    margin-left: auto;
}

.health-quick-links {
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding-top: 0.45rem;
}

.health-quick-links-grid {
    align-items: stretch;
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    justify-content: flex-start;
}

.health-quick-link {
    align-items: center;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 999px;
    color: rgba(255, 255, 255, 0.92);
    display: inline-flex;
    font-size: 0.85rem;
    justify-content: center;
    min-height: 44px;
    min-width: 165px;
    padding: 0.5rem 0.9rem;
    text-decoration: none;
}

.health-quick-link:hover,
.health-quick-link:focus {
    background: var(--cwa-red);
    color: #fff;
}

.health-section {
    scroll-margin-top: 100px;
}

.health-security-table th,
.health-security-table td {
    text-align: center;
    vertical-align: middle;
}

.health-security-table td .d-flex.flex-wrap {
    justify-content: center;
}

.site-back-to-top {
    border-radius: 999px;
    bottom: 18px;
    display: none;
    padding: 0.45rem 0.7rem;
    position: fixed;
    right: 18px;
    z-index: 1080;
}

.leader-contact-photo {
    width: 132px;
    height: 132px;
    object-fit: cover;
    border-radius: 50%;
    border: 4px solid var(--cwa-red);
}

.leader-contact-photo--placeholder {
    margin-top: 0;
}

.leader-contact-details {
    background: #f8f8f8;
    border-radius: 0.85rem;
    padding: 1rem;
}

.gallery-album {
    border-radius: 1rem;
}

.gallery-album-cover {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 260px;
    object-fit: cover;
}

.gallery-album-cover--placeholder {
    align-items: center;
    background: linear-gradient(135deg, #f4f4f4 0%, #e8e8e8 100%);
    color: var(--cwa-text-muted);
    display: flex;
    font-size: 3rem;
    justify-content: center;
}

.gallery-photo-tile {
    color: inherit;
    display: block;
    text-decoration: none;
}

.gallery-photo-image {
    border-radius: 0.75rem;
    box-shadow: 0 4px 16px rgba(26, 26, 26, 0.08);
    display: block;
    height: 140px;
    object-fit: cover;
    width: 100%;
}

.gallery-photo-caption {
    color: var(--cwa-text-muted);
    display: block;
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

.feature-panel {
    background: #fff7f7;
    border: 1px solid rgba(204, 0, 0, 0.1);
    border-radius: 0.85rem;
    padding: 1rem;
}

.partnership-contact-card,
.retiree-contact-card {
    box-shadow: 0 10px 28px rgba(26, 26, 26, 0.08);
}

.contact-detail-row {
    align-items: flex-start;
    display: flex;
    gap: 0.85rem;
}

.contact-detail-row i {
    color: var(--cwa-red);
    font-size: 1.1rem;
    margin-top: 0.15rem;
}

.partnership-doc-card {
    border: 1px solid rgba(204, 0, 0, 0.12);
}

.partnership-doc-type-badge {
    background: #fff1f1;
    border: 1px solid rgba(204, 0, 0, 0.2);
    color: var(--cwa-red-dark);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.partnership-doc-meta {
    border-top: 1px dashed rgba(0, 0, 0, 0.12);
    padding-top: 0.55rem;
}

.admin-docs-table td,
.admin-docs-table th {
    vertical-align: middle;
}

.admin-docs-table td a.small {
    display: inline-block;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: bottom;
    white-space: nowrap;
}

/* ── Consolidated responsive/navigation system ───────────────────────────── */

:root {
    --cwa-top-nav-offset: 60px;
}

.cwa-navbar + .contract-banner {
    margin-top: 0.75rem;
}

.admin-main-content section[id],
.health-main section[id] {
    scroll-margin-top: 112px;
}

/* Desktop/tablet: fixed top navbar + fixed independent sidebars. */
@media (min-width: 768px) and (min-height: 500px) {
    body {
        padding-top: var(--cwa-top-nav-offset);
    }

    .cwa-navbar {
        height: var(--cwa-top-nav-offset);
        left: 0;
        position: fixed;
        right: 0;
        top: 0;
        width: 100%;
        z-index: 1040;
    }

    .admin-quick-nav,
    .health-quick-nav {
        display: none !important;
    }

    .admin-sidebar,
    .health-sidebar {
        align-self: flex-start;
        display: flex !important;
        left: 0;
        max-height: calc(100vh - var(--cwa-top-nav-offset));
        overflow-y: auto;
        overscroll-behavior: contain;
        position: fixed;
        scrollbar-gutter: stable;
        top: var(--cwa-top-nav-offset);
        z-index: 1032;
    }

    .admin-dashboard-main .row,
    .health-layout {
        align-items: flex-start;
    }

    .admin-main-content,
    .health-main-content {
        margin-left: 25%;
        min-width: 0;
    }

    .admin-sidebar,
    .health-sidebar {
        max-width: 25%;
        width: 25%;
    }
}

@media (min-width: 992px) and (min-height: 500px) {
    .admin-main-content,
    .health-main-content {
        margin-left: 16.666667%;
    }

    .admin-sidebar,
    .health-sidebar {
        max-width: 16.666667%;
        width: 16.666667%;
    }

    .cwa-hero-logo-wrap {
        justify-content: flex-start;
    }
}

/* Mobile: static top navbar and quick nav overlays. */
@media (max-width: 767.98px) {
    body {
        padding-top: 0;
    }

    .cwa-navbar {
        position: static;
        top: auto;
    }

    .cwa-navbar + .contract-banner {
        margin-top: 0;
    }

    .admin-sidebar,
    .health-sidebar {
        display: none !important;
    }

    .admin-quick-nav,
    .health-quick-nav {
        display: block !important;
        margin-top: 0 !important;
        position: sticky;
        top: 0 !important;
        z-index: 1031;
    }

    .admin-quick-nav {
        background: rgba(26, 26, 26, 0.92);
        border: 1px solid rgba(255, 255, 255, 0.16);
        border-radius: 0.7rem;
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.16);
        margin-bottom: 0.6rem;
    }

    .admin-quick-nav {
        background: rgba(26, 26, 26, 0.92);
        border: 1px solid rgba(255, 255, 255, 0.16);
        border-radius: 0.7rem;
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.16);
        margin-bottom: 0.6rem;
    }

    .health-main {
        padding-top: 0 !important;
    }

    .admin-login-main {
        padding-bottom: 1.25rem;
        padding-top: 1.25rem;
    }

    .admin-main-content {
        padding-left: 0.55rem !important;
        padding-right: 0.55rem !important;
    }

    .admin-main-content section[id],
    .health-main section[id] {
        scroll-margin-top: 72px;
    }

    .health-security-legend {
        background: #f8f9fa;
        border: 1px solid #e2e6ea;
        border-radius: 0.6rem;
        font-size: 0.78rem;
        line-height: 1.35;
        padding: 0.5rem 0.6rem;
    }

    .activity-log-table {
        table-layout: fixed;
    }

    .activity-log-table th:nth-child(4),
    .activity-log-table td:nth-child(4),
    .activity-log-table th:nth-child(5),
    .activity-log-table td:nth-child(5) {
        display: none;
    }

    .activity-log-table td {
        font-size: 0.84rem;
        overflow-wrap: anywhere;
        white-space: normal;
    }
}

/* Small phones and stacked card tables. */
@media (max-width: 576px) {
    .contract-banner-shell {
        padding: 0.85rem 0 1rem;
    }

    .cwa-hero {
        padding: 3rem 0 2.5rem;
    }

    .meeting-card {
        flex-direction: column;
        text-align: center;
    }

    .doc-row {
        align-items: flex-start;
        flex-wrap: wrap;
        gap: 0.55rem;
        padding: 0.75rem;
    }

    .doc-row .btn {
        width: 100%;
    }

    .partnership-doc-card {
        padding: 0.8rem !important;
    }

    .partnership-doc-card .btn {
        width: 100%;
    }

    .partnership-doc-type-badge {
        font-size: 0.62rem;
    }

    .admin-docs-table th,
    .admin-docs-table td {
        font-size: 0.8rem;
        padding: 0.38rem 0.32rem;
    }

    .admin-docs-table:not(.admin-partnership-docs-table) th:nth-child(4),
    .admin-docs-table:not(.admin-partnership-docs-table) td:nth-child(4),
    .admin-partnership-docs-table th:nth-child(3),
    .admin-partnership-docs-table td:nth-child(3) {
        display: none;
    }

    .admin-docs-table td a.small {
        max-width: 130px;
    }

    .gallery-album-cover {
        min-height: 220px;
    }

    .site-back-to-top {
        bottom: 14px;
        right: 14px;
    }

    .health-quick-nav {
        border-radius: 0.65rem;
    }

    .health-quick-title {
        font-size: 0.9rem;
    }

    .health-nav-action {
        flex: 1 1 auto;
        font-size: 0.72rem;
        justify-content: center;
        min-height: 38px;
        min-width: 135px;
        padding: 0.25rem 0.55rem;
    }

    .health-quick-nav-head {
        align-items: center;
        display: grid;
        gap: 0.3rem;
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto;
    }

    .health-quick-head-left {
        grid-column: 1 / 2;
        grid-row: 1;
        justify-content: center;
    }

    .health-quick-head-center {
        grid-column: 1 / 3;
        grid-row: 2;
        justify-content: center;
        width: 100%;
    }

    .health-quick-head-right {
        grid-column: 2 / 3;
        grid-row: 1;
        justify-content: flex-end;
    }

    .admin-events-table th,
    .admin-events-table td {
        font-size: 0.8rem;
        padding: 0.4rem 0.35rem;
        vertical-align: middle;
    }

    .admin-events-table .col-location,
    .admin-events-table .col-status,
    .admin-events-table .col-popup {
        display: none;
    }

    .admin-events-table .col-title {
        min-width: 140px;
    }

    .admin-events-table .col-date {
        white-space: nowrap;
    }

    .admin-events-table .event-toggle-btn {
        align-items: center;
        display: inline-flex;
        gap: 0.25rem;
        padding: 0.25rem 0.4rem;
    }

    .admin-events-table .event-toggle-btn-text {
        display: none;
    }

    .admin-events-table .event-actions-group .btn {
        padding: 0.25rem 0.4rem;
    }

    .admin-users-table thead,
    .health-security-table thead {
        display: none;
    }

    .admin-users-table,
    .admin-users-table tbody,
    .admin-users-table tr,
    .admin-users-table td,
    .health-security-table,
    .health-security-table tbody,
    .health-security-table tr,
    .health-security-table td {
        display: block;
        width: 100%;
    }

    .admin-users-table tr,
    .health-security-table tr {
        background: #fff;
        border: 1px solid rgba(0, 0, 0, 0.1);
        border-radius: 0.6rem;
        margin-bottom: 0.75rem;
        padding: 0.55rem 0.6rem;
    }

    .admin-users-table td,
    .health-security-table td {
        border: 0;
        padding: 0.3rem 0;
    }

    .admin-users-table td::before,
    .health-security-table td::before {
        color: var(--cwa-text-muted);
        content: attr(data-label);
        display: block;
        font-size: 0.74rem;
        font-weight: 700;
        margin-bottom: 0.18rem;
        text-transform: uppercase;
    }

    .admin-users-table td input,
    .admin-users-table td select {
        max-width: 100%;
    }

    .health-security-table td .d-flex.flex-wrap {
        justify-content: center;
        width: 100%;
    }
}

/* Landscape-phone only. */
@media (orientation: landscape) and (max-width: 991.98px) and (max-height: 499.98px) {
    body {
        padding-top: 0 !important;
    }

    .cwa-navbar {
        position: static !important;
        top: auto !important;
    }

    .cwa-navbar {
        padding-bottom: 0.2rem;
        padding-top: 0.2rem;
    }

    .cwa-navbar.navbar-expand-lg .navbar-toggler {
        display: block;
    }

    .cwa-navbar.navbar-expand-lg .navbar-collapse {
        display: none !important;
        flex-basis: 100%;
    }

    .cwa-navbar.navbar-expand-lg .navbar-collapse.show {
        display: block !important;
    }

    .cwa-navbar.navbar-expand-lg .navbar-nav {
        margin-top: 0.35rem;
    }

    .cwa-navbar .navbar-brand {
        font-size: 0.95rem;
    }

    .cwa-logo-badge {
        font-size: 0.68rem;
        padding: 1px 6px;
    }

    .cwa-navbar .nav-link {
        padding-bottom: 0.3rem;
        padding-top: 0.3rem;
    }

    .admin-sidebar,
    .health-sidebar {
        display: none !important;
    }


    .admin-login-main {
        padding-bottom: 0.85rem;
        padding-top: 0.85rem;
    }
    .admin-main-content,
    .health-main-content {
        margin-left: 0 !important;
        max-width: 100%;
        width: 100% !important;
    }

    .admin-quick-nav,
    .health-quick-nav {
        display: block !important;
        margin-top: 0 !important;
        position: sticky;
        top: 0 !important;
        z-index: 1031;
    }

    .admin-quick-nav-head {
        align-items: center;
        display: grid !important;
        gap: 0.25rem;
        grid-template-columns: minmax(0, 1fr) auto auto;
        grid-template-rows: auto;
        min-height: 36px;
    }

    .admin-health-center-btn {
        grid-column: 2 / 3;
        grid-row: 1;
        left: auto;
        min-height: 36px;
        padding: 0.22rem 0.55rem;
        position: static;
        transform: none;
        width: auto;
    }

    .admin-quick-toggle {
        grid-column: 3 / 4;
        grid-row: 1;
    }

    .partnership-doc-card .btn {
        min-height: 34px;
        padding: 0.3rem 0.5rem;
    }

    .admin-docs-table th,
    .admin-docs-table td {
        font-size: 0.78rem;
        padding: 0.3rem;
    }

    /* Grievance steps: compact table + tighter add-step form */
    #grievance-steps .table th,
    #grievance-steps .table td {
        font-size: 0.78rem;
        padding: 0.3rem 0.4rem;
    }

    /* Hide verbose Description column in landscape to save horizontal space */
    #grievance-steps .table th:nth-child(4),
    #grievance-steps .table td:nth-child(4) {
        display: none;
    }

    /* Re-flow add-step form: 2-up grid instead of single cramped row */
    #grievance-steps form.row > [class*="col-md-"] {
        width: 50%;
    }

    #grievance-steps form.row > [class*="col-md-"]:last-child {
        width: 100%;
    }

    /* Icon legend: smaller tiles in landscape */
    #grievance-steps .card.bg-light .d-flex.flex-wrap {
        gap: 0.4rem !important;
    }

    #grievance-steps .card.bg-light .d-flex.flex-wrap > div {
        font-size: 0.72rem;
    }
}
