:root {
    --bg-dark: #0f172a;
    --bg-panel: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-blue: #3b82f6;
    --accent-blue-hover: #2563eb;
    --accent-green: #10b981;
    --accent-red: #ef4444;
    --border-color: #334155;
    --font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-family);
    margin: 0;
    height: 100vh;
    display: flex;
    overflow: hidden;
}

h1,
h2,
h3 {
    margin: 0;
    font-weight: 600;
}

.app-container {
    display: flex;
    width: 100%;
    height: 100%;
}

/* Sidebar */
.sidebar {
    width: 320px;
    background-color: var(--bg-panel);
    border-right: 1px solid var(--border-color);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
}

.brand {
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.brand h1 {
    font-size: 1.5rem;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.status-indicator {
    font-size: 0.875rem;
    color: var(--accent-green);
    margin-top: 5px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-indicator.offline {
    color: var(--accent-red);
}

.status-indicator::before {
    content: '';
    display: block;
    width: 8px;
    height: 8px;
    background-color: currentColor;
    border-radius: 50%;
    box-shadow: 0 0 8px currentColor;
}

.panel h2 {
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 15px;
}

.control-group {
    margin-bottom: 15px;
}

.control-group label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

select,
input[type="text"],
select,
input[type="text"],
input[type="password"],
input[type="number"] {
    width: 100%;
    background-color: var(--bg-dark);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.875rem;
    font-family: inherit;
    transition: border-color 0.2s;
    box-sizing: border-box;
    margin-bottom: 8px;
}

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

button {
    width: 100%;
    background-color: var(--accent-blue);
    color: white;
    border: none;
    padding: 10px;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

button:hover {
    background-color: var(--accent-blue-hover);
}

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

.success-btn {
    background-color: var(--accent-green);
}

.success-btn:hover {
    background-color: #059669;
}

.danger-btn {
    background-color: var(--accent-red);
}

.danger-btn:hover {
    background-color: #dc2626;
}

.secondary-btn {
    background-color: #607D8B;
}

.secondary-btn:hover {
    background-color: #546E7A;
}

.info-btn {
    background-color: #009688;
}

.info-btn:hover {
    background-color: #00796B;
}

.button-row {
    display: flex;
    gap: 10px;
}

/* Main Content - Flex Column Layout for Tabs + View */
.main-content {
    display: flex !important;
    /* Override grid */
    flex-direction: column;
    /* Remove grid properties if they were inline or specific */
    grid-template-columns: none;
    gap: 0;
    flex: 1;
    background-color: var(--border-color);
}

.terminal-wrapper {
    background-color: var(--bg-dark);
    display: flex;
    flex-direction: column;
    min-width: 0;
    /* Prevent flex item from overflowing */
}

.terminal-header {
    background-color: var(--bg-panel);
    padding: 10px 15px;
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

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

.status-dot.connected {
    background-color: var(--accent-green);
    box-shadow: 0 0 8px var(--accent-green);
}

.chart-wrapper {
    position: relative;
    /* Removed padding to let canvas fill */
    display: flex;
    flex-direction: column;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 10px;
    background-color: var(--surface-color-alt);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.chart-title {
    font-weight: 600;
    color: var(--text-primary);
}

.chart-stats {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
}

.chart-canvas-container {
    flex: 1;
    position: relative;
    width: 100%;
    min-height: 0;
    /* Important for flex child to shrink */
    overflow: hidden;
}

.terminal-container {
    flex: 1;
    position: relative;
    padding: 10px;
    overflow: hidden;
}

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

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

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

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

/* Sidebar Tab Navigation */
.tab-nav {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.9rem;
    padding: 10px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    border-radius: 0;
}

.tab-btn:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    color: var(--accent-blue);
    border-bottom-color: var(--accent-blue);
}

.tab-content {
    display: none;
    animation: fadeIn 0.2s ease-in-out;
}

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

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

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

/* Helper classes */
.flex-grow {
    flex-grow: 1;
}

.auto-width {
    width: auto !important;
}

.help-text {
    font-size: 0.75rem;
    color: #94a3b8;
    display: block;
    margin-top: 4px;
}

.checkbox-group {
    margin-top: 10px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
}

.mic-input-group {
    display: flex;
    gap: 5px;
}

.radio-group {
    display: flex;
    gap: 15px;
    margin-bottom: 10px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
}

/* Main View Tabs (Top Bar) */
.view-tabs {
    flex: 0 0 40px;
    /* Fixed height */
    position: static;
    width: 100%;
    background-color: var(--bg-panel);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    z-index: 10;
    /* overflow-x: auto;  REMOVED: User requested fixed width / no scroll */
    /* white-space: nowrap; REMOVED */
}

/* Hide scrollbar for view-tabs */
.view-tabs::-webkit-scrollbar {
    height: 4px;
    /* Tiny scrollbar */
}

.view-tabs::-webkit-scrollbar-thumb {
    background: var(--border-color);
}

.view-tab-btn {
    flex: 1;
    /* Make them fill the width like sidebar tabs */
    padding: 0 20px;
    height: 100%;
    /* flex-shrink: 0; REMOVED: Allow shrinking */
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    /* Match sidebar tab style */
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    border-radius: 0;
    /* Ensure square corners */
}

.view-tab-btn:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.05);
}

.view-tab-btn.active {
    color: var(--accent-blue);
    background-color: transparent;
    /* Removed dark bg */
    border-bottom-color: var(--accent-blue);
}

/* View Containers */
.view-container {
    flex: 1;
    /* Fill remaining space */
    width: 100%;
    padding-top: 0;
    display: none;
    /* Hidden by default */
    overflow: hidden;
    overflow: hidden;
    /* Handle internal scrolling */
    flex-direction: column;
    /* Ensure default vertical stacking */
}

/* Explicit scrollable content area for admin/tables */
.scrollable-content {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.view-container.active {
    display: flex;
}

/* Terminal View - Specific Layout */
#terminal-view {
    display: none;
}

#terminal-view.active {
    display: grid;
    /* Restore original grid layout */
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    background-color: var(--border-color);
}

/* Data View - Specific Layout */
#data-view {
    display: none;
}

#data-view.active {
    display: flex;
    flex-direction: row;
    /* Ensure Map and Stats are side-by-side on desktop */
    background-color: var(--bg-dark);
}

/* Map & Chart Styles */
.map-container {
    flex: 1;
    /* 1:1 Split initially */
    min-width: 0;
    width: 50%;
    position: relative;
    border-right: 1px solid var(--border-color);
}

#map {
    width: 100%;
    height: 100%;
}

.stats-container {
    flex: 1;
    /* 1:1 Split */
    min-width: 0;
    width: 50%;
    display: flex;
    flex-direction: column;
}

.chart-wrapper {
    flex: 1;
    /* Split vertical */
    padding: 10px;
    position: relative;
    border-bottom: 1px solid var(--border-color);
    overflow: hidden;
    /* Prevent canvas overflow */
}

.chart-wrapper:last-child {
    border-bottom: none;
}

/* --- Added Styles for Modular Frontend --- */

/* Audio Analysis Tracks */
.track-container {
    background: #000;
    margin-bottom: 15px;
    border-radius: 4px;
    padding: 10px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    border: 1px solid #333;
}

[id^="wf-"] {
    min-height: 60px;
    width: 100%;
}

.track-source-primary {
    border: 1px solid #2e7d32;
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.2);
}

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

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

.track-name-source {
    font-weight: bold;
    color: #4CAF50;
}

.track-name-output {
    font-weight: bold;
}

.badge-primary {
    background: #4CAF50;
    color: #000;
    padding: 2px 5px;
    border-radius: 3px;
    font-size: 0.7em;
}

.badge-rx {
    border: 1px solid;
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 0.7em;
}

.track-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.offset-label {
    font-size: 0.8em;
    color: #aaa;
}

.offset-input {
    width: 38px;
    background: #222;
    border: 1px solid #444;
    color: #fff;
    padding: 2px 5px;
    border-radius: 3px;
}

.track-details-group {
    margin-top: 5px;
}

.track-details-group summary {
    cursor: pointer;
    font-size: 0.8em;
    color: #888;
}

.track-details-content {
    padding: 5px;
    font-size: 0.8em;
    color: #ccc;
    background: #111;
    margin-top: 5px;
    border-radius: 3px;
}

.meta-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 2px 10px;
}

.small {
    padding: 4px 8px;
    font-size: 0.8em;
    width: auto !important;
    display: inline-block;
    margin: 0;
}

.small-btn {
    padding: 2px 8px;
    font-size: 0.8em;
    width: auto;
}


.action-btn-group {
    display: flex;
    gap: 5px;
    width: 100%;
}

.action-btn-group .small {
    flex: 1;
    text-align: center;
    width: 100% !important;
    /* Force full width within flex item */
}

/* Admin View specific override */
#admin-view {
    display: none;
    flex-direction: column;
    overflow: hidden;
    /* Container itself shouldn't scroll, let content scroll */
}

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

#admin-view>.admin-section-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.btn-active-red {
    background-color: #f44336 !important;
    color: white !important;
}

.btn-active-orange {
    background-color: #ff9800 !important;
    color: black !important;
}

.btn-active-green {
    background-color: #4CAF50 !important;
    color: black !important;
}

/* Log Coloring */
.log-entry {
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    margin-bottom: 2px;
}

.log-ts {
    color: #888;
    margin-right: 5px;
}

.log-error {
    color: #ff5252;
}

.log-success {
    color: #69f0ae;
}

.log-warn {
    color: #ffd740;
}

.log-info {
    color: #40c4ff;
}

/* --- Rich Dropdown --- */
.rich-dropdown {
    position: relative;
    width: 100%;
    /* min-width: 250px; Remove fixed min-width to allow flex */
    min-width: 120px;
    /* Sensible minimum, but allow shrinking via flex if needed */
    flex-shrink: 0;
    font-family: 'Inter', sans-serif;
    user-select: none;
}

.rich-dropdown-trigger {
    background-color: var(--bg-dark);
    /* Match input background */
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 8px 12px;
    /* Match standard inputs padding */
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s;
    min-height: 38px;
    /* Approximate height of standard inputs */
    box-sizing: border-box;
    color: var(--text-primary);
}

.rich-dropdown-trigger:hover {
    border-color: var(--accent-blue);
    background-color: #2a2a2a;
}

.rich-dropdown.open .rich-dropdown-trigger {
    border-color: var(--accent-blue);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.rich-dropdown-label {
    color: var(--text-primary);
    font-size: 0.875rem;
    /* Match standard font size */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rich-dropdown-arrow {
    color: var(--text-secondary);
    font-size: 0.8em;
    margin-left: 10px;
}

.rich-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-top: none;
    border-bottom-left-radius: 6px;
    border-bottom-right-radius: 6px;
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.rich-dropdown-list {
    display: flex;
    flex-direction: column;
}

.rich-dropdown-item {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background-color 0.1s;
    display: flex;
    flex-direction: row;
    /* Ensure Side-by-Side */
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.rich-dropdown-item:last-child {
    border-bottom: none;
}

.rich-dropdown-item:hover {
    background-color: #2a2a2a;
}

.rich-dropdown-item.selected {
    background-color: rgba(59, 130, 246, 0.1);
    /* accent-blue low opacity */
    border-left: 3px solid var(--accent-blue);
}

.rich-dropdown-item-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.rich-dropdown-item-main {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.9em;
}

.rich-dropdown-item-meta {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

.badge {
    font-size: 0.7em;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-codec {
    background-color: rgba(59, 130, 246, 0.2);
    /* accent-blue */
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge-info {
    background-color: rgba(16, 185, 129, 0.2);
    /* accent-green */
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

/* --- Modals --- */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.2s ease-in-out;
}

.modal {
    background-color: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    width: 400px;
    max-width: 90%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
}

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

.modal-header h3 {
    margin: 0;
    font-size: 1.1em;
    color: var(--text-primary);
}

.close-modal {
    background: transparent !important;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5em;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    width: auto !important;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-modal:hover {
    color: var(--text-primary);
    background: transparent !important;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.rich-dropdown-item-actions {
    display: none;
    /* Hide by default */
    flex-shrink: 0;
}

.rich-dropdown-item:hover .rich-dropdown-item-actions {
    display: block;
}

.rich-dropdown-delete-btn {
    font-size: 1.0em;
    opacity: 0.7;
    transition: opacity 0.2s, transform 0.2s;
    padding: 6px;
    border-radius: 4px;
    color: var(--accent-red);
}

.rich-dropdown-delete-btn:hover {
    opacity: 1;
    background: rgba(239, 68, 68, 0.1);
    transform: scale(1.1);
}

/* Base Bottom Nav Hidden on Desktop */
.bottom-nav {
    display: none;
}

/* Mobile Responsive Adjustments */
@media (max-width: 768px) {

    /* Layout */
    .app-container {
        /* Sidebar will be absolute, so main can take full width */
    }

    .main-content {
        /* Add padding for bottom nav */
        padding-bottom: 60px;
        width: 100vw;
        box-sizing: border-box;
        /* Ensure padding is inside height */
    }

    /* Sidebar - Hidden by default, overlay when active */
    .sidebar {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: calc(100% - 60px);
        /* Leave space for bottom nav */
        z-index: 2000;
        border-right: none;
        box-sizing: border-box;
        /* Includes padding in width */
        overflow-y: auto;
    }

    .sidebar.mobile-active {
        display: flex;
    }

    /* Bottom Navigation Bar */
    .bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 60px;
        background-color: var(--bg-panel);
        border-top: 1px solid var(--border-color);
        z-index: 3000;
        padding: 0;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
    }

    .nav-item {
        flex: 1;
        height: 100%;
        background: transparent;
        border: none;
        color: var(--text-secondary);
        font-size: 0.8rem;
        cursor: pointer;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        padding: 5px;
        border-radius: 0;
    }

    .nav-item.active {
        color: var(--text-primary);
        background-color: rgba(255, 255, 255, 0.1);
        border-top: 2px solid var(--accent-blue);
    }

    .nav-group {
        display: flex;
        flex: 3;
        /* Take remaining space */
        height: 100%;
    }

    /* View Specific Mobile Layouts */

    /* Terminal View */
    #terminal-view.active {
        display: block !important;
        /* Override grid */
        height: 100%;
    }

    .terminal-wrapper {
        height: 100%;
        display: none;
        /* Hide all wrappers initially */
    }

    .terminal-wrapper.mobile-active {
        display: flex;
        /* Flex column as defined in standard css */
    }

    /* Data View */
    #data-view.active {
        display: block !important;
        /* Override flex row/column logic if needed, but standard is flex row */
        /* Actually standard was display:flex (row). Flex-direction logic for mobile: */
        flex-direction: column;
    }

    .map-container,
    .stats-container {
        display: none;
        width: 100%;
        height: 100%;
    }

    .map-container.mobile-active,
    .stats-container.mobile-active {
        display: flex;
        /* Restore flex display */
    }

    /* Ensure ChartJS canvases fit */
    .chart-wrapper {
        flex: 1;
        height: 50%;
        /* If showing both stacks? No, we show one at a time */
    }

    .stats-container.mobile-active {
        flex-direction: column;
        /* Charts stacked vertically */
    }

    /* Audio Analysis View */
    #audio-analysis-view {
        /* Standard was flex row. Force block or column? */
        flex-direction: column;
    }

    #audio-analysis-view>div {
        /* Direct children (Left controls, Right FFT) */
        display: none !important;
        width: 100%;
        height: 100%;
        border-right: none;
    }

    #audio-analysis-view>div.mobile-active {
        display: flex !important;
    }

    /* Benchmark View */
    #benchmark-view {
        /* Usually just one panel, so no sub-tabs needed explicitly, but consistency is good */
        /* It is display:flex column already. */
    }

    /* Hide scrollbars on main to prevent double scrolling with panels */
    .main-content {
        overflow: hidden;
    }

    /* Ensure Panels trigger internal scrolling */
    .view-container {
        overflow-y: auto;
    }

    #audio-tracks-scroll-wrapper {
        padding-bottom: 80px !important;
        /* Force space for bottom nav */
    }



    /* Mobile Benchmark Layout */
    .benchmark-controls-wrapper {
        flex-direction: column !important;
        /* Force column stack */
        align-items: stretch !important;
        gap: 15px !important;
        height: auto !important;
        /* Allow growing */
        padding: 15px !important;
    }

    .benchmark-inputs-group {
        flex-direction: column !important;
        gap: 10px !important;
    }

    .benchmark-input-item {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        /* Prevent wrapping */
        align-items: center !important;
        width: 100% !important;
    }

    .benchmark-input-item label {
        min-width: 60px;
        flex-shrink: 0;
        /* Keep label size */
    }

    .benchmark-input-item input,
    .benchmark-input-item select {
        flex: 1;
        min-width: 0;
        /* Allow shrinking if needed */
    }

    .benchmark-input-item span {
        flex-shrink: 0;
        /* Keep unit size */
        margin-left: 8px;
    }

    .benchmark-divider {
        display: none !important;
        /* Hide vertical separator on mobile */
    }

    .benchmark-run-btn {
        width: 100% !important;
        /* Full width button */
        margin-top: 10px;
        padding: 10px !important;
    }

    /* Mobile Data View Layout */
    .data-view-controls {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 10px !important;
        height: auto !important;
    }

    .data-layer-select {
        width: 100% !important;
        margin-bottom: 5px !important;
    }

    .data-view-buttons {
        display: flex;
        gap: 10px;
        width: 100%;
        margin-left: 0 !important;
        /* Reset any margin */
    }

    .data-view-buttons button {
        flex: 1;
        /* Distribute space */
        white-space: normal !important;
        /* Allow text wrap if needed */
        font-size: 0.8em;
        padding: 8px 4px;
        /* Tighter padding */
    }

    /* Mobile Top Bar Optimization */
    .view-tab-btn {
        padding: 0 5px;
        /* Reduce padding significantly */
        font-size: 0.75rem;
        /* Reduce font size */
        white-space: normal;
        /* Allow wrapping of text e.g. "Terminal Console" -> "Terminal\nConsole" if really needed, or just shrink */
        line-height: 1.1;
        /* Tighter lines if wrap */
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;
    }

    .rich-dropdown {
        /* Ensure dropdown doesn't take too much space but stays usable */
        min-width: 0 !important;
        /* Allow shrinking */
        width: auto;
    }

    .rich-dropdown-trigger {
        padding: 4px 8px;
        /* Reduce trigger padding */
    }

    .rich-dropdown-label {
        font-size: 0.75rem;
    }
}

/* Benchmark Desktop Styles (outside media query) */
.benchmark-controls-wrapper {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    width: 100%;
    box-sizing: border-box;
}

.benchmark-inputs-group {
    display: flex;
    align-items: center;
    gap: 20px;
    flex: 1;
}

.benchmark-input-item {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.benchmark-input-item label {
    color: var(--text-secondary);
    font-size: 0.9em;
    margin: 0;
    white-space: nowrap;
}

.benchmark-input-item input,
.benchmark-input-item select {
    flex: 1;
    min-width: 60px;
    margin: 0;
    height: 40px;
    box-sizing: border-box;
    /* Reset generic input margins if any */
    margin-bottom: 0 !important;
}

.benchmark-input-item span {
    color: var(--text-secondary);
    font-size: 0.9em;
}

.benchmark-divider {
    width: 1px;
    height: 40px;
    background-color: var(--border-color);
    flex-shrink: 0;
}

.benchmark-run-btn {
    margin: 0;
    width: auto;
    height: 40px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 30px;
    white-space: nowrap;
}

/* Data View Desktop Styles */
.data-view-controls {
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--surface-color, #1e293b);
    display: flex;
    gap: 10px;
    align-items: center;
}

.data-layer-select {
    flex: 1;
    margin-bottom: 0;
}

.data-view-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
    flex: 2;
    /* Take substantial space */
}

.data-view-buttons button {
    white-space: nowrap;
    width: auto;
}

/* Generic Upward Opening Class (Global) */
.rich-dropdown.open-up .rich-dropdown-menu {
    top: auto !important;
    bottom: 100% !important;
    border-top: 1px solid var(--border-color) !important;
    border-bottom: none !important;
    border-radius: 6px 6px 0 0 !important;
    box-shadow: 0 -4px 6px rgba(0, 0, 0, 0.3) !important;
}