/* pulse trading system - optimized styles with theme support */

/* CSS Variables - Theme colors are now managed dynamically by ThemeManager.js */
/* Fallback values will be set by ThemeManager on initialization */
:root {
    /* Dynamic CSS variables will be injected by ThemeManager */
}

html {
    filter: none;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Matrix theme styling */
body[data-theme="matrix"] {
    font-family: 'Courier New', 'Consolas', monospace;
    /* Subtle dark shadow for better contrast */
    text-shadow: 0 0 2px #003300;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    font-weight: 600;
    letter-spacing: 0.5px;
}

body[data-theme="matrix"] .ascii-title {
    animation: matrix-flicker 0.15s infinite;
}

@keyframes matrix-flicker {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.85; }
}

body[data-theme="matrix"] .pulsar-logo {
    /* Remove box-like filter effect */
}

body[data-theme="matrix"] button {
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: bold;
}

/* Keep buy/sell colors distinct in matrix theme */
body[data-theme="matrix"] .side-buy {
    color: var(--side-buy) !important;
    text-shadow: 0 0 5px var(--side-buy);
}

body[data-theme="matrix"] .side-sell {
    color: var(--side-sell) !important;
    text-shadow: 0 0 5px var(--side-sell);
}

body[data-theme="matrix"] .currency-flag {
    text-shadow: none;
    /* Show currency codes in matrix theme instead of flags */
}

/* Space theme styling */
body[data-theme="space"] {
    background-image:
        radial-gradient(ellipse at top, transparent, rgba(10, 10, 31, 0.8)),
        radial-gradient(2px 2px at 20% 30%, white, transparent),
        radial-gradient(2px 2px at 60% 70%, white, transparent),
        radial-gradient(1px 1px at 50% 50%, white, transparent);
    background-size: 100% 100%, 200px 200px, 300px 300px, 250px 250px;
    background-position: center, 0 0, 100px 50px, 130px 130px;
}

body[data-theme="space"] .pulsar-logo {
    /* Remove filter effects that might create box appearance */
    animation: float-space 6s ease-in-out infinite;
}

@keyframes float-space {
    0%, 100% { transform: scaleX(-1) translateY(0); }
    50% { transform: scaleX(-1) translateY(-10px); }
}

body[data-theme="space"] .ascii-title {
    color: var(--accent-primary);
    animation: space-glow 3s ease-in-out infinite;
}

@keyframes space-glow {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.3); }
}

/* Monochrome theme styling */
body[data-theme="monochrome"] {
    /* Rely on theme variables for grayscale appearance without desaturating emojis */
    filter: none;
}

body[data-theme="monochrome"] .pulsar-logo {
    /* Remove filter to prevent box appearance */
}

body[data-theme="monochrome"] .ascii-title {
    font-weight: 900;
    letter-spacing: 4px;
    color: #000000;
    -webkit-text-fill-color: #000000;
    background: none;
    text-shadow: none;
    opacity: 1;
}

body[data-theme="monochrome"] .ascii-title:hover {
    text-shadow: none;
    -webkit-text-fill-color: #000000;
    background: none;
    opacity: 1;
}

/* Ensure icons and flags lose their color in monochrome theme */
body[data-theme="monochrome"] [class*="icon"],
body[data-theme="monochrome"] .currency-flag {
    filter: grayscale(100%) brightness(0);
}

/* Prevent lingering colour in charts */
body[data-theme="monochrome"] .chart-container canvas {
    filter: grayscale(100%);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    overflow-x: hidden;
}

/* Title Container */
.title-container {
    display: flex;
    justify-content: space-between;
    align-items: center; /* Center items vertically */
    gap: 20px;
    margin-bottom: 15px; /* Reduced from 30px to 15px */
    padding: 20px 20px 25px 20px; /* Increased vertical padding (top and bottom) */
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-primary);
    box-shadow: 0 4px 6px var(--shadow-color);
    flex-wrap: wrap;
    position: relative;
    overflow: hidden;
    min-height: 80px; /* Ensure minimum height for consistency */
}

/* Theme-specific header backgrounds */
.bg-ocean-waves {
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-primary));
    background-size: 200% 200%;
    animation: ocean-waves 10s ease-in-out infinite;
}

@keyframes ocean-waves {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.bg-matrix-digital {
    background: var(--bg-primary);
}

.bg-geometric-pattern {
    background-image: repeating-linear-gradient(45deg, var(--bg-secondary), var(--bg-secondary) 10px, var(--bg-tertiary) 10px, var(--bg-tertiary) 20px);
}

.bg-monochrome-particles {
    background: var(--bg-primary);
    border: 1px solid var(--flow-box-border);
    box-shadow: none;
    position: relative;
    overflow: hidden;
}


.bg-cyberpunk-grid {
    background-color: #0a0a0f;
    background-image:
        linear-gradient(0deg, rgba(255, 0, 110, 0.2) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 255, 255, 0.2) 1px, transparent 1px);
    background-size: 40px 40px;
}

.bg-retro-wave {
    background: radial-gradient(circle at center, var(--bg-secondary), var(--bg-primary));
}

.bg-night-sky {
    background: radial-gradient(ellipse at bottom, #1a1a3e 0%, #0f0f23 100%);
}


.title-with-logo {
    display: flex;
    align-items: center;
    gap: 15px; /* Slightly increased gap */
    position: relative;
    z-index: 10; /* Ensure title and logo are above particles */
    align-self: center; /* Ensure this container is vertically centered */
    /* No overflow constraint to allow natural glow */
}

.ascii-title {
    font-family: 'Courier New', monospace;
    font-size: 42px;
    font-weight: bold;
    color: var(--accent-primary);
    letter-spacing: 3px;
    text-shadow: 0 0 10px var(--accent-primary);
    transition: all 0.3s ease;
    opacity: calc(0.5 + var(--glow-intensity));
    line-height: 1;
    margin: 0;
    padding: 0;
}

.ascii-title:hover {
    text-shadow: 0 0 20px var(--accent-primary);
    transform: scale(1.05);
    opacity: 1;
}

/* Pulsar logo - ensure responsive clicking */
.pulsar-logo {
    width: 60px;
    height: 60px;
    cursor: pointer;
    display: inline-block;
    position: relative;
    z-index: 2;
    background: transparent;
    border: none;
    outline: none;
    opacity: 1;
    /* Anti-aliasing for smooth edges */
    image-rendering: auto;
    -webkit-font-smoothing: antialiased;
    /* Prevent tap delay on mobile */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    /* Smooth transitions for press states */
    transition: transform 0.1s ease;
    vertical-align: middle; /* Ensure proper vertical alignment */
    flex-shrink: 0; /* Prevent logo from shrinking */
}

.pulsar-logo:active {
    transform: scale(0.95);
}

.pulsar-logo.insane {
    animation: pulsar-insane 0.1s infinite;
}

.pulsar-logo.pulse-burst {
    animation: pulse-burst 0.3s ease;
}

.pulsar-logo.pulse-holding {
    filter: brightness(1.2);
    transform: scale(0.95);
    transition: all 0.1s ease;
}

.pulsar-logo.pulse-extreme {
    animation: pulse-extreme 0.2s infinite;
}

@keyframes pulsar-insane {
    0%,100% { transform: scale(1); }
    50% { transform: scale(1.3); }
}

@keyframes pulse-burst {
    0% { transform: scale(1); }
    20% { transform: scale(1.3); filter: brightness(1.5); }
    40% { transform: scale(0.95); }
    60% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

@keyframes pulse-extreme {
    0% { filter: brightness(1.5) hue-rotate(0deg); }
    50% { filter: brightness(2) hue-rotate(10deg); }
    100% { filter: brightness(1.5) hue-rotate(0deg); }
}

/* Trade surge effect for body */
body.trade-surge {
    animation: trade-surge-bg 0.5s infinite;
}

@keyframes trade-surge-bg {
    0% { background-color: var(--bg-primary); }
    50% { background-color: color-mix(in srgb, var(--bg-primary), var(--accent-danger) 5%); }
    100% { background-color: var(--bg-primary); }
}

button {
    white-space: nowrap;
}
/* Ensure form controls follow theme accent colors */
input[type="checkbox"],
input[type="radio"] {
    accent-color: var(--accent-primary);
}
/* Modal Styles */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--overlay-color);
    z-index: 9999;
    backdrop-filter: blur(2px);
}

.modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-secondary);
    padding: 30px;
    border-radius: 12px;
    border: 1px solid var(--border-primary);
    box-shadow: 0 20px 50px var(--shadow-color-strong);
    z-index: 10000;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

/* Specific override for allocation detail modal */
#allocation-detail-modal.modal {
    padding: 0; /* Remove padding since content has its own */
    overflow: hidden; /* Let inner container handle scrolling */
}

.modal h3 {
    color: var(--text-primary);
    margin-bottom: 20px;
    font-size: 20px;
}

/* Allocation Detail Modal specific */
#allocation-detail-modal {
    z-index: 10001 !important;
    display: none; /* Ensure hidden by default */
}

/* Modal buttons */
.modal button {
    padding: 8px 16px;
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    z-index: 10001;
}

.modal button:hover {
    background: var(--accent-primary);
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.modal button.success {
    background: var(--accent-success);
}

.modal button.success:hover {
    background: var(--accent-success);
    filter: brightness(1.1);
}

/* Clickable order id links */
.order-id-link {
    color: var(--accent-primary);
    cursor: pointer;
    text-decoration: underline;
}

.order-id-link:hover {
    filter: brightness(1.2);
}

/* Allocation Details Modal - Enhanced Professional Styling */
/* Note: .allocation-detail-container styles are now in the layout fixes section below */

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-primary);
}

.detail-header-left {
    display: flex;
    align-items: baseline;  /* Changed from center to baseline to align text baselines */
    gap: 15px;
}

.detail-header h2 {
    color: var(--text-primary);
    font-size: 24px;
    font-weight: 600;
    margin: 0;
}

.allocation-id-badge {
    padding: 6px 12px;
    background: var(--bg-tertiary);
    color: var(--accent-primary);
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    font-family: 'Courier New', monospace;
    transform: translateY(-2px);  /* Fine-tune vertical alignment */
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.detail-section {
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.detail-section:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.detail-section.full-width {
    grid-column: 1 / -1;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-primary);
}

.section-header h3 {
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.section-icon {
    font-size: 20px;
    opacity: 0.8;
}

.detail-content {
    padding: 20px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
}

.detail-value {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
    text-align: right;
}

.detail-value.highlight-commission {
    color: var(--accent-secondary);
    font-size: 16px;
}

/* FX Rate Section - Compact Layout */
.fx-rate-section {
    background: var(--bg-primary);
    border: 1px solid var(--accent-info);
}

.fx-rate-content {
    padding: 20px;
}

.fx-info-grid {
    display: grid;
    gap: 20px;
}

.fx-rate-display {
    text-align: center;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-primary);
}

.fx-rate-label {
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
}

.fx-rate-value {
    font-size: 24px;
    font-weight: bold;
    color: var(--accent-info);
}

.fx-summary-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.fx-summary-item {
    text-align: center;
}

.fx-summary-label {
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
}

.fx-summary-value {
    color: var(--text-primary);
    font-size: 20px;
    font-weight: 600;
}

.fx-values-section {
    display: grid;
    gap: 12px;
    padding-top: 15px;
    border-top: 1px solid var(--border-primary);
}

.fx-value-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: baseline;
}

.fx-value-item.total {
    padding-top: 10px;
    border-top: 2px solid var(--accent-info);
    margin-top: 5px;
}

.fx-value-label {
    color: var(--text-muted);
    font-size: 13px;
}

.fx-value-amount {
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
    text-align: right;
}

.fx-value-converted {
    grid-column: 2;
    color: var(--text-muted);
    font-size: 13px;
    text-align: right;
    font-style: italic;
}

.fx-value-item.total .fx-value-amount {
    color: var(--accent-info);
    font-size: 18px;
}

/* Enhanced Trades Table */
#allocation-detail-modal .detail-trades-table,
#order-detail-modal .detail-trades-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
}

#allocation-detail-modal .detail-trades-table th,
#order-detail-modal .detail-trades-table th {
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 12px;
    padding: 12px 15px;
    text-align: left !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border-primary);
    white-space: nowrap;
}

#allocation-detail-modal .detail-trades-table td,
#order-detail-modal .detail-trades-table td {
    padding: 10px 15px;
    font-size: 13px;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
    text-align: left !important;
    white-space: nowrap;
}

#allocation-detail-modal .detail-trades-table tbody tr:hover,
#order-detail-modal .detail-trades-table tbody tr:hover {
    background: var(--bg-tertiary);
}

.currency-flag {
    font-size: 14px;
    margin-right: 4px;
}

/* Comprehensive Audit Trail */
.audit-trail.comprehensive {
    /* Removed max-height - let parent container handle scrolling */
    padding: 20px;
    background: var(--bg-primary);
    border-radius: 8px;
    border: 1px solid var(--border-primary);
    margin-bottom: 20px; /* Space at bottom */
}

/* No scroll version for audit trail */
.audit-trail.comprehensive.no-scroll {
    /* Same as above - no internal scrolling */
}

.audit-entry {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 12px 15px;
    margin-bottom: 8px;
    background: var(--bg-secondary);
    border-radius: 8px;
    border-left: 3px solid var(--border-primary);
    transition: all 0.2s ease;
}

.audit-entry:hover {
    transform: translateX(5px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.audit-entry.log-trade {
    border-left-color: var(--accent-primary);
}

.audit-entry.log-allocation {
    border-left-color: var(--accent-success);
}

.audit-entry.log-order {
    border-left-color: var(--desk-eex);
}

.audit-entry.log-system {
    border-left-color: var(--text-muted);
}

.audit-entry.log-commission {
    border-left-color: var(--accent-secondary);
}

.audit-entry.log-acceptance {
    border-left-color: var(--accent-success);
}

.audit-time {
    color: var(--text-muted);
    font-size: 12px;
    font-family: 'Courier New', monospace;
    white-space: nowrap;
    min-width: 160px;
}

.audit-type-icon {
    font-size: 16px;
    min-width: 24px;
    text-align: center;
}

.audit-event {
    color: var(--text-primary);
    font-size: 13px;
    flex: 1;
    line-height: 1.5;
}

/* Trades Count Badge */
.trades-count {
    padding: 4px 12px;
    background: var(--bg-tertiary);
    color: var(--text-muted);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

/* Chart Container Improvements */
.detail-section .chart-container {
    background: var(--bg-primary);
    border-radius: 8px;
    padding: 20px;
    margin: 0;
    border: 1px solid var(--border-primary);
}

/* Desk Badge Styling */
.desk-badge {
    display: inline-block;
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.desk-badge.desk-cash {
    background: var(--badge-primary-bg);
    color: var(--desk-cash);
    border: 1px solid var(--badge-primary-border);
}

.desk-badge.desk-eex {
    background: var(--badge-info-bg);
    color: var(--desk-eex);
    border: 1px solid var(--badge-info-border);
}

/* Responsive Design for Allocation Details */
@media (max-width: 768px) {
    .detail-grid {
        grid-template-columns: 1fr;
    }
    
    .fx-rate-content {
        grid-template-columns: 1fr;
    }
    
    .fx-summary-grid {
        grid-template-columns: 1fr;
    }
    
    .detail-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .detail-header-left {
        flex-direction: column;
    }
    
    #sankey-container {
        min-height: 300px;
    }
}

/* Sankey container dynamic sizing */
#sankey-container {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: height 0.3s ease;
}

/* Sankey diagram tooltip styling */
.sankey-tooltip {
    position: absolute;
    background: rgba(15, 23, 42, 0.95) !important;
    color: white !important;
    padding: 12px !important;
    border-radius: 6px !important;
    font-size: 12px !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3) !important;
    pointer-events: none !important;
    z-index: 10002 !important;
    max-width: 300px;
    line-height: 1.4;
    border: 1px solid rgba(71, 85, 105, 0.5);
}

/* Monochrome sankey tooltip */
body[data-theme="monochrome"] .sankey-tooltip {
    background: var(--bg-primary) !important;
    color: var(--text-primary) !important;
    border: 2px solid var(--border-primary) !important;
    box-shadow: 4px 4px 0 var(--border-primary) !important;
}

.sankey-tooltip strong {
    color: var(--text-secondary);
    display: block;
    margin-bottom: 4px;
}

/* Monochrome theme allocation detail modal specific styles */
body[data-theme="monochrome"] #allocation-detail-modal {
    background: var(--bg-primary) !important;
    border: 3px solid var(--border-primary);
    box-shadow: 10px 10px 0 var(--border-primary);
    color: var(--text-primary);
}

body[data-theme="monochrome"] .allocation-detail-container {
    color: var(--text-primary);
}

body[data-theme="monochrome"] .detail-section {
    background: var(--bg-secondary);
    border: 2px solid var(--border-primary);
}

body[data-theme="monochrome"] .section-header {
    background: var(--bg-tertiary);
    border-bottom: 2px solid var(--border-primary);
}

body[data-theme="monochrome"] .detail-label {
    color: var(--text-muted);
}

body[data-theme="monochrome"] .detail-value {
    color: var(--text-primary);
    font-weight: 700;
}

body[data-theme="monochrome"] .detail-trades-table th {
    background: var(--bg-primary);
    color: var(--text-primary);
}

body[data-theme="monochrome"] .detail-trades-table td {
    color: var(--text-primary);
}

body[data-theme="monochrome"] .audit-trail.comprehensive {
    background: var(--bg-secondary);
    border: 2px solid var(--border-primary);
}

body[data-theme="monochrome"] .audit-entry {
    background: var(--bg-primary);
    border-left: 3px solid var(--border-primary);
}

/* Monochrome modal buttons and controls */
body[data-theme="monochrome"] .modal button {
    background: var(--bg-primary) !important;
    color: var(--text-primary) !important;
    border: 2px solid var(--border-primary);
    font-weight: bold;
}

body[data-theme="monochrome"] .modal button:hover {
    background: var(--bg-secondary) !important;
    box-shadow: 2px 2px 0 var(--border-primary);
}

body[data-theme="monochrome"] .status-badge {
    background: var(--bg-primary) !important;
    color: var(--text-primary) !important;
    border: 2px solid var(--border-primary);
}

body[data-theme="monochrome"] .allocation-id-badge {
    background: var(--bg-primary) !important;
    color: var(--text-primary) !important;
    border: 2px solid var(--border-primary);
    box-shadow: none;
}

body[data-theme="monochrome"] .grouping-badge {
    background: var(--bg-tertiary) !important;
    color: var(--text-primary) !important;
    border: 2px solid var(--border-primary);
    font-weight: 700;
}

body[data-theme="monochrome"] .desk-badge {
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
    border: 2px solid var(--border-primary);
}

body[data-theme="monochrome"] .client-status-badge {
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
    border: 2px solid var(--border-primary);
    box-shadow: none;
}

body[data-theme="monochrome"] .client-status-indicator.active {
    background: var(--text-primary) !important;
    box-shadow: none;
    animation: none;
}

body[data-theme="monochrome"] .client-status-indicator.inactive {
    display: none !important;
}

body[data-theme="monochrome"] .allocation-link {
    color: var(--text-primary);
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    box-shadow: none;
}

body[data-theme="monochrome"] .allocation-link:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    box-shadow: none;
}

body[data-theme="monochrome"] .system-status {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-primary);
}

body[data-theme="monochrome"] .system-status:hover {
    background: var(--bg-tertiary);
    box-shadow: none;
}

/* Cleaner, more legible log text */
body[data-theme="monochrome"] #log-list {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.5;
}

body[data-theme="monochrome"] #log-list li,
body[data-theme="monochrome"] #log-list li.log-info,
body[data-theme="monochrome"] #log-list li.log-success,
body[data-theme="monochrome"] #log-list li.log-warning,
body[data-theme="monochrome"] #log-list li.log-error,
body[data-theme="monochrome"] #log-list li.log-trade,
body[data-theme="monochrome"] #log-list li.log-allocation {
    color: var(--text-primary) !important;
    font-weight: 500;
}

/* Ensure chart containers have proper contrast */
body[data-theme="monochrome"] .detail-section .chart-container {
    background: var(--bg-primary);
    border: 2px solid var(--border-primary);
}

/* Matrix theme icons - ensure all icons are green */
body[data-theme="matrix"] .theme-icon,
body[data-theme="matrix"] .matrix-icon,
body[data-theme="matrix"] .status-icon,
body[data-theme="matrix"] .detail-icon,
body[data-theme="matrix"] .csa-icon,
body[data-theme="matrix"] .section-icon,
body[data-theme="matrix"] .mono-icon,
body[data-theme="matrix"] .grouping-icon,
body[data-theme="matrix"] .desk-icon,
body[data-theme="matrix"] .stat-icon,
body[data-theme="matrix"] .activity-icon,
body[data-theme="matrix"] .metric-icon,
body[data-theme="matrix"] .audit-type-icon,
body[data-theme="matrix"] .feature-icon,
body[data-theme="matrix"] .axis-icon,
body[data-theme="matrix"] .mouse-icon,
body[data-theme="matrix"] .mode-icon,
body[data-theme="matrix"] .hint-icon,
body[data-theme="matrix"] [data-icon-type] {
    color: var(--accent-primary) !important;
    text-shadow: 0 0 5px var(--accent-primary);
}

/* Matrix theme log entries - ensure icons are green */
body[data-theme="matrix"] #log-list li {
    color: var(--accent-primary) !important;
}

/* Matrix theme log icons inside brackets */
body[data-theme="matrix"] #log-list li:before,
body[data-theme="matrix"] #log-list li:after {
    color: var(--accent-primary) !important;
}

/* Matrix theme log icons specifically */
body[data-theme="matrix"] .log-icon {
    color: var(--accent-primary) !important;
    text-shadow: 0 0 5px var(--accent-primary);
}

/* Override inline styles for log entries in matrix theme */
body[data-theme="matrix"] #log-list li.log-info,
body[data-theme="matrix"] #log-list li.log-success,
body[data-theme="matrix"] #log-list li.log-warning,
body[data-theme="matrix"] #log-list li.log-error,
body[data-theme="matrix"] #log-list li.log-trade,
body[data-theme="matrix"] #log-list li.log-allocation {
    color: var(--accent-primary) !important;
}

body[data-theme="matrix"] #log-list li .log-icon {
    color: var(--accent-primary) !important;
    text-shadow: 0 0 5px var(--accent-primary);
}

/* Matrix theme specific icon overrides for any missed icons */
body[data-theme="matrix"] .progress-complete,
body[data-theme="matrix"] .client-status-indicator.active,
body[data-theme="matrix"] .status-indicator,
body[data-theme="matrix"] .check-icon,
body[data-theme="matrix"] .icon-wrapper {
    color: var(--accent-primary) !important;
}

/* Ensure all emojis and special characters in matrix theme are green */
body[data-theme="matrix"] .trigger-badge .mono-icon,
body[data-theme="matrix"] .grouping-badge .mono-icon,
body[data-theme="matrix"] .client-card .mono-icon,
body[data-theme="matrix"] .allocation-detail-container .mono-icon,
body[data-theme="matrix"] .commission-form-group .help-icon,
body[data-theme="matrix"] .calculator-icon,
body[data-theme="matrix"] .save-icon,
body[data-theme="matrix"] .feature-icon,
body[data-theme="matrix"] .play-label,
body[data-theme="matrix"] td,
body[data-theme="matrix"] .detail-icon,
body[data-theme="matrix"] .modal .mono-icon,
body[data-theme="matrix"] .advanced-sections .section-icon {
    color: var(--accent-primary) !important;
    text-shadow: 0 0 5px var(--accent-primary);
}

/* Matrix theme checkmarks and status indicators */
body[data-theme="matrix"] td:nth-child(13),  /* CSA column checkmarks */
body[data-theme="matrix"] .csa-eligible,
body[data-theme="matrix"] .eligible {
    color: var(--accent-primary) !important;
}

/* Ensure all text and symbols in matrix theme tables are green */
body[data-theme="matrix"] table td,
body[data-theme="matrix"] table th {
    color: var(--accent-primary) !important;
}

/* Matrix theme specific overrides for any elements that should remain green */
body[data-theme="matrix"] .desk-badge,
body[data-theme="matrix"] .status-badge,
body[data-theme="matrix"] .trigger-badge,
body[data-theme="matrix"] .grouping-badge {
    color: var(--accent-primary) !important;
    border-color: var(--accent-primary) !important;
}

/* Matrix theme currency flags - show as currency codes */
body[data-theme="matrix"] .currency-flag {
    color: var(--accent-primary) !important;
    font-size: 11px;
    font-weight: bold;
    font-family: 'Courier New', monospace;
    text-shadow: 0 0 4px var(--accent-primary);
    border: 1px solid var(--accent-primary);
    padding: 1px 3px;
    border-radius: 2px;
    margin-right: 2px;
    /* Remove the grayscale filter that was applied */
    filter: none !important;
}

/* Monochrome theme icons - ensure all icons are black and white */
body[data-theme="monochrome"] .theme-icon,
body[data-theme="monochrome"] .mono-icon,
body[data-theme="monochrome"] .status-icon,
body[data-theme="monochrome"] .detail-icon,
body[data-theme="monochrome"] .csa-icon,
body[data-theme="monochrome"] .section-icon {
    color: var(--text-primary) !important;
    text-shadow: none !important;
    filter: none !important;
}

/* Matrix theme allocation details */
body[data-theme="matrix"] #allocation-detail-modal {
    background: var(--bg-primary);
    border: 1px solid var(--accent-primary);
}

body[data-theme="matrix"] .detail-section {
    background: var(--bg-secondary);
    border-color: var(--accent-primary);
}

body[data-theme="matrix"] .section-header {
    background: var(--bg-secondary);
    border-bottom-color: var(--accent-primary);
}

body[data-theme="matrix"] .detail-trades-table th {
    background: var(--bg-secondary);
    border-bottom-color: var(--accent-primary);
    color: var(--accent-primary);
}

body[data-theme="matrix"] .detail-trades-table td {
    color: var(--accent-primary);
    border-bottom-color: var(--bg-secondary);
}

/* Space theme allocation details */
body[data-theme="space"] #allocation-detail-modal {
    background: rgba(18, 18, 42, 0.95);
    border: 1px solid var(--accent-primary);
    box-shadow: 0 20px 50px var(--shadow-color-strong);
}

body[data-theme="space"] .detail-section {
    background: rgba(26, 26, 53, 0.95);
    border-color: var(--accent-primary);
}

body[data-theme="space"] .section-header {
    background: rgba(18, 18, 42, 0.95);
    border-bottom-color: var(--accent-primary);
}

body[data-theme="space"] .detail-trades-table th {
    background: rgba(10, 10, 31, 0.95);
    border-bottom-color: var(--accent-primary);
}

/* Allocation Link Button */
.allocation-link {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
    transition: all 0.2s ease;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.allocation-link:hover {
    background: rgba(59, 130, 246, 0.2);
    color: var(--accent-primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
    text-decoration: none;
}

.allocation-link:active {
    transform: translateY(0);
}

/* Status badges */
.status-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}
.status-pending {
    background: var(--badge-secondary-bg);
    color: var(--accent-secondary);
    border: 1px solid var(--badge-secondary-border);
}

.status-allocated {
    background: var(--badge-success-bg);
    color: var(--accent-success);
    border: 1px solid var(--badge-success-border);
}

.status-accepted {
    background: var(--badge-success-bg);
    color: var(--accent-success);
    border: 1px solid var(--badge-success-border);
    font-weight: 600;
    opacity: 0.9;
}

/* Lane grouping badges */
.grouping-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.grouping-badge.grouping-stp,
.grouping-stp {
    background: var(--badge-stp-bg);
    color: var(--lane-stp);
    border: 1px solid var(--badge-stp-border);
}

.grouping-badge.grouping-time-based,
.grouping-badge.grouping-timebased {
    background: var(--badge-timebased-bg);
    color: var(--lane-timebased);
    border: 1px solid var(--badge-timebased-border);
}

.grouping-badge.grouping-value,
.grouping-value {
    background: var(--badge-value-bg);
    color: var(--lane-value);
    border: 1px solid var(--badge-value-border);
}

.grouping-badge.grouping-client-triggered,
.grouping-badge.grouping-clienttriggered {
    background: var(--badge-clienttriggered-bg);
    color: var(--lane-clienttriggered);
    border: 1px solid var(--badge-clienttriggered-border);
}

.grouping-badge.grouping-manual,
.grouping-manual {
    background: var(--badge-manual-bg);
    color: var(--lane-manual);
    border: 1px solid var(--badge-manual-border);
}

@keyframes swim {
    0%, 100% { transform: scaleX(-1) translateY(0) rotate(0deg); }
    25% { transform: scaleX(-1) translateY(-5px) rotate(-5deg); }
    75% { transform: scaleX(-1) translateY(5px) rotate(5deg); }
}

@keyframes pulse {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.1); }
    100% { opacity: 1; transform: scale(1); }
}

/* Additional core styles that were missing */

/* Status-time container */
.status-time-container {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center; /* Center vertically within container */
    gap: 4px; /* Tighter gap for visual cohesion */
    position: relative;
    z-index: 10; /* Ensure status/time are above particles */
    align-self: center; /* Ensure container itself is vertically centered */
}

.system-status {
    padding: 10px 16px; /* Increased padding for better visual weight */
    background: color-mix(in srgb, var(--accent-success), transparent 90%);
    color: var(--accent-success);
    border: 1px solid var(--accent-success);
    border-radius: 4px;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    min-height: 32px; /* Ensure consistent minimum height */
}

.system-status:hover {
    background: color-mix(in srgb, var(--accent-success), transparent 80%);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px var(--shadow-color);
}

.system-status.active {
    background: color-mix(in srgb, var(--accent-success), transparent 80%);
    box-shadow: 0 2px 4px var(--shadow-color);
}

/* Old advanced controls styles - deprecated */

.system-menu-dropdown {
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    box-shadow: 0 4px 12px var(--shadow-color);
    overflow: hidden;
    min-width: 160px;
    padding: 4px 0;
}

.system-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.2s ease;
}

.system-menu-item:hover {
    background: var(--bg-secondary);
}

.system-menu-divider {
    height: 1px;
    background: var(--border-primary);
    margin: 4px 0;
}

.system-time {
    font-family: 'Courier New', monospace;
    font-size: 13px; /* Slightly smaller to balance with button */
    color: var(--text-muted);
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    line-height: 1;
    padding: 2px 2px; /* Adjusted padding for visual alignment */
    min-height: 20px; /* Ensure consistent height */
    font-weight: 500; /* Slightly bolder for readability */
}

.theme-dropdown {
    padding: 4px 10px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 100px;
    text-align: center;
}

.theme-dropdown:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-primary);
}

.theme-dropdown:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-primary), transparent 80%);
}

/* Side colors */
.side-buy {
    color: var(--side-buy);
    font-weight: 600;
}

.side-sell {
    color: var(--side-sell);
    font-weight: 600;
}

/* Trigger Badge Styling */
.trigger-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
    max-width: 145px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.trigger-badge.grouping-stp {
    background: var(--badge-stp-bg);
    color: var(--lane-stp);
    border: 1px solid var(--badge-stp-border);
}

.trigger-badge.grouping-timebased {
    background: var(--badge-timebased-bg);
    color: var(--lane-timebased);
    border: 1px solid var(--badge-timebased-border);
}

.trigger-badge.grouping-value {
    background: var(--badge-value-bg);
    color: var(--lane-value);
    border: 1px solid var(--badge-value-border);
}

.trigger-badge.grouping-clienttriggered {
    background: var(--badge-clienttriggered-bg);
    color: var(--lane-clienttriggered);
    border: 1px solid var(--badge-clienttriggered-border);
}

.trigger-badge.grouping-manual {
    background: var(--badge-manual-bg);
    color: var(--lane-manual);
    border: 1px solid var(--badge-manual-border);
}

/* Table container base styles */
.table-container {
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-primary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    position: relative;
    display: flex;
    flex-direction: column;
    overflow-x: auto;
}

.table-wrapper {
    overflow-x: auto;
    flex: 1;
}

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

thead {
    background: var(--bg-primary);
}

th {
    padding: 8px 6px;
    text-align: left;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 13px;
    border-bottom: 2px solid var(--border-primary);
    white-space: nowrap;
}

td {
    padding: 6px;
    border-bottom: 1px solid var(--border-primary);
    color: var(--text-primary);
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 32px;
    line-height: 18px;
}

tbody tr {
    min-height: 32px;
    height: 32px;
}

tbody tr:hover {
    background: var(--bg-tertiary);
}

/* Ensure value columns are properly aligned */
.text-right {
    text-align: right !important;
}

.text-left {
    text-align: left !important;
}

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

/* Default left align for street table */
#street-table td {
    text-align: left;
}

/* Pagination controls */
.table-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    margin-top: 8px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-primary);
}

.table-pagination .pagination-info {
    font-size: 13px;
    color: var(--text-secondary);
}

.table-pagination .pagination-controls {
    display: flex;
    gap: 6px;
}

.table-pagination .pagination-btn {
    padding: 6px 12px;
    background: var(--accent-primary);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}

.table-pagination .pagination-btn:hover:not(:disabled) {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.table-pagination .pagination-btn:disabled {
    background: var(--bg-tertiary);
    color: var(--text-muted);
    cursor: not-allowed;
    transform: none;
}

/* Trade screen table adjustments */
#street-side-trade .table-container {
    overflow-x: hidden;
    overflow-y: visible;
    max-width: 100%;
}

#street-side-trade .table-wrapper {
    overflow-x: hidden;
    max-width: 100%;
    margin: 0 auto;
}

#street-table {
    width: 100%;
    table-layout: fixed;
}

#street-table th,
#street-table td {
    padding: 4px 6px;
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Ensure content fits in cells */
#street-table .client-name,
#street-table .counterparty-name,
#street-table .trader-name {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

/* Allocation Trigger column */
#street-table th:nth-child(14),
#street-table td:nth-child(14) {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 6px;
}

/* Keep Progress header from wrapping */
#street-table th:nth-child(15) {
    white-space: nowrap;
}

/* Narrow select column */
#street-table th:first-child,
#street-table td:first-child {
    width: 40px;
    text-align: center;
}

/* Center CSA column */
#street-table th:nth-child(13),
#street-table td:nth-child(13) {
    text-align: center !important;
}

/* Progress column spacing */
#street-table th:nth-child(15),
#street-table td:nth-child(15) {
    padding-right: 4px;
    padding-left: 4px;
    white-space: nowrap;
    text-align: left !important;
}

/* Status column */
#street-table th:nth-child(16),
#street-table td:nth-child(16) {
    min-width: 90px;
    padding-right: 8px;
}

/* Timestamp column */
#street-table th:nth-child(17),
#street-table td:nth-child(17) {
    font-size: 11px;
    padding-right: 10px;
}

/* Tabs */
.tab-links {
    display: flex;
    gap: 2px;
    margin-bottom: 15px; /* Reduced from 20px to 15px */
    background: var(--bg-secondary);
    padding: 4px;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.advanced-button {
    margin-left: auto;
    padding: 10px 20px;
    background: transparent;
    color: var(--text-muted);
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.advanced-button:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.advanced-button.active {
    background: var(--accent-primary);
    color: white;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

.tab-link {
    padding: 10px 20px;
    background: transparent;
    color: var(--text-muted);
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.3s ease;
}

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

.tab-link.active {
    background: var(--accent-primary);
    color: white;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

/* Controls section - removed as it's no longer needed */

.control-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Old grid layout for advanced controls - deprecated */

.control-group.theme-group {
    margin-left: auto;
    flex-shrink: 0;
}

.control-group label {
    color: var(--text-muted);
    font-size: 14px;
}

.control-group input[type="range"] {
    width: 200px;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    outline: none;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--accent-primary);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
}

.control-group input[type="range"]:hover::-webkit-slider-thumb {
    transform: scale(1.2);
    box-shadow: 0 0 8px color-mix(in srgb, var(--accent-primary), transparent 60%);
}

.speed-indicator {
    padding: 4px 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    transition: all 0.3s ease;
    white-space: nowrap; /* Prevent text wrapping */
    display: inline-block; /* Ensure proper box model */
}

/* Flow Container */
.flow-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-primary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.flow-item {
    flex: 1;
    text-align: center;
    padding: 20px;
}

.flow-item h3 {
    color: var(--accent-primary);
    margin-bottom: 10px;
    font-size: 16px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.flow-item .value {
    color: var(--accent-secondary);
    font-size: 24px;
    font-weight: bold;
}

.flow-arrow {
    color: var(--text-muted);
    font-size: 24px;
    margin: 0 20px;
}

/* Particle Flow Section */
.particle-flow-section {
    position: relative;
    margin-bottom: 20px; /* Reduced from 30px to 20px */
    background: var(--bg-canvas);
    border-radius: 12px;
    border: 1px solid var(--border-primary);
    overflow: hidden;
    box-shadow: 0 2px 4px var(--shadow-color);
    min-height: 500px;
}

.flow-boxes {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    padding: 20px;
    background: var(--bg-tertiary-alpha);
    backdrop-filter: blur(10px);
    position: relative;
    z-index: 2;
    pointer-events: none;
}

.flow-boxes > * {
    pointer-events: auto;
}

.flow-box {
    text-align: center;
    padding: 20px;
    background: var(--flow-box-bg);
    border: 1px solid var(--flow-box-border);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.flow-box:hover {
    transform: translateY(-2px);
    box-shadow: var(--flow-box-hover-shadow);
}

.flow-box h3 {
    color: var(--text-primary);
    font-size: 14px;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.box-count {
    font-size: 36px;
    font-weight: bold;
    color: var(--accent-primary);
}

/* Canvas */
#flow-canvas {
    width: 100%;
    height: 400px;
    background: var(--bg-canvas);
    image-rendering: optimizeSpeed;
    will-change: transform;
    display: block;
    position: relative;
    z-index: 1;
}

/* Dashboard Metrics */
.dashboard-metrics {
    margin-bottom: 20px; /* Reduced from 30px to 20px */
}

.dashboard-metrics h4 {
    color: var(--text-primary);
    margin-bottom: 15px;
    font-size: 18px;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.metric-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    gap: 15px;
    align-items: center;
    transition: all 0.3s ease;
}

.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
}

.metric-card.primary { border-left: 4px solid var(--accent-primary); }
.metric-card.success { border-left: 4px solid var(--accent-success); }
.metric-card.warning { border-left: 4px solid var(--accent-secondary); }
.metric-card.info { border-left: 4px solid var(--accent-info); }
.metric-card.danger { border-left: 4px solid var(--accent-danger); }

.metric-icon {
    font-size: 32px;
    opacity: 0.8;
}

.metric-content {
    flex: 1;
}

.metric-value {
    font-size: 24px;
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.metric-label {
    color: var(--text-muted);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 20px; /* Reduced from 30px to 20px */
}

.chart-container {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--border-primary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    position: relative;
}

.chart-container h3 {
    color: var(--text-primary);
    margin-bottom: 15px;
    font-size: 16px;
}

.chart-container canvas {
    max-width: 100%;
    height: auto !important;
    max-height: 300px;
}

/* Filter Container */
.filter-container {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-primary);
    flex-wrap: wrap;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Matrix theme specific filter container fix */
body[data-theme="matrix"] .filter-container {
    flex-wrap: nowrap;
    overflow-x: auto;
    align-items: flex-start;
}

body[data-theme="matrix"] .filter-container > * {
    flex-shrink: 0;
}

.filter-container input[type="text"],
.filter-container select {
    padding: 8px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
}

.filter-container input[type="text"]::placeholder {
    color: var(--text-muted);
}

.filter-container button {
    padding: 8px 16px;
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-container button:hover {
    background: var(--accent-primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.filter-container button:disabled {
    background: var(--bg-tertiary);
    cursor: not-allowed;
    transform: none;
}

.filter-container button.success {
    background: var(--accent-success);
}

.filter-container button.success:hover {
    background: var(--accent-success);
    filter: brightness(1.1);
}

.filter-container button.danger {
    background: var(--accent-danger);
}

.filter-container button.danger:hover {
    background: var(--accent-danger);
    filter: brightness(1.1);
}

/* Logs */
.logs {
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-primary);
    padding: 20px;
    max-height: 600px;
    overflow-y: auto;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.log-header {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#log-list {
    list-style: none;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    line-height: 1.4;
}

#log-list li {
    padding: 2px 0;
    border-bottom: 1px solid var(--border-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#log-list li.log-info { color: var(--accent-info); }
#log-list li.log-success { color: var(--accent-success); }
#log-list li.log-warning { color: var(--accent-secondary); font-weight: 600; }
#log-list li.log-error { color: var(--accent-danger); font-weight: 600; }
#log-list li.log-trade { color: var(--accent-primary); }
#log-list li.log-allocation { color: var(--accent-secondary); }

/* Status Container */
.status-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.status-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--border-primary);
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.status-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.status-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.status-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent-success);
    box-shadow: 0 0 0 2px var(--badge-success-border);
    animation: pulse 2s infinite;
}

.status-indicator.warning {
    background: var(--accent-secondary);
    box-shadow: 0 0 0 2px var(--badge-secondary-border);
}

.status-indicator.error {
    background: var(--accent-danger);
    box-shadow: 0 0 0 2px var(--badge-danger-border);
}

/* Commission Summary */
.commission-summary {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid var(--border-primary);
}

.commission-summary h4 {
    color: var(--text-primary);
    margin-bottom: 15px;
    font-size: 18px;
}

.commission-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.commission-stat-card {
    background: var(--bg-primary);
    padding: 15px;
    border-radius: 6px;
    border: 1px solid var(--border-primary);
    text-align: center;
}

.commission-label {
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
}

.commission-value {
    color: var(--accent-secondary);
    font-size: 24px;
    font-weight: bold;
    margin: 10px 0;
}

.commission-detail {
    color: var(--text-muted);
    font-size: 11px;
}

/* Trader Performance */
.trader-performance-section {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid var(--border-primary);
}

.trader-performance-section h4 {
    color: var(--text-primary);
    margin-bottom: 15px;
    font-size: 18px;
}

.trader-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
}

.trader-stat-card {
    background: var(--bg-primary);
    padding: 15px;
    border-radius: 6px;
    border: 1px solid var(--border-primary);
}

.trader-name {
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 10px;
}

.trader-desk {
    display: inline-block;
    padding: 2px 8px;
    background: var(--bg-tertiary);
    color: var(--text-muted);
    border-radius: 4px;
    font-size: 11px;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.trader-metrics {
    display: grid;
    gap: 8px;
}

.trader-metric {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
}

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

.trader-metric-value {
    color: var(--text-primary);
    font-weight: 600;
}

/* Client Management - Enhanced UI */
#client-grid-container {
    padding: 20px;
}

.client-overview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.client-overview-header h3 {
    color: var(--text-primary);
    font-size: 24px;
    font-weight: 600;
    margin: 0;
}

.client-stats-summary {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.client-stats-summary span {
    color: var(--text-muted);
    font-size: 13px;
    padding: 4px 10px;
    background: var(--bg-tertiary);
    border-radius: 16px;
    white-space: nowrap;
}

/* Client Quick Select Dropdown - Simple and subtle */
.client-quick-select {
    margin-top: 15px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.client-quick-select label {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
}

.client-dropdown {
    min-width: 250px;
    padding: 6px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M1 1L5 5L9 1' stroke='%23999' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

.client-dropdown:hover {
    border-color: var(--accent-primary);
}

.client-dropdown:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-primary), transparent 90%);
}

.client-dropdown option {
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: 4px;
}

/* Client Cards Grid */
.client-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 20px;
}

.client-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-primary);
    overflow: hidden;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
    cursor: pointer;
    position: relative;
    box-shadow: 0 2px 4px var(--shadow-color);
}

.client-card:hover {
    box-shadow: 0 6px 16px var(--shadow-color-strong);
    border-color: var(--accent-primary);
}

.client-card.inactive {
    opacity: 0.7;
    background: var(--bg-tertiary);
}

.client-card-header {
    padding: 20px;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-primary);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.client-name-section h4 {
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 4px 0;
}

.client-short-name {
    color: var(--text-muted);
    font-size: 14px;
    font-family: 'Courier New', monospace;
}

.client-status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-top: 4px;
}

.client-status-indicator.active {
    background: var(--accent-success);
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.3);
}

.client-status-indicator.inactive {
    background: var(--text-muted);
}

.client-card-body {
    padding: 20px;
}

.client-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

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

.info-label {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
}

.info-value {
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
}

.client-card-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    padding: 15px 20px;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border-primary);
}

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

.stat-value {
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
    display: block;
    margin-bottom: 4px;
}

.stat-label {
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.client-card-actions {
    padding: 15px 20px;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-primary);
}

.btn-view-details {
    width: 100%;
    padding: 10px;
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: filter 0.2s ease;
}

.btn-view-details:hover {
    background: var(--accent-primary);
    filter: brightness(1.1);
}

.btn-save-settings {
    padding: 10px 20px;
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: filter 0.2s ease;
    margin-top: 10px;
}

.btn-save-settings:hover {
    filter: brightness(1.1);
}

/* Client Details View */
.client-details-container {
    padding: 30px;
    max-width: 1400px;
    margin: 0 auto;
}

.client-details-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-primary);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.client-details-header h2 {
    color: var(--text-primary);
    font-size: 28px;
    font-weight: 600;
    margin: 0;
}

.client-type-badge {
    padding: 6px 12px;
    background: var(--bg-tertiary);
    color: var(--text-muted);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}

.client-status-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}

.client-status-badge.active {
    background: var(--badge-success-bg);
    color: var(--accent-success);
    border: 1px solid var(--badge-success-border);
}

.client-status-badge.inactive {
    background: var(--badge-secondary-bg);
    color: var(--text-muted);
    border: 1px solid var(--badge-secondary-border);
}

.btn-close {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.3s ease;
}

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

.client-details-content {
    display: grid;
    gap: 30px;
}

.client-details-content .detail-section {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 25px;
    border: 1px solid var(--border-primary);
    box-shadow: 0 2px 4px var(--shadow-color);
}

.client-details-content .detail-section h3 {
    color: var(--text-primary);
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 20px 0;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-primary);
}

.client-details-content .detail-section h4 {
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 15px 0;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.detail-item label {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
}

.detail-item span {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
}

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

.not-eligible {
    color: var(--text-muted);
    font-style: italic;
}

.csa-eligible {
    color: var(--accent-success);
    font-weight: 600;
}

.csa-not-eligible {
    color: var(--text-muted);
    font-style: italic;
}

/* Commission Preview Calculator */
.commission-preview {
    background: var(--bg-primary);
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
    border: 1px solid var(--border-primary);
}

.calculator-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-top: 15px;
}

.calc-input,
.calc-result {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.calc-input label,
.calc-result label {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 500;
}

.calc-input input {
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.calc-input input:hover {
    border-color: var(--accent-primary);
    background: var(--bg-primary);
}

.calc-input input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-primary), transparent 85%);
}

/* Theme-specific calculator input styling */
body[data-theme="monochrome"] .calc-input input {
    border-width: 2px;
    font-weight: 700;
}

body[data-theme="matrix"] .calc-input input {
    font-family: 'Courier New', monospace;
    color: var(--accent-primary);
}

body[data-theme="cyberpunk"] .calc-input input:focus {
    box-shadow: 0 0 0 3px var(--accent-primary), 0 0 20px var(--accent-primary);
}

.calc-result span {
    color: var(--accent-secondary);
    font-size: 18px;
    font-weight: 700;
}

/* Current Groups */
.current-groups {
    margin-top: 20px;
}

.no-groups {
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
    padding: 20px;
}

.group-status-item {
    background: var(--bg-primary);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    border: 1px solid var(--border-primary);
}

.group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.group-count {
    color: var(--text-muted);
    font-size: 12px;
}

.group-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.progress-container {
    display: flex;
    align-items: center;
    gap: 6px;
}

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

.progress-fill {
    height: 100%;
    background: var(--accent-primary);
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: width;
}

.progress-fill.complete {
    background: var(--accent-success);
}

.progress-text {
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 600;
    min-width: 40px;
    text-align: right;
}

.group-details {
    display: flex;
    gap: 15px;
    font-size: 12px;
    color: var(--text-muted);
}

/* Performance Statistics */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--bg-primary);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    border: 1px solid var(--border-primary);
    transition: box-shadow 0.2s ease;
}

.stat-card:hover {
    box-shadow: 0 4px 12px var(--shadow-color);
}

.stat-card.disabled {
    opacity: 0.6;
    background: var(--bg-tertiary);
}

.stat-card.disabled:hover {
    box-shadow: none;
}

.stat-icon {
    font-size: 32px;
    margin-bottom: 10px;
    opacity: 0.8;
}

.stat-content {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.stat-sub {
    color: var(--text-muted);
    font-size: 12px;
}

/* Volume Analysis */
.volume-analysis {
    margin-top: 20px;
    background: var(--bg-primary);
    border-radius: 8px;
    padding: 20px;
    border: 1px solid var(--border-primary);
}

.volume-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-top: 15px;
}

.volume-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.volume-item label {
    color: var(--text-muted);
    font-size: 13px;
}

.volume-item span {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
}

/* Recent Activity */
.activity-list {
    max-height: 300px;
    overflow-y: auto;
}

.no-activity {
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
    padding: 20px;
}

.activity-item {
    display: flex;
    gap: 15px;
    padding: 12px;
    background: var(--bg-primary);
    border-radius: 6px;
    margin-bottom: 8px;
    border: 1px solid var(--border-primary);
    align-items: center;
}

.activity-time {
    color: var(--text-muted);
    font-size: 12px;
    font-family: 'Courier New', monospace;
    min-width: 80px;
}

.activity-details {
    display: flex;
    gap: 10px;
    align-items: center;
    flex: 1;
    flex-wrap: wrap;
}

.activity-id {
    color: var(--accent-primary);
    font-weight: 600;
    font-family: 'Courier New', monospace;
}

.activity-value {
    color: var(--accent-secondary);
    font-weight: 600;
}

.activity-summary {
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 8px;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .client-overview-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .client-stats-summary {
        width: 100%;
    }

    .title-container {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 10px;
        padding: 15px; /* Reduced padding on mobile */
        min-height: auto; /* Auto height on mobile */
    }

    .status-time-container {
        flex-direction: row; /* Keep horizontal on mobile for better use of space */
        align-items: center;
        justify-content: center;
        gap: 15px;
        width: 100%;
        margin-top: 10px;
    }
    
    .controls {
        flex-direction: column;
        gap: 20px;
    }
    
    .flow-container {
        flex-direction: column;
    }
    
    .flow-arrow {
        transform: rotate(90deg);
    }
    
    .metrics-grid,
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .filter-container {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-container input,
    .filter-container select,
    .filter-container button {
        width: 100%;
    }
    
    .client-cards {
        grid-template-columns: 1fr;
    }
}

/* ===== ALLOCATION DETAIL VIEW - LAYOUT STABILITY FIXES ===== */

/* Fixed modal dimensions to prevent shifting */
#allocation-detail-modal {
    max-height: 90vh !important;
    height: 90vh !important; /* Fixed height prevents shifting */
    max-width: 95vw !important;
    width: 90% !important;
    display: none; /* Hidden by default */
    flex-direction: column;
}

/* When modal is shown, make it flex */
#allocation-detail-modal[style*="display: block"] {
    display: flex !important;
}

#allocation-detail-content {
    flex: 1;
    overflow: hidden;
    min-height: 0; /* Important for flexbox */
    display: flex;
    flex-direction: column;
}

.allocation-detail-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    /* Force scrollbar to always show to prevent layout shift */
    scrollbar-gutter: stable;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    padding: 20px;
    padding-bottom: 40px; /* Extra padding at bottom */
    min-height: 0; /* Important for flexbox scrolling */
}

/* Custom scrollbar styling */
.allocation-detail-container {
    scrollbar-width: thin;
    scrollbar-color: var(--border-primary) var(--bg-primary);
}

/* WebKit browsers */
.allocation-detail-container::-webkit-scrollbar {
    width: 12px;
    background-color: var(--bg-primary);
}

.allocation-detail-container::-webkit-scrollbar-track {
    background-color: var(--bg-primary);
    border-radius: 6px;
}

.allocation-detail-container::-webkit-scrollbar-thumb {
    background-color: var(--border-primary);
    border-radius: 6px;
    border: 2px solid var(--bg-primary);
}

/* Hover styling removed to avoid invalid selector warnings in non-WebKit browsers */

/* Reserve space for charts to prevent jumping */
.detail-section .chart-container {
    min-height: 400px; /* Reserve space for charts */
    position: relative;
    /* Removed contain property to allow proper scrolling */
}

#sankey-container {
    min-height: 400px !important; /* Fixed minimum height */
    max-height: 700px !important;
    height: 400px; /* Default height, will be adjusted by JS */
    transition: none !important; /* Remove transition during load */
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden; /* Ensure content stays within bounds */
    padding: 10px; /* Add padding for breathing room */
}

/* Ensure SVG respects container bounds */
#allocation-sankey {
    max-width: 100% !important;
    max-height: 100% !important;
    width: 100% !important;
    height: 100% !important;
}

#allocation-history-chart {
    min-height: 200px !important;
    display: block;
}

/* Canvas parent container for history chart */
.detail-section.has-history-chart {
    min-height: 250px;
    position: relative;
}

/* Loading placeholders */
.chart-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--text-muted);
    font-size: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    z-index: 1;
}

/* Skeleton loader animation */
.skeleton-loader {
    width: 80%;
    max-width: 300px;
    height: 20px;
    background: linear-gradient(
        90deg,
        var(--bg-tertiary) 25%,
        var(--border-primary) 50%,
        var(--bg-tertiary) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 4px;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Prevent content jumping in sections */
.detail-section {
    min-height: 200px; /* Minimum height for sections */
    /* Removed contain property to allow proper height calculation */
}

.detail-section.full-width {
    min-height: 300px;
}

/* Fixed dimensions for specific sections */
.detail-section.has-fx-rate {
    min-height: 250px;
}

/* Select All Checkbox Styling */
.select-all-checkbox {
    cursor: pointer;
    margin: 0;
    width: 16px;
    height: 16px;
}

/* Progress container in tables */
.progress-container {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: auto;
    white-space: nowrap;
}

.progress-bar {
    width: 70px;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
}

.progress-fill {
    height: 100%;
    background: var(--accent-primary);
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: width;
    border-radius: 3px;
}

/* Time-based progress animation */
.progress-fill.grouping-timebased {
    background: var(--lane-timebased);
    transition: width 0.1s linear;
}

/* Value-based progress animation */
.progress-fill.grouping-value {
    background: var(--lane-value);
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Client-triggered progress animation */
.progress-fill.grouping-clienttriggered {
    background: var(--lane-clienttriggered);
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Progress text */
.progress-text {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 600;
    min-width: 30px;
    text-align: right;
    flex-shrink: 0;
}

/* Progress complete checkmark */
.progress-complete {
    color: var(--accent-success);
    font-weight: 600;
    font-size: 16px;
    display: inline-block;
    text-align: center;
}

/* Muted text in table cells */
td .text-muted {
    color: var(--text-muted);
    font-size: 12px;
}

/* Tables container with fixed dimensions */
.trades-table-container {
    min-height: 300px;
    max-height: 500px;
    overflow-y: auto;
    overflow-x: auto;
    position: relative;
    /* Removed contain property for better flow */
}

/* Audit trail - remove internal scrolling, let parent handle it */
.audit-trail.comprehensive {
    min-height: 200px;
    /* Remove max-height to show all content */
    overflow: visible;
    margin-bottom: 20px; /* Space at bottom */
}

.audit-trail.comprehensive.no-scroll {
    min-height: 200px;
    overflow: visible;
}

/* Hide the close button div entirely - we'll use Escape key */
#allocation-detail-modal > div[style*="text-align: right"] {
    display: none !important;
}

/* Grid sections maintain structure */
.detail-grid {
    /* Removed contain to allow proper content flow */
}

/* Placeholder states for loading content */
.detail-section.loading .detail-content {
    position: relative;
    min-height: 150px;
}

.detail-section.loading .detail-content::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        180deg,
        transparent 0%,
        var(--bg-tertiary) 50%,
        transparent 100%
    );
    animation: shimmer 1.5s ease-in-out infinite;
}

@keyframes shimmer {
    0% {
        transform: translateY(-100%);
    }
    100% {
        transform: translateY(100%);
    }
}

/* Ensure FX section doesn't collapse */
.fx-rate-section {
    min-height: 280px;
}

/* Commission details section minimum height */
/* Note: :contains() is not valid CSS - using attribute selectors instead */
.detail-section.commission-details {
    min-height: 280px;
}

/* Basic information section */
.detail-section.basic-info {
    min-height: 320px;
}

/* Allocation information section */
.detail-section.allocation-info {
    min-height: 250px;
}

body[data-theme="matrix"] .allocation-detail-container::-webkit-scrollbar-track {
    background-color: var(--bg-primary);
}

body[data-theme="matrix"] .allocation-detail-container::-webkit-scrollbar-thumb {
    background-color: var(--accent-primary);
    border-color: var(--bg-primary);
}

body[data-theme="monochrome"] .allocation-detail-container::-webkit-scrollbar-track {
    background-color: var(--bg-primary);
}

body[data-theme="monochrome"] .allocation-detail-container::-webkit-scrollbar-thumb {
    background-color: var(--text-primary);
    border-color: var(--bg-primary);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #allocation-detail-modal {
        max-height: 100vh !important;
        height: 100vh !important;
    }
    
    .detail-section {
        min-height: 150px;
    }
    
    #sankey-container {
        min-height: 300px !important;
    }
    
    .trades-table-container {
        min-height: 200px;
        max-height: 400px;
    }
}

/* ===== CLIENT MANAGER REAL-TIME UPDATE STYLES ===== */

/* Client card hover improvements */
.client-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

/* Stat value display */
[data-stat] {
    display: inline-block;
}

/* Client details stat display */
[data-detail-stat] {
    display: inline-block;
}

/* Back button styling */
.btn-back {
    padding: 8px 16px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-back:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-primary);
    transform: translateX(-2px);
}

/* Last update time */
.last-update {
    color: var(--text-muted);
    font-size: 12px;
    font-style: italic;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Progress bar smooth updates */
.progress-fill {
    transition: width 0.5s ease-out;
}

/* Optimize scrollbar for client details */
.client-details-content {
    scrollbar-gutter: stable;
}

/* Trader rankings table */
.trader-rankings-table {
    width: 100%;
    border-collapse: collapse;
}


.trader-rankings-table caption {
    text-align: left;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.trader-rankings-table th,
.trader-rankings-table td {
    padding: 8px 12px;
    font-size: 12px;
    color: var(--text-primary);
}

.trader-rankings-table tbody tr:nth-child(odd) {
    background: var(--bg-tertiary);
}

.trader-rankings-table tbody tr:hover {
    background: var(--bg-secondary);
}

.trader-rankings-table .rank-number {
    font-weight: 700;
    text-align: center;
}



.trader-rankings-table .desk-trades {
    color: var(--text-muted);
}


.trader-rankings-table .commission-value {
    color: var(--accent-success);
    font-weight: 600;
    text-align: left;
}

.trader-rankings-table .volume-value,
.trader-rankings-table .value-value,
.trader-rankings-table .csa-value,
.trader-rankings-table .efficiency-value {
    color: var(--text-secondary);
    font-weight: 500;
    text-align: left;
}


.metric-bar {
    background: var(--bg-secondary);
    height: 4px;
    margin-top: 4px;
    border-radius: 2px;
}

.metric-fill {
    background: var(--accent-primary);
    height: 100%;
    width: 0;
    border-radius: 2px;
}

.no-trader-data {
    text-align: center;
    color: var(--text-muted);
    padding: 40px;
}

/* Manual Allocation Preview Enhancements */
.allocation-preview {
    max-height: 60vh;
    overflow-y: auto;
}

.preview-summary {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-primary);
}

.preview-group {
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    padding: 8px;
    margin-bottom: 10px;
}

.preview-group label {
    display: block;
    font-weight: 600;
}

.preview-trades {
    margin-left: 20px;
    margin-top: 5px;
}

.preview-trade {
    display: block;
    font-weight: 400;
    margin-bottom: 3px;
}

/* Noise overlay */

/* ===== IMPROVED ADVANCED CONTROLS - NEW LAYOUT ===== */

/* Advanced Controls - Improved Layout */
.advanced-controls {
    display: none;
    margin-top: 10px; /* Reduced from 20px to 10px */
    margin-bottom: 10px; /* Added bottom margin */
    padding: 20px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    border: 1px solid var(--border-primary);
    animation: slideDown 0.3s ease;
}

.advanced-controls.active {
    display: block;
}

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

/* Advanced Menu Header */
.advanced-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-primary);
}

.advanced-header h3 {
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.advanced-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.advanced-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Advanced Sections Grid */
.advanced-sections {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    width: 100%;
    max-width: 100%;
    overflow: hidden; /* Prevent cards from overflowing */
}

/* Advanced Section */
.advanced-section {
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    padding: 20px;
    transition: all 0.2s ease;
    min-height: 280px; /* Ensure consistent height */
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Prevent content overflow */
    box-sizing: border-box; /* Include padding in width calculation */
}

.advanced-section:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0; /* Don't shrink */
}

/* Make content areas flex to fill available space */
.trade-control-content,
.mode-selector-content,
.noise-generator-content,
.particle-settings-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.section-icon {
    font-size: 18px;
    opacity: 0.8;
}

/* Enhanced Commission Configuration Layout */
.commission-configuration {
    background: var(--bg-secondary);
    border: 2px solid var(--border-primary);
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 12px var(--shadow-color);
    transition: all 0.3s ease;
}

.commission-configuration:hover {
    box-shadow: 0 6px 20px var(--shadow-color-strong);
    border-color: var(--accent-primary);
}

.commission-configuration h3 {
    color: var(--text-primary);
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border-primary);
}

.commission-config-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.commission-config-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: end;
}

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

.commission-form-group label {
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.help-icon {
    font-size: 14px;
    color: var(--text-muted);
    cursor: help;
    transition: color 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--bg-tertiary);
}

.help-icon:hover {
    color: var(--accent-info);
    background: var(--bg-primary);
}

/* Theme-aware inputs */
.theme-input {
    padding: 10px 14px;
    background: var(--bg-primary);
    border: 2px solid var(--border-primary);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    width: 100%;
}

.theme-input:hover {
    border-color: var(--accent-primary);
    background: var(--bg-tertiary);
}

.theme-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-primary), transparent 85%);
    background: var(--bg-secondary);
}

.theme-input:disabled {
    background: var(--bg-tertiary);
    color: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.6;
    border-color: var(--border-primary);
}

/* Select styling */
select.theme-input {
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M1 1L6 6L11 1' stroke='%23999' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

select.theme-input option {
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: 8px;
}

/* Input with units */
.input-with-units {
    position: relative;
    display: flex;
    align-items: stretch;
}

.input-with-units input {
    padding-right: 65px;
}

.input-unit {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    pointer-events: none;
    background: var(--bg-primary);
    padding: 0 4px;
}

/* CSA Configuration Group */
.csa-config-group {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 24px;
    align-items: start;
    padding: 20px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    border: 1px solid var(--border-primary);
    transition: all 0.3s ease;
}

.csa-checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
}

.csa-checkbox-wrapper input[type="checkbox"] {
    width: 24px;
    height: 24px;
    cursor: pointer;
    accent-color: var(--accent-primary);
}

.csa-checkbox-wrapper label {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    user-select: none;
    text-transform: none;
    letter-spacing: normal;
}

.csa-percentage-wrapper {
    transition: opacity 0.3s ease, filter 0.3s ease;
}

.csa-percentage-wrapper.disabled {
    opacity: 0.5;
    filter: grayscale(100%);
    pointer-events: none;
}

/* Input with addon */
.input-with-addon {
    display: flex;
    align-items: stretch;
}

/* ===== NUMBER INPUT SPIN BUTTON THEMING ===== */

/* Base number input styling */
input[type="number"] {
    position: relative;
}

/* WebKit browsers - Style spin buttons for all inputs */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: auto;
    opacity: 1;
    cursor: pointer;
}

/* Firefox - Default to showing spin buttons */
input[type="number"] {
    -moz-appearance: auto;
}

/* Commission Calculator specific - Always show spin buttons */
.calc-input input[type="number"]::-webkit-inner-spin-button,
.calc-input input[type="number"]::-webkit-outer-spin-button,
.commission-form-group input[type="number"]::-webkit-inner-spin-button,
.commission-form-group input[type="number"]::-webkit-outer-spin-button,
.input-with-units input[type="number"]::-webkit-inner-spin-button,
.input-with-units input[type="number"]::-webkit-outer-spin-button,
.input-with-addon input[type="number"]::-webkit-inner-spin-button,
.input-with-addon input[type="number"]::-webkit-outer-spin-button {
    opacity: 1 !important;
}

/* Ocean theme number inputs */
body[data-theme="ocean"] input[type="number"]::-webkit-inner-spin-button,
body[data-theme="ocean"] input[type="number"]::-webkit-outer-spin-button {
    filter: hue-rotate(200deg) brightness(1.2); /* Blue tint */
}

/* Matrix theme number inputs */
body[data-theme="matrix"] input[type="number"],
body[data-theme="matrix"] input[type="number"]::-webkit-inner-spin-button,
body[data-theme="matrix"] input[type="number"]::-webkit-outer-spin-button {
    color: var(--accent-primary) !important;
}

/* Style spin buttons in matrix theme */
body[data-theme="matrix"] input[type="number"]::-webkit-inner-spin-button,
body[data-theme="matrix"] input[type="number"]::-webkit-outer-spin-button {
    opacity: 1;
    filter: hue-rotate(120deg) brightness(1.5); /* Make arrows green */
}

/* Monochrome theme number inputs */
body[data-theme="monochrome"] input[type="number"]::-webkit-inner-spin-button,
body[data-theme="monochrome"] input[type="number"]::-webkit-outer-spin-button {
    filter: grayscale(100%) contrast(2); /* Pure black/white */
}

/* Cyberpunk theme number inputs */
body[data-theme="cyberpunk"] input[type="number"]::-webkit-inner-spin-button,
body[data-theme="cyberpunk"] input[type="number"]::-webkit-outer-spin-button {
    filter: hue-rotate(320deg) brightness(1.4) saturate(2); /* Neon pink */
}

/* Midnight theme number inputs */
body[data-theme="midnight"] input[type="number"]::-webkit-inner-spin-button,
body[data-theme="midnight"] input[type="number"]::-webkit-outer-spin-button {
    filter: hue-rotate(240deg) brightness(1.1); /* Deep purple */
}

/* Retro theme number inputs */
body[data-theme="retro"] input[type="number"]::-webkit-inner-spin-button,
body[data-theme="retro"] input[type="number"]::-webkit-outer-spin-button {
    filter: hue-rotate(300deg) brightness(1.3) saturate(1.5); /* Hot pink */
}

/* Firefox number input styling for all themes */
body[data-theme="ocean"] input[type="number"] {
    scrollbar-color: var(--accent-primary) var(--bg-tertiary);
}

body[data-theme="matrix"] input[type="number"] {
    color: var(--accent-primary) !important;
    scrollbar-color: var(--accent-primary) var(--bg-primary);
}

body[data-theme="monochrome"] input[type="number"] {
    scrollbar-color: var(--text-primary) var(--bg-tertiary);
}

body[data-theme="cyberpunk"] input[type="number"] {
    scrollbar-color: var(--accent-primary) var(--bg-tertiary);
}

body[data-theme="midnight"] input[type="number"] {
    scrollbar-color: var(--accent-primary) var(--bg-tertiary);
}

body[data-theme="retro"] input[type="number"] {
    scrollbar-color: var(--accent-primary) var(--bg-tertiary);
}

/* Hover states for spin buttons */
input[type="number"]::-webkit-inner-spin-button:hover,
input[type="number"]::-webkit-outer-spin-button:hover {
    opacity: 0.8;
}

/* Active/pressed states */
input[type="number"]::-webkit-inner-spin-button:active,
input[type="number"]::-webkit-outer-spin-button:active {
    opacity: 0.6;
}

/* Edge and other browsers fallback */
@supports not ((-webkit-appearance: none) and (filter: hue-rotate(0deg))) {
    input[type="number"] {
        /* Fallback for browsers that don't support filters on spin buttons */
        accent-color: var(--accent-primary);
    }
}

/* Ensure consistent appearance across all number inputs */
input[type="number"] {
    font-variant-numeric: tabular-nums; /* Align numbers properly */
    text-align: right; /* Right-align numbers */
}

/* Left align specific inputs that need it */
.frequency-input,
.slider-value input[type="number"] {
    text-align: center;
}

.input-with-addon input {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: none;
}

.input-addon {
    padding: 10px 14px;
    background: var(--bg-secondary);
    border: 2px solid var(--border-primary);
    border-left: none;
    border-top-right-radius: 6px;
    border-bottom-right-radius: 6px;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
}

/* Commission Actions */
.commission-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
}

.btn-save-settings {
    padding: 12px 24px;
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-save-settings:hover {
    background: var(--accent-primary);
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn-save-settings:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.save-icon {
    font-size: 18px;
}

/* Commission Preview Enhanced */
.commission-preview {
    background: var(--bg-tertiary);
    border-radius: 10px;
    padding: 24px;
    margin-top: 24px;
    border: 2px solid var(--border-primary);
    position: relative;
    overflow: hidden;
}

.commission-preview::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
}

.commission-preview h4 {
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.calculator-icon {
    font-size: 20px;
}

.calculator-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.calc-input {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.calc-input label {
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Input with prefix */
.input-with-prefix {
    display: flex;
    align-items: stretch;
}

.input-prefix {
    padding: 10px 14px;
    background: var(--bg-secondary);
    border: 2px solid var(--border-primary);
    border-right: none;
    border-top-left-radius: 6px;
    border-bottom-left-radius: 6px;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
}

.input-with-prefix input {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

/* Calculator Results */
.calc-results-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-primary);
}

.calc-result {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    text-align: center;
    padding: 16px;
    background: var(--bg-primary);
    border-radius: 6px;
    transition: all 0.3s ease;
}

.calc-result.disabled {
    opacity: 0.5;
    filter: grayscale(100%);
}

.calc-result label {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.result-value {
    font-size: 24px;
    font-weight: 700;
    transition: all 0.3s ease;
}

.result-value.commission {
    color: var(--accent-secondary);
}

.result-value.csa {
    color: var(--accent-info);
}

/* Monochrome theme overrides */
body[data-theme="monochrome"] .commission-configuration {
    background: var(--bg-secondary);
    border: 3px solid var(--border-primary);
    box-shadow: 6px 6px 0 var(--border-primary);
}

body[data-theme="monochrome"] .theme-input {
    background: var(--bg-primary);
    border: 2px solid var(--border-primary);
    font-weight: 600;
}

body[data-theme="monochrome"] .btn-save-settings {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 3px solid var(--border-primary);
    box-shadow: 4px 4px 0 var(--border-primary);
}

body[data-theme="monochrome"] .btn-save-settings:hover {
    background: var(--bg-secondary);
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 var(--border-primary);
}

/* Matrix theme overrides */
body[data-theme="matrix"] .commission-configuration {
    background: var(--bg-secondary);
    border: 1px solid var(--accent-primary);
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.1);
}

body[data-theme="matrix"] .theme-input {
    background: var(--bg-primary);
    border: 1px solid var(--accent-primary);
    color: var(--accent-primary);
    font-family: 'Courier New', monospace;
}

body[data-theme="matrix"] .theme-input:focus {
    box-shadow: 0 0 0 3px rgba(0, 255, 0, 0.3);
}

/* Responsive */
@media (max-width: 768px) {
    .commission-config-row {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .csa-config-group {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .calculator-grid {
        grid-template-columns: 1fr;
    }
    
    .calc-results-row {
        grid-template-columns: 1fr;
    }
}

/* Particle Mode Dropdown - Ensure adequate spacing */
#particle-mode {
    min-width: 140px !important;
    padding: 10px 16px !important;
    font-size: 14px !important;
    cursor: pointer;
}

/* Particle Settings Content specific styles */

.particle-settings-content .setting-item {
    margin-bottom: 8px;
}

/* Setting control specific adjustments */
.particle-settings-content .setting-control {
    flex: 1;
    display: flex;
    justify-content: flex-end;
    min-width: 160px;
}

/* Noise Generator Section specific styles */

/* Standalone Play Control */
.noise-play-control-standalone {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-primary);
}

.noise-play-control-standalone .noise-toggle {
    background: var(--accent-primary);
    border: none;
    color: var(--bg-primary);
    padding: 0;
    border-radius: 50%;
    cursor: pointer;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    position: relative;
    /* Ensure the icon is centered */
    line-height: 1;
    text-align: center;
}

/* Adjust play icon positioning slightly to the right for visual centering */
.noise-play-control-standalone .noise-toggle:not(.active) {
    padding-left: 3px;
}

/* Ensure stop icon is centered - adjust vertical positioning */
.noise-play-control-standalone .noise-toggle.active {
    padding-left: 0;
    padding-bottom: 4px; /* Lift the square up by adding bottom padding */
}

.noise-play-control-standalone .noise-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.noise-play-control-standalone .noise-toggle.active {
    background: var(--accent-danger);
    animation: pulse-animation 2s infinite;
}

@keyframes pulse-animation {
    0% { box-shadow: 0 0 0 0 rgba(255, 0, 0, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(255, 0, 0, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 0, 0, 0); }
}

.noise-play-control-standalone .play-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

/* Noise Controls */
.noise-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.noise-control-row {
    display: flex;
    gap: 12px;
    align-items: stretch;
}

.noise-control {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.noise-control label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.noise-type-select {
    padding: 8px 12px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M1 1L5 5L9 1' stroke='%23999' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 8px center;
    padding-right: 30px;
}

.noise-type-select:hover {
    background-color: var(--bg-secondary);
    border-color: var(--accent-primary);
}

.noise-type-select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-primary), transparent 80%);
}

.noise-type-select option {
    background: var(--bg-primary);
    color: var(--text-primary);
}

/* Slider Controls */
.slider-control {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.slider-control label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.slider-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.slider-input {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    background: color-mix(in srgb, var(--accent-primary), transparent 80%);
    border-radius: 3px;
    cursor: pointer;
    outline: none;
}

.slider-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent-primary);
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.slider-input::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent-primary), transparent 80%);
}

/* Firefox slider styles */
.slider-input::-moz-range-track {
    height: 6px;
    background: color-mix(in srgb, var(--accent-primary), transparent 80%);
    border-radius: 3px;
    border: none;
}

.slider-input::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent-primary);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.slider-input::-moz-range-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent-primary), transparent 80%);
}

.slider-value {
    min-width: 60px;
    padding: 4px 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap; /* Prevent wrapping */
}

.slider-unit {
    color: var(--text-muted);
    font-size: 11px;
    min-width: 20px;
}

/* Frequency Input */
.frequency-input {
    width: 80px;
    padding: 4px 8px;
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    color: var(--text-primary);
    border-radius: 4px;
    font-size: 12px;
    text-align: center;
    -moz-appearance: textfield;
}

.frequency-input::-webkit-outer-spin-button,
.frequency-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.frequency-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-primary), transparent 80%);
}

/* Removed System Settings Section */

.setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    background: var(--bg-secondary);
    border-radius: 4px;
    transition: background 0.2s ease;
}

.setting-item:hover {
    background: var(--bg-tertiary);
}

.setting-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-primary);
}

.setting-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    background: var(--bg-tertiary);
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.3s ease;
    border: 1px solid var(--border-primary);
}

.toggle-switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: transform 0.3s ease, background 0.3s ease;
}

.toggle-switch input:checked ~ .toggle-slider {
    transform: translateX(20px);
    background: var(--accent-primary);
}

.toggle-switch.checked {
    background: color-mix(in srgb, var(--accent-primary), transparent 80%);
}



/* Responsive for Advanced Controls */
@media (max-width: 1400px) {
    .advanced-sections {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .advanced-sections {
        grid-template-columns: 1fr;
    }
    
    .advanced-section {
        min-height: auto; /* Remove fixed height on mobile */
    }

    .noise-control-row {
        flex-direction: column;
    }
    
    /* Restore normal sizing on mobile */
    .trade-control-content .slider-value {
        min-width: 60px;
        font-size: 12px;
    }
    
    .trade-control-content .speed-indicator {
        min-width: 80px;
        font-size: 12px;
    }
}

/* Remove old advanced controls styles */
.control-group.advanced-controls {
    display: none !important;
}

/* ===== THEME-AWARE ICON SYSTEM ===== */

/* Base icon styles */
.theme-icon {
    display: inline-block;
    font-style: normal;
    font-weight: normal;
    transition: all 0.3s ease;
    vertical-align: middle;
}

/* Monochrome icons */
.monochrome-icon {
    font-weight: bold;
    color: var(--text-primary) !important;
    font-family: 'Courier New', monospace;
}

/* Matrix icons */
.matrix-icon {
    color: var(--accent-primary) !important;
    text-shadow: 0 0 5px var(--accent-primary);
    font-family: 'Courier New', monospace;
    font-weight: bold;
}

/* Matrix theme log icons specifically */
body[data-theme="matrix"] .log-icon {
    color: var(--accent-primary) !important;
    text-shadow: 0 0 5px var(--accent-primary);
    font-family: 'Courier New', monospace;
}

/* Matrix theme log entries - ensure all text is green */
body[data-theme="matrix"] #log-list li {
    color: var(--accent-primary) !important;
}

body[data-theme="matrix"] #log-list li.log-info,
body[data-theme="matrix"] #log-list li.log-success,
body[data-theme="matrix"] #log-list li.log-warning,
body[data-theme="matrix"] #log-list li.log-error,
body[data-theme="matrix"] #log-list li.log-trade,
body[data-theme="matrix"] #log-list li.log-allocation {
    color: var(--accent-primary) !important;
}

/* Medal icons special styling */
.medal-icon {
    font-size: 24px;
    margin: 0 4px;
}

body[data-theme="monochrome"] .medal-icon {
    font-size: 20px;
    font-weight: 900;
    color: var(--text-primary);
    border: 2px solid var(--text-primary);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    margin: 0;
}

body[data-theme="matrix"] .medal-icon {
    color: var(--accent-primary) !important;
    text-shadow: 0 0 10px var(--accent-primary);
    animation: matrix-pulse 2s infinite;
}

@keyframes matrix-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Section icons */
.section-icon {
    font-size: 18px;
    margin-right: 4px;
}

body[data-theme="monochrome"] .section-icon {
    font-size: 16px;
    font-weight: bold;
}

body[data-theme="matrix"] .section-icon {
    color: var(--accent-primary) !important;
    text-shadow: 0 0 8px var(--accent-primary);
}

/* Grouping icons */
.grouping-icon {
    font-size: 14px;
    margin-right: 2px;
}

body[data-theme="monochrome"] .grouping-icon {
    font-weight: bold;
    font-size: 13px;
}

body[data-theme="matrix"] .grouping-icon {
    color: var(--accent-primary) !important;
    text-shadow: 0 0 6px var(--accent-primary);
}

/* Desk icons */
.desk-icon {
    font-size: 20px;
    vertical-align: middle;
}

body[data-theme="monochrome"] .desk-icon {
    font-size: 16px;
    font-weight: 900;
}

body[data-theme="matrix"] .desk-icon {
    color: var(--accent-primary) !important;
    text-shadow: 0 0 8px var(--accent-primary);
}

/* Currency flags */
.currency-flag {
    font-size: 14px;
    margin-right: 4px;
    display: inline-block;
}

body[data-theme="monochrome"] .currency-flag {
    font-size: 11px;
    font-weight: bold;
    font-family: 'Courier New', monospace;
    border: 1px solid var(--text-primary);
    padding: 0 2px;
    border-radius: 2px;
}

body[data-theme="matrix"] .currency-flag {
    color: var(--accent-primary) !important;
    font-size: 11px;
    font-weight: bold;
    font-family: 'Courier New', monospace;
    text-shadow: 0 0 4px var(--accent-primary);
    border: 1px solid var(--accent-primary);
    padding: 0 2px;
    border-radius: 2px;
}

/* Trade Control Content specific overrides */

/* Trade Frequency Control */
.trade-control-content .slider-control {
    width: 100%;
}

.trade-control-content .slider-row {
    display: flex;
    align-items: center;
    gap: 6px; /* Reduced gap */
    width: 100%;
}

/* Make the slider take more space */
.trade-control-content .slider-input {
    flex: 1;
    min-width: 0; /* Allow it to shrink if needed */
}

/* Ensure value displays have enough space */
.trade-control-content .slider-value {
    min-width: 55px; /* Reduced for better fit */
    white-space: nowrap;
    font-size: 11px; /* Slightly smaller */
}

.trade-control-content .speed-indicator {
    min-width: 70px; /* Reduced but still fits "INSANE" */
    text-align: center;
    font-size: 11px; /* Slightly smaller */
}

.trade-control-content .setting-item:first-child {
    border-bottom: 1px solid var(--border-primary);
    padding-bottom: 16px;
    margin-bottom: 8px;
}

/* Icons toggle in Trade Control section */
.trade-control-content .setting-item:last-child {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-primary);
}

.theme-control {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.theme-control label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.theme-select {
    padding: 8px 12px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M1 1L5 5L9 1' stroke='%23999' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 8px center;
    padding-right: 30px;
}

.theme-select:hover {
    background-color: var(--bg-secondary);
    border-color: var(--accent-primary);
}

.theme-select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-primary), transparent 80%);
}

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

/* Operating Mode Section specific overrides */
.mode-selector-content {
    gap: 12px; /* Smaller gap than default */
}

.mode-control {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.mode-select {
    padding: 10px 14px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 2px solid var(--border-primary);
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mode-select:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-primary);
}

.mode-select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-primary), transparent 80%);
}

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

.mode-description {
    padding: 10px;
    background: var(--bg-secondary);
    border-radius: 4px;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
    text-align: center;
    font-style: italic;
}

/* Disabled section styling */
.advanced-section.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.advanced-section.disabled .section-title {
    color: var(--text-muted);
}

/* Mouse Control Button */
.mouse-control-button {
    width: 100%;
    padding: 8px 12px;
    border-radius: 4px;
    border: 1px solid var(--border-primary);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.mouse-control-button:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-primary);
}

.mouse-control-button.active {
    background: var(--accent-primary) !important;
    color: var(--bg-primary) !important;
    border-color: var(--accent-primary) !important;
}

.mouse-control-info {
    margin-top: 8px;
    padding: 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Enhanced Advanced Menu Styles */
/* Mode Features Grid */
.mode-features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 15px;
    padding: 10px;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-primary);
}

.feature-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.feature-indicator.active {
    border-color: var(--accent-primary);
    background: var(--bg-tertiary);
}

.feature-indicator.disabled {
    opacity: 0.4;
}

.feature-icon {
    font-size: 24px;
    margin-bottom: 5px;
}

.feature-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 3px;
}

.feature-status {
    font-size: 11px;
    font-weight: 600;
    color: var(--accent-primary);
    text-transform: uppercase;
}

.feature-indicator.disabled .feature-status {
    color: var(--text-muted);
}

/* Enhanced Mode Description */
.mode-description {
    margin-top: 10px;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-secondary);
    border-left: 3px solid var(--accent-primary);
    transition: all 0.3s ease;
}

/* Enhanced Mouse Control Section */
.mouse-control-section {
    margin-top: 20px;
    padding: 15px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    border: 1px solid var(--border-primary);
    transition: all 0.3s ease;
}

.mouse-control-section.active {
    border-color: var(--accent-primary);
    background: var(--bg-secondary);
}

.mouse-control-header {
    margin-bottom: 0;
}

.mouse-control-button {
    width: 100%;
    padding: 12px 20px;
    background: var(--bg-secondary);
    border: 2px solid var(--border-primary);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.mouse-control-button:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-primary);
    transform: translateY(-1px);
}

.mouse-control-button.active {
    background: var(--accent-primary);
    color: var(--bg-primary);
    border-color: var(--accent-primary);
    box-shadow: 0 0 20px rgba(var(--accent-primary-rgb), 0.4);
}

.mouse-icon {
    font-size: 18px;
    transition: transform 0.3s ease;
}

.mouse-control-button.active .mouse-icon {
    transform: scale(1.2);
}

.mouse-control-info {
    margin-top: 15px;
    padding: 15px;
    background: var(--bg-secondary);
    border-radius: 6px;
    animation: slideDown 0.3s ease;
}

.control-axis {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    padding: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
}

.axis-icon {
    font-size: 16px;
}

.axis-label {
    font-size: 13px;
    color: var(--text-secondary);
    min-width: 80px;
}

.axis-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-primary);
}

.control-mode-hint {
    margin-top: 12px;
    padding: 8px 12px;
    background: var(--accent-primary);
    color: var(--bg-primary);
    border-radius: 4px;
    font-size: 12px;
    text-align: center;
    font-weight: 600;
}

/* Disabled state for axis when not applicable */
.control-axis.disabled {
    opacity: 0.5;
}

.control-axis.disabled .axis-value {
    color: var(--text-muted);
    text-decoration: line-through;
}

/* Enhanced Mode Select Styling */
.mode-select {
    width: 100%;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 600;
    background: var(--bg-secondary);
    border: 2px solid var(--border-primary);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg width='14' height='8' viewBox='0 0 14 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M1 1L7 7L13 1' stroke='%23999' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

.mode-select:hover {
    border-color: var(--accent-primary);
    background-color: var(--bg-tertiary);
}

.mode-select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-primary), transparent 80%);
}

/* Dropdown option styling */
.mode-select option {
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: 8px;
}

/* Animation for mode changes */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .mode-features {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .feature-indicator {
        flex-direction: row;
        justify-content: space-between;
        padding: 8px 12px;
    }
    
    .feature-icon {
        font-size: 20px;
        margin-bottom: 0;
    }
    
    .feature-label {
        flex: 1;
        text-align: left;
        margin: 0 10px;
    }
}


