/* ==========================================================================
   Odoo Executive AI & BI Platform — Definitive Master Design System
   Linear + Apple Pro + Bloomberg Terminal Luxury Dark Theme
   ========================================================================== */

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

:root {
    /* ==========================================================================
       🎛️ GLASSMORPHISM & TRANSLUCENCY CONTROL PANEL (DARK MODE)
       Adjust opacities (0.0 to 1.0) & blur radius (px) here in one place!
       ========================================================================== */

    /* 1. Header / Top Navbar (Desktop & Mobile) */
    --navbar-glass-bg: rgba(8, 12, 22, 0.1);
    /* Lower = more transparent (e.g. 0.30 - 0.50) */
    --navbar-glass-blur: 18px;
    /* Frosted glass blur strength */
    --navbar-glass-saturate: 120%;
    /* Color saturation boost */
    --navbar-border: rgba(255, 255, 255, 0.08);
    /* Specular bottom border */

    /* 2. Mobile Bottom Navigation Bar */
    --mobile-nav-glass-bg: rgba(8, 12, 22, 0.1);
    /* Lower = more transparent */
    --mobile-nav-glass-blur: 18px;
    --mobile-nav-glass-saturate: 120%;
    --mobile-nav-border: rgba(255, 255, 255, 0.08);

    /* 3. Dynamic Island Floating Pill */
    --island-pill-glass-bg: rgba(8, 12, 24, 0.1);
    /* Lower = more transparent */
    --island-pill-glass-blur: 18px;
    --island-pill-glass-saturate: 120%;

    /* 4. Chat UI & Dynamic Island Drawer */
    --island-drawer-glass-bg: rgba(8, 12, 24, 0.1);
    /* Lower = more transparent */
    --island-drawer-glass-blur: 18px;
    --island-drawer-glass-saturate: 120%;
    --island-drawer-header-bg: rgba(8, 12, 24, 0.1);
    --island-input-bar-bg: rgba(8, 12, 24, 0.1);

    /* Obsidian & Midnight Velvet Surface System */
    --bg-base: #06080e;
    --bg-surface: #0b101b;
    --bg-surface-raised: #111827;
    --bg-glass: var(--navbar-glass-bg);
    --bg-glass-strong: var(--island-drawer-glass-bg);
    --bg-glass-card: rgba(13, 19, 36, 0.55);
    --bg-glass-hover: rgba(30, 41, 59, 0.60);
    --hero-text-gradient: linear-gradient(180deg, #ffffff 0%, #cbd5e1 65%, #94a3b8 100%);

    /* Precision Borders & Highlights */
    --border-subtle: rgba(255, 255, 255, 0.09);
    --border-medium: rgba(255, 255, 255, 0.16);
    --border-highlight: rgba(59, 130, 246, 0.5);
    --border-glow: rgba(14, 165, 233, 0.55);

    /* Executive Semantic Accent Colors */
    --accent-primary: #2563eb;
    /* Royal Sapphire */
    --accent-primary-hover: #3b82f6;
    --accent-cyan: #0ea5e9;
    /* Ice Cyan */
    --accent-indigo: #6366f1;
    /* Refined Indigo */
    --accent-emerald: #10b981;
    /* Growth Emerald */
    --accent-amber: #f59e0b;
    /* Caution Amber */
    --accent-rose: #f43f5e;
    /* Risk Crimson */
    --accent-purple: #a855f7;
    /* Sovereign Violet */

    /* Typography System */
    --font-sans: 'Plus Jakarta Sans', 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-display: 'Outfit', 'Plus Jakarta Sans', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* Text Hierarchy */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-dim: #475569;

    /* Depth, Radii & Shadows */
    --shadow-glass: 0 20px 50px rgba(0, 0, 0, 0.55);
    --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.6);
    --shadow-glow-blue: 0 0 35px rgba(37, 99, 235, 0.25);
    --shadow-glow-cyan: 0 0 35px rgba(14, 165, 233, 0.22);
    --shadow-glow-emerald: 0 0 35px rgba(16, 185, 129, 0.2);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    --transition-fast: all 0.15s ease;
    --transition-smooth: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    --transition-bounce: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ==========================================================================
   🎛️ GLASSMORPHISM & TRANSLUCENCY CONTROL PANEL (LIGHT MODE)
   Adjust opacities & blur radius for Light Mode here in one place!
   ========================================================================== */
[data-theme="light"] {
    /* 1. Header / Top Navbar (Desktop & Mobile) */
    --navbar-glass-bg: rgba(255, 255, 255, 0.1);
    /* Lower = more transparent (e.g. 0.35 - 0.55) */
    --navbar-glass-blur: 18px;
    --navbar-glass-saturate: 120%;
    --navbar-border: rgba(203, 213, 225, 0.6);

    /* 2. Mobile Bottom Navigation Bar */
    --mobile-nav-glass-bg: rgba(255, 255, 255, 0.1);
    --mobile-nav-glass-blur: 18px;
    --mobile-nav-glass-saturate: 120%;
    --mobile-nav-border: rgba(203, 213, 225, 0.6);

    /* 3. Dynamic Island Floating Pill */
    --island-pill-glass-bg: rgba(255, 255, 255, 0.1);
    --island-pill-glass-blur: 18px;
    --island-pill-glass-saturate: 120%;

    /* 4. Chat UI & Dynamic Island Drawer */
    --island-drawer-glass-bg: rgba(255, 255, 255, 0.1);
    --island-drawer-glass-blur: 18px;
    --island-drawer-glass-saturate: 120%;
    --island-drawer-header-bg: rgba(255, 255, 255, 0.1);
    --island-input-bar-bg: rgba(248, 250, 252, 0.1);

    --bg-base: #f8fafc;
    --bg-surface: #ffffff;
    --bg-surface-raised: #f1f5f9;
    --bg-glass: var(--navbar-glass-bg);
    --bg-glass-strong: var(--island-drawer-glass-bg);
    --bg-glass-card: rgba(255, 255, 255, 0.65);
    --bg-glass-hover: rgba(241, 245, 249, 0.70);
    --hero-text-gradient: linear-gradient(180deg, #0f172a 0%, #1e293b 65%, #334155 100%);

    --border-subtle: rgba(203, 213, 225, 0.7);
    --border-medium: rgba(203, 213, 225, 0.9);
    --border-highlight: rgba(37, 99, 235, 0.55);
    --border-glow: rgba(14, 165, 233, 0.4);

    --accent-primary: #2563eb;
    --accent-primary-hover: #1d4ed8;
    --accent-cyan: #0284c7;
    --accent-indigo: #4f46e5;
    --accent-emerald: #059669;
    --accent-amber: #d97706;
    --accent-rose: #e11d48;
    --accent-purple: #9333ea;

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --text-dim: #94a3b8;

    --shadow-glass: 0 20px 45px rgba(15, 23, 42, 0.08);
    --shadow-card: 0 4px 20px -2px rgba(15, 23, 42, 0.07), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
    --shadow-glow-blue: 0 0 25px rgba(37, 99, 235, 0.12);
    --shadow-glow-cyan: 0 0 25px rgba(14, 165, 233, 0.12);
    --shadow-glow-emerald: 0 0 25px rgba(5, 150, 105, 0.12);
}

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

html,
body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    min-height: 100%;
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 14.5px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.25s ease, color 0.25s ease;
}

body {
    background-image:
        radial-gradient(ellipse 90% 60% at 50% -10%, rgba(37, 99, 235, 0.12), transparent 75%),
        radial-gradient(circle 45% at 90% 15%, rgba(14, 165, 233, 0.08), transparent 70%),
        radial-gradient(circle 40% at 10% 85%, rgba(99, 102, 241, 0.06), transparent 70%);
    background-attachment: fixed;
}

[data-theme="light"] body {
    background-image:
        radial-gradient(ellipse 90% 60% at 50% -10%, rgba(37, 99, 235, 0.06), transparent 75%),
        radial-gradient(circle 45% at 90% 15%, rgba(14, 165, 233, 0.04), transparent 70%),
        radial-gradient(circle 40% at 10% 85%, rgba(99, 102, 241, 0.03), transparent 70%);
}

/* Custom Luxury Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(6, 8, 14, 0.5);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.16);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.28);
}

/* --------------------------------------------------------------------------
   Universal Animation & Spin Keyframes
   -------------------------------------------------------------------------- */
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

svg[style*="animation: spin"],
svg[style*="spin"],
.spin,
.spinner,
.loader-spinner {
    transform-origin: center center;
    animation: spin 0.85s linear infinite !important;
}

/* --------------------------------------------------------------------------
   Buttons & Micro-Components
   -------------------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition-smooth);
    text-decoration: none;
    white-space: nowrap;
    user-select: none;
}

.btn-sm {
    padding: 0.38rem 0.8rem;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: 0.85rem 1.75rem;
    font-size: 1rem;
    border-radius: var(--radius-lg);
}

.btn-primary {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.18);
    box-shadow: 0 4px 18px rgba(37, 99, 235, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    box-shadow: 0 6px 24px rgba(37, 99, 235, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.35);
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border-color: var(--border-subtle);
    backdrop-filter: blur(10px);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.09);
    border-color: var(--border-medium);
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border-subtle);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    border-color: var(--border-medium);
}

/* Badges & Tags */
.badge-pill,
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.65rem;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.badge-emerald {
    background: rgba(16, 185, 129, 0.12);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.28);
}

.badge-blue,
.badge-indigo {
    background: rgba(37, 99, 235, 0.12);
    color: #60a5fa;
    border: 1px solid rgba(37, 99, 235, 0.28);
}

.badge-cyan {
    background: rgba(14, 165, 233, 0.12);
    color: #38bdf8;
    border: 1px solid rgba(14, 165, 233, 0.28);
}

.badge-rose {
    background: rgba(244, 63, 94, 0.12);
    color: #fb7185;
    border: 1px solid rgba(244, 63, 94, 0.28);
}

.badge-purple {
    background: rgba(168, 85, 247, 0.12);
    color: #c084fc;
    border: 1px solid rgba(168, 85, 247, 0.28);
}

/* --------------------------------------------------------------------------
   1. Public Landing Page Styles
   -------------------------------------------------------------------------- */
.landing-container,
#landing-page-view {
    display: block;
    width: 100%;
}

.landing-nav {
    position: sticky;
    top: 0;
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 3rem;
    background: var(--navbar-glass-bg) !important;
    backdrop-filter: blur(var(--navbar-glass-blur)) saturate(var(--navbar-glass-saturate)) !important;
    -webkit-backdrop-filter: blur(var(--navbar-glass-blur)) saturate(var(--navbar-glass-saturate)) !important;
    border-bottom: 1px solid var(--navbar-border);
}

.nav-links-center {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-link-item {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 500;
    transition: var(--transition-fast);
}

.nav-link-item:hover {
    color: var(--text-primary);
}

@media (max-width: 768px) {
    .landing-nav {
        padding: 0.75rem 1.25rem !important;
    }
    .nav-links-center {
        display: none !important;
    }
}

.hero-section {
    padding: 4.5rem 2rem 4rem 2rem;
    max-width: 1240px;
    margin: 0 auto;
}

.hero-content-wrapper {
    display: grid;
    grid-template-columns: 1.15fr 0.95fr;
    gap: 3.5rem;
    align-items: center;
    text-align: left;
}

.hero-text-col {
    display: flex;
    flex-direction: column;
}

.hero-headline {
    font-family: var(--font-display);
    font-size: 3.4rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1.15;
    margin: 1.25rem 0 1.15rem 0;
    background: var(--hero-text-gradient, linear-gradient(180deg, #ffffff 0%, #cbd5e1 65%, #94a3b8 100%));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subhead {
    font-size: 1.12rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin-bottom: 2rem;
    line-height: 1.65;
}

.hero-cta-group {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 1rem;
    margin-bottom: 2.5rem;
    flex-wrap: wrap;
}

.trust-strip {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 1.5rem;
    padding: 0.9rem 1.4rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    max-width: fit-content;
}

.trust-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Floating SVG Graphic Showcase */
.hero-graphic-col {
    display: flex;
    justify-content: center;
    position: relative;
}

.hero-animation-card {
    position: relative;
    width: 100%;
    max-width: 480px;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(28px) saturate(180%);
    -webkit-backdrop-filter: blur(28px) saturate(180%);
    border: 1px solid rgba(59, 130, 246, 0.25);
    border-radius: var(--radius-2xl);
    padding: 2.2rem;
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.6), 0 0 50px rgba(37, 99, 235, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

[data-theme="light"] .hero-animation-card {
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(37, 99, 235, 0.2);
    box-shadow: 0 20px 45px rgba(37, 99, 235, 0.12);
}

.hero-animation-glow {
    position: absolute;
    width: 260px;
    height: 260px;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.35) 0%, rgba(14, 165, 233, 0) 70%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    pointer-events: none;
    filter: blur(40px);
}

.hero-svg-illustration {
    width: 100%;
    height: auto;
    max-height: 340px;
    display: block;
    position: relative;
    z-index: 2;
    filter: drop-shadow(0 15px 30px rgba(0, 0, 0, 0.3));
}

.hero-floating-badge {
    position: absolute;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.55rem 0.95rem;
    background: rgba(11, 16, 27, 0.88);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(59, 130, 246, 0.35);
    border-radius: var(--radius-full);
    color: #f8fafc;
    font-size: 0.78rem;
    font-weight: 600;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
    animation: floatBadge 4s ease-in-out infinite;
}

[data-theme="light"] .hero-floating-badge {
    background: rgba(255, 255, 255, 0.92);
    color: #0f172a;
    border-color: rgba(37, 99, 235, 0.3);
    box-shadow: 0 10px 25px rgba(37, 99, 235, 0.15);
}

.hero-floating-badge.badge-top-right {
    top: 1.2rem;
    right: 1.2rem;
    animation-delay: 0s;
}

.hero-floating-badge.badge-bottom-left {
    bottom: 1.2rem;
    left: 1.2rem;
    animation-delay: 2s;
}

.badge-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.badge-dot.pulse-green {
    background: #10b981;
    box-shadow: 0 0 10px #10b981;
}

@keyframes floatBadge {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-6px); }
}

/* Tablet & Mobile Hero Breakpoints */
@media (max-width: 980px) {
    .hero-content-wrapper {
        grid-template-columns: 1fr !important;
        text-align: center !important;
        gap: 2.5rem !important;
    }
    .hero-text-col {
        align-items: center !important;
    }
    .hero-cta-group,
    .trust-strip {
        justify-content: center !important;
    }
}

@media (max-width: 640px) {
    .hero-section {
        padding: 2.5rem 1rem 2rem 1rem !important;
        text-align: center !important;
    }
    .hero-headline {
        font-size: 2.1rem !important;
        line-height: 1.2 !important;
        margin: 1rem auto 0.85rem auto !important;
        text-align: center !important;
    }
    .hero-subhead {
        font-size: 0.95rem !important;
        margin: 0 auto 1.5rem auto !important;
        text-align: center !important;
    }
    .hero-badge {
        margin: 0 auto !important;
    }
    .hero-cta-group {
        flex-direction: column !important;
        width: 100% !important;
        gap: 0.75rem !important;
        margin: 0 auto 2rem auto !important;
    }
    .hero-cta-group .btn {
        width: 100% !important;
        justify-content: center !important;
    }
    .trust-strip {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 auto !important;
        padding: 0.75rem 1rem !important;
        gap: 0.75rem !important;
        justify-content: center !important;
    }
    .trust-item {
        font-size: 0.78rem !important;
    }
    .hero-animation-card {
        padding: 1.25rem !important;
        max-width: 100% !important;
        border-radius: var(--radius-xl) !important;
    }
    .hero-svg-illustration {
        max-height: 220px !important;
    }
    .hero-floating-badge {
        font-size: 0.68rem !important;
        padding: 0.35rem 0.65rem !important;
    }
    .hero-floating-badge.badge-top-right {
        top: 0.5rem !important;
        right: 0.5rem !important;
    }
    .hero-floating-badge.badge-bottom-left {
        bottom: 0.5rem !important;
        left: 0.5rem !important;
    }
}

/* ====================================================================
   SHOWCASE BANNER SECTIONS (For all 3 SVGs)
   ==================================================================== */
.showcase-banner-section {
    padding: 4rem 2rem;
    max-width: 1240px;
    margin: 0 auto;
}

.showcase-banner-grid {
    display: grid;
    grid-template-columns: 1fr 1.15fr;
    gap: 3.5rem;
    align-items: center;
    background: var(--bg-surface-glass);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-2xl);
    padding: 3rem;
    box-shadow: var(--shadow-glass);
}

.showcase-banner-grid.reverse-layout {
    grid-template-columns: 1.15fr 1fr;
}

.showcase-banner-graphic {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.showcase-banner-graphic img {
    width: 100%;
    height: auto;
    max-height: 340px;
    filter: drop-shadow(0 15px 35px rgba(37, 99, 235, 0.22));
    display: block;
}

.showcase-banner-text {
    display: flex;
    flex-direction: column;
}

.showcase-banner-title {
    font-size: 1.95rem;
    font-weight: 800;
    margin: 0.85rem 0 1rem 0;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    line-height: 1.25;
}

.showcase-banner-desc {
    color: var(--text-secondary);
    line-height: 1.7;
    font-size: 1.02rem;
    margin-bottom: 1.5rem;
}

.showcase-points-list {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.showcase-point-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    color: var(--text-primary);
    font-size: 0.94rem;
}

.showcase-point-check {
    color: var(--accent-emerald);
    font-weight: 800;
    font-size: 1.05rem;
}

@media (max-width: 900px) {
    .showcase-banner-section {
        padding: 2.5rem 1rem !important;
    }
    .showcase-banner-grid,
    .showcase-banner-grid.reverse-layout {
        grid-template-columns: 1fr !important;
        gap: 2rem !important;
        padding: 1.5rem !important;
    }
    .showcase-banner-graphic {
        order: -1 !important; /* Graphic renders above text on mobile */
    }
    .showcase-banner-graphic img {
        max-height: 230px !important;
    }
    .showcase-banner-title {
        font-size: 1.5rem !important;
    }
    .showcase-banner-desc {
        font-size: 0.92rem !important;
    }
}

/* ROI Calculator Section */
.roi-calculator-section {
    padding: 5rem 2rem;
    background: rgba(255, 255, 255, 0.015);
    border-top: 1px solid var(--border-subtle);
    border-bottom: 1px solid var(--border-subtle);
}

.section-container {
    max-width: 1200px;
    margin: 0 auto;
}

.section-header {
    text-align: center;
    margin-bottom: 3rem;
}

.section-title {
    font-family: var(--font-display);
    font-size: 2.25rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.section-subtitle {
    color: var(--text-secondary);
    font-size: 1.05rem;
    margin-top: 0.5rem;
}

.roi-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: center;
}

@media (max-width: 900px) {
    .roi-grid {
        grid-template-columns: 1fr;
    }
}

.calculator-card {
    background: var(--bg-glass-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 2.5rem;
}

.slider-group {
    margin-bottom: 1.8rem;
}

.slider-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.65rem;
    font-size: 0.92rem;
    font-weight: 600;
}

.range-slider {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-full);
    outline: none;
    accent-color: var(--accent-primary);
    cursor: pointer;
}

.roi-results-card {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.12) 0%, rgba(14, 165, 233, 0.08) 100%);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(59, 130, 246, 0.35);
    border-radius: var(--radius-xl);
    padding: 3rem;
    text-align: center;
    box-shadow: var(--shadow-glow-blue);
}

.roi-savings-amount {
    font-family: var(--font-mono);
    font-size: 3.5rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 1rem 0;
    letter-spacing: -0.04em;
}

/* Features Grid */
.features-section,
.pricing-section,
.faq-section {
    padding: 5rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.features-grid,
.pricing-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

@media (max-width: 900px) {

    .features-grid,
    .pricing-grid {
        grid-template-columns: 1fr;
    }
}

.feature-card,
.pricing-card {
    background: var(--bg-glass-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 2rem;
    transition: var(--transition-smooth);
}

.feature-card:hover,
.pricing-card:hover {
    border-color: var(--border-highlight);
    transform: translateY(-3px);
    box-shadow: var(--shadow-card);
}

.pricing-card.featured {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow-blue);
}

.pricing-single-wrapper {
    max-width: 860px;
    margin: 0 auto;
    width: 100%;
}

.single-plan-card {
    padding: 2.75rem 2.5rem;
    text-align: center;
    border-radius: var(--radius-xl);
}

.plan-name {
    font-size: 1.85rem;
    font-weight: 800;
    margin-top: 0.6rem;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.plan-desc {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: 0.4rem;
    max-width: 580px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.5;
}

.plan-price {
    font-size: 3.4rem;
    font-family: var(--font-mono);
    font-weight: 800;
    margin: 1.25rem 0 0.25rem 0;
    color: var(--text-primary);
    letter-spacing: -0.03em;
}

.plan-period {
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.plan-onboarding-note {
    color: var(--text-muted);
    font-size: 0.88rem;
    margin-bottom: 2.25rem;
}

.pricing-features-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.1rem 2rem;
    text-align: left;
    margin-bottom: 2.5rem;
}

@media (max-width: 640px) {
    .pricing-features-grid {
        grid-template-columns: 1fr;
    }
}

.pricing-feature-item {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    font-size: 0.94rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.pricing-feature-item .feature-check {
    color: var(--accent-emerald);
    font-weight: 800;
    font-size: 1.05rem;
    flex-shrink: 0;
    margin-top: 1px;
}

.pricing-cta-box {
    max-width: 480px;
    margin: 0 auto;
}

.pricing-cta-btn {
    width: 100%;
    font-size: 1.08rem;
}

.pricing-guarantee-note {
    color: var(--text-muted);
    font-size: 0.82rem;
    margin-top: 0.75rem;
}

.landing-nav-actions {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.launch-btn-short {
    display: none;
}

.launch-btn-full {
    display: inline;
}

.pricing-tier-name {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
}

.pricing-price {
    font-family: var(--font-mono);
    font-size: 2.2rem;
    font-weight: 800;
    margin: 0.75rem 0 1.25rem 0;
    color: var(--text-primary);
}

.pricing-features-list {
    list-style: none;
    margin-bottom: 2rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.pricing-features-list li {
    margin-bottom: 0.65rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pricing-features-list li span {
    color: var(--accent-emerald);
    font-weight: 700;
}

.faq-list {
    max-width: 800px;
    margin: 0 auto;
}

.faq-item {
    background: var(--bg-glass-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    padding: 1.25rem 1.5rem;
}

.faq-question {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
}

.faq-answer {
    margin-top: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.92rem;
}

.landing-footer {
    text-align: center;
    padding: 3rem 1.5rem;
    border-top: 1px solid var(--border-subtle);
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* --------------------------------------------------------------------------
   2. Main Workspace Layout & Top Navbar (.navbar)
   -------------------------------------------------------------------------- */
#landing-page-view {
    display: block;
    width: 100%;
}

#workspace-view {
    display: none;
    flex-direction: column;
    min-height: 100vh;
}

#workspace-view.active {
    display: flex;
}

/* Zero-Flash Session State (Instant restore on page reload) */
html.pre-auth-session #landing-page-view {
    display: none !important;
}

html.pre-auth-session #workspace-view {
    display: flex !important;
}

/* The Top Navbar in Workspace View */
.navbar {
    position: sticky !important;
    top: 0 !important;
    z-index: 500 !important;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 2rem;
    background: var(--navbar-glass-bg) !important;
    backdrop-filter: blur(var(--navbar-glass-blur)) saturate(var(--navbar-glass-saturate)) !important;
    -webkit-backdrop-filter: blur(var(--navbar-glass-blur)) saturate(var(--navbar-glass-saturate)) !important;
    border-bottom: 1px solid var(--navbar-border);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.08);
}

.brand-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
}

.brand-logo {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    filter: drop-shadow(0 4px 14px rgba(168, 85, 247, 0.4));
    transition: var(--transition-fast);
}

.brand-logo:hover {
    transform: scale(1.06);
}

.brand-logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: var(--radius-sm);
    display: block;
}

.brand-title {
    font-family: var(--font-display);
    font-size: 1.12rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    white-space: nowrap;
}

.brand-badge {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 800;
    background: rgba(37, 99, 235, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.35);
    padding: 0.15rem 0.45rem;
    border-radius: var(--radius-sm);
    color: var(--accent-primary);
    white-space: nowrap;
    display: inline-block;
    letter-spacing: 0.05em;
}

/* Mobile Bottom Nav Hidden by default on Desktop */
.mobile-bottom-nav {
    display: none;
}

/* Nav Tabs (Desktop) */
.nav-tabs {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    background: var(--bg-surface-raised);
    padding: 0.25rem 0.35rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}

.nav-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.95rem;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
}

.tab-btn-admin {
    display: none !important;
}

.tab-btn-admin.admin-visible {
    display: inline-flex !important;
}

.nav-tab-btn:hover {
    color: var(--text-primary);
    background: var(--bg-glass-hover);
}

.nav-tab-btn.active {
    background: var(--accent-primary) !important;
    color: #ffffff !important;
    border: 1px solid var(--accent-primary) !important;
    box-shadow: 0 2px 10px rgba(37, 99, 235, 0.3);
}

.nav-tab-btn.active svg {
    stroke: #ffffff !important;
}

/* Workspace Header Actions */
.workspace-header-actions {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

/* Theme Toggle Button */
.theme-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: var(--radius-full);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 1rem;
    transition: var(--transition-smooth);
    box-shadow: var(--shadow-card);
}

.theme-toggle-btn:hover {
    border-color: var(--accent-cyan);
    transform: rotate(15deg) scale(1.05);
    background: var(--bg-surface-raised);
}

/* Currency Picker Pill */
.currency-picker-pill {
    padding: 0.35rem 0.65rem;
    background: var(--bg-surface);
    color: var(--accent-cyan);
    font-weight: 700;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    cursor: pointer;
    outline: none;
    transition: var(--transition-fast);
}

.currency-picker-pill:hover {
    border-color: var(--border-medium);
}

/* Tenant Status Pill */
.tenant-status-pill {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.8rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    color: var(--text-primary);
}

.tenant-name-text {
    font-weight: 600;
}

.tenant-db-text {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    background: var(--accent-emerald);
    box-shadow: 0 0 10px var(--accent-emerald);
    flex-shrink: 0;
}

.status-dot.offline {
    background: var(--accent-rose);
    box-shadow: 0 0 10px var(--accent-rose);
}

/* Sign Out Button */
.signout-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border-color: rgba(239, 68, 68, 0.35) !important;
    color: #fca5a5 !important;
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

.signout-btn:hover {
    background: rgba(239, 68, 68, 0.15) !important;
    border-color: rgba(239, 68, 68, 0.6) !important;
    color: #ffffff !important;
}

/* --------------------------------------------------------------------------
   3. Workspace Views & Hubs
   -------------------------------------------------------------------------- */
.main-content {
    flex: 1;
    padding: 2rem 2.5rem 8rem 2.5rem;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
}

.hub-view {
    display: none;
    animation: fadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.hub-view.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hub-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.75rem;
    gap: 1rem;
}

@media (max-width: 640px) {
    .hub-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.85rem;
        margin-bottom: 1.25rem;
    }

    .hub-title-group h1 {
        font-size: 1.5rem !important;
    }

    .hub-header .hub-actions {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .hub-header .hub-actions .btn {
        flex: 1;
        justify-content: center;
    }
}

.hub-title-group h1 {
    font-family: var(--font-display);
    font-size: 1.85rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text-primary);
}

.hub-title-group p {
    color: var(--text-secondary);
    font-size: 0.92rem;
    margin-top: 0.2rem;
}

/* --------------------------------------------------------------------------
   HUB 1: BI Dashboards Hub
   -------------------------------------------------------------------------- */
.dashboard-controls-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-glass-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 0.65rem 1.1rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-card);
}

.period-filter-group {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    background: var(--bg-surface-raised);
    padding: 0.2rem 0.3rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}

.period-pill {
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-sm);
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
}

.period-pill:hover {
    color: var(--text-primary);
}

.period-pill.active {
    background: var(--accent-primary);
    color: #ffffff !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.dash-tabs {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    overflow-x: auto;
}

.dash-pill {
    padding: 0.45rem 1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    white-space: nowrap;
}

.dash-pill:hover {
    background: var(--bg-surface-raised);
    color: var(--text-primary);
}

.dash-pill.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: #ffffff !important;
    box-shadow: 0 2px 12px rgba(37, 99, 235, 0.25);
}

.widgets-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 1.25rem;
}

.col-12 {
    grid-column: span 12;
}

.col-8 {
    grid-column: span 8;
}

.col-7 {
    grid-column: span 7;
}

.col-6 {
    grid-column: span 6;
}

.col-5 {
    grid-column: span 5;
}

.col-4 {
    grid-column: span 4;
}

.col-3 {
    grid-column: span 3;
}

@media (max-width: 1200px) {
    .col-3 {
        grid-column: span 6;
    }

    .col-7 {
        grid-column: span 12;
    }

    .col-5 {
        grid-column: span 12;
    }
}

@media (max-width: 900px) {

    .col-8,
    .col-6,
    .col-4,
    .col-3 {
        grid-column: span 12;
    }
}

.widget-card {
    background: var(--bg-glass-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.4rem;
    transition: var(--transition-smooth);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-card);
}

.widget-card:hover {
    border-color: rgba(59, 130, 246, 0.35);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow-blue), var(--shadow-card);
}

.widget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.85rem;
}

.widget-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

/* KPI Cards 2.0 */
.kpi-card-v2 {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.kpi-metric-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    margin: 0.5rem 0 0.4rem 0;
}

.kpi-value {
    font-family: var(--font-mono);
    font-size: 1.7rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text-primary);
    font-feature-settings: "tnum" 1, "zero" 1;
    line-height: 1.2;
    word-break: break-word;
}

.kpi-delta-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.55rem;
    border-radius: var(--radius-full);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
    align-self: center;
    line-height: 1.2;
}

.kpi-delta-up {
    background: rgba(16, 185, 129, 0.14);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.kpi-delta-down {
    background: rgba(244, 63, 94, 0.14);
    color: #f43f5e;
    border: 1px solid rgba(244, 63, 94, 0.3);
}

.kpi-context-text {
    font-size: 0.76rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
}

.kpi-spark-bar {
    width: 100%;
    height: 3px;
    background: var(--border-subtle);
    border-radius: var(--radius-full);
    margin-top: 0.75rem;
    overflow: hidden;
}

.kpi-spark-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-cyan));
    border-radius: var(--radius-full);
}

.chart-container {
    position: relative;
    width: 100%;
    min-height: 260px;
    max-height: 320px;
    flex: 1;
}

/* Luxury Executive Widget Table */
.widget-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.85rem;
    color: var(--text-primary);
    margin-top: 0.5rem;
}

.widget-table th {
    background: var(--bg-surface-raised);
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-subtle);
    white-space: nowrap;
    text-align: left;
}

.widget-table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: middle;
    white-space: nowrap;
    color: var(--text-primary);
    transition: var(--transition-fast);
}

.widget-table tbody tr:hover td {
    background: var(--bg-glass-hover);
}

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

.badge-status-unpaid {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.55rem;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-status-paid {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.55rem;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

/* --------------------------------------------------------------------------
   HUB 2: Executive Reports Library
   -------------------------------------------------------------------------- */
.reports-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 1.75rem;
    align-items: start;
    width: 100%;
}

.reports-layout.empty-layout {
    display: block !important;
    width: 100% !important;
    max-width: 820px;
    margin: 0 auto;
}

.reports-layout.empty-layout .reports-sidebar {
    display: none !important;
}

.reports-layout.empty-layout .report-viewer-card {
    width: 100% !important;
    min-height: auto;
    padding: 3rem 2rem;
}

@media (max-width: 960px) {
    .reports-layout {
        display: flex;
        flex-direction: column;
        gap: 1.25rem;
    }
}

.reports-sidebar {
    background: var(--bg-glass-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 1.15rem;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

@media (max-width: 960px) {
    .reports-sidebar {
        max-height: 240px;
        width: 100%;
    }
}

.report-item-card {
    padding: 0.95rem 1.15rem;
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    cursor: pointer;
    transition: var(--transition-smooth);
    position: relative;
}

.report-item-card:hover {
    background: var(--bg-glass-hover);
    border-color: var(--border-medium);
    transform: translateX(3px);
}

.report-item-card.active {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.16) 0%, rgba(99, 102, 241, 0.1) 100%);
    border-color: var(--accent-primary);
    box-shadow: 0 0 16px rgba(37, 99, 235, 0.18);
}

.report-item-card.active h4 {
    color: var(--accent-cyan) !important;
}

.report-viewer-card {
    background: var(--bg-glass-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    min-height: 75vh;
    box-shadow: var(--shadow-card);
    position: relative;
}

@media (max-width: 640px) {
    .report-viewer-card {
        padding: 1.25rem;
        border-radius: var(--radius-lg);
        min-height: auto;
    }
}

.report-viewer-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 1rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.report-viewer-header h2 {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0;
}

.report-viewer-header span {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-muted);
}

.reports-empty-state-card {
    text-align: center;
    padding: 3.5rem 1.5rem;
    color: var(--text-muted);
}

.reports-empty-state-card .empty-state-icon {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    filter: drop-shadow(0 6px 16px rgba(99, 102, 241, 0.3));
}

.reports-empty-state-card h3 {
    color: var(--text-primary);
    font-size: 1.3rem;
    font-weight: 700;
}

.reports-empty-state-card p {
    margin-top: 0.6rem;
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
    font-size: 0.92rem;
    line-height: 1.65;
    color: var(--text-secondary);
}

/* Report Viewer Markdown Body Typography & Layout */
.report-markdown-body {
    color: var(--text-secondary);
    font-size: 0.96rem;
    line-height: 1.8;
    word-break: break-word;
}

.report-markdown-body h1,
.report-markdown-body h2,
.report-markdown-body h3,
.report-markdown-body h4 {
    color: var(--text-primary);
    font-family: var(--font-display);
    margin-top: 1.75rem;
    margin-bottom: 0.75rem;
    line-height: 1.35;
}

.report-markdown-body h1 {
    font-size: 1.55rem;
    font-weight: 800;
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.report-markdown-body h2 {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.report-markdown-body h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent-cyan);
}

.report-markdown-body p {
    margin-bottom: 1.1rem;
}

.report-markdown-body strong {
    color: var(--text-primary);
    font-weight: 700;
}

.report-markdown-body ul,
.report-markdown-body ol {
    margin: 0.75rem 0 1.25rem 1.4rem;
    padding-left: 0.5rem;
}

.report-markdown-body li {
    margin-bottom: 0.45rem;
    line-height: 1.65;
}

.report-markdown-body hr {
    border: none;
    height: 1px;
    background: var(--border-subtle);
    margin: 2rem 0;
}

.report-markdown-body blockquote {
    border-left: 3px solid var(--accent-primary);
    background: rgba(37, 99, 235, 0.08);
    padding: 0.85rem 1.25rem;
    margin: 1.25rem 0;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    font-style: italic;
    color: var(--text-primary);
}

.report-markdown-body code {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-subtle);
    padding: 0.15rem 0.45rem;
    border-radius: var(--radius-sm);
    color: var(--accent-cyan);
}

.report-markdown-body pre {
    background: var(--bg-surface-raised);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    overflow-x: auto;
    margin: 1.25rem 0;
}

.report-markdown-body pre code {
    background: transparent;
    border: none;
    padding: 0;
}

/* Responsive Table Wrapper & Executive Table Styling */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 1.5rem 0;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    background: var(--bg-surface);
}

.report-markdown-body table,
.report-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    color: var(--text-primary);
    text-align: left;
}

.report-markdown-body th,
.report-table th {
    background: var(--bg-surface-raised);
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    padding: 0.85rem 1.1rem;
    border-bottom: 1px solid var(--border-medium);
    white-space: nowrap;
}

.report-markdown-body td,
.report-table td {
    padding: 0.85rem 1.1rem;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-primary);
    white-space: nowrap;
}

.report-markdown-body tr:last-child td,
.report-table tr:last-child td {
    border-bottom: none;
}

.report-markdown-body tr:hover td,
.report-table tr:hover td {
    background: var(--bg-glass-hover);
}

/* Executive Decision Badges */
.exec-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.55rem;
    border-radius: var(--radius-full);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    margin: 0 0.25rem;
    vertical-align: middle;
    text-transform: uppercase;
    line-height: 1.2;
}

.exec-badge-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.35);
}

.exec-badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.35);
}

.exec-badge-success {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.35);
}

.exec-badge-info {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.35);
}

/* Print PDF High-Resolution Scoped Media */
@media print {
    body {
        background: #ffffff !important;
        color: #0f172a !important;
    }

    .navbar,
    .landing-nav,
    .dynamic-island-wrapper,
    .reports-sidebar,
    .mobile-bottom-nav,
    #print-report-btn,
    .brand-badge,
    .hub-header .hub-actions {
        display: none !important;
    }

    .main-content {
        padding: 0 !important;
        max-width: 100% !important;
    }

    .reports-layout {
        display: block !important;
    }

    .report-viewer-card {
        background: #ffffff !important;
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        color: #0f172a !important;
    }

    .report-markdown-body {
        color: #0f172a !important;
    }

    .report-markdown-body h1,
    .report-markdown-body h2,
    .report-markdown-body h3,
    .report-markdown-body strong {
        color: #0f172a !important;
    }

    .report-markdown-body th {
        background: #f1f5f9 !important;
        color: #475569 !important;
    }

    .report-markdown-body td {
        color: #0f172a !important;
        border-bottom: 1px solid #e2e8f0 !important;
    }
}

/* --------------------------------------------------------------------------
   HUB 3: Charts Gallery & HUB 4: Memory Grid
   -------------------------------------------------------------------------- */
.charts-gallery-grid,
.memory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 1.5rem;
}

.chart-gallery-card,
.memory-card {
    background: var(--bg-glass-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    transition: var(--transition-smooth);
}

.chart-gallery-card:hover,
.memory-card:hover {
    border-color: var(--border-highlight);
    transform: translateY(-2px);
    box-shadow: var(--shadow-card);
}

/* --------------------------------------------------------------------------
   HUB 5: Settings Hub & HUB 6: Admin Telemetry
   -------------------------------------------------------------------------- */
.settings-grid,
.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
    width: 100%;
    box-sizing: border-box;
}

.settings-card,
.admin-card {
    background: var(--bg-glass-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-sizing: border-box;
    width: 100%;
}

.schema-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.85rem;
    margin-top: 1rem;
    width: 100%;
    box-sizing: border-box;
}

.schema-stat-card {
    background: var(--bg-surface);
    padding: 0.9rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.schema-stat-card .stat-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.schema-stat-card .stat-value {
    font-size: 1.05rem;
    font-weight: 700;
    font-family: var(--font-mono);
    margin-top: 0.25rem;
    word-break: break-word;
}

.text-cyan {
    color: var(--accent-cyan) !important;
}

.text-purple {
    color: var(--accent-purple) !important;
}

.text-emerald {
    color: var(--accent-emerald) !important;
}

.custom-fields-list {
    max-height: 220px;
    overflow-y: auto;
    margin-top: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
    box-sizing: border-box;
}

.custom-field-item {
    background: var(--bg-surface);
    padding: 0.6rem 0.9rem;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    border: 1px solid var(--border-subtle);
    word-break: break-word;
}

/* --------------------------------------------------------------------------
   Dynamic Island & Executive Copilot (.dynamic-island-wrapper)
   -------------------------------------------------------------------------- */
.dynamic-island-wrapper {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    width: 90%;
    max-width: 820px;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
}

.dynamic-island-wrapper>* {
    pointer-events: auto;
}

.island-pill-collapsed {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1.5rem;
    background: var(--island-pill-glass-bg) !important;
    backdrop-filter: blur(var(--island-pill-glass-blur)) saturate(var(--island-pill-glass-saturate)) !important;
    -webkit-backdrop-filter: blur(var(--island-pill-glass-blur)) saturate(var(--island-pill-glass-saturate)) !important;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-glass), 0 0 35px rgba(37, 99, 235, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.18);
    cursor: pointer;
    color: var(--text-primary);
    transition: var(--transition-bounce);
}

.island-pill-collapsed:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glass), 0 0 45px rgba(37, 99, 235, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.island-pill-text {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--text-primary);
}

.island-shortcut-tag {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    background: var(--bg-surface-raised);
    padding: 0.15rem 0.45rem;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    border: 1px solid var(--border-subtle);
}

.island-expanded-container {
    display: none;
    width: 100%;
    background: var(--island-drawer-glass-bg) !important;
    backdrop-filter: blur(var(--island-drawer-glass-blur)) saturate(var(--island-drawer-glass-saturate)) !important;
    -webkit-backdrop-filter: blur(var(--island-drawer-glass-blur)) saturate(var(--island-drawer-glass-saturate)) !important;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-glass), 0 0 50px rgba(37, 99, 235, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.15);
    overflow: hidden;
    animation: islandExpand 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.island-expanded-container.active {
    display: block;
}

@keyframes islandExpand {
    from {
        opacity: 0;
        transform: scale(0.97) translateY(12px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.island-dialog-drawer {
    padding: 1.25rem 1.5rem;
    max-height: 440px;
    overflow-y: auto;
    position: relative;
    background: transparent;
}

.island-drawer-header {
    position: sticky;
    top: -1.25rem;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.5rem;
    margin: -1.25rem -1.5rem 1rem -1.5rem;
    background: var(--island-drawer-header-bg) !important;
    backdrop-filter: blur(var(--navbar-glass-blur)) saturate(var(--navbar-glass-saturate));
    -webkit-backdrop-filter: blur(var(--navbar-glass-blur)) saturate(var(--navbar-glass-saturate));
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-primary);
}

.floating-input-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    background: var(--island-input-bar-bg) !important;
    backdrop-filter: blur(var(--navbar-glass-blur)) saturate(var(--navbar-glass-saturate));
    -webkit-backdrop-filter: blur(var(--navbar-glass-blur)) saturate(var(--navbar-glass-saturate));
    border-top: 1px solid var(--border-subtle);
}

.floating-ai-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.96rem;
}

.floating-ai-input::placeholder {
    color: var(--text-muted);
}

.controller-btn {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
}

.controller-btn:hover {
    background: var(--bg-surface-raised);
    color: var(--text-primary);
}

.controller-btn.send-btn {
    background: var(--accent-primary);
    color: #ffffff;
    border: none;
}

.controller-btn.send-btn:hover {
    background: var(--accent-primary-hover);
}

.controller-btn.mic-active,
.controller-btn.recording,
#floating-mic-btn.mic-active,
#floating-mic-btn.recording {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
    color: #ffffff !important;
    border-color: rgba(239, 68, 68, 0.9) !important;
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7), 0 0 22px rgba(239, 68, 68, 0.6) !important;
    animation: micPulseRecording 1.25s infinite ease-in-out !important;
}

@keyframes micPulseRecording {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7), 0 0 16px rgba(239, 68, 68, 0.5);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 0 8px rgba(239, 68, 68, 0), 0 0 28px rgba(239, 68, 68, 0.8);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0), 0 0 16px rgba(239, 68, 68, 0.5);
    }
}

.floating-ai-input.recording-active {
    color: #f87171 !important;
}

.floating-ai-input.recording-active::placeholder {
    color: #f87171 !important;
    font-weight: 600;
}

.quick-prompt-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    background: var(--bg-surface-raised);
    overflow-x: auto;
    border-bottom: 1px solid var(--border-subtle);
}

.quick-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.75rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    font-size: 0.76rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    white-space: nowrap;
}

.quick-chip:hover {
    background: var(--bg-surface-raised);
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

/* Chat Messages Stream Inside Drawer */
.chat-bubble-user {
    align-self: flex-end;
    background: var(--accent-primary);
    border: 1px solid var(--accent-primary);
    border-radius: var(--radius-lg) var(--radius-lg) 2px var(--radius-lg);
    padding: 0.8rem 1.2rem;
    max-width: 82%;
    color: #ffffff;
    margin-bottom: 1rem;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.25);
}

.chat-bubble-ai {
    align-self: flex-start;
    background: var(--bg-surface);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg) var(--radius-lg) var(--radius-lg) 2px;
    padding: 1.1rem 1.35rem;
    max-width: 96%;
    width: 100%;
    margin-bottom: 1.25rem;
    color: var(--text-primary);
    box-shadow: var(--shadow-card);
}

/* Markdown Tables & Body Styling inside Chat AI Bubble */
.report-markdown-body {
    color: var(--text-primary);
    font-size: 0.92rem;
    line-height: 1.65;
    word-break: break-word;
}

.report-markdown-body h1,
.report-markdown-body h2,
.report-markdown-body h3,
.report-markdown-body h4 {
    color: var(--text-primary);
    font-weight: 700;
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.report-markdown-body h1 {
    font-size: 1.25rem;
}

.report-markdown-body h2 {
    font-size: 1.15rem;
}

.report-markdown-body h3 {
    font-size: 1.02rem;
}

.report-markdown-body p {
    margin-bottom: 0.75rem;
}

.report-markdown-body ul,
.report-markdown-body ol {
    margin-left: 1.25rem;
    margin-bottom: 0.85rem;
}

.report-markdown-body li {
    margin-bottom: 0.35rem;
}

/* Table Scroll Wrapper for Chat Drawer */
.table-scroll-wrapper {
    width: 100%;
    overflow-x: auto;
    margin: 0.85rem 0 1.15rem 0;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    background: var(--bg-surface-raised);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.08);
    -webkit-overflow-scrolling: touch;
}

.report-markdown-body table {
    width: 100%;
    min-width: 560px;
    border-collapse: separate;
    border-spacing: 0;
    margin: 0;
    font-size: 0.82rem;
    background: transparent;
    border: none;
}

.report-markdown-body th {
    background: var(--bg-surface-raised);
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid var(--border-subtle);
    text-align: left;
    white-space: nowrap;
}

.report-markdown-body td {
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-primary);
    vertical-align: middle;
    white-space: nowrap;
}

.report-markdown-body tr:last-child td {
    border-bottom: none;
}

.report-markdown-body tbody tr:hover td {
    background: var(--bg-glass-hover);
    color: var(--text-primary);
}

.report-markdown-body code {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    background: var(--bg-surface-raised);
    padding: 0.15rem 0.4rem;
    border-radius: var(--radius-sm);
    color: var(--accent-primary);
    border: 1px solid var(--border-subtle);
}

.action-chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.85rem;
}

.action-chip-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.8rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
}

.action-chip-btn:hover {
    background: rgba(37, 99, 235, 0.18);
    border-color: rgba(59, 130, 246, 0.4);
    color: #ffffff;
    transform: translateY(-1px);
}

/* AI Luxury Loading & Shimmer State */
.ai-loading-card {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.08) 0%, rgba(14, 165, 233, 0.04) 100%);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-glow-blue);
    animation: pulseGlow 2s ease-in-out infinite alternate;
}

@keyframes pulseGlow {
    0% {
        border-color: rgba(59, 130, 246, 0.25);
        box-shadow: 0 0 15px rgba(37, 99, 235, 0.1);
    }

    100% {
        border-color: rgba(14, 165, 233, 0.55);
        box-shadow: 0 0 25px rgba(14, 165, 233, 0.25);
    }
}

.ai-loading-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.85rem;
}

.ai-loading-title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--accent-cyan);
    font-family: var(--font-sans);
}

.ai-loading-orb {
    width: 14px;
    height: 14px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-cyan));
    box-shadow: 0 0 12px var(--accent-cyan);
    animation: orbSpin 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

@keyframes orbSpin {
    0% {
        transform: scale(0.85);
        opacity: 0.7;
    }

    50% {
        transform: scale(1.15);
        opacity: 1;
    }

    100% {
        transform: scale(0.85);
        opacity: 0.7;
    }
}

.ai-loading-step-text {
    font-size: 0.85rem;
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.ai-shimmer-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.ai-shimmer-line {
    height: 8px;
    border-radius: var(--radius-full);
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.04) 25%, rgba(255, 255, 255, 0.14) 50%, rgba(255, 255, 255, 0.04) 75%);
    background-size: 200% 100%;
    animation: shimmerSlide 1.5s infinite linear;
}

@keyframes shimmerSlide {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.chat-msg {
    margin-bottom: 1.25rem;
    display: flex;
    flex-direction: column;
}

.chat-msg-user {
    align-items: flex-end;
}

.chat-msg-user .msg-bubble {
    background: rgba(37, 99, 235, 0.25);
    border: 1px solid rgba(59, 130, 246, 0.4);
    border-radius: var(--radius-lg) var(--radius-lg) 0 var(--radius-lg);
    padding: 0.75rem 1.1rem;
    max-width: 80%;
    color: #ffffff;
}

.chat-msg-assistant {
    align-items: flex-start;
}

.chat-msg-assistant .msg-bubble {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg) var(--radius-lg) var(--radius-lg) 0;
    padding: 1rem 1.25rem;
    max-width: 95%;
    width: 100%;
}

/* Markdown formatting in Chat & Reports */
.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
    margin: 1rem 0 0.5rem 0;
    color: #ffffff;
}

.markdown-body p {
    margin-bottom: 0.75rem;
}

.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.85rem;
}

.markdown-body th {
    background: rgba(255, 255, 255, 0.04);
    padding: 0.6rem 0.8rem;
    border-bottom: 1px solid var(--border-subtle);
    text-align: left;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
}

.markdown-body td {
    padding: 0.65rem 0.8rem;
    border-bottom: 1px solid var(--border-subtle);
}

/* --------------------------------------------------------------------------
   Modals, Forms & Notifications
   -------------------------------------------------------------------------- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(3, 5, 10, 0.8);
    backdrop-filter: blur(16px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.modal-backdrop.active {
    display: flex;
}

.modal-card {
    background: rgba(14, 20, 32, 0.95);
    backdrop-filter: blur(30px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 480px;
    padding: 2.2rem;
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.8), var(--shadow-glow-blue);
    animation: modalIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] .modal-card {
    background: rgba(255, 255, 255, 0.98) !important;
    border: 1px solid rgba(203, 213, 225, 0.9) !important;
    box-shadow: 0 25px 60px rgba(15, 23, 42, 0.15), 0 0 20px rgba(37, 99, 235, 0.1) !important;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.96) translateY(10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.modal-title {
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    transition: var(--transition-fast);
}

.close-btn:hover {
    color: var(--text-primary);
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(14px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.modal-backdrop.active {
    display: flex;
}

.modal-card {
    background: var(--bg-surface);
    backdrop-filter: blur(28px);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-xl);
    padding: 2.2rem;
    max-width: 520px;
    width: 100%;
    box-shadow: var(--shadow-glass);
    color: var(--text-primary);
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.form-group {
    margin-bottom: 1.2rem;
}

.form-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    background: var(--bg-surface-raised);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.92rem;
    transition: var(--transition-smooth);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.auth-tabs {
    display: flex;
    background: var(--bg-surface-raised);
    padding: 0.25rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    margin-bottom: 1.5rem;
}

.auth-tab-btn,
.auth-tab {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-weight: 600;
    padding: 0.55rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-fast);
    text-align: center;
    font-size: 0.88rem;
    font-family: var(--font-sans);
}

.auth-tab-btn:hover,
.auth-tab:hover {
    color: var(--text-primary);
}

.auth-tab-btn.active,
.auth-tab.active {
    background: var(--accent-primary);
    color: #ffffff !important;
}

/* Step Item in Onboarding Modal */
.handshake-steps {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
}

.step-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.65rem 0.9rem;
    border-radius: var(--radius-md);
    font-size: 0.82rem;
    background: var(--bg-surface-raised);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

.step-item.success {
    border-color: var(--accent-emerald);
    color: var(--accent-emerald);
    background: rgba(16, 185, 129, 0.1);
}

.step-item.pending {
    color: var(--text-muted);
}

/* Luxury In-App Toast Notifications */
.toast-container {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 100000 !important;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    pointer-events: none;
    max-width: 380px;
    width: calc(100% - 3rem);
}

.custom-toast {
    pointer-events: auto;
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    background: rgba(11, 16, 27, 0.92);
    backdrop-filter: blur(28px) saturate(180%);
    -webkit-backdrop-filter: blur(28px) saturate(180%);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-lg);
    padding: 0.85rem 1.1rem;
    box-shadow: var(--shadow-glass), 0 0 25px rgba(37, 99, 235, 0.18);
    color: var(--text-primary);
    overflow: hidden;
    animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    transition: var(--transition-smooth);
}

[data-theme="light"] .custom-toast {
    background: rgba(255, 255, 255, 0.95) !important;
    border: 1px solid rgba(203, 213, 225, 0.95) !important;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12), 0 2px 8px rgba(15, 23, 42, 0.06) !important;
}

.custom-toast.toast-hiding {
    opacity: 0;
    transform: translateX(30px) scale(0.95);
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(40px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

.toast-icon-wrapper {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.toast-icon {
    width: 16px !important;
    height: 16px !important;
    max-width: 16px !important;
    max-height: 16px !important;
}

.toast-icon-success {
    background: rgba(16, 185, 129, 0.18);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.35);
}

.toast-icon-error {
    background: rgba(239, 68, 68, 0.18);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.35);
}

.toast-icon-warning {
    background: rgba(245, 158, 11, 0.18);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.35);
}

.toast-icon-info {
    background: rgba(37, 99, 235, 0.18);
    color: #2563eb;
    border: 1px solid rgba(37, 99, 235, 0.35);
}

.toast-content {
    flex: 1;
    min-width: 0;
}

.toast-title {
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--text-primary) !important;
    margin-bottom: 0.15rem;
}

.toast-message {
    font-size: 0.82rem;
    color: var(--text-secondary) !important;
    line-height: 1.4;
    word-break: break-word;
}

.toast-close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    margin-left: 0.3rem;
    transition: var(--transition-fast);
}

.toast-close-btn:hover {
    color: var(--text-primary) !important;
}

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-cyan));
    animation: toastProgress linear forwards;
    width: 100%;
}

@keyframes toastProgress {
    from {
        width: 100%;
    }

    to {
        width: 0%;
    }
}

/* Global Animated Spinner Utility */
.spinner {
    display: inline-block;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Executive Decision & Risk Badges */
.exec-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.2rem 0.65rem;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    vertical-align: middle;
    margin: 0 0.2rem;
    line-height: 1.3;
    white-space: nowrap !important;
    flex-shrink: 0;
}

.exec-badge-danger {
    background: rgba(239, 68, 68, 0.18);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.4);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.2);
}

.exec-badge-warning {
    background: rgba(245, 158, 11, 0.18);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.4);
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.15);
}

.exec-badge-success {
    background: rgba(16, 185, 129, 0.18);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.4);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.15);
}

.exec-badge-info {
    background: rgba(14, 165, 233, 0.18);
    color: #38bdf8;
    border: 1px solid rgba(14, 165, 233, 0.4);
    box-shadow: 0 0 10px rgba(14, 165, 233, 0.15);
}

/* --------------------------------------------------------------------------
   Light Theme System-Wide Workspace Overrides & High-Contrast Typography
   -------------------------------------------------------------------------- */
[data-theme="light"] {
    /* Workspace cards */
    .widget-card,
    .calculator-card,
    .roi-results-card,
    .feature-card,
    .single-plan-card,
    .pricing-card,
    .settings-card,
    .memory-card,
    .report-card,
    .admin-card {
        background: #ffffff !important;
        border-color: rgba(203, 213, 225, 0.9) !important;
        box-shadow: 0 4px 18px -2px rgba(15, 23, 42, 0.05), 0 1px 4px -1px rgba(15, 23, 42, 0.03) !important;
    }

    /* Widget titles & KPI values */
    .widget-title,
    .kpi-value,
    .hub-title-group h1,
    .section-title,
    .plan-name,
    .roi-savings-amount {
        color: #0f172a !important;
    }

    .kpi-context-text,
    .hub-title-group p,
    .section-subtitle,
    .plan-desc {
        color: #475569 !important;
    }

    /* Table contrast */
    .widget-table th {
        background: #f1f5f9 !important;
        color: #334155 !important;
        border-bottom: 2px solid #cbd5e1 !important;
    }

    .widget-table td {
        color: #0f172a !important;
        border-bottom: 1px solid #e2e8f0 !important;
    }

    .widget-table tbody tr:hover td {
        background: #f8fafc !important;
    }

    /* Control bars and filters */
    .dashboard-controls-bar {
        background: #ffffff !important;
        border-color: rgba(203, 213, 225, 0.85) !important;
    }

    .period-filter-group {
        background: #f1f5f9 !important;
        border-color: #cbd5e1 !important;
    }

    .period-pill {
        color: #475569 !important;
    }

    .period-pill:hover {
        color: #0f172a !important;
    }

    .period-pill.active {
        background: var(--accent-primary) !important;
        color: #ffffff !important;
    }

    .dash-pill {
        background: #f8fafc !important;
        border-color: #cbd5e1 !important;
        color: #334155 !important;
    }

    .dash-pill:hover {
        background: #f1f5f9 !important;
        color: #0f172a !important;
    }

    .dash-pill.active {
        background: var(--accent-primary) !important;
        border-color: var(--accent-primary) !important;
        color: #ffffff !important;
    }

    /* Reports Tab */
    .report-item {
        background: #ffffff !important;
        border-color: #e2e8f0 !important;
        color: #0f172a !important;
    }

    .report-item:hover {
        background: #f8fafc !important;
        border-color: #cbd5e1 !important;
    }

    .report-item.active {
        background: #eff6ff !important;
        border-color: #3b82f6 !important;
        color: #1d4ed8 !important;
    }

    .report-title-text {
        color: #0f172a !important;
    }

    .report-meta-text {
        color: #64748b !important;
    }

    .report-content-body {
        color: #1e293b !important;
    }

    /* Memory / Directives Hub */
    .memory-card {
        background: #ffffff !important;
        border-color: #e2e8f0 !important;
    }

    .memory-content-text {
        color: #1e293b !important;
    }

    .memory-meta {
        color: #64748b !important;
    }

    /* Settings Hub */
    .settings-input,
    .settings-select {
        background: #ffffff !important;
        border-color: #cbd5e1 !important;
        color: #0f172a !important;
    }

    .settings-label {
        color: #0f172a !important;
    }

    .settings-helper {
        color: #475569 !important;
    }

    /* Status Badges */
    .badge-status-unpaid {
        background: #fee2e2 !important;
        color: #991b1b !important;
        border: 1px solid #fca5a5 !important;
    }

    .badge-status-paid {
        background: #d1fae5 !important;
        color: #065f46 !important;
        border: 1px solid #6ee7b7 !important;
    }

    .exec-badge-danger {
        background: #fee2e2 !important;
        color: #991b1b !important;
        border: 1px solid #f87171 !important;
    }

    .exec-badge-warning {
        background: #fef3c7 !important;
        color: #92400e !important;
        border: 1px solid #f59e0b !important;
    }

    .exec-badge-success {
        background: #d1fae5 !important;
        color: #065f46 !important;
        border: 1px solid #10b981 !important;
    }

    .exec-badge-info {
        background: #e0f2fe !important;
        color: #075985 !important;
        border: 1px solid #0284c7 !important;
    }
}

/* --------------------------------------------------------------------------
   Boardroom PDF & Print Stylesheet
   -------------------------------------------------------------------------- */
@media print {
    @page {
        margin: 1.5cm;
        size: A4 portrait;
    }

    body {
        background: #ffffff !important;
        color: #0f172a !important;
        background-image: none !important;
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* Hide ALL Website Navigation, Hub Headers, UI Buttons, and Floating Island */
    .navbar,
    .workspace-header,
    .hub-header,
    .hub-actions,
    .landing-nav,
    .landing-container,
    .dashboard-controls-bar,
    .dynamic-island-wrapper,
    .reports-sidebar,
    .btn,
    .btn-primary,
    .btn-secondary,
    .btn-outline,
    .nav-tabs,
    .toast-container,
    #modal-overlay,
    .btn-icon-delete,
    header,
    nav {
        display: none !important;
    }

    .main-content,
    .workspace-container,
    #workspace-view {
        padding: 0 !important;
        margin: 0 !important;
        max-width: 100% !important;
        display: block !important;
    }

    .reports-layout {
        display: block !important;
        grid-template-columns: 1fr !important;
        gap: 0 !important;
    }

    .report-viewer-card {
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin: 0 !important;
        background: transparent !important;
        color: #0f172a !important;
    }

    .report-viewer-header {
        border-bottom: 2px solid #0f172a !important;
        padding-bottom: 0.8rem !important;
        margin-bottom: 1.5rem !important;
    }

    .report-viewer-header h2 {
        color: #0f172a !important;
        font-size: 1.8rem !important;
        font-weight: 800 !important;
        margin: 0 !important;
    }

    .report-viewer-header p {
        color: #64748b !important;
        font-size: 0.85rem !important;
        margin-top: 0.3rem !important;
    }

    .markdown-body {
        color: #1e293b !important;
        font-size: 10.5pt !important;
        line-height: 1.6 !important;
    }

    .markdown-body h1,
    .markdown-body h2,
    .markdown-body h3,
    .markdown-body h4 {
        color: #0f172a !important;
        border-bottom: 1px solid #cbd5e1 !important;
        padding-bottom: 0.3rem !important;
        margin-top: 1.5rem !important;
        page-break-after: avoid;
    }

    .markdown-body table {
        border-collapse: collapse !important;
        width: 100% !important;
        margin: 1.25rem 0 !important;
        page-break-inside: avoid;
    }

    .markdown-body th {
        background: #f1f5f9 !important;
        color: #0f172a !important;
        border: 1px solid #cbd5e1 !important;
        font-weight: 700 !important;
        padding: 8px 10px !important;
        font-size: 9.5pt !important;
    }

    .markdown-body td {
        border: 1px solid #e2e8f0 !important;
        color: #1e293b !important;
        padding: 7px 10px !important;
        font-size: 9.5pt !important;
    }

    /* Print Badge Colors */
    .exec-badge {
        border-radius: 4px !important;
        padding: 2px 6px !important;
        font-size: 7.5pt !important;
    }

    .exec-badge-danger {
        background: #fee2e2 !important;
        color: #991b1b !important;
        border: 1px solid #f87171 !important;
    }

    .exec-badge-warning {
        background: #fef3c7 !important;
        color: #92400e !important;
        border: 1px solid #f59e0b !important;
    }

    .exec-badge-success {
        background: #d1fae5 !important;
        color: #065f46 !important;
        border: 1px solid #10b981 !important;
    }

    .exec-badge-info {
        background: #e0f2fe !important;
        color: #075985 !important;
        border: 1px solid #0284c7 !important;
    }
}

/* ==========================================================================
   MOBILE & TABLET RESPONSIVE SYSTEM (iOS / Android Native App Experience)
   ========================================================================== */

@media (max-width: 900px) {

    /* Responsive Top Workspace Navbar - Ultra-Compact with Zero Horizontal Overflow */
    .navbar {
        padding: 0.45rem 0.65rem;
        gap: 0.35rem;
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        max-width: 100vw;
        box-sizing: border-box;
        overflow-x: clip;
    }

    .brand-section {
        gap: 0.35rem;
        flex-shrink: 1;
        min-width: 0;
    }

    .brand-logo {
        width: 26px;
        height: 26px;
        flex-shrink: 0;
    }

    .brand-title {
        font-size: 0.88rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 120px;
    }

    .brand-badge {
        display: none;
    }

    .workspace-header-actions {
        gap: 0.25rem;
        flex-shrink: 0;
        display: flex;
        align-items: center;
    }

    .theme-toggle-btn {
        width: 28px;
        height: 28px;
        font-size: 0.8rem;
        flex-shrink: 0;
    }

    .currency-picker-pill {
        padding: 0.2rem 0.35rem;
        font-size: 0.68rem;
        max-width: 65px;
        flex-shrink: 0;
    }

    .tenant-status-pill {
        padding: 0.2rem 0.35rem;
        font-size: 0.68rem;
        gap: 0.25rem;
        max-width: 85px;
        flex-shrink: 1;
        overflow: hidden;
    }

    .tenant-name-text {
        max-width: 60px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 0.68rem;
    }

    .tenant-db-text {
        display: none !important;
    }

    .signout-btn {
        padding: 0.25rem 0.45rem;
        font-size: 0.72rem;
        flex-shrink: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 28px;
    }

    .signout-label {
        display: none;
    }

    /* Main Container Content with Safe Padding for Bottom Nav */
    .main-content {
        padding: 1rem 1rem 7.5rem 1rem;
    }

    /* Hub Headers */
    .hub-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.85rem;
        margin-bottom: 1.25rem;
    }

    .hub-title-group h1 {
        font-size: 1.45rem;
    }

    .hub-title-group p {
        font-size: 0.82rem;
    }

    .hub-actions {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .hub-actions button,
    .hub-actions .btn {
        flex: 1;
        font-size: 0.82rem;
        padding: 0.5rem 0.75rem;
        text-align: center;
        justify-content: center;
    }

    /* Hide Desktop Tabs in Top Header on Mobile */
    .desktop-nav-tabs {
        display: none !important;
    }

    /* Native Bottom Navigation Bar on Mobile */
    .mobile-bottom-nav {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        width: 100% !important;
        z-index: 9999 !important;
        background: var(--mobile-nav-glass-bg) !important;
        backdrop-filter: blur(var(--mobile-nav-glass-blur)) saturate(var(--mobile-nav-glass-saturate)) !important;
        -webkit-backdrop-filter: blur(var(--mobile-nav-glass-blur)) saturate(var(--mobile-nav-glass-saturate)) !important;
        border-top: 1px solid var(--mobile-nav-border) !important;
        border-bottom: none !important;
        border-left: none !important;
        border-right: none !important;
        border-radius: 0 !important;
        display: flex !important;
        justify-content: space-around !important;
        align-items: center !important;
        padding: 0.45rem 0.2rem calc(0.5rem + env(safe-area-inset-bottom, 0px)) 0.2rem !important;
        box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.35) !important;
        gap: 0.15rem !important;
        margin: 0 !important;
    }

    .nav-tab-btn {
        flex: 1 !important;
        display: flex;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 4px !important;
        padding: 0.35rem 0.15rem !important;
        font-size: 0.68rem !important;
        font-weight: 600 !important;
        color: var(--text-muted) !important;
        border: none !important;
        background: transparent !important;
        border-radius: 10px !important;
        transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
    }

    .tab-btn-admin {
        display: none !important;
    }

    .tab-btn-admin.admin-visible {
        display: flex !important;
    }

    .nav-tab-btn svg {
        width: 20px !important;
        height: 20px !important;
        stroke-width: 2.2 !important;
    }

    .nav-tab-btn.active {
        color: var(--accent-cyan) !important;
        background: rgba(6, 182, 212, 0.14) !important;
        box-shadow: 0 0 16px rgba(6, 182, 212, 0.25) !important;
    }

    .nav-tab-btn.active svg {
        stroke: var(--accent-cyan) !important;
    }

    /* Dynamic Island AI Copilot on Mobile - Sits above Bottom Nav */
    .dynamic-island-wrapper {
        bottom: calc(68px + env(safe-area-inset-bottom, 0px)) !important;
        width: calc(100% - 1.5rem) !important;
        max-width: 500px !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        z-index: 9998 !important;
    }

    .island-dialog-drawer {
        max-height: 75vh;
    }

    /* Keep the collapse control reachable on phones.
       The drawer scrolls, and the header's sticky offset of -1.25rem parks it just
       above the scroll port — so on a tall conversation it scrolls out of reach and
       the chat covers the whole screen with no way back. Pin it to the top instead. */
    .island-drawer-header {
        top: 0 !important;
        margin-top: 0 !important;
        padding-top: 0.75rem !important;
        padding-bottom: 0.75rem !important;
        gap: 0.5rem;
    }

    /* The label wraps and squeezes the button out of the row on narrow screens. */
    .island-drawer-header > span:first-child {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 0.78rem !important;
    }

    #island-minimize-btn {
        flex-shrink: 0;
        white-space: nowrap;
        /* A comfortable tap target; the chevron alone is enough of a label here. */
        min-width: 44px;
        min-height: 36px;
        padding: 0.4rem 0.7rem;
        font-size: 1rem;
        line-height: 1;
    }

    /* "Ctrl+K" means nothing on a phone, and the full label crowds the row. */
    .collapse-btn-label {
        display: none;
    }

    /* Grids & Cards */
    .widgets-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .widget-kpi {
        grid-column: 1 / -1 !important;
    }

    .widget-chart {
        grid-column: 1 / -1 !important;
    }

    .reports-layout {
        display: flex !important;
        flex-direction: column !important;
        gap: 1rem !important;
        width: 100% !important;
    }

    .reports-sidebar {
        max-height: 200px !important;
        width: 100% !important;
        box-sizing: border-box !important;
        overflow-y: auto !important;
        padding: 0.85rem !important;
    }

    .report-viewer-card {
        width: 100% !important;
        box-sizing: border-box !important;
        padding: 1.25rem 1rem !important;
        border-radius: var(--radius-lg) !important;
        min-height: auto !important;
    }

    .report-viewer-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.35rem !important;
        margin-bottom: 1rem !important;
        padding-bottom: 0.75rem !important;
    }

    .report-viewer-header h2 {
        font-size: 1.2rem !important;
        word-break: break-word !important;
    }

    .report-markdown-body {
        font-size: 0.9rem !important;
        line-height: 1.65 !important;
        word-break: break-word !important;
    }

    .report-markdown-body h1 {
        font-size: 1.3rem !important;
    }

    .report-markdown-body h2 {
        font-size: 1.15rem !important;
    }

    .report-markdown-body h3 {
        font-size: 1.05rem !important;
    }

    .table-responsive {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        box-sizing: border-box !important;
        margin: 1rem 0 !important;
        display: block !important;
    }

    .report-markdown-body table,
    .report-table {
        min-width: 380px !important;
        font-size: 0.78rem !important;
    }

    .report-markdown-body th,
    .report-markdown-body td,
    .report-table th,
    .report-table td {
        padding: 0.55rem 0.7rem !important;
        white-space: nowrap !important;
    }

    .settings-grid,
    .admin-grid {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        gap: 1.25rem !important;
    }

    .settings-card,
    .admin-card {
        width: 100% !important;
        padding: 1.25rem 1rem !important;
        box-sizing: border-box !important;
        border-radius: var(--radius-lg) !important;
    }

    .schema-stats-grid {
        grid-template-columns: 1fr !important;
        gap: 0.65rem !important;
    }

    .form-input,
    .form-select,
    .form-textarea {
        font-size: 16px !important; /* Prevents mobile browser viewport auto-zoom */
        padding: 0.75rem 0.85rem !important;
        box-sizing: border-box !important;
    }

    .memory-grid,
    .charts-gallery-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .dashboard-controls-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .period-filter-group {
        justify-content: space-between;
    }

    /* Landing Page Responsive */
    .landing-nav {
        padding: 0.55rem 0.85rem !important;
        gap: 0.4rem !important;
    }

    .brand-section {
        gap: 0.35rem !important;
    }

    .brand-title {
        font-size: 0.88rem !important;
        white-space: nowrap !important;
    }

    .brand-badge {
        display: none !important;
    }

    .nav-links-center {
        display: none !important;
    }

    .landing-nav-actions {
        gap: 0.35rem !important;
    }

    .landing-auth-btn {
        padding: 0.32rem 0.55rem !important;
        font-size: 0.74rem !important;
        white-space: nowrap !important;
    }

    .landing-launch-btn {
        padding: 0.32rem 0.65rem !important;
        font-size: 0.74rem !important;
        white-space: nowrap !important;
    }

    .launch-btn-full {
        display: none !important;
    }

    .launch-btn-short {
        display: inline !important;
    }

    .hero-section {
        padding: 3.5rem 1rem 2.5rem 1rem !important;
    }

    .hero-headline {
        font-size: 1.85rem !important;
        line-height: 1.2 !important;
    }

    .hero-subhead {
        font-size: 0.92rem !important;
    }

    .hero-cta-group {
        flex-direction: column !important;
        width: 100% !important;
    }

    .hero-cta-group button,
    .hero-cta-group a {
        width: 100% !important;
        text-align: center !important;
    }

    .trust-strip {
        flex-direction: column !important;
        gap: 0.65rem !important;
        align-items: center !important;
    }

    /* Interactive ROI Calculator Mobile */
    .roi-calculator-section {
        padding: 3rem 1rem !important;
    }

    .roi-grid {
        grid-template-columns: 1fr !important;
        gap: 1.25rem !important;
    }

    .roi-savings-amount {
        font-size: 2.4rem !important;
    }

    /* Single Plan Card & Features Mobile (Eliminates squished columns) */
    .pricing-section {
        padding: 3rem 1rem !important;
    }

    .pricing-single-wrapper {
        padding: 0 !important;
        max-width: 100% !important;
    }

    .single-plan-card {
        padding: 1.75rem 1.15rem !important;
        border-radius: var(--radius-lg) !important;
    }

    .plan-name {
        font-size: 1.35rem !important;
    }

    .plan-desc {
        font-size: 0.85rem !important;
    }

    .plan-price {
        font-size: 2.5rem !important;
    }

    .plan-period {
        font-size: 0.95rem !important;
    }

    .plan-onboarding-note {
        font-size: 0.8rem !important;
        margin-bottom: 1.5rem !important;
    }

    .pricing-features-grid {
        grid-template-columns: 1fr !important;
        gap: 0.85rem !important;
        margin-bottom: 1.75rem !important;
    }

    .pricing-feature-item {
        font-size: 0.88rem !important;
        line-height: 1.4 !important;
    }

    .pricing-cta-btn {
        font-size: 0.92rem !important;
        padding: 0.8rem 1rem !important;
        white-space: normal !important;
        line-height: 1.3 !important;
    }

    .pricing-guarantee-note {
        font-size: 0.75rem !important;
    }

    /* Features Grid & FAQ Mobile */
    .features-section,
    .faq-section {
        padding: 3rem 1rem !important;
    }

    .features-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    .feature-card {
        padding: 1.5rem 1.15rem !important;
    }
}

@media (max-width: 520px) {
    .navbar {
        padding: 0.4rem 0.5rem !important;
    }

    .brand-title {
        max-width: 70px !important;
        font-size: 0.78rem !important;
    }

    .tenant-status-pill {
        max-width: 26px !important;
        padding: 0.2rem 0.3rem !important;
    }

    .tenant-name-text {
        display: none !important;
    }

    .currency-picker-pill {
        max-width: 58px !important;
        font-size: 0.65rem !important;
        padding: 0.15rem 0.25rem !important;
    }

    .signout-btn {
        padding: 0.25rem 0.35rem !important;
        font-size: 0.7rem !important;
        min-width: 26px !important;
    }
}
/* ==========================================================================
   Capability States — Locked / Empty Widgets & Real KPI Sparklines
   Renders missing Odoo apps as an upgrade path and genuinely-empty periods
   as an honest "no data yet", instead of both collapsing into a dead tile.
   ========================================================================== */

.widget-card.widget-locked,
.widget-card.widget-empty {
    display: flex;
    flex-direction: column;
    min-height: 190px;
}

.badge-pill.badge-locked {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.18), rgba(99, 102, 241, 0.18));
    color: var(--accent-purple);
    border: 1px solid rgba(168, 85, 247, 0.32);
    font-size: 0.62rem;
    letter-spacing: 0.06em;
}

.badge-pill.badge-neutral {
    background: var(--surface-subtle, rgba(148, 163, 184, 0.12));
    color: var(--text-muted);
    border: 1px solid var(--border-subtle, rgba(148, 163, 184, 0.22));
    font-size: 0.62rem;
    letter-spacing: 0.06em;
}

/* --- Locked capability card --- */
.locked-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    padding: 1rem 1.15rem 1.15rem;
    text-align: center;
}

.locked-icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    color: var(--accent-purple);
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.14), rgba(99, 102, 241, 0.10));
    border: 1px solid rgba(168, 85, 247, 0.24);
}

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

.locked-copy { display: flex; flex-direction: column; gap: 0.3rem; }

.locked-headline {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.locked-headline strong { color: var(--accent-purple); }

.locked-value {
    margin: 0;
    font-size: 0.8rem;
    line-height: 1.5;
    color: var(--text-muted);
    max-width: 34ch;
}

.locked-hint {
    margin-top: 0.2rem;
    font-size: 0.7rem;
    color: var(--text-muted);
    opacity: 0.85;
    padding: 0.4rem 0.7rem;
    border-radius: 8px;
    background: var(--surface-subtle, rgba(148, 163, 184, 0.08));
    border: 1px dashed var(--border-subtle, rgba(148, 163, 184, 0.2));
}

/* --- Empty (valid but no rows) card --- */
.empty-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    text-align: center;
}

.empty-icon { color: var(--text-muted); opacity: 0.5; }
.empty-icon svg { width: 34px; height: 34px; }

.empty-headline {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 650;
    color: var(--text-secondary, var(--text-primary));
}

.empty-sub {
    margin: 0;
    font-size: 0.75rem;
    color: var(--text-muted);
    max-width: 32ch;
    line-height: 1.5;
}

/* --- Real KPI sparkline (width encodes actual YoY delta) --- */
.kpi-spark-bar-fill {
    transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-cyan));
}

.kpi-spark-bar-fill.spark-down {
    background: linear-gradient(90deg, var(--accent-rose), var(--accent-amber));
}

.kpi-context-text.kpi-context-substituted {
    color: var(--accent-amber);
    font-style: italic;
}

@media (prefers-reduced-motion: reduce) {
    .kpi-spark-bar-fill { transition: none; }
}

/* ==========================================================================
   Voice Dictation & Prompt Suggestions
   Every place the executive can type, they can also speak.
   ========================================================================== */

.voice-input-wrap {
    position: relative;
    display: block;
    width: 100%;
}

.voice-input-wrap > .form-input {
    width: 100%;
    padding-right: 2.9rem;
}

.voice-mic-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.55rem;
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    padding: 0;
    border-radius: 9px;
    cursor: pointer;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid transparent;
    transition: color 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.voice-mic-btn svg { width: 16px; height: 16px; }

.voice-mic-btn:hover {
    color: var(--accent-primary);
    background: rgba(37, 99, 235, 0.1);
    border-color: rgba(37, 99, 235, 0.25);
}

.voice-mic-btn:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

.voice-mic-btn.listening {
    color: #fff;
    background: var(--accent-rose);
    border-color: var(--accent-rose);
    animation: voice-pulse 1.5s ease-in-out infinite;
}

@keyframes voice-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.45); }
    50%      { box-shadow: 0 0 0 6px rgba(244, 63, 94, 0); }
}

.form-input.voice-listening {
    border-color: var(--accent-rose);
    box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.12);
}

/* --- One-tap example chips so nobody faces a blank box --- */
.prompt-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.7rem;
}

.suggestion-chip {
    font-size: 0.73rem;
    font-weight: 550;
    line-height: 1.3;
    padding: 0.36rem 0.66rem;
    border-radius: 999px;
    cursor: pointer;
    color: var(--text-secondary, var(--text-primary));
    background: var(--surface-subtle, rgba(148, 163, 184, 0.1));
    border: 1px solid var(--border-subtle, rgba(148, 163, 184, 0.22));
    transition: color 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

.suggestion-chip:hover {
    color: var(--accent-primary);
    background: rgba(37, 99, 235, 0.12);
    border-color: rgba(37, 99, 235, 0.34);
}

.suggestion-chip:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .voice-mic-btn.listening { animation: none; }
}

/* ==========================================================================
   Drill-Down Records Modal
   Clicking a chart data point opens the underlying Odoo records.

   Note: the base .modal-card sets `padding: 2.2rem` and `overflow-y: auto`, which
   would break sticky table headers and internal scrolling. The drill card resets
   both and owns its own scroll region.
   ========================================================================== */

.drill-backdrop {
    /* Sit above the base modal layer and align to top on tall record sets. */
    z-index: 10050;
    align-items: flex-start;
    padding: clamp(0.75rem, 4vh, 3rem) clamp(0.75rem, 4vw, 2rem);
    overflow-y: auto;
}

.modal-card.drill-card {
    /* Reset the base card so the header stays fixed and only the table scrolls. */
    padding: 0;
    overflow: hidden;
    max-width: 940px;
    width: 100%;
    max-height: min(80vh, 760px);
    display: flex;
    flex-direction: column;
    margin: auto;
}

.drill-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.5rem 1rem;
    border-bottom: 1px solid var(--border-subtle);
    background: linear-gradient(180deg, rgba(37, 99, 235, 0.07), transparent);
    flex-shrink: 0;
}

.drill-eyebrow {
    display: block;
    font-size: 0.65rem;
    font-weight: 750;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--accent-primary);
    margin-bottom: 0.3rem;
}

.drill-title {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: -0.015em;
    color: var(--text-primary);
    line-height: 1.25;
    /* Long partner names wrap instead of pushing the close button off-card. */
    overflow-wrap: anywhere;
}

.drill-context {
    margin: 0.3rem 0 0;
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.drill-close {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.35rem;
    line-height: 1;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid transparent;
    transition: color 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

.drill-close:hover {
    color: var(--text-primary);
    background: var(--bg-surface-raised);
    border-color: var(--border-subtle);
}

.drill-close:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

/* --- Summary strip: totals for the drilled set --- */
.drill-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    padding: 0.85rem 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-surface-raised);
    flex-shrink: 0;
}

.drill-stat-label {
    display: block;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 0.15rem;
}

.drill-stat-value {
    display: block;
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-primary);
    font-family: var(--font-mono);
    letter-spacing: -0.01em;
}

/* --- Scroll region: only this scrolls, headers stay put --- */
.drill-body {
    flex: 1;
    min-height: 0;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

.drill-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.85rem;
    padding: 3.5rem 1.5rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.88rem;
}

.drill-state .spinner {
    width: 30px;
    height: 30px;
    border: 3px solid rgba(37, 99, 235, 0.2);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.drill-state-error { color: var(--accent-rose); }

.drill-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.82rem;
}

.drill-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    text-align: left;
    white-space: nowrap;
    padding: 0.65rem 1rem;
    font-size: 0.65rem;
    font-weight: 750;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-secondary);
    /* Opaque: rows must not show through while scrolling under the header. */
    background: var(--bg-surface-raised);
    border-bottom: 1px solid var(--border-medium, var(--border-subtle));
}

.drill-table thead th.num { text-align: right; }

.drill-table tbody td {
    padding: 0.6rem 1rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-subtle);
    white-space: nowrap;
    vertical-align: middle;
}

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

.drill-table tbody tr { transition: background 0.13s ease; }
.drill-table tbody tr:hover td { background: rgba(37, 99, 235, 0.07); }

.drill-table td.num {
    text-align: right;
    font-family: var(--font-mono);
    font-weight: 650;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.drill-table td.doc {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--text-primary);
}

/* Status chips make lifecycle state scannable at a glance. */
.drill-chip {
    display: inline-block;
    padding: 0.16rem 0.55rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    white-space: nowrap;
    background: var(--bg-surface-raised);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

.drill-chip.chip-good {
    color: var(--accent-emerald);
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.3);
}

.drill-chip.chip-warn {
    color: var(--accent-amber);
    background: rgba(245, 158, 11, 0.12);
    border-color: rgba(245, 158, 11, 0.3);
}

.drill-chip.chip-bad {
    color: var(--accent-rose);
    background: rgba(244, 63, 94, 0.12);
    border-color: rgba(244, 63, 94, 0.3);
}

/* --- Footer --- */
.drill-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.8rem 1.5rem;
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-surface-raised);
    flex-shrink: 0;
}

.drill-footer-note {
    margin: 0;
    font-size: 0.72rem;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

/* --- Phones: full-screen sheet, cards instead of a cramped table --- */
@media (max-width: 640px) {
    /* Full-screen sheet. !important is required here: the base .modal-card rules and
       earlier 640px blocks in this file are more specific / also flagged. */
    .modal-backdrop.drill-backdrop {
        padding: 0 !important;
        align-items: stretch !important;
        justify-content: stretch !important;
        overflow: hidden !important;
    }

    .modal-backdrop.drill-backdrop .modal-card.drill-card {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        margin: 0 !important;
        padding: 0 !important;
        border-radius: 0 !important;
        border: none !important;
        overflow: hidden !important;
        display: flex !important;
        flex-direction: column !important;
    }

    .drill-header,
    .drill-summary,
    .drill-footer {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    .drill-title { font-size: 1.05rem; }

    /* Summary stats sit in a row of equal columns rather than wrapping awkwardly. */
    .drill-summary {
        gap: 0.75rem;
        justify-content: space-between;
    }

    .drill-summary > div { flex: 1 1 0; min-width: 0; }
    .drill-stat-value { font-size: 0.88rem; overflow-wrap: anywhere; }

    .drill-body { overflow-y: auto; overflow-x: hidden; }

    /* Reflow each record into a stacked card: no horizontal scrolling, nothing clipped. */
    .drill-table { display: block; width: 100%; }
    .drill-table thead { display: none; }
    .drill-table tbody { display: block; width: 100%; }

    .drill-table tbody tr {
        display: block;
        width: auto;
        margin: 0.6rem 1rem;
        padding: 0.5rem 0.85rem;
        border: 1px solid var(--border-subtle);
        border-radius: 12px;
        background: var(--bg-surface-raised);
    }

    .drill-table tbody td {
        display: flex;
        align-items: baseline;
        justify-content: space-between;
        gap: 0.75rem;
        width: auto;
        padding: 0.3rem 0;
        border-bottom: none;
        /* Long values wrap instead of being clipped by the inherited nowrap. */
        white-space: normal !important;
        overflow-wrap: anywhere;
        text-align: right;
    }

    .drill-table tbody td::before {
        content: attr(data-label);
        flex: 0 0 auto;
        text-align: left;
        font-size: 0.62rem;
        font-weight: 750;
        letter-spacing: 0.06em;
        text-transform: uppercase;
        color: var(--text-secondary);
    }

    /* Hide empty cells so a record card shows only fields that carry a value. */
    .drill-table tbody td:empty { display: none; }

    .drill-table tbody tr:hover td { background: transparent; }

    .drill-footer { gap: 0.75rem; }
    .drill-footer-note { font-size: 0.68rem; }
}

@media (prefers-reduced-motion: reduce) {
    .drill-state .spinner { animation: none; }
}

/* Negative KPI figures (credit notes, refunds, contra balances) read as a reduction. */
.kpi-value.kpi-value-negative {
    color: var(--accent-rose);
}

/* ==========================================================================
   KPI Sparklines, Goal Bars & Table Widgets
   A KPI card shows the number, the movement behind it, and progress to goal.
   ========================================================================== */

.kpi-card-v2 { position: relative; overflow: hidden; }

/* Trend drawn behind the figure, low-contrast so the number stays dominant. */
.kpi-sparkline {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 26px;
    height: 30px;
    pointer-events: none;
    opacity: 0.55;
    z-index: 0;
}

.kpi-sparkline svg { width: 100%; height: 100%; display: block; }

/* Keep foreground content above the sparkline. */
.kpi-card-v2 .widget-header,
.kpi-card-v2 .kpi-metric-wrap,
.kpi-card-v2 .kpi-context-text,
.kpi-card-v2 .kpi-spark-bar { position: relative; z-index: 1; }

.kpi-context-text {
    /* Goal text can run long; keep it on one tidy line. */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Table widgets embedded in the dashboard grid. */
.widget-table-host {
    max-height: 320px;
    overflow: auto;
    border-radius: 12px;
    border: 1px solid var(--border-subtle);
}

.widget-table-host .drill-table thead th {
    background: var(--bg-surface-raised);
}

@media (max-width: 640px) {
    /* Match the drill-down sheet: stacked record cards, no sideways scrolling. */
    .widget-table-host { max-height: none; border: none; }

    .widget-table-host .drill-table,
    .widget-table-host .drill-table tbody { display: block; width: 100%; }
    .widget-table-host .drill-table thead { display: none; }

    .widget-table-host .drill-table tbody tr {
        display: block;
        margin: 0.6rem 0;
        padding: 0.5rem 0.85rem;
        border: 1px solid var(--border-subtle);
        border-radius: 12px;
        background: var(--bg-surface-raised);
    }

    .widget-table-host .drill-table tbody td {
        display: flex;
        align-items: baseline;
        justify-content: space-between;
        gap: 0.75rem;
        padding: 0.3rem 0;
        border-bottom: none;
        white-space: normal !important;
        overflow-wrap: anywhere;
        text-align: right;
    }

    .widget-table-host .drill-table tbody td::before {
        content: attr(data-label);
        flex: 0 0 auto;
        text-align: left;
        font-size: 0.62rem;
        font-weight: 750;
        letter-spacing: 0.06em;
        text-transform: uppercase;
        color: var(--text-secondary);
    }

    .widget-table-host .drill-table tbody td:empty { display: none; }
}

/* Positioning context for the KPI sparkline drawn behind each card. */
.widget-card { position: relative; }

/* ==========================================================================
   Cross-Filter Bar (v2)
   Entered from the drill-down modal, so it must clearly announce that the
   dashboard is showing a subset — and offer one obvious way back.
   ========================================================================== */

.crossfilter-bar {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    margin: 0 0 1.25rem;
    padding: 0.7rem 1rem;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(14, 165, 233, 0.06));
    border: 1px solid rgba(37, 99, 235, 0.32);
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.1);
    animation: modalIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.crossfilter-icon { font-size: 0.95rem; line-height: 1; }

.crossfilter-label {
    font-size: 0.72rem;
    font-weight: 750;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--accent-primary);
    white-space: nowrap;
}

.crossfilter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding: 0.3rem 0.8rem;
    border-radius: 999px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
}

.crossfilter-chip strong {
    color: var(--text-primary);
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crossfilter-clear-btn {
    margin-left: auto;
    flex-shrink: 0;
    padding: 0.35rem 0.85rem;
    font-size: 0.78rem;
    font-weight: 650;
    cursor: pointer;
    border-radius: 8px;
    color: var(--text-secondary);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    transition: color 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

.crossfilter-clear-btn:hover {
    color: #fff;
    background: var(--accent-rose);
    border-color: var(--accent-rose);
}

.crossfilter-clear-btn:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

/* Footer actions in the drill-down modal. */
.drill-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

@media (max-width: 640px) {
    .crossfilter-bar {
        flex-wrap: wrap;
        gap: 0.5rem;
        padding: 0.65rem 0.8rem;
    }

    .crossfilter-clear-btn {
        margin-left: 0;
        width: 100%;
        text-align: center;
    }

    .drill-footer { flex-direction: column; align-items: stretch; }
    .drill-actions { justify-content: stretch; }
    .drill-actions .btn { flex: 1 1 auto; justify-content: center; }
}

/* ==========================================================================
   Company (Legal Entity) Scope Selector
   Multi-company databases must never present an ambiguous figure, so the
   active scope stays visible in the navbar at all times.
   ========================================================================== */

.company-scope {
    position: relative;
    display: inline-flex;
    flex-shrink: 0;
}

.company-scope-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    max-width: 220px;
    padding: 0.4rem 0.7rem;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 10px;
    color: var(--text-secondary);
    background: var(--bg-surface-raised);
    border: 1px solid var(--border-subtle);
    transition: color 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

.company-scope-btn:hover {
    color: var(--text-primary);
    border-color: var(--accent-primary);
}

.company-scope-btn:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

/* A narrowed scope is highlighted: the figures on screen are a subset. */
.company-scope-btn.scoped {
    color: var(--accent-primary);
    background: rgba(37, 99, 235, 0.1);
    border-color: rgba(37, 99, 235, 0.4);
}

.company-scope-icon { font-size: 0.85rem; line-height: 1; }

.company-scope-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.company-scope-warn { color: var(--accent-amber); font-size: 0.85rem; }
.company-scope-caret { font-size: 0.6rem; opacity: 0.7; }

.company-scope-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 3000;
    min-width: 260px;
    max-height: 340px;
    overflow-y: auto;
    padding: 0.35rem;
    border-radius: 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border-medium, var(--border-subtle));
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.35);
    animation: modalIn 0.16s cubic-bezier(0.16, 1, 0.3, 1);
}

.company-scope-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 0.6rem;
    font-size: 0.83rem;
    font-weight: 550;
    text-align: left;
    cursor: pointer;
    border: none;
    border-radius: 8px;
    color: var(--text-secondary);
    background: transparent;
    transition: color 0.14s ease, background 0.14s ease;
}

.company-scope-item:hover {
    color: var(--text-primary);
    background: rgba(37, 99, 235, 0.1);
}

.company-scope-item.active { color: var(--text-primary); font-weight: 700; }

.company-scope-check {
    flex: 0 0 14px;
    font-size: 0.8rem;
    color: var(--accent-primary);
}

.company-scope-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.company-scope-curr {
    flex: 0 0 auto;
    font-size: 0.7rem;
    font-family: var(--font-mono);
    opacity: 0.65;
}

.company-scope-divider {
    height: 1px;
    margin: 0.3rem 0.2rem;
    background: var(--border-subtle);
}

@media (max-width: 900px) {
    .company-scope-btn { max-width: 130px; padding: 0.35rem 0.55rem; font-size: 0.75rem; }
    .company-scope-menu { min-width: 220px; }
}

/* ==========================================================================
   Data Integrity Warning
   Shown in place of a figure that cannot be trusted (e.g. one that would sum
   several currencies without conversion). Refusing beats a confident wrong number.
   ========================================================================== */

.widget-card.widget-integrity {
    display: flex;
    flex-direction: column;
    min-height: 190px;
    border-color: rgba(245, 158, 11, 0.4);
}

.badge-pill.badge-integrity {
    background: rgba(245, 158, 11, 0.16);
    color: var(--accent-amber);
    border: 1px solid rgba(245, 158, 11, 0.35);
    font-size: 0.62rem;
    letter-spacing: 0.06em;
}

.integrity-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    padding: 1rem 1.15rem 1.15rem;
    text-align: center;
}

.integrity-icon {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    color: var(--accent-amber);
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.28);
}

.integrity-icon svg { width: 21px; height: 21px; }

.integrity-headline {
    margin: 0;
    font-size: 0.92rem;
    font-weight: 750;
    color: var(--text-primary);
}

.integrity-text {
    margin: 0;
    font-size: 0.76rem;
    line-height: 1.5;
    color: var(--text-muted);
    max-width: 42ch;
}

/* ==========================================================================
   Landing Feature Grid — tablet tier + lead card
   The base grid steps 3 -> 1 at 900px, which wastes width on tablets.
   ========================================================================== */

@media (min-width: 641px) and (max-width: 900px) {
    .features-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* The drill-down card leads the grid: it is the capability people react to. */
.feature-card-hero {
    border-color: rgba(37, 99, 235, 0.4);
    background: linear-gradient(150deg, rgba(37, 99, 235, 0.09), transparent 62%);
}

@media (min-width: 901px) {
    .feature-card-hero {
        grid-column: span 3;
        display: grid;
        grid-template-columns: auto 1fr;
        column-gap: 1.4rem;
        align-items: start;
    }

    .feature-card-hero .feature-icon-box { grid-row: span 2; }
    .feature-card-hero .feature-title { font-size: 1.3rem; margin-bottom: 0.4rem; }
    .feature-card-hero .feature-desc { max-width: 68ch; }
}
