.rx-app-shell {
  display: grid;
  grid-template-columns: var(--rx-sidebar-width) minmax(0, 1fr);
  min-height: calc(100vh - 24px);
  align-items: start;
  gap: 0;
}
.rx-sidebar {
  width: var(--rx-sidebar-width);
  min-height: calc(100vh - 24px);
  align-self: start;
}
.shell { width: 100%; max-width: none; margin: 8px 0 16px; padding: 0 12px; }
.rx-workspace { min-width: 0; align-self: start; padding: 0 14px; }
.rx-workspace-tabs { min-width: 0; }

.device-rail { display: flex; min-width: 0; padding: 11px 12px 10px; flex-direction: column; border-right: 1px solid var(--rx-border); color: var(--rx-text); background: #FAFAFA; }
.rail-brand { display: flex; align-items: flex-start; gap: 9px; height: 42px; margin-bottom: 9px; }
.rail-brand-mark { display: flex; width: 32px; height: 32px; align-items: center; justify-content: center; color: var(--rx-red); }
.rail-brand-copy { display: grid; gap: 1px; }
.rail-brand-copy strong { color: var(--rx-black); font-size: 18px; line-height: 1.05; letter-spacing: -.03em; }
.rail-brand-copy small { color: var(--rx-muted); font-size: 10px; }
.rail-section { padding: 10px 0; border-top: 1px solid var(--rx-divider); }
.rail-label { display: block; margin-bottom: 7px; }
.rail-label-row { display: flex; align-items: center; justify-content: space-between; min-height: 14px; }
.rail-label-row .rail-label { margin-bottom: 7px; }
.info-icon { display: inline-flex; align-items: center; margin: -2px 1px 5px 6px; color: var(--rx-muted); }
.rail-connection > strong { display: flex; align-items: center; gap: 7px; margin-bottom: 8px; color: var(--rx-text); font-size: 12px; font-weight: 600; }
.connection-dot { width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%; background: #999; }
[data-kind="connected"] .connection-dot { background: var(--rx-connection); }
[data-kind="connecting"] .connection-dot { background: #999; }
[data-kind="error"] .connection-dot { background: var(--rx-red); }
.connection-text { color: var(--rx-text); }
.rail-device-meta { display: block; margin: -2px 0 9px; color: var(--rx-muted); font-size: 10px; }
.connection-feedback { margin: -2px 0 8px; color: var(--rx-red); font-size: 10px; line-height: 1.35; }
.connection-feedback strong { display: block; margin-bottom: 2px; }
.rail-actions { display: grid; gap: 5px; }
.rail-actions button, .rail-utility-actions button, .rail-button { width: 100%; min-height: 31px; border-color: #DADADA; color: var(--rx-text); background: var(--rx-surface); font-size: 11px; }
.rail-actions button.primary, .rail-actions #disconnect { border-color: var(--rx-red); color: #fff; background: var(--rx-red); }
.rail-actions #disconnect:disabled { border-color: var(--rx-border); color: var(--rx-muted); background: var(--rx-hover); }
.download-modes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
.download-modes button { min-width: 0; min-height: 28px; padding: 3px 2px; border-color: #DADADA; color: var(--rx-text); background: var(--rx-surface); font-size: 9px; }
.download-modes button.selected, .download-modes button[aria-pressed="true"] { border-color: var(--rx-red); color: #fff; background: var(--rx-red); }
.rail-utility-actions { display: grid; gap: 5px; }
.rail-utility-actions .rail-label { margin-bottom: 1px; }
.rail-utility-actions > button, .rail-utility-actions > .rail-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.rail-button { cursor: pointer; }
.utility-icon { display: inline-flex; width: var(--rx-icon-md); color: var(--rx-text); }
.rail-utility-actions > button:hover .utility-icon, .rail-utility-actions > .rail-button:hover .utility-icon { color: var(--rx-red); }
.rail-master-section { margin-top: auto; }
.system-set-dialog { width: min(820px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--rx-border); border-radius: 12px; color: var(--rx-text); background: var(--rx-surface); box-shadow: 0 20px 60px rgba(0, 0, 0, .2); }
.system-set-dialog::backdrop { background: rgba(0, 0, 0, .28); }
.system-set-dialog form { padding: 22px; }
.system-set-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.system-set-heading h2 { margin-top: 3px; font-size: 17px; }
.system-set-heading button { min-width: 30px; min-height: 30px; padding: 0; border: 1px solid transparent; border-radius: 50%; color: var(--rx-muted); background: transparent; font-size: 22px; line-height: 1; }
.system-set-heading button:hover { border-color: var(--rx-border); color: var(--rx-text); background: var(--rx-hover); }
.system-set-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 20px; }
.system-set-card { min-width: 0; padding: 14px; border: 1px solid var(--rx-divider); border-radius: var(--rx-radius-sm); background: var(--rx-hover); }
.system-set-card h3 { margin: 0 0 13px; color: var(--rx-text); font-size: 13px; }
.system-set-card-fields { display: grid; gap: 14px; }
.system-set-field { display: grid; grid-template-columns: minmax(72px, .8fr) minmax(80px, 1fr) 48px; align-items: center; gap: 9px; color: var(--rx-muted); font-size: 11px; }
.system-set-bound-label { white-space: nowrap; }
.system-set-slider { width: 100%; min-width: 0; }
.system-set-slider .rx-slider { width: 100%; min-width: 0; gap: 2px; }
.system-set-slider .rx-slider__labels { display: none; }
.system-set-value { width: 48px; min-height: 25px; padding: 3px 4px; color: var(--rx-text); text-align: center; }
.system-set-help { margin: 16px 0 0; color: var(--rx-muted); font-size: 10px; line-height: 1.4; }
@media (max-width: 700px) {
  .system-set-grid { grid-template-columns: 1fr; }
  .system-set-card { padding: 12px; }
}
.master-faders { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; min-height: 184px; }
.master-faders label { display: grid; grid-template-rows: 24px 126px 17px 30px; justify-items: center; gap: 4px; color: var(--rx-muted); font-size: 10px; text-align: center; }
.master-value-input { width: 42px; height: 23px; padding: 2px 4px; color: var(--rx-text); text-align: center; }
.master-mute { display: inline-flex; width: 30px; height: 30px; min-height: 30px; align-items: center; justify-content: center; padding: 0; border-color: #DADADA; color: var(--rx-text); line-height: 1; }
.master-mute.is-muted { border-color: var(--rx-red); color: var(--rx-red); background: #FFF5F5; }

.rx600-main { min-width: 0; }
.category-nav { display: flex; min-height: 54px; margin: 0 0 7px; gap: 0; overflow-x: auto; border-bottom: 1px solid var(--rx-divider); }
.category-tab { position: relative; display: inline-flex; min-width: 0; min-height: 54px; align-items: center; justify-content: center; flex: 1 1 0; gap: 8px; padding: 0 12px; border: 0; border-radius: 0; color: var(--rx-text); background: transparent; font-size: 13px; font-weight: 600; white-space: nowrap; }
.category-tab:hover:not(:disabled) { color: var(--rx-red); background: transparent; }
.category-tab.active { color: var(--rx-red); background: transparent; }
.category-tab.active::after { position: absolute; right: 12px; bottom: -1px; left: 12px; height: 2px; background: var(--rx-red); content: ''; }
.category-icon { display: inline-flex; align-items: center; color: currentColor; }
.category-content { display: grid; min-width: 0; gap: 7px; }

.config-toolbar { display: flex; min-height: 38px; align-items: center; gap: 7px; margin-top: 0; padding: 4px 2px; border-top: 1px solid var(--rx-divider); color: var(--rx-muted); }
.toolbar-value { min-width: 125px; padding: 5px 7px; border: 1px solid var(--rx-border); border-radius: var(--rx-radius-sm); color: var(--rx-text); background: var(--rx-surface); font-size: 11px; }
.config-toolbar button, .file-button { min-height: 28px; padding: 4px 8px; border-color: var(--rx-border); color: var(--rx-text); background: var(--rx-surface); font-size: 11px; cursor: pointer; }
.file-button { display: inline-flex; align-items: center; }
.import-summary { min-width: 0; overflow: hidden; color: var(--rx-muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.toast-region { position: fixed; right: 18px; bottom: 18px; z-index: 20; max-width: min(320px, calc(100vw - 36px)); margin: 0; padding: 8px 10px; border: 1px solid var(--rx-red); border-radius: var(--rx-radius-sm); color: var(--rx-red); background: #FFF5F5; box-shadow: 0 5px 18px rgba(0, 0, 0, .12); font-size: 11px; line-height: 1.35; pointer-events: auto; }
.toast-region::backdrop { display: none; }
.toast-item + .toast-item { margin-top: 6px; }
.toast-region[hidden] { display: none; }
.connection-footer { display: flex; min-height: 22px; align-items: center; justify-content: space-between; padding: 4px 2px; color: var(--rx-muted); font-size: 10px; }

.advanced-panel { margin-top: 8px; padding: 0; border: 1px solid var(--rx-border); border-radius: var(--rx-radius-sm); background: var(--rx-surface); box-shadow: none; }
.advanced-panel > summary { min-height: 36px; padding: 9px 11px; color: var(--rx-text); cursor: pointer; font-size: 11px; font-weight: 700; list-style-position: inside; }
.advanced-content { display: grid; gap: 12px; padding: 0 11px 11px; }
.debug-section { padding-top: 11px; border-top: 1px solid var(--rx-divider); }
.section-heading { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 12px; }
.section-heading h2 { margin-top: 3px; font-size: 13px; }
.section-heading strong { color: var(--rx-red); font-size: 13px; }
.transport-select-label { display: flex; margin-top: 10px; align-items: center; gap: 10px; color: var(--rx-muted); font-size: 11px; }
.transport-select-label select { min-height: 30px; padding: 4px 7px; border: 1px solid var(--rx-border); border-radius: var(--rx-radius-sm); color: var(--rx-text); background: var(--rx-surface); }
.transport-help, .debug-caption { display: block; margin-top: 7px; color: var(--rx-muted); font-size: 10px; line-height: 1.45; }
.debug-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.debug-actions button { font-size: 10px; }
.debug-checkbox { display: flex; margin-top: 9px; align-items: center; gap: 6px; color: var(--rx-muted); font-size: 10px; }
.raw-state { min-height: 45px; max-height: 260px; overflow: auto; margin: 8px 0 0; padding: 9px; border: 1px solid var(--rx-border); border-radius: var(--rx-radius-sm); color: #444; background: #FAFAFA; font: 10px/1.5 ui-monospace, monospace; white-space: pre-wrap; word-break: break-word; }
.monitor { min-height: 150px; max-height: 300px; overflow: auto; margin-top: 8px; padding: 9px; border: 1px solid #333; border-radius: var(--rx-radius-sm); color: #E8E8E8; background: #1D1D1D; font: 10px/1.5 ui-monospace, monospace; }
.log-line { white-space: pre-wrap; word-break: break-word; }
.log-tx, .log-rx, .log-info, .log-error { color: #E8E8E8; }
.status-table-wrap { max-width: 100%; overflow-x: auto; margin-top: 8px; }
.status-table-wrap table { width: 100%; border-collapse: collapse; font-size: 10px; white-space: nowrap; }
.status-table-wrap th, .status-table-wrap td { padding: 6px; border-bottom: 1px solid var(--rx-divider); text-align: left; }
.status-badge { display: inline-block; padding: 2px 5px; border: 1px solid var(--rx-border); border-radius: 3px; color: var(--rx-muted); background: var(--rx-surface); font: 9px ui-monospace, monospace; }
.status-unknown, .status-failed_probe { color: var(--rx-red); border-color: var(--rx-red); background: #FFF4F4; }
.progress-list { display: grid; gap: 7px; margin-top: 10px; }
.progress-row { display: grid; grid-template-columns: 150px 1fr 42px; gap: 8px; align-items: center; color: var(--rx-muted); font-size: 10px; }
progress { width: 100%; height: 7px; accent-color: var(--rx-red); }
.id05-debug-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.id05-calibration { margin-top: 9px; }
.calibration-actions { align-items: center; }
.calibration-actions input { min-height: 30px; padding: 4px 7px; border: 1px solid var(--rx-border); border-radius: var(--rx-radius-sm); }

@media (max-width: 1000px) {
  .eq-top-row { grid-template-columns: minmax(0, 1fr) 140px; }
  .rx-peq { padding-inline: 9px; }
}
@media (max-width: 820px) {
  .rx-app-shell { grid-template-columns: 1fr; }
  .rx-sidebar { width: auto; min-height: auto; }
  .device-rail { border-right: 0; border-bottom: 1px solid var(--rx-border); }
  .rail-master-section { display: none; }
  .eq-top-row { grid-template-columns: minmax(0, 1fr) 120px; }
  .band-editor-pane { grid-template-columns: 50px minmax(0, 1fr); }
  .id05-debug-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .shell { margin: 8px 0 14px; padding: 0 8px; }
  .rx-workspace { padding-inline: 0; }
  .category-tab { padding-inline: 8px; }
  .category-tab.active::after { right: 8px; left: 8px; }
  .eq-top-row { grid-template-columns: minmax(0, 1fr); }
  .rx-peq { grid-row: auto; grid-column: 1; border-top: 1px solid var(--rx-divider); border-left: 0; }
  .config-toolbar { flex-wrap: wrap; }
  .import-summary { flex-basis: 100%; }
}
