h1:focus {
    outline: none;
}

html,
body,
#app {
    height: 100%;
    margin: 0;
    overflow: hidden;
}

/* CrystalFX checkbox (used where MudCheckBox renders poorly in WebView) */
.cfx-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    user-select: none;
}

.cfx-check-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.cfx-check-box {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    border: 1px solid rgba(255, 136, 0, 0.35);
    background: rgba(0, 0, 0, 0.25);
    box-shadow: inset 0 1px 0 rgba(255, 136, 0, 0.08);
    display: inline-grid;
    place-items: center;
}

.cfx-check-input:focus-visible + .cfx-check-box {
    outline: 2px solid rgba(255, 149, 0, 0.45);
    outline-offset: 2px;
}

.cfx-check-input:checked + .cfx-check-box {
    border-color: rgba(255, 149, 0, 0.75);
    background: rgba(255, 136, 0, 0.18);
}

.cfx-check-input:checked + .cfx-check-box::after {
    content: "";
    width: 8px;
    height: 8px;
    background: linear-gradient(180deg, rgba(255,149,0,0.95), rgba(255,122,0,0.95));
    border-radius: 2px;
    box-shadow: 0 0 10px rgba(255, 136, 0, 0.25);
}

.cfx-check-label {
    color: var(--cfx-text);
    font-size: 0.9rem;
    line-height: 1;
}

.cfx-remote-connection {
    padding-bottom: 8px;
}

.cfx-remote-connection-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: center;
    margin-bottom: 8px;
}

.cfx-remote-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border: 1px solid rgba(255, 136, 0, 0.18);
    background: rgba(0, 0, 0, 0.18);
    border-radius: 6px;
    white-space: nowrap;
}

.cfx-remote-status-text {
    font-size: 0.78rem;
    color: var(--cfx-text-muted);
}

.cfx-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.6);
}

.cfx-dot-off {
    background: rgba(231, 237, 247, 0.25);
}

.cfx-dot-on {
    background: rgba(50, 210, 120, 0.9);
    box-shadow: 0 0 10px rgba(50, 210, 120, 0.35), 0 0 0 1px rgba(0,0,0,0.6);
}

.cfx-dot-disconnected {
    background: rgba(220, 53, 69, 0.9);
    box-shadow: 0 0 10px rgba(220, 53, 69, 0.35), 0 0 0 1px rgba(0,0,0,0.6);
}

.cfx-dot-connected {
    background: rgba(50, 210, 120, 0.9);
    box-shadow: 0 0 10px rgba(50, 210, 120, 0.35), 0 0 0 1px rgba(0,0,0,0.6);
}

.cfx-dot-connecting {
    background: rgba(255, 149, 0, 0.9);
    box-shadow: 0 0 10px rgba(255, 149, 0, 0.35), 0 0 0 1px rgba(0,0,0,0.6);
    animation: cfx-pulse 1.2s ease-in-out infinite;
}

@keyframes cfx-pulse {
    0%, 100% {
        opacity: 1;
        box-shadow: 0 0 10px rgba(255, 149, 0, 0.35), 0 0 0 1px rgba(0,0,0,0.6);
    }
    50% {
        opacity: 0.4;
        box-shadow: 0 0 4px rgba(255, 149, 0, 0.15), 0 0 0 1px rgba(0,0,0,0.6);
    }
}

.cfx-dock-buttons {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
}

.cfx-remote-command-grid .mud-button-root {
    border-color: rgba(255, 136, 0, 0.22);
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.18), rgba(20, 28, 38, 0.30));
    box-shadow: inset 0 1px 0 rgba(255, 136, 0, 0.06);
}

.cfx-remote-command-grid .mud-button-root:hover {
    border-color: rgba(255, 136, 0, 0.42);
    background: linear-gradient(180deg, rgba(255, 136, 0, 0.10), rgba(0, 0, 0, 0.18));
}

.cfx-remote-command-grid .mud-button-root .mud-icon-root {
    font-size: 18px;
    opacity: 0.9;
}

.cfx-remote-sd {
    margin-top: 12px;
    height: 34px;
    border-radius: 6px;
    text-transform: none;
    letter-spacing: 0.02em;
    box-shadow: 0 0 0 1px rgba(255, 136, 0, 0.25), 0 10px 22px rgba(0, 0, 0, 0.45);
}

.cfx-remote-sd .mud-icon-root {
    font-size: 20px;
}

.cfx-dock-btn {
    width: 22px;
    height: 22px;
    display: inline-grid;
    place-items: center;
    padding: 0;
    border-radius: 4px;
    border: 1px solid rgba(255, 136, 0, 0.20);
    background: rgba(0, 0, 0, 0.15);
    color: rgba(231, 237, 247, 0.85);
    cursor: pointer;
}

.cfx-dock-btn:hover {
    border-color: rgba(255, 136, 0, 0.40);
    background: rgba(255, 136, 0, 0.08);
    color: rgba(255, 149, 0, 0.95);
}

.cfx-dock-btn:focus-visible {
    outline: 2px solid rgba(255, 149, 0, 0.45);
    outline-offset: 1px;
}

.cfx-menu-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid rgba(255, 136, 0, 0.2);
    background: linear-gradient(135deg, transparent 0%, rgba(255, 255, 255, 0.03) 50%, transparent 100%),
                linear-gradient(180deg, rgba(12, 16, 22, 0.95), rgba(7, 10, 15, 0.95));
}

.cfx-config-editor {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 16px;
    background: rgba(10, 14, 20, 0.85);
    border: 1px solid rgba(255, 136, 0, 0.18);
    overflow: hidden;
}

.cfx-config-empty {
    flex: 1;
    display: grid;
    place-items: center;
    color: var(--cfx-text-muted);
    text-align: center;
}

.cfx-config-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}

.cfx-config-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cfx-config-search {
    width: 220px;
}

.cfx-config-body {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 16px;
    flex: 1;
    min-height: 0;
}

.cfx-config-tree {
    border: 1px solid rgba(255, 136, 0, 0.15);
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 10px;
    overflow: auto;
    min-height: 0;
}

.cfx-config-tree-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.cfx-config-tree-toggle {
    margin-right: 2px;
}

.cfx-config-tree-toggle-spacer {
    display: inline-block;
    width: 30px;
    margin-right: 2px;
    flex-shrink: 0;
}

.cfx-config-item {
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    color: var(--cfx-text);
}

.cfx-config-item:hover {
    background: rgba(255, 136, 0, 0.08);
}

.cfx-config-item.selected {
    background: rgba(255, 136, 0, 0.2);
    border: 1px solid rgba(255, 136, 0, 0.35);
}

.cfx-config-item-sub {
    margin-left: 10px;
    font-size: 0.88rem;
}

.cfx-config-list {
    overflow: auto;
    padding-right: 10px;
    min-height: 0;
}

.cfx-config-group {
    margin: 8px 0 4px;
    text-transform: uppercase;
    font-size: 0.78rem;
    color: var(--cfx-text-muted);
}

.cfx-config-row {
    display: grid;
    grid-template-columns: minmax(140px, 0.8fr) minmax(200px, 1.5fr);
    gap: 10px;
    align-items: center;
    padding: 6px 10px;
    border: 1px solid rgba(255, 136, 0, 0.12);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.18);
    margin-bottom: 4px;
}

.cfx-config-meta {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

/* Custom styled tooltip for parameter descriptions */
.cfx-tooltip-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: default;
}

.cfx-tooltip {
    visibility: hidden;
    opacity: 0;
    position: fixed;
    z-index: 9999;
    min-width: 220px;
    max-width: 420px;
    width: max-content;
    padding: 10px 14px;
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(30,24,14,0.97), rgba(18,16,12,0.97));
    border: 1px solid rgba(255, 149, 0, 0.35);
    box-shadow: 0 4px 24px rgba(0,0,0,0.55), 0 0 12px rgba(255,136,0,0.10);
    color: rgba(255, 200, 130, 0.95);
    font-size: 0.82rem;
    line-height: 1.45;
    letter-spacing: 0.01em;
    pointer-events: none;
    transition: opacity 0.18s ease, visibility 0.18s ease, transform 0.18s ease;
    transform: translateY(-4px);
}

.cfx-tooltip::before {
    content: "";
    position: absolute;
    bottom: 100%;
    left: 18px;
    border: 6px solid transparent;
    border-bottom-color: rgba(255, 149, 0, 0.35);
}

.cfx-tooltip.cfx-tooltip-visible {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
}

.cfx-config-control {
    display: grid;
    gap: 2px;
    min-width: 0;
}

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

.cfx-slider-row > :first-child {
    flex: 1;
    min-width: 0;
}

.cfx-slider-value {
    min-width: 44px;
    text-align: right;
    font-size: 0.8rem;
    color: var(--cfx-text-muted);
    white-space: nowrap;
}

/* Read CFX Data button
.cfx-read-btn {
    text-transform: none !important;
    letter-spacing: 0.04em;
    border-radius: 6px !important;
    height: 34px;
    background: linear-gradient(180deg, var(--cfx-accent-2) 0%, var(--cfx-accent) 100%) !important;
    color: #fff !important;
    box-shadow: 0 0 0 1px rgba(255, 136, 0, 0.35),
                0 8px 20px rgba(0, 0, 0, 0.45),
                0 0 16px rgba(255, 136, 0, 0.12);
    transition: box-shadow 0.25s ease, transform 0.15s ease;
}

.cfx-read-btn .mud-button-start-icon {
    margin-inline-end: 8px;
}

.cfx-read-btn:hover:not(.Mud-disabled):not(.mud-disabled) {
    box-shadow: 0 0 0 1px rgba(255, 149, 0, 0.55),
                0 12px 28px rgba(0, 0, 0, 0.5),
                0 0 28px rgba(255, 136, 0, 0.22);
    transform: translateY(-1px);
}

.cfx-read-btn:active:not(.Mud-disabled):not(.mud-disabled) {
    transform: translateY(0);
    box-shadow: 0 0 0 1px rgba(255, 136, 0, 0.35),
                0 4px 12px rgba(0, 0, 0, 0.45);
}

/* Reading / busy state – stays within the orange theme */
.cfx-read-busy {
    background: linear-gradient(180deg, rgba(255, 136, 0, 0.18), rgba(20, 14, 6, 0.9)) !important;
    border: 1px solid rgba(255, 136, 0, 0.45) !important;
    color: #fff !important;
    pointer-events: none;
    box-shadow: 0 0 0 1px rgba(255, 136, 0, 0.3),
                0 0 18px rgba(255, 136, 0, 0.10),
                0 8px 20px rgba(0, 0, 0, 0.45);
    animation: cfx-read-glow 1.8s ease-in-out infinite;
}

.cfx-read-busy .mud-button-label {
    color: #fff !important;
    animation: cfx-read-text-pulse 1.8s ease-in-out infinite;
}

.cfx-read-busy .mud-button-start-icon,
.cfx-read-busy .mud-button-icon-start,
.cfx-read-busy .mud-icon-root {
    color: #fff !important;
    animation: cfx-read-spin 1.2s linear infinite,
               cfx-read-text-pulse 1.8s ease-in-out infinite;
}

@keyframes cfx-read-glow {
    0%, 100% {
        box-shadow: 0 0 0 1px rgba(255, 136, 0, 0.3),
                    0 0 14px rgba(255, 136, 0, 0.08),
                    0 8px 20px rgba(0, 0, 0, 0.45);
        border-color: rgba(255, 136, 0, 0.35);
    }
    50% {
        box-shadow: 0 0 0 1px rgba(255, 149, 0, 0.65),
                    0 0 38px rgba(255, 136, 0, 0.30),
                    0 0 60px rgba(255, 122, 0, 0.12),
                    0 8px 20px rgba(0, 0, 0, 0.45);
        border-color: rgba(255, 149, 0, 0.6);
    }
}

@keyframes cfx-read-text-pulse {
    0%, 100% { opacity: 0.72; }
    50%      { opacity: 1; }
}

@keyframes cfx-read-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* Read-status container: label + progress bar */
.cfx-read-status {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-left: 12px;
    width: 240px;
    flex-shrink: 0;
    opacity: 0;
    transform: translateY(4px);
    pointer-events: none;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.cfx-read-status-visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.cfx-read-activity-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--cfx-text-muted);
    line-height: 1.2;
}

.cfx-read-progress {
    height: 3px !important;
    min-height: 3px !important;
    border-radius: 2px;
}

.cfx-read-progress .mud-progress-linear-bar {
    transition: width 0.35s ease;
}

h1:focus {
    outline: none;
}

:root {
    /* Crystal FX theme tokens (inspired by provided mobile screens) */
    --cfx-bg: #070a0f;
    --cfx-surface: #0d121a;
    --cfx-surface-2: #131a24;
    --cfx-border: rgba(255, 136, 0, 0.35);
    --cfx-border-strong: rgba(255, 136, 0, 0.65);
    --cfx-accent: #ff7a00;
    --cfx-accent-2: #ff9500;
    --cfx-text: #e7edf7;
    --cfx-text-muted: rgba(231, 237, 247, 0.72);
    --cfx-warning: #ffb300;
}

html, body {
    height: 100%;
}

/* Ensure consistent box sizing so padding/gaps don't accidentally cause overflow */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: radial-gradient(1100px 700px at 30% -10%, rgba(255, 122, 0, 0.18), transparent 60%),
                linear-gradient(180deg, #06080c 0%, #070a0f 40%, #06080c 100%);
    color: var(--cfx-text);
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}

.cfx-brand-logo {
    width: min(240px, 40vw);
    max-width: 100%;
    height: auto;
    margin-bottom: 10px;
    filter: drop-shadow(0 12px 26px rgba(0, 0, 0, 0.6));
}

/* MudTabs: make headers match Crystal FX theme (fix white header / grey text) */
.cfx-tabs,
.cfx-left-tabs {
    --cfx-tabs-bg: rgba(0, 0, 0, 0.18);
    --cfx-tabs-border: rgba(255, 136, 0, 0.18);
}

/* Compact variant for narrow panels (like left dock) */
.cfx-left-tabs .mud-tabs-tabbar,
.cfx-left-tabs .mud-tabbar {
    padding: 2px;
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
}

.cfx-left-tabs .mud-tab {
    flex: 1 1 0;
    min-width: 0;
    padding: 6px 8px;
}

.cfx-left-tabs .mud-tab .mud-tab-label,
.cfx-left-tabs .mud-tab .mud-button-label {
    font-size: 0.78rem;
    line-height: 1.1;
}

/* MudExpansionPanels: theme to match Crystal FX (combat default white backgrounds) */
.cfx-accordion,
.cfx-harmonica {
    --cfx-acc-bg: rgba(0, 0, 0, 0.18);
    --cfx-acc-border: rgba(255, 136, 0, 0.18);
}

/* MudBlazor renders expansion panels using `mud-expand-panel*` classes. */
.cfx-accordion .mud-expansion-panels,
.cfx-harmonica .mud-expansion-panels {
    background: transparent !important;
}

.cfx-accordion .mud-expand-panel,
.cfx-harmonica .mud-expand-panel {
    background-color: var(--cfx-acc-bg) !important;
    border: 1px solid var(--cfx-acc-border) !important;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: inset 0 1px 0 rgba(255, 136, 0, 0.06);
}

.cfx-accordion .mud-expand-panel-border,
.cfx-harmonica .mud-expand-panel-border {
    border-color: var(--cfx-acc-border) !important;
}

.cfx-accordion .mud-expand-panel + .mud-expand-panel,
.cfx-harmonica .mud-expand-panel + .mud-expand-panel {
    margin-top: 8px;
}

.cfx-accordion .mud-expand-panel-header,
.cfx-harmonica .mud-expand-panel-header {
    background: transparent !important;
    color: var(--cfx-text) !important;
}

.cfx-accordion .mud-expand-panel-header-gutters,
.cfx-harmonica .mud-expand-panel-header-gutters {
    padding: 8px 10px;
}

.cfx-accordion .mud-expand-panel-text,
.cfx-harmonica .mud-expand-panel-text {
    color: inherit !important;
    font-size: 0.86rem;
    letter-spacing: 0.02em;
}

.cfx-accordion .mud-expand-panel-header:hover,
.cfx-harmonica .mud-expand-panel-header:hover {
    background: rgba(255, 136, 0, 0.08) !important;
}

.cfx-accordion .mud-expand-panel-icon,
.cfx-harmonica .mud-expand-panel-icon {
    color: var(--cfx-text-muted) !important;
}

.cfx-accordion .mud-expand-panel-content,
.cfx-harmonica .mud-expand-panel-content {
    padding: 0 !important;
    background: transparent !important;
    color: var(--cfx-text) !important;
}

.cfx-accordion .mud-expansion-panels,
.cfx-harmonica .mud-expansion-panels {
    background: transparent !important;
}

.cfx-accordion .mud-expansion-panels-root,
.cfx-harmonica .mud-expansion-panels-root,
.cfx-accordion .mud-expansion-panels.mud-paper,
.cfx-harmonica .mud-expansion-panels.mud-paper,
.cfx-accordion .mud-expansion-panels .mud-paper,
.cfx-harmonica .mud-expansion-panels .mud-paper,
.cfx-accordion .mud-expansion-panels.mud-surface,
.cfx-harmonica .mud-expansion-panels.mud-surface,
.cfx-accordion .mud-expansion-panels .mud-surface,
.cfx-harmonica .mud-expansion-panels .mud-surface {
    background-color: transparent !important;
}

.cfx-accordion .mud-expansion-panel,
.cfx-harmonica .mud-expansion-panel {
    background: var(--cfx-acc-bg) !important;
    border: 1px solid var(--cfx-acc-border);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: inset 0 1px 0 rgba(255, 136, 0, 0.06);
}

/* Outlined expansion panels (default) can enforce a white background/border via pseudo elements. */
.cfx-accordion .mud-expansion-panel.outlined,
.cfx-harmonica .mud-expansion-panel.outlined,
.cfx-accordion .mud-expansion-panel-outlined,
.cfx-harmonica .mud-expansion-panel-outlined {
    background-color: var(--cfx-acc-bg) !important;
    border-color: var(--cfx-acc-border) !important;
}

.cfx-accordion .mud-expansion-panel.outlined::before,
.cfx-harmonica .mud-expansion-panel.outlined::before,
.cfx-accordion .mud-expansion-panel-outlined::before,
.cfx-harmonica .mud-expansion-panel-outlined::before {
    border-color: var(--cfx-acc-border) !important;
    background: transparent !important;
}

/* Some templates render the whole accordion inside a MudPaper surface (white by default). */
.cfx-accordion.mud-paper,
.cfx-harmonica.mud-paper,
.cfx-accordion .mud-paper,
.cfx-harmonica .mud-paper {
    background-color: var(--cfx-acc-bg) !important;
}

.cfx-accordion .mud-expansion-panel-header,
.cfx-harmonica .mud-expansion-panel-header {
    color: var(--cfx-text) !important;
}

/* Some MudBlazor versions wrap header/content with additional paper/surface elements. */
.cfx-accordion .mud-expansion-panel .mud-paper,
.cfx-harmonica .mud-expansion-panel .mud-paper,
.cfx-accordion .mud-expansion-panel .mud-surface,
.cfx-harmonica .mud-expansion-panel .mud-surface {
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.cfx-accordion .mud-expansion-panel + .mud-expansion-panel,
.cfx-harmonica .mud-expansion-panel + .mud-expansion-panel {
    margin-top: 8px;
}

.cfx-accordion .mud-expansion-panel-header,
.cfx-harmonica .mud-expansion-panel-header {
    padding: 8px 10px;
    background: transparent !important;
}

.cfx-accordion .mud-expansion-panel-header-content,
.cfx-harmonica .mud-expansion-panel-header-content {
    background: transparent !important;
}

.cfx-accordion .mud-expansion-panel-header .mud-typography,
.cfx-accordion .mud-expansion-panel-header .mud-expansion-panel-header-text,
.cfx-harmonica .mud-expansion-panel-header .mud-typography,
.cfx-harmonica .mud-expansion-panel-header .mud-expansion-panel-header-text {
    color: var(--cfx-text);
    font-size: 0.86rem;
    letter-spacing: 0.02em;
}

.cfx-accordion .mud-expansion-panel-header:hover,
.cfx-harmonica .mud-expansion-panel-header:hover {
    background: rgba(255, 136, 0, 0.08) !important;
}

.cfx-accordion .mud-expand-icon,
.cfx-harmonica .mud-expand-icon {
    color: var(--cfx-text-muted);
}

.cfx-accordion .mud-expanded .mud-expansion-panel-header,
.cfx-harmonica .mud-expanded .mud-expansion-panel-header,
.cfx-accordion .mud-panel-expanded .mud-expand-panel-header,
.cfx-harmonica .mud-panel-expanded .mud-expand-panel-header {
    border-bottom: 1px solid rgba(255, 136, 0, 0.14);
}

.cfx-accordion .mud-expanded .mud-expansion-panel-header .mud-typography,
.cfx-accordion .mud-expanded .mud-expansion-panel-header .mud-expansion-panel-header-text,
.cfx-harmonica .mud-expanded .mud-expansion-panel-header .mud-typography,
.cfx-harmonica .mud-expanded .mud-expansion-panel-header .mud-expansion-panel-header-text,
.cfx-accordion .mud-panel-expanded .mud-expand-panel-header .mud-typography,
.cfx-accordion .mud-panel-expanded .mud-expand-panel-header .mud-expand-panel-text,
.cfx-harmonica .mud-panel-expanded .mud-expand-panel-header .mud-typography,
.cfx-harmonica .mud-panel-expanded .mud-expand-panel-header .mud-expand-panel-text {
    color: var(--cfx-accent-2);
}

.cfx-accordion .mud-expansion-panel-content,
.cfx-harmonica .mud-expansion-panel-content {
    padding: 0 !important;
    background: transparent !important;
}

/* MudBlazor v8 applies padding via .mud-expansion-panel-gutters on the content div.
   Force it to zero so list items span the full panel width.               */
.cfx-harmonica .mud-expansion-panel-gutters,
.cfx-accordion .mud-expansion-panel-gutters {
    padding: 0 !important;
}

/* Force all MudBlazor collapse / content wrappers inside the harmonica to zero padding */
.cfx-harmonica .mud-collapse-wrapper,
.cfx-harmonica .mud-collapse-wrapper-inner,
.cfx-harmonica .mud-collapse-body,
.cfx-harmonica .mud-collapse-container,
.cfx-harmonica .mud-expand-panel-content > *,
.cfx-harmonica .mud-expansion-panel-content > * {
    padding: 0 !important;
}

/* ── Accordion-only scroll ─────────────────────────────────────────── */
/* All three panel headers stay visible at all times. Only the open
   panel's content area scrolls.

   Strategy
   --------
   The harmonica is a flex column inside the panel-body. Collapsed
   panels are flex-shrink:0 so they keep their header height. The
   expanded panel gets flex:1 so it fills the rest.

   We do NOT override MudBlazor's grid-based MudCollapse internals.
   Instead we make the harmonica a CSS *size container* and use
   container-query-height (cqh) to cap the content's max-height,
   subtracting the space reserved for the collapsed-panel headers.

   --cfx-panel-header-h : measured height of one header row (≈ 49px)
   --cfx-panel-gap      : margin between panels                       */

.cfx-harmonica {
    --cfx-panel-header-h: 51px;
    --cfx-panel-gap: 8px;

    flex: 1;
    min-height: 0;
    display: flex !important;
    flex-direction: column;
    overflow: hidden;

    /* make this element a size container for cqh units */
    container-type: size;
}

/* Every panel (collapsed or expanded) keeps its natural height. */
.cfx-harmonica .mud-expand-panel {
    flex: 0 0 auto;
}

/* The expanded panel fills remaining space. */
.cfx-harmonica .mud-expand-panel.mud-panel-expanded {
    flex: 1 1 0%;
    min-height: 0;
    overflow: hidden;
}

/* Cap the content area so the collapse container can never grow
   beyond the space the harmonica actually has.
   100cqh  = full harmonica height
   Subtract 3 headers + 2 inter-panel gaps.                         */
.cfx-harmonica .mud-panel-expanded .mud-expand-panel-content {
    overflow-y: auto;
    max-height: calc(
        100cqh
        - 3 * var(--cfx-panel-header-h)
        - 2 * var(--cfx-panel-gap)
    );
}

/* MudBlazor currently renders the header as a white tab bar; override it explicitly. */
.cfx-tabs .mud-tabs-tabbar,
.cfx-tabs .mud-tabbar,
.cfx-left-tabs .mud-tabs-tabbar,
.cfx-left-tabs .mud-tabbar {
    background-color: var(--cfx-tabs-bg) !important;
    border: 1px solid var(--cfx-tabs-border);
    border-radius: 10px;
    box-shadow: inset 0 1px 0 rgba(255, 136, 0, 0.06);
}

.cfx-tabs .mud-tab,
.cfx-left-tabs .mud-tab {
    background-color: transparent !important;
    text-transform: none;
    letter-spacing: 0.02em;
}

.cfx-tabs .mud-tab .mud-tab-label,
.cfx-tabs .mud-tab .mud-button-label,
.cfx-left-tabs .mud-tab .mud-tab-label,
.cfx-left-tabs .mud-tab .mud-button-label {
    color: var(--cfx-text-muted) !important;
}

.cfx-tabs .mud-tab:hover,
.cfx-left-tabs .mud-tab:hover {
    background-color: rgba(255, 136, 0, 0.08) !important;
}

.cfx-tabs .mud-tab:hover .mud-tab-label,
.cfx-tabs .mud-tab:hover .mud-button-label,
.cfx-left-tabs .mud-tab:hover .mud-tab-label,
.cfx-left-tabs .mud-tab:hover .mud-button-label {
    color: var(--cfx-text) !important;
}

.cfx-tabs .mud-tab.mud-tab-active .mud-tab-label,
.cfx-tabs .mud-tab.mud-tab-active .mud-button-label,
.cfx-left-tabs .mud-tab.mud-tab-active .mud-tab-label,
.cfx-left-tabs .mud-tab.mud-tab-active .mud-button-label {
    color: var(--cfx-accent-2) !important;
}

.cfx-tabs .mud-tab.mud-disabled .mud-tab-label,
.cfx-tabs .mud-tab.mud-tab-disabled .mud-tab-label,
.cfx-tabs .mud-tab.mud-disabled .mud-button-label,
.cfx-tabs .mud-tab.mud-tab-disabled .mud-button-label,
.cfx-left-tabs .mud-tab.mud-disabled .mud-tab-label,
.cfx-left-tabs .mud-tab.mud-tab-disabled .mud-tab-label,
.cfx-left-tabs .mud-tab.mud-disabled .mud-button-label,
.cfx-left-tabs .mud-tab.mud-tab-disabled .mud-button-label {
    color: rgba(231, 237, 247, 0.35) !important;
}

.cfx-tabs .mud-tab-slider,
.cfx-left-tabs .mud-tab-slider {
    background: linear-gradient(90deg, rgba(255,149,0,0.95), rgba(255,122,0,0.95));
    height: 2px;
    border-radius: 999px;
}

.cfx-tabs .mud-tab:focus-visible,
.cfx-left-tabs .mud-tab:focus-visible {
    outline: 2px solid rgba(255, 149, 0, 0.45);
    outline-offset: 2px;
}

/* App shell helpers */
.cfx-app {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.cfx-app .mud-layout {
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.cfx-fw-badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    padding: 2px 8px;
    border-radius: 4px;
    color: rgba(50, 210, 120, 0.95);
    background: rgba(50, 210, 120, 0.12);
    border: 1px solid rgba(50, 210, 120, 0.25);
    margin-left: 4px;
    white-space: nowrap;
    line-height: 1.4;
}

.cfx-section {
    color: var(--cfx-accent-2);
    letter-spacing: 0.12em;
    margin: 0.75rem 0.75rem 0.25rem;
}

.cfx-content {
    padding: 1rem 1.25rem;
}

.cfx-main {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    padding-top: 0 !important;
}

.cfx-content-full {
    flex: 1 1 0;
    display: flex;
    min-height: 0;
    box-sizing: border-box;
    padding: 12px;
}

.cfx-main-stack {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.cfx-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 12px 14px 14px;
    flex-shrink: 0;
}

.cfx-footer-card {
    display: inline-flex;
    align-items: center;
    gap: 16px;
    padding: 10px 18px;
    background: linear-gradient(135deg, 
        rgba(255, 136, 0, 0.08) 0%, 
        rgba(0, 0, 0, 0.25) 50%, 
        rgba(255, 136, 0, 0.06) 100%);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 136, 0, 0.25);
    border-radius: 12px;
    box-shadow: 
        0 0 0 1px rgba(255, 136, 0, 0.15) inset,
        0 4px 16px rgba(0, 0, 0, 0.4),
        0 0 24px rgba(255, 136, 0, 0.08);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.cfx-footer-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 149, 0, 0.4), 
        transparent);
    opacity: 0.6;
}

.cfx-footer-card:hover {
    border-color: rgba(255, 149, 0, 0.45);
    box-shadow: 
        0 0 0 1px rgba(255, 149, 0, 0.25) inset,
        0 6px 24px rgba(0, 0, 0, 0.5),
        0 0 32px rgba(255, 136, 0, 0.15);
    transform: translateY(-1px);
}

.cfx-footer-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.cfx-footer-version-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 136, 0, 0.2);
    border-radius: 8px;
    color: var(--cfx-text);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    white-space: nowrap;
    box-shadow: inset 0 1px 0 rgba(255, 136, 0, 0.08);
    transition: all 0.25s ease;
}

.cfx-footer-version-badge:hover {
    background: rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 136, 0, 0.35);
}

.cfx-footer-icon {
    width: 16px;
    height: 16px;
    color: var(--cfx-accent-2);
    filter: drop-shadow(0 0 4px rgba(255, 136, 0, 0.3));
}

.cfx-footer-version-text {
    line-height: 1;
}

.cfx-footer-link {
    display: flex;
    align-items: center;
    gap: 6px;
    border: 0;
    padding: 6px 12px;
    background: transparent;
    color: var(--cfx-accent-2);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    cursor: pointer;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.25s ease;
    position: relative;
}

.cfx-footer-link::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 8px;
    padding: 1px;
    background: linear-gradient(135deg, 
        rgba(255, 136, 0, 0.2), 
        transparent, 
        rgba(255, 136, 0, 0.2));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, 
                   linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.cfx-footer-link:hover {
    color: #ffb14d;
    background: rgba(255, 136, 0, 0.08);
}

.cfx-footer-link:hover::before {
    opacity: 1;
}

.cfx-footer-link:hover .cfx-footer-link-icon {
    transform: translate(2px, -2px);
}

.cfx-footer-link:focus-visible {
    outline: 2px solid rgba(255, 149, 0, 0.45);
    outline-offset: 2px;
    border-radius: 8px;
}

.cfx-footer-link:active {
    transform: scale(0.98);
}

.cfx-footer-link-icon {
    width: 14px;
    height: 14px;
    transition: transform 0.25s ease;
}

.cfx-footer-version {
    white-space: nowrap;
}

/* Desktop shell: left / center / right with bottom log */
.cfx-shell {
    flex: 1 1 0;
    min-height: 0;
    display: grid;
    grid-template-columns:
        var(--cfx-left-width, 330px)
        8px
        1fr
        8px
        var(--cfx-right-width, 320px);
    gap: 8px;
    align-items: stretch;
}

/* Collapse tracks when panels are hidden */
.cfx-shell[data-cfx-left="0"] {
    grid-template-columns: 1fr 8px var(--cfx-right-width, 320px);
}

.cfx-shell[data-cfx-right="0"] {
    grid-template-columns: var(--cfx-left-width, 330px) 8px 1fr;
}

.cfx-shell[data-cfx-left="0"][data-cfx-right="0"] {
    grid-template-columns: 1fr;
}

.cfx-shell-left,
.cfx-shell-right {
    min-height: 0;
    overflow: hidden;
}

.cfx-shell-center {
    min-height: 0;
    display: grid;
    grid-template-rows:
        1fr
        8px
        var(--cfx-bottom-height, 220px);
    gap: 8px;
    overflow: hidden;
}

.cfx-shell[data-cfx-bottom="0"] .cfx-shell-center {
    grid-template-rows: 1fr;
}

/* Responsive: collapse side panels under the center when space is tight */
@media (max-width: 1100px) {
    .cfx-shell {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
    }

    .cfx-splitter {
        display: none;
    }

    .cfx-shell-left,
    .cfx-shell-right {
        height: auto;
        overflow: visible;
    }

    .cfx-shell-center {
        grid-template-rows: 1fr;
        overflow: hidden;
        min-height: 0;
    }

    .cfx-shell-bottom {
        margin-top: 8px;
    }
}

/* Splitters */
.cfx-splitter {
    border: 1px solid rgba(255, 136, 0, 0.18);
    background: linear-gradient(180deg, rgba(255, 136, 0, 0.06), rgba(0, 0, 0, 0.12));
    border-radius: 6px;
}

.cfx-splitter:hover {
    border-color: rgba(255, 136, 0, 0.35);
    background: linear-gradient(180deg, rgba(255, 136, 0, 0.12), rgba(0, 0, 0, 0.16));
}

.cfx-splitter-v {
    cursor: col-resize;
}

.cfx-splitter-h {
    cursor: row-resize;
}

body.cfx-noselect {
    user-select: none;
}

body.cfx-drag-col,
body.cfx-drag-col * {
    cursor: col-resize !important;
}

body.cfx-drag-row,
body.cfx-drag-row * {
    cursor: row-resize !important;
}

.cfx-center-surface {
    height: 100%;
    border: 1px solid rgba(255, 136, 0, 0.20);
    overflow: hidden;
}

.cfx-center-brand {
    height: 100%;
    display: grid;
    place-items: center;
    text-align: center;
    padding: 24px;
    overflow: auto;
    background: linear-gradient(135deg, transparent 0%, rgba(255, 255, 255, 0.02) 50%, transparent 100%);
}

.cfx-center-hint {
    color: var(--cfx-text-muted);
    margin-top: 12px;
}

.cfx-brand-mark {
    width: 180px;
    height: 180px;
    opacity: 0.75;
    background: radial-gradient(circle at 30% 30%, rgba(255, 149, 0, 0.45), transparent 60%),
                linear-gradient(135deg, rgba(255, 122, 0, 0.55), rgba(255, 40, 0, 0.35));
    clip-path: polygon(50% 4%, 92% 22%, 92% 78%, 50% 96%, 8% 78%, 8% 22%);
    border: 1px solid rgba(255, 136, 0, 0.35);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
}

/* Panel styling */
.cfx-panel {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.cfx-panel-header {
    padding: 10px 12px;
    border-bottom: 1px solid var(--cfx-border);
    background: linear-gradient(135deg, transparent 0%, rgba(255, 255, 255, 0.03) 50%, transparent 100%),
                linear-gradient(180deg, rgba(16, 22, 32, 0.96) 0%, rgba(10, 14, 20, 0.96) 100%);
    box-shadow: inset 0 1px 0 rgba(255, 136, 0, 0.10);
    display: flex;
    align-items: center;
    gap: 8px;
}

.cfx-panel-header .mud-typography {
    line-height: 1;
}

.cfx-panel-header .cfx-dock-buttons {
    margin-left: auto;
}

.cfx-panel-header-compact {
    padding: 8px 10px;
}

.cfx-panel-title {
    color: var(--cfx-accent-2);
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.cfx-panel-subtitle {
    color: var(--cfx-accent-2);
    letter-spacing: 0.10em;
    text-transform: uppercase;
}

.cfx-panel-body {
    padding: 12px;
    flex: 1;
    min-height: 0;
    overflow: auto;
}

/* Applied only to panels that contain an accordion so only the
   expanded section scrolls while headers stay pinned.           */
.cfx-panel-body--accordion {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.cfx-panel-toolbar {
    flex-shrink: 0;
}

.cfx-panel-body-compact {
    padding: 10px;
}


.cfx-muted {
    color: var(--cfx-text-muted);
}

.cfx-harmonica .cfx-no-items {
    padding: 10px !important;
}

.cfx-cta {
    background: linear-gradient(180deg, var(--cfx-accent-2) 0%, var(--cfx-accent) 100%) !important;
}

.cfx-btn-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

/* Remote control panel */
.cfx-remote .cfx-panel-body {
    padding: 10px;
}

.cfx-remote-section {
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 6px;
    border: 1px solid rgba(255, 136, 0, 0.22);
    background:
        linear-gradient(180deg, rgba(12, 16, 24, 0.78) 0%, rgba(8, 10, 14, 0.62) 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 136, 0, 0.10),
        0 10px 28px rgba(0, 0, 0, 0.45);
}

.cfx-remote-section .cfx-panel-subtitle {
    display: block;
    padding: 6px 8px;
    margin: -2px -2px 8px;
    border-radius: 4px;
    border: 1px solid rgba(255, 136, 0, 0.22);
    background: linear-gradient(180deg, rgba(255, 136, 0, 0.10), rgba(0, 0, 0, 0.10));
}

.cfx-remote-connect {
    text-transform: none;
    letter-spacing: 0.04em;
    border-radius: 3px;
    height: 30px;
    box-shadow: 0 0 0 1px rgba(255, 136, 0, 0.25), 0 10px 22px rgba(0, 0, 0, 0.45);
}

.cfx-remote-connect .mud-button-start-icon {
    margin-inline-end: 8px;
}

.cfx-remote-command-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 10px;
}

.cfx-remote-command-grid .mud-button-root {
    height: 30px;
    border-radius: 3px;
    text-transform: none;
    font-size: 0.78rem;
    justify-content: flex-start;
}

.cfx-remote-command-grid .mud-button-root .mud-button-start-icon {
    margin-inline-end: 8px;
}

.cfx-remote-command-grid .mud-icon-root {
    font-size: 16px;
}

.cfx-remote-sd {
    margin-top: 10px;
    height: 30px;
    border-radius: 3px;
    text-transform: none;
}

.cfx-remote-sd .mud-button-start-icon {
    margin-inline-end: 8px;
}

.cfx-remote-toggles {
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}

.cfx-remote .mud-checkbox {
    color: var(--cfx-text);
}

.cfx-remote .mud-input-control {
    margin-top: 6px;
}

.cfx-remote-command {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: end;
}

.cfx-remote-send,
.cfx-remote-play {
    height: 38px;
    border-radius: 6px;
    text-transform: none;
}

.cfx-remote-player-grid {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: end;
}

@media (max-width: 380px) {
    .cfx-remote-connection-row,
    .cfx-remote-command,
    .cfx-remote-player-grid {
        grid-template-columns: 1fr;
    }

    .cfx-remote-status {
        justify-content: center;
    }

    .cfx-remote-send,
    .cfx-remote-play {
        width: 100%;
    }
}

.cfx-remote .mud-input-outlined {
    background: rgba(0, 0, 0, 0.18);
}

.cfx-remote .mud-input-outlined-border {
    border-color: rgba(255, 136, 0, 0.20);
}

.cfx-remote .mud-input-outlined:hover .mud-input-outlined-border {
    border-color: rgba(255, 136, 0, 0.38);
}

.cfx-remote .mud-input-outlined.mud-input-focused .mud-input-outlined-border {
    border-color: rgba(255, 149, 0, 0.75);
}

.cfx-remote-sliders {
    margin-top: 10px;
    display: grid;
    gap: 8px;
}

.cfx-remote-save {
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.cfx-remote-save .mud-button-root {
    height: 30px;
    border-radius: 3px;
    text-transform: none;
}

.cfx-remote-player {
    margin-top: 10px;
    display: flex;
    justify-content: flex-end;
}

.cfx-remote-player .mud-button-root {
    height: 30px;
    border-radius: 3px;
    text-transform: none;
}

.cfx-slider {
    display: grid;
    grid-template-columns: 50px 1fr;
    gap: 10px;
    align-items: center;
}

/* Battery indicator */
.cfx-battery-section {
    padding: 8px 10px;
}

.cfx-battery-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cfx-battery-bar-track {
    flex: 1;
    height: 8px;
    border-radius: 4px;
    background: rgba(255, 136, 0, 0.12);
    border: 1px solid rgba(255, 136, 0, 0.18);
    overflow: hidden;
}

.cfx-battery-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s ease, background 0.6s ease;
}

.cfx-battery-good {
    background: linear-gradient(90deg, rgba(50, 210, 120, 0.85), rgba(50, 210, 120, 0.95));
    box-shadow: 0 0 8px rgba(50, 210, 120, 0.25);
}

.cfx-battery-mid {
    background: linear-gradient(90deg, rgba(255, 179, 0, 0.85), rgba(255, 179, 0, 0.95));
    box-shadow: 0 0 8px rgba(255, 179, 0, 0.25);
}

.cfx-battery-low {
    background: linear-gradient(90deg, rgba(255, 136, 0, 0.85), rgba(255, 136, 0, 0.95));
    box-shadow: 0 0 8px rgba(255, 136, 0, 0.25);
}

.cfx-battery-critical {
    background: linear-gradient(90deg, rgba(220, 53, 69, 0.85), rgba(220, 53, 69, 0.95));
    box-shadow: 0 0 8px rgba(220, 53, 69, 0.25);
}

.cfx-battery-icon-good { color: rgba(50, 210, 120, 0.9); }
.cfx-battery-icon-mid { color: rgba(255, 179, 0, 0.9); }
.cfx-battery-icon-low { color: rgba(255, 136, 0, 0.9); }
.cfx-battery-icon-critical { color: rgba(220, 53, 69, 0.9); }

.cfx-battery-text {
    min-width: 32px;
    text-align: right;
    color: var(--cfx-text-muted);
    font-size: 0.8rem;
    white-space: nowrap;
}

.cfx-panel-log {
    height: 100%;
}

.cfx-panel-log .cfx-panel-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
}

/* Serial Log Panel Header Buttons - Match Remote Control Style */
.cfx-panel-log .cfx-panel-header .mud-button-root {
    height: 30px;
    border-radius: 3px;
    text-transform: none;
    font-size: 0.78rem;
    border-color: rgba(255, 136, 0, 0.22);
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.18), rgba(20, 28, 38, 0.30));
    box-shadow: inset 0 1px 0 rgba(255, 136, 0, 0.06);
    color: #ffffff !important;
}

.cfx-panel-log .cfx-panel-header .mud-button-root .mud-button-label {
    color: #ffffff !important;
}

.cfx-panel-log .cfx-panel-header .mud-button-root:hover {
    border-color: rgba(255, 136, 0, 0.42);
    background: linear-gradient(180deg, rgba(255, 136, 0, 0.10), rgba(0, 0, 0, 0.18));
}

.cfx-panel-log .cfx-panel-header .mud-button-root .mud-icon-root {
    font-size: 16px;
    opacity: 0.9;
    color: #ffffff !important;
}

.cfx-panel-log .cfx-panel-header .mud-button-root .mud-button-start-icon {
    margin-inline-end: 8px;
}

/* Left Panel Configuration Buttons (RESTORE and RE-ORDER) - Match Remote Control Style */
.cfx-panel .cfx-panel-body > .d-flex > .mud-button-root {
    height: 30px;
    border-radius: 3px;
    text-transform: none;
    font-size: 0.78rem;
    border-color: rgba(255, 136, 0, 0.22);
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.18), rgba(20, 28, 38, 0.30));
    box-shadow: inset 0 1px 0 rgba(255, 136, 0, 0.06);
    color: #ffffff !important;
}

.cfx-panel .cfx-panel-body > .d-flex > .mud-button-root .mud-button-label {
    color: #ffffff !important;
}

.cfx-panel .cfx-panel-body > .d-flex > .mud-button-root:hover {
    border-color: rgba(255, 136, 0, 0.42);
    background: linear-gradient(180deg, rgba(255, 136, 0, 0.10), rgba(0, 0, 0, 0.18));
}

.cfx-log {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding: 8px 10px;
    border: 1px solid rgba(255, 136, 0, 0.20);
    background: rgba(0, 0, 0, 0.25);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 12px;
    line-height: 1.5;
}

.cfx-log-line {
    display: grid;
    grid-template-columns: 86px 40px 1fr;
    gap: 8px;
    align-items: start;
    padding: 2px 0;
}

.cfx-log-line:has(.cfx-log-ts) {
    grid-template-columns: 86px 40px 1fr;
}

.cfx-log-line:not(:has(.cfx-log-ts)) {
    grid-template-columns: 40px 1fr;
}

.cfx-log-ts {
    color: rgba(231, 237, 247, 0.55);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.cfx-log-dir {
    color: rgba(255, 149, 0, 0.85);
    white-space: nowrap;
}

.cfx-log-message {
    color: rgba(231, 237, 247, 0.9);
    white-space: pre-wrap;
    word-wrap: break-word;
}

.cfx-log-dir-tx {
    color: rgba(50, 210, 120, 0.9);
    font-weight: 600;
}

.cfx-log-dir-rx {
    color: rgba(100, 180, 255, 0.9);
    font-weight: 600;
}

.cfx-log-dir-info {
    color: rgba(255, 149, 0, 0.85);
}

.cfx-copy-btn {
    transition: color 0.3s ease, border-color 0.3s ease, background-color 0.3s ease;
}

/* MudBlazor: baseline overrides for the Crystal FX look */
.mud-theme-dark,
.mud-container,
.mud-layout {
    background-color: transparent;
}

.cfx-appbar.mud-appbar {
    position: relative !important;
    flex-shrink: 0;
    background: linear-gradient(135deg, transparent 0%, rgba(255, 255, 255, 0.03) 50%, transparent 100%),
                linear-gradient(180deg, rgba(18, 24, 33, 0.94) 0%, rgba(9, 12, 18, 0.92) 100%);
    border-bottom: 1px solid var(--cfx-border);
    backdrop-filter: blur(10px);
}

/* Custom title bar drag area */
.cfx-titlebar-drag {
    flex: 1;
    display: flex;
    align-items: center;
    cursor: default;
    user-select: none;
    min-height: 100%;
}

.cfx-titlebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-left: 12px;
}

.cfx-title-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cfx-title {
    letter-spacing: 0.18em;
    font-weight: 700;
    line-height: 1;
}

.cfx-title-version {
    font-size: 0.55rem;
    color: var(--cfx-text-muted);
    letter-spacing: 0.03em;
    line-height: 1;
    font-weight: 400;
    opacity: 0.6;
}

.cfx-title-logo {
    width: 26px;
    height: 26px;
    object-fit: contain;
}

/* Window control buttons */
.cfx-titlebar-btn.mud-icon-button {
    border-radius: 0;
    width: 40px;
    height: 100%;
    min-width: 40px;
    color: var(--cfx-text-muted);
    transition: background 0.15s ease, color 0.15s ease;
}

.cfx-titlebar-btn.mud-icon-button:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--cfx-text);
}

.cfx-titlebar-btn-close.mud-icon-button:hover {
    background: rgba(232, 17, 35, 0.85);
    color: #fff;
}

.cfx-drawer.mud-drawer {
    background: linear-gradient(180deg, rgba(13, 18, 26, 0.96) 0%, rgba(9, 12, 18, 0.96) 100%);
    border-right: 1px solid var(--cfx-border);
}

.cfx-drawer-inner {
    padding-top: 0.5rem;
}

.cfx-nav .mud-nav-link {
    color: var(--cfx-text-muted);
}

/* Left panel tabs (MudTabs) */
.cfx-left-tabs {
    --cfx-tab-height: 34px;
}

/* Tab header strip (MudBlazor v8) */
.cfx-left-tabs .mud-tabs-toolbar {
    padding: 0;
    border-radius: 6px;
    border: 1px solid rgba(255, 136, 0, 0.22);
    background: linear-gradient(180deg, rgba(12, 16, 24, 0.90) 0%, rgba(8, 10, 14, 0.78) 100%);
    box-shadow: inset 0 1px 0 rgba(255, 136, 0, 0.10);
    overflow: hidden;
}

/* Some MudBlazor variants apply a surface background on wrapper elements; force them dark. */
.cfx-left-tabs .mud-tabs-toolbar-wrapper,
.cfx-left-tabs .mud-tabs-toolbar-content,
.cfx-left-tabs .mud-tabs-toolbar-inner,
.cfx-left-tabs .mud-tabs-toolbar-scrollable {
    background: transparent !important;
}

/* Also force the overall tabs root surface to stay dark within the left panel. */
.cfx-left-tabs.mud-tabs,
.cfx-left-tabs .mud-tabs {
    background: transparent;
}

.cfx-left-tabs .mud-tabs-toolbar-content {
    min-height: var(--cfx-tab-height);
}

/* The moving indicator bar */
.cfx-left-tabs .mud-tab-slider,
.cfx-left-tabs .mud-tabs-slider {
    background-color: rgba(255, 149, 0, 0.85);
    height: 2px;
}

/* Each tab button */
.cfx-left-tabs .mud-tabs-toolbar .mud-tab {
    min-height: var(--cfx-tab-height);
    height: var(--cfx-tab-height);
    padding: 0 10px;
    margin: 0;
    border-right: 1px solid rgba(255, 136, 0, 0.16);
    color: var(--cfx-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.72rem;
    background: transparent;
}

.cfx-left-tabs .mud-tabs-toolbar .mud-tab:last-child {
    border-right: 0;
}

/* Active tab */
.cfx-left-tabs .mud-tabs-toolbar .mud-tab.mud-tab-active {
    color: rgba(255, 149, 0, 0.95);
    background: linear-gradient(180deg, rgba(255, 136, 0, 0.12), rgba(0, 0, 0, 0.08));
    box-shadow: inset 0 1px 0 rgba(255, 149, 0, 0.18);
}

/* Disabled tab */
.cfx-left-tabs .mud-tabs-toolbar .mud-tab.mud-disabled,
.cfx-left-tabs .mud-tabs-toolbar .mud-tab:disabled {
    opacity: 0.45;
    color: rgba(231, 237, 247, 0.55);
}

/* Panels area - scope to left tabs only */
.cfx-left-tabs .cfx-tabs-panel {
    margin-top: 10px;
    border-radius: 6px;
    border: 1px solid rgba(255, 136, 0, 0.18);
    background: linear-gradient(180deg, rgba(10, 14, 20, 0.55) 0%, rgba(19, 26, 36, 0.35) 100%);
    box-shadow: inset 0 1px 0 rgba(255, 136, 0, 0.08);
}

.cfx-left-tabs .cfx-tabs-panel .mud-tabs-panels {
    padding: 10px;
}

.cfx-nav .mud-nav-link.active,
.cfx-nav .mud-nav-link:hover {
    color: var(--cfx-text);
}

.cfx-nav .mud-nav-link.active::before {
    background-color: var(--cfx-accent);
}

.mud-paper {
    background: linear-gradient(180deg, rgba(19, 26, 36, 0.92) 0%, rgba(11, 15, 22, 0.92) 100%);
    border: 1px solid var(--cfx-border);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
}

.mud-button-filled-primary {
    background: linear-gradient(180deg, var(--cfx-accent-2) 0%, var(--cfx-accent) 100%);
}

.mud-typography,
.mud-typography-body1,
.mud-typography-body2,
.mud-typography-subtitle1,
.mud-typography-subtitle2 {
    color: var(--cfx-text);
}

.mud-input > input,
.mud-input > textarea {
    color: var(--cfx-text);
}

.mud-input-control .mud-input-label {
    color: var(--cfx-text-muted);
}

.mud-input-underline:before {
    border-bottom-color: rgba(255, 136, 0, 0.25);
}

.mud-input-underline:hover:before {
    border-bottom-color: rgba(255, 136, 0, 0.45);
}

.mud-input-underline:after {
    border-bottom-color: var(--cfx-accent);
}

.mud-tabs-toolbar {
    border-bottom: 1px solid var(--cfx-border);
}

.mud-tab.mud-tab-active {
    color: var(--cfx-text);
}

.mud-tab {
    color: var(--cfx-text-muted);
}

.mud-tab:hover {
    color: var(--cfx-text);
}

.mud-tab-indicator {
    background-color: var(--cfx-accent);
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA9NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

.status-bar-safe-area {
    display: none;
}

@supports (-webkit-touch-callout: none) {
    .status-bar-safe-area {
        display: flex;
        position: sticky;
        top: 0;
        height: env(safe-area-inset-top);
        background-color: #f7f7f7;
        width: 100%;
        z-index: 1;
    }

    .flex-column, .navbar-brand {
        padding-left: env(safe-area-inset-left);
    }
}

/* ── Unified list-card design (full-width material futuristic) ──── */

.cfx-listcard {
    --lc-accent: 255, 149, 0;
    position: relative;
    border-radius: 0;
    padding: 0;
    border: none;
    border-bottom: 1px solid rgba(var(--lc-accent), 0.12);
    background: transparent;
    transition: background 180ms ease, box-shadow 180ms ease;
    cursor: pointer;
    overflow: hidden;
    margin: 0;
}

/* Left accent bar */
.cfx-listcard::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: rgba(var(--lc-accent), 0.25);
    transition: width 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

/* Bottom scan-line highlight */
.cfx-listcard::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, rgba(var(--lc-accent), 0.4), transparent 80%);
    opacity: 0;
    transition: opacity 200ms ease;
}

.cfx-listcard:hover {
    background: rgba(var(--lc-accent), 0.06);
    box-shadow: inset 0 0 20px rgba(var(--lc-accent), 0.03);
}

.cfx-listcard:hover::before {
    width: 3px;
    background: rgba(var(--lc-accent), 0.7);
    box-shadow: 0 0 8px rgba(var(--lc-accent), 0.25);
}

.cfx-listcard:hover::after {
    opacity: 1;
}

.cfx-listcard:active {
    background: rgba(var(--lc-accent), 0.10);
    transition: all 60ms ease;
}

/* Selected / active state */
.cfx-listcard--active {
    background: linear-gradient(90deg, rgba(var(--lc-accent), 0.10) 0%, rgba(var(--lc-accent), 0.03) 100%);
    border-bottom-color: rgba(var(--lc-accent), 0.25);
    box-shadow:
        inset 0 0 24px rgba(var(--lc-accent), 0.05),
        0 0 12px rgba(var(--lc-accent), 0.04);
}

.cfx-listcard--active::before {
    width: 3px;
    background: linear-gradient(180deg, rgba(var(--lc-accent), 1), rgba(var(--lc-accent), 0.6));
    box-shadow: 0 0 10px rgba(var(--lc-accent), 0.45);
    animation: cfx-lc-pulse 2.5s ease-in-out infinite;
}

.cfx-listcard--active::after {
    opacity: 1;
    background: linear-gradient(90deg, rgba(var(--lc-accent), 0.5), transparent 70%);
}

@keyframes cfx-lc-pulse {
    0%, 100% { box-shadow: 0 0 8px rgba(var(--lc-accent), 0.35); }
    50%      { box-shadow: 0 0 14px rgba(var(--lc-accent), 0.65); }
}

/* ── Type modifiers (accent colours) ───────────────────────────────── */

.cfx-listcard--sound { --lc-accent: 255, 149, 0; }
.cfx-listcard--blade { --lc-accent: 100, 180, 255; }
.cfx-listcard--color { --lc-accent: 50, 210, 120; }

/* ── Inner layout ──────────────────────────────────────────────────── */

.cfx-listcard__inner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px 10px 16px;
    min-height: 62px;
}

.cfx-listcard__index {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    color: rgba(var(--lc-accent), 0.95);
    text-shadow: 0 0 8px rgba(var(--lc-accent), 0.25);
    border: 1px solid rgba(var(--lc-accent), 0.25);
    border-radius: 4px;
    background: rgba(var(--lc-accent), 0.06);
}

.cfx-listcard--active .cfx-listcard__index {
    border-color: rgba(var(--lc-accent), 0.5);
    background: rgba(var(--lc-accent), 0.12);
    box-shadow: 0 0 8px rgba(var(--lc-accent), 0.15);
}

.cfx-listcard__body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    overflow: hidden;
}

.cfx-listcard__name {
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.92) !important;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cfx-listcard--active .cfx-listcard__name {
    color: rgba(255, 255, 255, 1) !important;
}

.cfx-listcard__detail {
    font-size: 0.66rem;
    line-height: 1.3;
    color: rgba(var(--lc-accent), 0.6) !important;
    letter-spacing: 0.03em;
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cfx-listcard--active .cfx-listcard__detail {
    color: rgba(var(--lc-accent), 0.85) !important;
}

.cfx-listcard__tag {
    align-self: flex-start;
    flex-shrink: 0;
    font-size: 0.55rem !important;
    height: 18px !important;
    letter-spacing: 0.1em;
    border-color: rgba(var(--lc-accent), 0.35) !important;
    color: rgba(var(--lc-accent), 0.8) !important;
    margin-top: 2px;
}

/* ── Linked font names in detail line ──────────────────────────────── */

.cfx-listcard__fonts {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: default;
}

.cfx-listcard__font-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 3px;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    background: rgba(var(--lc-accent), 0.15);
    border: 1px solid rgba(var(--lc-accent), 0.25);
    color: rgba(var(--lc-accent), 0.95) !important;
    flex-shrink: 0;
}

.cfx-listcard--active .cfx-listcard__font-count {
    background: rgba(var(--lc-accent), 0.22);
    border-color: rgba(var(--lc-accent), 0.4);
}

/* ── Tooltip for linked font list ──────────────────────────────────── */

.cfx-listcard-tooltip {
    backdrop-filter: blur(12px);
}

.cfx-listcard-tooltip .mud-tooltip {
    background: linear-gradient(135deg, rgba(20, 16, 10, 0.97), rgba(12, 10, 8, 0.97)) !important;
    border: 1px solid rgba(var(--lc-accent, 255, 149, 0), 0.35) !important;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.6), 0 0 12px rgba(255, 136, 0, 0.08) !important;
    border-radius: 8px !important;
    padding: 0 !important;
    max-width: 280px;
}

.cfx-listcard-tooltip__content {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 8px 0;
}

.cfx-listcard-tooltip__title {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 149, 0, 0.85);
    padding: 0 12px 6px;
    border-bottom: 1px solid rgba(255, 136, 0, 0.15);
    margin-bottom: 2px;
}

.cfx-listcard-tooltip__item {
    font-size: 0.72rem;
    color: rgba(231, 237, 247, 0.88);
    padding: 4px 12px;
    letter-spacing: 0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cfx-listcard-tooltip__item:hover {
    background: rgba(255, 136, 0, 0.08);
    color: rgba(231, 237, 247, 1);
}

/* Loading Screen Styles */
.cfx-loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 50%, #0a0a0a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.cfx-loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
}

.cfx-loading-logo {
    width: 200px;
    height: auto;
    filter: drop-shadow(0 0 30px rgba(255, 149, 0, 0.3));
    animation: cfx-logo-pulse 2s ease-in-out infinite;
}

.cfx-loading-spinner {
    width: 60px;
    height: 60px;
    border: 3px solid rgba(255, 149, 0, 0.1);
    border-top-color: rgba(255, 149, 0, 0.8);
    border-radius: 50%;
    animation: cfx-spinner-rotate 1s linear infinite;
    position: relative;
}

.cfx-loading-spinner::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid rgba(255, 149, 0, 0.1);
    border-bottom-color: rgba(255, 149, 0, 0.6);
    border-radius: 50%;
    animation: cfx-spinner-rotate 1.5s linear infinite reverse;
}

.cfx-loading-text {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: rgba(255, 149, 0, 0.9);
    text-shadow: 0 0 20px rgba(255, 149, 0, 0.5);
    animation: cfx-text-fade 2s ease-in-out infinite;
}

@keyframes cfx-logo-pulse {
    0%, 100% {
        transform: scale(1);
        filter: drop-shadow(0 0 30px rgba(255, 149, 0, 0.3));
    }
    50% {
        transform: scale(1.05);
        filter: drop-shadow(0 0 40px rgba(255, 149, 0, 0.5));
    }
}

@keyframes cfx-spinner-rotate {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@keyframes cfx-text-fade {
    0%, 100% {
        opacity: 0.6;
    }
    50% {
        opacity: 1;
    }
}

/* ====================================================
   MudBlazor Dialog / MessageBox Styling
   ==================================================== */

/* Dialog backdrop overlay */
.mud-overlay.mud-overlay-absolute,
.mud-overlay.mud-overlay-dialog {
    background: rgba(6, 8, 12, 0.82) !important;
    backdrop-filter: blur(4px);
}

/* Main dialog container */
.mud-dialog {
    background: linear-gradient(135deg, transparent 0%, rgba(255, 255, 255, 0.03) 50%, transparent 100%),
                linear-gradient(180deg, var(--cfx-surface-2), var(--cfx-surface)) !important;
    border: 1px solid var(--cfx-border) !important;
    border-radius: 12px !important;
    box-shadow: 0 0 0 1px rgba(255, 136, 0, 0.25),
                0 20px 60px rgba(0, 0, 0, 0.75),
                0 0 40px rgba(255, 136, 0, 0.12),
                inset 0 1px 0 rgba(255, 136, 0, 0.08) !important;
    overflow: hidden;
}

/* Dialog title */
.mud-dialog-title {
    background: linear-gradient(180deg, rgba(255, 136, 0, 0.08), transparent) !important;
    color: var(--cfx-accent-2) !important;
    font-size: 1.1rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.04em !important;
    padding: 18px 20px 14px !important;
    border-bottom: 1px solid rgba(255, 136, 0, 0.15) !important;
    text-shadow: 0 0 12px rgba(255, 136, 0, 0.18);
}

/* Dialog content/message */
.mud-dialog-content {
    background: transparent !important;
    color: var(--cfx-text) !important;
    padding: 20px !important;
    font-size: 0.94rem !important;
    line-height: 1.6 !important;
}

/* Dialog actions (buttons container) */
.mud-dialog-actions {
    background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.15)) !important;
    padding: 14px 18px !important;
    border-top: 1px solid rgba(255, 136, 0, 0.10) !important;
    gap: 10px !important;
    display: flex !important;
    justify-content: flex-end !important;
}

/* Dialog buttons - Primary/Yes button (CTA style) */
.mud-dialog-actions .mud-button-filled,
.mud-dialog-actions .mud-button-filled-primary,
.mud-dialog-actions .mud-button-root.mud-button-filled {
    background: linear-gradient(180deg, var(--cfx-accent-2), var(--cfx-accent)) !important;
    color: #fff !important;
    border-radius: 7px !important;
    padding: 8px 20px !important;
    text-transform: none !important;
    letter-spacing: 0.04em !important;
    font-weight: 600 !important;
    border: 1px solid rgba(255, 136, 0, 0.35) !important;
    box-shadow: 0 0 0 1px rgba(255, 136, 0, 0.25),
                0 6px 16px rgba(0, 0, 0, 0.45),
                0 0 14px rgba(255, 136, 0, 0.10) !important;
    transition: all 0.20s ease !important;
}

.mud-dialog-actions .mud-button-filled:hover,
.mud-dialog-actions .mud-button-filled-primary:hover,
.mud-dialog-actions .mud-button-root.mud-button-filled:hover {
    box-shadow: 0 0 0 1px rgba(255, 149, 0, 0.50),
                0 8px 22px rgba(0, 0, 0, 0.55),
                0 0 24px rgba(255, 136, 0, 0.20) !important;
    transform: translateY(-1px);
    border-color: rgba(255, 149, 0, 0.55) !important;
}

.mud-dialog-actions .mud-button-filled:active,
.mud-dialog-actions .mud-button-filled-primary:active,
.mud-dialog-actions .mud-button-root.mud-button-filled:active {
    transform: translateY(0);
    box-shadow: 0 0 0 1px rgba(255, 136, 0, 0.35),
                0 3px 10px rgba(0, 0, 0, 0.45) !important;
}

/* Dialog buttons - Cancel/Secondary button */
.mud-dialog-actions .mud-button-text,
.mud-dialog-actions .mud-button-outlined,
.mud-dialog-actions .mud-button-root:not(.mud-button-filled) {
    background: rgba(0, 0, 0, 0.18) !important;
    color: var(--cfx-text-muted) !important;
    border: 1px solid rgba(255, 136, 0, 0.20) !important;
    border-radius: 7px !important;
    padding: 8px 20px !important;
    text-transform: none !important;
    letter-spacing: 0.02em !important;
    box-shadow: inset 0 1px 0 rgba(255, 136, 0, 0.06) !important;
    transition: all 0.20s ease !important;
}

.mud-dialog-actions .mud-button-text:hover,
.mud-dialog-actions .mud-button-outlined:hover,
.mud-dialog-actions .mud-button-root:not(.mud-button-filled):hover {
    background: rgba(255, 136, 0, 0.08) !important;
    border-color: rgba(255, 136, 0, 0.40) !important;
    color: var(--cfx-text) !important;
}

.mud-dialog-actions .mud-button-text:active,
.mud-dialog-actions .mud-button-outlined:active,
.mud-dialog-actions .mud-button-root:not(.mud-button-filled):active {
    transform: scale(0.98);
}

/* Close button (X) in dialog */
.mud-dialog .mud-icon-button-close,
.mud-dialog-title .mud-icon-button {
    color: var(--cfx-text-muted) !important;
    transition: all 0.15s ease !important;
}

.mud-dialog .mud-icon-button-close:hover,
.mud-dialog-title .mud-icon-button:hover {
    color: var(--cfx-accent-2) !important;
    background: rgba(255, 136, 0, 0.10) !important;
}

/* MessageBox specific styling */
.mud-message-box .mud-dialog {
    min-width: 360px;
    max-width: 480px;
}

/* Animation for dialog appearance */
@keyframes cfx-dialog-appear {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.mud-dialog {
    animation: cfx-dialog-appear 0.25s ease-out;
}

/* ── Blade Style Library ───────────────────────────────────────────── */

.cfx-stylelib {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.cfx-stylelib-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255, 136, 0, 0.22);
    background: linear-gradient(180deg, rgba(16, 22, 32, 0.96), rgba(10, 14, 20, 0.96));
    box-shadow: inset 0 1px 0 rgba(255, 136, 0, 0.10);
}

.cfx-stylelib-header-icon {
    color: var(--cfx-accent-2);
}

.cfx-stylelib-body {
    flex: 1;
    display: flex;
    min-height: 0;
    overflow: hidden;
}

/* ── Browse panel (left) ── */

.cfx-stylelib-browse {
    width: 320px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255, 136, 0, 0.18);
    min-height: 0;
    overflow: hidden;
}

.cfx-stylelib-tabs {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* MudTabs generates .mud-tabs > .mud-tabs-toolbar + .mud-tabs-panels > .mud-tabpanel
   Every intermediate node must propagate the flex height constraint. */
.cfx-stylelib-tabs .mud-tabs {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.cfx-stylelib-tabs .mud-tabs-panels {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.cfx-stylelib-tabs .mud-tabpanel {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.cfx-stylelib-search {
    flex-shrink: 0;
    padding: 10px 12px;
}

.cfx-stylelib-progress {
    flex-shrink: 0;
}

.cfx-stylelib-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 0 12px 12px;
    overflow-y: auto;
    min-height: 0;
}

.cfx-stylelib-list-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 28px 16px;
    text-align: center;
}

/* ── Style card (list item) ── */

.cfx-stylecard {
    position: relative;
    flex-shrink: 0;
    border-radius: 8px;
    border: 1px solid rgba(255, 136, 0, 0.30);
    background: linear-gradient(180deg, rgba(18, 24, 33, 0.92), rgba(8, 12, 18, 0.96));
    box-shadow: inset 0 1px 0 rgba(255, 136, 0, 0.08), 0 2px 8px rgba(0, 0, 0, 0.4);
    transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
    cursor: pointer;
    overflow: hidden;
}

.cfx-stylecard::after {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, rgba(255, 149, 0, 0.9), rgba(255, 122, 0, 0.7));
    opacity: 0;
    transition: opacity 180ms ease;
}

.cfx-stylecard:hover {
    border-color: rgba(255, 149, 0, 0.60);
    box-shadow: inset 0 1px 0 rgba(255, 149, 0, 0.18), 0 6px 16px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 149, 0, 0.15);
    transform: translateY(-1px);
}

.cfx-stylecard:hover::after {
    opacity: 0.6;
}

.cfx-stylecard:active {
    transform: translateY(0) scale(0.995);
    transition: all 80ms ease;
}

.cfx-stylecard-selected {
    border-color: rgba(255, 149, 0, 0.90);
    box-shadow: inset 0 1px 0 rgba(255, 149, 0, 0.35), 0 8px 22px rgba(255, 136, 0, 0.22), 0 0 0 1px rgba(255, 149, 0, 0.30);
    background: linear-gradient(180deg, rgba(255, 136, 0, 0.08), rgba(8, 12, 18, 0.96));
}

.cfx-stylecard-selected::after {
    opacity: 1;
}

.cfx-stylecard-inner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
}

.cfx-stylecard-icon-area {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 6px;
    background: rgba(255, 136, 0, 0.10);
    border: 1px solid rgba(255, 136, 0, 0.22);
    color: var(--cfx-accent-2);
}

.cfx-stylecard-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    overflow: hidden;
}

.cfx-stylecard-title {
    font-size: 0.88rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    color: #ffffff;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cfx-stylecard-author {
    font-size: 0.72rem;
    color: var(--cfx-text-muted);
    letter-spacing: 0.02em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cfx-stylecard-arrow {
    flex-shrink: 0;
    color: var(--cfx-accent-2);
    opacity: 0.8;
}

/* ── Detail panel (right) ── */

.cfx-stylelib-detail {
    flex: 1;
    min-width: 0;
    min-height: 0;
    padding: 16px 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
    box-sizing: border-box;
}

.cfx-stylelib-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-align: center;
    padding: 32px;
}

.cfx-stylelib-detail-top {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cfx-stylelib-detail-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.cfx-stylelib-badge {
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.68rem;
}

.cfx-stylelib-inline-icon {
    vertical-align: text-bottom;
    margin-right: 4px;
    font-size: 14px !important;
    opacity: 0.7;
}

/* Video embed */

.cfx-stylelib-video-wrap {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

.cfx-stylelib-video-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 24px 12px;
    border-radius: 8px;
    border: 1px dashed rgba(255, 136, 0, 0.25);
    background: rgba(0, 0, 0, 0.2);
}

.cfx-stylelib-video {
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(255, 136, 0, 0.22);
    background: rgba(0, 0, 0, 0.35);
    aspect-ratio: 16 / 9;
    max-width: 360px;
}

.cfx-stylelib-video iframe,
.cfx-stylelib-video video,
.cfx-stylelib-video embed,
.cfx-stylelib-video object {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

/* Description & sections */

.cfx-stylelib-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 0;
}

.cfx-stylelib-section-grow {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cfx-stylelib-section-title {
    color: var(--cfx-accent-2) !important;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.72rem !important;
}

.cfx-stylelib-desc {
    color: var(--cfx-text);
    line-height: 1.55;
}

/* Actions bar */

.cfx-stylelib-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid rgba(255, 136, 0, 0.18);
    background: rgba(0, 0, 0, 0.18);
}

.cfx-stylelib-action-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.cfx-stylelib-apply-btn {
    box-shadow: 0 0 0 1px rgba(255, 136, 0, 0.25), 0 6px 16px rgba(0, 0, 0, 0.4);
}

/* Parameters */

.cfx-stylelib-params {
    flex: 1;
    min-height: 120px;
    overflow-y: auto;
    border-radius: 6px;
    border: 1px solid rgba(255, 136, 0, 0.15);
    background: rgba(0, 0, 0, 0.20);
}

.cfx-stylelib-param-row {
    display: grid;
    grid-template-columns: minmax(140px, 1fr) 1fr;
    gap: 12px;
    padding: 6px 14px;
    border-bottom: 1px solid rgba(255, 136, 0, 0.08);
    font-size: 0.82rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.cfx-stylelib-param-row:last-child {
    border-bottom: none;
}

.cfx-stylelib-param-name {
    color: var(--cfx-accent-2);
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cfx-stylelib-param-value {
    color: var(--cfx-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Responsive: collapse to single column */
@media (max-width: 720px) {
    .cfx-stylelib-body {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr 1fr;
    }

    .cfx-stylelib-browse {
        border-right: none;
        border-bottom: 1px solid rgba(255, 136, 0, 0.18);
    }
}

/* ── GraFx Previewer ────────────────────────────────────────────────── */

.cfx-grafx-previewer {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.cfx-grafx-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255, 136, 0, 0.22);
    background: linear-gradient(180deg, rgba(16, 22, 32, 0.96), rgba(10, 14, 20, 0.96));
    box-shadow: inset 0 1px 0 rgba(255, 136, 0, 0.10);
}

.cfx-grafx-header-icon {
    color: var(--mud-palette-primary);
}

.cfx-grafx-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cfx-grafx-link-status {
    display: flex;
    flex-direction: column;
}

.cfx-grafx-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.cfx-grafx-alert {
    font-size: 0.85rem;
}

.cfx-grafx-selector {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.cfx-grafx-select {
    flex: 1;
    min-width: 180px;
}

.cfx-grafx-stage-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.cfx-grafx-canvas-wrap {
    background: #0d0d14;
    border: 1px solid rgba(255, 136, 0, 0.18);
    border-radius: 6px;
    padding: 10px;
    overflow-x: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80px;
}

.cfx-grafx-canvas {
    display: block;
    border-radius: 30px;
    background: #0a0a12;
}

.cfx-grafx-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.cfx-grafx-bitmap-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cfx-grafx-section-title {
    margin-bottom: 4px;
}

.cfx-grafx-bitmap-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.cfx-grafx-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 48px 24px;
    text-align: center;
    flex: 1;
}

/* ── MudSelect & MudList tree: force light icons on dark surfaces ─── */

/* MudSelect dropdown arrow (anchor icon) */
.mud-select .mud-input-adornment-end .mud-icon-root,
.mud-select .mud-input-control-input-container .mud-icon-root,
.mud-select .mud-select-input .mud-icon-root,
.mud-select .mud-icon-root {
    color: var(--cfx-text) !important;
}

/* MudList tree expand/collapse toggle icons */
.cfx-config-tree-toggle .mud-icon-root,
.cfx-config-tree .mud-icon-root {
    color: var(--cfx-text) !important;
}

/* Panel toolbar button flash – plays when a panel is closed from inside */
@keyframes cfx-flash {
    0%   { color: inherit; box-shadow: 0 0 0 0 transparent; }
    20%  { color: #ff8800; box-shadow: 0 0 10px 3px rgba(255, 136, 0, 0.6); }
    40%  { color: inherit; box-shadow: 0 0 4px 1px rgba(255, 136, 0, 0.2); }
    60%  { color: #ff8800; box-shadow: 0 0 10px 3px rgba(255, 136, 0, 0.6); }
    80%  { color: inherit; box-shadow: 0 0 4px 1px rgba(255, 136, 0, 0.2); }
    100% { color: inherit; box-shadow: 0 0 0 0 transparent; }
}

.cfx-btn-flash {
    animation: cfx-flash 0.6s ease-in-out;
    border-radius: 4px;
    background-color: rgba(255, 136, 0, 0.12);
}

/* ── Color Profile Editor ────────────────────────────────────────────── */

.cfx-color-editor {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 16px;
    background: rgba(10, 14, 20, 0.85);
    border: 1px solid rgba(255, 136, 0, 0.18);
    overflow: hidden;
}

.cfx-color-editor-body {
    flex: 1;
    overflow: auto;
    min-height: 0;
}

/* Row container stacks each group of 3 color cards vertically */
.cfx-color-rows {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 6px;
}

/* Each row is a fixed 3-column grid */
.cfx-color-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.cfx-color-card {
    border: 1px solid rgba(255, 136, 0, 0.2);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.22);
    transition: border-color 200ms ease, box-shadow 200ms ease;
    cursor: pointer;
    overflow: hidden;
}

.cfx-color-card:hover {
    border-color: rgba(255, 136, 0, 0.4);
    box-shadow: 0 0 8px rgba(255, 136, 0, 0.08);
}

.cfx-color-card--active {
    border-color: rgba(255, 136, 0, 0.6);
    box-shadow: 0 0 14px rgba(255, 136, 0, 0.12);
}

.cfx-color-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
}

.cfx-color-swatch {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5), inset 0 0 6px rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.cfx-color-card-label {
    flex: 1;
    min-width: 0;
}

.cfx-color-card-chevron {
    color: var(--cfx-text-muted);
    flex-shrink: 0;
}

.cfx-color-card-picker {
    padding: 4px 12px 12px;
    border-top: 1px solid rgba(255, 136, 0, 0.12);
    background: rgba(0, 0, 0, 0.15);
}

/* Force MudColorPicker to fill card width */
.cfx-color-card-picker .mud-picker {
    width: 100%;
}

.cfx-color-card-picker .mud-picker-container {
    width: 100%;
}

/* Mix options section */
.cfx-color-mix-section {
    display: flex;
    gap: 32px;
    flex-wrap: wrap;
    margin-top: 6px;
    padding: 14px;
    border: 1px solid rgba(255, 136, 0, 0.15);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.18);
}

.cfx-color-mix-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cfx-color-mix-title {
    color: var(--cfx-text);
}

.cfx-color-mix-toggles {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

/* ── Firmware Update Dialog ────────────────────────────────────────── */

.cfx-fw-dialog.mud-dialog {
    min-width: 540px;
    max-width: 640px;
}

.cfx-fw-alert.mud-alert-outlined-warning {
    border-color: rgba(255, 179, 0, 0.35) !important;
}

.cfx-fw-desc {
    color: var(--cfx-text-muted);
    line-height: 1.55;
}

.cfx-fw-section-title {
    color: var(--cfx-accent-2);
    letter-spacing: 0.10em;
    margin-bottom: 8px;
}

/* Version selector */
.cfx-fw-select .mud-input-outlined .mud-input-outlined-border {
    border-color: rgba(255, 136, 0, 0.25) !important;
}

.cfx-fw-select .mud-input-outlined:hover .mud-input-outlined-border {
    border-color: rgba(255, 136, 0, 0.45) !important;
}

.cfx-fw-chip.mud-chip {
    height: 20px !important;
    font-size: 0.7rem !important;
}

/* Version transition (FROM → TO) */
.cfx-fw-version-transition {
    padding: 14px 16px;
    border: 1px solid rgba(255, 136, 0, 0.15);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.18);
}

.cfx-fw-version-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 100px;
}

.cfx-fw-arrow {
    color: rgba(255, 136, 0, 0.6);
}

.cfx-fw-changelog {
    margin-top: 8px;
}

.cfx-fw-changelog-text {
    color: var(--cfx-text-muted);
    line-height: 1.6;
    white-space: pre-wrap;
    font-size: 0.85rem;
    max-height: 120px;
    overflow-y: auto;
}

/* Timeline (preview + active) */
.cfx-fw-timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding-left: 4px;
}

.cfx-fw-timeline-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 8px 0;
    position: relative;
}

.cfx-fw-timeline-item:not(:last-child)::before {
    content: "";
    position: absolute;
    left: 7px;
    top: 24px;
    bottom: -8px;
    width: 2px;
    background: rgba(255, 136, 0, 0.18);
}

.cfx-fw-timeline-dot {
    width: 16px;
    height: 16px;
    min-width: 16px;
    border-radius: 999px;
    border: 2px solid rgba(255, 136, 0, 0.35);
    background: rgba(0, 0, 0, 0.3);
    display: inline-grid;
    place-items: center;
    margin-top: 2px;
}

.cfx-fw-timeline-text {
    color: var(--cfx-text);
}

.cfx-fw-timeline-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Active timeline states */
.cfx-fw-dot--done {
    border-color: rgba(50, 210, 120, 0.8) !important;
    background: rgba(50, 210, 120, 0.2) !important;
    color: rgba(50, 210, 120, 0.95);
}

.cfx-fw-dot--done .mud-icon-root {
    font-size: 12px !important;
    color: rgba(50, 210, 120, 0.95) !important;
}

.cfx-fw-dot--active {
    border-color: rgba(255, 149, 0, 0.75) !important;
    background: rgba(255, 136, 0, 0.15) !important;
    box-shadow: 0 0 10px rgba(255, 136, 0, 0.25);
    width: 22px;
    height: 22px;
    min-width: 22px;
    margin-top: 0;
    margin-left: -3px;
}

.cfx-fw-dot--error {
    border-color: rgba(220, 53, 69, 0.8) !important;
    background: rgba(220, 53, 69, 0.2) !important;
    color: rgba(220, 53, 69, 0.95);
}

.cfx-fw-dot--error .mud-icon-root {
    font-size: 12px !important;
    color: rgba(220, 53, 69, 0.95) !important;
}

.cfx-fw-timeline-item--done:not(:last-child)::before {
    background: rgba(50, 210, 120, 0.4) !important;
}

.cfx-fw-timeline-item--active:not(:last-child)::before {
    background: linear-gradient(180deg, rgba(255, 149, 0, 0.5), rgba(255, 136, 0, 0.12)) !important;
}

.cfx-fw-timeline-item--pending .cfx-fw-timeline-text {
    color: var(--cfx-text-muted);
    opacity: 0.6;
}

.cfx-fw-progress {
    min-height: 200px;
}

/* Pulsing user-action alert during firmware update */
.cfx-fw-action-alert {
    animation: cfx-fw-pulse 1.8s ease-in-out infinite;
    border-radius: 8px !important;
}

@keyframes cfx-fw-pulse {
    0%, 100% { box-shadow: 0 0 6px rgba(255, 152, 0, 0.3); }
    50%      { box-shadow: 0 0 20px rgba(255, 152, 0, 0.65); }
}

/* Drag handle – hand cursor for reorder dialog */
.drag-handle,
.drag-handle * {
    cursor: pointer !important;
}

/* Drag ghost – styled inline by cfx-drag.js; class is a hook for overrides */
.cfx-drag-ghost {
    overflow: hidden;
    white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════════════
   Music Player
   ═══════════════════════════════════════════════════════════════ */

.cfx-music {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.cfx-music-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255, 136, 0, 0.22);
    background: linear-gradient(180deg, rgba(16, 22, 32, 0.96), rgba(10, 14, 20, 0.96));
    box-shadow: inset 0 1px 0 rgba(255, 136, 0, 0.10);
}

.cfx-music-header-icon {
    color: var(--mud-palette-primary);
}

.cfx-music-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.cfx-music-alert {
    font-size: 0.85rem;
}

/* Font selector strip */
.cfx-music-font-bar {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cfx-music-font-select {
    flex: 1;
    max-width: 400px;
}

/* Three-column grid */
.cfx-music-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
    flex: 1;
    min-height: 0;
    align-content: start;
}

.cfx-music-card {
    border: 1px solid rgba(255, 136, 0, 0.15);
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cfx-music-card-title {
    color: var(--cfx-accent-2);
    letter-spacing: 0.10em;
    margin-bottom: 4px;
}

.cfx-music-action-btn {
    height: 32px;
    border-radius: 4px;
    text-transform: none;
    letter-spacing: 0.04em;
}

.cfx-music-transport {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.cfx-music-vol-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cfx-music-vol-row .mud-slider {
    flex: 1;
}

.cfx-music-vol-value {
    min-width: 30px;
    text-align: right;
    font-size: 0.85rem;
    color: var(--cfx-accent-2);
}

/* Outlined inputs inside music cards */
.cfx-music-card .mud-input-outlined {
    background: rgba(0, 0, 0, 0.18);
}

.cfx-music-card .mud-input-outlined-border {
    border-color: rgba(255, 136, 0, 0.20);
}

.cfx-music-card .mud-input-outlined:hover .mud-input-outlined-border {
    border-color: rgba(255, 136, 0, 0.38);
}

.cfx-music-font-bar .mud-input-outlined {
    background: rgba(0, 0, 0, 0.18);
}

.cfx-music-font-bar .mud-input-outlined-border {
    border-color: rgba(255, 136, 0, 0.20);
}

.cfx-music-font-bar .mud-input-outlined:hover .mud-input-outlined-border {
    border-color: rgba(255, 136, 0, 0.38);
}


