@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@600;700;800&family=Inter:wght@400;500;600&display=swap');

/* ===== Reset & Base ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --blue: #2563eb;
    --blue-dark: #1d4ed8;
    --blue-light: #dbeafe;
    --green: #16a34a;
    --green-dark: #15803d;
    --green-light: #dcfce7;
    --orange: #ea580c;
    --orange-light: #fff7ed;
    --purple: #7c3aed;
    --purple-light: #f3e8ff;
    --red: #dc2626;
    --red-light: #fef2f2;
    --teal: #0d9488;
    --teal-light: #f0fdfa;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --indigo: #4f46e5;
    --indigo-dark: #4338ca;
    --indigo-light: #eef2ff;
    --emerald: #059669;
    --emerald-light: #ecfdf5;
    --amber: #d97706;
    --amber-light: #fffbeb;
    --radius: 12px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 4px 16px rgba(0,0,0,0.08);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.12);

    /* Typography */
    --font-display: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    /* Category accent colors */
    --cat-groups: #2563eb;
    --cat-timeseries: #4f46e5;
    --cat-sla: #d97706;
    --cat-priority: #ea580c;
    --cat-operational: #0d9488;
    --cat-insights: #7c3aed;

    /* Animation easing */
    --ease-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    color: var(--gray-800);
    background: #fff;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.hidden {
    display: none !important;
}

/* ===== Navbar ===== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--gray-200);
}

.nav-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--gray-900);
}

.brand-icon {
    width: 28px;
    height: 28px;
    color: var(--blue);
}

.nav-cta {
    padding: 8px 20px;
    background: var(--blue);
    color: #fff;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 600;
    transition: background 0.2s;
}

.nav-cta:hover {
    background: var(--blue-dark);
}

.nav-guest-btn {
    padding: 6px 14px;
    background: var(--teal-light);
    color: var(--teal);
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1.5px solid var(--teal);
    transition: background 0.2s, color 0.2s;
}

.nav-guest-btn:hover {
    background: var(--teal);
    color: #fff;
}

/* ===== Guest Upgrade Banner ===== */
.guest-banner {
    background: linear-gradient(90deg, #0d948810 0%, #0d948818 100%);
    border-bottom: 1px solid #0d948840;
    padding: 10px 24px;
}

.guest-banner-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.875rem;
    color: var(--gray-700);
}

.guest-banner-cta {
    color: var(--teal);
    font-weight: 700;
    text-decoration: none;
    margin-left: 4px;
}

.guest-banner-cta:hover {
    text-decoration: underline;
}

.guest-banner-close {
    margin-left: auto;
    background: none;
    border: none;
    font-size: 1.1rem;
    color: var(--gray-400);
    cursor: pointer;
    line-height: 1;
    padding: 2px 4px;
    flex-shrink: 0;
}

.guest-banner-close:hover {
    color: var(--gray-700);
}

/* ===== Section Layout ===== */
.section-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ===== Global Display Font for all headings ===== */
h1, h2, h3, h4, h5 {
    font-family: var(--font-display);
}

/* ===== Shared Scroll-Reveal Animation ===== */
.reveal-pending {
    opacity: 0;
    transform: translateY(20px);
}
.reveal-visible {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.55s var(--ease-expo), transform 0.55s var(--ease-expo);
}

.section-title {
    font-size: 2rem;
    font-weight: 800;
    color: var(--gray-900);
    text-align: center;
    margin-bottom: 8px;
}

.section-sub {
    text-align: center;
    color: var(--gray-500);
    font-size: 1.05rem;
    max-width: 600px;
    margin: 0 auto 48px;
}

/* ===== Hero ===== */
.hero {
    padding: 140px 24px 80px;
    background: linear-gradient(160deg, #f0f5ff 0%, #e8f0fe 40%, #fff 100%);
    text-align: center;
}

.hero-inner {
    max-width: 760px;
    margin: 0 auto;
}

.hero-badge {
    display: inline-block;
    padding: 6px 16px;
    background: var(--blue-light);
    color: var(--blue);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 20px;
}

.hero h1 {
    font-size: 3rem;
    font-weight: 800;
    color: var(--gray-900);
    line-height: 1.15;
    margin-bottom: 20px;
    letter-spacing: -0.5px;
}

.hero-sub {
    font-size: 1.15rem;
    color: var(--gray-600);
    line-height: 1.7;
    max-width: 600px;
    margin: 0 auto 32px;
}

.hero-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 40px;
}

/* ===== Hero Pills ===== */
.hero-pills {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
}

.hero-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--gray-700);
    box-shadow: var(--shadow-sm);
}

.pill-icon {
    width: 16px;
    height: 16px;
    color: var(--indigo);
    flex-shrink: 0;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    line-height: 1.4;
}

.btn-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.btn-primary {
    background: var(--blue);
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    background: var(--blue-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.btn-primary:disabled {
    background: #93b5f1;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-outline {
    background: transparent;
    color: var(--gray-700);
    border: 1.5px solid var(--gray-200);
}

.btn-outline:hover {
    border-color: var(--gray-400);
    background: var(--gray-50);
}

.btn-success {
    background: var(--green);
    color: #fff;
}

.btn-success:hover {
    background: var(--green-dark);
}

.btn-lg {
    padding: 14px 32px;
    font-size: 1rem;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

/* ===== Hero Stats ===== */
.hero-stats {
    display: flex;
    justify-content: center;
    gap: 48px;
    flex-wrap: wrap;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-num {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--blue);
    line-height: 1;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--gray-500);
    font-weight: 500;
    margin-top: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* ===== Features ===== */
.features {
    padding: 96px 24px;
    background: #fff;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.feature-card {
    background: var(--gray-50);
    border: 1px solid var(--gray-100);
    border-radius: var(--radius);
    padding: 28px 24px;
    transition: all 0.25s;
}

.feature-card:hover {
    box-shadow: var(--shadow);
    border-color: var(--gray-200);
    transform: translateY(-2px);
}

.feature-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.feature-icon svg {
    width: 22px;
    height: 22px;
}

.icon-blue   { background: var(--blue-light);   color: var(--blue); }
.icon-green  { background: var(--green-light);  color: var(--green); }
.icon-orange { background: var(--orange-light); color: var(--orange); }
.icon-purple { background: var(--purple-light); color: var(--purple); }
.icon-red    { background: var(--red-light);    color: var(--red); }
.icon-teal   { background: var(--teal-light);   color: var(--teal); }
.icon-indigo  { background: var(--indigo-light);  color: var(--indigo); }
.icon-emerald { background: var(--emerald-light); color: var(--emerald); }
.icon-amber   { background: var(--amber-light);   color: var(--amber); }

a.feature-card-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
}

.feature-view-link {
    margin-top: auto;
    padding-top: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--blue);
    transition: color 0.2s;
}

.feature-card-link:hover .feature-view-link {
    color: var(--blue-dark);
}

.feature-card h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 8px;
}

.feature-card p {
    font-size: 0.9rem;
    color: var(--gray-500);
    line-height: 1.55;
}

/* ===== How It Works ===== */
.how-it-works {
    padding: 96px 24px;
    background: var(--gray-50);
}

.steps {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 0;
    max-width: 800px;
    margin: 0 auto;
}

.step {
    flex: 1;
    text-align: center;
    padding: 0 20px;
}

.step-num {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--blue);
    color: #fff;
    font-size: 1.2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.step h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 8px;
}

.step p {
    font-size: 0.9rem;
    color: var(--gray-500);
    line-height: 1.5;
}

.step-connector {
    width: 60px;
    height: 2px;
    background: var(--gray-200);
    margin-top: 24px;
    flex-shrink: 0;
}

/* ===== Step Cards (new 4-step layout) ===== */
.steps-row {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 0;
    max-width: 960px;
    margin: 0 auto;
}

.step-card {
    flex: 1;
    text-align: center;
    padding: 0 12px;
    max-width: 200px;
}

.step-card .step-num {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--indigo);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
}

.step-icon-wrap {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: var(--indigo-light);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
}

.step-icon-wrap svg {
    width: 26px;
    height: 26px;
    color: var(--indigo);
}

.step-card h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 6px;
}

.step-card p {
    font-size: 0.85rem;
    color: var(--gray-500);
    line-height: 1.5;
}

.step-arrow {
    display: flex;
    align-items: center;
    padding-top: 52px;
    flex-shrink: 0;
}

.step-arrow svg {
    width: 24px;
    height: 24px;
    color: var(--gray-300);
}

/* ===== Features Minimal (3-card layout) ===== */
.features-minimal {
    padding: 96px 24px;
    background: var(--gray-50);
}

.features-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.feature-card-m {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 32px 24px;
    text-decoration: none;
    color: inherit;
    transition: all 0.25s;
}

.feature-card-m:hover {
    box-shadow: var(--shadow);
    border-color: var(--gray-300);
    transform: translateY(-2px);
}

.feature-icon-m {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 18px;
}

.feature-icon-m svg {
    width: 24px;
    height: 24px;
}

.feature-card-m h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 8px;
}

.feature-card-m p {
    font-size: 0.9rem;
    color: var(--gray-500);
    line-height: 1.6;
    margin-bottom: 16px;
}

.feature-link {
    margin-top: auto;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--indigo);
    transition: color 0.2s;
}

.feature-card-m:hover .feature-link {
    color: var(--indigo-dark);
}

/* ===== Bottom CTA ===== */
.bottom-cta {
    padding: 80px 24px;
    background: linear-gradient(160deg, #0f172a 0%, #1e293b 100%);
    text-align: center;
}

.bottom-cta h2 {
    font-size: 2rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 12px;
    letter-spacing: -0.3px;
}

.bottom-cta p {
    font-size: 1.05rem;
    color: #94a3b8;
    max-width: 520px;
    margin: 0 auto 32px;
    line-height: 1.6;
}

.btn-cta-light {
    background: #fff;
    color: var(--gray-900);
    font-weight: 700;
}

.btn-cta-light:hover {
    background: var(--gray-100);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(255, 255, 255, 0.15);
}

/* ===== Upload Section ===== */
.upload-section {
    padding: 96px 24px;
    background: #fff;
}

.upload-card {
    max-width: 560px;
    margin: 0 auto;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 16px;
    padding: 40px;
    text-align: center;
}

.upload-card h2 {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--gray-900);
    margin-bottom: 6px;
}

.upload-hint {
    color: var(--gray-500);
    font-size: 0.9rem;
    margin-bottom: 28px;
}

/* Dropzone */
.dropzone {
    border: 2px dashed var(--gray-200);
    border-radius: var(--radius);
    padding: 40px 24px;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 16px;
    background: #fff;
}

.dropzone:hover,
.dropzone.dragover {
    border-color: var(--blue);
    background: var(--blue-light);
}

.dropzone.has-files {
    border-color: var(--green);
    background: var(--green-light);
}

.dropzone-icon {
    width: 40px;
    height: 40px;
    color: var(--gray-400);
    margin-bottom: 12px;
}

.dropzone.has-files .dropzone-icon {
    color: var(--green);
}

.dropzone-text {
    font-size: 0.9rem;
    color: var(--gray-500);
}

.dropzone.has-files .dropzone-text {
    color: var(--green-dark);
    font-weight: 600;
}

.dropzone input[type="file"] {
    display: none;
}

/* ===== Progress Ring ===== */
.progress-ring-wrapper {
    position: relative;
    width: 140px;
    height: 140px;
    margin: 16px auto 20px;
}

.progress-ring {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.progress-ring-bg {
    fill: none;
    stroke: var(--gray-200);
    stroke-width: 8;
}

.progress-ring-fill {
    fill: none;
    stroke: var(--blue);
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.6s ease;
}

.progress-ring-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--blue);
}

.step-text {
    color: var(--gray-500);
    font-size: 0.9rem;
}

/* ===== Result Boxes ===== */
.success-box {
    background: var(--green-light);
    border: 1px solid #bbf7d0;
    border-radius: var(--radius);
    padding: 32px 24px;
    margin-bottom: 16px;
}

.success-box h3 {
    font-size: 1.2rem;
    color: var(--green-dark);
    margin: 12px 0 6px;
}

.success-box p {
    color: var(--gray-600);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.error-box {
    background: var(--red-light);
    border: 1px solid #fecaca;
    border-radius: var(--radius);
    padding: 32px 24px;
    margin-bottom: 16px;
}

.error-box h3 {
    font-size: 1.2rem;
    color: var(--red);
    margin: 12px 0 6px;
}

.error-box p {
    color: var(--gray-600);
    font-size: 0.9rem;
    word-break: break-word;
}

.result-icon {
    width: 40px;
    height: 40px;
}

/* ===== Footer ===== */
.footer {
    padding: 32px 24px;
    background: var(--gray-900);
    text-align: center;
}

.footer p {
    color: var(--gray-400);
    font-size: 0.85rem;
}

.footer strong {
    color: var(--gray-200);
}

/* ===== Nav Links ===== */
.nav-links {
    display: flex;
    align-items: center;
    gap: 16px;
}

.nav-link {
    color: var(--gray-600);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-link:hover {
    color: var(--gray-900);
}

.nav-brand {
    text-decoration: none;
}

/* ===== Gallery ===== */
.gallery-header {
    padding: 120px 24px 40px;
    text-align: center;
    background: linear-gradient(160deg, #f0f5ff 0%, #e8f0fe 40%, #fff 100%);
}

.gallery-header h1 {
    font-size: clamp(1.6rem, 4vw, 2.5rem);
    font-weight: 800;
    font-family: var(--font-display);
    color: var(--gray-900);
    margin-bottom: 8px;
}

.gallery-section {
    padding: 24px 24px 96px;
    background: #fff;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.gallery-tile {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.25s;
}

.gallery-tile:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--blue);
    transform: translateY(-3px);
}

.tile-img-wrapper {
    background: #fff;
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    position: relative;
}

.chart-num-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: var(--blue);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.tile-img-wrapper img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 6px;
}

.tile-label {
    padding: 12px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-700);
    border-top: 1px solid var(--gray-100);
    text-align: center;
}

/* Filter Tabs */
.filter-tabs {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
}

.filter-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--gray-600);
    background: #fff;
    border: 1.5px solid var(--gray-200);
    transition: all 0.2s;
}

.filter-tab:hover {
    border-color: var(--blue);
    color: var(--blue);
}

.filter-tab.active {
    background: var(--blue);
    color: #fff;
    border-color: var(--blue);
}

.filter-count {
    font-size: 0.7rem;
    background: rgba(0, 0, 0, 0.1);
    padding: 1px 7px;
    border-radius: 10px;
}

.filter-tab.active .filter-count {
    background: rgba(255, 255, 255, 0.25);
}

/* Gallery Empty */
.gallery-empty {
    text-align: center;
    padding: 80px 24px;
}

.empty-icon {
    width: 56px;
    height: 56px;
    color: var(--gray-400);
    margin-bottom: 16px;
}

.gallery-empty h3 {
    font-size: 1.3rem;
    color: var(--gray-700);
    margin-bottom: 8px;
}

.gallery-empty p {
    color: var(--gray-500);
    margin-bottom: 24px;
}

/* ===== Executive Narrative Page ===== */
.narrative-header {
    padding: 120px 24px 40px;
    text-align: center;
    background: linear-gradient(160deg, #0f172a 0%, #1e293b 60%, #334155 100%);
    color: #fff;
}

.narrative-header h1 {
    font-size: 2.4rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 8px;
}

.narrative-header .section-sub {
    color: #94a3b8;
}

.narrative-header .hero-badge {
    background: rgba(255, 255, 255, 0.1);
    color: #93c5fd;
}

/* Performance Story */
.narrative-story {
    background: #fff;
    padding: 36px 24px 32px;
    border-bottom: 1px solid #e2e8f0;
}

.performance-story-text {
    font-size: 1.08rem;
    line-height: 1.9;
    color: #334155;
    max-width: 820px;
    margin: 0 auto;
    text-align: center;
}

.performance-story-text strong {
    color: #1e40af;
    font-weight: 600;
}

/* KPI Cards */
.narrative-kpis {
    padding: 32px 24px 0;
    margin-top: 0;
    position: relative;
    z-index: 10;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    max-width: 900px;
    margin: 0 auto;
}

.kpi-card {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 20px 16px;
    text-align: center;
    box-shadow: var(--shadow);
}

.kpi-value {
    display: block;
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--blue);
    line-height: 1.1;
}

.kpi-label {
    display: block;
    font-size: 0.72rem;
    color: var(--gray-500);
    font-weight: 500;
    margin-top: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Overview Grid */
.narrative-overview {
    padding: 56px 24px 48px;
    background: #fff;
}

.overview-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.overview-card {
    background: var(--gray-50);
    border: 1px solid var(--gray-100);
    border-radius: var(--radius);
    padding: 24px;
}

.overview-card h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 12px;
}

.overview-card p {
    font-size: 0.85rem;
    color: var(--gray-600);
    line-height: 1.6;
    margin-bottom: 12px;
}

.overview-note {
    font-size: 0.8rem !important;
    color: var(--gray-500) !important;
    font-style: italic;
}

/* Bar list in overview */
.overview-bar-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.overview-bar-item {
    font-size: 0.8rem;
}

.overview-bar-label {
    display: flex;
    justify-content: space-between;
    color: var(--gray-700);
    font-weight: 500;
    margin-bottom: 3px;
}

.overview-bar-track {
    height: 6px;
    background: var(--gray-200);
    border-radius: 3px;
    overflow: hidden;
}

.overview-bar-fill {
    height: 100%;
    background: var(--blue);
    border-radius: 3px;
    transition: width 0.5s ease;
}

/* Priority bars */
.priority-bars {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 16px 0;
}

.priority-bar {
    display: flex;
    align-items: center;
    gap: 10px;
}

.priority-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--gray-700);
    width: 85px;
    flex-shrink: 0;
}

.priority-track {
    flex: 1;
    height: 8px;
    background: var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
}

.priority-fill {
    height: 100%;
    border-radius: 4px;
}

.priority-low { background: var(--green); }
.priority-high { background: var(--red); }

.priority-pct {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--gray-600);
    width: 40px;
    text-align: right;
}

/* Section-by-section analysis */
.narrative-section {
    padding: 56px 24px;
    background: #fff;
}

.narrative-section-alt {
    background: var(--gray-50);
}

.narrative-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--gray-200);
}

.narrative-section-header h2 {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--gray-900);
}

.btn-sm {
    padding: 7px 16px;
    font-size: 0.8rem;
}

.narrative-chart-block {
    margin-bottom: 20px;
}

.narrative-chart-row {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 20px;
}

.narrative-section-alt .narrative-chart-row {
    background: #fff;
}

.narrative-chart-thumb {
    flex-shrink: 0;
    width: 220px;
    cursor: pointer;
    border: 1px solid var(--gray-100);
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.2s;
    position: relative;
}

.narrative-chart-thumb:hover {
    box-shadow: var(--shadow);
}

.narrative-chart-thumb img {
    width: 100%;
    height: auto;
    display: block;
}

.narrative-chart-text {
    flex: 1;
    min-width: 0;
}

.narrative-chart-text h4 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 8px;
}

.narrative-summary-text {
    font-size: 0.85rem;
    color: var(--gray-600);
    line-height: 1.6;
    margin-bottom: 12px;
}

.narrative-trend {
    background: var(--gray-50);
    border-radius: 8px;
    padding: 12px;
}

.narrative-trend p {
    font-size: 0.82rem;
    color: var(--gray-600);
    line-height: 1.55;
}

/* Key Takeaways */
.narrative-takeaways {
    padding: 72px 24px;
    background: linear-gradient(160deg, #0f172a 0%, #1e293b 100%);
}

.narrative-takeaways .section-title {
    color: #fff;
    margin-bottom: 40px;
}

.takeaway-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    max-width: 1000px;
    margin: 0 auto;
}

.takeaway-card {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius);
    padding: 24px 20px;
    text-align: center;
}

.takeaway-num {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--blue);
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
}

.takeaway-card h4 {
    font-size: 0.95rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 8px;
}

.takeaway-card p {
    font-size: 0.8rem;
    color: #94a3b8;
    line-height: 1.55;
}

/* ===== Slide Modal ===== */
.slide-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.slide-overlay.active {
    display: flex;
}

.slide-modal {
    background: #fff;
    border-radius: 16px;
    width: 95vw;
    max-width: 95vw;
    max-height: 95vh;
    overflow-y: auto;
    padding: 20px 28px;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.slide-close {
    position: absolute;
    top: 12px;
    right: 20px;
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--gray-400);
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
    z-index: 10;
}

.slide-close:hover {
    color: var(--gray-900);
}

.slide-title {
    font-size: clamp(0.95rem, 2vw, 1.3rem);
    font-weight: 800;
    font-family: var(--font-display);
    color: var(--gray-900);
    margin-bottom: 16px;
    padding-right: 40px;
    display: flex;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 10px;
}

.slide-chart-num {
    flex-shrink: 0;
    background: var(--blue);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 6px;
    letter-spacing: 0.3px;
}

.slide-chart-num:empty {
    display: none;
}

.chart-ref {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--blue);
    background: var(--blue-light);
    padding: 2px 8px;
    border-radius: 4px;
    margin-right: 4px;
    vertical-align: middle;
}

/* Two-column modal body */
.slide-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
}

.slide-body.slide-single-col {
    grid-template-columns: 1fr;
}

.slide-col-hidden {
    display: none !important;
}

.slide-left-col {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.slide-right-col {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Column header with label + expand button */
.slide-col-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--gray-200);
    margin-bottom: 2px;
}

.slide-col-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--gray-400);
}

.slide-expand-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    cursor: pointer;
    color: var(--gray-500);
    transition: all 0.2s;
    flex-shrink: 0;
}

.slide-expand-btn:hover {
    background: var(--blue-light);
    border-color: var(--blue);
    color: var(--blue);
}

.slide-expand-btn svg {
    width: 14px;
    height: 14px;
}

/* ── Refresh Analysis button ────────────────────────────────────────────── */
.refresh-narrative-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1.5px solid var(--blue);
    background: var(--blue-light);
    color: var(--blue);
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-right: 6px;
    flex-shrink: 0;
    white-space: nowrap;
}
.refresh-narrative-btn:hover {
    background: var(--blue);
    color: #fff;
}
.refresh-narrative-btn.filter-active {
    background: var(--blue);
    color: #fff;
    border-color: var(--blue-dark);
    box-shadow: 0 1px 4px rgba(37,99,235,0.25);
}
.refresh-narrative-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}
@keyframes spin-refresh { to { transform: rotate(360deg); } }
.refresh-narrative-btn.spinning svg {
    animation: spin-refresh 0.7s linear infinite;
}

/* ── Filter context badge ───────────────────────────────────────────────── */
.filter-context-badge {
    display: flex;
    align-items: center;
    gap: 7px;
    background: var(--blue-light);
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    padding: 6px 10px;
    margin-bottom: 12px;
    font-size: 0.73rem;
    font-weight: 500;
    color: var(--blue);
}
.filter-context-badge button {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
    opacity: 0.65;
    padding: 1px 2px;
    display: flex;
    align-items: center;
    border-radius: 3px;
    transition: opacity 0.15s;
    flex-shrink: 0;
}
.filter-context-badge button:hover { opacity: 1; }

.slide-block {
    background: var(--gray-50);
    border: 1px solid var(--gray-100);
    border-radius: 10px;
    padding: 16px;
}

.slide-block-label {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--blue);
    background: var(--blue-light);
    padding: 3px 10px;
    border-radius: 4px;
    margin-bottom: 8px;
}

.slide-block p {
    font-size: 0.85rem;
    color: var(--gray-700);
    line-height: 1.6;
}

.slide-chart-col {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.slide-chart-col img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 6px;
}

/* iframe variant — fixed height so it fills left column */
.slide-iframe-col {
    padding: 0;
    min-height: 600px;
    height: 600px;
    overflow: hidden;
}

/* Insight items */
.insight-item {
    font-size: 0.83rem;
    color: var(--gray-700);
    line-height: 1.55;
    padding: 8px 0;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.insight-item:last-child {
    border-bottom: none;
}

.insight-num {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--blue);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1px;
}

.insight-item strong {
    color: var(--gray-900);
}

/* ===== Gallery Header Sub-Row (count + download) ===== */
.gallery-header-sub-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.gallery-count-text {
    margin: 0;
}

/* ===== Gallery Search Box ===== */
.gallery-search-wrap {
    position: relative;
    max-width: 380px;
    margin: 16px auto 8px;
}

.gallery-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--gray-400);
    pointer-events: none;
}

.gallery-search {
    width: 100%;
    padding: 9px 14px 9px 36px;
    border: 1.5px solid var(--gray-200);
    border-radius: 24px;
    font-size: 0.88rem;
    background: #fff;
    color: var(--gray-800);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.gallery-search:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}

.gallery-no-results {
    text-align: center;
    color: var(--gray-500);
    padding: 48px 0;
    font-size: 0.95rem;
}

/* ===== Download Dropdown ===== */
.download-dropdown {
    position: relative;
    display: inline-block;
}

.download-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: #fff;
    border: 1.5px solid var(--gray-200);
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    min-width: 120px;
    z-index: 200;
    overflow: hidden;
}

.download-menu.open {
    display: block;
}

.download-item {
    display: block;
    padding: 10px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-700);
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
    cursor: pointer;
}

.download-item:hover {
    background: var(--blue-light);
    color: var(--blue);
}

/* Download button turns blue when filters are active */
.download-trigger.filter-active {
    border-color: var(--blue);
    color: var(--blue);
    background: var(--blue-light);
}
.download-trigger.filter-active:hover {
    background: color-mix(in srgb, var(--blue) 15%, transparent);
}

/* ===== Slide Modal: Header Actions Row ===== */

.slide-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    flex-shrink: 0;
}

/* ===== PNG / Interactive View Toggle ===== */
.view-toggle {
    display: flex;
    border: 1.5px solid var(--gray-200);
    border-radius: 8px;
    overflow: hidden;
}

.view-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    font-size: 0.78rem;
    font-weight: 600;
    background: #fff;
    border: none;
    cursor: pointer;
    color: var(--gray-600);
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

.view-toggle-btn:not(:last-child) {
    border-right: 1.5px solid var(--gray-200);
}

.view-toggle-btn.active {
    background: var(--blue);
    color: #fff;
}

.view-toggle-btn:not(.active):hover {
    background: var(--gray-100);
    color: var(--gray-900);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .hero {
        padding: 120px 20px 60px;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .hero-sub {
        font-size: 1rem;
    }

    .hero-stats {
        gap: 32px;
    }

    .hero-pills {
        gap: 8px;
    }

    .hero-pill {
        font-size: 0.75rem;
        padding: 6px 12px;
    }

    .feature-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .features-grid-3 {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .steps {
        flex-direction: column;
        align-items: center;
        gap: 24px;
    }

    .step-connector {
        width: 2px;
        height: 32px;
        margin: 0;
    }

    .steps-row {
        flex-direction: column;
        align-items: center;
        gap: 16px;
    }

    .step-card {
        max-width: 280px;
    }

    .step-arrow {
        padding-top: 0;
        transform: rotate(90deg);
    }

    .section-title {
        font-size: 1.5rem;
    }

    .upload-card {
        padding: 28px 20px;
    }

    .bottom-cta {
        padding: 60px 20px;
    }

    .bottom-cta h2 {
        font-size: 1.5rem;
    }

    .gallery-grid {
        grid-template-columns: 1fr;
    }

    .gallery-header h1 {
        font-size: 1.6rem;
    }

    .slide-modal {
        padding: 16px 16px;
        width: 98vw;
        max-height: 98vh;
    }

    .slide-body {
        grid-template-columns: 1fr;
    }

    .slide-expand-btn {
        display: none;
    }

    .slide-title {
        font-size: 1.2rem;
    }

    .filter-tabs {
        gap: 6px;
    }

    .filter-tab {
        font-size: 0.75rem;
        padding: 6px 12px;
    }

    .overview-grid {
        grid-template-columns: 1fr;
    }

    .narrative-chart-row {
        flex-direction: column;
    }

    .narrative-chart-thumb {
        width: 100%;
    }

    .takeaway-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .narrative-header h1 {
        font-size: 1.7rem;
    }

    .narrative-section-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    /* Filter bar: stack zones vertically on mobile */
    .api-filter-bar { flex-direction: column; align-items: stretch; }
    .fb-zone { flex-wrap: wrap; }
    .fb-zone + .fb-zone { border-left: none; padding-left: 0; border-top: 1px solid var(--gray-200); padding-top: 8px; }
    .fb-group select { max-width: 100%; }
}

/* ===== Auth Card (login / register) ===== */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, #f0f5ff 0%, #e8f0fe 40%, #fff 100%);
    padding: 80px 24px 40px;
}

.auth-card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 420px;
}

.auth-card h2 {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--gray-900);
    margin-bottom: 0.25rem;
}

.auth-card .auth-subtitle {
    color: var(--gray-500);
    font-size: 0.9rem;
    margin-bottom: 1.75rem;
}

.auth-card .form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 1rem;
}

.auth-card .form-group label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-700);
}

.auth-card input[type=text],
.auth-card input[type=email],
.auth-card input[type=password] {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--gray-200);
    border-radius: 8px;
    font-size: 0.95rem;
    color: var(--gray-800);
    outline: none;
    transition: border-color 0.2s;
}

.auth-card input[type=text]:focus,
.auth-card input[type=email]:focus,
.auth-card input[type=password]:focus {
    border-color: var(--blue);
}

/* ── Password visibility toggle ── */
/* The wrapper becomes the bordered container; the input loses its own border. */
.password-wrapper {
    display: flex;
    align-items: stretch;
    border: 1.5px solid var(--gray-200);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    transition: border-color 0.2s;
}

.password-wrapper:focus-within {
    border-color: var(--blue);
}

/* Strip the input's own border/radius so the wrapper provides it */
.password-wrapper input[type=password],
.password-wrapper input[type=text] {
    flex: 1;
    min-width: 0;
    width: auto !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    outline: none !important;
    padding: 10px 12px;
    font-size: 0.95rem;
    color: var(--gray-800);
    background: transparent;
    transition: none;
}

.password-toggle {
    flex-shrink: 0;
    width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-left: 1.5px solid var(--gray-200);
    color: #9ca3af;
    cursor: pointer;
    padding: 0;
    line-height: 0;
    transition: color 0.15s, background 0.15s;
}

.password-toggle:hover {
    color: var(--gray-700);
    background: var(--gray-50);
}

.password-toggle:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: -2px;
}

.password-toggle .eye-on  { display: block; }
.password-toggle .eye-off { display: none;  }

.password-toggle.showing .eye-on  { display: none;  }
.password-toggle.showing .eye-off { display: block; }

.auth-card .btn-block {
    width: 100%;
    margin-top: 0.5rem;
    padding: 11px 0;
    font-size: 1rem;
    font-weight: 700;
    background: var(--blue);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.auth-card .btn-block:hover {
    background: var(--blue-dark);
}

.auth-card .auth-link {
    display: block;
    text-align: center;
    margin-top: 1.25rem;
    font-size: 0.875rem;
    color: var(--gray-500);
}

.auth-card .auth-link a {
    color: var(--blue);
    font-weight: 600;
    text-decoration: none;
}

.auth-card .auth-link a:hover {
    text-decoration: underline;
}

.auth-card .auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 1.25rem 0 1rem;
    color: var(--gray-400);
    font-size: 0.8rem;
}

.auth-card .auth-divider::before,
.auth-card .auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--gray-200);
}

.auth-card .btn-guest-access {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 11px 20px;
    background: var(--teal-light);
    color: var(--teal);
    border: 1.5px solid var(--teal);
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
}

.auth-card .btn-guest-access:hover {
    background: var(--teal);
    color: #fff;
}

.auth-card .auth-guest-note {
    text-align: center;
    font-size: 0.78rem;
    color: var(--gray-400);
    margin-top: 0.75rem;
}

.auth-card .auth-guest-note a {
    color: var(--teal);
    font-weight: 600;
    text-decoration: none;
}

.auth-card .auth-guest-note a:hover {
    text-decoration: underline;
}

/* ===== Flash Messages ===== */
.flash-messages {
    margin-bottom: 1rem;
}

.flash-msg {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.875rem;
    margin-bottom: 8px;
}

.flash-msg.error {
    background: var(--red-light);
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.flash-msg.success {
    background: var(--green-light);
    color: #14532d;
    border: 1px solid #86efac;
}

.flash-msg.info {
    background: var(--blue-light);
    color: #1e40af;
    border: 1px solid #93c5fd;
}

/* ===== Role Badge ===== */
.role-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 99px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    vertical-align: middle;
}

.role-badge.guest        { background: var(--teal-light); color: var(--teal); }
.role-badge.viewer       { background: var(--gray-100); color: var(--gray-600); }
.role-badge.contribute   { background: var(--blue-light); color: #1d4ed8; }
.role-badge.admin        { background: var(--orange-light); color: #9a3412; }
.role-badge.global_admin { background: var(--red-light); color: #991b1b; }

/* ===== Navbar User Section ===== */
.nav-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-user-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-700);
}

.nav-user-logout {
    padding: 6px 14px;
    background: transparent;
    border: 1.5px solid var(--gray-200);
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray-600);
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
    text-decoration: none;
}

.nav-user-logout:hover {
    border-color: var(--red);
    color: var(--red);
}

/* ===== Admin User Table ===== */
.admin-page {
    padding: 100px 24px 60px;
    min-height: 100vh;
}

.admin-page h1 {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
}

.admin-page .admin-sub {
    color: var(--gray-500);
    font-size: 0.95rem;
    margin-bottom: 2rem;
}

.user-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.user-table thead {
    background: var(--gray-50);
    border-bottom: 2px solid var(--gray-200);
}

.user-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.user-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-100);
    font-size: 0.9rem;
    color: var(--gray-800);
    vertical-align: middle;
}

.user-table tbody tr:last-child td {
    border-bottom: none;
}

.user-table tbody tr:hover td {
    background: var(--gray-50);
}

.user-table .role-select {
    padding: 5px 8px;
    border: 1.5px solid var(--gray-200);
    border-radius: 6px;
    font-size: 0.875rem;
    color: var(--gray-700);
    background: #fff;
    cursor: pointer;
}

.user-table .btn-toggle {
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1.5px solid;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.user-table .btn-toggle.active {
    background: var(--green-light);
    color: var(--green);
    border-color: var(--green);
}

.user-table .btn-toggle.inactive {
    background: var(--red-light);
    color: var(--red);
    border-color: var(--red);
}

.user-table .inline-form {
    display: inline;
}

/* ===== Upload Locked Message ===== */
.upload-locked {
    text-align: center;
    color: var(--gray-400);
    font-size: 0.95rem;
    padding: 2rem;
    background: var(--gray-50);
    border-radius: var(--radius);
    border: 1.5px dashed var(--gray-200);
}

/* ===== Category Accent Strips on Gallery Tiles ===== */
.gallery-tile[data-category="groups"]      { border-top: 3px solid var(--cat-groups); }
.gallery-tile[data-category="timeseries"]  { border-top: 3px solid var(--cat-timeseries); }
.gallery-tile[data-category="sla"]         { border-top: 3px solid var(--cat-sla); }
.gallery-tile[data-category="priority"]    { border-top: 3px solid var(--cat-priority); }
.gallery-tile[data-category="operational"] { border-top: 3px solid var(--cat-operational); }
.gallery-tile[data-category="insights"]    { border-top: 3px solid var(--cat-insights); }

/* ===== Gallery Tile Stagger Reveal Animation ===== */
.tile-will-reveal {
    opacity: 0;
    transform: translateY(22px);
}
.tile-will-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.55s var(--ease-expo), transform 0.55s var(--ease-expo),
                box-shadow 0.25s, border-color 0.25s;
}

/* ===== Gallery Tile Hover Overlay ===== */
.tile-img-wrapper {
    overflow: hidden;
}
.tile-hover-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(37,99,235,0.82) 0%, rgba(37,99,235,0.25) 55%, transparent 100%);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 18px;
    opacity: 0;
    transition: opacity 0.22s var(--ease-in-out);
    border-radius: 6px;
    pointer-events: none;
}
.tile-hover-overlay .hover-cta {
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.4px;
    display: flex;
    align-items: center;
    gap: 5px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.gallery-tile:hover .tile-hover-overlay {
    opacity: 1;
}
.tile-interactive-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--teal);
    color: #fff;
    font-size: 0.62rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 4px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    z-index: 1;
}

/* ===== Gallery Count Micro-animation ===== */
@keyframes count-pop {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.22); }
    100% { transform: scale(1); }
}
.gallery-count-pop {
    animation: count-pop 0.35s var(--ease-expo);
}

/* ===== Filter Tab Active Pulse (page-load entrance) ===== */
@keyframes tab-enter {
    from { opacity: 0.4; transform: scale(0.94); }
    to   { opacity: 1;   transform: scale(1); }
}
.filter-tab.active {
    animation: tab-enter 0.3s var(--ease-expo) both;
}

/* ===== Modal Scale + Blur Entrance ===== */
.slide-overlay {
    opacity: 0;
    transition: opacity 0.2s var(--ease-in-out);
}
.slide-overlay.active {
    display: flex;
}
.slide-overlay.modal-visible {
    opacity: 1;
}
.slide-modal {
    transform: scale(0.96) translateY(10px);
    transition: transform 0.28s var(--ease-expo);
}
.slide-overlay.modal-visible .slide-modal {
    transform: scale(1) translateY(0);
}

/* ===== Modal Prev/Next Navigation ===== */
.slide-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.92);
    border: 1.5px solid var(--gray-200);
    color: var(--gray-700);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 20;
    transition: background 0.18s, border-color 0.18s, color 0.18s, opacity 0.18s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    backdrop-filter: blur(4px);
}
.slide-nav-btn:hover {
    background: var(--blue);
    border-color: var(--blue);
    color: #fff;
}
.slide-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}
.slide-nav-btn:disabled:hover {
    background: rgba(255,255,255,0.92);
    border-color: var(--gray-200);
    color: var(--gray-700);
}
.slide-nav-prev { left: -20px; }
.slide-nav-next { right: -20px; }
.slide-nav-btn svg { width: 16px; height: 16px; }

.slide-nav-counter {
    display: inline-flex;
    align-items: center;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--gray-500);
    background: var(--gray-100);
    border-radius: 20px;
    padding: 3px 10px;
    margin-left: 4px;
    flex-shrink: 0;
}

/* ===== Loading Skeleton ===== */
@keyframes shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position:  200% 0; }
}
.skeleton-wrap { display: none; }
.skeleton-wrap.active { display: block; }
.skeleton {
    background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite linear;
    border-radius: 6px;
}
.skeleton-chart {
    width: 100%;
    aspect-ratio: 4/3;
    min-height: 220px;
    border-radius: 8px;
}
.skeleton-line {
    height: 13px;
    margin-bottom: 10px;
    border-radius: 4px;
}
.skeleton-line.w-100 { width: 100%; }
.skeleton-line.w-80  { width: 80%;  }
.skeleton-line.w-65  { width: 65%;  }
.skeleton-line.w-50  { width: 50%;  }

/* ===== Insight Cards Redesign ===== */
.insight-item {
    background: var(--gray-50);
    border: 1px solid var(--gray-100);
    border-left: 3px solid var(--blue);
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 6px;
    font-size: 0.83rem;
    color: var(--gray-700);
    line-height: 1.55;
    display: flex;
    gap: 10px;
    align-items: flex-start;
    transition: border-left-color 0.2s, background 0.2s;
}
.insight-item:hover {
    background: var(--blue-light);
    border-left-color: var(--blue-dark);
}
.insight-item:last-child {
    margin-bottom: 0;
}
.insight-num {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--blue);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1px;
    font-family: var(--font-display);
}

/* ===== Trend Direction Badge ===== */
.trend-direction {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 20px;
    margin-bottom: 8px;
}
.trend-direction.positive {
    background: var(--green-light);
    color: var(--green-dark);
}
.trend-direction.negative {
    background: var(--red-light);
    color: var(--red);
}
.trend-direction.neutral {
    background: var(--gray-100);
    color: var(--gray-500);
}

/* ===== Dark Mode Toggle Button ===== */
.dark-toggle {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: transparent;
    border: 1.5px solid var(--gray-200);
    color: var(--gray-600);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
    flex-shrink: 0;
}
.dark-toggle:hover {
    background: var(--gray-100);
    border-color: var(--gray-400);
    color: var(--gray-900);
}
.dark-toggle svg { width: 16px; height: 16px; }
.dark-toggle .icon-moon { display: block; }
.dark-toggle .icon-sun  { display: none; }
[data-theme="dark"] .dark-toggle .icon-moon { display: none; }
[data-theme="dark"] .dark-toggle .icon-sun  { display: block; }

/* ===== Dark Mode ===== */
[data-theme="dark"] {
    color-scheme: dark;
}
[data-theme="dark"] body {
    background: #0f172a;
    color: #e2e8f0;
}
[data-theme="dark"] .navbar {
    background: #0f172a;
    border-bottom-color: #1e293b;
    box-shadow: 0 1px 0 #1e293b;
}
[data-theme="dark"] .nav-brand span,
[data-theme="dark"] .nav-link,
[data-theme="dark"] .nav-user-name {
    color: #e2e8f0;
}
[data-theme="dark"] .nav-link:hover { color: #93c5fd; }
[data-theme="dark"] .nav-user-logout {
    border-color: #334155;
    color: #94a3b8;
}
[data-theme="dark"] .nav-user-logout:hover { border-color: var(--red); color: var(--red); }
[data-theme="dark"] .dark-toggle {
    border-color: #334155;
    color: #94a3b8;
}
[data-theme="dark"] .dark-toggle:hover { background: #1e293b; border-color: #475569; color: #e2e8f0; }
[data-theme="dark"] .gallery-header {
    background: linear-gradient(160deg, #0c1a3a 0%, #111e40 40%, #0f172a 100%);
}
[data-theme="dark"] .gallery-header h1 { color: #f1f5f9; }
[data-theme="dark"] .gallery-header p  { color: #94a3b8; }
[data-theme="dark"] .gallery-section { background: #0f172a; }
[data-theme="dark"] .gallery-tile {
    background: #1e293b;
    border-color: #334155;
}
[data-theme="dark"] .gallery-tile:hover {
    border-color: var(--blue);
    box-shadow: 0 8px 32px rgba(37,99,235,0.25);
}
[data-theme="dark"] .tile-label {
    color: #e2e8f0;
    border-top-color: #334155;
    background: #1e293b;
}
[data-theme="dark"] .tile-img-wrapper { background: #273548; }
[data-theme="dark"] .gallery-search {
    background: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}
[data-theme="dark"] .gallery-search:focus { border-color: var(--blue); }
[data-theme="dark"] .filter-tab {
    background: #1e293b;
    border-color: #334155;
    color: #94a3b8;
}
[data-theme="dark"] .filter-tab:hover { border-color: var(--blue); color: #93c5fd; }
[data-theme="dark"] .filter-tab.active { background: var(--blue); color: #fff; border-color: var(--blue); }
[data-theme="dark"] .slide-modal {
    background: #1e293b;
    color: #e2e8f0;
}
[data-theme="dark"] .slide-title { color: #f1f5f9; }
[data-theme="dark"] .slide-block {
    background: #273548;
    border-color: #334155;
}
[data-theme="dark"] .slide-block p,
[data-theme="dark"] .slide-block div { color: #cbd5e1; }
[data-theme="dark"] .slide-col-header { border-bottom-color: #334155; }
[data-theme="dark"] .slide-col-label { color: #64748b; }
[data-theme="dark"] .slide-expand-btn {
    background: #334155;
    border-color: #475569;
    color: #94a3b8;
}
[data-theme="dark"] .slide-expand-btn:hover { background: var(--blue-light); border-color: var(--blue); color: var(--blue); }
[data-theme="dark"] .slide-chart-col {
    background: #1e293b;
    border-color: #334155;
}
[data-theme="dark"] .insight-item {
    background: #273548;
    border-color: #334155;
    color: #cbd5e1;
}
[data-theme="dark"] .insight-item:hover { background: #1a3a5c; }
[data-theme="dark"] .slide-nav-btn {
    background: rgba(30,41,59,0.95);
    border-color: #334155;
    color: #e2e8f0;
}
[data-theme="dark"] .slide-nav-btn:hover { background: var(--blue); border-color: var(--blue); color: #fff; }
[data-theme="dark"] .slide-nav-counter { background: #273548; color: #94a3b8; }
[data-theme="dark"] .view-toggle { border-color: #334155; }
[data-theme="dark"] .view-toggle-btn { background: #1e293b; color: #94a3b8; }
[data-theme="dark"] .view-toggle-btn:not(:last-child) { border-right-color: #334155; }
[data-theme="dark"] .view-toggle-btn.active { background: var(--blue); color: #fff; }
[data-theme="dark"] .slide-close { color: #64748b; }
[data-theme="dark"] .slide-close:hover { color: #f1f5f9; }
[data-theme="dark"] .dashboard-card,
[data-theme="dark"] .kpi-card { background: #1e293b; border-color: #334155; }
[data-theme="dark"] .auth-card {
    background: #1e293b;
    border-color: #334155;
}
[data-theme="dark"] .auth-card h2,
[data-theme="dark"] .auth-card .auth-subtitle { color: #f1f5f9; }
[data-theme="dark"] .auth-card input[type=text],
[data-theme="dark"] .auth-card input[type=email],
[data-theme="dark"] .auth-card input[type=password] {
    background: #273548;
    border-color: #334155;
    color: #e2e8f0;
}
[data-theme="dark"] .footer {
    background: #0f172a;
    border-top-color: #1e293b;
    color: #64748b;
}
[data-theme="dark"] .skeleton {
    background: linear-gradient(90deg, #1e293b 25%, #273548 50%, #1e293b 75%);
    background-size: 200% 100%;
}
[data-theme="dark"] .guest-banner {
    background: linear-gradient(90deg, #0d948820 0%, #0d948830 100%);
    border-bottom-color: #0d948860;
}

/* ===== Dark Mode: Dashboard inline-style overrides ===== */
[data-theme="dark"] .dash-page        { background: #0f172a; }
[data-theme="dark"] .dash-header h1   { color: #f1f5f9; }
[data-theme="dark"] .dash-meta        { color: #64748b; }
[data-theme="dark"] .sparkline-wrap   { background: #1e293b; border-color: #334155; }
[data-theme="dark"] .spark-label      { color: #64748b; }
[data-theme="dark"] .spark-count      { color: #94a3b8; }
[data-theme="dark"] .dash-section h2  { color: #e2e8f0; }
[data-theme="dark"] .dash-table th    { color: #64748b; border-bottom-color: #334155; }
[data-theme="dark"] .dash-table td    { border-bottom-color: #1e293b; color: #cbd5e1; }
[data-theme="dark"] .dash-footer      { border-top-color: #1e293b; color: #64748b; }
[data-theme="dark"] .error-card       { background: #2d1b1b; border-color: #7f1d1d; color: #fca5a5; }

/* ===== Dark Mode: Narrative & Index ===== */
[data-theme="dark"] .narrative-header { background: linear-gradient(135deg, #0c1a3a 0%, #111e40 100%); }
[data-theme="dark"] .narrative-story  { background: #111827; border-bottom-color: #1e293b; }
[data-theme="dark"] .performance-story-text { color: #cbd5e1; }
[data-theme="dark"] .performance-story-text strong { color: #93c5fd; }
[data-theme="dark"] .narrative-kpis   { background: #0f172a; }
[data-theme="dark"] .narrative-overview { background: #0f172a; }
[data-theme="dark"] .overview-card    { background: #1e293b; border-color: #334155; }
[data-theme="dark"] .overview-card h3 { color: #f1f5f9; }
[data-theme="dark"] .overview-card p  { color: #94a3b8; }
[data-theme="dark"] .overview-bar-track { background: #334155; }
[data-theme="dark"] .narrative-section { background: #0f172a; }
[data-theme="dark"] .narrative-section-alt { background: #0c1525; }
[data-theme="dark"] .narrative-section-header h2 { color: #f1f5f9; }
[data-theme="dark"] .narrative-chart-block { border-color: #334155; background: #1e293b; }
[data-theme="dark"] .narrative-chart-text h4 { color: #f1f5f9; }
[data-theme="dark"] .narrative-chart-text p  { color: #94a3b8; }
[data-theme="dark"] .narrative-takeaways { background: #0f172a; }
[data-theme="dark"] .takeaway-card    { background: #1e293b; border-color: #334155; }
[data-theme="dark"] .takeaway-card h4 { color: #f1f5f9; }
[data-theme="dark"] .takeaway-card p  { color: #94a3b8; }
[data-theme="dark"] .narrative-trend  { background: #273548; border-color: #334155; }
[data-theme="dark"] .hero             { background: linear-gradient(160deg, #0c1a3a 0%, #111e40 40%, #0f172a 100%); }
[data-theme="dark"] .hero h1          { color: #f1f5f9; }
[data-theme="dark"] .hero-sub         { color: #94a3b8; }
[data-theme="dark"] .hero-pill        { background: #1e293b; border-color: #334155; color: #94a3b8; }
[data-theme="dark"] .how-it-works     { background: #0f172a; }
[data-theme="dark"] .step-card        { background: #1e293b; border-color: #334155; }
[data-theme="dark"] .step-card h3     { color: #f1f5f9; }
[data-theme="dark"] .step-card p      { color: #94a3b8; }
[data-theme="dark"] .step-num         { background: var(--blue); color: #fff; }
[data-theme="dark"] .features-minimal { background: #0c1525; }
[data-theme="dark"] .feature-card-m   { background: #1e293b; border-color: #334155; }
[data-theme="dark"] .feature-card-m h3 { color: #f1f5f9; }
[data-theme="dark"] .feature-card-m p  { color: #94a3b8; }
[data-theme="dark"] .upload-section   { background: #0f172a; }
[data-theme="dark"] .upload-card      { background: #1e293b; border-color: #334155; }
[data-theme="dark"] .upload-card h2   { color: #f1f5f9; }
[data-theme="dark"] .dropzone         { background: #273548; border-color: #334155; color: #94a3b8; }
[data-theme="dark"] .dropzone.dragover { border-color: var(--blue); background: #1a3a5c; }
[data-theme="dark"] .bottom-cta       { background: linear-gradient(135deg, #1d4ed8 0%, #7c3aed 100%); }
[data-theme="dark"] .section-title    { color: #f1f5f9; }
[data-theme="dark"] .section-sub      { color: #94a3b8; }
[data-theme="dark"] .admin-page h1    { color: #f1f5f9; }
[data-theme="dark"] .admin-page .admin-sub { color: #64748b; }
[data-theme="dark"] .user-table th    { color: #64748b; border-bottom-color: #334155; background: #1e293b; }
[data-theme="dark"] .user-table td    { border-bottom-color: #1e293b; color: #cbd5e1; }
[data-theme="dark"] .user-table tr:hover td { background: #273548; }
[data-theme="dark"] .role-select      { background: #273548; border-color: #334155; color: #e2e8f0; }
[data-theme="dark"] .kpi-card         { background: #1e293b; border-color: #334155; }
[data-theme="dark"] .kpi-card .kpi-label { color: #64748b; }
[data-theme="dark"] .kpi-card .kpi-value { color: #f1f5f9; }
[data-theme="dark"] .kpi-card.good .kpi-value  { color: var(--green); }
[data-theme="dark"] .kpi-card.warn .kpi-value  { color: var(--amber); }
[data-theme="dark"] .kpi-card.danger .kpi-value { color: var(--red); }
[data-theme="dark"] .kpi-card.blue .kpi-value  { color: #60a5fa; }

/* ===== API Filter Bar (chart-engine) ===== */
.api-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: flex-end;
    padding: 8px 0 10px;
    border-bottom: 1px solid var(--gray-100);
    margin-bottom: 6px;
}
/* Zones group related filters with a subtle separator */
.fb-zone {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-end;
    padding-right: 10px;
}
.fb-zone + .fb-zone {
    border-left: 1.5px solid var(--gray-200);
    padding-left: 10px;
}
.fb-group { display: flex; flex-direction: column; gap: 2px; }
.fb-group label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.fb-group select {
    font-size: 0.82rem;
    padding: 4px 8px;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    background: #fff;
    color: var(--gray-800);
    min-width: 60px;
    max-width: 280px;
    cursor: pointer;
}
.fb-group select:focus { outline: 2px solid var(--blue); outline-offset: 1px; }
.fb-btn-group { flex-direction: row; align-items: center; gap: 0; }
.fb-btn-group label { margin-right: 6px; align-self: center; }
.fb-btn {
    font-size: 0.78rem;
    padding: 4px 10px;
    border: 1px solid var(--gray-200);
    background: #fff;
    color: var(--gray-600);
    cursor: pointer;
    transition: all 0.15s;
}
.fb-btn:first-of-type { border-radius: 6px 0 0 6px; }
.fb-btn:last-child { border-radius: 0 6px 6px 0; }
.fb-btn:not(:first-of-type) { border-left: none; }
.fb-btn.fb-active {
    background: var(--blue);
    color: #fff;
    border-color: var(--blue);
}
.fb-daterange {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
}
.fb-daterange input[type="date"] {
    font-size: 0.8rem;
    padding: 3px 6px;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
}
.fb-sep { font-size: 0.78rem; color: var(--gray-400); }

/* Interactive chart column */
.slide-interactive-col {
    display: flex;
    flex-direction: column;
}

/* Drilldown panel */
#chart-drilldown-panel {
    max-height: 200px;
    overflow-y: auto;
    border-top: 1px solid var(--gray-200);
    margin-top: 6px;
    font-size: 0.82rem;
}
.dd-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 8px;
    font-weight: 600;
    color: var(--gray-700);
    background: var(--gray-50);
    position: sticky;
    top: 0;
}
.dd-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--gray-400);
    line-height: 1;
}
.dd-close:hover { color: var(--gray-700); }
.dd-table-wrap { overflow-x: auto; }
.dd-pages { text-align: center; padding: 6px; color: var(--gray-500); font-size: 0.78rem; }
.dd-loading { padding: 16px; text-align: center; color: var(--gray-400); }
.dd-err { padding: 16px; text-align: center; color: var(--red); }

/* Chart data table (shared by drilldown + scorecard) */
.chart-table-wrap { overflow-x: auto; }
.chart-data-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.chart-data-table th {
    text-align: left;
    padding: 6px 10px;
    background: var(--gray-50);
    border-bottom: 2px solid var(--gray-200);
    font-weight: 600;
    color: var(--gray-700);
    white-space: nowrap;
}
.chart-data-table td {
    padding: 5px 10px;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
}
.chart-data-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.chart-data-table tr:hover { background: var(--gray-50); }
.chart-data-table .row-label { font-weight: 600; white-space: nowrap; }
.chart-data-table .top-row td { font-weight: 600; }
.chart-data-table .sla-ok { color: var(--green); font-size: 0.9em; }
.chart-data-table .sla-warn { color: var(--amber); font-size: 0.9em; }
.chart-data-table .sla-breach { color: var(--red); font-size: 0.9em; }
.chart-data-table .sla-target-row td {
    font-size: 0.72rem;
    color: var(--gray-400);
    font-style: italic;
    border-top: 2px solid var(--gray-200);
    padding-top: 6px;
}
.heatmap-table td.num { font-variant-numeric: tabular-nums; font-weight: 500; }

/* Dark mode overrides for filter bar + drilldown */
[data-theme="dark"] .api-filter-bar { border-color: #334155; }
[data-theme="dark"] .fb-zone + .fb-zone { border-color: #334155; }
[data-theme="dark"] .fb-group select { background: #1e293b; color: #e2e8f0; border-color: #334155; }
[data-theme="dark"] .fb-btn { background: #1e293b; color: #94a3b8; border-color: #334155; }
[data-theme="dark"] .fb-btn.fb-active { background: var(--blue); color: #fff; border-color: var(--blue); }
[data-theme="dark"] .fb-daterange input { background: #1e293b; color: #e2e8f0; border-color: #334155; }
[data-theme="dark"] #chart-drilldown-panel { border-color: #334155; }
[data-theme="dark"] .dd-header { background: #1e293b; color: #e2e8f0; }
[data-theme="dark"] .chart-data-table th { background: #1e293b; color: #e2e8f0; border-color: #334155; }
[data-theme="dark"] .chart-data-table td { color: #cbd5e1; border-color: #1e293b; }
[data-theme="dark"] .chart-data-table tr:hover { background: #334155; }

/* ===== KPI Summary Bar ===== */
.kpi-summary-bar {
    display: flex;
    gap: 10px;
    padding: 10px 0 12px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--gray-100);
    overflow-x: auto;
}
.kpi-stat-card {
    flex: 1;
    min-width: 120px;
    background: var(--gray-50);
    border: 1px solid var(--gray-100);
    border-radius: 10px;
    padding: 10px 14px;
    text-align: center;
}
.kpi-stat-value { font-size: 1.3rem; font-weight: 800; font-family: var(--font-display); line-height: 1.1; }
.kpi-stat-label { font-size: 0.65rem; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.4px; margin-top: 3px; }
.kpi-stat-delta { font-size: 0.7rem; font-weight: 600; margin-top: 3px; }
.kpi-stat-card.good .kpi-stat-value { color: var(--green); }
.kpi-stat-card.good .kpi-stat-delta { color: var(--green-dark); }
.kpi-stat-card.warning .kpi-stat-value { color: var(--amber); }
.kpi-stat-card.warning .kpi-stat-delta { color: var(--amber); }
.kpi-stat-card.critical .kpi-stat-value { color: var(--red); }
.kpi-stat-card.critical .kpi-stat-delta { color: var(--red); }
.kpi-stat-card.neutral .kpi-stat-value { color: var(--blue); }
.kpi-stat-card.neutral .kpi-stat-delta { color: var(--gray-500); }

/* ===== Trend Card ===== */
.trend-card {
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 10px;
    border: 1px solid var(--green);
    background: var(--green-light);
}
.trend-card.declining { border-color: var(--red); background: var(--red-light); }
.trend-card.stable { border-color: var(--gray-200); background: var(--gray-100); }
.trend-card-header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.trend-icon { font-size: 1.1rem; line-height: 1; }
.trend-card.improving .trend-icon { color: var(--green-dark); }
.trend-card.declining .trend-icon { color: var(--red); }
.trend-card.stable .trend-icon { color: var(--gray-500); }
.trend-label { font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; }
.trend-card.improving .trend-label { color: var(--green-dark); }
.trend-card.declining .trend-label { color: var(--red); }
.trend-card.stable .trend-label { color: var(--gray-600); }
.trend-desc { font-size: 0.82rem; line-height: 1.5; color: var(--gray-700); margin: 0; }

/* ===== Finding Cards (insight items) ===== */
.findings-block .insight-item {
    border-left: 3px solid var(--blue);
    border-radius: 0 8px 8px 0;
    background: var(--gray-50);
    padding: 8px 12px;
    margin-bottom: 6px;
    transition: border-left-color 0.15s, background 0.15s;
}
.findings-block .insight-item:hover { background: var(--blue-light); border-left-color: var(--blue-dark); }
.findings-block .insight-item.severity-high { border-left-color: var(--red); }
.findings-block .insight-item.severity-high:hover { background: var(--red-light); }
.findings-block .insight-item.severity-medium { border-left-color: var(--amber); }
.findings-block .insight-item.severity-medium:hover { background: var(--amber-light); }
.findings-block .insight-item.severity-low { border-left-color: var(--green); }
.findings-block .insight-item.severity-low:hover { background: var(--green-light); }

/* ===== Collapsible Description ===== */
.collapsible.collapsed .collapsible-content { display: none; }
.desc-toggle { cursor: pointer; user-select: none; }
.collapse-chevron { display: inline-block; font-size: 0.55rem; margin-left: 4px; transition: transform 0.2s; }
.collapsible.collapsed .collapse-chevron { transform: rotate(-90deg); }

/* ===== Filter Bar Enhancements ===== */
.fb-zone-label {
    font-size: 0.58rem;
    font-weight: 700;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    width: 100%;
    margin-bottom: 2px;
}
.fb-group select.fb-active-filter {
    border-color: var(--blue);
    box-shadow: inset 0 0 0 1px var(--blue);
}
.fb-reset-btn {
    font-size: 0.72rem;
    padding: 4px 10px;
    border: 1px solid var(--red-light);
    border-radius: 6px;
    background: var(--red-light);
    color: var(--red);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.15s;
    align-self: flex-end;
    white-space: nowrap;
}
.fb-reset-btn:hover { background: var(--red); color: #fff; border-color: var(--red); }

/* Link Filters toggle button */
.link-filters-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.78rem;
    padding: 4px 10px;
    border: 1.5px solid var(--gray-200);
    border-radius: 6px;
    background: #fff;
    color: var(--gray-500);
    cursor: pointer;
    transition: all 0.15s;
}
.link-filters-btn:hover { border-color: var(--blue); color: var(--blue); }
.link-filters-btn.active {
    background: var(--blue);
    color: #fff;
    border-color: var(--blue);
}
[data-theme="dark"] .link-filters-btn { background: #1e293b; border-color: #334155; color: #94a3b8; }

/* Dark mode: KPI bar */
[data-theme="dark"] .kpi-summary-bar { border-color: #334155; }
[data-theme="dark"] .kpi-stat-card { background: #273548; border-color: #334155; }
[data-theme="dark"] .kpi-stat-label { color: #64748b; }

/* Dark mode: Trend card */
[data-theme="dark"] .trend-card { background: #0f2a1a; border-color: #16a34a; }
[data-theme="dark"] .trend-card.declining { background: #2a0f0f; border-color: #dc2626; }
[data-theme="dark"] .trend-card.stable { background: #1e293b; border-color: #334155; }
[data-theme="dark"] .trend-desc { color: #cbd5e1; }

/* Dark mode: Finding cards */
[data-theme="dark"] .findings-block .insight-item { background: #273548; }
[data-theme="dark"] .findings-block .insight-item:hover { background: #1a3a5c; }

/* Dark mode: Filter enhancements */
[data-theme="dark"] .fb-zone-label { color: #475569; }
[data-theme="dark"] .fb-reset-btn { background: #2a0f0f; border-color: #7f1d1d; color: #fca5a5; }
[data-theme="dark"] .fb-reset-btn:hover { background: #dc2626; color: #fff; }
[data-theme="dark"] .link-filters-btn.active { background: var(--blue); color: #fff; border-color: var(--blue); }
