/* =============================================================
   Waqf Endowment Portal — Custom Styles
   ============================================================= */

/* ---- Variables --------------------------------------------- */
:root {
    /* ── Core brand palette (edit these to rebrand) ── */
    --brand-dark:        #0d2b22;   /* darkest green — login bg, hero bg */
    --brand-green:       #1a3c34;   /* primary brand green */
    --brand-mid:         #2e5e4e;   /* mid green — sidebar hover */
    --brand-green-dark:  #122b25;   /* dark green — button hover states */
    --brand-gold:        #f0b429;   /* primary gold / accent (deeper) */
    --brand-gold-bright: #f5c842;   /* brighter gold — used on hero/highlights */
    --brand-gold-light:  #ffe082;   /* light gold — gradient endpoint */
    --brand-focus:       #1a7a6e;   /* focus ring — teal variant */
    --accent-green:      #2e7d32;   /* Bootstrap success green — leave independent */

    /* ── RGB companions for rgba() usage ── */
    --brand-green-rgb:   26, 60, 52;
    --brand-gold-rgb:    240, 180, 41;
    --brand-gold-bright-rgb: 245, 200, 66;

    /* ── Semantic aliases (inherit from palette) ── */
    --sidebar-bg:        var(--brand-green);
    --sidebar-hover:     var(--brand-mid);
    --sidebar-active:    var(--brand-gold);
    --body-bg:           #f0f2f0;

    /* ── Radius scale (use these instead of arbitrary px) ── */
    --radius-xs:         3px;       /* badges, chips */
    --radius-sm:         6px;       /* small cards, buttons */
    --radius-md:         8px;       /* default card / input */
    --radius-lg:         12px;      /* hero / large card */
    --radius-xl:         16px;      /* extra large surfaces */
    --radius-pill:       999px;     /* pills / capsules */

    /* ── Spacing scale (4px base) ── */
    --space-1:           4px;
    --space-2:           8px;
    --space-3:           12px;
    --space-4:           16px;
    --space-5:           20px;
    --space-6:           24px;
    --space-8:           32px;
    --space-10:          40px;
    --space-12:          48px;

    /* ── Type scale ── */
    --fs-xs:             11px;
    --fs-sm:             12px;
    --fs-base:           13px;
    --fs-md:             14px;
    --fs-lg:             15px;
    --fs-xl:             18px;
    --fs-2xl:            22px;
    --fs-3xl:            28px;
}

/* ---- Base -------------------------------------------------- */
body {
    background-color: var(--body-bg);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ---- App Layout -------------------------------------------- */
.app-wrapper {
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    min-width: 260px;
    background: var(--sidebar-bg);
    color: #fff;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.main-content {
    min-height: 100vh;
    overflow-x: hidden;
}

.content-area {
    min-height: calc(100vh - 70px);
    background: var(--body-bg);
}

/* ---- Sidebar Brand ----------------------------------------- */
.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 22px 20px 18px;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.3px;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    gap: 8px;
}

.sidebar-brand i {
    color: var(--brand-gold);
    font-size: 20px;
}

/* ---- Sidebar Nav ------------------------------------------ */
.sidebar-section-label {
    padding: 16px 20px 6px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.4);
}

.sidebar-nav {
    list-style: none;
    padding: 0 12px;
    margin: 0;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.15s ease, color 0.15s ease;
    margin-bottom: 2px;
}

.sidebar-nav li a:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.sidebar-nav li a.active {
    background: var(--brand-gold);
    color: var(--brand-green);
    font-weight: 700;
    box-shadow: 0 4px 14px -4px rgba(var(--brand-gold-rgb), 0.5);
}

/* Make count/badge pills readable when the nav link is active (gold bg).
   The pills carry inline styles from the three sidebar partials, so override with !important. */
.sidebar-nav li a.active .badge {
    background: rgba(26, 60, 52, 0.18) !important;
    color: var(--brand-green) !important;
}

.sidebar-nav li a i {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

/* ---- Topbar ------------------------------------------------ */
.topbar {
    height: 64px;
    position: sticky;
    top: 0;
    z-index: 100;
    background: #fff !important;
    box-shadow: 0 1px 0 #e5e7eb, 0 2px 8px rgba(0,0,0,0.04);
}

/* ---- Stat Cards -------------------------------------------- */
.stat-card {
    border-radius: 6px;
    padding: 26px 24px 22px;
    border: none;
    box-shadow: 0 4px 20px rgba(0,0,0,0.10);
    position: relative;
    overflow: hidden;
    transition: transform .18s ease, box-shadow .18s ease;
    color: #fff;
}
.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 32px rgba(0,0,0,0.16);
}

/* Tranche explainer (collapsible above chart) */
.tranche-explainer {
    margin-bottom: 14px;
}
.tranche-explainer > summary {
    list-style: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    user-select: none;
    padding: 0;
}
.tranche-explainer > summary::-webkit-details-marker { display: none; }
.tranche-explainer-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #f0faf5;
    border: 1px solid #d0ede0;
    color: var(--brand-green);
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 600;
    transition: background .15s ease, color .15s ease;
}
.tranche-explainer-pill strong {
    color: var(--brand-green);
    font-weight: 800;
}
.tranche-explainer > summary:hover .tranche-explainer-pill {
    background: var(--brand-green);
    color: #fff;
}
.tranche-explainer > summary:hover .tranche-explainer-pill strong {
    color: var(--brand-gold-light);
}
.tranche-explainer-caret {
    font-size: 12px;
    color: #999;
    transition: transform .2s ease;
}
.tranche-explainer[open] .tranche-explainer-caret {
    transform: rotate(180deg);
    color: var(--brand-green);
}
.tranche-explainer-body {
    margin-top: 10px;
    background: #f0faf5;
    border: 1px solid #d0ede0;
    border-left: 3px solid var(--brand-green);
    border-radius: 6px;
    padding: 12px 14px;
    font-size: 12.5px;
    line-height: 1.55;
    color: #2d4a3e;
}
.tranche-explainer-body p {
    margin: 0 0 8px;
}
.tranche-explainer-body strong {
    color: var(--brand-green);
    font-weight: 700;
}
.tranche-explainer-your {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed #d0ede0;
}
.tranche-explainer-your-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
    color: #6b8f7e;
}
.tranche-explainer-chip {
    display: inline-flex;
    align-items: center;
    background: #fff;
    border: 1px solid var(--brand-green);
    color: var(--brand-green);
    border-radius: 12px;
    padding: 2px 9px;
    font-size: 11px;
    font-weight: 700;
}
.tranche-explainer-chip-share {
    background: var(--brand-green);
    color: #fff;
}
.tranche-explainer-thanks {
    font-style: italic;
    color: var(--brand-green);
    margin: 8px 0 0 !important;
    font-size: 12px;
}
.tranche-explainer-desktop-hint {
    display: block;
    width: 100%;
    font-style: italic;
    color: #6b8f7e;
    font-size: 11px;
    margin-top: 4px;
}
@media (max-width: 575.98px) {
    .tranche-explainer-body { font-size: 11.5px; padding: 10px 12px; }
    .tranche-explainer-pill { font-size: 11px; padding: 3px 10px; }
}

/* Mobile back-to-dashboard chevron (topbar, subpages only) */
.mobile-back-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    margin: 0 6px 0 4px;
    border-radius: 6px;
    color: var(--brand-green);
    background: #f0faf5;
    border: 1px solid #d0ede0;
    text-decoration: none;
    font-size: 16px;
    transition: background .15s ease, transform .15s ease;
    flex-shrink: 0;
}
.mobile-back-link:hover,
.mobile-back-link:focus {
    background: var(--brand-green);
    color: #fff;
    text-decoration: none;
}
.mobile-back-link:active {
    transform: translateX(-2px);
}

/* Clickable stat card wrapper */
.stat-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
}
.stat-card-link:hover,
.stat-card-link:focus {
    text-decoration: none;
    color: inherit;
}
.stat-card-link:focus-visible .stat-card {
    outline: 2px solid var(--brand-gold);
    outline-offset: 2px;
}

/* Subtle radial glow in top-right corner */
.stat-card::after {
    content: '';
    position: absolute;
    top: -30px; right: -30px;
    width: 120px; height: 120px;
    border-radius: 50%;
    background: rgba(255,255,255,0.10);
    pointer-events: none;
}

/* Full gradient backgrounds */
.stat-card-green { background: linear-gradient(135deg, var(--brand-green) 0%, var(--accent-green) 100%); }
.stat-card-gold  { background: linear-gradient(135deg, #a86c00 0%, #e6a817 100%); }
.stat-card-blue  { background: linear-gradient(135deg, #0e4848 0%, #1a7a6e 100%); }
.stat-card-red   { background: linear-gradient(135deg, #7a2e2e 0%, #a84848 100%); }
.stat-card-muted { background: linear-gradient(135deg, #374151 0%, #6b7280 100%); }

/* Icon bubble — top right */
.stat-card-icon {
    position: absolute;
    top: 20px; right: 20px;
    width: 48px; height: 48px;
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    background: rgba(255,255,255,0.18);
    color: #fff;
}

/* Label */
.stat-card-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: rgba(255,255,255,0.75);
    margin-bottom: 8px;
}

/* Value */
.stat-card-value {
    font-size: 28px;
    font-weight: 800;
    color: #fff;
    line-height: 1.1;
    margin-bottom: 6px;
    padding-right: 56px;
}

/* ---- Cards ------------------------------------------------- */
.card {
    border-radius: 6px;
    border: 1px solid #e8ebe8 !important;
    box-shadow: 0 2px 12px rgba(0,0,0,0.05) !important;
    overflow: hidden;
}

.card-header {
    border-radius: 6px 6px 0 0 !important;
    border-bottom: 1px solid #eef0ee !important;
    background: #fff !important;
}

.card-header h6 {
    color: var(--brand-green);
}

/* ---- Tables ------------------------------------------------ */
.table th {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: #6b7280;
    background: #f7f8f7;
}

.table-hover > tbody > tr:hover > * {
    background-color: #f3f7f3;
}

/* ---- Login Page -------------------------------------------- */
.login-page {
    background: linear-gradient(135deg, var(--brand-dark) 0%, var(--brand-green) 50%, var(--brand-dark) 100%);
    position: relative;
    overflow: hidden;
}
.login-page::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url('../img/iar-pic.jpg');
    background-size: cover;
    background-position: center;
    opacity: 0.05;
    pointer-events: none;
    z-index: 0;
}
.login-page > * { position: relative; z-index: 1; }

.login-card {
    background: #fff;
    border-radius: 18px;
    padding: 36px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--brand-gold);
    color: var(--brand-green);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

/* ---- Document cards --------------------------------------- */
.document-card, .newsletter-card {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.document-card:hover, .newsletter-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.1) !important;
}

/* ---- Mobile sidebar --------------------------------------- */
@media (max-width: 991.98px) {
    .sidebar {
        position: fixed;
        z-index: 1050;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
    }
    .sidebar.show {
        transform: translateX(0);
    }
    #sidebarOverlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(13, 43, 34, 0.55); /* brand-dark tint, not pure black */
        z-index: 1049;
    }
}

/* ---- Utilities --------------------------------------------- */
.border-start.border-4 {
    border-left-width: 4px !important;
}

.text-white-75 {
    color: rgba(255,255,255,0.75) !important;
}

/* ---- Messages card (dashboard) ----------------------------- */
.card-messages {
    background: linear-gradient(160deg, #fffdf5 0%, #fff9e6 100%) !important;
    border-color: #f0d98a !important;
}
.card-messages .card-header {
    background: linear-gradient(90deg, #fef6d0 0%, #fffaeb 100%) !important;
    border-bottom-color: #f0d98a !important;
}
.card-messages .card-header h6 {
    color: #92680a;
}
.card-messages .list-group-item {
    background: transparent;
    border-color: #f5e8b0;
}
.card-messages .list-group-item:hover {
    background: rgba(240,180,41,0.08);
}

/* ---- Performance colors ------------------------------------ */
.performance-positive { color: var(--accent-green); font-weight: 600; }
.performance-negative { color: #c62828; font-weight: 600; }

/* ---- Responsive adjustments ------------------------------- */
@media (max-width: 575.98px) {
    .stat-card              { padding: 14px 12px 12px; }
    .stat-card-value        { font-size: 15px; padding-right: 36px; }
    .stat-card-label        { font-size: 9px; margin-bottom: 4px; }
    .stat-card-subtitle     { font-size: 10px; }
    .stat-card-icon         { width: 30px; height: 30px; font-size: 13px; top: 10px; right: 10px; border-radius: 8px; }
    .content-area           { padding: 16px !important; }
    .login-card             { padding: 22px; margin: 0 24px; max-width: calc(100% - 48px); border-radius: 14px; }
    .login-logo-img         { height: 60px !important; }
    /* Login footer: shrink + force single line. The 'Built with care' suffix
       is auto-hidden on the smallest screens so the © org line stays intact. */
    .login-footer           { font-size: 10px !important; white-space: nowrap; padding: 0 8px; }
    .login-footer .login-credit-suffix { display: none; }

    /* Donor dashboard chart — compact on phones */
    .perfchart-wrap  { height: 200px !important; }
    .perfchart-body  { padding: 8px 6px 10px !important; }
    /* Hide the chart-markers legend block + period-toggle pills on phones */
    .chart-markers   { display: none !important; }
    #donorPeriodButtons { display: none !important; }
    /* Shrink the 'Fund Value History' card title */
    .perfchart-body ~ * h6, .card-header h6 { font-size: 13px !important; }

    /* Portal footer — drop org name down to mobile size */
    .portal-footer .footer-brand span,
    .portal-footer .footer-credit { font-size: 10px !important; }
    .portal-footer .footer-inner  { padding-left: 6px !important; padding-right: 6px !important; }

    /* Grow Endowment 'Add More' CTA — smaller on phones */
    .grow-cta-btn { font-size: 12px !important; padding: 6px 14px !important; }
    .grow-cta-btn i { font-size: 12px !important; }

    /* Mobile quick-nav bar (3 tiles above CTA) */
    .mobile-quicknav { gap: 8px; }
    .mobile-quicknav-tile {
        flex: 1 1 0;
        min-width: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        padding: 10px 6px;
        background: #fff;
        border: 1px solid #e8ebe8;
        border-radius: 10px;
        color: var(--brand-green);
        text-decoration: none;
        box-shadow: 0 1px 3px rgba(0,0,0,0.04);
        transition: background .15s ease, border-color .15s ease, transform .06s ease;
    }
    .mobile-quicknav-tile:hover,
    .mobile-quicknav-tile:focus-visible {
        background: #f0faf5;
        border-color: var(--brand-green);
        color: var(--brand-green);
    }
    .mobile-quicknav-tile:active { transform: translateY(1px); }
    .mobile-quicknav-tile i  { font-size: 18px; color: var(--brand-green); }
    .mobile-quicknav-tile span {
        font-size: 11px;
        font-weight: 600;
        text-align: center;
        line-height: 1.2;
    }

    /* Endowment Goal stat card: hide the totals (X / Y) on phones — only 'to go' stays */
    .endow-goal-totals { display: none !important; }

    /* ─── Menu-discovery pulse ──────────────────────────────
       First few visits on mobile: hamburger button pulses gently so
       users notice they can open the sidebar. JS removes the class
       after the user opens it once. */
    #sidebarToggle.pulse-hint {
        animation: iar-pulse-hint 1.8s ease-in-out 2;
        border-radius: 8px;
    }
    @keyframes iar-pulse-hint {
        0%, 100% { box-shadow: 0 0 0 0 rgba(240, 180, 41, 0); }
        50%      { box-shadow: 0 0 0 8px rgba(240, 180, 41, 0.35); }
    }
    .login-footer           { font-size: 10px !important; padding: 0 16px; }
}

/* ---- Larger screens (≥1400px) — scale up text ------------- */
@media (min-width: 1400px) {
    body                    { font-size: 15px; }
    .table                  { font-size: 14px; }
    .table th               { font-size: 12px; }
    .card-header h6         { font-size: 15px; }
    .stat-card-label        { font-size: 12px; }
    .stat-card-value        { font-size: 30px; }
    .stat-card-subtitle     { font-size: 13px; }
    .hero-kpi-value         { font-size: 24px !important; }
    .hero-kpi-label         { font-size: 12px !important; }
}
@media (min-width: 1800px) {
    body                    { font-size: 16px; }
    .table                  { font-size: 15px; }
    .table th               { font-size: 13px; }
    .stat-card-value        { font-size: 32px; }
    .hero-kpi-value         { font-size: 28px !important; }
    .content-area           { padding: 32px 40px !important; }
}

/* ---- Skip link (accessibility) ---------------------------- */
.skip-link {
    position: absolute;
    top: -100%;
    left: 8px;
    z-index: 9999;
    padding: 8px 16px;
    background: var(--brand-green);
    color: #fff;
    border-radius: 0 0 6px 6px;
    font-weight: 600;
    text-decoration: none;
    font-size: 14px;
    transition: top 0.15s ease;
}
.skip-link:focus {
    top: 0;
    color: #fff;
}

/* ---- Focus visible ---------------------------------------- */
:focus-visible {
    outline: 2px solid var(--brand-focus);
    outline-offset: 2px;
}

/* ---- Touch targets (mobile) ------------------------------- */
button, a, [role="button"] {
    touch-action: manipulation;
}

/* ---- Tabular numbers for data columns --------------------- */
.stat-card-value,
.hero-kpi-value,
.tabular,
[data-num],
.table td:is(:nth-child(3), :nth-child(4), :nth-child(5)) {
    font-variant-numeric: tabular-nums;
}

/* ---- Reduced motion --------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    /* Suppress every transform-based motion delight ------------- */
    .stat-card:hover,
    .document-card:hover,
    .newsletter-card:hover,
    .btn:active:not(:disabled):not(.disabled) {
        transform: none !important;
    }
    .sidebar {
        transition: none;
    }
}

/* ---- Brand buttons ---------------------------------------- */
.btn-brand {
    background: var(--brand-green);
    border-color: var(--brand-green);
    color: #fff;
}
.btn-brand:hover,
.btn-brand:focus {
    background: var(--brand-green-dark);
    border-color: var(--brand-green-dark);
    color: #fff;
}

/* ---- Brand outline button --------------------------------- */
.btn-outline-brand {
    color: var(--brand-green);
    border-color: var(--brand-green);
    background: transparent;
}
.btn-outline-brand:hover,
.btn-outline-brand:focus {
    background: var(--brand-green);
    border-color: var(--brand-green);
    color: #fff;
}

/* ---- Portal Footer ---------------------------------------- */
.portal-footer {
    background: #fff;
    border-top: 1px solid #eee;
    padding: 14px 0 12px;
    margin-top: 2rem;
    font-size: 13px;
}

.portal-footer .footer-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #555;
}

.portal-footer .footer-brand img {
    width: auto;
    object-fit: contain;
}

.portal-footer .footer-credit {
    color: #999;
}

.portal-footer .footer-credit a {
    color: var(--brand-green);
    font-weight: 600;
    text-decoration: none;
    transition: color .15s;
}

.portal-footer .footer-credit a:hover {
    color: var(--brand-gold);
}

@media (max-width: 575.98px) {
    .portal-footer .footer-inner {
        flex-direction: column;
        text-align: center;
        gap: 6px;
    }
}

/* ---- Login logo ------------------------------------------- */
.login-logo-img {
    height: 72px;
    width: auto;
    max-width: 220px;
    object-fit: contain;
}

/* ---- Sidebar logo ----------------------------------------- */
.sidebar-logo-img {
    height: 68px;
    width: auto;
    max-width: 210px;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

/* ---- Footer logo ------------------------------------------ */
.footer-logo-img {
    height: 44px;
    width: auto;
    max-width: 160px;
    object-fit: contain;
}

/* ── Global checkboxes & toggles — IAR brand green ─────────── */

/* Checkboxes */
.form-check-input[type="checkbox"]:checked {
    background-color: var(--brand-green);
    border-color:     var(--brand-green);
}
.form-check-input[type="checkbox"]:focus {
    border-color: var(--brand-green);
    box-shadow: 0 0 0 .25rem rgba(var(--brand-green-rgb), .25);
}
.form-check-input[type="checkbox"]:indeterminate {
    background-color: var(--brand-green);
    border-color:     var(--brand-green);
}

/* Radio buttons */
.form-check-input[type="radio"]:checked {
    background-color: var(--brand-green);
    border-color:     var(--brand-green);
}
.form-check-input[type="radio"]:focus {
    border-color: var(--brand-green);
    box-shadow: 0 0 0 .25rem rgba(var(--brand-green-rgb), .25);
}

/* Toggle switches (form-switch) */
.form-check-input[role="switch"]:checked {
    background-color: var(--brand-green);
    border-color:     var(--brand-green);
}
.form-check-input[role="switch"]:focus {
    border-color: var(--brand-green);
    box-shadow: 0 0 0 .25rem rgba(var(--brand-green-rgb), .25);
    /* keep the white thumb image Bootstrap sets */
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e");
}

/* =============================================================
   Delight Round-3a — additive only. Revert per commit.
   ============================================================= */

/* ---- #6 Breadcrumbs ---------------------------------------- */
.iar-breadcrumbs {
    margin: 0 0 14px;
}
.iar-breadcrumbs ol {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    color: #6b7280;
}
.iar-breadcrumbs li {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.iar-breadcrumbs li + li::before {
    content: '\203A';   /* › */
    color: #c5cac5;
    margin: 0 4px 0 0;
}
.iar-breadcrumbs a {
    color: var(--brand-green);
    text-decoration: none;
    border-radius: 4px;
    padding: 2px 4px;
    transition: background .15s ease;
}
.iar-breadcrumbs a:hover {
    background: rgba(var(--brand-green-rgb), 0.07);
    text-decoration: underline;
}
.iar-breadcrumbs li[aria-current="page"] span {
    color: #444;
    font-weight: 600;
}

/* ---- Category-pill radio (ticket form) --------------------
   Used on /donor/tickets.php?new=1 and /member/tickets.php?new=1
   for the "Request Type" choices. Pairs with .btn-check radios.
   Hover + checked + focus states clearly visible. */
.cat-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    border: 1.5px solid #e0e0e0;
    border-radius: 7px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: #444;
    background: #fff;
    width: 100%;
    transition: border-color .15s ease, background .15s ease, color .15s ease, box-shadow .15s ease;
}
.cat-pill:hover {
    border-color: var(--brand-green);
    background: #f0faf5;
    color: var(--brand-green);
}
.btn-check:focus-visible + .cat-pill {
    box-shadow: 0 0 0 3px rgba(var(--brand-green-rgb), 0.18);
}
.btn-check:checked + .cat-pill {
    border-color: var(--brand-green);
    background: #f0faf5;
    color: var(--brand-green);
    box-shadow: inset 0 0 0 1px var(--brand-green);
}
.btn-check:checked + .cat-pill i {
    color: var(--brand-green) !important;
}

/* ---- #5b Topbar user dropdown — refined ---------------------
   Glassy white card. Subtle gold accent strip on top. Identity
   block with role-icon avatar + name + email + role chip.
   Action rows: tinted icon tile + title + sub-label + chevron.
*/
.topbar-user-menu {
    padding: 6px;
    border: 1px solid #e3e8e3;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}
.topbar-user-menu::before {
    /* Tiny brand accent strip at top edge */
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--brand-gold) 0%, var(--brand-gold-light) 50%, var(--brand-gold) 100%);
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
}

/* ── Header (identity block) ── */
.topbar-user-menu-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 12px 12px;
    margin: 0 0 4px;
    border-bottom: 1px solid #eef0ee;
    background: linear-gradient(180deg, rgba(var(--brand-green-rgb), 0.04) 0%, transparent 100%);
    border-radius: 8px 8px 0 0;
}
.topbar-user-menu-avatar {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-green) 0%, var(--brand-mid) 100%);
    color: var(--brand-gold);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}
.topbar-user-menu-id {
    flex: 1 1 auto;
    min-width: 0;
    line-height: 1.3;
}
.topbar-user-menu-name {
    font-weight: 700;
    color: #1a1a1a;
    font-size: 14px;
}
.topbar-user-menu-email {
    color: #6b7280;
    font-size: 11.5px;
}
.topbar-user-menu-role {
    margin-top: 4px;
}
.topbar-user-role-chip {
    display: inline-flex;
    align-items: center;
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--brand-green-dark);
    background: rgba(var(--brand-gold-rgb), 0.18);
    border: 1px solid rgba(var(--brand-gold-rgb), 0.45);
    padding: 2px 8px;
    border-radius: 999px;
    line-height: 1.4;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.topbar-user-role-chip i {
    font-size: 10px;
    color: #b08200;
}

/* ── Actions ── */
.topbar-user-menu-actions {
    padding: 4px 0 2px;
}
.topbar-user-action {
    display: flex !important;
    align-items: center;
    gap: 11px;
    padding: 8px 10px !important;
    border-radius: 8px;
    color: #1a1a1a !important;
    transition: background .15s ease, transform .12s ease;
    overflow: hidden;
}
.topbar-user-action:hover,
.topbar-user-action:focus {
    background: rgba(var(--brand-green-rgb), 0.06) !important;
    color: var(--brand-green) !important;
    transform: translateX(2px);
}
.topbar-user-action-danger:hover,
.topbar-user-action-danger:focus {
    background: rgba(220, 53, 69, 0.06) !important;
    color: #b02a37 !important;
}

.topbar-user-action-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: transform .15s ease;
}
.topbar-user-action-icon-green {
    background: rgba(var(--brand-green-rgb), 0.10);
    color: var(--brand-green);
}
.topbar-user-action-icon-red {
    background: rgba(220, 53, 69, 0.10);
    color: #c62828;
}
.topbar-user-action:hover .topbar-user-action-icon {
    transform: scale(1.05);
}

.topbar-user-action-label {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}
.topbar-user-action-title {
    font-weight: 600;
    font-size: 13px;
}
.topbar-user-action-sub {
    font-size: 10.5px;
    color: #999;
    margin-top: 1px;
}
.topbar-user-action-danger .topbar-user-action-sub { color: #b88; }

.topbar-user-action-chev {
    flex-shrink: 0;
    font-size: 11px;
    color: #bbb;
    opacity: 0;
    transform: translateX(-4px);
    transition: opacity .15s ease, transform .15s ease;
}
.topbar-user-action:hover .topbar-user-action-chev,
.topbar-user-action:focus .topbar-user-action-chev {
    opacity: 1;
    transform: translateX(0);
}

/* Reduced-motion: kill slide */
@media (prefers-reduced-motion: reduce) {
    .topbar-user-action:hover,
    .topbar-user-action:focus { transform: none; }
    .topbar-user-action:hover .topbar-user-action-icon { transform: none; }
}

/* ---- #5 Topbar user pill — waqfos1-style bar ---------------
   Single-line pill: icon + name • role + caret. Soft brand-green
   tinted bg. Pill radius. Truncates name first if space tight. */
.topbar-user-pill-wrap { position: relative; }

.topbar-user-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(var(--brand-green-rgb), 0.08);
    color: var(--brand-green);
    border: 1px solid transparent;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 999px;
    text-decoration: none;
    max-width: 280px;
    line-height: 1.2;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease;
    min-width: 0;
}
.topbar-user-pill:hover {
    background: rgba(var(--brand-green-rgb), 0.12);
    border-color: rgba(var(--brand-green-rgb), 0.18);
    color: var(--brand-green);
}
.topbar-user-pill[aria-expanded="true"] {
    background: rgba(var(--brand-green-rgb), 0.14);
    border-color: rgba(var(--brand-green-rgb), 0.25);
}

/* Name is the only flexible element — it truncates first. */
.topbar-user-pill .name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    font-weight: 600;
}

.topbar-user-sep {
    opacity: 0.45;
    flex-shrink: 0;
}
.topbar-user-role {
    flex-shrink: 0;
    opacity: 0.85;
    white-space: nowrap;
}

.topbar-user-caret {
    flex-shrink: 0;
    font-size: 9px;
    opacity: 0.55;
    margin-left: 2px;
    transition: transform .15s ease, opacity .15s ease;
}
.topbar-user-pill:hover .topbar-user-caret { opacity: 0.85; }
.topbar-user-pill[aria-expanded="true"] .topbar-user-caret {
    transform: rotate(180deg);
    opacity: 1;
}

/* Hide role on very small screens to keep pill compact */
@media (max-width: 575.98px) {
    .topbar-user-sep,
    .topbar-user-role { display: none; }
    .topbar-user-pill { max-width: 200px; }
}

/* Legacy avatar element still in markup but never rendered. */
.topbar-user-avatar { display: none !important; }
.topbar-user-name { display: none !important; }

/* ---- #12 Copy-to-clipboard flash states -------------------- */
[data-copy], [data-copy-target] {
    cursor: pointer;
}
[data-copy].copy-ok, [data-copy-target].copy-ok {
    color: var(--accent-green) !important;
    transition: color .15s ease;
}
[data-copy].copy-fail, [data-copy-target].copy-fail {
    color: #c62828 !important;
}

/* ---- #17 Section header pattern ---------------------------
   <div class="section-header">
       <div class="section-header-title"><i class="bi bi-..."></i> Title</div>
       <a class="section-header-action" href="...">View all <i class="bi bi-arrow-right"></i></a>
   </div>
   Already referenced by IAR markup in places (orphaned without CSS).
   Ported from waqfos1 style family; tuned to current scale. */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 12px;
}
.section-header-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--brand-green);
    font-weight: 700;
    letter-spacing: 0.2px;
}
.section-header-title > i {
    color: var(--brand-gold);
}
.section-header-action {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--brand-green);
    text-decoration: none;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background .15s ease, color .15s ease;
}
.section-header-action:hover {
    background: rgba(var(--brand-green-rgb), 0.08);
    color: var(--brand-green-dark);
}
.section-header-action.is-warning {
    color: #92680a;
}
.section-header-action.is-warning:hover {
    background: rgba(240, 180, 41, 0.15);
    color: #6b4d07;
}

/* ---- #24 Seen-state on document / newsletter rows ----------
   IAR doc/newsletter links open via JS preview (href="#"), so the
   native :visited pseudo never fires. We mark rows with .is-seen
   via JS+localStorage after the user opens them. Subtle indicator:
   muted text + small "✓" badge.
   Revert: delete this block + the data-seen-key handler in app.js. */
[data-seen-key].is-seen {
    opacity: 0.72;
}
[data-seen-key].is-seen::after {
    content: '\2713';   /* ✓ */
    color: var(--accent-green);
    font-size: 0.85em;
    margin-left: 6px;
    opacity: 0.8;
    vertical-align: middle;
}

/* ---- Polish T2: reusable hover utility classes ------------
   Replace inline onmouseover/onmouseout JS patterns with these
   classes. Each variant matches a hover style used repeatedly
   across the codebase. */

/* Icon button — 30x30 circle, green-on-hover (replaces table-row action buttons) */
.iar-icon-btn {
    width: 30px; height: 30px;
    border-radius: 5px;
    border: 1.5px solid #e0e0e0;
    background: #fff;
    color: #666;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.iar-icon-btn:hover, .iar-icon-btn:focus-visible {
    border-color: var(--brand-green);
    color: var(--brand-green);
    background: #f0faf5;
}
.iar-icon-btn.is-danger:hover, .iar-icon-btn.is-danger:focus-visible {
    border-color: #dc3545;
    color: #dc3545;
    background: #fff5f5;
}
.iar-icon-btn.is-gold:hover, .iar-icon-btn.is-gold:focus-visible {
    border-color: var(--brand-gold);
    color: var(--brand-green-dark);
    background: #fef9e7;
}

/* Pill action — green fill on hover (replaces "View / Edit" pill style) */
.iar-pill-action {
    display: inline-flex; align-items: center; gap: 4px;
    border: 1.5px solid #d0ede0;
    background: #f0faf5;
    color: var(--brand-green);
    border-radius: 6px;
    padding: 5px 12px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.iar-pill-action:hover, .iar-pill-action:focus-visible {
    background: var(--brand-green);
    color: #fff;
    border-color: var(--brand-green);
}

/* Inline name/title link — color shift on hover (table title links) */
.iar-text-link {
    color: #1a1a1a;
    text-decoration: none;
    transition: color .15s ease;
}
.iar-text-link:hover, .iar-text-link:focus-visible {
    color: var(--brand-green);
}

/* Field focus glow on input groups w/ icon prefix (replaces onfocus inline) */
.iar-focus-glow:focus, .iar-focus-glow:focus-visible {
    border-color: var(--brand-green) !important;
    box-shadow: 0 0 0 .2rem rgba(var(--brand-green-rgb), .15);
    outline: 0;
}

/* ---- T2 Inline-styled button focus visibility -------------
   Browsers handle <button>:focus-visible globally (see general
   :focus-visible rule below) but many inline buttons set
   outline:none / border:none. This forces a visible ring. */
button:not(.btn):not(.btn-link):not(.dropdown-toggle):not(.topbar-user-pill):not(.iar-icon-btn):not(.iar-pill-action):focus-visible {
    outline: 2px solid var(--brand-focus);
    outline-offset: 2px;
}

/* ---- #25 Branded text selection ---------------------------- */
::selection {
    background: var(--brand-gold);
    color: var(--brand-green);
}
::-moz-selection {
    background: var(--brand-gold);
    color: var(--brand-green);
}

/* =============================================================
   Delight Round-2 — additive only. Revert by deleting this block.
   ============================================================= */

/* ---- #4 Sidebar polish: green scrollbar + edge marker on active

   - Visible thin scrollbar tinted with mid-green (matches sidebar bg family)
   - On the active nav item, a 3px gold bar pinned to the sidebar's
     LEFT edge, vertically aligned with the active row.
   - No drop-shadow / glow on the pill itself. */

/* Firefox */
.sidebar {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.30) rgba(255, 255, 255, 0.05);
}
/* WebKit (Chrome, Edge, Safari) */
.sidebar::-webkit-scrollbar {
    width: 8px;
}
.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}
.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.30);
    border-radius: 4px;
}
.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.50);
}

/* Gold edge marker on active item — sits at sidebar's left edge.
   .sidebar-nav has padding: 0 12px, so we offset -12px to reach edge. */
.sidebar-nav li {
    position: relative;
}
.sidebar-nav li a.active::before {
    content: '';
    position: absolute;
    left: -12px;
    top: 4px;
    bottom: 4px;
    width: 3px;
    background: var(--brand-gold);
    border-radius: 0 2px 2px 0;
}

/* ---- #9 Brand-tinted focus for text inputs / selects --------
   Bootstrap's default blue focus ring is off-brand. Tint to brand-green. */
.form-control:focus,
.form-select:focus {
    border-color: var(--brand-green);
    box-shadow: 0 0 0 .2rem rgba(var(--brand-green-rgb), .18);
}

/* ---- #10 Button press feedback ------------------------------
   Subtle 1px nudge on click. Universal mechanical haptic feel.
   Respects reduced-motion (transition suppressed by global block above). */
.btn {
    transition: transform .06s ease, box-shadow .15s ease, background-color .15s ease, border-color .15s ease, color .15s ease;
}
.btn:active:not(:disabled):not(.disabled) {
    transform: translateY(1px);
}
