/* Loading bar at top of page */
.page-loading-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--teal), var(--lime), var(--teal));
    background-size: 200% 100%;
    animation: loading-bar 1.5s ease-in-out infinite;
    z-index: 9999;
}
@keyframes loading-bar {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
:root {
    /* Color palette — dark theme, teal accent only */
    --navy: #0f172a;
    --navy-light: #1e293b;
    --navy-dark: #070d1a;
    --indigo: #0d9488;
    --indigo-light: #2dd4bf;
    --indigo-dark: #0f766e;
    --teal: #0d9488;
    --teal-light: #2dd4bf;
    --lime: #10b981;
    --lime-light: #34d399;
    --coral: #f43f5e;
    --coral-light: #fb7185;
    --amber: #f59e0b;
    --amber-light: #fbbf24;
    --violet: #8b5cf6;
    --violet-light: #a78bfa;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;

    /* Shadows — teal tint instead of indigo */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --shadow-glow: 0 0 40px rgba(13, 148, 136, 0.15);
    --shadow-hover: 0 20px 40px rgba(0,0,0,0.12);

    /* Glass effect */
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.2);
    --glass-blur: 12px;

    /* Gradients — teal-only, no purple */
    --gradient-primary: linear-gradient(135deg, #0d9488 0%, #0f766e 100%);
    --gradient-dark: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
    --gradient-mesh: radial-gradient(at 40% 20%, hsla(174, 80%, 35%, 0.12) 0px, transparent 50%),
                    radial-gradient(at 80% 0%, hsla(189, 100%, 56%, 0.08) 0px, transparent 50%),
                    radial-gradient(at 0% 50%, hsla(174, 60%, 40%, 0.06) 0px, transparent 50%),
                    radial-gradient(at 80% 50%, hsla(160, 80%, 45%, 0.08) 0px, transparent 50%),
                    radial-gradient(at 0% 100%, hsla(174, 50%, 50%, 0.06) 0px, transparent 50%);

    /* Border radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

/* Verification freshness indicators (inline text) */
.verification-fresh { color: var(--lime); font-weight: 500; }
.verification-aging { color: var(--amber); font-weight: 500; }
.verification-stale { color: var(--coral); font-weight: 500; }
.verification-never { color: var(--gray-400); font-style: italic; }

/* Verification freshness badges */
.verification-badge-fresh { background-color: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.verification-badge-aging { background-color: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.verification-badge-stale { background-color: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.verification-badge-never { background-color: #f9fafb; color: #6b7280; border: 1px solid #e5e7eb; }

/* Freshness dots for list pages */
.freshness-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.freshness-dot.fresh { background-color: #22c55e; }
.freshness-dot.aging { background-color: #f59e0b; }
.freshness-dot.stale { background-color: #ef4444; }
.freshness-dot.never { background-color: #d1d5db; }

/* Stale data banner — subtle amber, dismissible */
.freshness-banner {
    display: flex;
    align-items: center;
    padding: 0.4rem 0.75rem;
    margin-bottom: 0.75rem;
    font-size: 0.72rem;
    color: #92400e;
    background-color: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 0.375rem;
}
.freshness-banner .btn-close-sm {
    font-size: 0.5rem;
    padding: 0.25rem;
    opacity: 0.5;
}
.freshness-banner .btn-close-sm:hover { opacity: 1; }

/* Skip link for accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--navy);
    color: white;
    padding: 0.5rem 1rem;
    z-index: 9999;
    transition: top 0.3s;
    text-decoration: none;
}
.skip-link:focus {
    top: 0;
}

/* Prevent horizontal scroll on mobile */
html, body {
    overflow-x: hidden;
}

/* Modern typography */
body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--gray-700);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.6;
    background: var(--gray-50);
}
h1, .h1 {
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--gray-900);
    line-height: 1.1;
}
h2, .h2 {
    font-weight: 700;
    letter-spacing: -0.025em;
    color: var(--gray-900);
}
h3, .h3, h4, .h4 {
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--gray-800);
}

main {
    flex: 1;
    background: #f8fafc;
    min-height: calc(100vh - 200px);
}

/* Focus states for accessibility */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Status Colors - Enhanced with dot indicators */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.7rem;
    padding: 0.375rem 0.75rem;
    font-weight: 600;
    border-radius: 6px;
    letter-spacing: 0.025em;
    text-transform: uppercase;
}
.status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}
.status-awaiting_response { background-color: #f3f4f6; color: #4b5563; }
.status-awaiting_response::before { background-color: #9ca3af; }
.status-awaiting_action { background-color: #e0e7ff; color: #3730a3; }
.status-awaiting_action::before { background-color: #6366f1; }
.status-in_progress { background-color: #dbeafe; color: #1e40af; }
.status-in_progress::before { background-color: #3b82f6; }
.status-completed { background-color: #dcfce7; color: #166534; }
.status-completed::before { background-color: var(--lime); }
.status-partially_delivered { background-color: #fef3c7; color: #92400e; }
.status-partially_delivered::before { background-color: #f59e0b; }
.status-partially_accepted { background-color: #fef3c7; color: #92400e; }
.status-partially_accepted::before { background-color: #f59e0b; }
.status-not_accepted { background-color: #f3f4f6; color: #1f2937; }
.status-not_accepted::before { background-color: #1f2937; }
.status-long_term { background-color: #f0fdfa; color: #115e59; }
.status-long_term::before { background-color: #14b8a6; }
.status-superseded { background-color: #f8fafc; color: #64748b; }
.status-superseded::before { background-color: #94a3b8; }
.status-stalled { background-color: #fee2e2; color: #991b1b; }
.status-stalled::before { background-color: var(--coral); }
.status-no_recent_updates { background-color: #fef3c7; color: #92400e; }
.status-no_recent_updates::before { background-color: var(--amber); }
.status-under_consideration { background-color: #e0e7ff; color: #3730a3; }
.status-under_consideration::before { background-color: #6366f1; }
.status-response_pending { background-color: #fef3c7; color: #92400e; }
.status-response_pending::before { background-color: #f59e0b; }
.status-no_published_response { background-color: #f3f4f6; color: #6b7280; }
.status-no_published_response::before { background-color: #9ca3af; }
.status-delayed { background-color: #fef3c7; color: #92400e; }
.status-delayed::before { background-color: var(--amber); }
.status-not_applicable { background-color: #f3f4f6; color: #6b7280; }
.status-not_applicable::before { background-color: #9ca3af; }
.status-historic { background-color: #f1f5f9; color: #94a3b8; }
.status-historic::before { background-color: #cbd5e1; }
.status-no_progress_updates { background-color: #f3f4f6; color: #6b7280; }
.status-no_progress_updates::before { background-color: #9ca3af; }

/* Response Badges (government response axis) */
.response-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.7rem;
    padding: 0.375rem 0.75rem;
    font-weight: 600;
    border-radius: 6px;
    letter-spacing: 0.025em;
    text-transform: uppercase;
}
.response-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}
.response-accepted { background-color: #dcfce7; color: #166534; }
.response-accepted::before { background-color: var(--lime); }
.response-accepted_in_part { background-color: #dbeafe; color: #1e40af; }
.response-accepted_in_part::before { background-color: #3b82f6; }
.response-accepted_in_principle { background-color: #dbeafe; color: #1e40af; }
.response-accepted_in_principle::before { background-color: #3b82f6; }
.response-partially_accepted { background-color: #dbeafe; color: #1e40af; }
.response-partially_accepted::before { background-color: #3b82f6; }
.response-not_accepted { background-color: #fee2e2; color: #991b1b; }
.response-not_accepted::before { background-color: var(--coral); }
.response-under_consideration { background-color: #e0e7ff; color: #3730a3; }
.response-under_consideration::before { background-color: #6366f1; }
.response-under_review { background-color: #e0e7ff; color: #3730a3; }
.response-under_review::before { background-color: #6366f1; }
.response-no_published_response { background-color: #f3f4f6; color: #6b7280; }
.response-no_published_response::before { background-color: #9ca3af; }
.response-not_addressed { background-color: #fef3c7; color: #92400e; }
.response-not_addressed::before { background-color: #f59e0b; }
.response-pending { background-color: #f3f4f6; color: #6b7280; }
.response-pending::before { background-color: #9ca3af; }
.response-response_pending { background-color: #f3f4f6; color: #6b7280; }
.response-response_pending::before { background-color: #9ca3af; }
.response-no_response { background-color: #f3f4f6; color: #6b7280; }
.response-no_response::before { background-color: #9ca3af; }
.response-not_tracked { background-color: #fefce8; color: #854d0e; }
.response-not_tracked::before { background-color: #ca8a04; }
.response-historic_untracked { background-color: #f3f4f6; color: #6b7280; }
.response-historic_untracked::before { background-color: #9ca3af; }

/* Response progress bar segments (rationalised: 5 categories) */
.response-bar-accepted { background-color: var(--lime) !important; }
.response-bar-accepted_in_part { background-color: #3b82f6 !important; }
.response-bar-not_accepted { background-color: var(--coral) !important; }
.response-bar-under_review { background-color: #6366f1 !important; }
.response-bar-awaiting_response { background-color: var(--gray-300) !important; }
/* Legacy keys kept for individual badges */
.response-bar-under_consideration { background-color: #6366f1 !important; }
.response-bar-not_addressed { background-color: #f59e0b !important; }
.response-bar-pending { background-color: var(--gray-300) !important; }
.response-bar-response_pending { background-color: var(--gray-300) !important; }
.response-bar-no_response { background-color: var(--gray-300) !important; }
.response-bar-not_tracked { background-color: #ca8a04 !important; }
.response-bar-historic_untracked { background-color: var(--gray-300) !important; }

/* Response legend dots (rationalised: 5 categories) */
.response-dot { width: 10px; height: 10px; border-radius: 2px; }
.response-dot.accepted { background-color: var(--lime); }
.response-dot.accepted_in_part { background-color: #3b82f6; }
.response-dot.not_accepted { background-color: var(--coral); }
.response-dot.under_review { background-color: #6366f1; }
.response-dot.awaiting_response { background-color: var(--gray-300); }
/* Legacy keys kept for individual badges */
.response-dot.under_consideration { background-color: #6366f1; }
.response-dot.not_addressed { background-color: #f59e0b; }
.response-dot.pending { background-color: var(--gray-300); }
.response-dot.response_pending { background-color: var(--gray-300); }
.response-dot.no_response { background-color: var(--gray-300); }
.response-dot.not_tracked { background-color: #ca8a04; }
.response-dot.historic_untracked { background-color: #9ca3af; }

/* Badge pair for two-axis display */
.badge-pair {
    display: inline-flex;
    gap: 0.375rem;
    align-items: center;
    flex-wrap: wrap;
}

/* Implementation gap warning — response positive but delivery lagging */
.gap-warning {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.65rem;
    color: #92400e;
    background: #fef3c7;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}
.gap-warning i { font-size: 0.75rem; }

/* Government response timeline on detail page */
.response-timeline-item {
    position: relative;
    padding-left: 1.5rem;
    padding-bottom: 1.25rem;
    border-left: 2px solid var(--gray-200);
    margin-left: 0.5rem;
}
.response-timeline-item:last-child {
    border-left-color: transparent;
    padding-bottom: 0;
}
.response-timeline-item::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--navy);
    border: 2px solid white;
    box-shadow: 0 0 0 1px var(--gray-300);
}
.response-timeline-item.initial::before {
    width: 12px;
    height: 12px;
    left: -7px;
}

/* Collapsible sections */
.collapsible-section > summary { list-style: none; }
.collapsible-section > summary::-webkit-details-marker { display: none; }
.collapsible-section .collapse-icon { transition: transform 0.2s ease; font-size: 0.85rem; color: var(--gray-500); }
.collapsible-section[open] .collapse-icon { transform: rotate(90deg); }
.collapsible-section > summary:hover { opacity: 0.8; }

/* AI Traffic Light indicators */
.traffic-light { width: 12px; height: 12px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.traffic-light.green { background-color: #22c55e; }
.traffic-light.amber { background-color: #f59e0b; }
.traffic-light.red { background-color: #ef4444; }
.traffic-light.grey { background-color: #9ca3af; }
.traffic-light.blue { background-color: #3b82f6; }

.ai-assessment-card { border-left: 4px solid; padding: 1rem; margin: 1rem 0; background: #f9fafb; border-radius: 0 8px 8px 0; }
.ai-assessment-card.green { border-color: #22c55e; }
.ai-assessment-card.amber { border-color: #f59e0b; }
.ai-assessment-card.red { border-color: #ef4444; }
.ai-assessment-card.grey { border-color: #9ca3af; }

/* Modern Cards */
.inquiry-card {
    transition: all 0.25s ease;
    background: #fff;
    border: 1px solid var(--gray-300);
    box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 4px 12px rgba(0,0,0,0.04);
    border-radius: var(--radius-lg);
}
.inquiry-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    border-color: rgba(13, 148, 136, 0.3);
}
.recommendation-text {
    background: rgba(13, 148, 136, 0.06);
    border-left: 3px solid rgba(13, 148, 136, 0.45);
    padding: 1.25rem 1.5rem;
    margin: 0.75rem 0;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    font-size: 0.95rem;
    line-height: 1.7;
}

/* Stat Vignettes */
.stat-vignette {
    text-align: center;
    padding: 2rem 1.5rem;
    background: #fff;
    border-radius: var(--radius-xl);
    box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 4px 12px rgba(0,0,0,0.04);
    border: 1px solid var(--gray-300);
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}
.stat-vignette:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}
.stat-vignette .stat-number {
    font-size: 2.75rem;
    font-weight: 800;
    line-height: 1;
    color: var(--gray-900);
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, var(--gray-900) 0%, var(--gray-700) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.stat-vignette .stat-label {
    font-size: 0.7rem;
    color: var(--gray-600);
    margin-top: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
}
.stat-vignette.highlight {
    background: linear-gradient(135deg, var(--indigo) 0%, var(--violet) 100%);
    border: none;
    box-shadow: var(--shadow-lg), 0 0 40px rgba(13, 148, 136, 0.3);
}
.stat-vignette.highlight::before {
    display: none;
}
.stat-vignette.highlight .stat-number {
    background: white;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.stat-vignette.highlight .stat-label {
    color: rgba(255,255,255,0.9);
}
.stat-vignette.success .stat-number {
    background: linear-gradient(135deg, var(--lime) 0%, var(--teal) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.stat-vignette.warning .stat-number {
    background: linear-gradient(135deg, var(--amber) 0%, #ea580c 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.stat-vignette.danger .stat-number {
    background: linear-gradient(135deg, var(--coral) 0%, #dc2626 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.stat-vignette.info .stat-number {
    background: linear-gradient(135deg, var(--teal) 0%, var(--indigo) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Stat vignette animations */
.stat-vignette {
    animation: fadeInUp 0.5s ease-out forwards;
    opacity: 0;
}
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.row.g-3 .col-6:nth-child(1) .stat-vignette { animation-delay: 0.1s; }
.row.g-3 .col-6:nth-child(2) .stat-vignette { animation-delay: 0.15s; }
.row.g-3 .col-6:nth-child(3) .stat-vignette { animation-delay: 0.2s; }
.row.g-3 .col-6:nth-child(4) .stat-vignette { animation-delay: 0.25s; }

/* Alert Banner for No Recent Updates */
.alert-banner {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 1px solid var(--amber);
    border-radius: 12px;
    padding: 1rem 1.5rem;
}
.alert-banner.danger {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border-color: var(--coral);
}

/* Progress Bars - Modern rounded with gradients */
.progress-stacked {
    height: 12px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--gray-200);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.06);
}
.progress-bar {
    position: relative;
    transition: all 0.3s ease;
    cursor: pointer;
}
.progress-bar:hover {
    filter: brightness(1.15);
    transform: scaleY(1.1);
}
/* Delivery progress bar segments (rationalised: 4 categories) */
.progress-bar-completed { background: linear-gradient(135deg, #10b981 0%, #22c55e 100%) !important; }
.progress-bar-in_progress { background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%) !important; }
.progress-bar-long_term { background: linear-gradient(135deg, #14b8a6 0%, #0d9488 100%) !important; }
.progress-bar-not_started { background: var(--gray-300) !important; }
/* Legacy keys kept for individual badges and dropdowns */
.progress-bar-partially_delivered { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important; }
.progress-bar-stalled { background: linear-gradient(135deg, var(--coral) 0%, #dc2626 100%) !important; }
.progress-bar-no_recent_updates { background: linear-gradient(135deg, var(--amber) 0%, #ea580c 100%) !important; }
.progress-bar-delayed { background: linear-gradient(135deg, var(--amber) 0%, #ea580c 100%) !important; }
.progress-bar-superseded { background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%) !important; }
.progress-bar-not_accepted { background: linear-gradient(135deg, var(--gray-700) 0%, var(--gray-900) 100%) !important; }
.progress-bar-awaiting_response { background: var(--gray-300) !important; }
.progress-bar-awaiting_action { background: linear-gradient(135deg, var(--violet) 0%, var(--indigo) 100%) !important; }
.progress-bar-response_pending { background: var(--gray-300) !important; }
.progress-bar-no_progress_updates { background: var(--gray-300) !important; }
.progress-bar-not_applicable { background: var(--gray-300) !important; }

/* Custom filter selects */
.filter-select, .form-select {
    appearance: none;
    background-color: white;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    padding: 0.625rem 2.5rem 0.625rem 0.875rem;
    font-size: 0.875rem;
    color: var(--gray-700);
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.filter-select:hover, .form-select:hover {
    border-color: var(--gray-400);
}
.filter-select:focus, .form-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Status Legend */
.status-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.8rem;
}
.status-legend-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}
.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 2px;
}
/* Rationalised delivery dots (4 categories) */
.status-dot.completed { background-color: #22c55e; }
.status-dot.in_progress { background-color: #3b82f6; }
.status-dot.long_term { background-color: #14b8a6; }
.status-dot.not_started { background-color: var(--gray-400); }
/* Legacy keys kept for individual badges and dropdowns */
.status-dot.partially_delivered { background-color: #f59e0b; }
.status-dot.stalled { background-color: var(--coral); }
.status-dot.no_recent_updates { background-color: var(--amber); }
.status-dot.delayed { background-color: var(--amber); }
.status-dot.superseded { background-color: #dc2626; }
.status-dot.not_accepted { background-color: #1f2937; }
.status-dot.awaiting_response { background-color: var(--gray-400); }
.status-dot.awaiting_action { background-color: #6366f1; }
.status-dot.response_pending { background-color: var(--gray-400); }
.status-dot.no_progress_updates { background-color: var(--gray-400); }
.status-dot.not_applicable { background-color: #d1d5db; }

/* Key Facts Grid */
.key-facts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 0.75rem;
}
.key-fact {
    text-align: center;
    padding: 0.75rem 0.5rem;
    background: var(--gray-50);
    border-radius: 8px;
    border: 1px solid var(--gray-100);
}
.key-fact-value {
    display: block;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--navy);
    line-height: 1.2;
}
.key-fact-label {
    display: block;
    font-size: 0.7rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.025em;
    margin-top: 0.25rem;
}
@media (max-width: 575.98px) {
    .key-facts-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.4rem;
    }
    .key-fact {
        padding: 0.5rem 0.25rem;
    }
    .key-fact-value {
        font-size: 0.85rem;
    }
    .key-fact-label {
        font-size: 0.6rem;
    }
}

/* Navigation - Modern glass effect */
.navbar {
    background: rgba(7, 13, 26, 0.95) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05), var(--shadow-lg);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: sticky;
    top: 0;
    z-index: 1030;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.navbar.scrolled {
    background: rgba(7, 13, 26, 0.98) !important;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}
.navbar-brand {
    font-weight: 700;
    letter-spacing: -0.5px;
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.nav-link {
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    position: relative;
    padding: 0.5rem 0.5rem !important;
    border-radius: var(--radius-sm);
    white-space: nowrap;
}
.nav-link:hover {
    background: rgba(255, 255, 255, 0.08);
}
.nav-link.active {
    background: rgba(13, 148, 136, 0.2);
    color: var(--indigo-light) !important;
}
/* Split-button navbar dropdowns */
.nav-split-dropdown {
    display: flex;
    align-items: center;
}
.nav-split-dropdown .nav-split-link {
    padding-right: 0.15rem !important;
}
.nav-split-dropdown .nav-split-link::after {
    display: none;
}
.nav-split-dropdown .nav-split-toggle {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.75);
    padding: 0.5rem 0.3rem;
    font-size: 0.6rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: var(--radius-sm);
    line-height: 1;
    display: flex;
    align-items: center;
}
.nav-split-dropdown .nav-split-toggle:hover {
    color: white;
    background: rgba(255, 255, 255, 0.08);
}
.nav-split-dropdown .nav-split-toggle::after {
    display: none;
}
.nav-split-dropdown .nav-split-link.active ~ .nav-split-toggle {
    color: var(--indigo-light);
}
/* Modern search input */
.navbar .form-control {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.05);
    color: white;
    border-radius: var(--radius-sm);
}
.navbar .form-control::placeholder {
    color: rgba(255,255,255,0.5);
}
.navbar .form-control:focus {
    background: rgba(255,255,255,0.1);
    border-color: var(--indigo);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.25);
    color: white;
}

/* Section Headers */
.breadcrumb {
    font-size: 0.85rem;
}

.section-header {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--gray-500);
    margin-bottom: 1rem;
    font-weight: 700;
}

footer {
    background: linear-gradient(135deg, var(--gray-900) 0%, var(--navy-light) 100%);
    position: relative;
}
footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(13, 148, 136, 0.5), transparent);
}

/* Filter Panel - Modern glass */
.filter-panel {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

/* Buttons - Modern with gradient and glow effects */
.btn-primary {
    background: linear-gradient(135deg, var(--indigo) 0%, var(--violet) 100%);
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 14px rgba(13, 148, 136, 0.4);
    position: relative;
    overflow: hidden;
}
.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--indigo-light) 0%, var(--violet-light) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(13, 148, 136, 0.5);
}
.btn-primary:hover::before {
    opacity: 1;
}
.btn-primary span, .btn-primary i {
    position: relative;
    z-index: 1;
}
.btn-primary:active {
    transform: translateY(0);
}
.btn-outline-primary {
    color: var(--indigo);
    border: 2px solid var(--indigo);
    background: transparent;
    border-radius: var(--radius-md);
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn-outline-primary:hover {
    background: var(--indigo);
    border-color: var(--indigo);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(13, 148, 136, 0.3);
}
.btn-sm {
    border-radius: var(--radius-sm);
    font-weight: 600;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}
.btn-outline-secondary {
    border: 2px solid var(--gray-300);
    color: var(--gray-600);
    border-radius: var(--radius-md);
    font-weight: 600;
    transition: all 0.3s ease;
}
.btn-outline-secondary:hover {
    border-color: var(--gray-400);
    background: var(--gray-100);
    color: var(--gray-700);
}
.btn-export {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}
.btn-export .bi {
    transition: transform 0.2s;
}
.btn-export:hover .bi {
    transform: translateY(2px);
}

/* Chart container */
.chart-container {
    background: #fff;
    border-radius: var(--radius-xl);
    padding: 1.75rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 4px 12px rgba(0,0,0,0.04);
    border: 1px solid var(--gray-300);
    overflow-wrap: break-word;
    word-break: break-word;
    transition: all 0.25s ease;
    text-align: left;
}
.chart-container:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}
/* Ensure dropdowns inside chart-containers aren't obscured by subsequent cards.
   backdrop-filter creates a stacking context that traps z-index, so we lift
   the entire card above its siblings when it contains a dropdown. */
.chart-container:has(.dropdown) {
    position: relative;
    z-index: 1;
}

/* Last updated */
.last-updated {
    font-size: 0.75rem;
    color: var(--gray-600);
}

/* Clickable rows */
.body-row {
    padding: 0.5rem;
    margin: -0.5rem;
    border-radius: 6px;
    transition: background-color 0.15s ease;
}
.body-row:hover {
    background-color: var(--gray-100);
}

/* Clickable badges/tags */
.clickable-badge {
    cursor: pointer;
    transition: opacity 0.15s ease, transform 0.15s ease;
}
.clickable-badge:hover {
    opacity: 0.85;
    transform: translateY(-1px);
}

/* Clickable stat vignettes */
.clickable-stat {
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.clickable-stat:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(2,32,97,0.15);
}

/* Clickable legend items */
.status-legend-item {
    color: inherit;
    transition: opacity 0.15s ease;
}
.status-legend-item:hover {
    opacity: 0.7;
}

/* Collapsible section icons */
.collapse-icon {
    transition: transform 0.2s ease;
}
[aria-expanded="true"] .collapse-icon {
    transform: rotate(180deg);
}
.section-header a:hover {
    opacity: 0.8;
}

/* Mobile Responsive Styles */
@media (max-width: 767.98px) {
    /* Navbar adjustments */
    .navbar-brand {
        font-size: 0.85rem;
        max-width: 220px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .navbar .input-group {
        width: 100%;
        margin-top: 0.5rem;
        margin-bottom: 0.5rem;
    }
    .navbar .btn-outline-light {
        width: 100%;
        margin-top: 0.5rem;
    }
    /* Mobile navbar collapsed menu */
    .navbar-collapse {
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
    }
    .navbar-collapse .navbar-nav {
        gap: 0;
    }
    .navbar-collapse .dropdown-menu {
        background-color: transparent;
        border: none;
        box-shadow: none;
        padding-left: 1rem;
    }
    .navbar-collapse .dropdown-item {
        color: rgba(255, 255, 255, 0.8);
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }
    .navbar-collapse .dropdown-item:hover,
    .navbar-collapse .dropdown-item:focus {
        background-color: rgba(255, 255, 255, 0.1);
        color: white;
    }
    .navbar-collapse .dropdown-divider {
        border-color: rgba(255, 255, 255, 0.1);
    }
    .nav-split-dropdown {
        flex-wrap: wrap;
    }
    .nav-split-dropdown .nav-split-link {
        flex: 1;
    }
    .nav-split-dropdown .nav-split-toggle {
        padding: 0.5rem 0.75rem;
    }
    .nav-split-dropdown .dropdown-menu {
        width: 100%;
    }
    /* Make navbar search full width in mobile menu */
    .navbar-collapse .d-flex {
        width: 100%;
    }
    .navbar-collapse .d-flex .input-group {
        width: 100%;
    }
    .navbar-collapse .d-flex .input-group input {
        max-width: none !important;
        min-width: 0 !important;
    }

    /* Improve touch targets - minimum 44px */
    .nav-link,
    .btn,
    .filter-select,
    .form-select,
    .form-control {
        min-height: 44px;
    }
    .nav-link {
        padding: 0.75rem 1rem;
    }

    /* Stat vignettes - smaller on mobile */
    .stat-vignette {
        padding: 1rem 0.75rem;
    }
    .stat-vignette .stat-number {
        font-size: 1.75rem;
    }
    .stat-vignette .stat-label {
        font-size: 0.65rem;
    }

    /* Status legend - stack on mobile */
    .status-legend {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }

    /* Alert banner - stack content */
    .alert-banner {
        flex-direction: column !important;
        text-align: center;
        gap: 0.75rem;
    }
    .alert-banner .badge {
        align-self: center;
    }

    /* Timeline - more compact on mobile */
    .timeline-date {
        min-width: 70px !important;
        font-size: 0.75rem;
    }
    .timeline-content strong {
        font-size: 0.9rem;
    }
    .timeline-content p {
        font-size: 0.8rem !important;
    }

    /* Filter panels - stack elements */
    .filter-panel .row {
        gap: 0.5rem;
    }
    .filter-panel {
        padding: 0.75rem;
    }
    /* Filter toggle button on mobile */
    .filter-toggle-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        background: transparent;
        border: 1px solid rgba(0, 0, 0, 0.1);
        color: var(--gray-700);
        font-weight: 600;
        font-size: 0.85rem;
        padding: 0.4rem 0.75rem;
    }
    .filter-toggle-btn:hover {
        background: rgba(0, 0, 0, 0.03);
    }
    .filter-toggle-icon {
        transition: transform 0.2s;
        font-size: 0.75rem;
    }
    .filter-toggle-btn[aria-expanded="true"] .filter-toggle-icon {
        transform: rotate(180deg);
    }
    /* Compact status tabs on mobile */
    .inquiry-tabs-bar {
        gap: 0.35rem !important;
    }
    .inquiry-tab {
        padding: 0.3rem 0.6rem !important;
        font-size: 0.8rem !important;
    }

    /* Tables - allow horizontal scroll */
    .table-responsive {
        font-size: 0.85rem;
    }

    /* Chart containers - less padding on mobile */
    .chart-container {
        padding: 0.875rem;
        border-radius: var(--radius-md);
    }
    /* Disable hover lift on mobile (causes jank on touch) */
    .chart-container:hover {
        transform: none;
    }

    /* Section headers */
    .section-header {
        font-size: 0.65rem;
    }

    /* Collapsible section summaries - wrap on mobile */
    .collapsible-section > summary {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    .collapsible-section > summary > div {
        flex-wrap: wrap;
    }
    .collapsible-section > summary .section-header {
        white-space: nowrap;
    }

    /* Progress bar labels */
    .progress-stacked {
        height: 20px;
    }

    /* Cards - full width on mobile */
    .inquiry-card .card-body {
        padding: 0.875rem;
    }
    .inquiry-card .card-title {
        font-size: 1rem;
    }

    /* Recommendation text blocks */
    .recommendation-text {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }

    /* Badge pair - wrap on small screens */
    .badge-pair {
        gap: 0.25rem;
    }

    /* Status badges - slightly smaller on mobile */
    .status-badge, .response-badge {
        font-size: 0.6rem;
        padding: 0.3rem 0.5rem;
    }

    /* Gap warning - compact on mobile */
    .gap-warning {
        font-size: 0.6rem;
        padding: 0.15rem 0.4rem;
    }

    /* Breadcrumbs - smaller on mobile */
    .breadcrumb {
        font-size: 0.78rem;
        margin-bottom: 0.5rem;
    }
    .breadcrumb-item + .breadcrumb-item::before {
        padding: 0 0.35rem;
    }

    /* H1 - scale down on mobile */
    h1, .h1 {
        font-size: 1.4rem;
    }

    /* Footer - stack and center on mobile */
    footer {
        padding-top: 1.5rem !important;
        padding-bottom: 1.5rem !important;
    }
    footer .col-md-4 {
        text-align: center !important;
        margin-bottom: 1rem;
    }
    footer .list-unstyled {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0 1rem;
    }

    /* Response timeline items - more compact */
    .response-timeline-item {
        padding-left: 1rem;
    }

    /* Container padding - tighter on mobile */
    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    /* Row gaps - tighter on mobile */
    .row.mb-4 {
        margin-bottom: 1rem !important;
    }
    .row.g-4 {
        --bs-gutter-y: 1rem;
        --bs-gutter-x: 0.75rem;
    }

    /* Flex d-flex columns with gap - tighter on mobile */
    .d-flex.gap-3 {
        gap: 0.5rem !important;
    }

    /* Disable hover transform on touch devices */
    .tracked-card:hover,
    .browse-card:hover,
    .source-card:hover,
    .sector-overview-card:hover {
        transform: none;
    }
}

/* Small mobile (< 375px) */
@media (max-width: 374.98px) {
    h1, .h1 {
        font-size: 1.2rem;
    }
    .navbar-brand {
        font-size: 0.78rem;
        max-width: 180px;
    }
    .chart-container {
        padding: 0.65rem;
    }
    .container {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
}

/* Tablet adjustments */
@media (min-width: 768px) and (max-width: 991.98px) {
    .navbar-brand {
        font-size: 1rem;
    }
    .stat-vignette .stat-number {
        font-size: 2rem;
    }
    .status-legend {
        gap: 0.75rem;
    }
}

/* Ensure tables scroll horizontally on small screens */
.table-responsive {
    -webkit-overflow-scrolling: touch;
}

/* Quick filter tabs - horizontal scroll on mobile */
.nav-pills {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.5rem;
}
@media (max-width: 767.98px) {
    .nav-pills .nav-item {
        flex-shrink: 0;
    }
    .nav-pills .nav-link {
        white-space: nowrap;
        padding: 0.4rem 0.75rem;
        font-size: 0.85rem;
    }
}

/* Utility class for flex overflow */
.min-width-0 {
    min-width: 0;
}


/* ============================================================
   Shared Component Library
   Extracted from inline <style> blocks across 100+ templates.
   Patterns here were duplicated in 8-45 templates each.
   ============================================================ */

/* === Source Hero Section ===
   Dark gradient hero banner used on all source/data landing pages.
   Override `background` per-template for source-specific colours.
   Default: teal-dark gradient (most common).
*/
.source-hero {
    background: linear-gradient(135deg, #1e293b 0%, #1a2e35 50%, #0d2e2b 100%);
    color: white;
    padding: 2rem 2rem 1.75rem;
    border-radius: var(--radius-xl);
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
}
.hero-stats {
    display: flex;
    gap: 2rem;
    margin-top: 1.25rem;
}
.hero-stat-number {
    font-size: 1.5rem;
    font-weight: 800;
    color: #5eead4;
}
.hero-stat-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    opacity: 0.7;
}
.tagline {
    font-size: 0.88rem;
    opacity: 0.85;
    max-width: 600px;
    line-height: 1.6;
}
@media (max-width: 767.98px) {
    .source-hero { padding: 1.5rem; }
    .source-hero h1 { font-size: 1.25rem; }
    .hero-stats { gap: 1.25rem; flex-wrap: wrap; }
    .hero-stat-number { font-size: 1.25rem; }
}

/* === Filter Bar === */
.filter-bar {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 1.5rem;
}
.filter-bar select,
.filter-bar input {
    font-size: 0.85rem;
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    background: white;
}

/* === Chart Card === */
.chart-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    padding: 1.25rem;
}
.chart-card h3 {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    margin-bottom: 1rem;
}

/* === Data Card (list items) === */
.data-card {
    background: white;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    padding: 1rem;
    margin-bottom: 0.75rem;
}
.data-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

/* === Key Insight text === */
.key-insight {
    font-size: 0.88rem;
    color: var(--gray-700);
    line-height: 1.7;
}
.key-insight strong {
    color: var(--gray-900);
}

/* === Insights Card === */
.insights-card {
    background: white;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
}
.insights-card h2 {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    margin-bottom: 0.75rem;
}

/* === Report Card (clickable list items) === */
.report-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    padding: 1.25rem;
    margin-bottom: 0.75rem;
    transition: border-color 0.2s;
    text-decoration: none;
    display: block;
    color: inherit;
}
.report-card:hover {
    border-color: var(--teal);
    text-decoration: none;
    color: inherit;
}

/* === Report Meta === */
.report-meta {
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-bottom: 0.5rem;
}

/* === Response Pill (status badges) === */
.response-pill {
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: 20px;
    font-weight: 600;
}
.response-pill.responded {
    background: rgba(5, 150, 105, 0.12);
    color: #059669;
}
.response-pill.partially_responded {
    background: rgba(217, 119, 6, 0.12);
    color: #d97706;
}
.response-pill.overdue {
    background: rgba(220, 38, 38, 0.12);
    color: #dc2626;
}
.response-pill.pending {
    background: rgba(107, 114, 128, 0.12);
    color: #6b7280;
}
.response-pill.unknown {
    background: rgba(107, 114, 128, 0.12);
    color: #6b7280;
}
.response-pill.historic {
    background: rgba(148, 163, 184, 0.15);
    color: #94a3b8;
}

/* === Section Badge ===
   Override `background` per-template for source-specific colours.
   Default: amber gradient (most common).
*/
.section-badge {
    color: white;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: linear-gradient(135deg, #d97706, #f59e0b);
}

/* === Section Heading === */
.section-heading {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--gray-200);
}

/* === Metric cards (outcome/performance) === */
.metric-card--clickable {
    cursor: pointer;
    transition: box-shadow 0.15s ease, transform 0.1s ease, background 0.15s ease;
}
.metric-card--clickable:hover {
    box-shadow: 0 2px 10px rgba(0,0,0,0.12);
    transform: translateY(-1.5px);
    background: rgba(8,145,178,0.07) !important;
}
.metric-card-link {
    display: block;
    color: inherit;
}
.metric-card-link:hover {
    color: inherit;
}
/* Focus ring for keyboard navigation */
.metric-card-link:focus-visible .metric-card--clickable {
    outline: 2px solid #0891b2;
    outline-offset: 2px;
}


/* ============================================================
   MOBILE RESPONSIVE — 375px viewport fixes
   ============================================================ */

/* Metric card grid: force single column on very small screens */
@media (max-width: 479px) {
    .metric-cards-grid .col-sm-6 {
        flex: 0 0 100%;
        max-width: 100%;
    }
    /* Compact sparkline bars on mobile */
    .metric-cards-grid .peer-bar {
        height: 4px;
    }
    /* Grouped card sub-rows: allow wrapping on narrow screens */
    .metric-card--group .d-flex.align-items-center {
        flex-wrap: wrap;
        gap: 0.15rem;
    }
}

/* Peer comparison panel in metric_detail: horizontal scroll */
.peer-comparison-scroll {
    max-height: 340px;
    overflow-y: auto;
    overflow-x: hidden;
}
@media (max-width: 767px) {
    /* Metric detail: sidebar stacks below chart on mobile */
    .metric-detail-sidebar {
        margin-top: 1rem;
    }
    /* Download buttons: stack on mobile */
    .league-download-btns {
        flex-direction: column;
        align-items: stretch;
    }
    .league-download-btns .btn {
        width: 100%;
    }
}

/* League table: horizontal scroll wrapper */
.ranking-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
/* Sticky first column (body name) in league table on mobile */
@media (max-width: 767px) {
    .ranking-table-wrap table td:first-child,
    .ranking-table-wrap table th:first-child {
        position: sticky;
        left: 0;
        background: white;
        z-index: 1;
        box-shadow: 2px 0 4px rgba(0,0,0,0.05);
    }
    .ranking-table-wrap table thead th:first-child {
        background: #f8fafc;
    }
    /* Taller bar chart on mobile: handled inline with JS height calc */
    .league-chart-canvas-wrap {
        min-height: 300px;
    }
}


/* ============================================================
   PRINT STYLESHEETS
   ============================================================ */

@media print {
    /* ---- Hide chrome ---- */
    nav.navbar, .site-header, .site-footer,
    .navbar, footer,
    .btn, button,
    .no-print,
    #typeahead-results,
    .show-more-container,
    .breadcrumb,
    .pagination,
    form,
    .d-print-none { display: none !important; }

    /* ---- Layout ---- */
    body { font-size: 10pt; color: #000; background: #fff; }
    .container, .container-xl, .container-fluid { max-width: 100% !important; padding: 0 !important; }
    .row { display: block !important; }
    .col-lg-8, .col-lg-4, [class*="col-"] { width: 100% !important; max-width: 100% !important; flex: none !important; }

    /* ---- Print header (hidden on screen) ---- */
    .print-header { display: block !important; margin-bottom: 1rem; }
    .print-header h1 { font-size: 14pt; margin: 0 0 0.25rem; }
    .print-header p  { font-size: 9pt; color: #555; margin: 0; }

    /* ---- League table chart: keep on one page ---- */
    .league-chart-canvas-wrap {
        width: 100% !important;
        height: auto !important;
        page-break-inside: avoid;
        max-height: 500px !important;
    }
    canvas { max-width: 100% !important; }

    /* ---- League table data table ---- */
    .ranking-table-wrap { overflow: visible !important; }
    .ranking-table-wrap table {
        width: 100%;
        border-collapse: collapse;
        font-size: 8pt;
        page-break-inside: auto;
    }
    .ranking-table-wrap table th,
    .ranking-table-wrap table td {
        border: 1px solid #ccc;
        padding: 3px 6px;
    }
    .ranking-table-wrap table thead { background: #f0f0f0 !important; }
    tr { page-break-inside: avoid; }

    /* ---- RAG indicators: use borders so they survive black-and-white printing ---- */
    .rag-dot-print-green  { border: 3px solid #2e7d32 !important; background: transparent !important; }
    .rag-dot-print-amber  { border: 3px solid #f57f17 !important; background: transparent !important; }
    .rag-dot-print-red    { border: 3px solid #c62828 !important; background: transparent !important; }

    /* ---- Scorecard: expand all pillar tabs for print ---- */
    .tab-content .tab-pane { display: block !important; opacity: 1 !important; }
    .metric-card-extra { display: block !important; }   /* show all hidden metric cards */
    .metric-cards-grid .col-sm-6 { width: 50% !important; float: left !important; }

    /* ---- Source attribution ---- */
    .source-attribution { display: block !important; font-size: 9pt; color: #555; margin-top: 0.75rem; }

    /* ---- Sidebar panels: collapse to list in print ---- */
    .chart-container { box-shadow: none !important; border: 1px solid #ddd !important; }

    /* ---- Page setup ---- */
    @page { margin: 1.5cm; }
}

/* ---- Provenance dots ---- */
.provenance-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    vertical-align: middle;
    cursor: help;
}
.provenance-green { background-color: #16a34a; }
.provenance-blue  { background-color: #6366f1; }
.provenance-amber { background-color: #d97706; }
.provenance-grey  { background-color: #9ca3af; }

/* ---- Skeleton loading animation ---- */
@keyframes skeleton-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}
.skeleton-line {
    background: var(--gray-200);
    border-radius: 4px;
    animation: skeleton-pulse 1.5s ease-in-out infinite;
}
.skeleton-block {
    background: var(--gray-100);
    border-radius: 4px;
    animation: skeleton-pulse 1.5s ease-in-out infinite;
}

/* ---- Tighter spacing for data-dense auth pages ---- */
.body-detail-header { padding: 1rem 1.25rem; }
.scorecard-pillar-section { margin-bottom: 1.25rem; }
.scorecard-card { padding: 0.85rem; min-height: 110px; }
.scorecard-card-scroll-row { gap: 0.4rem; }
