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

:root {

    /* Percept Agent Palette - Cool Minimal Perceptual */
    /* Roles
       - Primary Base: Neutral Background #F5F6F7
       - Depth Base: Graphite Gray #A1A1A1
       - Highlight: Pure White #FFFFFF
       - Accent: Cool Light Highlight #DDE3EA (perceptual)
       - Brand Glow: Perceptual Light Shimmer #E3E8ED
    */
    --base-soft-silver: #D8D8D8;
    --depth-graphite-gray: #A1A1A1;
    --highlight-white: #FFFFFF;
    --accent-warm-glow: #DDE3EA;
    --tint-arctic-blue: #C9DFF5;
    --bg-neutral: #F5F6F7;
    --brand-glow: #E3E8ED;

    /* Surfaces */
    --surface: var(--base-soft-silver);

    /* Neumorphic Shadows - Refined for softer depth */
    --neu-light: var(--highlight-white);
    --neu-dark: rgba(161, 161, 161, 0.55);

    /* Material Gradients (micro-contrast) */
    --gradient-platinum: linear-gradient(145deg, #F8F9FA 0%, #E6E7EB 100%);
    --gradient-graphite: linear-gradient(145deg, #BFC3C8 0%, #8E8E93 100%);
    --gradient-accent: linear-gradient(145deg, #FFFFFF 0%, #DDE3EA 100%);
    --gradient-tint: linear-gradient(145deg, #FFFFFF 0%, #C9DFF5 100%);

    /* Jony Ive Refined Color Palette - Subtle Material Tones */
    --space-gray: #636366;        /* Darker neutral for emphasis */
    --slate-blue: #B5BCC9;        /* Muted blue-gray for info states */
    --sage-green: #C7D3C0;        /* Very muted green for success/active */
    --champagne: #E8DDD0;         /* Soft warm highlight */
    --rose-gold: #D4C4BC;         /* Subtle warm accent */
    --copper: #C9B5A0;            /* Muted orange-brown for caution */
    --titanium: #E5E5E7;          /* Light metallic gray */
    --obsidian: #2C2C2E;          /* Deep charcoal for critical states */
    
    /* Semantic Colors - Monochrome Perceptual Signals */
    --color-active: var(--sage-green);
    --color-info: #B3B3B3;
    --color-warning: #B3B3B3;
    --color-critical: #5E5E5E;
    --color-accent: var(--brand-glow);
    
    /* Legacy semantic mappings - Monochrome */
    --success: var(--sage-green);
    --warning: #B3B3B3;
    --danger: #5E5E5E;

    /* Typography - Percept Agent Accessibility */
    --color-mist-silver: #E6E7EB; /* Headers on dark backgrounds */
    --color-graphite-gray: #8E8E93; /* Supporting/tertiary text */
    --color-ice-blue: #A8B5C4; /* Captions - darker for better visibility */
    --text-primary: #3C3C3C; /* Main text - dark graphite (6.5:1 contrast) */
    --text-secondary: #606366; /* Subtle contrast (5.2:1 contrast) */
    --text-tertiary: #8E8E93; /* Muted supporting text (4.8:1 contrast) */
    --text-inverse: #4d73bf ;
    
    /* Typography Families - Percept Agent Hierarchy */
    --font-display: 'Söhne', 'Inter', 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
    --font-text: 'Inter', 'Helvetica Neue', -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif;

    /* Layout — shell (mobile-first tokens; desktop overrides in min-width) */
    --header-height: 4rem;
    /* Actual offset below fixed header; JS syncs to measured height when header wraps */
    --shell-header-offset: var(--header-height);
    --sidebar-width: 16.25rem;
    --main-pad-x: 1.25rem;
    --main-pad-y: 1.5rem;
    --main-pad-sidebar-gap: 3.5rem;
}

html {
    min-height: 100%;
    background: var(--bg-neutral);
}

body {
    min-height: 100%;
    font-family: var(--font-text);
    font-weight: 300;
    letter-spacing: 0.01em;
    background: var(--bg-neutral);
    color: var(--color-graphite-gray);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Scrollbar - Minimal */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--text-tertiary);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Header - Neumorphic with Clean Lines */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    min-height: var(--header-height);
    height: auto;
    background: var(--surface);
    box-shadow: 
        6px 6px 12px var(--neu-dark),
        -6px -6px 12px var(--neu-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    row-gap: 0.5rem;
    padding: 0 1rem;
    z-index: 1000;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
}

button.nav-menu-toggle {
    display: none;
    flex-shrink: 0;
}

.nav-menu-icon {
    width: 18px;
    height: 18px;
}

.nav-overlay {
    display: none;
}

/* Navigation Controls */
.nav-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#back-button {
    display: none;
}

#location-dropdown {
    display: none;
}

.location-dropdown-title {
    font-weight: 500;
}

.warmup-status,
.keepwarm-indicator {
    display: none;
}

/* Location Selector / Zoom Controls */
.location-selector {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: relative;
    flex: 1;
    min-width: 0;
}

.location-select-wrapper {
    position: relative;
    flex: 1;
    min-width: 0;
    max-width: min(100%, 28rem);
}

.location-select-btn {
    min-width: 0;
    width: 100%;
    max-width: 100%;
    padding: 0.625rem 1rem !important;
    font-size: 0.8125rem !important;
    border-radius: 10px !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    border: none;
    text-align: left;
}

.location-select-btn #location-display {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.location-select-btn svg {
    color: var(--text-secondary);
    transition: transform 0.3s ease;
}

.location-select-btn:hover svg {
    color: var(--text-primary);
}

.location-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    min-width: 0;
    width: min(100vw - 2rem, 28rem);
    max-width: min(100vw - 2rem, 28rem);
    max-height: min(31.25rem, 70vh);
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1001;
    padding: 1rem !important;
}

.location-dropdown::-webkit-scrollbar {
    width: 6px;
}

.location-dropdown::-webkit-scrollbar-track {
    background: transparent;
}

.location-dropdown::-webkit-scrollbar-thumb {
    background: var(--text-tertiary);
    border-radius: 3px;
}

.location-dropdown::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

.location-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.location-search-bar {
    margin-bottom: 12px;
}

.location-search-bar .neu-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    transition: all 0.2s ease;
}

.location-search-bar .neu-input:focus {
    transform: translateY(-1px);
    box-shadow: 
        3px 3px 6px var(--neu-dark),
        -3px -3px 6px var(--neu-light);
}

.location-clear-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    padding: 4px 8px;
}

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

.location-divider {
    font-size: 11px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 12px 0 8px 0;
    font-weight: 500;
}

.location-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    margin: 4px 0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.location-option:hover {
    background: rgba(60, 60, 60, 0.04);
}

.location-option input[type="checkbox"],
.location-option input[type="radio"] {
    cursor: pointer;
    width: 16px;
    height: 16px;
}

.location-option label {
    cursor: pointer;
    flex: 1;
    font-size: 13px;
    color: var(--text-primary);
}

.location-dropdown-footer {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.location-dropdown-footer .neu-button {
    width: 100%;
    justify-content: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    flex-shrink: 0;
    min-width: 0;
}

.logo-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-text {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Helvetica Neue', sans-serif;
    font-size: 20px;
    font-weight: 400;
    letter-spacing: -0.01em; /* Apple's tight tracking */
    text-transform: none;
    /* "Different" in Space Gray with subtle shimmer */
    background: linear-gradient(135deg, #86868B 0%, #636366 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-text strong {
    font-weight: 600; /* Apple semibold */
    /* "Perspective" in vibrant Apple Blue to Orange gradient */
    background: linear-gradient(135deg, #007AFF 0%, #5E5CE6 50%, #FF9500 100%); 
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 20px rgba(0, 122, 255, 0.3); /* Subtle glow */
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

.header-stats {
    display: flex;
    gap: 28px;
}

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

.stat-label {
    font-size: 10px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 400;
}

.stat-value {
    font-size: 15px;
    color: var(--text-primary);
    font-weight: 300;
    letter-spacing: 0.01em;
    margin-top: 3px;
}

.status-online {
    color: var(--graphite);
}

.header-actions {
    display: flex;
    gap: 12px;
}

/* Toolbar overflow: desktop = inline row; mobile = single trigger + dropdown panel */
.header-overflow-toggle {
    display: none;
}

.header-actions-dropdown {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 0;
    margin: 0;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    border: none;
}

.header-actions-dropdown.neu-card {
    transition: none;
}

.header-actions-dropdown.neu-card:hover {
    box-shadow: none;
}

.neu-icon-button {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--surface);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 
        5px 5px 10px var(--neu-dark),
        -5px -5px 10px var(--neu-light);
    transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.neu-icon-button svg {
    width: 18px;
    height: 18px;
    color: var(--graphite);
    stroke-width: 1.5px;
}

.neu-icon-button:hover {
    box-shadow: 
        7px 7px 14px var(--neu-dark),
        -7px -7px 14px var(--neu-light);
}

.neu-icon-button.active {
    background: var(--gradient-accent);
    box-shadow: 
        inset 3px 3px 6px rgba(0, 0, 0, 0.15),
        inset -3px -3px 6px rgba(255, 255, 255, 0.1),
        0 0 12px var(--brand-glow);
}

.neu-icon-button:active {
    box-shadow: 
        inset 4px 4px 8px var(--neu-dark),
        inset -4px -4px 8px var(--neu-light);
}

.notification-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: var(--gradient-graphite);
    color: var(--text-inverse);
    font-size: 10px;
    font-weight: 500;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 
        3px 3px 6px rgba(0, 0, 0, 0.3),
        -1px -1px 3px rgba(255, 255, 255, 0.1);
}

/* App Container */
.app-container {
    display: flex;
    padding-top: var(--shell-header-offset);
    min-height: 100vh;
}

/* Sidebar - Neumorphic Navigation */
.sidebar {
    position: fixed;
    left: 0;
    top: var(--shell-header-offset);
    width: var(--sidebar-width);
    height: calc(100vh - var(--shell-header-offset));
    background: var(--surface);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    box-shadow: 
        8px 0 16px var(--neu-dark),
        -2px 0 8px var(--neu-light);
    z-index: 999;
    overflow-x: hidden;
    overflow-y: auto;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border-radius: 12px;
    background: var(--surface);
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 400;
    letter-spacing: 0.02em;
    color: var(--text-secondary);
    transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    box-shadow: 
        5px 5px 10px var(--neu-dark),
        -5px -5px 10px var(--neu-light);
}

.sidebar-item:hover {
    color: var(--text-primary);
    box-shadow: 
        7px 7px 14px var(--neu-dark),
        -7px -7px 14px var(--neu-light);
}

.sidebar-item.active {
    background: var(--gradient-graphite);
    color: var(--text-inverse);
    box-shadow: 
        inset 3px 3px 6px rgba(0, 0, 0, 0.25),
        inset -3px -3px 6px rgba(255, 255, 255, 0.1),
        5px 5px 10px var(--neu-dark),
        0 0 8px var(--brand-glow);
}

.sidebar-icon {
    width: 18px;
    height: 18px;
    stroke-width: 1.5px;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 24px;
}

.system-info {
    padding: 14px;
    background: var(--surface);
    border-radius: 12px;
    box-shadow: 
        inset 3px 3px 6px var(--neu-dark),
        inset -3px -3px 6px var(--neu-light);
}

.info-card {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    padding: 8px;
    background: var(--surface);
    border-radius: 8px;
    box-shadow: 
        2px 2px 4px var(--neu-dark),
        -2px -2px 4px var(--neu-light);
}

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

.info-icon {
    width: 16px;
    height: 16px;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.info-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.info-label {
    font-family: var(--font-display);
    font-size: 8px;
    color: var(--color-ice-blue);
    text-transform: lowercase;
    letter-spacing: 0.08em;
    font-weight: 300;
    font-style: italic;
}

.info-value {
    font-size: 11px;
    font-weight: 300;
    letter-spacing: 0.01em;
    color: var(--text-primary);
}

/* Main Content - Spacious & Elevated (mobile-first) */
.main-content {
    flex: 1;
    margin-left: 0;
    padding: var(--main-pad-y) var(--main-pad-x);
    background: var(--surface);
    min-height: calc(100vh - var(--shell-header-offset));
    width: 100%;
    max-width: 100%;
}

/* Back to top - fixed bottom-right */
.back-to-top-btn {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 90;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 18px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    background: var(--surface);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    box-shadow:
        6px 6px 12px var(--neu-dark),
        -6px -6px 12px var(--neu-light);
    transition: opacity 0.25s ease, visibility 0.25s ease, transform 0.2s ease, box-shadow 0.2s ease;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.back-to-top-btn.visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.back-to-top-btn:hover {
    transform: translateY(-2px);
    box-shadow:
        8px 8px 16px var(--neu-dark),
        -8px -8px 16px var(--neu-light);
}

.back-to-top-btn:active {
    transform: translateY(0);
    box-shadow:
        inset 3px 3px 6px var(--neu-dark),
        inset -3px -3px 6px var(--neu-light);
}

.back-to-top-btn svg {
    flex-shrink: 0;
}

.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: calc(100vh - 140px);
    gap: 24px;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--surface);
    box-shadow: 
        inset 4px 4px 8px var(--neu-dark),
        inset -4px -4px 8px var(--neu-light);
    position: relative;
}

.loading-spinner::before {
    content: '';
    position: absolute;
    top: 5px;
    left: 5px;
    right: 5px;
    bottom: 5px;
    border-radius: 50%;
    border: 3px solid transparent;
    border-top-color: var(--graphite);
    animation: spin 0.8s cubic-bezier(0.4, 0.0, 0.2, 1) infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-container p {
    font-size: 15px;
    color: var(--text-secondary);
    font-weight: 300;
    letter-spacing: 0.02em;
}

/* Neumorphic Components - Perfect Geometry */
.neu-card {
    background: var(--surface);
    border-radius: 20px;
    padding: 32px;
    box-shadow: 
        10px 10px 20px var(--neu-dark),
        -10px -10px 20px var(--neu-light);
    transition: all 0.4s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.neu-card:hover {
    box-shadow: 
        14px 14px 28px var(--neu-dark),
        -14px -14px 28px var(--neu-light);
}

.neu-button {
    background: var(--surface);
    border: none;
    border-radius: 12px;
    padding: 13px 32px;
    color: var(--text-primary);
    font-weight: 400;
    font-size: 13px;
    letter-spacing: 0.03em;
    cursor: pointer;
    box-shadow: 
        6px 6px 12px var(--neu-dark),
        -6px -6px 12px var(--neu-light);
    transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.neu-button:hover {
    box-shadow: 
        8px 8px 16px var(--neu-dark),
        -8px -8px 16px var(--neu-light);
    transform: translateY(-1px);
}

.neu-button:active {
    transform: translateY(0);
    box-shadow: 
        inset 4px 4px 8px var(--neu-dark),
        inset -4px -4px 8px var(--neu-light);
}

.neu-button.primary {
    background: var(--gradient-graphite);
    color: var(--text-inverse);
    box-shadow: 
        6px 6px 12px var(--neu-dark),
        -3px -3px 8px var(--neu-light),
        inset 0 0.5px 0 rgba(255, 255, 255, 0.05);
}

.neu-button.primary:hover {
    box-shadow: 
        8px 8px 16px var(--neu-dark),
        -4px -4px 10px var(--neu-light),
        inset 0 0.5px 0 rgba(255, 255, 255, 0.05),
        0 0 8px var(--brand-glow);
}

.neu-button.primary:active {
    box-shadow: 
        inset 4px 4px 8px rgba(0, 0, 0, 0.25),
        inset -2px -2px 6px rgba(255, 255, 255, 0.05);
}

.neu-input {
    background: var(--surface);
    border: none;
    border-radius: 12px;
    padding: 14px 20px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 300;
    letter-spacing: 0.01em;
    box-shadow: 
        inset 5px 5px 10px var(--neu-dark),
        inset -5px -5px 10px var(--neu-light);
    transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    width: 100%;
}

.neu-input:focus {
    outline: none;
    box-shadow: 
        inset 6px 6px 12px var(--neu-dark),
        inset -6px -6px 12px var(--neu-light),
        0 0 8px var(--brand-glow);
}

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

/* Accent & Tint Utilities (subtle, premium) */
.badge-insight {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    background: var(--gradient-accent);
    color: #6B4A35;
    font-size: 12px;
    font-weight: 400;
    box-shadow:
        4px 4px 8px rgba(161, 161, 161, 0.35),
        -4px -4px 8px rgba(255, 255, 255, 0.6),
        inset 0 1px 0 rgba(255,255,255,0.5);
}

.accent-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--brand-glow);
    box-shadow: 0 0 10px var(--brand-glow);
}

.panel-tinted {
    background: var(--surface);
    box-shadow:
        10px 10px 20px var(--neu-dark),
        -10px -10px 20px var(--neu-light),
        inset 0 0 0 1px rgba(201, 223, 245, 0.35);
}

.stroke-tint {
    border: 1px solid rgba(201, 223, 245, 0.45);
}

/* Typography - Light & Spacious - Percept Agent */
.page-title {
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 5vw + 0.5rem, 2.5rem);
    font-weight: 400;
    letter-spacing: 0.015em;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    line-height: 1.15;
}

.page-subtitle {
    font-family: var(--font-display);
    font-size: clamp(0.8125rem, 2vw + 0.5rem, 0.9375rem);
    color: var(--color-ice-blue);
    font-weight: 300;
    font-style: italic;
    letter-spacing: 0.02em;
    line-height: 1.4;
    margin-bottom: 2rem;
    text-transform: lowercase;
}

.card-title {
    font-family: var(--font-display);
    font-size: clamp(1.0625rem, 2.2vw, 1.25rem);
    font-weight: 500;
    letter-spacing: 0.02em;
    color: var(--text-primary);
    margin-bottom: 20px;
}

/* Desktop shell: sidebar visible, main offset, wider header */
@media (min-width: 1025px) {
    :root {
        --main-pad-x: 3.5rem;
        --main-pad-y: 3rem;
    }

    .header {
        display: flex;
        flex-wrap: nowrap;
        padding: 0 3rem;
    }

    .header-left {
        display: flex;
        gap: 2rem;
        flex: 1;
    }

    .header-right {
        display: flex;
        gap: 1.75rem;
    }

    .location-selector {
        flex: 0 1 auto;
    }

    .location-select-wrapper {
        max-width: min(28rem, 40vw);
    }

    .location-select-btn {
        min-width: 20rem;
    }

    .header-overflow-toggle {
        display: none !important;
    }

    .header-actions-dropdown {
        display: flex !important;
        flex-direction: row;
        position: static;
        padding: 0;
        margin: 0;
        background: transparent;
        border-radius: 0;
        box-shadow: none;
        visibility: visible;
    }

    .location-dropdown {
        width: auto;
        right: auto;
        min-width: min(25rem, 90vw);
        max-width: min(28.125rem, 92vw);
    }

    .main-content {
        padding: var(--main-pad-y) var(--main-pad-x) var(--main-pad-y)
            calc(var(--sidebar-width) + var(--main-pad-sidebar-gap));
    }

    .page-subtitle {
        margin-bottom: 2.25rem;
    }
}

/* Tablet / mobile: drawer nav, compact header */
@media (max-width: 1024px) {
    .header {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr) auto auto;
        grid-template-rows: auto auto;
        column-gap: 0.35rem;
        row-gap: 0.5rem;
        align-items: center;
        justify-content: stretch;
        padding-top: max(0.625rem, env(safe-area-inset-top, 0px));
        padding-bottom: 0.625rem;
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .header-left,
    .header-right {
        display: contents;
    }

    button.nav-menu-toggle {
        display: flex;
        grid-column: 1;
        grid-row: 1;
    }

    .header .logo {
        grid-column: 2;
        grid-row: 1;
        justify-self: center;
        min-width: 0;
        max-width: 100%;
    }

    .nav-controls {
        grid-column: 3;
        grid-row: 1;
    }

    .location-selector {
        grid-column: 1 / -1;
        grid-row: 2;
        gap: 0.5rem;
        flex: none;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        justify-content: center;
        align-items: center;
    }

    .location-selector .location-select-wrapper {
        flex: 0 1 auto;
        min-width: 0;
        max-width: min(100%, 20rem);
    }

    /* Center panel on trigger so viewport-wide width does not clip past the right edge */
    .location-dropdown {
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        width: min(
            calc(100vw - 2rem - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)),
            28rem
        );
        max-width: calc(
            100vw - 2rem - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)
        );
        box-sizing: border-box;
    }

    .header-actions {
        grid-column: 4;
        grid-row: 1;
        position: relative;
        flex-wrap: wrap;
        justify-content: flex-end;
        gap: 0.5rem;
    }

    .header-overflow-toggle {
        display: flex;
    }

    .header-actions-dropdown {
        display: none;
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
        position: absolute;
        top: calc(100% + 0.5rem);
        right: 0;
        left: auto;
        padding: 0.75rem;
        border-radius: 16px;
        background: var(--surface);
        box-shadow:
            8px 8px 16px var(--neu-dark),
            -4px -4px 12px var(--neu-light);
        z-index: 1001;
        min-width: 3.25rem;
    }

    .header-actions-dropdown .neu-icon-button {
        flex-shrink: 0;
    }

    .header-actions.header-actions--open .header-actions-dropdown {
        display: flex;
    }

    /* Zoom +/- redundant on small screens; keep demo toggle + location dropdown visible */
    #zoom-out-btn,
    #zoom-in-btn {
        display: none !important;
    }

    .nav-overlay {
        display: block;
        position: fixed;
        left: 0;
        right: 0;
        top: var(--shell-header-offset);
        bottom: 0;
        z-index: 998;
        background: rgba(42, 42, 46, 0.42);
        backdrop-filter: blur(3px);
        -webkit-backdrop-filter: blur(3px);
        opacity: 0;
        pointer-events: none;
        visibility: hidden;
        transition: opacity 0.22s ease, visibility 0.22s ease;
    }

    body.nav-open .nav-overlay {
        opacity: 1;
        pointer-events: auto;
        visibility: visible;
    }

    body.nav-open {
        overflow: hidden;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow:
            8px 0 24px var(--neu-dark),
            -2px 0 8px var(--neu-light);
    }

    body.nav-open .sidebar {
        transform: translateX(0);
    }

    .header-stats {
        display: none;
    }
}

@media (min-width: 1025px) {
    .nav-overlay {
        display: none !important;
    }
}

/* Reports View Styles */
.reports-container {
    width: 100%;
    min-width: 0;
    max-width: 100%;
}

.reports-page-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem 1rem;
    margin-bottom: 30px;
    min-width: 0;
}

.reports-page-header .page-title,
.reports-page-header .page-subtitle {
    min-width: 0;
}

.reports-page-header .page-subtitle {
    flex: 1 1 auto;
    text-align: right;
}

#reports-body {
    min-width: 0;
    max-width: 100%;
}

.reports-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 28rem), 1fr));
    gap: 1.5rem;
    padding: 0;
    width: 100%;
    min-width: 0;
    max-width: 100%;
}

.report-card {
    padding: 24px;
    border-radius: 16px;
    transition: all 0.3s ease;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

.report-card:hover {
    transform: translateY(-2px);
}

.report-header {
    margin-bottom: 20px;
}

.report-title {
    font-size: 18px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.report-subtitle {
    font-size: 13px;
    color: var(--text-tertiary);
}

.report-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
    min-width: 0;
}

.metric-box {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.metric-label {
    font-size: 11px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.metric-value {
    font-size: 20px;
    font-weight: 400;
    color: var(--text-primary);
}

.metric-change {
    font-size: 12px;
    font-weight: 500;
}

.metric-change.up {
    color: var(--sage-green);
}

.metric-change.down {
    color: var(--copper);
}

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

.report-chart-container {
    margin-bottom: 20px;
    border-radius: 12px;
    padding: 16px;
    background: linear-gradient(145deg, #FAFAFA, #F0F0F0);
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
    box-sizing: border-box;
}

.report-chart {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
}

.report-expand-btn {
    width: 100%;
    padding: 12px;
    font-size: 13px;
}

/* ── Notification Alert Panel ── */
.notif-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: min(380px, 100vw);
    height: 100vh;
    z-index: 9100;
    display: flex;
    flex-direction: column;
    background: var(--bg-neutral);
    border-left: 1px solid rgba(0,0,0,0.07);
    box-shadow: -8px 0 32px rgba(0,0,0,0.12);
    border-radius: 20px 0 0 20px;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.16,1,0.3,1);
    overflow: hidden;
}

.notif-panel.notif-panel-open {
    transform: translateX(0);
}

.notif-panel-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9099;
    background: rgba(0,0,0,0.15);
    backdrop-filter: blur(2px);
}

.notif-panel-overlay.notif-panel-overlay-open {
    display: block;
}

.notif-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    flex-shrink: 0;
}

.notif-panel-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.notif-panel-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.notif-ack-all-btn {
    font-size: 11.5px;
    padding: 5px 10px;
}

.notif-panel-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.notif-empty {
    padding: 32px 20px;
    text-align: center;
    font-size: 13px;
    color: var(--text-tertiary);
}

.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 20px;
    cursor: pointer;
    border-bottom: 1px solid rgba(0,0,0,0.04);
    transition: background 0.15s;
}

.notif-item:hover {
    background: rgba(0,0,0,0.025);
}

.notif-item.notif-item-read {
    opacity: 0.5;
}

.notif-item-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 5px;
}

.notif-sev-critical { background: #e74c3c; }
.notif-sev-high     { background: #e67e22; }

.notif-item-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.notif-item-type {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    text-transform: capitalize;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notif-item-meta {
    font-size: 11.5px;
    color: var(--text-tertiary);
    text-transform: capitalize;
}

.notif-item-sev {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 2px 7px;
    border-radius: 10px;
    background: rgba(0,0,0,0.06);
    flex-shrink: 0;
}

.notif-sev-critical.notif-item-sev { background: rgba(231,76,60,0.12); color: #c0392b; }
.notif-sev-high.notif-item-sev     { background: rgba(230,126,34,0.12); color: #d35400; }

#notif-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 16px;
    height: 16px;
    background: #e74c3c;
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    border-radius: 8px;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    line-height: 1;
}

@keyframes notifPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

.notif-badge-pulse {
    animation: notifPulse 2s ease-in-out infinite;
}

/* ── Report Detail Panel (slide-out) ── */
.report-detail-panel {
    position: fixed;
    inset: 0;
    z-index: 9000;
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
}

.report-detail-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.18);
    backdrop-filter: blur(3px);
    cursor: pointer;
}

.report-detail-content {
    position: relative;
    z-index: 1;
    width: min(680px, 95vw);
    height: 100vh;
    overflow-y: auto;
    border-radius: 20px 0 0 20px;
    padding: 32px 28px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    animation: slideInFromRight 0.3s cubic-bezier(0.16,1,0.3,1);
}

@keyframes slideInFromRight {
    from { transform: translateX(100%); opacity: 0; }
    to   { transform: translateX(0);   opacity: 1; }
}

.report-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.report-detail-title {
    font-size: 20px;
    font-weight: 500;
    color: var(--text-primary);
    margin: 0 0 4px;
}

.report-detail-subtitle {
    font-size: 13px;
    color: var(--text-tertiary);
    margin: 0;
}

.report-detail-close {
    flex-shrink: 0;
}

.report-detail-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 14px;
}

.report-detail-chart-wrap {
    border-radius: 12px;
    padding: 16px;
    background: linear-gradient(145deg, #FAFAFA, #F0F0F0);
}

.report-detail-chart-wrap canvas {
    display: block;
    width: 100%;
    height: auto;
}

.report-detail-table-wrap {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,0.06);
}

.report-detail-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.report-detail-table th {
    background: rgba(0,0,0,0.04);
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(0,0,0,0.07);
    white-space: nowrap;
}

.report-detail-table td {
    padding: 9px 14px;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(0,0,0,0.04);
}

.report-detail-table tr:last-child td {
    border-bottom: none;
}

.report-detail-table tr:hover td {
    background: rgba(0,0,0,0.025);
}

.report-detail-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding-top: 4px;
}

.report-detail-note {
    font-size: 11.5px;
    color: var(--text-tertiary);
}

.report-detail-export {
    font-size: 12.5px;
    padding: 8px 16px;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .header {
        padding-top: max(0.625rem, env(safe-area-inset-top, 0px));
        padding-bottom: 0.625rem;
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .header-actions {
        gap: 0.35rem;
    }

    .header .neu-icon-button {
        width: 2.75rem;
        height: 2.75rem;
    }

    .sidebar {
        padding: 1.5rem 1rem;
    }

    .main-content {
        padding: 1.25rem 0.875rem;
    }

    .logo-text {
        font-size: clamp(0.9375rem, 4vw, 1.0625rem);
    }

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

    .report-metrics {
        grid-template-columns: 1fr;
    }

    .reports-page-header .page-subtitle {
        text-align: left;
        flex: 1 1 100%;
    }
}
