body[data-page="dashboard"] { overflow-x: hidden; }
.dashboard-shell { display: grid; grid-template-columns: 270px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; overflow-y: auto; padding: 20px 16px; border-right: 1px solid var(--line); background: var(--panel); scrollbar-width: none; }
.sidebar::-webkit-scrollbar { display: none; }
.sidebar-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 32px; }
.dashboard-wordmark { font-size: 1rem; font-weight: 600; letter-spacing: -.025em; }
.sidebar .theme-button { font-size: .66rem; }
.sidebar-section + .sidebar-section { margin-top: 24px; }
.device-label { margin: 0 0 9px; padding: 0 3px; color: var(--quiet); font-family: var(--font-data); font-size: .57rem; letter-spacing: .1em; text-transform: uppercase; }
.selected-device { padding: 3px; }
.selected-device strong { display: block; font-size: .95rem; font-weight: 500; letter-spacing: -.02em; }
.device-connection { display: flex; align-items: center; gap: 6px; margin-top: 5px; color: var(--muted); font-size: .69rem; }
.device-dot, .status-dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; background: var(--good); box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 15%, transparent); }
.device-dot.is-idle, .status-dot.is-idle { background: var(--quiet); box-shadow: none; }
.device-dot.is-warn, .status-dot.is-warn { background: var(--warn); box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 15%, transparent); }
.device-list { display: grid; gap: 7px; }
.empty-device-list { margin: 0; padding: 12px 3px; color: var(--quiet); font-size: .72rem; }
.device-select { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; width: 100%; padding: 11px 12px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--panel-3); text-align: left; }
.device-select strong, .device-select small { display: block; }
.device-select strong { font-size: .8rem; font-weight: 500; }
.device-select small { margin-top: 3px; color: var(--muted); font-size: .64rem; }
.device-select em { color: var(--quiet); font: normal .56rem var(--font-data); text-transform: uppercase; letter-spacing: .06em; }
.add-device-btn, .sidebar-action { width: 100%; min-height: 44px; display: flex; align-items: center; padding: 0 11px; border-radius: 8px; background: transparent; color: var(--muted); font-size: .76rem; text-align: left; }
.add-device-btn { margin-top: 8px; border: 1px solid var(--line); }
.sidebar-action { margin-top: 5px; border: 0; }
.add-device-btn:hover { border-color: var(--line-strong); color: var(--text); }
.sidebar-action:hover { background: var(--panel-2); color: var(--text); }
.sidebar-divider { width: 100%; margin: 18px 0 8px; border: 0; border-top: 1px solid var(--line); }
.sidebar-footer { display: grid; gap: 5px; margin-top: auto; padding: 20px 3px 0; color: var(--quiet); font: .55rem var(--font-data); letter-spacing: .04em; }

.control-panel { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; background: var(--bg); }
.preview-banner { min-height: 36px; display: flex; align-items: center; gap: 13px; padding: 7px 15px; border-bottom: 1px solid var(--line); background: var(--panel); color: var(--muted); font-size: .7rem; }
.preview-banner span { color: var(--text); font: .58rem var(--font-data); letter-spacing: .08em; }
.preview-banner p { margin: 0; }
.status-bar { min-height: 36px; display: flex; align-items: center; gap: 8px; padding: 7px 15px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: .7rem; }
.tab-bar { display: flex; overflow-x: auto; flex: 0 0 auto; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.tab-bar::-webkit-scrollbar { display: none; }
.tab-btn { position: relative; min-height: 44px; padding: 0 16px; border: 0; background: transparent; color: var(--quiet); font-size: .76rem; font-weight: 500; white-space: nowrap; }
.tab-btn:hover { color: var(--muted); }
.tab-btn.active { color: var(--text); }
.tab-btn.active::after { content: ""; position: absolute; right: 8px; bottom: 0; left: 8px; height: 1.5px; border-radius: 2px; background: var(--text); }
.panel-wrap { flex: 1; }
.panel { padding: 24px clamp(20px, 3vw, 34px) 96px; }
.overline { margin: 0 0 10px; color: var(--muted); font: .6rem var(--font-data); letter-spacing: .09em; }
.panel h1 { margin: 0; font-size: clamp(1.8rem, 3vw, 2.7rem); line-height: 1; letter-spacing: -.035em; font-weight: 500; }
.panel h2 { margin: 0; font-size: 1.15rem; font-weight: 500; letter-spacing: -.02em; }

.empty-state { min-height: 62vh; display: grid; align-content: center; justify-items: center; max-width: 590px; margin-inline: auto; text-align: center; }
.headphone-glyph { width: 82px; height: 82px; display: grid; place-items: center; margin-bottom: 22px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.headphone-glyph svg { width: 46px; fill: none; stroke: var(--muted); stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round; }
.empty-state h1 { font-size: clamp(2rem, 5vw, 3.6rem); }
.empty-state p { max-width: 52ch; margin: 18px auto 0; color: var(--muted); line-height: 1.6; }
.empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 26px; }
.primary-control, .secondary-control, .apply-actions button { min-height: 44px; padding: 0 15px; border-radius: 8px; font-weight: 500; }
.primary-control, .apply-actions button:last-child { border: 1px solid var(--control); background: var(--control); color: var(--control-text); }
.secondary-control, .apply-actions button:first-child { border: 1px solid var(--line); background: transparent; color: var(--muted); }
.secondary-control:hover, .apply-actions button:first-child:not(:disabled):hover { color: var(--text); border-color: var(--line-strong); }

.device-overview { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(260px, .8fr); min-height: 310px; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.device-stage { position: relative; min-height: 310px; display: grid; place-items: center; overflow: hidden; border-right: 1px solid var(--line); background: radial-gradient(circle at 50% 45%, var(--panel-3), var(--panel) 66%); }
.device-stage::before { content: ""; position: absolute; width: min(420px, 75%); aspect-ratio: 1; border: 1px solid var(--line); border-radius: 50%; }
.device-stage-icon { position: relative; width: min(185px, 42%); fill: none; stroke: var(--text); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; opacity: .86; }
.device-stage > span { position: absolute; right: 16px; bottom: 13px; color: var(--quiet); font: .55rem var(--font-data); letter-spacing: .08em; }
.device-summary { display: grid; grid-template-rows: repeat(3, 1fr); }
.device-summary > div { display: grid; align-content: center; gap: 5px; padding: 24px; }
.device-summary > div + div { border-top: 1px solid var(--line); }
.device-summary span, .summary-grid span, .readout-list span { color: var(--quiet); font-size: .66rem; text-transform: uppercase; letter-spacing: .05em; }
.device-summary strong { font-size: 1.25rem; font-weight: 500; }
.device-summary small { color: var(--muted); font-size: .72rem; }
.section-title-row { display: flex; align-items: end; justify-content: space-between; gap: 28px; margin-top: 38px; padding-bottom: 18px; }
.section-title-row p:not(.overline) { max-width: 60ch; margin: 10px 0 0; color: var(--muted); line-height: 1.55; }
.section-title-row > strong, .section-title-row > span { color: var(--muted); font: .74rem var(--font-data); }
.summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); border-block: 1px solid var(--line); }
.summary-grid > div { display: grid; gap: 6px; padding: 20px 0; }
.summary-grid > div + div { padding-left: 24px; border-left: 1px solid var(--line); }
.summary-grid strong { font-size: .9rem; font-weight: 500; }

.setting-block { margin: 0; padding: 26px 0; border: 0; border-top: 1px solid var(--line); }
.setting-block legend { width: 100%; margin-bottom: 18px; padding: 25px 0 0; color: var(--muted); font-size: .76rem; }
.option-row { display: flex; flex-wrap: wrap; gap: 8px; }
.option-row label { cursor: pointer; }
.option-row input { position: absolute; opacity: 0; pointer-events: none; }
.option-row span { min-height: 44px; display: inline-flex; align-items: center; padding: 0 14px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); font-size: .8rem; }
.option-row input:checked + span { border-color: var(--line-strong); background: var(--panel-3); color: var(--text); }
.option-row input:focus-visible + span { outline: 2px solid var(--text); outline-offset: 3px; }
.range-setting, .select-setting, .switch-setting { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 26px; }
.select-setting + .select-setting, .switch-setting + .switch-setting { border-top: 1px solid var(--line); }
.range-setting strong, .select-setting strong, .switch-setting strong { display: block; font-size: .85rem; font-weight: 500; }
.range-setting small, .select-setting small, .switch-setting small { display: block; margin-top: 4px; color: var(--muted); font-size: .72rem; line-height: 1.4; }
.range-setting input[type="range"] { width: min(260px, 40vw); accent-color: var(--text); }
.select-setting select { min-width: 190px; min-height: 44px; padding: 0 34px 0 11px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); color: var(--text); }
input[role="switch"] { appearance: none; width: 44px; height: 24px; flex: 0 0 auto; padding: 2px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--panel-3); }
input[role="switch"]::before { content: ""; display: block; width: 18px; height: 18px; border-radius: 50%; background: var(--muted); transition: transform .14s ease-out, background .14s ease-out; }
input[role="switch"]:checked { background: var(--control); border-color: var(--control); }
input[role="switch"]:checked::before { transform: translateX(18px); background: var(--control-text); }
.readout-list { margin-top: 12px; border-top: 1px solid var(--line); }
.readout-list > div { min-height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--line); }
.readout-list strong { font: 500 .72rem var(--font-data); text-align: right; }
.danger-note { display: grid; gap: 7px; margin-top: 24px; padding: 20px 0; border-block: 1px solid var(--line); }
.danger-note strong { font-size: .85rem; font-weight: 500; }
.danger-note span { max-width: 70ch; color: var(--muted); font-size: .75rem; line-height: 1.55; }

.apply-bar { position: sticky; bottom: 0; z-index: 5; min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 10px clamp(20px, 3vw, 34px); border-top: 1px solid var(--line); background: color-mix(in srgb, var(--panel) 94%, transparent); backdrop-filter: blur(12px); }
.apply-bar > div:first-child { display: grid; gap: 3px; }
.apply-bar strong { font-size: .75rem; font-weight: 500; }
.apply-bar span { color: var(--muted); font-size: .68rem; }
.apply-actions { display: flex; gap: 8px; }
.apply-actions button { min-width: 92px; }
.apply-actions button:disabled { opacity: .35; cursor: not-allowed; }

.device-dialog { width: min(560px, calc(100% - 28px)); padding: 0; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--panel); color: var(--text); box-shadow: 0 28px 90px rgb(0 0 0 / .45); }
.device-dialog::backdrop { background: rgb(0 0 0 / .64); }
.dialog-card { padding: 22px; }
.dialog-head { display: flex; align-items: start; justify-content: space-between; gap: 24px; padding-bottom: 20px; }
.dialog-head h2 { margin: 0; font-size: 1.35rem; font-weight: 500; letter-spacing: -.025em; }
.dialog-head p { margin: 7px 0 0; color: var(--muted); font-size: .78rem; }
.dialog-close { width: 44px; height: 44px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 1.35rem; }
.dialog-close:hover { background: var(--panel-2); color: var(--text); }
.transport-options { display: grid; gap: 8px; }
.transport-option { min-height: 80px; display: grid; gap: 4px; padding: 14px; border: 1px solid var(--line); border-radius: 9px; background: transparent; color: var(--text); text-align: left; }
.transport-option:hover:not(:disabled) { border-color: var(--line-strong); background: var(--panel-2); }
.transport-option:disabled { opacity: .42; cursor: not-allowed; }
.transport-option strong { font-size: .84rem; font-weight: 500; }
.transport-option span { color: var(--muted); font-size: .74rem; }
.transport-option small { color: var(--quiet); font: .58rem var(--font-data); }
.dialog-note { margin: 18px 0 0; color: var(--quiet); font-size: .68rem; line-height: 1.5; }
.compact-dialog { padding-bottom: 8px; }

@media (max-width: 860px) {
  .dashboard-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; overflow: visible; padding: 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar-header { margin-bottom: 20px; }
  .sidebar-section { display: grid; grid-template-columns: minmax(140px, .7fr) minmax(0, 1.3fr); gap: 12px 18px; align-items: start; }
  .sidebar-section + .sidebar-section { margin-top: 18px; }
  .sidebar-section .device-label { grid-column: 1 / -1; margin-bottom: 0; }
  .device-list { grid-column: 2; grid-row: 2 / span 3; }
  .add-device-btn, .sidebar-action { grid-column: 1; }
  .sidebar-divider, .sidebar > a.sidebar-action, #browserCheck, .sidebar-footer { display: none; }
  .device-overview { grid-template-columns: 1fr; }
  .device-stage { border-right: 0; border-bottom: 1px solid var(--line); }
  .device-summary { grid-template-columns: repeat(3, 1fr); grid-template-rows: none; }
  .device-summary > div + div { border-top: 0; border-left: 1px solid var(--line); }
}

@media (max-width: 590px) {
  .preview-banner { align-items: flex-start; flex-direction: column; gap: 3px; padding-block: 9px; }
  .panel { padding-inline: 16px; }
  .sidebar-section { grid-template-columns: 1fr; }
  .device-list, .add-device-btn, .sidebar-action { grid-column: 1; grid-row: auto; }
  .section-title-row { align-items: flex-start; flex-direction: column; }
  .summary-grid, .device-summary { grid-template-columns: 1fr; }
  .summary-grid > div + div, .device-summary > div + div { padding-left: 0; border-left: 0; border-top: 1px solid var(--line); }
  .device-summary > div { padding: 18px; }
  .range-setting, .select-setting, .switch-setting { align-items: flex-start; flex-direction: column; padding-block: 14px; }
  .range-setting input[type="range"], .select-setting select { width: 100%; min-width: 0; }
  .switch-setting { position: relative; padding-right: 58px; }
  .switch-setting input { position: absolute; top: 18px; right: 0; }
  .apply-bar { align-items: flex-start; flex-direction: column; }
  .apply-actions { width: 100%; }
  .apply-actions button { flex: 1; }
}

@media (prefers-reduced-motion: reduce) { input[role="switch"]::before { transition: none; } }
