/**
 * ═══════════════════════════════════════════════════════════════════════════════
 * APP.CSS — Analytics Dashboard Stylesheet
 * ═══════════════════════════════════════════════════════════════════════════════
 *
 * A complete, production-ready CSS file for an enterprise analytics dashboard.
 * Designed for long reading sessions, data-heavy interfaces, and export-ready visuals.
 *
 * VISUAL PHILOSOPHY:
 * - Dark theme for focus and reduced eye strain
 * - Information hierarchy through contrast
 * - Calm, professional aesthetics (no visual noise)
 * - Premium feel suitable for enterprise/stakeholder presentations
 *
 * FILE STRUCTURE:
 * 1. CSS Variables (Design Tokens)
 * 2. Reset & Base Styles
 * 3. Typography System
 * 4. Layout Structure (Grid)
 * 5. Header
 * 6. Sidebar & Navigation
 * 7. Main Content Area
 * 8. Submodule System (Tabs & Panels)
 * 9. Content Sections
 * 10. Charts
 * 11. Tables
 * 12. Glossary
 * 13. Recommendations & RCA
 * 14. Buttons & Controls
 * 15. Loading & Error States
 * 16. Utility Classes
 * 17. Responsive Design
 * 18. Scrollbar Styling
 * 19. Animations
 * 20. Print Styles
 *
 * ═══════════════════════════════════════════════════════════════════════════════
 */


/* ═══════════════════════════════════════════════════════════════════════════════
   1. CSS VARIABLES — DESIGN TOKENS
   ═══════════════════════════════════════════════════════════════════════════════
   
   All colors, spacing, and typography values are defined here.
   This makes the design system consistent and easy to modify.
   
   Think of these as the "DNA" of the design — change them here,
   and the entire dashboard updates automatically.
*/

:root {
    /* ─────────────────────────────────────────────────────────────────────
       BACKGROUND LAYERS
       From darkest (base) to lightest (active state)
       Creates depth and visual hierarchy
    ───────────────────────────────────────────────────────────────────── */
    --bg-base: #0d1117;
    /* Deepest background - main canvas */
    --bg-surface: #161b22;
    /* Cards, sidebar, elevated surfaces */
    --bg-elevated: #1c2128;
    /* Headers, table headers, raised elements */
    --bg-hover: #252c35;
    /* Hover states */
    --bg-active: #2d3640;
    /* Active/selected states */
    --bg-input: #21262d;
    /* Form inputs, search fields */

    /* ─────────────────────────────────────────────────────────────────────
       BORDER & DIVIDER COLORS
       Subtle separation without harsh lines
    ───────────────────────────────────────────────────────────────────── */
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-default: rgba(255, 255, 255, 0.1);
    --border-emphasis: rgba(255, 255, 255, 0.15);
    --border-strong: rgba(255, 255, 255, 0.2);

    /* ─────────────────────────────────────────────────────────────────────
       TEXT HIERARCHY
       Primary = most important (headings, key data)
       Secondary = supporting text
       Tertiary = labels, captions
       Muted = disabled, placeholder
    ───────────────────────────────────────────────────────────────────── */
    --text-primary: #f0f3f6;
    --text-secondary: #9ca3af;
    --text-tertiary: #6b7280;
    --text-muted: #4b5563;
    --text-inverse: #0d1117;

    /* ─────────────────────────────────────────────────────────────────────
       ACCENT COLORS
       Primary = amber/gold (calls to action, highlights)
       Secondary = blue (links, secondary actions)
       Semantic = success/warning/danger for status
    ───────────────────────────────────────────────────────────────────── */
    --accent-primary: #f59e0b;
    --accent-primary-rgb: 245, 158, 11;
    /* For rgba() functions */
    --accent-primary-hover: #fbbf24;
    --accent-primary-muted: rgba(245, 158, 11, 0.15);
    --accent-secondary: #3b82f6;
    --accent-secondary-hover: #60a5fa;
    --accent-secondary-muted: rgba(59, 130, 246, 0.15);
    --accent-success: #10b981;
    --accent-success-muted: rgba(16, 185, 129, 0.15);
    --accent-warning: #f59e0b;
    --accent-warning-muted: rgba(245, 158, 11, 0.15);
    --accent-danger: #ef4444;
    --accent-danger-muted: rgba(239, 68, 68, 0.15);

    /* ─────────────────────────────────────────────────────────────────────
       CHART COLOR PALETTE
       Carefully selected for visual distinction and accessibility
    ───────────────────────────────────────────────────────────────────── */
    --chart-blue: #3b82f6;
    --chart-blue-light: rgba(59, 130, 246, 0.2);
    --chart-amber: #f59e0b;
    --chart-amber-light: rgba(245, 158, 11, 0.2);
    --chart-emerald: #10b981;
    --chart-emerald-light: rgba(16, 185, 129, 0.2);
    --chart-purple: #8b5cf6;
    --chart-purple-light: rgba(139, 92, 246, 0.2);
    --chart-rose: #f43f5e;
    --chart-rose-light: rgba(244, 63, 94, 0.2);
    --chart-cyan: #06b6d4;
    --chart-cyan-light: rgba(6, 182, 212, 0.2);
    --chart-orange: #f97316;
    --chart-slate: #64748b;

    /* ─────────────────────────────────────────────────────────────────────
       SPACING SCALE
       Consistent spacing creates visual rhythm
       Based on 4px base unit
    ───────────────────────────────────────────────────────────────────── */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    --space-3xl: 64px;

    /* ─────────────────────────────────────────────────────────────────────
       TYPOGRAPHY
       Inter for UI, monospace for data/numbers
    ───────────────────────────────────────────────────────────────────── */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', 'Consolas', monospace;

    /* Font sizes */
    --text-xs: 0.75rem;
    /* 12px */
    --text-sm: 0.8125rem;
    /* 13px */
    --text-base: 0.875rem;
    /* 14px */
    --text-md: 0.9375rem;
    /* 15px */
    --text-lg: 1rem;
    /* 16px */
    --text-xl: 1.125rem;
    /* 18px */
    --text-2xl: 1.25rem;
    /* 20px */
    --text-3xl: 1.5rem;
    /* 24px */
    --text-4xl: 1.875rem;
    /* 30px */

    /* Line heights */
    --leading-tight: 1.25;
    --leading-snug: 1.375;
    --leading-normal: 1.5;
    --leading-relaxed: 1.625;
    --leading-loose: 1.75;

    /* Font weights */
    --font-light: 300;
    --font-normal: 400;
    --font-medium: 500;
    --font-semibold: 600;
    --font-bold: 700;
    --font-extrabold: 800;

    /* ─────────────────────────────────────────────────────────────────────
       BORDER RADIUS
       Consistent corner rounding
    ───────────────────────────────────────────────────────────────────── */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 12px;
    --radius-2xl: 16px;
    --radius-full: 9999px;

    /* ─────────────────────────────────────────────────────────────────────
       SHADOWS
       Subtle depth effects
    ───────────────────────────────────────────────────────────────────── */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 20px rgba(245, 158, 11, 0.15);

    /* ─────────────────────────────────────────────────────────────────────
       LAYOUT DIMENSIONS
    ───────────────────────────────────────────────────────────────────── */
    --sidebar-width: 280px;
    --sidebar-width-collapsed: 72px;
    --header-height: 72px;
    --content-max-width: 1400px;
    --table-min-width: 600px;

    /* ─────────────────────────────────────────────────────────────────────
       TRANSITIONS
    ───────────────────────────────────────────────────────────────────── */
    --transition-fast: 0.15s ease;
    --transition-base: 0.2s ease;
    --transition-slow: 0.3s ease;

    /* ─────────────────────────────────────────────────────────────────────
       Z-INDEX SCALE
    ───────────────────────────────────────────────────────────────────── */
    --z-base: 0;
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-header: 300;
    --z-modal: 400;
    --z-tooltip: 500;
}


/* ═══════════════════════════════════════════════════════════════════════════════
   2. RESET & BASE STYLES
   ═══════════════════════════════════════════════════════════════════════════════
   
   Normalize browser defaults for consistent cross-browser rendering.
   Set up the foundational styles that everything else builds on.
*/

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    font-weight: var(--font-normal);
    line-height: var(--leading-normal);
    color: var(--text-primary);
    background-color: var(--bg-base);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Remove default focus outlines, add custom ones */
:focus {
    outline: none;
}

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

/* Links */
a {
    color: var(--accent-secondary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-secondary-hover);
}

/* Images */
img,
svg {
    display: block;
    max-width: 100%;
    height: auto;
}

/* Lists */
ul,
ol {
    list-style: none;
}

/* Form elements inherit font */
button,
input,
select,
textarea {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
}


/* ═══════════════════════════════════════════════════════════════════════════════
   3. TYPOGRAPHY SYSTEM
   ═══════════════════════════════════════════════════════════════════════════════
   
   Consistent text styling throughout the dashboard.
   Headers, body text, labels, and monospace data.
*/

/* Page-level headings (set by JS in header) */
h1,
.header-title {
    font-size: var(--text-3xl);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
    letter-spacing: -0.02em;
    line-height: var(--leading-tight);
}

/* Section headings */
h2,
.section-title {
    font-size: var(--text-2xl);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
    letter-spacing: -0.01em;
    line-height: var(--leading-snug);
}

/* Card/component headings */
h3,
.chart-title,
.table-title,
.rca-title {
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
    line-height: var(--leading-snug);
}

/* Small headings */
h4,
.recommendation-title {
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
}

/* Body text */
p,
.section-description,
.rca-content,
.recommendation-text {
    font-size: var(--text-md);
    color: var(--text-secondary);
    line-height: var(--leading-relaxed);
}

/* Small/caption text */
small,
.text-sm {
    font-size: var(--text-sm);
}

/* Monospace for data */
.mono,
code,
.data-table td {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
}

/* Label text (uppercase) */
.label,
.sidebar-title,
.header-label {
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}


/* ═══════════════════════════════════════════════════════════════════════════════
   4. LAYOUT STRUCTURE (CSS GRID)
   ═══════════════════════════════════════════════════════════════════════════════
   
   The dashboard uses CSS Grid for the main layout:
   - Sidebar on the left (fixed width)
   - Header at the top (spans main content area)
   - Main content fills remaining space
*/

.dashboard-layout {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    grid-template-rows: var(--header-height) 1fr;
    grid-template-areas:
        "sidebar header"
        "sidebar main";
    min-height: 100vh;
    width: 100%;
}


/* ═══════════════════════════════════════════════════════════════════════════════
   5. HEADER
   ═══════════════════════════════════════════════════════════════════════════════
   
   Top bar with branding, title, and download controls.
   Sticky positioning keeps it visible while scrolling.
*/

.dashboard-header {
    grid-area: header;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-lg);
    padding: 0 var(--space-xl);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
    position: sticky;
    top: 0;
    z-index: var(--z-header);
}

/* Brand section (left side) */
.header-brand {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    /* Allow text truncation */
}

/* Small label above title */
.header-label {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.header-label-icon {
    display: flex;
    gap: 2px;
}

.header-label-icon span {
    width: 6px;
    height: 6px;
    border-radius: 1px;
}

.header-label-icon span:first-child {
    background: var(--accent-primary);
}

.header-label-icon span:last-child {
    background: var(--accent-secondary);
}

/* Subtitle below main title */
.header-subtitle {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin-top: 2px;
}

/* Action buttons (right side) */
.header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex-shrink: 0;
}


/* ═══════════════════════════════════════════════════════════════════════════════
   6. SIDEBAR & NAVIGATION
   ═══════════════════════════════════════════════════════════════════════════════
   
   Left sidebar containing:
   - Module list (main navigation)
   - Submodule list (expands under active module)
   
   The sidebar is fixed-width and scrolls independently.
*/

.dashboard-sidebar {
    grid-area: sidebar;
    display: flex;
    flex-direction: column;
    background: var(--bg-surface);
    border-right: 1px solid var(--border-subtle);
    overflow: hidden;
}

/* Sidebar header with "MODULES" label */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.sidebar-title {
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.sidebar-count {
    color: var(--text-muted);
    font-weight: var(--font-normal);
}

/* Scrollable navigation area */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: var(--space-md);
}

/* Module list container */
#module-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

/* Individual module item */
.module-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-base);
    user-select: none;
}

.module-item:hover {
    background: var(--bg-hover);
    border-color: var(--border-default);
}

.module-item.active {
    background: var(--bg-active);
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-sm);
}

/* Module number badge */
.module-number {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-hover);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--text-secondary);
    flex-shrink: 0;
    transition: all var(--transition-base);
}

.module-item.active .module-number {
    background: var(--accent-primary);
    color: var(--text-inverse);
}

/* Module name */
.module-name {
    flex: 1;
    font-size: var(--text-base);
    font-weight: var(--font-medium);
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Expand arrow */
.module-arrow {
    width: 16px;
    height: 16px;
    color: var(--text-tertiary);
    flex-shrink: 0;
    transition: transform var(--transition-base);
}

.module-item.active .module-arrow {
    transform: rotate(90deg);
    color: var(--accent-primary);
}

/* Submodule list (nested under active module) */
.submodule-list {
    display: none;
    flex-direction: column;
    gap: 2px;
    margin-top: var(--space-sm);
    margin-left: 44px;
    /* Align with module name */
    padding-left: var(--space-md);
    border-left: 2px solid var(--border-subtle);
}

/* Show submodule list when module is active */
.module-item.active+.submodule-list,
.module-item.expanded+.submodule-list {
    display: flex;
}

/* Individual submodule item */
.submodule-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.submodule-item:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.submodule-item.active {
    color: var(--accent-primary);
    background: var(--accent-primary-muted);
}

/* Submodule icon */
.submodule-icon {
    width: 16px;
    height: 16px;
    opacity: 0.7;
    flex-shrink: 0;
}

.submodule-item.active .submodule-icon {
    opacity: 1;
}


/* ═══════════════════════════════════════════════════════════════════════════════
   7. MAIN CONTENT AREA
   ═══════════════════════════════════════════════════════════════════════════════
   
   The scrollable area where module content appears.
   Only one module is visible at a time (controlled by .active class).
*/

.dashboard-main {
    grid-area: main;
    background: var(--bg-base);
    overflow-y: auto;
    overflow-x: hidden;
    padding: var(--space-xl);
}

/* Module content container (one per module) */
.module-content {
    display: none;
    max-width: var(--content-max-width);
    margin: 0 auto;
}

/* Only show the active module */
.module-content.active {
    display: block;
    animation: fadeIn 0.3s ease forwards;
}


/* ═══════════════════════════════════════════════════════════════════════════════
   8. SUBMODULE SYSTEM (TABS & PANELS)
   ═══════════════════════════════════════════════════════════════════════════════
   
   Each module has 3 submodules:
   1. Overview & Glossary
   2. In-Depth Analysis
   3. RCA & Recommendations
   
   Tabs control which panel is visible.
*/

/* Tab container */
.submodule-tabs {
    display: flex;
    gap: var(--space-xs);
    padding: var(--space-xs);
    background: var(--bg-surface);
    border-radius: var(--radius-xl);
    margin-bottom: var(--space-xl);
    width: fit-content;
    border: 1px solid var(--border-subtle);
}

/* Individual tab */
.submodule-tab {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-lg);
    font-size: var(--text-base);
    font-weight: var(--font-medium);
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-base);
    white-space: nowrap;
}

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

.submodule-tab.active {
    color: var(--text-primary);
    background: var(--bg-elevated);
    box-shadow: var(--shadow-sm);
}

.submodule-tab svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Panel container (hidden by default) */
.submodule-panel {
    display: none;
}

/* Only show active panel */
.submodule-panel.active {
    display: block;
    animation: fadeIn 0.25s ease forwards;
}


/* ═══════════════════════════════════════════════════════════════════════════════
   9. CONTENT SECTIONS
   ═══════════════════════════════════════════════════════════════════════════════
   
   Generic content blocks used throughout the dashboard.
   Consistent spacing and visual treatment.
*/

.content-section {
    margin-bottom: var(--space-xl);
}

.content-section:last-child {
    margin-bottom: 0;
}

/* Section header with indicator bar */
.section-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
}

/* Amber accent bar */
.section-indicator {
    width: 4px;
    height: 24px;
    background: var(--accent-primary);
    border-radius: 2px;
    flex-shrink: 0;
}

/* Section body text */
.section-description {
    max-width: 80ch;
    /* Optimal reading width */
}


/* ═══════════════════════════════════════════════════════════════════════════════
   10. CHARTS
   ═══════════════════════════════════════════════════════════════════════════════
   
   Chart containers for Chart.js visualizations.
   Includes header with title, legend, and download action.
*/

/* Grid layout for multiple charts */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: var(--space-xl);
    margin-bottom: var(--space-xl);
}

/* Individual chart card */
.chart-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: var(--space-lg);
    transition: border-color var(--transition-base);
}

.chart-card:hover {
    border-color: var(--border-default);
}

/* Chart header */
.chart-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
    flex-wrap: wrap;
}

/* Chart actions (legend + download) */
.chart-actions {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    flex-wrap: wrap;
}

/* Legend */
.chart-legend {
    display: flex;
    gap: var(--space-md);
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: var(--text-xs);
    color: var(--text-secondary);
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 2px;
    flex-shrink: 0;
}

/* Chart container (where Chart.js renders) */
.chart-container {
    position: relative;
    height: 280px;
    width: 100%;
}

/* Canvas inside chart container */
.chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}


/* ═══════════════════════════════════════════════════════════════════════════════
   11. TABLES
   ═══════════════════════════════════════════════════════════════════════════════
   
   Data tables with:
   - Sticky headers
   - Zebra striping
   - Horizontal scroll on small screens
   - Monospace numbers for alignment
*/

/* Table wrapper card */
.table-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    overflow: hidden;
    margin-bottom: var(--space-xl);
}

.table-card:last-child {
    margin-bottom: 0;
}

/* Table header (title + download button) */
.table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-surface);
}

/* Scrollable table wrapper */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* The actual table */
.data-table {
    width: 100%;
    min-width: var(--table-min-width);
    border-collapse: collapse;
    border-spacing: 0;
    table-layout: fixed;
}

/* Table header cells */
.data-table th {
    padding: 12px 16px;
    text-align: center;
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-subtle);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    overflow: hidden;
    text-overflow: ellipsis;
}

/* First column — left-aligned for label readability */
.data-table th:first-child,
.data-table td:first-child {
    text-align: left;
}

/* Table data cells */
.data-table td {
    padding: 12px 16px;
    text-align: center;
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-subtle);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Remove border from last row */
.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* Zebra striping */
.data-table tbody tr:nth-child(even) td {
    background: rgba(255, 255, 255, 0.02);
}

/* Hover effect */
.data-table tbody tr:hover td {
    background: var(--bg-hover);
}

/* Alignment helpers — all override to center for uniform column alignment */
.data-table .text-right,
.data-table .text-center,
.data-table .text-left {
    text-align: center;
}

/* Numeric cells — centered with tabular nums for consistent digit width */
.data-table td[data-type="number"],
.data-table td[data-type="currency"],
.data-table td[data-type="percent"] {
    text-align: center;
    font-variant-numeric: tabular-nums;
}

/* Positive/negative value colors */
.data-table .value-positive {
    color: var(--accent-success);
}

.data-table .value-negative {
    color: var(--accent-danger);
}


/* ═══════════════════════════════════════════════════════════════════════════════
   12. GLOSSARY
   ═══════════════════════════════════════════════════════════════════════════════
   
   Definition list for terms and metrics.
   Styled as bulleted items with term:definition format.
*/

.glossary-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.glossary-item {
    display: flex;
    gap: var(--space-sm);
    font-size: var(--text-md);
    line-height: var(--leading-relaxed);
}

.glossary-bullet {
    color: var(--accent-primary);
    flex-shrink: 0;
    font-weight: var(--font-bold);
}

.glossary-term {
    font-weight: var(--font-semibold);
    color: var(--text-primary);
}

.glossary-definition {
    color: var(--text-secondary);
}


/* ═══════════════════════════════════════════════════════════════════════════════
   13. RECOMMENDATIONS & RCA
   ═══════════════════════════════════════════════════════════════════════════════
   
   Card-based display for insights and recommendations.
   High readability, text-focused design.
*/

/* Recommendations list container */
.recommendations-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

/* Individual recommendation card */
.recommendation-item {
    padding: var(--space-lg);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-left: 3px solid var(--accent-primary);
    border-radius: var(--radius-lg);
    transition: all var(--transition-base);
}

.recommendation-item:hover {
    border-color: var(--border-default);
    border-left-color: var(--accent-primary);
    box-shadow: var(--shadow-sm);
}

.recommendation-title {
    margin-bottom: var(--space-sm);
}

.recommendation-text {
    font-size: var(--text-md);
    color: var(--text-secondary);
    line-height: var(--leading-relaxed);
}

/* RCA (Root Cause Analysis) card - special highlight */
.rca-card {
    padding: var(--space-xl);
    background: linear-gradient(135deg,
            var(--accent-primary-muted) 0%,
            var(--accent-secondary-muted) 100%);
    border: 1px solid rgba(245, 158, 11, 0.25);
    border-radius: var(--radius-xl);
}

.rca-title {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.rca-title::before {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--accent-primary);
    border-radius: 50%;
}

.rca-content {
    line-height: var(--leading-loose);
}


/* ═══════════════════════════════════════════════════════════════════════════════
   14. BUTTONS & CONTROLS
   ═══════════════════════════════════════════════════════════════════════════════
   
   Consistent button styling for all interactive elements.
   Primary (amber), Secondary (subtle), Icon-only variants.
*/

/* Base button styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    font-family: var(--font-sans);
    font-size: var(--text-base);
    font-weight: var(--font-medium);
    line-height: 1;
    color: var(--text-primary);
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-base);
    white-space: nowrap;
    user-select: none;
}

.btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-emphasis);
}

.btn:active {
    transform: translateY(1px);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Primary button (amber) */
.btn-primary {
    color: var(--text-inverse);
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

.btn-primary:hover {
    background: var(--accent-primary-hover);
    border-color: var(--accent-primary-hover);
}

/* Secondary button (subtle) */
.btn-secondary {
    color: var(--text-primary);
    background: var(--bg-elevated);
    border-color: var(--border-default);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--border-emphasis);
}

/* Icon-only button */
.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
}

/* Button icons */
.btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* Small button variant */
.btn-sm {
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--text-sm);
}

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


/* ═══════════════════════════════════════════════════════════════════════════════
   15. LOADING & ERROR STATES
   ═══════════════════════════════════════════════════════════════════════════════
   
   Visual feedback during async operations and error conditions.
*/

/* Loading state container */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-3xl);
    color: var(--text-secondary);
    text-align: center;
}

/* Spinning loader */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-default);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: var(--space-md);
}

/* Error state */
.error-state {
    padding: var(--space-xl);
    background: var(--accent-danger-muted);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-xl);
    color: var(--accent-danger);
    text-align: center;
}

.error-state p {
    color: inherit;
    margin: 0;
}


/* ═══════════════════════════════════════════════════════════════════════════════
   16. UTILITY CLASSES
   ═══════════════════════════════════════════════════════════════════════════════
*/

/* Hide visually but keep accessible to screen readers */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Hide completely */
.hidden {
    display: none !important;
}

/* Text alignment */
.text-left {
    text-align: left;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: center;
}

/* Text colors */
.text-primary {
    color: var(--text-primary);
}

.text-secondary {
    color: var(--text-secondary);
}

.text-tertiary {
    color: var(--text-tertiary);
}

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

.text-success {
    color: var(--accent-success);
}

.text-warning {
    color: var(--accent-warning);
}

.text-danger {
    color: var(--accent-danger);
}

/* Spacing utilities */
.mt-0 {
    margin-top: 0;
}

.mt-sm {
    margin-top: var(--space-sm);
}

.mt-md {
    margin-top: var(--space-md);
}

.mt-lg {
    margin-top: var(--space-lg);
}

.mt-xl {
    margin-top: var(--space-xl);
}

.mb-0 {
    margin-bottom: 0;
}

.mb-sm {
    margin-bottom: var(--space-sm);
}

.mb-md {
    margin-bottom: var(--space-md);
}

.mb-lg {
    margin-bottom: var(--space-lg);
}

.mb-xl {
    margin-bottom: var(--space-xl);
}


/* ═══════════════════════════════════════════════════════════════════════════════
   17. RESPONSIVE DESIGN
   ═══════════════════════════════════════════════════════════════════════════════
   
   Desktop-first approach with breakpoints for tablet and mobile.
*/

/* Large screens (default) */
/* All styles above apply */

/* Medium screens (tablets, small laptops) */
@media (max-width: 1200px) {
    :root {
        --sidebar-width: 260px;
    }

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

/* Small screens (tablets portrait, large phones) */
@media (max-width: 1024px) {

    /* Convert to single-column layout */
    .dashboard-layout {
        grid-template-columns: 1fr;
        grid-template-rows: var(--header-height) 1fr;
        grid-template-areas:
            "header"
            "main";
    }

    /* Hide sidebar on small screens */
    .dashboard-sidebar {
        display: none;
    }

    /* Full-width content */
    .dashboard-main {
        padding: var(--space-lg);
    }

    /* Stack tabs vertically if needed */
    .submodule-tabs {
        flex-wrap: wrap;
        width: 100%;
    }

    .submodule-tab {
        flex: 1;
        justify-content: center;
        min-width: 120px;
    }

    /* Charts grid single column */
    .charts-grid {
        grid-template-columns: 1fr;
        gap: var(--space-lg);
    }

    /* Stack spend effectiveness layout on tablets */
    .spend-eff-layout {
        grid-template-columns: 1fr !important;
    }

    /* Chart container height */
    .chart-container {
        height: 240px;
    }
}

/* Extra small screens (phones) */
@media (max-width: 640px) {
    :root {
        --header-height: 64px;
    }

    .dashboard-header {
        padding: 0 var(--space-md);
    }

    .header-title {
        font-size: var(--text-xl);
    }

    .header-subtitle {
        display: none;
    }

    .header-actions {
        gap: var(--space-xs);
    }

    /* Hide text in header buttons on mobile */
    .header-actions .btn span {
        display: none;
    }

    .header-actions .btn-primary {
        padding: var(--space-sm);
    }

    .dashboard-main {
        padding: var(--space-md);
    }

    /* Stack submodule tabs */
    .submodule-tabs {
        flex-direction: column;
        border-radius: var(--radius-lg);
    }

    .submodule-tab {
        width: 100%;
        border-radius: var(--radius-md);
    }

    /* Table adjustments */
    .table-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-sm);
    }

    .data-table th,
    .data-table td {
        padding: var(--space-sm) var(--space-md);
    }

    /* Chart adjustments */
    .chart-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .chart-container {
        height: 200px;
    }

    /* Section spacing */
    .content-section {
        margin-bottom: var(--space-lg);
    }

    /* RCA card */
    .rca-card {
        padding: var(--space-lg);
    }

    /* Recommendation items */
    .recommendation-item {
        padding: var(--space-md);
    }
}


/* ═══════════════════════════════════════════════════════════════════════════════
   18. SCROLLBAR STYLING
   ═══════════════════════════════════════════════════════════════════════════════
   
   Custom scrollbars for WebKit browsers.
   Falls back to native on Firefox/others.
*/

/* Thin scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-surface);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-hover);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--bg-active);
}

/* Scrollbar for sidebar */
.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}

/* Scrollbar for main content */
.dashboard-main::-webkit-scrollbar {
    width: 10px;
}

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--bg-hover) var(--bg-surface);
}


/* ═══════════════════════════════════════════════════════════════════════════════
   19. ANIMATIONS
   ═══════════════════════════════════════════════════════════════════════════════
   
   Subtle motion for state transitions.
   Performance-optimized (opacity + transform only).
*/

/* Fade in animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

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

/* Spin animation (for loader) */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Pulse animation (for live indicators) */
@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}


/* ═══════════════════════════════════════════════════════════════════════════════
   20. PRINT STYLES
   ═══════════════════════════════════════════════════════════════════════════════
   
   Optimized for printing/PDF export.
*/

@media print {

    /* Reset colors for print */
    :root {
        --bg-base: #ffffff;
        --bg-surface: #f9fafb;
        --bg-elevated: #f3f4f6;
        --text-primary: #111827;
        --text-secondary: #4b5563;
        --border-subtle: #e5e7eb;
    }

    /* Hide non-essential elements */
    .dashboard-sidebar,
    .header-actions,
    .submodule-tabs,
    .btn,
    .chart-actions {
        display: none !important;
    }

    /* Full-width layout */
    .dashboard-layout {
        display: block;
    }

    .dashboard-main {
        padding: 0;
    }

    /* Show all submodules */
    .submodule-panel {
        display: block !important;
        page-break-inside: avoid;
        margin-bottom: 2rem;
    }

    /* Page breaks */
    .content-section {
        page-break-inside: avoid;
    }

    .chart-card,
    .table-card {
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid var(--border-subtle);
    }

    /* Table adjustments */
    .data-table {
        font-size: 10pt;
    }

    .data-table th,
    .data-table td {
        padding: 8px 12px;
    }
}


/* ═══════════════════════════════════════════════════════════════════════════════
   ADDITIONAL STYLES FOR BASE.HTML & INDEX.HTML (UPLOAD PAGE)
   ═══════════════════════════════════════════════════════════════════════════════
   
   These styles support the home/upload page that uses base.html.
   They extend Bootstrap's defaults with the dashboard's design system.
*/

/* App body (used in base.html) */
.app-body {
    font-family: var(--font-sans);
    background: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
}

/* Background animation orbs */
.bg-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.bg-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.15;
}

.bg-orb-1 {
    width: 600px;
    height: 600px;
    background: var(--accent-primary);
    top: -200px;
    right: -200px;
    animation: float 20s ease-in-out infinite;
}

.bg-orb-2 {
    width: 500px;
    height: 500px;
    background: var(--accent-secondary);
    bottom: -150px;
    left: -150px;
    animation: float 25s ease-in-out infinite reverse;
}

.bg-orb-3 {
    width: 400px;
    height: 400px;
    background: var(--chart-purple);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: float 30s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0);
    }

    25% {
        transform: translate(30px, -30px);
    }

    50% {
        transform: translate(-20px, 20px);
    }

    75% {
        transform: translate(20px, 10px);
    }
}

/* Navbar (base.html) */
.app-navbar {
    background: rgba(22, 27, 34, 0.95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-subtle);
    padding: var(--space-md) 0;
}

.app-navbar .navbar-brand {
    color: var(--text-primary);
}

.brand-mark {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--accent-primary);
    border-radius: var(--radius-lg);
    color: var(--text-inverse);
    font-size: 1.25rem;
}

.brand-text {
    font-size: var(--text-lg);
    font-weight: var(--font-bold);
    color: var(--text-primary);
}

.brand-sub {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
}

.nav-link-item .nav-link {
    color: var(--text-secondary);
    font-weight: var(--font-medium);
    transition: color var(--transition-fast);
}

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

.uload-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-lg);
    background: var(--accent-primary);
    color: var(--text-inverse);
    font-weight: var(--font-semibold);
    border-radius: var(--radius-lg);
    transition: all var(--transition-base);
}

.uload-btn:hover {
    background: var(--accent-primary-hover);
    color: var(--text-inverse);
    transform: translateY(-1px);
}

/* Main content area (base.html) */
.app-main {
    min-height: calc(100vh - 180px);
}

/* Footer (base.html) */
.app-footer {
    padding: var(--space-lg) 0;
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-surface);
}

/* Hero section (index.html) */
.hero-wrap {
    position: relative;
    padding: var(--space-2xl) 0;
}

.hero-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.1;
    pointer-events: none;
}

.hero-blob-a {
    width: 400px;
    height: 400px;
    background: var(--accent-primary);
    top: 0;
    left: 10%;
}

.hero-blob-b {
    width: 300px;
    height: 300px;
    background: var(--accent-secondary);
    bottom: 20%;
    right: 5%;
}

/* Badge pill */
.badge-pill {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--accent-primary-muted);
    color: var(--accent-primary);
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    border-radius: var(--radius-full);
    margin-bottom: var(--space-lg);
}

.badge-pill i {
    font-size: 1rem;
}

/* Hero title */
.hero-title {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: var(--font-extrabold);
    color: var(--text-primary);
    line-height: var(--leading-tight);
    margin-bottom: var(--space-lg);
}

.hero-subtitle {
    font-size: var(--text-lg);
    color: var(--text-secondary);
    line-height: var(--leading-relaxed);
    max-width: 540px;
    margin-bottom: var(--space-xl);
}

/* Stats grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
    margin-top: var(--space-xl);
}

.stat-card {
    padding: var(--space-lg);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    transition: all var(--transition-base);
}

.stat-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}

.stat-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-primary-muted);
    color: var(--accent-primary);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-sm);
    font-size: 1.25rem;
}

.stat-label {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 2px;
}

.stat-value {
    font-size: var(--text-2xl);
    font-weight: var(--font-bold);
    color: var(--text-primary);
}

/* Upload card */
.upload-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-2xl);
    overflow: hidden;
}

.upload-card-head {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.upload-card-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-primary-muted);
    color: var(--accent-primary);
    border-radius: var(--radius-xl);
    font-size: 1.5rem;
}

.upload-card-title {
    font-size: var(--text-xl);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
}

/* Drop zone */
.upload-drop {
    padding: var(--space-2xl);
    border: 2px dashed var(--border-default);
    border-radius: var(--radius-xl);
    text-align: center;
    transition: all var(--transition-base);
    cursor: pointer;
}

.upload-drop:hover,
.upload-drop.dragging {
    border-color: var(--accent-primary);
    background: var(--accent-primary-muted);
}

.drop-icon {
    font-size: 3rem;
    color: var(--accent-primary);
    margin-bottom: var(--space-md);
}

.drop-title {
    font-size: var(--text-xl);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}

.drop-text {
    font-size: var(--text-base);
    color: var(--text-secondary);
    margin-bottom: var(--space-lg);
}

.upload-meta {
    margin-top: var(--space-md);
    font-size: var(--text-sm);
    color: var(--text-tertiary);
}

/* Selected file display */
.selected-file {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md);
    background: var(--bg-elevated);
    border-radius: var(--radius-lg);
    margin-top: var(--space-md);
    font-size: var(--text-base);
    color: var(--text-primary);
}

.selected-file i {
    color: var(--accent-success);
    font-size: 1.25rem;
}

/* Upload button */
.upload-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    width: 100%;
    padding: var(--space-md) var(--space-xl);
    background: var(--accent-primary);
    color: var(--text-inverse);
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-base);
}

.upload-btn:hover {
    background: var(--accent-primary-hover);
    transform: translateY(-1px);
}

.upload-btn:active {
    transform: translateY(0);
}

/* Outline button */
.btn-outline-amz {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-lg);
    background: transparent;
    color: var(--accent-primary);
    font-weight: var(--font-medium);
    border: 1px solid var(--accent-primary);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-base);
}

.btn-outline-amz:hover {
    background: var(--accent-primary);
    color: var(--text-inverse);
}

/* Progress bar */
.app-progress {
    height: 8px;
    background: var(--bg-elevated);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.app-progress .progress-bar {
    background: var(--accent-primary);
}

/* ═══════════════════════════════════════════════════════════════════════════
   BRANDED KEYWORD MODAL
   ═══════════════════════════════════════════════════════════════════════════ */

.branded-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1050;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.branded-modal-overlay.d-none {
    display: none !important;
}

.branded-modal {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-2xl);
    padding: var(--space-2xl);
    width: 100%;
    max-width: 520px;
    margin: var(--space-lg);
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4);
}

.branded-modal-header {
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.branded-modal-icon {
    width: 48px;
    height: 48px;
    min-width: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-primary-muted);
    color: var(--accent-primary);
    border-radius: var(--radius-xl);
    font-size: 1.5rem;
}

.branded-modal-title {
    font-size: var(--text-xl);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}

.branded-modal-desc {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
}

.branded-input-row {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.branded-term-input {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-size: var(--text-base);
    outline: none;
    transition: border-color var(--transition-base);
}

.branded-term-input::placeholder {
    color: var(--text-tertiary);
}

.branded-term-input:focus {
    border-color: var(--accent-primary);
}

.branded-add-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-lg);
    background: var(--accent-primary);
    color: var(--text-inverse);
    font-weight: var(--font-semibold);
    font-size: var(--text-sm);
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: background var(--transition-base);
    white-space: nowrap;
}

.branded-add-btn:hover {
    background: var(--accent-primary-hover);
}

.branded-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    min-height: 32px;
    margin-bottom: var(--space-md);
}

.branded-tag {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-md);
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    color: var(--text-primary);
}

.branded-tag-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 0;
    margin-left: var(--space-xs);
    font-size: 0.85rem;
    line-height: 1;
    transition: color var(--transition-base);
}

.branded-tag-remove:hover {
    color: var(--accent-danger);
}

.branded-validation {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-lg);
    color: var(--accent-danger);
    font-size: var(--text-sm);
    margin-bottom: var(--space-md);
}

.branded-validation.d-none {
    display: none !important;
}

.branded-modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border-subtle);
}

.branded-back-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-lg);
    background: transparent;
    color: var(--text-secondary);
    font-weight: var(--font-medium);
    font-size: var(--text-sm);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-base);
}

.branded-back-btn:hover {
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

.branded-continue-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-xl);
    background: var(--accent-primary);
    color: var(--text-inverse);
    font-weight: var(--font-semibold);
    font-size: var(--text-sm);
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-base);
}

.branded-continue-btn:hover:not(:disabled) {
    background: var(--accent-primary-hover);
    transform: translateY(-1px);
}

.branded-continue-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Features grid */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: var(--space-lg);
    margin-top: var(--space-3xl);
}

.feature-card {
    padding: var(--space-xl);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    transition: all var(--transition-base);
}

.feature-card:hover {
    border-color: var(--accent-secondary);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.feature-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-secondary-muted);
    color: var(--accent-secondary);
    border-radius: var(--radius-xl);
    margin-bottom: var(--space-md);
    font-size: 1.5rem;
}

.feature-title {
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

.feature-desc {
    font-size: var(--text-base);
    color: var(--text-secondary);
    line-height: var(--leading-relaxed);
    margin: 0;
}

/* Form select */
.soft-select {
    background: var(--bg-input);
    border: 1px solid var(--border-default);
    color: var(--text-primary);
    border-radius: var(--radius-lg);
    padding: var(--space-sm) var(--space-md);
}

.soft-select:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-primary-muted);
}

/* Toast overrides */
.toast {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
}


/* ═══════════════════════════════════════════════════════════════════════════════
   AUDIT DATE SELECTOR — Premium Calendar UI
   ═══════════════════════════════════════════════════════════════════════════════
   A polished, enterprise-grade date selector matching the dark theme.
   Visual design inspired by premium analytics SaaS products.
*/

/* ─────────────────────────────────────────────────────────────────────────────
   CONTAINER & POSITIONING
   ─────────────────────────────────────────────────────────────────────────────
*/
.audit-date-selector-wrap {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: var(--space-lg);
    z-index: 100;
}

/* ─────────────────────────────────────────────────────────────────────────────
   TRIGGER BUTTON (Collapsed State)
   ─────────────────────────────────────────────────────────────────────────────
   Pill-shaped button with amber accent border
*/
.date-selector-trigger {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: transparent;
    border: 1.5px solid var(--accent-primary);
    border-radius: 999px;
    color: var(--accent-primary);
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.date-selector-trigger:hover {
    background: rgba(var(--accent-primary-rgb), 0.1);
    transform: translateY(-1px);
}

.date-selector-trigger.active {
    background: rgba(var(--accent-primary-rgb), 0.15);
}

.date-selector-trigger i {
    font-size: 1rem;
    opacity: 0.9;
}

.date-selector-arrow {
    font-size: 0.75rem !important;
    transition: transform 0.25s ease;
}

.date-selector-trigger.active .date-selector-arrow {
    transform: rotate(180deg);
}

/* ─────────────────────────────────────────────────────────────────────────────
   POPOVER (Expanded State)
   ─────────────────────────────────────────────────────────────────────────────
   Dark surface with subtle elevation and premium feel
*/
.date-selector-popover {
    position: absolute;
    top: calc(100% + 16px);
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(145deg, #1a1a1f 0%, #151519 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    box-shadow:
        0 24px 48px rgba(0, 0, 0, 0.4),
        0 8px 16px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    z-index: 200;
    min-width: 580px;
    overflow: hidden;
}

/* ─────────────────────────────────────────────────────────────────────────────
   POPOVER HEADER
   ─────────────────────────────────────────────────────────────────────────────
   Date summary with duration badge and calendar icon
*/
.date-popover-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 24px;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.date-popover-header #popover-summary {
    flex: 1;
    color: #ffffff;
    font-size: 0.9375rem;
    font-weight: 500;
    letter-spacing: 0.01em;
}

.duration-dropdown-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: rgba(var(--accent-primary-rgb), 0.12);
    border: 1px solid rgba(var(--accent-primary-rgb), 0.25);
    border-radius: 8px;
    color: var(--accent-primary);
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.duration-dropdown-btn:hover {
    background: rgba(var(--accent-primary-rgb), 0.2);
    border-color: rgba(var(--accent-primary-rgb), 0.4);
}

.duration-dropdown-btn i {
    font-size: 0.625rem;
    transition: transform 0.2s ease;
}

.duration-dropdown-btn.active i {
    transform: rotate(180deg);
}

.popover-calendar-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.2s ease;
}

.popover-calendar-icon:hover {
    color: var(--accent-primary);
    border-color: rgba(var(--accent-primary-rgb), 0.3);
    background: rgba(var(--accent-primary-rgb), 0.08);
}

/* ─────────────────────────────────────────────────────────────────────────────
   DURATION DROPDOWN
   ─────────────────────────────────────────────────────────────────────────────
   Preset days selection dropdown
*/
.duration-dropdown {
    position: absolute;
    top: 64px;
    right: 24px;
    background: #1e1e24;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.4);
    z-index: 210;
    min-width: 180px;
    overflow: hidden;
    padding: 6px;
}

.duration-option {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.15s ease;
}

.duration-option:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
}

.duration-option.active {
    background: rgba(var(--accent-primary-rgb), 0.15);
    color: var(--accent-primary);
}

.duration-option-custom {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 6px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 0 0 8px 8px;
}

.duration-option-custom span {
    flex-shrink: 0;
    font-weight: 500;
}

.duration-option-custom input {
    flex: 1;
    width: 80px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: #ffffff;
    font-size: 0.875rem;
    font-weight: 500;
    text-align: center;
}

.duration-option-custom input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.duration-option-custom input:focus {
    border-color: var(--accent-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(var(--accent-primary-rgb), 0.15);
}

/* ─────────────────────────────────────────────────────────────────────────────
   CALENDAR CONTAINER (Two-Month View)
   ─────────────────────────────────────────────────────────────────────────────
   Side-by-side months with premium spacing
*/
.calendar-container {
    display: flex;
    gap: 32px;
    padding: 24px 28px;
}

.calendar-month {
    flex: 1;
    min-width: 240px;
}

/* ─────────────────────────────────────────────────────────────────────────────
   MONTH HEADER & NAVIGATION
   ─────────────────────────────────────────────────────────────────────────────
   Clean navigation with subtle arrow icons
*/
.calendar-month-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 0 4px;
}

.calendar-month-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #ffffff;
    letter-spacing: 0.02em;
}

.calendar-nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    transition: all 0.2s ease;
}

.calendar-nav-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.9);
}

.calendar-nav-btn i {
    font-size: 0.75rem;
}

/* ─────────────────────────────────────────────────────────────────────────────
   WEEKDAY LABELS
   ─────────────────────────────────────────────────────────────────────────────
   Muted secondary labels
*/
.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 8px;
}

.calendar-weekdays span {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    font-size: 0.75rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.35);
    text-transform: capitalize;
    letter-spacing: 0.03em;
}

/* ─────────────────────────────────────────────────────────────────────────────
   DATE CELLS
   ─────────────────────────────────────────────────────────────────────────────
   Rounded cells with smooth hover and selection states
*/
.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.calendar-day {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.75);
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.calendar-day:hover:not(.disabled):not(.empty) {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.calendar-day.empty {
    cursor: default;
    pointer-events: none;
}

.calendar-day.disabled {
    color: rgba(255, 255, 255, 0.2);
    cursor: not-allowed;
}

.calendar-day.today {
    color: var(--accent-primary);
    font-weight: 600;
    position: relative;
}

.calendar-day.today::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    background: var(--accent-primary);
    border-radius: 50%;
}

/* ─────────────────────────────────────────────────────────────────────────────
   SELECTED RANGE STYLING
   ─────────────────────────────────────────────────────────────────────────────
   Amber accent for start/end, softer orange band for in-range
*/
.calendar-day.selected {
    background: var(--accent-primary) !important;
    color: #1a1a1f !important;
    font-weight: 600;
}

.calendar-day.in-range {
    background: rgba(var(--accent-primary-rgb), 0.2);
    color: var(--accent-primary);
    border-radius: 0;
}

.calendar-day.range-start {
    border-radius: 8px 0 0 8px;
}

.calendar-day.range-end {
    border-radius: 0 8px 8px 0;
}

.calendar-day.range-start.range-end {
    border-radius: 8px;
}

/* Ensure smooth visual flow for range */
.calendar-day.in-range:first-child,
.calendar-day.range-start {
    margin-left: 0;
}

/* ─────────────────────────────────────────────────────────────────────────────
   POPOVER FOOTER
   ─────────────────────────────────────────────────────────────────────────────
   Clear (low-emphasis) and Apply (high-emphasis CTA)
*/
.date-popover-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 28px;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.date-action-btn {
    padding: 12px 28px;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

/* Clear Button — Low emphasis, text-like */
.date-clear-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.6);
}

.date-clear-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

/* Apply Button — High emphasis, primary CTA */
.date-apply-btn {
    background: var(--accent-primary);
    border: none;
    color: #1a1a1f;
    min-width: 100px;
}

.date-apply-btn:hover {
    background: #e6a817;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(var(--accent-primary-rgb), 0.3);
}

.date-apply-btn:active {
    transform: translateY(0);
}

.date-apply-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ─────────────────────────────────────────────────────────────────────────────
   VALIDATION MESSAGE
   ─────────────────────────────────────────────────────────────────────────────
   Error state with danger accent
*/
.date-validation-msg {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    padding: 12px 18px;
    background: rgba(220, 53, 69, 0.1);
    border: 1px solid rgba(220, 53, 69, 0.3);
    border-radius: 10px;
    color: #dc3545;
    font-size: 0.875rem;
    font-weight: 500;
}

.date-validation-msg i {
    flex-shrink: 0;
    font-size: 1rem;
}

/* ─────────────────────────────────────────────────────────────────────────────
   GUIDANCE NOTES — Micro-guidance for onboarding
   ─────────────────────────────────────────────────────────────────────────────
   Subtle, helpful notes that appear on the homepage to guide users.
*/

/* Date Range Guidance Note */
.guidance-note {
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
}

.guidance-note-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 6px;
}

.guidance-note-header i {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.4);
}

.guidance-note-text {
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.55);
    line-height: 1.5;
    margin: 0;
}

/* Decision Guide Assistant Note */
.decision-guide-note {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 20px;
    background: rgba(var(--accent-primary-rgb), 0.04);
    border: 1px solid rgba(var(--accent-primary-rgb), 0.1);
    border-radius: 10px;
}

.decision-guide-note-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(var(--accent-primary-rgb), 0.1);
    border-radius: 8px;
    color: var(--accent-primary);
    font-size: 1rem;
}

.decision-guide-note-content {
    flex: 1;
}

.decision-guide-note-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.75);
    margin-bottom: 4px;
}

.decision-guide-note-text {
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.5);
    line-height: 1.55;
    margin: 0;
}


/* ═══════════════════════════════════════════════════════════════════════════════
   AD TYPE MIX — Campaign State Filter (Dropdown)
   ═══════════════════════════════════════════════════════════════════════════════ */

.adtype-filter-toolbar {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.adtype-filter-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: #ffffff;
    white-space: nowrap;
}

.adtype-filter-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background: var(--bg-base, #0d1117)
        url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%23ffffff' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
        no-repeat right 10px center;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    color: #ffffff;
    font-size: 0.8125rem;
    font-family: inherit;
    padding: 6px 28px 6px 12px;
    cursor: pointer;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    min-width: 150px;
}

.adtype-filter-select::-ms-expand {
    display: none;
}

.adtype-filter-select:hover {
    border-color: rgba(255, 255, 255, 0.3);
}

.adtype-filter-select:focus {
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.15);
}

.adtype-filter-select:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.adtype-filter-select option {
    background: var(--bg-base, #0d1117);
    color: #ffffff;
}

.adtype-filter-hint {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.45);
    font-style: italic;
    white-space: nowrap;
}


/* ═══════════════════════════════════════════════════════════════════════════════
   END OF APP.CSS
   ═══════════════════════════════════════════════════════════════════════════════
*/