/* Mooshimeter Desktop - Dark theme */

:root {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-card: #1e2a47;
    --bg-input: #0f1729;
    --border: #2a3a5c;
    --text: #e0e0e0;
    --text-dim: #8899aa;
    --accent: #3d6aff;
    --accent-hover: #5580ff;
    --ch1-color: #ff4444;
    --ch2-color: #44cc44;
    --success: #44cc44;
    --warning: #ffaa00;
    --error: #ff4444;
    --radius: 6px;
    --panel-left-width: 340px;
}

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

body {
    font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

/* === Header (combined) === */

.header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 6px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.header h1 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
}
.header h1 span { color: var(--accent); }

.header-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.header-divider {
    width: 1px;
    height: 20px;
    background: rgba(255,255,255,0.15);
    margin: 0 2px;
}

.header-icon-btn {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.8);
    width: 30px;
    height: 28px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.header-icon-btn:hover {
    background: rgba(255,255,255,0.2);
    color: #fff;
}

.header-status {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-left: auto;
}

/* Connection dot */
.conn-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-dim);
    flex-shrink: 0;
    transition: background 0.3s;
}
.conn-dot.connecting {
    background: var(--warning);
    animation: conn-pulse 1.2s ease-in-out infinite;
}
.conn-dot.connected {
    background: var(--success);
    animation: conn-glow 3s ease-in-out infinite;
}
.conn-dot.error { background: var(--error); }

@keyframes conn-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255,170,0,0.5); }
    50%      { box-shadow: 0 0 0 5px rgba(255,170,0,0); }
}
@keyframes conn-glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(68,204,68,0.3); }
    50%      { box-shadow: 0 0 0 4px rgba(68,204,68,0); }
}

.status-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(255,255,255,0.06);
    color: var(--text-dim);
    white-space: nowrap;
}
.status-badge strong { color: var(--text); }

#status-text {
    font-size: 11px;
    color: var(--text-dim);
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
#status-text.status-error { color: var(--error); }
#status-text.status-info { color: var(--text-dim); }

/* === Main two-panel layout === */

.main {
    display: flex;
    padding: 10px;
    height: calc(100vh - 62px);  /* header ~34px + status bar ~28px */
    min-height: 400px;
}

/* === Left controls panel === */

.panel-left {
    width: var(--panel-left-width);
    min-width: 250px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
    padding-right: 4px;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
.panel-left::-webkit-scrollbar { width: 5px; }
.panel-left::-webkit-scrollbar-track { background: transparent; }
.panel-left::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* Resize handle */
.panel-resize-handle {
    width: 5px;
    cursor: col-resize;
    background: transparent;
    flex-shrink: 0;
    z-index: 5;
    border-radius: 2px;
    transition: background 0.15s;
}
.panel-resize-handle:hover,
.panel-resize-handle.dragging {
    background: var(--accent);
    opacity: 0.5;
}
body.panel-resizing {
    cursor: col-resize !important;
    user-select: none !important;
}

/* === Right stacked panel (graph + table) === */

.panel-right {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    padding-left: 4px;
    --pane-split: 55%;
}

.pane {
    display: flex;
    flex-direction: column;
    min-height: 120px;
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.pane-graph { height: var(--pane-split); flex-shrink: 0; }
.pane-table { flex: 1; }

/* When swapped, table gets the fixed height and graph gets flex */
.panel-right.panes-swapped .pane-table { height: var(--pane-split); flex: none; flex-shrink: 0; }
.panel-right.panes-swapped .pane-graph { height: auto; flex: 1; }

.pane-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    flex-shrink: 0;
}
.pane-title {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-dim);
    font-weight: 600;
    white-space: nowrap;
    margin-right: 4px;
}
.pane-title i { margin-right: 3px; }

/* Pane vertical divider / resize handle */
.pane-divider {
    height: 7px;
    cursor: row-resize;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
    z-index: 5;
    transition: background 0.15s;
}
.pane-divider:hover,
.pane-divider.dragging {
    background: rgba(61,106,255,0.1);
}
body.pane-resizing {
    cursor: row-resize !important;
    user-select: none !important;
}

.pane-swap-btn {
    position: absolute;
    right: 12px;
    width: 22px;
    height: 16px;
    padding: 0;
    font-size: 10px;
    border-radius: 3px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-dim);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s, border-color 0.15s;
    z-index: 6;
}
.pane-swap-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--bg-card);
}

/* === Cards === */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 10px;
}

.card-title {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-dim);
    margin-bottom: 4px;
    font-weight: 600;
}

/* === Collapsible accordion === */

.card[data-collapsible] > .card-title {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0;
    padding: 2px 0;
    user-select: none;
    border-radius: 3px;
}
.card[data-collapsible] > .card-title:hover {
    background: rgba(255,255,255,0.04);
    margin: 0 -4px;
    padding: 2px 4px;
}

.collapse-icon {
    display: inline-block;
    width: 0; height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid var(--text-dim);
    transition: transform 0.2s ease;
    margin-left: 6px;
}

.card[data-collapsible].collapsed .collapse-icon {
    transform: rotate(-90deg);
}

.card-body {
    overflow: hidden;
    transition: max-height 0.25s ease, opacity 0.2s ease;
    max-height: 500px;
    opacity: 1;
}

.card[data-collapsible].collapsed .card-body {
    max-height: 0;
    opacity: 0;
    pointer-events: none;
}

.card[data-collapsible]:not(.collapsed) > .card-title {
    margin-bottom: 4px;
}

/* === Channel cards === */

.channel-card { position: relative; }
.channel-card.ch1 { border-left: 3px solid var(--ch1-color); }
.channel-card.ch2 { border-left: 3px solid var(--ch2-color); }
.channel-card.math { border-left: 3px solid var(--accent); }

.channel-value {
    font-family: "Consolas", "Cascadia Code", "JetBrains Mono", monospace;
    font-size: 28px;
    font-weight: 700;
    text-align: right;
    padding: 4px 4px 0;
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    letter-spacing: -0.5px;
    word-break: break-all;
    transition: filter 0.05s;
}

.ch1 .channel-value { color: var(--ch1-color); }
.ch2 .channel-value { color: var(--ch2-color); }
.math .channel-value { color: var(--accent); }

/* Value flash animation */
@keyframes value-flash {
    0%   { filter: brightness(1.5); }
    100% { filter: brightness(1); }
}
.channel-value.flash {
    animation: value-flash 0.3s ease-out;
}

/* Min / Max / Avg stats */
.channel-stats {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding: 1px 4px 3px;
    font-family: "Consolas", "Cascadia Code", "JetBrains Mono", monospace;
    font-size: 10px;
    color: var(--text-dim);
}
.stat { display: flex; gap: 3px; align-items: baseline; }
.stat-label { text-transform: uppercase; letter-spacing: 0.5px; font-size: 9px; opacity: 0.5; }
.stat-val { color: var(--text); font-variant-numeric: tabular-nums; }

.channel-controls {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
    padding-top: 4px;
    border-top: 1px solid rgba(255,255,255,0.06);
}

.control-group {
    display: flex;
    align-items: center;
    gap: 3px;
}
.control-group label {
    font-size: 10px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.control-section {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

/* === Graph card === */

#graph-container {
    flex: 1;
    min-height: 0;
    position: relative;
    overflow: hidden;
}

#table-container {
    flex: 1;
    min-height: 0;
}

/* uPlot overrides */
.graph-pane .uplot { position: absolute; top: 0; left: 0; }
.u-legend { font-size: 11px !important; }
.u-legend th { color: var(--text-dim) !important; font-weight: normal !important; }
.u-legend td { color: var(--text) !important; }

.graph-split-wrap { display: flex; width: 100%; height: 100%; }
.graph-pane { position: relative; overflow: hidden; }

/* === Form elements (enhanced) === */

select, button {
    font-family: inherit;
    font-size: 12px;
    border-radius: 4px;
    border: 1px solid var(--border);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

select {
    background: var(--bg-input);
    color: var(--text);
    padding: 4px 22px 4px 6px;
    cursor: pointer;
    min-width: 70px;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%238899aa' stroke-width='1.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 6px center;
    background-size: 10px;
}
select:hover { border-color: var(--accent); }
select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(61,106,255,0.2);
}
select:disabled { opacity: 0.4; cursor: not-allowed; }

button {
    background: var(--bg-input);
    color: var(--text);
    padding: 4px 10px;
    cursor: pointer;
    font-weight: 500;
    white-space: nowrap;
}
button:hover:not(:disabled) {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
button:focus-visible {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(61,106,255,0.25);
}
button:disabled { opacity: 0.35; cursor: not-allowed; }

button.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
button.primary:hover:not(:disabled) { background: var(--accent-hover); }

button.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

button.danger:hover:not(:disabled) {
    background: var(--error);
    border-color: var(--error);
}

button.small {
    padding: 3px 8px;
    font-size: 11px;
}

/* Hold button active state */
#btn-hold.active {
    background: var(--warning);
    border-color: var(--warning);
    color: #000;
}

/* Continuity beep button */
#btn-continuity.active {
    background: var(--warning);
    border-color: var(--warning);
    color: #000;
}

/* (view toggle removed — graph and table are always visible) */

/* === AG Grid data table === */

#table-container {
    font-family: "Consolas", "Cascadia Code", "JetBrains Mono", monospace;
    font-size: 12px;
    overflow: hidden;
}

.ag-ch1-cell { color: var(--ch1-color) !important; }
.ag-ch2-cell { color: var(--ch2-color) !important; }
.ag-row-number { color: var(--text-dim) !important; font-variant-numeric: tabular-nums; }

/* === Custom tooltips === */

.custom-tooltip {
    position: fixed;
    z-index: 300;
    background: #151a30;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 5px 10px;
    font-size: 12px;
    max-width: 320px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.1s ease;
    box-shadow: 0 4px 16px rgba(0,0,0,0.5);
    line-height: 1.4;
}
.custom-tooltip.visible { opacity: 1; }

/* === Toast notifications === */

.toast-container {
    position: fixed;
    bottom: 40px;
    right: 16px;
    display: flex;
    flex-direction: column-reverse;
    gap: 6px;
    z-index: 200;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: 4px;
    padding: 8px 14px;
    font-size: 13px;
    min-width: 200px;
    max-width: 400px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    cursor: pointer;
    transform: translateX(calc(100% + 20px));
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}
.toast.show {
    transform: translateX(0);
    opacity: 1;
}
.toast.hide {
    transform: translateX(calc(100% + 20px));
    opacity: 0;
}
.toast-success { border-left-color: var(--success); }
.toast-warning { border-left-color: var(--warning); }
.toast-error   { border-left-color: var(--error); }

/* === Sessions modal === */

.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}
.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    min-width: 500px;
    max-width: 700px;
    max-height: 80vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
.modal-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.sessions-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.sessions-table th {
    text-align: left;
    padding: 6px 8px;
    border-bottom: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.sessions-table td {
    padding: 6px 8px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.sessions-table tr:hover td { background: rgba(255,255,255,0.03); }
.sessions-table td:last-child { white-space: nowrap; display: flex; gap: 4px; }

/* === Welcome dialog === */

.welcome-dialog {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0;
    width: 520px;
    max-width: 90vw;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 16px 48px rgba(0,0,0,0.6);
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
    animation: welcome-in 0.3s ease;
}

@keyframes welcome-in {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.welcome-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 24px 0;
}
.welcome-icon {
    font-size: 28px;
    filter: drop-shadow(0 0 8px rgba(61,106,255,0.5));
}
.welcome-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.3px;
}
.welcome-subtitle {
    font-size: 13px;
    color: var(--text-dim);
    padding: 4px 24px 16px;
    border-bottom: 1px solid var(--border);
}

.welcome-body {
    padding: 16px 24px;
}
.welcome-section {
    margin-bottom: 14px;
}
.welcome-section h3 {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--accent);
    margin-bottom: 6px;
    font-weight: 600;
}
.welcome-section p {
    font-size: 13px;
    line-height: 1.6;
    color: var(--text);
}
.welcome-section ul,
.welcome-section ol {
    font-size: 13px;
    line-height: 1.7;
    color: var(--text);
    padding-left: 18px;
}
.welcome-section li {
    margin-bottom: 2px;
}
.welcome-section li strong {
    color: var(--text);
}

.welcome-hint {
    background: rgba(61,106,255,0.08);
    border: 1px solid rgba(61,106,255,0.15);
    border-radius: 5px;
    padding: 8px 12px;
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 4px;
}
.welcome-hint kbd {
    background: rgba(255,255,255,0.08);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 0 4px;
    font-family: inherit;
    font-size: 11px;
}

.welcome-support {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    border-top: 1px solid var(--border);
    background: rgba(255,202,40,0.04);
}
.bmc-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: #ffca28;
    color: #1a1a2e;
    font-size: 13px;
    font-weight: 600;
    border-radius: 5px;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s, transform 0.15s;
}
.bmc-link:hover {
    background: #ffd54f;
    transform: translateY(-1px);
}
.bmc-icon {
    font-size: 16px;
}
.welcome-support-text {
    font-size: 12px;
    color: var(--text-dim);
}

.welcome-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    border-top: 1px solid var(--border);
}
.welcome-session-note {
    font-size: 11px;
    color: var(--text-dim);
    font-style: italic;
}

/* === Status bar === */

.status-bar {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    padding: 4px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 11px;
    color: var(--text-dim);
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 10;
}

.shortcut-hint kbd {
    background: rgba(255,255,255,0.08);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 0 4px;
    font-family: inherit;
    font-size: 10px;
}

/* === Light theme (Office-inspired) === */

body.theme-light {
    --bg-primary: #f3f3f3;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-input: #f7f7f7;
    --border: #d1d1d1;
    --text: #1a1a1a;
    --text-dim: #616161;
    --accent: #2b579a;
    --accent-hover: #3567b0;
    --ch1-color: #c03030;
    --ch2-color: #1a7a1a;
    --success: #107c10;
    --warning: #ca5010;
    --error: #d13438;
}

/* Header - Office ribbon-style top bar */
body.theme-light .header {
    background: #2b579a;
    border-bottom: none;
}
body.theme-light .header h1 { color: #fff; }
body.theme-light .header h1 span { color: #fff; }
body.theme-light .header-actions button {
    background: rgba(255,255,255,0.15);
    border-color: rgba(255,255,255,0.25);
    color: #fff;
}
body.theme-light .header-actions button:hover:not(:disabled) {
    background: rgba(255,255,255,0.3);
    border-color: rgba(255,255,255,0.4);
    color: #fff;
}
body.theme-light .header-actions button.primary {
    background: #fff;
    border-color: #fff;
    color: #2b579a;
}
body.theme-light .header-actions button.primary:hover:not(:disabled) {
    background: #e6ecf5;
}
body.theme-light .header-divider { background: rgba(255,255,255,0.25); }
body.theme-light .header-icon-btn {
    background: rgba(255,255,255,0.15);
    border-color: rgba(255,255,255,0.25);
    color: rgba(255,255,255,0.85);
}
body.theme-light .header-icon-btn:hover {
    background: rgba(255,255,255,0.3);
    color: #fff;
}

body.theme-light .status-badge {
    background: rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.8);
}
body.theme-light .status-badge strong { color: #fff; }
body.theme-light .conn-dot { background: rgba(255,255,255,0.4); }
body.theme-light .conn-dot.connected { background: #92e092; }
body.theme-light .conn-dot.connecting { background: #ffca80; }
body.theme-light .conn-dot.error { background: #ff8080; }
body.theme-light #status-text { color: rgba(255,255,255,0.7); }
body.theme-light #status-text.status-error { color: #ffb0b0; }

/* Cards - clean white with subtle shadow */
body.theme-light .card {
    border-color: #e0e0e0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
body.theme-light .channel-card.ch1 { border-left-color: var(--ch1-color); }
body.theme-light .channel-card.ch2 { border-left-color: var(--ch2-color); }
body.theme-light .channel-card.math { border-left-color: var(--accent); }

/* Controls */
body.theme-light .channel-controls {
    border-top-color: #e8e8e8;
}
body.theme-light .card[data-collapsible] > .card-title:hover {
    background: rgba(0,0,0,0.04);
}

/* Form elements - Office style */
body.theme-light select {
    background-color: #fff;
    border-color: #b0b0b0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23616161' stroke-width='1.5'/%3E%3C/svg%3E");
}
body.theme-light select:hover { border-color: #2b579a; }
body.theme-light select:focus {
    border-color: #2b579a;
    box-shadow: 0 0 0 2px rgba(43,87,154,0.15);
}

body.theme-light button {
    background: #f0f0f0;
    border-color: #b0b0b0;
    color: var(--text);
}
body.theme-light button:hover:not(:disabled) {
    background: #2b579a;
    border-color: #2b579a;
    color: #fff;
}
body.theme-light button:focus-visible {
    box-shadow: 0 0 0 2px rgba(43,87,154,0.2);
}
body.theme-light button.primary {
    background: #2b579a;
    border-color: #2b579a;
    color: #fff;
}
body.theme-light button.primary:hover:not(:disabled) {
    background: #3567b0;
}
body.theme-light button.active {
    background: #2b579a;
    border-color: #2b579a;
    color: #fff;
}
body.theme-light #btn-hold.active {
    background: var(--warning);
    border-color: var(--warning);
    color: #fff;
}
body.theme-light #btn-continuity.active {
    background: var(--warning);
    border-color: var(--warning);
    color: #fff;
}
body.theme-light button.danger:hover:not(:disabled) {
    background: var(--error);
    border-color: var(--error);
    color: #fff;
}

/* Pane divider */
body.theme-light .pane-divider:hover,
body.theme-light .pane-divider.dragging {
    background: rgba(43,87,154,0.08);
}
body.theme-light .pane-swap-btn {
    background: #fff;
    border-color: #c0c0c0;
}
body.theme-light .pane-swap-btn:hover {
    color: #2b579a;
    border-color: #2b579a;
    background: #fff;
}

/* Resize handle */
body.theme-light .panel-resize-handle:hover,
body.theme-light .panel-resize-handle.dragging {
    background: #2b579a;
}

/* Scrollbar */
body.theme-light .panel-left { scrollbar-color: #c0c0c0 transparent; }

/* Tooltips */
body.theme-light .custom-tooltip {
    background: #fff;
    border-color: #c0c0c0;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

/* Toasts */
body.theme-light .toast {
    background: #fff;
    border-color: #d0d0d0;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

/* Modal */
body.theme-light .modal-overlay { background: rgba(0,0,0,0.35); }
body.theme-light .modal-content {
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}
body.theme-light .sessions-table th { border-bottom-color: #d0d0d0; }
body.theme-light .sessions-table td { border-bottom-color: #f0f0f0; }
body.theme-light .sessions-table tr:hover td { background: rgba(43,87,154,0.04); }

/* Welcome dialog */
body.theme-light .welcome-dialog {
    box-shadow: 0 16px 48px rgba(0,0,0,0.15);
}
body.theme-light .welcome-icon {
    filter: drop-shadow(0 0 8px rgba(43,87,154,0.3));
}
body.theme-light .welcome-hint {
    background: rgba(43,87,154,0.06);
    border-color: rgba(43,87,154,0.12);
}
body.theme-light .welcome-hint kbd {
    background: rgba(0,0,0,0.05);
    border-color: #d0d0d0;
}
body.theme-light .welcome-support {
    background: rgba(255,202,40,0.08);
    border-top-color: #e0e0e0;
}
body.theme-light .bmc-link {
    color: #333;
}

/* Status bar */
body.theme-light .status-bar {
    background: #f0f0f0;
    border-top-color: #d0d0d0;
}
body.theme-light .shortcut-hint kbd {
    background: rgba(0,0,0,0.05);
    border-color: #c0c0c0;
}

/* uPlot overrides for light theme */
body.theme-light .u-legend th { color: var(--text-dim) !important; }
body.theme-light .u-legend td { color: var(--text) !important; }

/* === Responsive === */

@media (max-width: 900px) {
    .main {
        flex-direction: column;
        height: auto;
    }
    .panel-left {
        width: 100% !important;
        min-width: 0;
        overflow-y: visible;
    }
    .panel-resize-handle { display: none; }
    .panel-right { min-height: 500px; }
    .pane-graph { height: 50% !important; }
    .channel-value { font-size: 24px; min-height: 36px; }
}

@media (max-width: 600px) {
    .header { flex-direction: column; align-items: flex-start; }
    .header-status { margin-left: 0; }
    .channel-value { font-size: 20px; }
    .modal-content { min-width: auto; margin: 16px; }
    .pane-toolbar { font-size: 10px; }
}
