/* DarkMode Button Fixed Bottom-Right */
.darkmode-fixed {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 9999;
    background: var(--surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast);
}
.darkmode-fixed:hover {
    background: var(--surface-hover);
    color: var(--primary);
}
/* ============================================
   FrictionalBank - Modern Bento Dashboard
   ============================================ */

/* CSS Variables */
:root {
    /* Colors */
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --accent: #06b6d4;
    --success: #10b981;
    --success-light: #34d399;
    --warning: #f59e0b;
    --warning-light: #fbbf24;
    --danger: #ef4444;
    --danger-light: #f87171;
    --purple: #8b5cf6;
    --pink: #ec4899;
    
    /* Dark Theme (Default) */
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a24;
    --surface: rgba(255, 255, 255, 0.03);
    --surface-hover: rgba(255, 255, 255, 0.06);
    --glass-bg: rgba(20, 20, 30, 0.8);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    /* Spacing */
    --sidebar-width: 240px;
    --header-height: 64px;
    --gap: 16px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.3);

    /* Card & Component Colors */
    --card-bg: rgba(255, 255, 255, 0.04);
    --card-bg-secondary: rgba(255, 255, 255, 0.02);
    --card-bg-hover: rgba(255, 255, 255, 0.08);
    --border-color: rgba(255, 255, 255, 0.1);

    /* Accent Colors (aliases) */
    --accent-primary: var(--primary);
    --accent-primary-transparent: rgba(99, 102, 241, 0.15);
    --error: var(--danger);
}

/* Light Theme */
body.light-theme {
    --bg-primary: #f4f6fa;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #e9eef3;
    --surface: rgba(30, 41, 59, 0.04);
    --surface-hover: rgba(30, 41, 59, 0.08);
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(30, 41, 59, 0.08);
    --glass-shadow: 0 8px 32px rgba(30, 41, 59, 0.08);
    --text-primary: #27364a;
    --text-secondary: #5c6a7d;
    --text-muted: #a0aec0;

    /* Card & Component Colors (Light) */
    --card-bg: rgba(30, 41, 59, 0.04);
    --card-bg-secondary: rgba(30, 41, 59, 0.02);
    --card-bg-hover: rgba(30, 41, 59, 0.08);
    --border-color: rgba(30, 41, 59, 0.12);
    --accent-primary-transparent: rgba(99, 102, 241, 0.1);
}

/* OLED Theme - True Black */
body.oled-theme {
    --bg-primary: #000000;
    --bg-secondary: #0a0a0a;
    --bg-tertiary: #111111;
    --surface: rgba(255, 255, 255, 0.02);
    --surface-hover: rgba(255, 255, 255, 0.04);
    --glass-bg: rgba(10, 10, 10, 0.95);
    --glass-border: rgba(255, 255, 255, 0.05);
}

/* Color Scheme Variants */
body[data-accent="cyan"] { --primary: #06b6d4; --primary-light: #22d3ee; --primary-dark: #0891b2; }
body[data-accent="emerald"] { --primary: #10b981; --primary-light: #34d399; --primary-dark: #059669; }
body[data-accent="amber"] { --primary: #f59e0b; --primary-light: #fbbf24; --primary-dark: #d97706; }
body[data-accent="rose"] { --primary: #f43f5e; --primary-light: #fb7185; --primary-dark: #e11d48; }
body[data-accent="violet"] { --primary: #8b5cf6; --primary-light: #a78bfa; --primary-dark: #7c3aed; }

/* High Contrast Mode */
body.high-contrast {
    --text-primary: #ffffff;
    --text-secondary: #e2e8f0;
    --glass-border: rgba(255, 255, 255, 0.2);
}

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

/* Accessibility - Skip Link */
.skip-link {
    position: absolute;
    top: -100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    background: var(--primary);
    color: white;
    border-radius: var(--radius-md);
    z-index: 10000;
    font-weight: 600;
    text-decoration: none;
}

.skip-link:focus {
    top: 16px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ============================================
   Global Form Elements (Select/Input)
   ============================================ */

select,
input[type="text"],
input[type="number"],
input[type="date"],
input[type="email"],
textarea {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
}

select option {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

/* Force dark color scheme for select dropdowns */
select {
    color-scheme: dark;
}

body.light-theme select {
    color-scheme: light;
}

select:focus,
input:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
}

/* Fix for dark mode dropdown in Windows/Chrome */
@supports (-webkit-appearance: none) {
    select {
        -webkit-appearance: none;
        appearance: none;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 8px center;
        padding-right: 28px;
    }
}

/* ============================================
   Animated Background
   ============================================ */

.animated-bg {
    position: fixed;
    inset: 0;
    z-index: -2;
    overflow: hidden;
    background: var(--bg-primary);
}

.gradient-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
    animation: float 20s ease-in-out infinite;
}

.orb-1 {
    width: 600px;
    height: 600px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--purple) 100%);
    top: -200px;
    left: -200px;
    animation-delay: 0s;
}

.orb-2 {
    width: 500px;
    height: 500px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--success) 100%);
    bottom: -150px;
    right: -150px;
    animation-delay: -7s;
}

.orb-3 {
    width: 400px;
    height: 400px;
    background: linear-gradient(135deg, var(--pink) 0%, var(--warning) 100%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -14s;
}

@keyframes float {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    25% {
        transform: translate(50px, -50px) scale(1.1);
    }
    50% {
        transform: translate(-30px, 30px) scale(0.95);
    }
    75% {
        transform: translate(40px, 20px) scale(1.05);
    }
}

body.light-theme .gradient-orb {
    opacity: 0.2;
}

/* Particle Canvas */
#particle-canvas {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
}

/* ============================================
   Glass Effect
   ============================================ */

.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
}

.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--glass-shadow);
    position: relative;
    overflow: hidden;
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.glass-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.glass-heavy {
    background: rgba(15, 15, 25, 0.95);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
}

body.light-theme .glass-heavy {
    background: rgba(255, 255, 255, 0.98);
}

/* Card Glow Effect */
.card-glow {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, var(--primary) 0%, transparent 70%);
    opacity: 0;
    transition: opacity var(--transition-slow);
    pointer-events: none;
}

.card-glow.red { background: radial-gradient(circle at center, var(--danger) 0%, transparent 70%); }
.card-glow.green { background: radial-gradient(circle at center, var(--success) 0%, transparent 70%); }
.card-glow.orange { background: radial-gradient(circle at center, var(--warning) 0%, transparent 70%); }
.card-glow.purple { background: radial-gradient(circle at center, var(--purple) 0%, transparent 70%); }

.glass-card:hover .card-glow {
    opacity: 0.1;
}

/* ============================================
   Command Palette
   ============================================ */

.command-palette-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 15vh;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.command-palette-overlay.active {
    opacity: 1;
    visibility: visible;
}

.command-palette {
    width: 100%;
    max-width: 640px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg), 0 0 60px rgba(99, 102, 241, 0.2);
    transform: translateY(-20px) scale(0.95);
    transition: transform var(--transition-normal);
    overflow: hidden;
}

.command-palette-overlay.active .command-palette {
    transform: translateY(0) scale(1);
}

.command-input-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--glass-border);
}

.command-input-wrapper i {
    font-size: 1.25rem;
    color: var(--text-muted);
}

.command-input-wrapper input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    font-size: 1.125rem;
    color: var(--text-primary);
    font-family: inherit;
}

.command-input-wrapper input::placeholder {
    color: var(--text-muted);
}

.command-results {
    max-height: 400px;
    overflow-y: auto;
    padding: 8px;
}

.command-group {
    margin-bottom: 8px;
}

.command-group-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 8px 12px;
}

.command-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.command-item:hover,
.command-item.selected {
    background: var(--surface-hover);
}

.command-item i {
    width: 20px;
    color: var(--text-secondary);
}

.command-item span {
    flex: 1;
    color: var(--text-primary);
}

.command-item kbd {
    font-size: 0.7rem;
    padding: 4px 8px;
    background: var(--surface);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    color: var(--text-muted);
    font-family: inherit;
}

.command-footer {
    display: flex;
    gap: 16px;
    padding: 12px 20px;
    border-top: 1px solid var(--glass-border);
    background: var(--surface);
}

.command-footer span {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.command-footer kbd {
    font-size: 0.65rem;
    padding: 2px 6px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 4px;
}

/* ============================================
   App Layout
   ============================================ */

.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
    border-right: 1px solid var(--glass-border);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--glass-border);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none !important;
    cursor: pointer;
    transition: opacity var(--transition-fast);
    color: inherit !important;
}

.logo:hover,
.logo:visited,
.logo:active,
.logo:focus {
    text-decoration: none !important;
    color: inherit !important;
}

.logo:hover {
    opacity: 0.85;
}

.logo-icon-wrapper {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--purple));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.logo-title {
    font-size: 1rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--text-primary), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-subtitle {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0; /* Important for flex container to allow shrinking */
}

/* Custom scrollbar for sidebar */
.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 2px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    transition: all var(--transition-fast);
    position: relative;
}

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

.nav-item.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(139, 92, 246, 0.1));
    color: var(--primary-light);
}

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

.nav-indicator {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: var(--primary);
    border-radius: 0 3px 3px 0;
    transition: height var(--transition-fast);
}

.nav-item.active .nav-indicator {
    height: 24px;
}

.nav-divider {
    height: 1px;
    background: var(--glass-border);
    margin: 8px 16px;
}

/* Sidebar Navigation Accordion */
.nav-accordion {
    display: flex;
    flex-direction: column;
}

.nav-accordion-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    width: 100%;
    text-align: left;
    font-size: inherit;
    font-family: inherit;
}

.nav-accordion-header:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}

.nav-accordion-header .accordion-arrow {
    margin-left: auto;
    font-size: 0.75rem;
    transition: transform var(--transition-fast);
}

.nav-accordion.expanded .nav-accordion-header {
    color: var(--primary-light);
}

.nav-accordion.expanded .accordion-arrow {
    transform: rotate(180deg);
}

.nav-accordion-content {
    display: none;
    flex-direction: column;
    gap: 2px;
    padding-left: 12px;
    overflow: hidden;
}

.nav-accordion.expanded .nav-accordion-content {
    display: flex;
}

.nav-sub-item {
    padding: 10px 16px 10px 24px;
    font-size: 0.9rem;
}

.nav-sub-item .nav-icon {
    width: 20px;
    height: 20px;
    font-size: 0.85rem;
}

.nav-sub-item.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.08));
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.command-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.command-trigger:hover {
    background: var(--surface-hover);
    border-color: var(--primary);
    color: var(--text-primary);
}

.command-trigger kbd {
    margin-left: auto;
    font-size: 0.7rem;
    padding: 2px 6px;
    background: var(--bg-tertiary);
    border-radius: 4px;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: pulse 2s ease-in-out infinite;
}

.connection-status.connected .status-dot {
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
    animation: none;
}

.connection-status.error .status-dot {
    background: var(--danger);
    animation: none;
}

/* Task 2.2: Connection status indicator styles */
.connection-status.connecting .status-dot {
    background: var(--warning);
    animation: pulse 1s infinite;
}

.connection-status.reconnecting .status-dot {
    background: var(--warning);
    animation: pulse 0.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    max-width: calc(100vw - var(--sidebar-width));
}

/* Top Bar */
.top-bar {
    height: var(--header-height);
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.top-bar-left {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.page-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.breadcrumb i {
    font-size: 0.6rem;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.last-update {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 6px 12px;
    background: var(--surface);
    border-radius: var(--radius-md);
}

/* Buttons */
.icon-btn {
    position: relative;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

.icon-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.primary-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
    white-space: nowrap;
    flex-shrink: 0;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.chip-btn {
    padding: 6px 12px;
    background: var(--surface);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

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

.chip-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* ============================================
   Views
   ============================================ */

.view {
    display: none;
    padding: 24px;
    flex: 1;
    animation: fadeIn 0.3s ease;
    overflow-x: hidden;
    max-width: 100%;
}

.view.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Celebration Overlay */
.celebration-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(99, 102, 241, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    pointer-events: none;
    animation: celebrationPulse 0.5s ease-out;
}

.celebration-text {
    font-size: 5rem;
    animation: celebrationBounce 0.5s ease-out;
}

.celebration-overlay.fade-out {
    opacity: 0;
    transition: opacity 0.5s ease-out;
}

@keyframes celebrationPulse {
    0% { background: rgba(99, 102, 241, 0.3); }
    100% { background: rgba(99, 102, 241, 0.1); }
}

@keyframes celebrationBounce {
    0% { transform: scale(0.5); opacity: 0; }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

/* ============================================
   Bento Grid
   ============================================ */

.bento-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: auto;
    gap: var(--gap);
}

.bento-grid.single {
    grid-template-columns: 1fr;
}

.bento-item {
    position: relative;
    transition: transform var(--transition-normal);
}

/* Bento Sizes */
.bento-wide {
    grid-column: span 2;
}

.bento-tall {
    /* Height determined by content */
}

.bento-large {
    grid-column: span 2;
}

.bento-full {
    grid-column: span 4;
}

/* Bento Content */
.bento-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--glass-border);
}

.bento-header h3 {
    font-size: 0.875rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
}

.bento-header h3 i {
    color: var(--primary);
}

.bento-actions {
    display: flex;
    gap: 6px;
}

.bento-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* ============================================
   Metric Cards
   ============================================ */

.metric-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 12px;
}

.metric-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: white;
}

.gradient-blue { background: linear-gradient(135deg, var(--primary), var(--accent)); }
.gradient-red { background: linear-gradient(135deg, var(--danger), var(--pink)); }
.gradient-green { background: linear-gradient(135deg, var(--success), #22d3ee); }
.gradient-orange { background: linear-gradient(135deg, var(--warning), var(--danger)); }
.gradient-purple { background: linear-gradient(135deg, var(--purple), var(--primary)); }

.metric-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.metric-badge.positive {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.metric-badge.negative {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.metric-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.metric-body.compact {
    gap: 2px;
}

.metric-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.metric-value-wrapper {
    display: flex;
    align-items: center;
    gap: 16px;
}

.metric-value {
    font-size: 2rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}

.metric-value.counting {
    transition: color var(--transition-fast);
}

.metric-value.positive { color: var(--success); }
.metric-value.negative { color: var(--danger); }

.metric-footer {
    margin-top: auto;
    padding-top: 8px;
}

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

/* Sparkline */
.sparkline {
    flex: 1;
    height: 40px;
    max-width: 120px;
}

/* Mini Chart */
.mini-chart {
    margin-top: auto;
    height: 40px;
    opacity: 0.6;
}

/* Progress Ring */
.progress-ring {
    position: absolute;
    bottom: 16px;
    right: 16px;
    width: 48px;
    height: 48px;
}

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

.ring-bg {
    fill: none;
    stroke: var(--surface);
    stroke-width: 3;
}

.ring-fill {
    fill: none;
    stroke: var(--warning);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    transition: stroke-dashoffset var(--transition-slow);
}

/* XVA Breakdown Bar */
.xva-breakdown {
    margin-top: auto;
}

.xva-bar {
    display: flex;
    height: 6px;
    border-radius: 3px;
    overflow: hidden;
    background: var(--surface);
}

.xva-segment {
    height: 100%;
    transition: width var(--transition-slow);
}

.xva-segment.cva { background: var(--danger); }
.xva-segment.dva { background: var(--success); }
.xva-segment.fva { background: var(--warning); }

/* XVA Components (CVA, DVA, FVA in Total XVA card) */
.xva-components {
    display: flex;
    gap: 1.5rem;
    margin: 1rem 0;
    padding: 0.75rem 0;
    border-top: 1px solid var(--glass-border);
    border-bottom: 1px solid var(--glass-border);
}

.xva-component {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    background: var(--glass-bg);
    transition: transform var(--transition-fast), background var(--transition-fast);
}

.xva-component:hover {
    transform: translateY(-2px);
    background: var(--surface-hover);
}

.xva-component.cva {
    border-left: 3px solid var(--danger);
}

.xva-component.dva {
    border-left: 3px solid var(--success);
}

.xva-component.fva {
    border-left: 3px solid var(--warning);
}

.xva-comp-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.xva-comp-value {
    font-size: 1.1rem;
    font-weight: 700;
    font-family: var(--font-mono);
}

.xva-comp-value.positive {
    color: var(--success);
}

.xva-comp-value.negative {
    color: var(--danger);
}

/* ============================================
   Charts
   ============================================ */

.chart-container {
    position: relative;
    flex: 1;
    min-height: 200px;
}

.chart-container.small {
    min-height: 150px;
}

.chart-container.large {
    min-height: 350px;
}

.chart-legend {
    display: flex;
    justify-content: center;
    gap: 24px;
    padding: 12px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--surface);
    border-radius: 20px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.legend-item:hover {
    background: var(--surface-hover);
}

.legend-item:not(.active) {
    opacity: 0.5;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.legend-dot.pfe { background: var(--warning); }
.legend-dot.ee { background: var(--primary); }
.legend-dot.epe { background: var(--success); }
.legend-dot.ene { background: var(--danger); }

.legend-value {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Donut Chart */
.donut-container {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.donut-center {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.donut-value {
    font-size: 1.25rem;
    font-weight: 700;
}

.donut-label {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* ============================================
   Quick Actions
   ============================================ */

.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 16px;
}

.action-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px;
    background: var(--surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.action-tile:hover {
    background: var(--surface-hover);
    border-color: var(--primary);
    transform: translateY(-2px);
}

.action-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary), var(--purple));
    border-radius: var(--radius-md);
    color: white;
    font-size: 1rem;
}

.action-tile span {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* ============================================
   Portfolio Table
   ============================================ */

.view-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px 16px;
    margin-bottom: 16px;
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.search-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1 1 200px;
    min-width: 150px;
    max-width: 400px;
    padding: 8px 14px;
    background: var(--surface);
    border-radius: var(--radius-md);
}

.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex: 1 1 auto;
}

.view-toggle {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.toolbar-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.column-selector-wrapper {
    flex-shrink: 0;
}

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

.search-wrapper input {
    flex: 1;
    min-width: 0;
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.search-wrapper kbd {
    font-size: 0.65rem;
    padding: 2px 6px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    color: var(--text-muted);
}

.filter-chips {
    display: flex;
    gap: 8px;
}

.view-toggle {
    display: flex;
    gap: 4px;
    margin-left: auto;
}

.portfolio-table-wrapper {
    overflow-x: auto;
    overflow-y: hidden;
    margin-bottom: 16px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scroll-behavior: smooth;
    max-width: 100%;
}

.portfolio-table-wrapper.glass-card {
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    max-width: 100%;
}

.portfolio-table {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
    table-layout: auto;
}

.portfolio-table th,
.portfolio-table td {
    padding: 14px 16px;
    text-align: left;
    white-space: nowrap;
}

.portfolio-table th {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--surface);
    border-bottom: 1px solid var(--glass-border);
}

.portfolio-table th.sortable {
    cursor: pointer;
    transition: color var(--transition-fast);
}

.portfolio-table th.sortable:hover {
    color: var(--primary);
}

.portfolio-table th i {
    margin-left: 6px;
    font-size: 0.65rem;
}

.portfolio-table tbody tr {
    border-bottom: 1px solid var(--glass-border);
    transition: background var(--transition-fast);
}

.portfolio-table tbody tr:hover {
    background: var(--surface-hover);
}

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

.portfolio-table td {
    font-size: 0.875rem;
}

.portfolio-table td code {
    padding: 2px 8px;
    background: var(--surface);
    border-radius: 4px;
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 0.8rem;
}

.portfolio-table .positive { color: var(--success); }
.portfolio-table .negative { color: var(--danger); }

.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-radius: var(--radius-lg);
}

.page-info {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.page-number {
    padding: 6px 14px;
    background: var(--primary);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    color: white;
}

/* ============================================
   Risk View
   ============================================ */

.risk-metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    padding: 20px;
}

.risk-metric-card {
    padding: 16px;
    background: var(--surface);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.risk-metric-card.total {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.1));
    border: 1px solid var(--primary);
}

.risk-metric-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.risk-metric-name {
    font-size: 0.875rem;
    font-weight: 600;
}

.risk-metric-badge {
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 10px;
}

.risk-metric-badge.negative {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.risk-metric-badge.positive {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.risk-metric-badge.warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.risk-metric-value {
    font-size: 1.5rem;
    font-weight: 700;
}

.risk-metric-bar {
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    overflow: hidden;
}

.risk-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width var(--transition-slow);
}

.risk-bar-fill.red { background: linear-gradient(90deg, var(--danger), var(--danger-light)); }
.risk-bar-fill.green { background: linear-gradient(90deg, var(--success), var(--success-light)); }
.risk-bar-fill.orange { background: linear-gradient(90deg, var(--warning), var(--warning-light)); }

.risk-metric-desc {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Gauges */
.gauges-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    padding: 20px;
}

.gauge-widget {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.gauge-svg {
    position: relative;
    width: 120px;
    height: 60px;
}

.gauge-svg svg {
    width: 100%;
    height: 100%;
}

.gauge-track {
    fill: none;
    stroke: var(--surface);
    stroke-width: 8;
    stroke-linecap: round;
}

.gauge-value {
    fill: none;
    stroke: var(--primary);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 141;
    stroke-dashoffset: 141;
    transition: stroke-dashoffset var(--transition-slow);
}

.gauge-value.epe { stroke: var(--success); }
.gauge-value.pfe { stroke: var(--warning); }

.gauge-needle {
    position: absolute;
    bottom: 5px;
    left: 50%;
    width: 2px;
    height: 40px;
    background: var(--text-primary);
    transform-origin: bottom center;
    transform: translateX(-50%) rotate(-90deg);
    transition: transform var(--transition-slow);
    border-radius: 1px;
}

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

.gauge-label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.gauge-number {
    font-size: 1.125rem;
    font-weight: 600;
}

/* ============================================
   Exposure View
   ============================================ */

.exposure-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    padding: 16px 0 0;
    border-top: 1px solid var(--glass-border);
    margin-top: 16px;
}

.stat-card {
    padding: 12px 16px;
    background: var(--surface);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.stat-value {
    font-size: 1.125rem;
    font-weight: 600;
}

/* Toggle Group */
.toggle-group {
    display: flex;
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: 3px;
}

.toggle-btn {
    padding: 6px 12px;
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

.toggle-btn.active {
    background: var(--primary);
    color: white;
}

/* Exposure Summary Bar */
.exposure-summary {
    display: flex;
    align-items: center;
    gap: 32px;
    padding: 20px 24px;
    margin-bottom: var(--gap);
}

.summary-metric {
    display: flex;
    align-items: center;
    gap: 12px;
}

.metric-icon-sm {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.metric-icon-sm.pfe {
    background: rgba(99, 102, 241, 0.2);
    color: var(--primary);
}

.metric-icon-sm.epe {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
}

.metric-icon-sm.ee {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.metric-icon-sm.ene {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.metric-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.metric-details .metric-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.metric-details .metric-value {
    font-size: 1.1rem;
    font-weight: 700;
}

/* Exposure Grid */
.exposure-grid {
    grid-template-columns: repeat(3, 1fr);
}

.exposure-grid .bento-item.bento-large {
    grid-column: span 2;
    grid-row: span 2;
}

/* Exposure Bottom Row */
.exposure-bottom-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--gap);
    margin-top: var(--gap);
}

/* Chart Container Sizes */
.chart-container.large {
    height: 300px;
}

.chart-container.small {
    height: 160px;
}

/* Exposure Stats List */
.exposure-stats-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: var(--surface);
    border-radius: var(--radius-sm);
}

.stat-row .stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.stat-row .stat-value {
    font-size: 0.95rem;
    font-weight: 600;
}

.stat-row .stat-value.pfe {
    color: var(--primary);
}

.stat-row .stat-value.epe {
    color: var(--warning);
}

.stat-row .stat-value.ee {
    color: var(--success);
}

.stat-row .stat-value.ene {
    color: var(--danger);
}

/* Chart Actions */
.chart-actions {
    display: flex;
    gap: 4px;
}

/* Interactive Legend */
.chart-legend.interactive {
    display: flex;
    gap: 16px;
    padding: 12px 16px;
    border-top: 1px solid var(--glass-border);
    flex-wrap: wrap;
}

.chart-legend.interactive .legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--surface);
    border-radius: 20px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.chart-legend.interactive .legend-item:hover {
    background: var(--surface-hover);
}

.chart-legend.interactive .legend-item.active {
    background: var(--surface-hover);
    box-shadow: 0 0 0 1px var(--primary);
}

.chart-legend .legend-name {
    font-size: 0.75rem;
    font-weight: 500;
}

/* Netting Set Table */
.netting-set-table-wrapper {
    max-height: 250px;
    overflow-y: auto;
}

.netting-set-table {
    width: 100%;
    border-collapse: collapse;
}

.netting-set-table th,
.netting-set-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
    font-size: 0.85rem;
}

.netting-set-table th {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    background: var(--surface);
    position: sticky;
    top: 0;
    z-index: 1;
}

.netting-set-table tbody tr:hover {
    background: var(--surface-hover);
}

.netting-benefit {
    display: inline-block;
    padding: 2px 8px;
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
}

.netting-set-chart {
    height: 200px;
    padding: 16px;
}

/* Monte Carlo Stats */
.mc-stats {
    display: flex;
    gap: 16px;
    padding: 12px 16px;
    border-top: 1px solid var(--glass-border);
}

.mc-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.mc-stat .mc-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.mc-stat .mc-value {
    font-size: 0.85rem;
    font-weight: 600;
}

.path-count {
    font-size: 0.7rem;
    color: var(--text-muted);
    padding: 4px 8px;
    background: var(--surface);
    border-radius: var(--radius-sm);
}

/* Limits List (Risk View) */
.limits-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px;
}

.limit-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.limit-item .limit-info {
    flex: 1;
    min-width: 0;
}

.limit-item .limit-name {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    margin-bottom: 2px;
}

.limit-item .limit-values {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.limit-item .limit-bar {
    width: 100px;
    height: 6px;
    background: var(--surface);
    border-radius: 3px;
    overflow: hidden;
}

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

.limit-item .limit-bar.warning .limit-fill {
    background: var(--warning);
}

.limit-item .limit-bar.danger .limit-fill {
    background: var(--danger);
}

.limit-item .limit-percent {
    font-size: 0.8rem;
    font-weight: 600;
    width: 40px;
    text-align: right;
}

.limit-item .limit-percent.warning {
    color: var(--warning);
}

.limit-item .limit-percent.danger {
    color: var(--danger);
}

/* ============================================
   Risk Attribution Grid
   ============================================ */

.risk-grid-select {
    padding: 8px 16px;
    background: var(--surface);
    border: 2px solid var(--primary);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    transition: all var(--transition-fast);
    min-width: 120px;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236366f1' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 36px;
}

.risk-grid-select:hover,
.risk-grid-select:focus {
    border-color: var(--primary);
    background-color: var(--surface-hover);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.risk-grid-select option {
    background: var(--background);
    color: var(--text-primary);
    padding: 8px;
}

/* Risk Attribution Panel - Primary Grid Display */
.risk-attribution-panel {
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: var(--radius-lg);
    display: block;
    width: 100%;
    box-sizing: border-box;
}

.risk-attribution-panel .bento-header {
    margin-bottom: 1rem;
}

.risk-attribution-panel .bento-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.risk-attribution-panel .bento-header h3 i {
    color: var(--primary);
}

.risk-attribution-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

/* Dashboard variant - more compact */
.risk-attribution-summary.dashboard-variant {
    padding: 0.75rem;
    margin-bottom: 0;
    gap: 0.75rem;
}

.risk-attribution-summary.dashboard-variant .risk-summary-card {
    padding: 0.75rem;
}

.risk-attribution-summary.dashboard-variant .risk-summary-value {
    font-size: 1.25rem;
}

.risk-summary-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    background: var(--glass-bg);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--primary);
    transition: transform var(--transition-fast);
}

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

.risk-summary-card.dv01 {
    border-left-color: var(--primary);
}

.risk-summary-card.gamma {
    border-left-color: var(--warning);
}

.risk-summary-card.vega {
    border-left-color: var(--info);
}

.risk-summary-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.risk-summary-value {
    font-size: 1.5rem;
    font-weight: 700;
    font-family: var(--font-mono);
    margin: 0.25rem 0;
}

.risk-summary-change {
    font-size: 0.75rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}

.risk-summary-change.positive {
    color: var(--success);
}

.risk-summary-change.negative {
    color: var(--danger);
}

.risk-grid-wrapper {
    overflow-x: auto;
    margin: 0 -1rem;
    padding: 0 1rem;
}

.risk-grid-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    min-width: 900px;
}

.risk-grid-table th,
.risk-grid-table td {
    padding: 10px 8px;
    text-align: right;
    border-bottom: 1px solid var(--glass-border);
}

.risk-grid-table th {
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.03em;
    background: var(--surface);
    position: sticky;
    top: 0;
    z-index: 1;
}

.risk-grid-table th.index-header {
    text-align: left;
    min-width: 120px;
}

.risk-grid-table th.tenor-header {
    min-width: 65px;
}

.risk-grid-table th.total-header {
    background: var(--surface-hover);
    min-width: 80px;
}

.risk-grid-table .index-cell {
    text-align: left;
    font-weight: 500;
}

.index-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    font-family: var(--font-mono);
}

.index-badge.usd {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.index-badge.eur {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.index-badge.gbp {
    background: rgba(168, 85, 247, 0.15);
    color: #a855f7;
}

.index-badge.jpy {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.index-badge.chf {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
}

.index-badge.aud {
    background: rgba(20, 184, 166, 0.15);
    color: #14b8a6;
}

.risk-cell {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    transition: background var(--transition-fast);
}

.risk-cell:hover {
    background: var(--surface-hover);
}

.risk-cell.positive {
    color: var(--success);
}

.risk-cell.negative {
    color: var(--danger);
}

.risk-cell.total {
    font-weight: 600;
    background: var(--surface);
}

.risk-cell.total.grand {
    font-size: 0.9rem;
    background: var(--surface-hover);
}

.risk-grid-table .total-row {
    background: var(--surface);
}

.risk-grid-table .total-row td {
    font-weight: 600;
    border-top: 2px solid var(--glass-border);
}

/* Risk Heatmap */
.risk-heatmap-container {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--glass-border);
    max-width: 320px;
}

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

.heatmap-header h4 {
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.heatmap-header h4 i {
    color: var(--warning);
}

.heatmap-legend {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.65rem;
    color: var(--text-secondary);
}

.legend-gradient {
    width: 60px;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(to right,
        rgba(34, 197, 94, 0.3),
        rgba(251, 191, 36, 0.5),
        rgba(239, 68, 68, 0.7)
    );
}

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

.heatmap-cell {
    aspect-ratio: 1;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.55rem;
    font-weight: 500;
    font-family: var(--font-mono);
    cursor: pointer;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.heatmap-cell:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1;
}

.heatmap-cell.low {
    background: rgba(34, 197, 94, 0.3);
    color: var(--success);
}

.heatmap-cell.medium {
    background: rgba(251, 191, 36, 0.4);
    color: var(--warning);
}

.heatmap-cell.high {
    background: rgba(239, 68, 68, 0.5);
    color: var(--danger);
}

/* Responsive Risk Attribution */
@media (max-width: 1200px) {
    .risk-attribution-summary {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .risk-attribution-summary {
        grid-template-columns: 1fr;
    }

    .risk-summary-card {
        flex-direction: row;
        justify-content: space-between;
    }

    .heatmap-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}

/* Pie Legend */
.pie-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--glass-border);
}

.pie-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
}

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

/* Counterparty Table */
.counterparty-table-wrapper {
    max-height: 300px;
    overflow-y: auto;
}

.counterparty-table {
    width: 100%;
    border-collapse: collapse;
}

.counterparty-table th,
.counterparty-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
    font-size: 0.85rem;
}

.counterparty-table th {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    background: var(--surface);
    position: sticky;
    top: 0;
    z-index: 1;
}

.counterparty-table tbody tr:hover {
    background: var(--surface-hover);
}

.rating-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 500;
}

.status-badge.healthy {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.status-badge.warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.status-badge.critical {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.utilization-cell {
    display: flex;
    align-items: center;
    gap: 8px;
}

.utilization-cell .limit-bar {
    width: 60px;
    height: 6px;
    background: var(--glass-border);
    border-radius: 3px;
    overflow: hidden;
}

.utilization-cell .limit-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
}

.utilization-cell .limit-fill.healthy { background: var(--success); }
.utilization-cell .limit-fill.warning { background: var(--warning); }
.utilization-cell .limit-fill.critical { background: var(--danger); }

/* ============================================
   Scenarios View
   ============================================ */

.scenarios-layout {
    display: grid;
    grid-template-columns: 300px 1fr 280px;
    gap: 16px;
    height: calc(100vh - var(--header-height) - 48px);
}

.scenario-panel,
.scenario-results-panel,
.scenario-history-panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.scenario-controls {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex: 1;
    overflow-y: auto;
}

.slider-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.slider-group label {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.slider-val {
    font-weight: 600;
    color: var(--primary);
}

.fancy-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    background: var(--surface);
    border-radius: 3px;
    outline: none;
}

.fancy-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
    transition: transform var(--transition-fast);
}

.fancy-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.preset-section {
    margin-top: 8px;
}

.preset-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.preset-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.preset-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px;
    background: var(--surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

.preset-btn.danger:hover {
    border-color: var(--danger);
    color: var(--danger);
}

.preset-btn.success:hover {
    border-color: var(--success);
    color: var(--success);
}

.run-scenario-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
    margin-top: auto;
}

.run-scenario-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

/* Scenario Results */
.scenario-results {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
}

.results-placeholder {
    flex: 1;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 12px;
    padding: 40px;
}

.placeholder-icon {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    border-radius: 50%;
    font-size: 1.5rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.results-placeholder p {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.results-placeholder span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.scenario-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--surface);
    border-radius: 20px;
    font-size: 0.75rem;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
}

.scenario-status.running .status-indicator {
    background: var(--warning);
    animation: pulse 1s ease-in-out infinite;
}

.scenario-status.complete .status-indicator {
    background: var(--success);
}

/* Scenario History */
.scenario-history {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
}

.history-empty {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-muted);
}

.history-empty i {
    font-size: 2rem;
    opacity: 0.5;
}

.history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: var(--surface);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.history-item:hover {
    background: var(--surface-hover);
}

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

.history-name {
    font-size: 0.8rem;
    font-weight: 500;
}

.history-time {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.history-result {
    font-size: 0.875rem;
    font-weight: 600;
}

/* ============================================
   Toast Notifications
   ============================================ */

.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 9000;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    animation: slideInRight 0.3s ease;
    min-width: 280px;
}

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

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.warning { border-left: 3px solid var(--warning); }
.toast.info { border-left: 3px solid var(--primary); }

.toast i {
    font-size: 1.125rem;
}

.toast.success i { color: var(--success); }
.toast.error i { color: var(--danger); }
.toast.warning i { color: var(--warning); }
.toast.info i { color: var(--primary); }

.toast-content {
    flex: 1;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
}

/* ============================================
   Loading Overlay
   ============================================ */

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: none !important;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    visibility: hidden !important;
    opacity: 0 !important;
}

.loading-overlay.active {
    display: none !important;
    visibility: hidden !important;
}

.loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.loader-spinner {
    display: none !important;
    visibility: hidden !important;
    width: 48px;
    height: 48px;
    border: 3px solid var(--surface);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: none !important;
}

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

.loader span {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* ============================================
   Celebration Particles
   ============================================ */

.celebration-container {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9500;
}

/* ============================================
   Results Grid (Scenario)
   ============================================ */

.results-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.result-card {
    padding: 16px;
    background: var(--surface);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

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

.result-value {
    font-size: 1.25rem;
    font-weight: 600;
}

.result-delta {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
}

.result-delta.muted {
    color: var(--text-secondary);
    font-style: italic;
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 1400px) {
    .bento-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .bento-full {
        grid-column: span 3;
    }
    
    .scenarios-layout {
        grid-template-columns: 280px 1fr;
    }
    
    .scenario-history-panel {
        display: none;
    }
}

@media (max-width: 1024px) {
    .bento-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .bento-full,
    .bento-large {
        grid-column: span 2;
    }
    
    .risk-metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .gauges-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .exposure-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .scenarios-layout {
        grid-template-columns: 1fr;
        height: auto;
    }

    /* Top bar adjustments for medium screens */
    .top-bar-right {
        gap: 8px;
    }

    .last-update span {
        display: none;
    }

    .last-update i {
        margin-right: 0;
    }

    /* Modal adjustments */
    .report-modal {
        max-width: 95%;
    }
}

@media (max-width: 768px) {
    :root {
        --sidebar-width: 0;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        width: 280px;
        height: 100vh;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

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

    .mobile-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .mobile-overlay.active {
        display: block;
        opacity: 1;
    }

    .main-content {
        margin-left: 0;
        max-width: 100vw;
    }

    .bento-grid {
        grid-template-columns: 1fr;
    }
    
    .bento-wide,
    .bento-large,
    .bento-full {
        grid-column: span 1;
    }
    
    .risk-metrics-grid,
    .gauges-grid,
    .exposure-stats {
        grid-template-columns: 1fr;
    }
    
    .view-toolbar {
        flex-wrap: wrap;
        gap: 8px;
        padding: 10px 12px;
    }
    
    .search-wrapper {
        max-width: 100%;
        order: -1;
        width: 100%;
        flex: 1 1 100%;
    }

    .filter-chips {
        order: 0;
        flex: 1 1 100%;
        justify-content: flex-start;
    }

    .view-toggle,
    .toolbar-actions,
    .column-selector-wrapper {
        order: 1;
    }
    
    .command-palette {
        margin: 16px;
        max-width: calc(100% - 32px);
    }

    /* Top bar responsive fixes */
    .top-bar {
        padding: 8px 12px;
        flex-wrap: wrap;
        height: auto;
        min-height: var(--header-height);
        gap: 8px;
    }

    .top-bar-left {
        flex: 1;
        min-width: 0;
    }

    .page-title {
        font-size: 1rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .top-bar-right {
        flex-wrap: wrap;
        gap: 8px;
        justify-content: flex-end;
    }

    .top-bar-divider {
        display: none;
    }

    .last-update {
        display: none;
    }

    .live-indicator {
        padding: 3px 8px;
        font-size: 0.65rem;
    }

    .icon-btn {
        width: 32px;
        height: 32px;
    }

    .primary-btn {
        padding: 6px 12px;
        font-size: 0.8rem;
    }

    .primary-btn span {
        display: none;
    }

    /* Modal responsive fixes */
    .modal {
        width: 95%;
        max-height: 85vh;
        margin: 8px;
    }

    .modal-header {
        padding: 12px 16px;
    }

    .modal-header h2 {
        font-size: 1rem;
    }

    .modal-body {
        padding: 16px;
    }

    .modal-footer {
        padding: 12px 16px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .modal-footer .primary-btn,
    .modal-footer .secondary-btn {
        flex: 1 1 auto;
        min-width: 120px;
        justify-content: center;
    }

    .modal-footer .primary-btn span {
        display: inline;
    }

    /* What-If modal responsive */
    .whatif-layout {
        grid-template-columns: 1fr;
    }

    .whatif-impact-grid {
        grid-template-columns: 1fr 1fr;
    }

    /* Report modal responsive */
    .report-type-grid {
        grid-template-columns: 1fr 1fr;
    }

    .format-grid {
        flex-wrap: wrap;
    }

    /* Theme panel responsive */
    .theme-panel {
        width: 100%;
        max-width: none;
        right: -100%;
        left: auto;
        border-radius: 0;
    }

    .theme-panel.active {
        right: 0;
    }

    .theme-mode-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Alert panel responsive */
    .alert-panel {
        width: 100%;
        max-width: none;
        right: 0;
    }

    /* AI panel responsive */
    .ai-panel {
        width: 100%;
        max-width: none;
        right: 0;
    }

    /* Results grid responsive */
    .results-grid {
        grid-template-columns: 1fr;
    }

    /* Filter chips responsive */
    .filter-chips {
        flex-wrap: wrap;
        width: 100%;
    }

    .chip-btn {
        flex: 1 1 auto;
        min-width: fit-content;
        text-align: center;
    }
}

/* Extra small screens (mobile phones) */
@media (max-width: 480px) {
    .top-bar {
        padding: 6px 8px;
    }

    .page-title {
        font-size: 0.9rem;
    }

    .breadcrumb {
        display: none;
    }

    .top-bar-right {
        gap: 4px;
    }

    .icon-btn {
        width: 28px;
        height: 28px;
        font-size: 0.75rem;
    }

    .primary-btn {
        padding: 5px 10px;
        font-size: 0.75rem;
    }

    .primary-btn i {
        font-size: 0.7rem;
    }

    .live-indicator {
        display: none;
    }

    /* View adjustments */
    .view {
        padding: 12px;
    }

    .bento-content {
        padding: 12px;
    }

    .bento-header {
        padding: 10px 12px;
    }

    .bento-header h3 {
        font-size: 0.8rem;
    }

    /* Modal adjustments */
    .modal {
        width: 100%;
        max-height: 100vh;
        margin: 0;
        border-radius: 0;
    }

    .modal-header {
        padding: 10px 12px;
    }

    .modal-header h2 {
        font-size: 0.9rem;
        gap: 8px;
    }

    .modal-body {
        padding: 12px;
    }

    .modal-footer {
        padding: 10px 12px;
        flex-direction: column;
    }

    .modal-footer .primary-btn,
    .modal-footer .secondary-btn {
        width: 100%;
        min-width: unset;
    }

    /* What-If modal */
    .whatif-impact-grid {
        grid-template-columns: 1fr;
    }

    .impact-card {
        padding: 10px;
    }

    .impact-value {
        font-size: 1rem;
    }

    /* Report modal */
    .report-type-grid {
        grid-template-columns: 1fr;
    }

    .report-type-btn {
        padding: 12px;
    }

    .format-grid {
        flex-direction: column;
    }

    .format-option {
        width: 100%;
    }

    /* Drawer adjustments */
    .drawer-content {
        width: 100%;
    }

    .drawer-header {
        padding: 12px;
    }

    .drawer-body {
        padding: 12px;
    }

    .drawer-footer {
        padding: 12px;
        flex-direction: column;
    }

    .drawer-footer button {
        width: 100%;
    }

    /* Table adjustments */
    .portfolio-table th,
    .portfolio-table td {
        padding: 8px 6px;
        font-size: 0.7rem;
    }

    /* Metric cards */
    .metric-value {
        font-size: 1.25rem;
    }

    .metric-icon {
        width: 36px;
        height: 36px;
    }
}

/* ============================================
   Utility Classes
   ============================================ */

.positive { color: var(--success) !important; }
.negative { color: var(--danger) !important; }

kbd {
    font-family: inherit;
}

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

::-webkit-scrollbar-track {
    background: transparent;
}

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

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

/* ============================================
   Enhanced Portfolio Styles
   ============================================ */

/* Summary Stats Bar */
.portfolio-summary {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 16px 20px;
    margin-bottom: 16px;
    border-radius: var(--radius-lg);
    overflow-x: auto;
}

.summary-stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: fit-content;
}

.summary-stat.highlight {
    padding: 8px 16px;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid var(--primary);
    border-radius: var(--radius-md);
}

.summary-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.summary-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Enhanced Filter Chips */
.filter-chips .chip-btn {
    position: relative;
}

.chip-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    font-size: 0.65rem;
    font-weight: 600;
    background: var(--bg-tertiary);
    border-radius: 9px;
    margin-right: 6px;
}

.chip-btn.active .chip-count {
    background: rgba(255, 255, 255, 0.2);
}

/* Column Selector */
.column-selector-wrapper {
    position: relative;
}

.column-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 200px;
    padding: 12px;
    border-radius: var(--radius-md);
    display: none;
    z-index: 100;
}

.column-dropdown.active {
    display: block;
    animation: fadeIn 0.2s ease;
}

.column-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--glass-border);
}

.column-dropdown-header span {
    font-size: 0.8rem;
    font-weight: 600;
}

.text-btn {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 0.75rem;
    cursor: pointer;
    transition: opacity var(--transition-fast);
}

.text-btn:hover {
    opacity: 0.8;
}

.column-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    font-size: 0.8rem;
    cursor: pointer;
    color: var(--text-secondary);
}

.column-option:hover {
    color: var(--text-primary);
}

.column-option input {
    accent-color: var(--primary);
}

/* Toolbar Actions */
.toolbar-actions {
    display: flex;
    gap: 4px;
    margin-left: 8px;
    padding-left: 8px;
    border-left: 1px solid var(--glass-border);
}

/* Advanced Filters Panel */
.advanced-filters {
    padding: 20px;
    margin-bottom: 16px;
    border-radius: var(--radius-lg);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-group label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.range-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
}

.range-inputs input,
.filter-group select {
    flex: 1;
    padding: 8px 12px;
    background: var(--surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.875rem;
}

.range-inputs input:focus,
.filter-group select:focus {
    outline: none;
    border-color: var(--primary);
}

.range-inputs span {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.risk-level-chips {
    display: flex;
    gap: 6px;
}

.risk-chip {
    padding: 6px 12px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    background: var(--surface);
    color: var(--text-secondary);
}

.risk-chip:hover {
    background: var(--surface-hover);
}

.risk-chip.active {
    color: white;
}

.risk-chip.all.active { background: var(--primary); }
.risk-chip.low.active { background: var(--success); }
.risk-chip.medium.active { background: var(--warning); }
.risk-chip.high.active { background: var(--danger); }

.filter-actions {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    grid-column: 1 / -1;
    justify-content: flex-end;
}

/* Bulk Actions Bar */
.bulk-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    margin-bottom: 16px;
    border-radius: var(--radius-lg);
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.1));
    border: 1px solid var(--primary);
    animation: fadeIn 0.3s ease;
}

.bulk-info {
    font-size: 0.875rem;
    font-weight: 500;
}

.bulk-info span {
    color: var(--primary);
    font-weight: 700;
}

.bulk-buttons {
    display: flex;
    gap: 8px;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

.action-btn.danger:hover {
    border-color: var(--danger);
    color: var(--danger);
}

/* Enhanced Table */
.portfolio-table .checkbox-col {
    width: 40px;
    text-align: center;
}

.portfolio-table .checkbox-col input {
    accent-color: var(--primary);
    cursor: pointer;
}

.portfolio-table th .th-content {
    display: flex;
    align-items: center;
    gap: 6px;
}

.portfolio-table th .sort-icon {
    font-size: 0.65rem;
    opacity: 0.4;
    transition: opacity var(--transition-fast);
}

.portfolio-table th.sortable:hover .sort-icon,
.portfolio-table th.sorted .sort-icon {
    opacity: 1;
}

.portfolio-table th.sorted.asc .sort-icon::before {
    content: "\f0de";
}

.portfolio-table th.sorted.desc .sort-icon::before {
    content: "\f0dd";
}

.portfolio-table .risk-col {
    width: 80px;
}

.portfolio-table .actions-col {
    width: 100px;
}

/* Table Row Selection */
.portfolio-table tbody tr.selected {
    background: rgba(99, 102, 241, 0.1);
}

.portfolio-table tbody tr.selected:hover {
    background: rgba(99, 102, 241, 0.15);
}

/* Risk Indicator */
.risk-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.risk-indicator.low {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.risk-indicator.medium {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.risk-indicator.high {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.risk-indicator i {
    font-size: 0.6rem;
}

/* Product Badge */
.product-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: capitalize;
    white-space: nowrap;
}

.product-badge.swap {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary-light);
}

.product-badge.swaption {
    background: rgba(139, 92, 246, 0.15);
    color: var(--purple);
}

.product-badge.cap {
    background: rgba(6, 182, 212, 0.15);
    color: var(--accent);
}

.product-badge.other {
    background: rgba(100, 116, 139, 0.15);
    color: var(--text-muted);
}

/* Row Actions */
.row-actions {
    display: flex;
    gap: 4px;
}

.row-actions .icon-btn {
    width: 28px;
    height: 28px;
    font-size: 0.75rem;
}

/* Sparkline in Table */
.table-sparkline {
    width: 60px;
    height: 20px;
}

/* Table Maturity Cell */
.maturity-cell {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.maturity-date {
    font-size: 0.875rem;
}

.maturity-ttm {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Counterparty Cell */
.counterparty-cell {
    display: flex;
    align-items: center;
    gap: 8px;
}

.counterparty-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--purple));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
    color: white;
}

.counterparty-info {
    display: flex;
    flex-direction: column;
}

.counterparty-name {
    font-size: 0.875rem;
}

.counterparty-rating {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Card/Grid View */
.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.trade-card {
    padding: 20px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-normal);
}

.trade-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
    box-shadow: var(--shadow-glow);
}

.trade-card.selected {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.trade-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.trade-card-id {
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 0.8rem;
    padding: 4px 8px;
    background: var(--surface);
    border-radius: 4px;
    color: var(--text-secondary);
}

.trade-card-type {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary);
}

.trade-card-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.trade-card-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.trade-card-stat.full-width {
    grid-column: 1 / -1;
}

.trade-card-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.trade-card-value {
    font-size: 1rem;
    font-weight: 600;
}

.trade-card-value.large {
    font-size: 1.5rem;
}

.trade-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid var(--glass-border);
}

.trade-card-greeks {
    display: flex;
    gap: 12px;
}

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

.greek-mini-label {
    font-size: 0.6rem;
    color: var(--text-muted);
}

.greek-mini-value {
    font-size: 0.8rem;
    font-weight: 500;
}

/* Heatmap View */
.portfolio-heatmap {
    padding: 20px;
    margin-bottom: 16px;
}

.heatmap-legend {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.heatmap-scale {
    display: flex;
    align-items: center;
    gap: 8px;
}

.scale-gradient {
    width: 120px;
    height: 12px;
    border-radius: 6px;
    background: linear-gradient(90deg, var(--success), var(--warning), var(--danger));
}

.scale-label {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.heatmap-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 4px;
}

.heatmap-cell {
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
}

.heatmap-cell:hover {
    transform: scale(1.1);
    z-index: 10;
}

.heatmap-cell.low { background: var(--success); }
.heatmap-cell.medium { background: var(--warning); }
.heatmap-cell.high { background: var(--danger); }

/* Enhanced Pagination */
.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

.pagination-left,
.pagination-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.page-size-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.page-size-selector select {
    padding: 4px 8px;
    background: var(--surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.8rem;
}

.page-numbers {
    display: flex;
    gap: 4px;
}

.page-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

.page-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.pagination-jump {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.pagination-jump input {
    width: 50px;
    padding: 4px 8px;
    background: var(--surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.8rem;
    text-align: center;
}

/* Trade Detail Drawer */
.trade-drawer {
    position: fixed;
    inset: 0;
    z-index: 1000;
    pointer-events: none;
}

.trade-drawer.active {
    pointer-events: auto;
}

.drawer-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.trade-drawer.active .drawer-overlay {
    opacity: 1;
}

.drawer-content {
    position: absolute;
    top: 0;
    right: 0;
    width: 480px;
    max-width: 100%;
    height: 100%;
    transform: translateX(100%);
    transition: transform var(--transition-normal);
    display: flex;
    flex-direction: column;
}

.trade-drawer.active .drawer-content {
    transform: translateX(0);
}

.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid var(--glass-border);
}

.drawer-header h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
}

.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.drawer-section {
    margin-bottom: 24px;
}

.drawer-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 12px;
}

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

.drawer-stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.drawer-stat.full {
    grid-column: 1 / -1;
}

.drawer-stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.drawer-stat-value {
    font-size: 1rem;
    font-weight: 600;
}

.drawer-stat-value.large {
    font-size: 1.5rem;
}

.drawer-chart {
    height: 150px;
    margin: 16px 0;
}

.drawer-footer {
    display: flex;
    gap: 12px;
    padding: 20px;
    border-top: 1px solid var(--glass-border);
}

.drawer-footer button {
    flex: 1;
}

.secondary-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    flex-shrink: 0;
}

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

/* ============================================
   Enhanced Risk View Styles
   ============================================ */

.risk-summary-bar {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 16px 24px;
    margin-bottom: var(--gap);
}

.risk-health-indicator {
    display: flex;
    align-items: center;
    gap: 16px;
}

.health-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.health-circle svg {
    position: absolute;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.health-circle .health-bg {
    fill: none;
    stroke: var(--surface);
    stroke-width: 8;
}

.health-circle .health-fill {
    fill: none;
    stroke: var(--success);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 283;
    stroke-dashoffset: 42; /* 85% health = 283 * 0.15 */
    transition: stroke-dashoffset 0.5s ease;
}

.health-score {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.health-score .score-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--success);
}

.health-score .score-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* Portfolio Health Mini Indicator */
.portfolio-health-mini {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    padding: 4px 10px;
    background: var(--surface);
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
}

.health-circle-mini {
    width: 28px;
    height: 28px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.health-circle-mini svg {
    position: absolute;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.health-circle-mini .health-bg-mini {
    fill: none;
    stroke: var(--surface-hover);
    stroke-width: 3;
}

.health-circle-mini .health-fill-mini {
    fill: none;
    stroke: var(--success);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-dasharray: 97.4;
    stroke-dashoffset: 97.4;
    transition: stroke-dashoffset 0.6s ease-out, stroke 0.3s ease;
}

.health-circle-mini .health-fill-mini.warning {
    stroke: var(--warning);
}

.health-circle-mini .health-fill-mini.danger {
    stroke: var(--danger);
}

.health-value-mini {
    position: relative;
    z-index: 1;
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--success);
}

.health-value-mini.warning {
    color: var(--warning);
}

.health-value-mini.danger {
    color: var(--danger);
}

.health-label-mini {
    font-size: 0.65rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.risk-summary-stats {
    display: flex;
    gap: 24px;
    flex: 1;
}

.summary-stat {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--surface);
    border-radius: var(--radius-md);
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.stat-icon.danger { background: rgba(239, 68, 68, 0.15); color: var(--danger); }
.stat-icon.warning { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.stat-icon.success { background: rgba(16, 185, 129, 0.15); color: var(--success); }

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-info .stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.stat-info .stat-value {
    font-size: 1.1rem;
    font-weight: 600;
}

.risk-alerts {
    margin-left: auto;
}

.risk-alerts .alert-btn {
    position: relative;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: var(--radius-md);
    background: var(--surface);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.risk-alerts .alert-btn:hover {
    background: var(--primary);
    color: white;
}

/* Risk Bottom Row: Left stack + Limit Utilization */
.risk-bottom-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--gap);
    margin-top: var(--gap);
}

.risk-left-stack {
    display: flex;
    flex-direction: column;
    gap: var(--gap);
}

.risk-left-stack .bento-item {
    flex: 1;
}

.risk-view-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--gap);
}

.xva-metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--gap);
    margin-bottom: var(--gap);
}

.xva-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    padding: 16px;
}

.xva-metric-card {
    padding: 20px;
    background: var(--surface);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
}

.xva-metric-card .xva-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.xva-metric-card .xva-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary);
}

.xva-metric-card.cva .xva-icon { background: rgba(239, 68, 68, 0.15); color: var(--danger); }
.xva-metric-card.dva .xva-icon { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.xva-metric-card.fva .xva-icon { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.xva-metric-card.kva .xva-icon { background: rgba(139, 92, 246, 0.15); color: #8b5cf6; }
.xva-metric-card.mva .xva-icon { background: rgba(6, 182, 212, 0.15); color: #06b6d4; }
.xva-metric-card.colva .xva-icon { background: rgba(236, 72, 153, 0.15); color: #ec4899; }

.xva-trend {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 12px;
}

.xva-trend.positive { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.xva-trend.negative { background: rgba(239, 68, 68, 0.15); color: var(--danger); }

.xva-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.xva-value {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.xva-value.positive { color: var(--success); }
.xva-value.negative { color: var(--danger); }

.xva-bar-container {
    margin: 8px 0;
}

.xva-bar-track {
    height: 4px;
    background: var(--glass-border);
    border-radius: 2px;
    overflow: hidden;
}

.xva-bar-fill {
    height: 100%;
    background: var(--danger);
    border-radius: 2px;
    width: 60%;
    transition: width 0.5s ease;
}

.xva-bar-fill.green { background: var(--success); }
.xva-bar-fill.orange { background: var(--warning); }

.xva-desc {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: auto;
}

/* XVA Compact Grid (for Risk View) */
.xva-compact-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 8px;
}

.xva-compact-item {
    padding: 12px;
    background: var(--surface);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--primary);
}

.xva-compact-item.cva { border-left-color: var(--danger); }
.xva-compact-item.dva { border-left-color: var(--success); }
.xva-compact-item.fva { border-left-color: var(--warning); }
.xva-compact-item.total { border-left-color: var(--primary); }

.xva-compact-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.xva-compact-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.xva-compact-trend {
    font-size: 0.65rem;
    font-weight: 500;
    padding: 1px 6px;
    border-radius: 8px;
}

.xva-compact-trend.positive {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.xva-compact-trend.negative {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.xva-compact-value {
    font-size: 1.1rem;
    font-weight: 700;
    font-family: var(--font-mono);
}

.xva-compact-value.positive { color: var(--success); }
.xva-compact-value.negative { color: var(--danger); }

/* XVA Composition for Total Card */
.xva-composition {
    display: flex;
    gap: 6px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.comp-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    padding: 4px 8px;
    border-radius: 4px;
    background: var(--glass-border);
}

.comp-item.cva { background: rgba(239, 68, 68, 0.15); color: var(--danger); }
.comp-item.dva { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.comp-item.fva { background: rgba(245, 158, 11, 0.15); color: var(--warning); }

.comp-item::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 2px;
}

.comp-item.cva::before { background: var(--danger); }
.comp-item.dva::before { background: var(--success); }
.comp-item.fva::before { background: var(--warning); }

/* XVA Period Chips */
.xva-period-chips {
    display: flex;
    gap: 6px;
}

.xva-period-chips .chip-btn {
    padding: 4px 12px;
    font-size: 0.7rem;
}

.xva-metric-card .metric-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.xva-metric-card .metric-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.xva-metric-card .metric-value {
    font-size: 1.5rem;
    font-weight: 700;
}

.xva-metric-card .metric-trend {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    font-size: 0.75rem;
}

.xva-metric-card .metric-trend.up {
    color: var(--success);
}

.xva-metric-card .metric-trend.down {
    color: var(--danger);
}

.counterparty-table-container {
    overflow-x: auto;
}

.counterparty-table {
    width: 100%;
    border-collapse: collapse;
}

.counterparty-table th,
.counterparty-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
}

.counterparty-table th {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    background: var(--surface);
}

.counterparty-table tbody tr:hover {
    background: var(--surface-hover);
}

.cpty-name {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cpty-avatar {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
    color: white;
}

.risk-asset-card,
.xva-history-card {
    padding: 0;
}

.risk-asset-card .chart-container,
.xva-history-card .chart-container {
    height: 200px;
    padding: 16px;
}

.limit-utilization-card {
    padding: 20px;
}

.limit-bars {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.limit-bar-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.limit-bar-row .label {
    width: 100px;
    font-size: 0.8rem;
    font-weight: 500;
}

.limit-bar {
    flex: 1;
    height: 8px;
    background: var(--surface);
    border-radius: 4px;
    overflow: hidden;
}

.limit-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.limit-fill.safe {
    background: var(--success);
}

.limit-fill.warning {
    background: var(--warning);
}

.limit-fill.danger {
    background: var(--danger);
}

.limit-bar-row .value {
    width: 50px;
    text-align: right;
    font-size: 0.8rem;
    font-weight: 600;
}

/* ============================================
   Enhanced Exposure View Styles
   ============================================ */

.exposure-summary-bar {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 16px 24px;
    margin-bottom: var(--gap);
}

.exposure-summary-metrics {
    display: flex;
    gap: 32px;
}

.exposure-metric {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.exposure-metric .value {
    font-size: 1.25rem;
    font-weight: 700;
}

.exposure-metric .value.positive {
    color: var(--success);
}

.exposure-metric .value.negative {
    color: var(--danger);
}

.exposure-metric .label {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.exposure-view-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--gap);
}

.exposure-main-chart-card {
    padding: 0;
}

.chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--glass-border);
}

.chart-header h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
}

.zoom-controls {
    display: flex;
    gap: 4px;
}

.zoom-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.zoom-btn:hover {
    background: var(--primary);
    color: white;
}

.exposure-chart-wrapper {
    height: 300px;
    padding: 16px;
}

.interactive-legend {
    display: flex;
    gap: 16px;
    padding: 12px 20px;
    border-top: 1px solid var(--glass-border);
    flex-wrap: wrap;
}

.legend-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--surface);
    border: none;
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.legend-toggle.active {
    background: var(--primary);
    color: white;
}

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

.dot.pfe { background: var(--primary); }
.dot.ee { background: var(--success); }
.dot.epe { background: var(--warning); }
.dot.ene { background: var(--danger); }
.dot.collateral { background: var(--accent); }

.exposure-stats-card {
    padding: 20px;
}

.key-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.key-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 12px;
    background: var(--surface);
    border-radius: var(--radius-md);
}

.key-stat .value {
    font-size: 1.1rem;
    font-weight: 700;
}

.key-stat .label {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.tenor-bucket-card,
.netting-set-card,
.collateral-card,
.mc-paths-card {
    padding: 0;
}

.tenor-bucket-card .chart-container,
.collateral-card .chart-container,
.mc-paths-card .chart-container {
    height: 180px;
    padding: 16px;
}

.netting-table-container {
    max-height: 200px;
    overflow-y: auto;
}

.netting-table {
    width: 100%;
    border-collapse: collapse;
}

.netting-table th,
.netting-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
    font-size: 0.8rem;
}

.netting-table th {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    background: var(--surface);
    position: sticky;
    top: 0;
}

.netting-badge {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.65rem;
    font-weight: 600;
}

.netting-badge.csa {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.netting-badge.no-csa {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

/* ============================================
   Enhanced Scenarios View Styles
   ============================================ */

.scenario-type-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    margin-bottom: var(--gap);
}

.scenario-types {
    display: flex;
    gap: 8px;
}

.scenario-type-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.scenario-type-btn:hover {
    background: var(--surface-hover);
    border-color: var(--primary);
}

.scenario-type-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.scenario-actions {
    display: flex;
    gap: 8px;
}

.scenarios-layout.advanced {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: var(--gap);
}

.scenario-panel {
    display: flex;
    flex-direction: column;
}

.scenario-controls {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.param-section {
    margin-bottom: 20px;
}

.param-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 12px;
}

.slider-group label {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    margin-bottom: 6px;
}

.fancy-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    background: var(--surface);
    border-radius: 3px;
    outline: none;
    margin-bottom: 12px;
}

.fancy-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.fancy-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.fancy-slider.blue::-webkit-slider-thumb {
    background: var(--accent);
}

.fancy-slider.orange::-webkit-slider-thumb {
    background: var(--warning);
}

.fancy-slider.red::-webkit-slider-thumb {
    background: var(--danger);
}

.fancy-slider.purple::-webkit-slider-thumb {
    background: var(--purple);
}

.historical-events {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.event-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.event-card:hover,
.event-card.selected {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.event-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: var(--surface-hover);
    display: flex;
    align-items: center;
    justify-content: center;
}

.event-info {
    display: flex;
    flex-direction: column;
}

.event-name {
    font-size: 0.85rem;
    font-weight: 600;
}

.event-date {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.run-scenario-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: calc(100% - 32px);
    margin: 16px;
    padding: 14px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--purple) 100%);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.run-scenario-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
}

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

.btn-loader {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.run-scenario-btn.loading .btn-loader {
    display: block;
}

.run-scenario-btn.loading span {
    display: none;
}

.scenario-results-panel {
    display: flex;
    flex-direction: column;
}

.impact-section {
    padding: 16px;
    border-top: 1px solid var(--glass-border);
}

.impact-section h4 {
    font-size: 0.85rem;
    margin-bottom: 12px;
}

/* Bottom Panel for History, Compare, Sensitivity */
.scenario-bottom-panel {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--gap);
    margin-top: var(--gap);
}

.scenario-history-panel,
.scenario-compare-panel,
.scenario-sensitivity-panel {
    min-height: 180px;
}

.scenario-history {
    padding: 12px;
}

.history-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 24px;
    color: var(--text-muted);
}

.history-empty i {
    font-size: 1.5rem;
}

.history-empty span {
    font-size: 0.8rem;
}

.chart-container.small {
    height: 120px;
    padding: 12px;
}

.sensitivity-bars {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

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

.sens-label {
    width: 50px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.sens-bar {
    flex: 1;
    height: 6px;
    background: var(--surface);
    border-radius: 3px;
    overflow: hidden;
}

.sens-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}

.sens-fill.positive {
    background: var(--success);
}

.sens-fill.negative {
    background: var(--danger);
}

.sens-value {
    width: 60px;
    text-align: right;
    font-size: 0.75rem;
    font-weight: 600;
}

.preset-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.preset-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 8px;
    background: var(--surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.preset-btn i {
    font-size: 1rem;
}

.preset-btn:hover,
.preset-btn.active {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
}

.preset-btn.warning:hover,
.preset-btn.warning.active {
    border-color: var(--warning);
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.preset-btn.danger:hover,
.preset-btn.danger.active {
    border-color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.preset-btn.success:hover,
.preset-btn.success.active {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

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

/* Scenario Results Grid */
.scenario-results-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    padding: 20px;
}

.result-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px;
    background: var(--surface);
    border-radius: var(--radius-md);
}

.result-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.result-value {
    font-size: 1.25rem;
    font-weight: 700;
}

.result-value.positive {
    color: var(--success);
}

.result-value.negative {
    color: var(--danger);
}

/* History Entry */
.history-entry {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--glass-border);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.history-entry:hover {
    background: var(--surface-hover);
}

.history-entry:last-child {
    border-bottom: none;
}

.history-time {
    font-size: 0.7rem;
    color: var(--text-muted);
    width: 60px;
}

.history-params {
    flex: 1;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.history-result {
    font-size: 0.8rem;
    font-weight: 600;
}

.history-result.positive {
    color: var(--success);
}

.history-result.negative {
    color: var(--danger);
}

/* Responsive adjustments for enhanced views */
@media (max-width: 1200px) {
    .scenarios-layout.advanced {
        grid-template-columns: 1fr;
    }

    .scenario-bottom-panel {
        grid-template-columns: repeat(3, 1fr);
    }

    .exposure-view-layout {
        grid-template-columns: 1fr;
    }

    .risk-view-layout {
        grid-template-columns: 1fr;
    }

    .risk-bottom-row {
        grid-template-columns: 1fr;
    }

    .exposure-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .exposure-grid .bento-item.bento-large {
        grid-column: span 2;
    }

    .exposure-summary {
        flex-wrap: wrap;
        gap: 16px;
    }
}

@media (max-width: 768px) {
    .scenarios-layout.advanced {
        grid-template-columns: 1fr;
    }

    .scenario-types {
        flex-wrap: wrap;
    }

    .scenario-bottom-panel {
        grid-template-columns: 1fr;
    }

    .xva-metrics-grid {
        grid-template-columns: 1fr;
    }
    
    .risk-summary-bar {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .risk-summary-metrics {
        margin-left: 0;
        width: 100%;
        justify-content: space-between;
    }
    
    .exposure-summary-bar {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .exposure-grid {
        grid-template-columns: 1fr;
    }
    
    .exposure-grid .bento-item.bento-large {
        grid-column: span 1;
    }

    .exposure-bottom-row {
        grid-template-columns: 1fr;
    }

    .exposure-summary {
        padding: 16px;
        gap: 12px;
    }
    
    .summary-metric {
        width: calc(50% - 6px);
    }
    
    .toggle-group {
        flex-wrap: wrap;
    }
    
    .chart-actions {
        display: none;
    }
    
    .netting-set-table th,
    .netting-set-table td {
        padding: 8px 10px;
        font-size: 0.75rem;
    }
}

/* ============================================
   Live Indicator & Real-time Effects
   ============================================ */

.live-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: rgba(16, 185, 129, 0.15);
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--success);
    text-transform: uppercase;
}

.live-dot {
    width: 6px;
    height: 6px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse-live 1.5s ease-in-out infinite;
}

@keyframes pulse-live {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.3); }
}

.top-bar-divider {
    width: 1px;
    height: 24px;
    background: var(--glass-border);
    margin: 0 8px;
}

/* Value update animation */
.value-updated {
    animation: value-flash 0.5s ease;
}

@keyframes value-flash {
    0% { background: rgba(99, 102, 241, 0.3); }
    100% { background: transparent; }
}

/* ============================================
   Sidebar Quick Actions
   ============================================ */

.sidebar-quick-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.sidebar-action-btn {
    position: relative;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: var(--radius-md);
    background: var(--surface);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.sidebar-action-btn:hover {
    background: var(--primary);
    color: white;
}

.sidebar-action-btn.danger:hover {
    background: var(--danger);
    color: white;
}

.alert-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: var(--danger);
    color: white;
    border-radius: 8px;
    font-size: 0.65rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================
   Toast Notifications
   ============================================ */

.toast-container {
    position: fixed;
    top: 80px;
    right: 24px;
    z-index: 9000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    pointer-events: auto;
    animation: toast-in 0.3s ease;
    max-width: 360px;
}

.toast.toast-out {
    animation: toast-out 0.3s ease forwards;
}

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

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

.toast-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.toast.success .toast-icon { background: rgba(16, 185, 129, 0.2); color: var(--success); }
.toast.warning .toast-icon { background: rgba(245, 158, 11, 0.2); color: var(--warning); }
.toast.error .toast-icon { background: rgba(239, 68, 68, 0.2); color: var(--danger); }
.toast.info .toast-icon { background: rgba(99, 102, 241, 0.2); color: var(--primary); }

.toast-content {
    flex: 1;
}

.toast-title {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.toast-message {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Task 3.1: Toast Action Button & Loading */
.toast-actions {
    margin-top: 8px;
}

.toast-action-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 6px 12px;
    transition: background 0.2s, border-color 0.2s;
}

.toast-action-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.toast-action-btn:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.toast-loading {
    display: flex;
    align-items: center;
    margin-right: 8px;
    color: var(--text-muted);
}

.toast-loading i {
    font-size: 1rem;
}

/* Task 3.4: WebSocket Connection Indicator */
.connection-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.connection-indicator.connected {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.connection-indicator.disconnected {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.connection-indicator.reconnecting {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.connection-indicator i {
    font-size: 0.65rem;
}

.connection-indicator .status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.connection-indicator.reconnecting .status-dot {
    animation: pulse-dot 1s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
}

/* ============================================
   Alert Panel
   ============================================ */

.alert-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 380px;
    height: 100vh;
    z-index: 8000;
    display: flex;
    flex-direction: column;
    transition: right var(--transition-normal);
}

.alert-panel.active {
    right: 0;
}

.alert-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid var(--glass-border);
}

.alert-panel-header h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
}

.alert-actions {
    display: flex;
    gap: 8px;
}

.alert-filters {
    display: flex;
    gap: 8px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--glass-border);
}

.alert-filter {
    padding: 6px 12px;
    background: var(--surface);
    border: none;
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.alert-filter:hover,
.alert-filter.active {
    background: var(--primary);
    color: white;
}

.alert-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.alert-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: var(--surface);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.alert-item:hover {
    background: var(--surface-hover);
}

.alert-item.unread {
    border-left: 3px solid var(--primary);
}

.alert-item.critical {
    border-left: 3px solid var(--danger);
}

.alert-item.warning {
    border-left: 3px solid var(--warning);
}

.alert-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.alert-icon.critical { background: rgba(239, 68, 68, 0.2); color: var(--danger); }
.alert-icon.warning { background: rgba(245, 158, 11, 0.2); color: var(--warning); }
.alert-icon.info { background: rgba(99, 102, 241, 0.2); color: var(--primary); }

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

.alert-title {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.alert-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.alert-time {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.alert-settings {
    padding: 12px 20px;
    border-top: 1px solid var(--glass-border);
}

/* ============================================
   Theme Panel
   ============================================ */

.theme-panel {
    position: fixed;
    top: 0;
    right: -360px;
    width: 340px;
    height: 100vh;
    z-index: 8000;
    display: flex;
    flex-direction: column;
    transition: right var(--transition-normal);
}

.theme-panel.active {
    right: 0;
}

.theme-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid var(--glass-border);
}

.theme-panel-header h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
}

.theme-options {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.theme-section {
    margin-bottom: 24px;
}

.theme-section h4 {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}

.theme-mode-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.theme-mode-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 16px;
    background: var(--surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.theme-mode-btn:hover,
.theme-mode-btn.active {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
}

.color-picker-grid {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.color-swatch {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid transparent;
    background: var(--swatch-color);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.color-swatch:hover {
    transform: scale(1.1);
}

.color-swatch.active {
    border-color: white;
    box-shadow: 0 0 0 2px var(--swatch-color);
}

.contrast-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--surface);
    border-radius: 24px;
    transition: var(--transition-fast);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: var(--transition-fast);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--primary);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

/* ============================================
   Modals
   ============================================ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 9500;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    transform: translateY(20px);
    transition: transform var(--transition-normal);
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--glass-border);
}

.modal-header h2 {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.25rem;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--glass-border);
}



/* Report Modal */
.report-modal {
    max-width: 600px;
}

.report-section {
    margin-bottom: 24px;
}

.report-section h4 {
    font-size: 0.85rem;
    margin-bottom: 12px;
}

.report-type-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.report-type-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px;
    background: var(--surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.report-type-btn i {
    font-size: 1.5rem;
}

.report-type-btn:hover,
.report-type-btn.active {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
}

.format-grid {
    display: flex;
    gap: 12px;
}

.format-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 24px;
    background: var(--surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.format-option:has(input:checked) {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.format-option input {
    display: none;
}

.format-option i {
    font-size: 1.5rem;
    color: var(--text-muted);
}

.format-option:has(input:checked) i {
    color: var(--primary);
}

.section-checklist {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.section-checklist label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: var(--surface);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    cursor: pointer;
}

.schedule-options {
    display: flex;
    gap: 12px;
}

.schedule-options select,
.schedule-options input {
    flex: 1;
    padding: 10px 14px;
    background: var(--surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.85rem;
}

/* ============================================
   AI Assistant Panel
   ============================================ */

.ai-panel {
    position: fixed;
    bottom: 24px;
    right: -420px;
    width: 400px;
    height: 500px;
    z-index: 8000;
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    transition: right var(--transition-normal);
}

.ai-panel.active {
    right: 24px;
}

.ai-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--glass-border);
}

.ai-panel-header h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
}

.ai-chat {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.ai-message {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.ai-message.user {
    flex-direction: row-reverse;
}

.ai-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.ai-bubble {
    max-width: 80%;
    padding: 12px 16px;
    background: var(--surface);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    line-height: 1.5;
}

.ai-message.user .ai-bubble {
    background: var(--primary);
    color: white;
}

.ai-suggestions {
    margin-top: 12px;
    padding-left: 0;
    list-style: none;
}

.ai-suggestions li {
    padding: 8px 12px;
    background: var(--surface-hover);
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 0.8rem;
}

.ai-suggestions li:hover {
    background: var(--primary);
    color: white;
}

.ai-input-wrapper {
    display: flex;
    gap: 8px;
    padding: 16px;
    border-top: 1px solid var(--glass-border);
}

.ai-input-wrapper input {
    flex: 1;
    padding: 12px 16px;
    background: var(--surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.85rem;
}

.ai-send-btn {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: var(--radius-md);
    background: var(--primary);
    color: white;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.ai-send-btn:hover {
    background: var(--primary-dark);
}

/* ============================================
   Fancy Select (shared component)
   ============================================ */

.fancy-select {
    padding: 10px 16px;
    background: var(--surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
    color-scheme: dark;
    min-height: 40px;
    appearance: auto;
    -webkit-appearance: menulist;
}

body.light-theme .fancy-select {
    color-scheme: light;
}

.fancy-select option,
.fancy-select optgroup {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

.fancy-select optgroup {
    font-weight: 600;
    font-style: normal;
}


/* ============================================
   Advanced Visual Enhancements
   ============================================ */

/* --- 1. Micro-interactions --- */

/* Subtle hover effect (no lift) */
.bento-card,
.glass-card,
.metric-card,
.exposure-card,
.summary-card {
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.bento-card:hover,
.glass-card:hover,
.metric-card:hover {
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.1);
}

/* Ripple Effect */
.ripple-container {
    position: relative;
    overflow: hidden;
}

.ripple {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.4) 0%, transparent 70%);
    transform: scale(0);
    animation: ripple-expand 0.6s ease-out forwards;
    pointer-events: none;
}

@keyframes ripple-expand {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Morphing Numbers */
.morph-value {
    display: inline-block;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.morph-value.updating {
    animation: morph-pulse 0.4s ease;
}

@keyframes morph-pulse {
    0% { transform: scale(1); filter: blur(0); }
    50% { transform: scale(1.1); filter: blur(2px); color: var(--primary); }
    100% { transform: scale(1); filter: blur(0); }
}

/* Counter Animation */
.counter-animate {
    animation: counter-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes counter-pop {
    0% { transform: scale(0.8); opacity: 0.5; }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); opacity: 1; }
}

/* --- 2. Gradients & Glow Effects --- */

/* Mesh Gradient Background */
.mesh-gradient-bg {
    background: 
        radial-gradient(ellipse at 20% 80%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(16, 185, 129, 0.12) 0%, transparent 50%),
        radial-gradient(ellipse at 40% 40%, rgba(139, 92, 246, 0.1) 0%, transparent 50%),
        var(--bg-primary);
}

/* Aurora Animation Background */
.aurora-bg {
    position: relative;
    overflow: hidden;
}

.aurora-bg::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: 
        conic-gradient(from 0deg at 50% 50%, 
            transparent 0deg, 
            rgba(99, 102, 241, 0.08) 60deg, 
            transparent 120deg,
            rgba(16, 185, 129, 0.06) 180deg,
            transparent 240deg,
            rgba(139, 92, 246, 0.08) 300deg,
            transparent 360deg);
    animation: aurora-rotate 30s linear infinite;
    pointer-events: none;
}

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

/* Glow Effect */
.glow-effect {
    position: relative;
}

.glow-effect::after {
    content: '';
    position: absolute;
    inset: -2px;
    background: linear-gradient(45deg, var(--primary), var(--success), var(--primary));
    border-radius: inherit;
    z-index: -1;
    opacity: 0;
    filter: blur(15px);
    transition: opacity 0.3s ease;
}

.glow-effect:hover::after,
.glow-effect.active::after {
    opacity: 0.5;
}

/* Pulsing Glow for Important Metrics */
.metric-glow {
    animation: metric-glow-pulse 2s ease-in-out infinite;
}

@keyframes metric-glow-pulse {
    0%, 100% { 
        box-shadow: 0 0 20px rgba(99, 102, 241, 0.2);
    }
    50% { 
        box-shadow: 0 0 40px rgba(99, 102, 241, 0.4), 0 0 60px rgba(99, 102, 241, 0.2);
    }
}

/* --- 3. Data Visualization --- */

/* Animated Progress Ring */
.progress-ring {
    position: relative;
    width: 80px;
    height: 80px;
}

.progress-ring svg {
    transform: rotate(-90deg);
}

.progress-ring-circle {
    fill: none;
    stroke: var(--surface);
    stroke-width: 8;
}

.progress-ring-progress {
    fill: none;
    stroke: var(--primary);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 226;
    stroke-dashoffset: 226;
    transition: stroke-dashoffset 1s ease-in-out;
}

.progress-ring-value {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 700;
}

/* Sparkline Container */
.sparkline-container {
    display: inline-block;
    width: 60px;
    height: 20px;
    margin-left: 8px;
    vertical-align: middle;
}

.sparkline {
    stroke: var(--primary);
    stroke-width: 1.5;
    fill: none;
}

.sparkline-fill {
    fill: url(#sparkline-gradient);
    opacity: 0.3;
}

/* Animated Gauge */
.gauge {
    position: relative;
    width: 120px;
    height: 60px;
    overflow: hidden;
}

.gauge-bg {
    position: absolute;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: conic-gradient(
        from 180deg,
        var(--surface) 0deg,
        var(--surface) 180deg
    );
    clip-path: polygon(0 0, 100% 0, 100% 50%, 0 50%);
}

.gauge-fill {
    position: absolute;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: conic-gradient(
        from 180deg,
        var(--success) 0deg,
        var(--warning) 90deg,
        var(--danger) 180deg
    );
    clip-path: polygon(0 0, 100% 0, 100% 50%, 0 50%);
    transform-origin: center center;
    transition: transform 1s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.gauge-needle {
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 4px;
    height: 50px;
    background: var(--text-primary);
    transform-origin: bottom center;
    transform: translateX(-50%) rotate(-90deg);
    transition: transform 1s cubic-bezier(0.34, 1.56, 0.64, 1);
    border-radius: 2px;
}

.gauge-center {
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 20px;
    background: var(--bg-secondary);
    border: 3px solid var(--text-primary);
    border-radius: 50%;
}

/* --- 4. Typography & Layout --- */

/* Variable Font Weight Animation */
.dynamic-weight {
    font-variation-settings: 'wght' 400;
    transition: font-variation-settings 0.3s ease;
}

.dynamic-weight:hover,
.dynamic-weight.emphasis {
    font-variation-settings: 'wght' 700;
}

/* Staggered Animation */
.stagger-container > * {
    opacity: 0;
    transform: translateY(20px);
    animation: stagger-in 0.5s ease forwards;
}

.stagger-container > *:nth-child(1) { animation-delay: 0.05s; }
.stagger-container > *:nth-child(2) { animation-delay: 0.1s; }
.stagger-container > *:nth-child(3) { animation-delay: 0.15s; }
.stagger-container > *:nth-child(4) { animation-delay: 0.2s; }
.stagger-container > *:nth-child(5) { animation-delay: 0.25s; }
.stagger-container > *:nth-child(6) { animation-delay: 0.3s; }
.stagger-container > *:nth-child(7) { animation-delay: 0.35s; }
.stagger-container > *:nth-child(8) { animation-delay: 0.4s; }

@keyframes stagger-in {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Text Gradient */
.text-gradient {
    background: linear-gradient(135deg, var(--primary), var(--success));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Typewriter Effect */
.typewriter {
    overflow: hidden;
    border-right: 2px solid var(--primary);
    white-space: nowrap;
    animation: 
        typewriter-typing 3s steps(40) 1s forwards,
        typewriter-blink 0.75s step-end infinite;
}

@keyframes typewriter-typing {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes typewriter-blink {
    50% { border-color: transparent; }
}

/* --- 5. Immersion & Glassmorphism --- */

/* Enhanced Frosted Glass */
.frosted-glass {
    background: rgba(15, 15, 25, 0.6);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.3),
        inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

/* Spotlight Effect on Focus */
.spotlight-focus:focus-within {
    position: relative;
    z-index: 10;
}

.spotlight-focus:focus-within::before {
    content: '';
    position: fixed;
    inset: 0;
    background: radial-gradient(
        circle at var(--spotlight-x, 50%) var(--spotlight-y, 50%),
        transparent 0%,
        rgba(0, 0, 0, 0.6) 100%
    );
    pointer-events: none;
    z-index: -1;
    animation: spotlight-in 0.3s ease;
}

@keyframes spotlight-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Parallax Card */
.parallax-card {
    transform-style: preserve-3d;
    perspective: 1000px;
}

.parallax-card-inner {
    transition: transform 0.1s ease;
}

.parallax-card:hover .parallax-layer-1 {
    transform: translateZ(20px);
}

.parallax-card:hover .parallax-layer-2 {
    transform: translateZ(40px);
}

/* Depth Layers */
.depth-layer {
    transition: transform 0.3s ease;
}

.depth-1 { transform: translateZ(10px); }
.depth-2 { transform: translateZ(20px); }
.depth-3 { transform: translateZ(30px); }

/* --- 6. Dark Mode Neon Effects --- */

/* Neon Text */
.neon-text {
    color: #fff;
    text-shadow: 
        0 0 5px currentColor,
        0 0 10px currentColor,
        0 0 20px currentColor,
        0 0 40px var(--primary);
}

.neon-text-primary {
    color: var(--primary);
    text-shadow: 
        0 0 5px var(--primary),
        0 0 10px var(--primary),
        0 0 20px var(--primary),
        0 0 40px var(--primary);
}

/* Neon Border */
.neon-border {
    border: 1px solid var(--primary);
    box-shadow: 
        0 0 5px var(--primary),
        0 0 10px var(--primary),
        inset 0 0 5px rgba(99, 102, 241, 0.1);
}

/* Gradient Border Animation */
.gradient-border {
    position: relative;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
}

.gradient-border::before {
    content: '';
    position: absolute;
    inset: -2px;
    background: linear-gradient(
        45deg,
        var(--primary),
        var(--success),
        var(--warning),
        var(--danger),
        var(--primary)
    );
    background-size: 400% 400%;
    border-radius: inherit;
    z-index: -1;
    animation: gradient-flow 8s linear infinite;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gradient-border:hover::before {
    opacity: 1;
}

@keyframes gradient-flow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Inner Glow (Soft Shadow for Dark UI) */
.inner-glow {
    box-shadow: 
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        inset 0 -1px 0 rgba(0, 0, 0, 0.2),
        0 0 20px rgba(99, 102, 241, 0.1);
}

/* Cyberpunk Scanlines */
.scanlines::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.1) 2px,
        rgba(0, 0, 0, 0.1) 4px
    );
    pointer-events: none;
    opacity: 0.3;
}

/* --- 7. Skeleton Loading --- */

.skeleton {
    position: relative;
    overflow: hidden;
    background: var(--surface);
    border-radius: var(--radius-sm);
}

.skeleton::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.08) 50%,
        transparent 100%
    );
    animation: skeleton-shimmer 1.5s infinite;
}

@keyframes skeleton-shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.skeleton-text {
    height: 1em;
    margin-bottom: 0.5em;
    border-radius: 4px;
}

.skeleton-text.short { width: 40%; }
.skeleton-text.medium { width: 70%; }
.skeleton-text.long { width: 100%; }

.skeleton-circle {
    border-radius: 50%;
}

.skeleton-card {
    padding: 16px;
}

/* Task 5: Loading State Overlay */
.loading-state-overlay {
    position: absolute;
    inset: 0;
    background: var(--glass-bg);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    border-radius: inherit;
}

.loading-state-overlay.active {
    opacity: 1;
    visibility: visible;
}

.loading-state-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--glass-border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-message {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-align: center;
}

.loading-timeout-message {
    display: none;
    color: var(--warning);
    font-size: 0.75rem;
    margin-top: 4px;
}

.loading-state-overlay.timeout .loading-timeout-message {
    display: block;
}

/* Skeleton overlays for cards */
.bento-item {
    position: relative;
}

.skeleton-overlay {
    position: absolute;
    inset: 0;
    z-index: 5;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
}

.skeleton-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Rich Tooltips */
.rich-tooltip {
    position: absolute;
    z-index: 9999;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: all 0.2s ease;
    max-width: 300px;
    pointer-events: none;
}

.rich-tooltip.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.rich-tooltip-title {
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.rich-tooltip-content {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.rich-tooltip-arrow {
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 12px;
    background: var(--bg-secondary);
    border-left: 1px solid var(--glass-border);
    border-top: 1px solid var(--glass-border);
    transform: translateX(-50%) rotate(45deg);
}

/* Context Menu */
.context-menu {
    position: fixed;
    z-index: 10000;
    min-width: 180px;
    padding: 8px 0;
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: scale(0.95);
    transform-origin: top left;
    transition: all 0.15s ease;
}

.context-menu.visible {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.context-menu-item:hover {
    background: var(--primary);
    color: white;
}

.context-menu-item i {
    width: 16px;
    text-align: center;
    font-size: 0.85rem;
}

.context-menu-divider {
    height: 1px;
    background: var(--glass-border);
    margin: 8px 0;
}

.context-menu-shortcut {
    margin-left: auto;
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Floating Action Indicators */
.floating-indicator {
    position: fixed;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    font-size: 0.8rem;
    animation: float-in 0.3s ease;
    z-index: 9000;
}

@keyframes float-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading Dots */
.loading-dots {
    display: inline-flex;
    gap: 4px;
}

.loading-dots span {
    width: 6px;
    height: 6px;
    background: var(--primary);
    border-radius: 50%;
    animation: dot-bounce 1.4s ease-in-out infinite both;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes dot-bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

/* Smooth Number Transitions */
.smooth-number {
    display: inline-block;
    font-variant-numeric: tabular-nums;
    transition: transform 0.3s ease;
}

/* Card Shine Effect on Hover */
.shine-effect {
    position: relative;
    overflow: hidden;
}

.shine-effect::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 40%,
        rgba(255, 255, 255, 0.08) 50%,
        transparent 60%
    );
    transform: translateX(-100%) rotate(45deg);
    transition: none;
    pointer-events: none;
}

.shine-effect:hover::before {
    animation: shine-sweep 0.6s ease forwards;
}

@keyframes shine-sweep {
    to { transform: translateX(100%) rotate(45deg); }
}

/* Blur on scroll (for headers) */
.blur-on-scroll {
    transition: backdrop-filter 0.3s ease, background 0.3s ease;
}

.blur-on-scroll.scrolled {
    backdrop-filter: blur(20px);
    background: rgba(10, 10, 18, 0.9);
}

/* ============================================
   Graph View Styles (Task 5.1, 5.2, 5.3)
   ============================================ */

/* Graph Header Bar */
.graph-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    margin-bottom: 16px;
    border-radius: var(--radius-lg);
}

.graph-title h2 {
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.graph-title p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
}

.graph-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Graph Controls Row (for Pricer Graph) */
.graph-controls-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    gap: 16px;
}

.graph-controls-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.graph-controls-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Graph Type Tabs */
.graph-type-tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: var(--surface);
    border-radius: var(--radius-md);
    margin: 0 16px;
}

.graph-type-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.graph-type-tab:hover {
    color: var(--text-primary);
    background: var(--surface-elevated);
}

.graph-type-tab.active {
    color: var(--text-primary);
    background: var(--accent);
    color: white;
}

.graph-type-tab i {
    font-size: 0.875rem;
}

/* Pricer Graph Info Panel */
.pricer-node-info-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pricer-node-info-details .info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    border-bottom: 1px solid var(--border);
}

.pricer-node-info-details .info-row:last-child {
    border-bottom: none;
}

.pricer-node-info-details .info-label {
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pricer-node-info-details .info-value {
    font-weight: 600;
    font-size: 0.875rem;
    max-width: 60%;
    text-align: right;
    word-break: break-all;
}

.pricer-node-info-details .code-location {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: var(--accent);
}

/* Pricer Graph Nodes */
.pricer-graph-svg {
    background: var(--surface);
    border-radius: var(--radius-md);
}

.pricer-node {
    cursor: pointer;
    transition: transform 0.2s ease;
}

.pricer-node:hover circle {
    filter: brightness(1.2);
}

.pricer-node-label {
    pointer-events: none;
}

.pricer-node.search-match circle {
    stroke: #fbbf24;
    stroke-width: 3px;
}

.pricer-node.search-dim {
    opacity: 0.3;
}

.pricer-link {
    stroke-opacity: 0.6;
    transition: stroke-opacity 0.2s ease;
}

.pricer-node-input circle {
    fill: #22c55e;
}

.pricer-node-output circle {
    fill: #ef4444;
}

.pricer-node-scope circle {
    fill: #8b5cf6;
}

.pricer-node-intermediate circle {
    fill: #64748b;
}

/* Instrument Graph Info Panel */
.instrument-info-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.instrument-info-details .info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
}

.instrument-info-details .info-label {
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.instrument-info-details .info-value {
    font-weight: 600;
    font-size: 0.875rem;
}

.instrument-info-details .info-value.positive {
    color: var(--success);
}

.instrument-info-details .info-value.negative {
    color: var(--danger);
}

/* Instrument Graph Nodes */
.inst-node {
    cursor: pointer;
    transition: transform 0.2s ease;
}

.inst-node:hover {
    transform: scale(1.05);
}

.inst-link {
    transition: stroke-opacity 0.2s ease;
}

.inst-node:hover ~ .inst-link {
    stroke-opacity: 1;
}

.zoom-controls {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: var(--surface);
    border-radius: var(--radius-md);
}

/* Task 6.2: Graph Search */
.graph-search-wrapper {
    position: relative;
}

.graph-search-input-container {
    display: flex;
    align-items: center;
    position: relative;
    background: var(--surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    transition: all 0.2s ease;
}

.graph-search-input-container:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-alpha);
}

.graph-search-icon {
    position: absolute;
    left: 10px;
    color: var(--text-muted);
    font-size: 0.875rem;
    pointer-events: none;
}

.graph-search-input {
    width: 180px;
    padding: 8px 32px 8px 32px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.875rem;
    outline: none;
}

.graph-search-input::placeholder {
    color: var(--text-muted);
}

@media (prefers-reduced-motion: reduce) {
    html:focus-within {
        scroll-behavior: auto;
    }
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

body.reduce-motion {
    scroll-behavior: auto;
}

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

body.reduce-motion .animated-bg,
body.reduce-motion #particle-canvas {
    display: none;
}

.graph-search-clear {
    position: absolute;
    right: 4px;
    padding: 4px;
    min-width: auto;
    width: 24px;
    height: 24px;
}

.graph-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    padding: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 100;
}

.search-results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.search-nav-buttons {
    display: flex;
    gap: 2px;
}

.search-nav-buttons .icon-btn {
    padding: 4px;
    min-width: auto;
    width: 24px;
    height: 24px;
}

/* Search highlight on nodes */
.node-highlight-search {
    filter: drop-shadow(0 0 8px var(--accent)) drop-shadow(0 0 16px var(--accent));
}

.node-dimmed {
    opacity: 0.3;
}

.link-dimmed {
    stroke-opacity: 0.1 !important;
}

/* Graph Layout */
.graph-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 16px;
    height: calc(100vh - 200px);
}

/* Main Graph Container */
.graph-main {
    position: relative;
    height: 100%;
    min-height: 400px;
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.graph-content {
    width: 100%;
    height: 100%;
}

.graph-container {
    width: 100%;
    height: 100%;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    overflow: hidden;
}

/* Task 8.1: Canvas rendering mode */
.graph-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
}

.graph-content {
    position: relative;
}

.render-mode-indicator {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 4px 8px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    color: var(--text-muted);
    z-index: 5;
}

.render-mode-indicator.canvas-mode {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.graph-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    z-index: 10;
}

/* Graph SVG Styles */
.graph-svg {
    display: block;
    user-select: none;
    touch-action: none;
    cursor: grab;
}

.graph-svg:active {
    cursor: grabbing;
}

.graph-main-group {
    /* Will be transformed by zoom */
}

.node {
    transition: opacity 0.2s ease, stroke 0.2s ease;
}

.node:hover {
    filter: brightness(1.2);
}

.link {
    fill: none;
    transition: opacity 0.2s ease;
}

.node-label {
    pointer-events: none;
    font-family: 'Inter', sans-serif;
    fill: var(--text-secondary);
}

/* Graph Sidebar */
.graph-sidebar {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

/* Graph Accordion */
.graph-accordion {
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.accordion-section {
    border-bottom: 1px solid var(--glass-border);
}

.accordion-section:last-child {
    border-bottom: none;
}

.accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 14px 16px;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
}

.accordion-header:hover {
    background: var(--bg-hover);
}

.accordion-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.accordion-title i {
    color: var(--accent-primary);
    font-size: 0.8rem;
}

.accordion-icon {
    font-size: 0.7rem;
    color: var(--text-muted);
    transition: transform 0.3s ease;
}

.accordion-header[aria-expanded="true"] .accordion-icon {
    transform: rotate(180deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    padding: 0 16px;
}

.accordion-content.expanded {
    max-height: 500px;
    padding: 0 16px 16px 16px;
}

/* Compact Statistics Row */
.stats-row-compact {
    display: flex;
    gap: 16px;
    margin-bottom: 8px;
}

.stat-compact {
    display: flex;
    align-items: center;
    gap: 6px;
}

.stat-compact .stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.stat-compact .stat-value {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.stat-generated {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--glass-border);
}

.stat-generated .stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.stat-generated .stat-value {
    font-size: 0.75rem;
    color: var(--text-secondary);
}


.sensitivity-deps-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
}

.sensitivity-deps-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}

.sensitivity-deps-item:hover {
    background: var(--bg-hover);
    transform: translateX(2px);
}

.sensitivity-deps-item.active {
    background: rgba(249, 115, 22, 0.15);
    border-left: 3px solid #f97316;
}

.sensitivity-deps-item .param-name {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-primary);
}

.sensitivity-deps-item .dep-count {
    font-size: 0.75rem;
    font-weight: 600;
    color: #f97316;
    background: rgba(249, 115, 22, 0.15);
    padding: 2px 8px;
    border-radius: 10px;
}

/* Critical Path Styles */

.critical-path-info {
    margin-bottom: 12px;
}

.critical-path-length {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

.critical-path-length .stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.critical-path-length .stat-value {
    font-size: 1rem;
    font-weight: 700;
    color: var(--accent-primary);
}

.critical-path-nodes {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
    max-height: 120px;
    overflow-y: auto;
}

.critical-path-nodes .no-data {
    width: 100%;
    text-align: center;
    padding: 16px;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.critical-path-node {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.2s;
}

.critical-path-node:hover {
    background: var(--bg-hover);
}

.critical-path-node.highlighted {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.critical-path-arrow {
    color: var(--text-muted);
    font-size: 0.6rem;
}

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

.accordion-content .btn.active {
    background: #3b82f6;
    color: white;
}

/* Sensitivity Path Styles */

.sensitivity-path-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sensitivity-path-controls .btn {
    width: 100%;
    justify-content: center;
}

.sensitivity-path-controls .btn.active {
    background: var(--accent-primary);
    color: white;
}

.sensitivity-path-controls .btn.active i {
    color: white;
}

.sensitivity-path-controls .form-select {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    font-size: 0.75rem;
    color: var(--text-primary);
}

.panel-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 8px;
    margin-bottom: 0;
}

/* Node Info Styles */

.node-info-content {
    min-height: 100px;
}

.no-selection {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100px;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.node-info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.node-info-id {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.node-info-type {
    font-size: 0.7rem;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    color: white;
    font-weight: 500;
}

.node-info-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--glass-border);
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.info-value {
    font-size: 0.8rem;
    color: var(--text-primary);
    font-weight: 500;
}

.sensitivity-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: rgba(249, 115, 22, 0.15);
    color: #f97316;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 500;
    margin-top: 8px;
}

/* Legend Styles */
.legend-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Graph Tooltip */
.graph-tooltip {
    position: fixed;
    z-index: 1000;
    padding: 12px 16px;
    min-width: 180px;
    border-radius: var(--radius-md);
    pointer-events: none;
    display: none;
    box-shadow: var(--shadow-lg);
}

.tooltip-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--glass-border);
}

.tooltip-label {
    font-weight: 600;
    color: var(--text-primary);
}

.tooltip-type {
    font-size: 0.7rem;
    padding: 2px 6px;
    background: var(--primary);
    color: white;
    border-radius: var(--radius-sm);
}

.tooltip-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tooltip-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
}

.tooltip-row span:first-child {
    color: var(--text-muted);
}

.tooltip-row span:last-child {
    color: var(--text-primary);
    font-weight: 500;
}

.tooltip-badge {
    margin-top: 8px;
    padding: 4px 8px;
    background: rgba(249, 115, 22, 0.15);
    color: #f97316;
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 500;
    text-align: center;
}

/* Responsive Graph Layout */
@media (max-width: 1200px) {
    .graph-layout {
        grid-template-columns: 1fr 280px;
    }
}

@media (max-width: 992px) {
    .graph-layout {
        grid-template-columns: 1fr;
        height: auto;
    }

    .graph-main {
        height: 500px;
    }

    .graph-accordion {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .graph-header-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .graph-controls {
        width: 100%;
        flex-wrap: wrap;
    }

    .graph-main {
        height: 400px;
    }

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

    .stat-item.stat-wide {
        grid-column: span 1;
    }
}

/* ============================================
   Task 7: Responsive Design Improvements
   ============================================ */

/* Task 7.1: Touch Target Sizes (44x44px minimum for mobile) */
@media (max-width: 768px) {
    .icon-btn {
        min-width: 44px;
        min-height: 44px;
        width: 44px;
        height: 44px;
    }

    .primary-btn {
        min-height: 44px;
        padding: 10px 20px;
    }

    .chip-btn {
        min-height: 44px;
        padding: 10px 16px;
    }

    .nav-item {
        min-height: 44px;
        padding: 12px 16px;
    }

    .toggle-switch {
        min-width: 44px;
        min-height: 24px;
    }

    .color-swatch {
        min-width: 44px;
        min-height: 44px;
    }

    .alert-filter {
        min-height: 44px;
        padding: 10px 16px;
    }

    .theme-mode-btn {
        min-height: 44px;
        padding: 12px;
    }

    .report-type-btn {
        min-height: 44px;
        padding: 12px;
    }

    .format-option {
        min-height: 44px;
    }

    /* Increase spacing between touch targets */
    .bento-actions {
        gap: 8px;
    }

    .top-bar-right {
        gap: 8px;
    }
}

/* Task 7.2: Sidebar Collapse (verified - already hidden at 768px) */
/* Existing implementation in media query above is sufficient */

/* Task 7.3: Card Stacking - Vertical stack for dashboard cards */
@media (max-width: 768px) {
    .bento-grid {
        grid-template-columns: 1fr;
    }

    .bento-wide,
    .bento-large,
    .bento-full {
        grid-column: span 1;
    }

    .bento-item {
        width: 100%;
    }
}

/* Task 7.4: Portfolio Table Horizontal Scroll with Sticky Trade ID */
.portfolio-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
}

.portfolio-table-wrapper::-webkit-scrollbar {
    height: 8px;
}

.portfolio-table-wrapper::-webkit-scrollbar-track {
    background: var(--surface);
    border-radius: 4px;
}

.portfolio-table-wrapper::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 4px;
}

.portfolio-table-wrapper::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

@media (max-width: 768px) {
    .portfolio-table {
        min-width: 800px;
    }

    /* Sticky first column (Trade ID) */
    .portfolio-table th:first-child,
    .portfolio-table td:first-child {
        position: sticky;
        left: 0;
        z-index: 2;
        background: var(--glass-bg);
    }

    .portfolio-table th:first-child {
        z-index: 3;
    }

    /* Add shadow to indicate scroll */
    .portfolio-table th:first-child::after,
    .portfolio-table td:first-child::after {
        content: '';
        position: absolute;
        top: 0;
        right: -8px;
        bottom: 0;
        width: 8px;
        background: linear-gradient(to right, rgba(0, 0, 0, 0.1), transparent);
        pointer-events: none;
    }
}

/* Task 7.5: Mobile Summary View (hide non-essential charts below 480px) */
@media (max-width: 480px) {
    /* Hide non-essential charts */
    .exposure-chart-container,
    .mini-chart,
    .sparkline,
    
    #graph-container {
        display: none;
    }

    /* Show summary metrics prominently */
    .metric-value {
        font-size: 1.5rem;
    }

    .metric-icon {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    /* Stack metric cards */
    .bento-grid {
        gap: 12px;
    }

    .bento-content {
        padding: 16px;
    }

    /* Show mobile summary badge */
    .mobile-summary-only {
        display: block;
    }

    /* Simplify top bar */
    .top-bar-left {
        display: none;
    }

    .top-bar {
        justify-content: flex-end;
    }

    /* Reduce header height */
    :root {
        --header-height: 56px;
    }
}

/* ============================================
   Task 8: Keyboard Navigation Enhancement
   ============================================ */

/* Task 8.1: Focus Indicators - Unified visible focus ring */
:focus {
    outline: none;
}

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

/* Specific focus styles for different elements */
.icon-btn:focus-visible,
.primary-btn:focus-visible,
.chip-btn:focus-visible,
.nav-item:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
}

.toggle-switch input:focus-visible + .toggle-slider {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Table row focus for keyboard navigation */
.portfolio-table tbody tr:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
    background: var(--surface-hover);
}

.portfolio-table tbody tr[tabindex="0"] {
    cursor: pointer;
}

/* Command palette item focus */
.command-item:focus-visible {
    background: var(--surface-hover);
    outline: none;
    box-shadow: inset 0 0 0 2px var(--primary);
}

/* Modal focus trap indicator */
.modal:focus-visible,
.modal [tabindex="-1"]:focus-visible {
    outline: none;
}

/* ============================================
   Task 9: Accessibility (WCAG 2.1 AA)
   ============================================ */

/* Task 9.1: Ensure ARIA labels have proper styles */
[aria-label],
[aria-labelledby] {
    /* No visual change, but ensures elements are interactive */
}

/* Visually hidden class for screen reader only content */
.visually-hidden,
.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;
}

/* Task 9.2: ARIA Live Regions styling */
[aria-live] {
    /* Ensure live regions are not visually disruptive */
}

.toast-container[aria-live="polite"] {
    /* Already styled, ensure it's accessible */
}

/* Status indicator for screen readers */
.connection-status[role="status"] {
    /* Visual styling already applied */
}

/* Task 9.3: Color Contrast Improvements */
/* Ensure text meets 4.5:1 contrast ratio */
.text-muted-accessible {
    color: #8b9bb4; /* Improved from #64748b for better contrast */
}

/* High contrast mode improvements */
body.high-contrast .text-secondary {
    color: #cbd5e1;
}

body.high-contrast .text-muted {
    color: #94a3b8;
}

body.high-contrast .glass-border {
    border-color: rgba(255, 255, 255, 0.25);
}

/* Ensure links are distinguishable */
a:not(.nav-item):not(.skip-link) {
    text-decoration: underline;
    text-underline-offset: 2px;
}

a:not(.nav-item):not(.skip-link):hover {
    text-decoration-thickness: 2px;
}

/* Task 9.4: Chart Alternative Text */
.chart-description {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Chart container with describedby */
[aria-describedby] canvas {
    /* Ensure canvas is accessible */
}

/* Task 9.5: Table Header Accessibility */
.portfolio-table th[scope="col"],
.portfolio-table th[scope="row"] {
    font-weight: 600;
    text-align: left;
}

.portfolio-table caption {
    caption-side: top;
    text-align: left;
    padding: 12px 16px;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--surface);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

/* Task 9.6: Reduce Motion - Additional selectors */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .gradient-orb {
        animation: none;
    }

    .glass-card:hover {
        transform: none;
    }

    .primary-btn:hover {
        transform: none;
    }
}

/* Also apply when body has reduce-motion class */
body.reduce-motion *,
body.reduce-motion *::before,
body.reduce-motion *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
}

body.reduce-motion .gradient-orb {
    animation: none;
}

body.reduce-motion .glass-card:hover,
body.reduce-motion .primary-btn:hover {
    transform: none;
}

/* ============================================
   Task 5: Loading State Overlay (Enhancement)
   ============================================ */

.loading-state-overlay {
    position: absolute;
    inset: 0;
    background: rgba(10, 10, 15, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.loading-state-overlay.active {
    opacity: 1;
    visibility: visible;
}

.loading-state-content {
    text-align: center;
    color: var(--text-primary);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--glass-border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 12px;
}

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

.loading-message {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.loading-timeout-message {
    font-size: 0.75rem;
    color: var(--warning);
    margin-top: 8px;
    display: none;
}

.loading-state-overlay.timeout .loading-timeout-message {
    display: block;
}

body.light-theme .loading-state-overlay {
    background: rgba(248, 250, 252, 0.9);
}

/* =============================================================================
   Task 5.1: Pricer View Styles
   ============================================================================= */

.pricer-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    height: 100%;
    padding: 1.5rem;
}

.pricer-header {
    padding: 1.5rem;
    border-radius: var(--radius-lg);
}

.pricer-header h2 {
    margin: 0 0 0.5rem 0;
    font-size: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.pricer-header p {
    margin: 0;
    color: var(--text-secondary);
}

.pricer-layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 1.5rem;
    flex: 1;
    min-height: 0;
}

/* Form Panel */
.pricer-form-panel {
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.pricer-form-panel h3 {
    margin: 0 0 1rem 0;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
}

.pricer-form {
    display: none;
}

.pricer-form.active {
    display: block;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.pricer-form-panel .form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.pricer-form-panel label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.pricer-form-panel input[type="number"] {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.9375rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.pricer-form-panel input[type="number"]:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-alpha);
}

.greeks-toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 0;
    border-top: 1px solid var(--border);
    margin-top: auto;
}

.greeks-toggle span {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.calculate-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--accent), var(--accent-dark, #4f46e5));
    color: white;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.calculate-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px var(--accent-alpha);
}

.calculate-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.pricer-error {
    padding: 0.75rem 1rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-md);
    color: #ef4444;
    font-size: 0.875rem;
    margin-top: 1rem;
}

/* Results Panel */
.pricer-results-panel {
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.pricer-results-panel h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
}

.pv-display {
    text-align: center;
    padding: 2rem;
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-primary));
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

.pv-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.pv-value {
    font-size: 2.5rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-primary);
}

.pv-value.positive {
    color: #10b981;
}

.pv-value.negative {
    color: #ef4444;
}

.greeks-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
}

.greek-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    transition: border-color 0.2s ease;
}

.greek-card:hover {
    border-color: var(--accent);
}

.greek-name {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.greek-value {
    font-size: 1rem;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-primary);
}

.greek-value.positive {
    color: #10b981;
}

.greek-value.negative {
    color: #ef4444;
}

.calc-info {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.history-list.horizontal {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 0.75rem;
    padding-bottom: 0.5rem;
}

.history-list.horizontal .history-item {
    flex: 0 0 auto;
    min-width: 180px;
    max-width: 220px;
}

.history-list.horizontal .history-empty {
    flex-direction: row;
    gap: 0.75rem;
    padding: 1rem;
}

.history-list.horizontal .history-empty i {
    font-size: 1.25rem;
    margin-bottom: 0;
}

.history-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.history-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: var(--text-secondary);
    text-align: center;
}

.history-empty i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    opacity: 0.5;
}

.history-item {
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s ease;
}

.history-item:hover {
    border-color: var(--accent);
    background: var(--bg-primary);
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

.history-type {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.history-time {
    font-size: 0.6875rem;
    color: var(--text-secondary);
}

.history-item-value {
    font-size: 0.875rem;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
}

.history-item-value.positive {
    color: #10b981;
}

.history-item-value.negative {
    color: #ef4444;
}

.secondary-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s ease;
}

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

/* Responsive adjustments */
@media (max-width: 1400px) {
    .pricer-layout {
        grid-template-columns: 350px 1fr;
    }

    .greeks-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 1200px) {
    .pricer-layout {
        grid-template-columns: 1fr 1fr;
    }

    .greeks-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .pricer-container {
        padding: 1rem;
    }

    .pricer-layout {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .greeks-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .greek-card:last-child {
        grid-column: span 2;
    }

    .history-list.horizontal .history-item {
        min-width: 160px;
    }
}

/* Light theme adjustments */
body.light-theme .pricer-form-panel input[type="number"] {
    background: white;
    border-color: #e2e8f0;
}

body.light-theme .pv-display {
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
}

body.light-theme .greek-card {
    background: white;
    border-color: #e2e8f0;
}

body.light-theme .history-item {
    background: white;
    border-color: #e2e8f0;
}

/* =============================================================================
   Trade Expansion View (pricer-trade-expansion-ui)
   ============================================================================= */

.trade-expansion-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    height: 100%;
    padding: 1.5rem;
}

.trade-expansion-header {
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.trade-expansion-actions {
    display: flex;
    gap: 0.75rem;
}

.trade-expansion-title h2 {
    margin: 0 0 0.5rem 0;
    font-size: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.trade-expansion-title p {
    margin: 0;
    color: var(--text-secondary);
}

.trade-expansion-layout {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 1.5rem;
    flex: 1;
    min-height: 0;
}

/* Form Panel */
.trade-expansion-form-panel {
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow-y: auto;
}

.trade-expansion-form-panel h3 {
    margin: 0 0 1rem 0;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
}

.expansion-form {
    display: none;
}

.expansion-form.active {
    display: block;
}

.trade-expansion-form-panel .form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.trade-expansion-form-panel label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.trade-expansion-form-panel input[type="number"],
.trade-expansion-form-panel input[type="date"],
.trade-expansion-form-panel input[type="text"] {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.9375rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.trade-expansion-form-panel input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-alpha);
}

/* Results Panel */
.trade-expansion-results-panel {
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    overflow-y: auto;
}

.trade-expansion-results-panel h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
}

/* Trade Summary Card */
.trade-summary-card {
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-primary));
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

.trade-summary-header {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.trade-summary-id,
.trade-summary-type {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.trade-summary-id .label,
.trade-summary-type .label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.trade-summary-id .value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.trade-summary-type .value {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
}

.trade-summary-status {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    font-weight: 600;
}

.trade-summary-status.success {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.trade-summary-status.error {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.trade-summary-stats {
    display: flex;
    gap: 2rem;
}

.trade-summary-stats .stat {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.trade-summary-stats .stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.trade-summary-stats .stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-primary);
}

/* Empty State */
.trade-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
    text-align: center;
}

.trade-empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.4;
}

.trade-empty-state p {
    margin: 0;
    font-size: 0.9375rem;
}

/* Legs Container */
.legs-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Leg Card */
.leg-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: border-color 0.2s ease;
}

.leg-card:hover {
    border-color: var(--accent-alpha);
}

.leg-card-header {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    cursor: pointer;
    user-select: none;
    gap: 1rem;
}

.leg-card-header:hover {
    background: var(--bg-primary);
}

.leg-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    background: var(--accent);
    color: white;
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    font-weight: 700;
}

.leg-info {
    display: flex;
    gap: 2rem;
    flex: 1;
}

.leg-info-item {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.leg-info-item .label {
    font-size: 0.6875rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.leg-info-item .value {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

.leg-info-item .value.pay {
    color: #ef4444;
}

.leg-info-item .value.receive {
    color: #10b981;
}

.leg-cf-count {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.leg-cf-count strong {
    color: var(--text-primary);
}

.leg-toggle-icon {
    color: var(--text-secondary);
    transition: transform 0.2s ease;
}

.leg-card.expanded .leg-toggle-icon {
    transform: rotate(180deg);
}

/* Cashflow Table */
.leg-card-body {
    display: none;
    border-top: 1px solid var(--border);
}

.leg-card.expanded .leg-card-body {
    display: block;
}

.cf-table-container {
    overflow-x: auto;
}

.cf-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

.cf-table th,
.cf-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    white-space: nowrap;
}

.cf-table th {
    background: var(--bg-primary);
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 0.6875rem;
    letter-spacing: 0.05em;
    cursor: pointer;
    user-select: none;
    transition: color 0.2s ease;
}

.cf-table th:hover {
    color: var(--text-primary);
}

.cf-table th.sorted {
    color: var(--accent);
}

.cf-table th .sort-icon {
    margin-left: 0.25rem;
    opacity: 0.5;
}

.cf-table th.sorted .sort-icon {
    opacity: 1;
}

.cf-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background 0.15s ease;
}

.cf-table tbody tr:hover {
    background: var(--bg-primary);
}

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

.cf-table td {
    color: var(--text-primary);
}

.cf-table td.mono {
    font-family: 'JetBrains Mono', monospace;
}

.cf-table td.positive {
    color: #10b981;
}

.cf-table td.negative {
    color: #ef4444;
}

/* Pagination */
.cf-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    border-top: 1px solid var(--border);
}

.cf-pagination button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.cf-pagination button:hover:not(:disabled) {
    background: var(--bg-primary);
    border-color: var(--accent);
    color: var(--accent);
}

.cf-pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.cf-pagination .page-info {
    font-size: 0.75rem;
    color: var(--text-secondary);
    padding: 0 0.5rem;
}

/* Responsive */
@media (max-width: 1200px) {
    .trade-expansion-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .trade-expansion-container {
        padding: 1rem;
    }

    .trade-summary-header {
        flex-wrap: wrap;
        gap: 1rem;
    }

    .trade-summary-status {
        margin-left: 0;
    }

    .trade-summary-stats {
        flex-wrap: wrap;
        gap: 1rem;
    }

    .leg-info {
        flex-wrap: wrap;
        gap: 0.75rem;
    }
}

/* Light Theme */
body.light-theme .trade-expansion-form-panel input[type="number"],
body.light-theme .trade-expansion-form-panel input[type="date"],
body.light-theme .trade-expansion-form-panel input[type="text"] {
    background: white;
    border-color: #e2e8f0;
}

body.light-theme .trade-summary-card {
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
}

body.light-theme .leg-card {
    background: white;
    border-color: #e2e8f0;
}

body.light-theme .cf-table th {
    background: #f1f5f9;
}

/* Daily Accruals Accordion */
.expand-col {
    width: 40px;
}

.expand-cell {
    padding: 0.5rem !important;
    text-align: center;
}

.expand-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 4px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.expand-btn:hover {
    background: var(--primary);
    color: white;
}

.expandable-row {
    cursor: pointer;
}

.expandable-row.expanded {
    background: rgba(99, 102, 241, 0.1);
}

.daily-accruals-row {
    background: var(--bg-secondary) !important;
}

.daily-accruals-row:hover {
    background: var(--bg-secondary) !important;
}

.daily-accruals-container {
    padding: 1rem;
    border-radius: 8px;
    background: var(--bg-tertiary);
    margin: 0.5rem;
}

.daily-accruals-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary);
}

.daily-accruals-header i {
    font-size: 0.9rem;
}

.daily-accruals-scroll {
    max-height: 300px;
    overflow-y: auto;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.daily-accruals-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.75rem;
}

.daily-accruals-table th {
    position: sticky;
    top: 0;
    background: var(--bg-primary);
    padding: 8px 12px;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    z-index: 1;
}

.daily-accruals-table td {
    padding: 6px 12px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    text-align: left;
}

.daily-accruals-table td.mono {
    font-family: 'JetBrains Mono', monospace;
}

.daily-accruals-table tbody tr:hover {
    background: rgba(99, 102, 241, 0.05);
}

.daily-accruals-table .more-rows td {
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
    padding: 12px;
}

.daily-accruals-table .more-rows-toggle td {
    text-align: center;
    padding: 8px 12px;
}

.show-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--accent-color);
    background: transparent;
    border: 1px solid var(--accent-color);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.show-more-btn:hover {
    background: var(--accent-color);
    color: white;
}

.show-more-btn i {
    font-size: 0.7rem;
}

body.light-theme .show-more-btn {
    color: var(--accent-color);
    border-color: var(--accent-color);
}

body.light-theme .show-more-btn:hover {
    background: var(--accent-color);
    color: white;
}

body.light-theme .expand-btn {
    background: #e2e8f0;
}

body.light-theme .daily-accruals-container {
    background: #f8fafc;
}

body.light-theme .daily-accruals-row {
    background: #f1f5f9 !important;
}

body.light-theme .daily-accruals-table th {
    background: #e2e8f0;
}

/* =============================================================================
   IRS Bootstrap & Risk View (Task 7.1-7.6, 8.1-9.3)
   ============================================================================= */

.irs-bootstrap-container {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: relative;
    min-height: calc(100vh - 140px);
}

/* Header with Step Indicator */
.irs-bootstrap-header {
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.irs-header-title h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.irs-header-title h2 i {
    color: var(--primary);
}

.irs-header-title p {
    margin: 0.25rem 0 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Step Indicator (Task 7.5) */
.step-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    cursor: pointer;
    opacity: 0.5;
    transition: var(--transition-normal);
}

.step.active {
    opacity: 1;
}

.step.completed {
    opacity: 1;
}

.step.completed .step-number {
    background: var(--success);
}

.step-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    border: 2px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    transition: var(--transition-normal);
}

.step.active .step-number {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.step-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.step.active .step-label {
    color: var(--primary);
}

.step-connector {
    width: 40px;
    height: 2px;
    background: var(--glass-border);
    position: relative;
}

.step-connector::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 0;
    background: var(--primary);
    transition: width 0.3s ease;
}

.step-connector.active::after {
    width: 100%;
}

/* Main Layout */
.irs-bootstrap-layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 1.5rem;
    flex: 1;
    align-items: start;
}

/* Input Panel */
.irs-input-panel {
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    overflow-y: auto;
}

.irs-section {
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 1.5rem;
}

.irs-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.irs-section.collapsed .section-header ~ * {
    display: none;
}

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

.section-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-header h3 i {
    color: var(--primary);
    font-size: 0.875rem;
}

.section-status {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-style: italic;
}

.section-actions {
    display: flex;
    gap: 0.5rem;
}

/* Preset Buttons (Task 7.3) */
.preset-btn {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    border-radius: 6px;
    background: var(--bg-tertiary);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-normal);
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

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

.preset-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Par Rate Grid (Task 7.2) */
.par-rate-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.par-rate-input {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.par-rate-input label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.par-rate-input input {
    padding: 0.5rem;
    font-size: 0.875rem;
    border-radius: 6px;
    background: var(--bg-primary);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    transition: var(--transition-normal);
}

.par-rate-input input:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* IRS Parameters Form (Task 7.4) */
.irs-params-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.input-hint {
    font-size: 0.7rem;
    color: var(--text-secondary);
    opacity: 0.7;
}

.button-row {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.button-row .primary-btn,
.button-row .secondary-btn {
    flex: 1;
}

/* Error Display */
.irs-error {
    padding: 1rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    color: #ef4444;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
}

/* Results Panel */
.irs-results-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto auto;
    gap: 1.5rem;
    align-content: start;
}

.irs-result-card {
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.irs-result-card.wide {
    grid-column: span 2;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.result-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.result-header h3 i {
    color: var(--primary);
    font-size: 0.875rem;
}

.result-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.result-status .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-secondary);
}

.result-status.success .status-dot {
    background: var(--success);
}

.result-status.loading .status-dot {
    background: var(--warning);
    animation: pulse 1s infinite;
}

.result-actions {
    display: flex;
    gap: 0.25rem;
}

/* Curve Chart Container (Task 8.1) */
.curve-chart-container {
    position: relative;
    height: 200px;
    background: var(--bg-primary);
    border-radius: 8px;
    overflow: hidden;
}

.curve-chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}

.chart-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    color: var(--text-secondary);
}

.chart-placeholder i {
    font-size: 2rem;
    opacity: 0.5;
}

.chart-placeholder p {
    margin: 0;
    font-size: 0.875rem;
}

.curve-info {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--glass-border);
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.info-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
}

/* IRS Pricing Results (Task 8.2) */
.pricing-results {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.npv-display {
    text-align: center;
    padding: 1rem;
    background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-secondary));
    border-radius: 8px;
}

.npv-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.25rem;
}

.npv-value {
    font-size: 1.75rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
}

.npv-value.positive {
    color: var(--success);
}

.npv-value.negative {
    color: var(--danger);
}

.leg-breakdown {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.leg-item {
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: 6px;
    text-align: center;
}

.leg-label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.leg-value {
    font-size: 1rem;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-primary);
}

.pricing-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: right;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.375rem;
}

.pricing-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 2rem;
    color: var(--text-secondary);
}

.pricing-placeholder i {
    font-size: 2rem;
    opacity: 0.5;
}

/* Delta Table (Task 9.1) */
.delta-table-container {
    overflow-x: auto;
}

.delta-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.delta-table th,
.delta-table td {
    padding: 0.75rem;
    text-align: right;
    border-bottom: 1px solid var(--glass-border);
}

.delta-table th {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--bg-tertiary);
}

.delta-table th:first-child,
.delta-table td:first-child {
    text-align: left;
}

.delta-table td {
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-primary);
}

.delta-table tbody tr:hover {
    background: var(--bg-tertiary);
}

.delta-table .dv01-row {
    font-weight: 700;
    background: var(--bg-tertiary);
}

.delta-table .dv01-row td {
    border-top: 2px solid var(--primary);
}

.delta-diff {
    font-size: 0.75rem;
}

.delta-diff.warning {
    color: var(--warning);
}

.delta-diff.success {
    color: var(--success);
}

/* Timing Chart (Task 9.2) */
.timing-chart-container {
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: 8px;
}

.timing-chart-container h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.timing-chart-container h4 i {
    color: var(--primary);
}

.timing-chart-container canvas {
    max-height: 150px;
}

.speedup-display {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--glass-border);
}

.speedup-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.speedup-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--success);
    font-family: 'JetBrains Mono', monospace;
}

/* Benchmark Warning (Task 9.3) */
.benchmark-warning {
    padding: 1rem;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 8px;
    color: var(--warning);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
}

.risk-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 3rem;
    color: var(--text-secondary);
}

.risk-placeholder i {
    font-size: 2.5rem;
    opacity: 0.5;
}

/* Loading Overlay (Task 7.5) */
.irs-loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(10, 10, 15, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    border-radius: inherit;
}

.irs-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.spinner-ring {
    width: 48px;
    height: 48px;
    border: 3px solid var(--glass-border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

#irs-loading-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Responsive Layout (Task 7.6) */
@media (max-width: 1200px) {
    .irs-bootstrap-layout {
        grid-template-columns: 1fr;
    }

    .irs-input-panel {
        max-height: none;
    }

    .irs-results-panel {
        grid-template-columns: 1fr;
    }

    .irs-result-card.wide {
        grid-column: span 1;
    }
}

@media (max-width: 768px) {
    .irs-bootstrap-container {
        padding: 1rem;
    }

    .irs-bootstrap-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .step-indicator {
        width: 100%;
        justify-content: center;
    }

    .par-rate-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .curve-info {
        grid-template-columns: 1fr;
    }

    .delta-table {
        font-size: 0.75rem;
    }

    .delta-table th,
    .delta-table td {
        padding: 0.5rem;
    }
}

@media (max-width: 480px) {
    .par-rate-grid {
        grid-template-columns: 1fr;
    }

    .section-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .preset-btn {
        flex: 1;
        justify-content: center;
    }

    .leg-breakdown {
        grid-template-columns: 1fr;
    }
}

/* Light theme adjustments */
body.light-theme .irs-input-panel input,
body.light-theme .irs-input-panel select {
    background: white;
    border-color: #e2e8f0;
}

body.light-theme .npv-display {
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
}

body.light-theme .leg-item {
    background: #f1f5f9;
}

body.light-theme .timing-chart-container {
    background: #f1f5f9;
}

body.light-theme .delta-table th {
    background: #f1f5f9;
}

body.light-theme .delta-table tbody tr:hover {
    background: #f8fafc;
}

body.light-theme .irs-loading-overlay {
    background: rgba(248, 250, 252, 0.9);
}

/* ============================================
   Curve Builder View (curve-builder-webapp)
   ============================================ */

.curve-builder-container {
    display: flex;
    flex-direction: column;
    gap: var(--gap);
    padding: var(--gap);
    height: 100%;
    overflow-y: auto;
    position: relative;
}

.curve-builder-header {
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.curve-builder-title h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
}

.curve-builder-title h2 i {
    color: var(--primary);
}

.curve-builder-title p {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-top: 0.25rem;
    margin-bottom: 0;
}

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

.curve-builder-actions {
    display: flex;
    gap: 0.75rem;
}

/* Rebuild Notification */
.rebuild-notification {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(241, 196, 15, 0.2);
    border: 1px solid rgba(241, 196, 15, 0.4);
    border-radius: 8px;
    color: #f1c40f;
    font-size: 0.875rem;
}

.rebuild-notification i {
    color: #f1c40f;
}

/* Main Layout */
.curve-builder-layout {
    display: grid;
    grid-template-columns: minmax(350px, 1fr) minmax(0, 1.5fr);
    gap: var(--gap);
    flex: 1;
    min-width: 0;
}

/* Input Panel */
.curve-builder-input-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 20px;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
    border-radius: var(--radius-lg);
    min-width: 0;
}

/* Curve Section */
.curve-section {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 16px;
}

.curve-section:last-of-type {
    border-bottom: none;
    padding-bottom: 0;
}

/* Index Selection Card - slightly larger */
#index-section {
    padding-top: 8px;
    padding-bottom: 24px;
}

#index-selector-container {
    margin-top: 8px;
}

#index-selector-container select {
    width: 100%;
    max-width: 300px;
}


.curve-section .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.curve-section .section-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.curve-section .section-header h3 i {
    color: var(--primary);
    font-size: 0.9rem;
}

.curve-section .section-actions {
    display: flex;
    gap: 8px;
}

/* Changes Indicator */
.changes-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(52, 152, 219, 0.1);
    border-radius: 6px;
    font-size: 0.75rem;
    color: var(--primary);
    margin-bottom: 12px;
}

/* Instrument Table */
.instrument-table-wrapper {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

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

.instrument-table th,
.instrument-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.instrument-table th {
    position: sticky;
    top: 0;
    z-index: 10;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--bg-tertiary);
}

.instrument-table tbody tr:hover {
    background: rgba(52, 152, 219, 0.05);
}

.instrument-table tbody tr.modified {
    background: rgba(52, 152, 219, 0.1);
}

.instrument-type-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.instrument-type-badge.deposit {
    background: rgba(46, 204, 113, 0.2);
    color: #2ecc71;
}

.instrument-type-badge.ois {
    background: rgba(52, 152, 219, 0.2);
    color: #3498db;
}

.instrument-type-badge.swap {
    background: rgba(155, 89, 182, 0.2);
    color: #9b59b6;
}

.rate-input {
    width: 100px;
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    text-align: right;
}

.rate-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.rate-input.error {
    border-color: #e74c3c;
    box-shadow: 0 0 0 2px rgba(231, 76, 60, 0.2);
}

.rate-input.warning {
    border-color: #f1c40f;
    box-shadow: 0 0 0 2px rgba(241, 196, 15, 0.2);
}

.status-col {
    width: 40px;
    text-align: center;
}

.modified-icon {
    color: var(--primary);
    font-size: 0.75rem;
}

/* Builder Settings Grid */
.builder-settings-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.builder-settings-grid .form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.builder-settings-grid .form-group label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.builder-settings-grid .form-group label i {
    color: var(--primary);
}

.input-hint {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Advanced Settings */
.advanced-settings {
    margin-top: 8px;
}

.advanced-settings summary {
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 0;
}

.advanced-settings summary:hover {
    color: var(--primary);
}

.advanced-settings-content {
    padding-top: 12px;
}

.advanced-settings .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* Preset Controls */
.preset-controls {
    margin-top: 8px;
}

.preset-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
}

.preset-buttons select {
    flex: 1;
}

/* Build Action */
.build-action {
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.primary-btn.large {
    width: 100%;
    padding: 14px 24px;
    font-size: 1rem;
}

/* Icon Button */
.icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.icon-btn:hover {
    background: var(--bg-tertiary);
    color: var(--primary);
    border-color: var(--primary);
}

.icon-btn.danger:hover {
    color: #e74c3c;
    border-color: #e74c3c;
}

.icon-btn.small {
    width: auto;
    padding: 6px 12px;
    font-size: 0.75rem;
    gap: 4px;
}

/* Error Display */
.curve-builder-error {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: rgba(231, 76, 60, 0.1);
    border: 1px solid rgba(231, 76, 60, 0.3);
    border-radius: 8px;
    color: #e74c3c;
    font-size: 0.875rem;
    margin-top: auto;
}

/* Results Panel */
.curve-builder-results-panel {
    display: flex;
    flex-direction: column;
    gap: var(--gap);
    min-width: 0;
    overflow: hidden;
}

/* Result Cards (glass-card style) */
.curve-builder-results-panel .glass-card {
    min-width: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.curve-builder-results-panel .glass-card:hover {
    transform: none;
}

.curve-builder-results-panel .glass-card.wide {
    flex: 1;
}

.curve-builder-results-panel .glass-card .bento-content {
    flex: 1;
    overflow: auto;
}

/* Build Status */
.build-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.build-status .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-secondary);
}

.build-status.success .status-dot {
    background: #2ecc71;
}

.build-status.failed .status-dot {
    background: #e74c3c;
}

/* Build Summary */
.build-summary {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}

.build-summary .summary-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.build-summary .summary-item .label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.build-summary .summary-item .value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    color: var(--text-primary);
}

/* Build Summary Grid - Compact horizontal layout */
.build-summary-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
    align-items: center;
}

.build-summary-grid .summary-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.build-summary-grid .summary-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
    white-space: nowrap;
}

.build-summary-grid .summary-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Export Actions */
.export-actions {
    display: flex;
    gap: 8px;
}

/* Parameter Tabs */
.parameter-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    padding: 4px;
    background: var(--bg-tertiary);
    border-radius: 8px;
}

.parameter-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.parameter-tab:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.parameter-tab.active {
    background: var(--primary);
    color: #ffffff;
}

.parameter-tab i {
    font-size: 0.8rem;
}

/* Tenor Range Controls */
.tenor-range-controls {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    margin-bottom: 16px;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: 8px;
}

.tenor-range-controls .form-group.compact {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tenor-range-controls .form-group.compact label {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.tenor-range-controls input {
    width: 80px;
    padding: 6px 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--card-bg);
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
}

.secondary-btn.small {
    padding: 6px 12px;
    font-size: 0.75rem;
}

/* Parameter Chart Container - Dual Charts */
.curve-charts-wrapper {
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
    margin-bottom: 16px;
}

.parameter-chart-container {
    height: 340px;
    position: relative;
    min-width: 0;
    background: var(--bg-tertiary);
    border-radius: 8px;
    padding: 12px 12px 40px 12px;  /* Extra bottom padding for x-axis labels */
}

.parameter-chart-container canvas {
    width: 100%;
    height: 250px;
}

.parameter-chart-container.short-term,
.parameter-chart-container.long-term {
    display: none;
}

.parameter-chart-container.short-term.visible,
.parameter-chart-container.long-term.visible {
    display: block;
}

.parameter-chart-container .chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
    height: 32px;
}

.parameter-chart-container .chart-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.parameter-chart-container .chart-title i {
    color: var(--primary);
}

.parameter-chart-container .chart-subtitle {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.chart-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    border-radius: 8px;
}

.chart-placeholder i {
    font-size: 3rem;
    opacity: 0.3;
}

.chart-placeholder p {
    margin: 0;
    font-size: 0.875rem;
}

/* Parameter Table */
.parameter-table-section {
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
}

.parameter-table-section summary {
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 0;
}

.parameter-table-section summary:hover {
    color: var(--primary);
}

.parameter-table-wrapper {
    max-height: 250px;
    overflow-y: auto;
    margin-top: 12px;
}

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

.parameter-table th,
.parameter-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.parameter-table th {
    position: sticky;
    top: 0;
    background: var(--bg-tertiary);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.7rem;
    text-transform: uppercase;
    z-index: 10;
}

.parameter-table td {
    font-family: 'JetBrains Mono', monospace;
}

/* Loading Overlay */
.curve-builder-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    border-radius: 12px;
}

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    color: var(--text-primary);
}

.loading-spinner .spinner-ring {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Responsive */
@media (max-width: 1024px) {
    .curve-builder-layout {
        grid-template-columns: 1fr;
    }

    .curve-builder-input-panel {
        max-height: none;
    }
}

/* Light Theme */
body.light-theme .curve-builder-container {
    background: var(--background);
}

body.light-theme .instrument-table th {
    background: #f8fafc;
}

body.light-theme .rate-input {
    background: #ffffff;
    border-color: #e2e8f0;
}

body.light-theme .parameter-tabs {
    background: #f1f5f9;
}

body.light-theme .tenor-range-controls {
    background: #f1f5f9;
}

body.light-theme .tenor-range-controls input {
    background: #ffffff;
}

body.light-theme .chart-placeholder {
    background: #f8fafc;
}

body.light-theme .parameter-table th {
    background: #f8fafc;
}

body.light-theme .curve-builder-loading-overlay {
    background: rgba(248, 250, 252, 0.9);
}

/* Parameter Tabs Row (with CB Meeting toggle) */
.param-tabs-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.param-tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: var(--bg-tertiary);
    border-radius: 8px;
}

.param-tab {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.param-tab:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.param-tab.active {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.cb-meeting-toggle {
    display: flex;
    align-items: center;
}

.cb-meeting-toggle .toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    transition: all 0.2s ease;
}

.cb-meeting-toggle .toggle-label:hover {
    background: rgba(255, 255, 255, 0.08);
}

.cb-meeting-toggle .toggle-label input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: var(--primary);
    cursor: pointer;
}

.cb-meeting-toggle .toggle-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.cb-meeting-toggle .toggle-text i {
    font-size: 0.75rem;
    color: var(--primary);
}

body.light-theme .param-tabs {
    background: #f1f5f9;
}

body.light-theme .param-tab:hover {
    background: rgba(0, 0, 0, 0.05);
}

body.light-theme .cb-meeting-toggle .toggle-label {
    background: #f1f5f9;
}

body.light-theme .cb-meeting-toggle .toggle-label:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* ============================================
   Market Data Viewer (market-data-viewer-webapp)
   ============================================ */

.market-data-container {
    display: flex;
    flex-direction: column;
    gap: var(--gap);
    padding: var(--gap);
    height: 100%;
    overflow-y: auto;
}

/* Header - 2-row layout */
.market-data-header {
    display: flex;
    flex-direction: column;
    padding: 12px 16px;
    gap: 10px;
}

/* Row 1: Title and Stats */
.market-data-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.market-data-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.market-data-title i {
    font-size: 1.25rem;
    color: var(--primary);
}

.market-data-title h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.last-update-badge {
    background: var(--surface);
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    color: var(--text-secondary);
}

/* Market Data Stats Badges */
.market-data-stats-badges {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Row 2: Controls */
.market-data-controls-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.market-data-filters {
    display: flex;
    align-items: center;
    gap: 10px;
}

.stats-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: var(--surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.stats-badge i {
    font-size: 0.65rem;
    opacity: 0.7;
}

.stats-badge.live {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.3);
    color: var(--success);
}

.stats-badge.live i {
    color: var(--success);
    opacity: 1;
}

.stats-badge.displayed {
    background: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.3);
    color: var(--primary);
}

.stats-badge.displayed i {
    color: var(--primary);
    opacity: 1;
}

/* Events Styles */
.event-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 500;
    white-space: nowrap;
}

.event-type-badge.central_bank_meeting {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary);
}

.event-type-badge.economic_release {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.event-type-badge.holiday {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.event-type-badge.news {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.event-type-badge.expiry {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.event-type-badge.other {
    background: rgba(107, 114, 128, 0.15);
    color: var(--text-secondary);
}

.event-date {
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

.event-title {
    font-weight: 500;
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.importance-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.importance-badge.importance-critical {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.4);
}

.importance-badge.importance-high {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.4);
}

.importance-badge.importance-medium {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.importance-badge.importance-low {
    background: rgba(107, 114, 128, 0.15);
    color: var(--text-secondary);
    border: 1px solid rgba(107, 114, 128, 0.3);
}

.event-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 8px;
}

.event-tag {
    display: inline-flex;
    padding: 2px 6px;
    background: var(--surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    font-size: 0.65rem;
    color: var(--text-secondary);
}

/* Asset Class Toggle */
.asset-class-toggle {
    display: flex;
    background: var(--surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 2px;
    gap: 2px;
}

.asset-toggle-btn {
    padding: 5px 12px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.asset-toggle-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.asset-toggle-btn.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Light Theme */
body.light-theme .asset-class-toggle {
    background: white;
    border-color: #e0e0e0;
}

body.light-theme .asset-toggle-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* Market Data Filter Groups (scoped to market-data-controls-row) */
.market-data-controls-row .filter-group.compact {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
}

.market-data-controls-row .filter-group.compact label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.market-data-controls-row .filter-group.compact .filter-select {
    padding: 4px 8px;
    font-size: 0.75rem;
    min-width: 70px;
    background: var(--surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    cursor: pointer;
    transition: border-color var(--transition-fast);
}

.market-data-controls-row .filter-select:hover,
.market-data-controls-row .filter-select:focus {
    border-color: var(--primary);
    outline: none;
}

/* Market Data Action Buttons (scoped) */
.market-data-controls-row .action-buttons {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}

.market-data-controls-row .action-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    background: var(--surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.market-data-controls-row .action-btn:hover {
    background: var(--surface-hover);
    border-color: var(--primary);
}

.market-data-controls-row .action-btn.primary {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.market-data-controls-row .action-btn.primary:hover {
    background: var(--primary-dark);
}

.market-data-controls-row .action-btn i.fa-sync-alt {
    transition: transform 0.3s ease;
}

.market-data-controls-row .action-btn:hover i.fa-sync-alt {
    transform: rotate(90deg);
}

/* Export Dropdown */
.export-dropdown {
    position: relative;
}

.export-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all var(--transition-fast);
    z-index: 100;
    min-width: 160px;
}

.export-dropdown:hover .export-menu,
.export-menu:hover {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.export-option {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 14px;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.export-option:hover {
    background: var(--surface-hover);
}

.export-option i {
    color: var(--text-secondary);
    width: 18px;
}

/* Main Content Grid */
.market-data-grid {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: var(--gap);
    flex: 1;
    min-height: 0;
}

@media (max-width: 1200px) {
    .market-data-grid {
        grid-template-columns: 1fr;
    }
}

/* Rates Panel */
.rates-panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.rates-panel .panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid var(--glass-border);
}

.rates-panel .panel-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.rates-panel .panel-header h3 i {
    color: var(--primary);
}

.rate-stats {
    display: flex;
    gap: 16px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
}

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

.stat-value {
    color: var(--text-primary);
    font-weight: 500;
}

.stat-value.stale-count {
    color: var(--warning);
}

/* Table Container */
.table-container {
    flex: 1;
    overflow: auto;
}

.market-rates-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.market-rates-table th,
.market-rates-table td {
    padding: 10px 14px;
    text-align: left;
    white-space: nowrap;
}

.market-rates-table th {
    background: var(--surface);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: sticky;
    top: 0;
    z-index: 1;
}

.market-rates-table th.sortable {
    cursor: pointer;
    user-select: none;
    transition: color var(--transition-fast);
}

.market-rates-table th.sortable:hover {
    color: var(--primary);
}

.market-rates-table th.sortable i {
    margin-left: 4px;
    font-size: 0.7rem;
    opacity: 0.5;
}

.market-rates-table th.sortable.sorted-asc i:before {
    content: "\f0de";
}

.market-rates-table th.sortable.sorted-desc i:before {
    content: "\f0dd";
}

.market-rates-table th.numeric {
    text-align: right;
}

.market-rates-table tbody tr {
    border-bottom: 1px solid var(--glass-border);
    transition: background var(--transition-fast);
    cursor: pointer;
}

.market-rates-table tbody tr:hover {
    background: var(--surface-hover);
}

.market-rates-table tbody tr.selected {
    background: rgba(99, 102, 241, 0.1);
}

.market-rates-table td.numeric {
    text-align: right;
    font-family: 'JetBrains Mono', 'SF Mono', monospace;
}

.market-rates-table .rate-value {
    font-weight: 500;
    color: var(--text-primary);
}

.market-rates-table .rate-value.positive {
    color: var(--success);
}

.market-rates-table .rate-value.negative {
    color: var(--danger);
}

/* Rate change highlight animation */
.market-rates-table .rate-value.highlight-up {
    animation: highlight-up 0.8s ease;
}

.market-rates-table .rate-value.highlight-down {
    animation: highlight-down 0.8s ease;
}

@keyframes highlight-up {
    0% { background: rgba(16, 185, 129, 0.3); }
    100% { background: transparent; }
}

@keyframes highlight-down {
    0% { background: rgba(239, 68, 68, 0.3); }
    100% { background: transparent; }
}

/* Rate index badge */
.index-badge {
    display: inline-block;
    padding: 2px 6px;
    background: var(--surface);
    border-radius: 4px;
    font-size: 0.7rem;
    color: var(--text-secondary);
}

/* Status indicators */
.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-indicator.fresh {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.status-indicator.stale {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.status-indicator i {
    font-size: 0.65rem;
}

/* Table placeholders */
.table-placeholder,
.table-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--text-muted);
    gap: 12px;
}

.table-placeholder i,
.table-loading i {
    font-size: 2rem;
    opacity: 0.5;
}

.table-loading .loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--glass-border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Detail Panel */
.detail-panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.detail-panel .panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid var(--glass-border);
}

.detail-panel .panel-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.detail-panel .panel-header h3 i {
    color: var(--accent);
}

.close-btn {
    padding: 6px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: color var(--transition-fast);
}

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

.detail-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.detail-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    gap: 12px;
    text-align: center;
}

.detail-placeholder i {
    font-size: 2.5rem;
    opacity: 0.4;
}

/* Rate detail sections */
.detail-section {
    margin-bottom: 20px;
}

.detail-section-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.detail-section-title i {
    font-size: 0.65rem;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--glass-border);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.detail-value {
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 500;
}

.detail-value.large {
    font-size: 1.25rem;
    font-family: 'JetBrains Mono', 'SF Mono', monospace;
}

/* Conventions Section */
.conventions-section {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 16px;
}

@media (max-width: 1200px) {
    .conventions-section {
        grid-template-columns: 1fr;
    }
}

/* Conventions Panel */
.conventions-panel {
    padding: 16px;
}

.conventions-panel .panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.convention-stats .stat-value {
    background: var(--surface);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Convention Detail Panel */
.convention-detail-panel {
    padding: 16px;
    height: fit-content;
    max-height: 400px;
    overflow-y: auto;
}

.convention-detail-panel .panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.convention-detail-panel .panel-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.convention-detail-panel .panel-header h3 i {
    color: var(--primary);
}

.conventions-panel .panel-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.conventions-panel .panel-header h3 i {
    color: var(--purple);
}

.conventions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.convention-card {
    background: var(--surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 14px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

.convention-card.selected {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.convention-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.convention-id {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.convention-type-badge {
    padding: 2px 8px;
    background: rgba(139, 92, 246, 0.15);
    border-radius: 4px;
    font-size: 0.7rem;
    color: var(--purple);
}

.convention-currency {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.convention-default-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
    padding: 2px 6px;
    background: rgba(16, 185, 129, 0.1);
    border-radius: 4px;
    font-size: 0.7rem;
    color: var(--success);
}

.convention-default-badge i {
    font-size: 0.6rem;
}

/* Light Theme Overrides */
body.light-theme .market-data-header {
    background: var(--glass-bg);
}

body.light-theme .filter-select {
    background: white;
    border-color: #e2e8f0;
}

body.light-theme .action-btn {
    background: white;
    border-color: #e2e8f0;
}

body.light-theme .market-rates-table th {
    background: #f1f5f9;
}

body.light-theme .market-rates-table tbody tr:hover {
    background: #f8fafc;
}

body.light-theme .convention-card {
    background: white;
    border-color: #e2e8f0;
}

/* Conventions Empty State */
.conventions-empty {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    color: var(--text-muted);
    text-align: center;
}

.conventions-empty i {
    font-size: 2rem;
    margin-bottom: 8px;
    opacity: 0.5;
}

.conventions-empty p {
    margin: 0;
    font-size: 0.9rem;
}

/* Placeholder hint for empty states */
.placeholder-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
    opacity: 0.7;
}

body.light-theme .export-menu {
    background: white;
    border-color: #e2e8f0;
}

/* ============================================
   Volatility Calibration View
   ============================================ */

.vol-calib-container {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
    padding: var(--space-lg);
    max-width: 1600px;
    margin: 0 auto;
}

.vol-calib-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-lg);
    flex-wrap: wrap;
    gap: var(--space-md);
}

.vol-calib-title h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.vol-calib-title h2 i {
    color: var(--primary);
}

.vol-calib-title p {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-top: var(--space-xs);
}

.vol-calib-actions {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.vol-calib-grid {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: var(--space-lg);
}

@media (max-width: 1200px) {
    .vol-calib-grid {
        grid-template-columns: 1fr;
    }
}

.model-calib-input-panel,
.model-calib-results-panel {
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow-y: auto;
}

.model-calib-input-panel > h3,
.model-calib-results-panel > h3 {
    margin: 0 0 1rem 0;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.model-calib-input-panel > h3 i,
.model-calib-results-panel > h3 i {
    color: var(--primary);
}

/* Model Calib uses curve-section style */
.model-calib-input-panel .curve-section {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 16px;
    margin-bottom: 16px;
}

.model-calib-input-panel .curve-section:last-of-type {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

.vol-calib-input-panel h4,
.model-calib-input-panel h4 {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin: 1.5rem 0 0.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.vol-calib-input-section {
    margin-bottom: 1rem;
}

.vol-calib-input-section label {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.vol-quote-grid {
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.vol-quote-row {
    display: grid;
    grid-template-columns: 60px 1fr 1fr 70px;
    gap: 2px;
    background: var(--surface);
    padding: 0.5rem;
    align-items: center;
}

.vol-quote-row.header {
    background: var(--bg-tertiary);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.vol-quote-row span:first-child {
    font-weight: 500;
    color: var(--text-secondary);
}

.vol-input {
    width: 100%;
    padding: 0.25rem 0.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.875rem;
    text-align: right;
}

.vol-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.vol-mid {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    color: var(--accent);
    font-weight: 500;
    text-align: right;
}

/* Results Panel */
.vol-calib-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--text-muted);
    text-align: center;
}

.vol-calib-placeholder i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

.vol-calib-placeholder p {
    font-size: 1rem;
}

.vol-calib-params,
.vol-calib-metrics {
    margin-bottom: 1.5rem;
}

.vol-calib-params h4,
.vol-calib-metrics h4,
.vol-surface-chart h4,
.vol-smile-chart h4 {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.param-grid,
.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

@media (max-width: 900px) {
    .param-grid,
    .metric-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.param-item,
.metric-item {
    background: var(--surface);
    padding: 1rem;
    border-radius: var(--radius-md);
    text-align: center;
}

.param-label,
.metric-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.param-value,
.metric-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 600;
    font-family: var(--font-mono);
    color: var(--text-primary);
}

.metric-value.positive {
    color: var(--success);
}

.metric-value.negative {
    color: var(--danger);
}

.vol-surface-chart,
.vol-smile-chart {
    margin-top: 1.5rem;
}

#vol-surface-3d,
#vol-smile-2d {
    min-height: 250px;
    background: var(--surface);
    border-radius: var(--radius-md);
    overflow: hidden;
}

#vol-smile-2d canvas {
    width: 100% !important;
    height: 250px !important;
}

.chart-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 250px;
    background: var(--surface);
    border-radius: var(--radius-md);
    border: 1px dashed var(--border-color);
    color: var(--text-muted);
}

.chart-placeholder i {
    font-size: 2.5rem;
    margin-bottom: var(--space-sm);
    opacity: 0.4;
}

.chart-placeholder p {
    font-size: 0.875rem;
}

.chart-placeholder small {
    font-size: 0.75rem;
    opacity: 0.7;
    margin-top: var(--space-xs);
}

/* Light theme */
body.light-theme .vol-calib-input-panel,
body.light-theme .vol-calib-results-panel {
    background: white;
}

body.light-theme .vol-input {
    background: #f8fafc;
    border-color: #e2e8f0;
}

body.light-theme .vol-quote-row.header {
    background: #f1f5f9;
}

body.light-theme .param-item,
body.light-theme .metric-item {
    background: #f8fafc;
}

body.light-theme .chart-placeholder {
    background: #f8fafc;
    border-color: #e2e8f0;
}

/* ============================================
   Model Calibration - Unified Card Styles
   ============================================ */

.model-calib-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1.5rem;
    height: 100%;
}

/* Header */
.model-calib-header {
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.model-calib-title h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
}

.model-calib-title h2 i {
    color: var(--primary);
}

.model-calib-title p {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-top: 0.25rem;
    margin-bottom: 0;
}

/* Main Grid - Input & Results */
.model-calib-grid {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 1.5rem;
}

@media (max-width: 1200px) {
    .model-calib-grid {
        grid-template-columns: 1fr;
    }
}

/* =====================================================
   Mobile Menu Toggle Button
   ===================================================== */
.mobile-menu-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 10px;
    background: transparent;
    border: none;
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: background 0.2s ease;
}

.mobile-menu-btn:hover {
    background: var(--surface-hover);
}

.mobile-menu-btn:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.hamburger-line {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 1px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Hamburger animation when menu is open */
.mobile-menu-btn.active .hamburger-line:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.mobile-menu-btn.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.mobile-menu-btn.active .hamburger-line:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 768px) {
    .mobile-menu-btn {
        display: flex;
        flex-shrink: 0;
        margin-left: 0;
        margin-right: 4px;
    }

    .top-bar {
        padding-left: 0;
    }
}

/* =============================================================================
   Pricer View Styles (demo-webapp-pricer Task 3.1)
   ============================================================================= */

.pricer-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1.5rem;
    height: 100%;
}

/* Header */
.pricer-header {
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.pricer-title h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
}

.pricer-title p {
    margin: 0.25rem 0 0;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.pricer-actions {
    display: flex;
    gap: 0.75rem;
}

/* Main Grid - 2 Panel Layout */
.pricer-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    flex: 1;
    min-height: 0;
}

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

/* Panels */
.pricer-input-panel,
.pricer-results-panel {
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Sections */
.pricer-section {
    background: var(--card-bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
}

.pricer-section h3 {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pricer-section h3 i {
    color: var(--accent-primary);
    font-size: 0.875rem;
}

/* Form Elements */
.pricer-form-group {
    margin-bottom: 1rem;
}

.pricer-form-group:last-child {
    margin-bottom: 0;
}

.pricer-form-group label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.pricer-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Cashflow Actions */
.pricer-cf-actions {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.pricer-cf-actions .outline-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.pricer-cf-actions .outline-btn:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.pricer-cf-actions .outline-btn:active {
    transform: scale(0.98);
}

.pricer-cf-actions .outline-btn i {
    font-size: 0.75rem;
    opacity: 0.8;
}

.pricer-cf-actions .outline-btn:hover i {
    opacity: 1;
}

/* Reset button danger style on hover */
.pricer-cf-actions #pricer-reset-cf-btn:hover {
    color: var(--danger);
    border-color: var(--danger);
    background: rgba(239, 68, 68, 0.05);
}

/* Cashflow Table Container */
.pricer-cf-table-container {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
}

/* CF Table */
.pricer-cf-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.pricer-cf-table th,
.pricer-cf-table td {
    padding: 0.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.pricer-cf-table th {
    background: var(--card-bg);
    color: var(--text-secondary);
    font-weight: 500;
    position: sticky;
    top: 0;
}

.pricer-cf-table input {
    width: 100%;
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--card-bg);
    color: var(--text-primary);
}

.pricer-cf-table input.modified {
    border-color: var(--warning);
    background: rgba(245, 158, 11, 0.1);
}

.pricer-cf-table input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px var(--accent-primary-transparent);
}

/* Placeholder Text */
.pricer-placeholder {
    color: var(--text-muted);
    text-align: center;
    padding: 2.5rem 1.5rem;
    font-size: 0.875rem;
    background: var(--card-bg);
    border-radius: var(--radius-sm);
    border: 1px dashed var(--border-color);
}

.pricer-placeholder i {
    display: block;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    opacity: 0.5;
}

/* PV Display */
.pricer-pv-display {
    text-align: center;
    padding: 1.5rem;
    background: var(--card-bg);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.pricer-pv-placeholder {
    color: var(--text-muted);
    padding: 1rem 0;
}

.pricer-pv-placeholder i {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    display: block;
    opacity: 0.5;
}

.pricer-pv-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-primary);
    margin-bottom: 0.25rem;
    font-family: 'SF Mono', 'Consolas', monospace;
}

.pricer-pv-value.positive {
    color: var(--success);
}

.pricer-pv-value.negative {
    color: var(--error);
}

.pricer-pv-currency {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Leg Table */
.pricer-leg-table {
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
}

.pricer-leg-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

.pricer-leg-table th,
.pricer-leg-table td {
    padding: 0.625rem 0.75rem;
    text-align: right;
    border-bottom: 1px solid var(--border-color);
}

.pricer-leg-table th {
    text-align: left;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    background: var(--card-bg);
    position: sticky;
    top: 0;
}

.pricer-leg-table td:first-child {
    text-align: left;
    font-weight: 500;
}

.pricer-leg-table td:last-child {
    font-family: 'SF Mono', 'Consolas', monospace;
}

.pricer-leg-row {
    cursor: pointer;
    transition: background var(--transition-fast);
}

.pricer-leg-row:hover {
    background: var(--card-bg-hover);
}

.pricer-leg-row.expanded {
    background: var(--card-bg-hover);
}

.pricer-cf-detail-row {
    background: var(--card-bg-secondary);
}

.pricer-cf-detail-row td {
    padding-left: 2rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Greeks Display */
.pricer-greeks-display {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 0.75rem;
}

.pricer-greek-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 1rem;
    text-align: center;
    transition: border-color var(--transition-fast), transform var(--transition-fast);
}

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

.pricer-greek-card .label {
    font-size: 0.6875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.pricer-greek-card .value {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    font-family: 'SF Mono', 'Consolas', monospace;
}

.pricer-greek-card .value.positive {
    color: var(--success);
}

.pricer-greek-card .value.negative {
    color: var(--error);
}

/* Model Config Fields */
.pricer-model-config {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

/* ============================================
   Pricer Parameter Form Styles
   ============================================ */

.pricer-parameter-form {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--glass-border);
}

.param-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.param-field {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.param-field label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.param-field .required-mark {
    color: var(--error);
    margin-left: 0.25rem;
}

.param-field .fancy-input,
.param-field .fancy-select {
    width: 100%;
}

.param-section-divider {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 0.5rem 0;
}

.param-section-divider::before,
.param-section-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--glass-border);
}

.param-section-divider span {
    font-size: 0.6875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.param-notice {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.8125rem;
}

.param-notice i {
    color: var(--primary);
}

/* Expanded Trade Display */
.expanded-trade-info {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.trade-id-badge,
.trade-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    background: var(--surface);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
}

.trade-id-badge {
    color: var(--primary);
}

.trade-type-badge {
    color: var(--accent);
}

.leg-section {
    margin-bottom: 1.5rem;
}

.leg-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    font-size: 0.8125rem;
    flex-wrap: wrap;
}

.leg-header.payer {
    background: rgba(239, 68, 68, 0.1);
    border-left: 3px solid var(--error);
}

.leg-header.receiver {
    background: rgba(16, 185, 129, 0.1);
    border-left: 3px solid var(--success);
}

.leg-number {
    font-weight: 700;
    color: var(--text-primary);
}

.leg-direction {
    padding: 0.125rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
}

.leg-direction.payer {
    background: var(--error);
    color: #fff;
}

.leg-direction.receiver {
    background: var(--success);
    color: #fff;
}

.leg-currency {
    padding: 0.125rem 0.5rem;
    background: var(--surface);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
}

.leg-type,
.leg-rate-index {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.leg-rate-index {
    color: var(--primary);
}

.leg-section .pricer-cf-table {
    border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.payoff-type {
    display: inline-block;
    padding: 0.125rem 0.375rem;
    background: var(--surface-hover);
    border-radius: var(--radius-xs);
    font-size: 0.6875rem;
    font-weight: 500;
}

.cf-rate {
    margin-left: 0.5rem;
    font-family: 'SF Mono', 'Consolas', monospace;
    font-size: 0.75rem;
    color: var(--primary);
}

.cf-index {
    margin-left: 0.5rem;
    font-size: 0.6875rem;
    color: var(--text-muted);
}

.trade-metadata {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.trade-metadata span {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.trade-metadata i {
    color: var(--primary);
}

.reset-edits-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    margin-left: auto;
    padding: 0.375rem 0.75rem;
    background: var(--warning);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.6875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.reset-edits-btn:hover {
    background: #d97706;
    transform: translateY(-1px);
}

/* ============================================
   Editable Cashflow Table Styles
   ============================================ */

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

.cf-edit-indicator {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: var(--radius-sm);
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--warning);
}

.cf-edit-indicator i {
    font-size: 0.625rem;
}

.leg-section {
    margin-bottom: 1.5rem;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--glass-border);
}

.leg-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    font-size: 0.75rem;
    flex-wrap: wrap;
}

.leg-header.payer {
    background: linear-gradient(90deg, rgba(239, 68, 68, 0.15) 0%, transparent 100%);
    border-left: 3px solid var(--error);
}

.leg-header.receiver {
    background: linear-gradient(90deg, rgba(16, 185, 129, 0.15) 0%, transparent 100%);
    border-left: 3px solid var(--success);
}

.leg-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    background: var(--surface);
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.75rem;
}

.leg-direction-tag {
    padding: 0.125rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.leg-direction-tag.payer {
    background: var(--error);
    color: #fff;
}

.leg-direction-tag.receiver {
    background: var(--success);
    color: #fff;
}

.leg-currency-tag {
    padding: 0.125rem 0.5rem;
    background: var(--primary);
    color: #fff;
    border-radius: var(--radius-sm);
    font-size: 0.625rem;
    font-weight: 700;
}

.leg-type-tag {
    color: var(--text-secondary);
    font-weight: 500;
}

.leg-index-tag {
    padding: 0.125rem 0.375rem;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: var(--radius-sm);
    font-size: 0.625rem;
    color: var(--primary);
    font-weight: 500;
}

.cf-table-wrapper {
    overflow-x: auto;
}

.pricer-cf-table.editable {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
}

.pricer-cf-table.editable th,
.pricer-cf-table.editable td {
    padding: 0.5rem 0.625rem;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
    white-space: nowrap;
}

.pricer-cf-table.editable th {
    background: var(--bg-secondary);
    font-weight: 600;
    font-size: 0.6875rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.pricer-cf-table.editable tr:hover {
    background: var(--surface-hover);
}

.pricer-cf-table.editable tr.edited {
    background: rgba(245, 158, 11, 0.08);
}

.pricer-cf-table.editable tr.edited:hover {
    background: rgba(245, 158, 11, 0.12);
}

/* Column widths */
.col-date { width: 100px; }
.col-period { width: 180px; }
.col-yf { width: 70px; text-align: right; }
.col-notional { width: 100px; }
.col-rate { width: 100px; }
.col-type { width: 120px; }

/* Period styling */
.period-start,
.period-end {
    font-family: 'SF Mono', 'Consolas', monospace;
    font-size: 0.6875rem;
}

.period-arrow {
    margin: 0 0.25rem;
    color: var(--text-muted);
}

/* Editable input fields */
.cf-input {
    width: 100%;
    padding: 0.25rem 0.5rem;
    background: var(--surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: 'SF Mono', 'Consolas', monospace;
    font-size: 0.75rem;
    text-align: right;
    transition: all var(--transition-fast);
}

.cf-input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg-primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.cf-input.modified {
    border-color: var(--warning);
    background: rgba(245, 158, 11, 0.1);
}

.cf-input.modified:focus {
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

.notional-input {
    max-width: 90px;
}

.rate-input {
    max-width: 70px;
}

.rate-unit {
    margin-left: 0.25rem;
    font-size: 0.6875rem;
    color: var(--text-muted);
}

.rate-floating {
    font-size: 0.6875rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Payoff badges */
.payoff-badge {
    display: inline-block;
    padding: 0.125rem 0.375rem;
    border-radius: var(--radius-xs);
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
}

.payoff-badge.fixed {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary);
}

.payoff-badge.linear {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.payoff-badge.vanillaoption {
    background: rgba(236, 72, 153, 0.15);
    color: #ec4899;
}

.index-badge {
    margin-left: 0.375rem;
    padding: 0.125rem 0.375rem;
    background: var(--surface);
    border-radius: var(--radius-xs);
    font-size: 0.5625rem;
    color: var(--text-muted);
}

/* PV Card Styles */
.pricer-pv-card {
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    text-align: center;
}

.pricer-pv-card.positive {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(16, 185, 129, 0.05) 100%);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.pricer-pv-card.negative {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15) 0%, rgba(239, 68, 68, 0.05) 100%);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.pv-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.pv-value {
    font-size: 2rem;
    font-weight: 700;
    font-family: 'SF Mono', 'Consolas', monospace;
}

.pricer-pv-card.positive .pv-value {
    color: var(--success);
}

.pricer-pv-card.negative .pv-value {
    color: var(--error);
}

.pv-meta {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Leg Table Improvements */
.pricer-leg-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.pricer-leg-table th,
.pricer-leg-table td {
    padding: 0.625rem 0.75rem;
    text-align: left;
    font-size: 0.8125rem;
    border-bottom: 1px solid var(--glass-border);
}

.pricer-leg-table th {
    background: var(--bg-secondary);
    font-weight: 600;
    color: var(--text-secondary);
}

.pricer-leg-table tfoot td {
    background: var(--surface);
    font-weight: 600;
}

.pricer-leg-table td.positive {
    color: var(--success);
}

.pricer-leg-table td.negative {
    color: var(--error);
}

/* Greeks Grid */
.pricer-greeks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
}

.greek-card {
    padding: 1rem;
    background: var(--surface);
    border-radius: var(--radius-md);
    text-align: center;
    transition: transform var(--transition-fast);
}

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

.greek-label {
    font-size: 0.6875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.375rem;
}

.greek-value {
    font-size: 1.25rem;
    font-weight: 700;
    font-family: 'SF Mono', 'Consolas', monospace;
    color: var(--text-primary);
}

.greek-value.positive {
    color: var(--success);
}

.greek-value.negative {
    color: var(--error);
}

/* API Notice */
.pricer-api-notice {
    padding: 1.5rem;
    background: var(--surface);
    border-radius: var(--radius-md);
    text-align: center;
}

.pricer-api-notice i {
    font-size: 2rem;
    color: var(--warning);
    margin-bottom: 1rem;
}

.pricer-api-notice p {
    color: var(--text-secondary);
    margin: 0.5rem 0;
}

/* ============================================
   VolCube Builder Styles (volcube-calibration-ui)
   ============================================ */

/* Header Actions */
.volcube-header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.volcube-tabs {
    display: flex;
    gap: 0.5rem;
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: 0.25rem;
}

.volcube-tab {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 0.875rem;
}

.volcube-tab:hover {
    color: var(--text-primary);
    background: var(--surface-hover);
}

.volcube-tab.active {
    color: var(--primary);
    background: rgba(99, 102, 241, 0.15);
}

.volcube-export-btns {
    display: flex;
    gap: 0.5rem;
}

/* Input Sections */
.volcube-input-section {
    margin-bottom: 1rem;
}

.volcube-input-section label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Form Grid Layout (Curve Builder style) */
.volcube-form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.volcube-form-grid.volcube-form-grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.volcube-form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.volcube-form-group label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.volcube-form-group .fancy-select,
.volcube-form-group .fancy-input {
    width: 100%;
}

.volcube-input-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

.volcube-settings {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--surface);
    border-radius: var(--radius-md);
}

.volcube-setting-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.volcube-setting-group label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Instruments Section */
.volcube-instruments-section {
    margin-top: 1.5rem;
}

.volcube-instruments-section h4 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.volcube-table-container {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
}

.volcube-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

.volcube-table thead {
    position: sticky;
    top: 0;
    background: var(--bg-secondary);
    z-index: 1;
}

.volcube-table th,
.volcube-table td {
    padding: 0.5rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
}

.volcube-table th {
    font-weight: 600;
    color: var(--text-secondary);
}

.volcube-table tbody tr:hover {
    background: var(--surface-hover);
}

.volcube-table input.vol-input {
    width: 80px;
    padding: 0.25rem 0.5rem;
    background: var(--surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.8125rem;
    text-align: right;
}

.volcube-table input.vol-input:focus {
    outline: none;
    border-color: var(--primary);
}

.volcube-table input.vol-input.small {
    width: 50px;
}

.volcube-placeholder {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

/* Slice Selectors */
.volcube-slice-selectors {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--glass-border);
}

.volcube-slice-selectors .volcube-input-section {
    margin-bottom: 0;
    min-width: 100px;
}

.volcube-view-btns {
    display: flex;
    gap: 0.5rem;
    margin-left: auto;
}

/* Results Sections */
.volcube-params-section,
.volcube-metrics-section {
    margin-bottom: 1.5rem;
}

.volcube-params-section h4,
.volcube-metrics-section h4 {
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Chart Sections */
.volcube-chart-section {
    margin-bottom: 2rem;
}

.volcube-chart-section h4 {
    margin-bottom: 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.volcube-chart-container {
    position: relative;
    height: 250px;
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: 1rem;
}

.volcube-3d-container {
    height: 400px;
    background: var(--surface);
    border-radius: var(--radius-md);
}

/* Stats Grid */
.volcube-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-top: 1rem;
    padding: 1rem;
    background: var(--surface);
    border-radius: var(--radius-md);
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

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

.stat-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    font-family: 'SF Mono', 'Consolas', monospace;
}

/* Loading Overlay */
.volcube-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 10, 15, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    border-radius: var(--radius-lg);
}

/* Responsive */
@media (max-width: 768px) {
    .volcube-input-row {
        grid-template-columns: 1fr;
    }

    .volcube-settings {
        grid-template-columns: 1fr;
    }

    .volcube-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .volcube-slice-selectors {
        flex-wrap: wrap;
    }
}

