:root {
  color-scheme: light;
  --bg: oklch(0.982 0 0);
  --surface: oklch(1 0 0);
  --surface-soft: oklch(0.963 0.004 250);
  --sidebar: oklch(0.205 0.022 255);
  --sidebar-2: oklch(0.260 0.024 255);
  --ink: oklch(0.205 0.022 255);
  --muted: oklch(0.468 0.024 255);
  --line: oklch(0.895 0.010 255);
  --line-strong: oklch(0.815 0.014 255);
  --primary: oklch(0.405 0.112 142);
  --primary-soft: oklch(0.938 0.040 142);
  --accent: oklch(0.560 0.115 235);
  --success: oklch(0.465 0.115 145);
  --danger: oklch(0.540 0.160 28);
  --warning: oklch(0.690 0.130 78);
  --neutral-200: oklch(0.906 0.006 255);
  --radius: 8px;
  --focus: 0 0 0 3px oklch(0.760 0.090 235 / 0.36);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg);
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

button,
select,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

button,
.tab,
.audio-pack-row > button,
.firmware-row > button,
.resource-row > button,
.target-device-card > button,
.audio-sequence-item,
.audio-pack-card,
.device-row,
.job-card,
.update-card {
  transition:
    transform 160ms ease,
    background-color 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    color 160ms ease,
    opacity 160ms ease;
}

button:hover,
.tab:hover,
.audio-pack-row > button:hover,
.firmware-row > button:hover,
.resource-row > button:hover,
.target-device-card > button:hover,
.icon-text-button:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

button:active,
.tab:active,
.icon-text-button:active,
.icon-button:active {
  transform: translateY(0) scale(0.985);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.64;
  transform: none;
}

h1,
h2,
h3,
p,
dl {
  margin: 0;
}

h1,
h2,
h3 {
  text-wrap: balance;
}

.console-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.side-nav {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px;
  color: oklch(0.955 0 0);
  background: linear-gradient(180deg, var(--sidebar), oklch(0.155 0.018 255));
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  min-height: 48px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  color: oklch(0.985 0 0);
  background: var(--primary);
}

.brand-mark svg,
.tab-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand-mark svg {
  width: 26px;
  height: 26px;
}

.brand strong {
  display: block;
  font-size: 16px;
  line-height: 1.25;
}

.brand small,
.side-status dt {
  color: oklch(0.755 0.020 255);
}

.module-nav {
  display: grid;
  gap: 6px;
}

.tab {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 56px;
  padding: 10px;
  border: 0;
  border-radius: 8px;
  color: oklch(0.850 0.014 255);
  background: transparent;
  text-align: left;
}

.tab:hover {
  background: oklch(1 0 0 / 0.07);
  color: oklch(0.985 0 0);
}

.tab.active {
  color: oklch(0.985 0 0);
  background: var(--sidebar-2);
}

.tab-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  color: oklch(0.820 0.018 255);
  background: oklch(1 0 0 / 0.08);
}

.tab.active .tab-icon {
  color: oklch(0.985 0 0);
  background: var(--primary);
}

.tab strong,
.tab small {
  display: block;
}

.tab strong {
  font-size: 14px;
}

.tab small {
  margin-top: 2px;
  color: oklch(0.700 0.020 255);
  font-size: 12px;
}

.side-status {
  margin-top: auto;
  padding: 12px;
  border-radius: 8px;
  background: oklch(1 0 0 / 0.06);
}

.side-status dl {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.side-status div {
  display: grid;
  gap: 2px;
}

.side-status dt {
  font-size: 12px;
}

.side-status dd {
  margin: 0;
  color: oklch(0.930 0.006 255);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.workspace {
  min-width: 0;
  padding: 22px 24px 36px;
}

.workspace-header,
.section-head,
.panel-head,
.toolbar,
.top-actions,
.status-pill,
.legend span {
  display: flex;
  align-items: center;
}

.workspace-header {
  position: sticky;
  top: 0;
  z-index: 5;
  justify-content: space-between;
  gap: 16px;
  min-height: 72px;
  padding: 0 0 16px;
  background: linear-gradient(180deg, var(--bg) 72%, oklch(0.982 0 0 / 0));
}

h1 {
  font-size: 28px;
  line-height: 1.18;
  font-weight: 760;
}

.workspace-header p,
.section-head p,
.panel small,
.metric-cell span,
.attention-list span,
.upgrade-card span,
.upgrade-card small,
label span {
  color: var(--muted);
}

.workspace-header p {
  margin-top: 5px;
  font-size: 14px;
}

.top-actions,
.toolbar {
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.selection-count {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 4px;
  color: var(--muted);
  font-size: 13px;
}

.status-pill,
.icon-button,
.primary-button,
.ghost-button,
.danger-button,
select,
input,
textarea {
  height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
}

textarea {
  min-height: 84px;
  height: auto;
  padding: 9px 10px;
  resize: vertical;
}

.status-pill {
  justify-content: center;
  gap: 8px;
  min-width: 86px;
  padding: 0 10px;
  color: oklch(0.910 0.004 255);
  background: oklch(1 0 0 / 0.08);
  border-color: oklch(1 0 0 / 0.10);
}

.dot,
.device-status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--warning);
}

.status-pill.ok .dot,
.device-row.online .device-status-dot {
  background: var(--success);
}

.status-pill.fail .dot,
.device-row.offline .device-status-dot {
  background: var(--danger);
}

.icon-button {
  width: 38px;
  padding: 0;
}

.primary-button,
.ghost-button,
.danger-button {
  padding: 0 13px;
}

.primary-button {
  border-color: var(--primary);
  color: oklch(0.990 0 0);
  background: var(--primary);
  box-shadow: 0 1px 0 color-mix(in oklab, var(--primary) 22%, transparent);
}

.ghost-button:hover,
.icon-button:hover {
  border-color: var(--accent);
  background: var(--surface-soft);
}

.primary-button:hover {
  box-shadow: 0 6px 14px color-mix(in oklab, var(--primary) 12%, transparent);
}

.danger-button {
  border-color: color-mix(in oklab, var(--danger) 42%, var(--line));
  color: var(--danger);
  background: color-mix(in oklab, var(--danger) 7%, var(--surface));
}

.danger-button:hover {
  border-color: var(--danger);
  background: color-mix(in oklab, var(--danger) 11%, var(--surface));
  box-shadow: 0 4px 10px color-mix(in oklab, var(--danger) 8%, transparent);
}

.primary-button:active {
  box-shadow: 0 2px 6px color-mix(in oklab, var(--primary) 10%, transparent);
}

.ghost-button:hover,
.icon-button:hover,
.icon-text-button:hover {
  box-shadow: 0 4px 10px color-mix(in oklab, var(--accent) 8%, transparent);
}

.status-pill:hover {
  transform: translateY(-1px);
}

.icon-text-button {
  transition:
    transform 160ms ease,
    background-color 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    color 160ms ease,
    opacity 160ms ease;
}

.icon-text-button:hover {
  border-color: var(--accent);
  color: var(--ink);
}

@media (prefers-reduced-motion: reduce) {
  button,
  .tab,
  .audio-pack-row > button,
  .firmware-row > button,
  .resource-row > button,
  .target-device-card > button,
  .audio-sequence-item,
  .audio-pack-card,
  .device-row,
  .job-card,
  .update-card,
  .icon-text-button,
  .icon-button,
  .status-pill {
    transition: none;
  }

  button:hover,
  .tab:hover,
  .audio-pack-row > button:hover,
  .firmware-row > button:hover,
  .resource-row > button:hover,
  .target-device-card > button:hover,
  .icon-text-button:hover,
  .icon-button:hover,
  .status-pill:hover {
    transform: none;
    box-shadow: none;
  }

  button:active,
  .tab:active,
  .icon-text-button:active,
  .icon-button:active {
    transform: none;
  }
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.control-board {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 14px;
}

.panel,
.status-panel,
.attention-panel,
.upgrade-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.status-panel,
.attention-panel {
  overflow: hidden;
}

.panel-head {
  justify-content: space-between;
  gap: 14px;
  min-height: 58px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.panel-head.compact {
  min-height: 52px;
}

h2 {
  font-size: 20px;
  line-height: 1.24;
}

h3 {
  font-size: 16px;
}

.server-state {
  min-width: 56px;
  padding: 5px 9px;
  border-radius: 999px;
  color: var(--primary);
  background: var(--primary-soft);
  font-size: 13px;
  text-align: center;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}

.metric-cell {
  min-height: 104px;
  padding: 16px;
  border-right: 1px solid var(--line);
}

.metric-cell:last-child {
  border-right: 0;
}

.metric-cell strong {
  display: block;
  margin-top: 12px;
  font-size: 34px;
  line-height: 1;
}

.home-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.home-summary div {
  min-height: 92px;
  padding: 16px;
  border-right: 1px solid var(--line);
}

.home-summary div:last-child {
  border-right: 0;
}

.home-summary span,
.home-summary small {
  display: block;
  color: var(--muted);
}

.home-summary strong {
  display: block;
  margin: 9px 0 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 18px;
}

.local-mode-panel {
  margin-top: 14px;
  overflow: hidden;
}

.mode-badge {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--primary);
  background: var(--primary-soft);
  font-size: 13px;
  white-space: nowrap;
}

.local-mode-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}

.local-endpoint-card {
  display: grid;
  gap: 7px;
  min-height: 104px;
  padding: 16px;
  border-right: 1px solid var(--line);
}

.local-endpoint-card:last-child {
  border-right: 0;
}

.local-endpoint-card.emphasis {
  background: color-mix(in oklab, var(--primary-soft) 55%, var(--surface));
}

.local-endpoint-card span,
.local-endpoint-card small,
.local-diagnostics dt {
  color: var(--muted);
}

.local-endpoint-card strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 16px;
  line-height: 1.35;
}

.local-diagnostics {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 14px 16px;
}

.local-diagnostics dl {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.local-diagnostics div {
  min-width: 0;
}

.local-diagnostics dt {
  margin-bottom: 4px;
  font-size: 12px;
}

.local-diagnostics dd {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.record-source-badge {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.record-source-badge.local {
  color: var(--primary);
  background: var(--primary-soft);
}

.record-source-badge.cloud {
  color: var(--accent);
  background: color-mix(in oklab, var(--accent) 10%, var(--surface));
}

.local-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.home-analytics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.home-chart-panel {
  min-height: 216px;
  overflow: visible;
  transition:
    border-color 160ms ease,
    background-color 160ms ease,
    transform 160ms cubic-bezier(0.22, 1, 0.36, 1);
}

.home-chart-panel:hover {
  border-color: var(--line-strong);
  background: color-mix(in oklab, var(--surface) 92%, var(--surface-soft));
  transform: translateY(-1px);
}

.mini-chart-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 0;
}

.mini-chart-head small,
.chart-footnote {
  color: var(--muted);
}

.home-chart-body {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  padding: 14px 16px 10px;
}

.chart-footnote {
  display: block;
  padding: 0 16px 14px;
  font-size: 12px;
}

.attention-list {
  display: grid;
}

.attention-list div {
  display: grid;
  gap: 6px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.attention-list div:last-child {
  border-bottom: 0;
}

.attention-list strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.route-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.route-row {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 58px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--surface);
  text-align: left;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.route-row:hover {
  border-color: var(--accent);
  background: var(--surface-soft);
  transform: translateY(-1px);
}

.route-row span {
  font-weight: 750;
}

.route-row strong {
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}

.route-row em {
  color: var(--primary);
  font-style: normal;
  font-weight: 750;
}

.section-head {
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.section-head h2 {
  margin-bottom: 4px;
}

.device-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 370px;
  gap: 14px;
}

.device-list {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.device-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  transition: background 160ms ease, border-color 160ms ease;
}

.device-row:hover {
  border-color: var(--accent);
  background: var(--surface-soft);
}

.device-row input {
  width: 18px;
  height: 18px;
}

.device-open {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 6px;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.device-open small,
.device-open em {
  color: var(--muted);
  font-style: normal;
}

.device-row-meta {
  display: grid;
  gap: 3px;
  justify-items: end;
  min-width: 126px;
}

.device-auth-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  color: var(--primary);
  background: var(--primary-soft);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.device-auth-pill.muted {
  color: var(--muted);
  background: var(--neutral-200);
}

.device-mode-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.device-mode-pill.local {
  color: var(--primary);
  background: var(--primary-soft);
}

.device-mode-pill.cloud {
  color: var(--accent);
  background: color-mix(in oklab, var(--accent) 10%, var(--surface));
}

.device-mode-pill.custom {
  color: var(--muted);
  background: var(--neutral-200);
}

.device-row-meta small {
  max-width: 150px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-profile-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.device-profile-form input,
.device-profile-form textarea,
.bulk-config-grid input {
  width: 100%;
}

.field-error-text {
  min-height: 1em;
  color: var(--danger);
  font-size: 12px;
  line-height: 1.15;
}

input.field-error,
textarea.field-error,
select.field-error {
  border-color: var(--danger);
}

.device-profile-form .full-line,
.device-profile-form button,
.device-profile-form .device-form-actions {
  grid-column: 1 / -1;
}

.device-profile-form .checkbox-line {
  grid-column: 1 / -1;
}

.device-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.device-form-actions .ghost-button,
.device-form-actions .primary-button {
  flex: 1 1 180px;
}

.mode-field {
  display: grid;
  gap: 5px;
}

.mode-field > span {
  color: var(--muted);
}

.checkbox-line {
  align-content: end;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
}

.checkbox-line input {
  min-width: 0;
  width: 18px;
  height: 18px;
}

.mode-switch {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.mode-switch label {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
}

.mode-switch label:hover {
  border-color: var(--accent);
  background: var(--surface-soft);
}

.mode-switch input {
  min-width: 0;
  width: 16px;
  height: 16px;
}

.mode-switch-hint {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.device-storage-panel {
  display: grid;
  gap: 12px;
  padding: 14px 16px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.storage-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.storage-head h4 {
  margin: 0;
  font-size: 15px;
}

.storage-head small {
  max-width: 190px;
  color: var(--muted);
  text-align: right;
}

.device-storage-visual {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.storage-metrics {
  display: grid;
  gap: 7px;
}

.storage-metrics div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--line);
}

.storage-metrics div:last-child {
  border-bottom: 0;
}

.storage-metrics span,
.storage-breakdown {
  color: var(--muted);
  font-size: 12px;
}

.storage-metrics strong {
  color: var(--ink);
  font-size: 13px;
  white-space: nowrap;
}

.storage-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.storage-breakdown span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}

.storage-breakdown i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.bulk-config-panel {
  margin-top: 14px;
}

.bulk-config-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) repeat(4, minmax(140px, 1fr)) repeat(3, minmax(160px, 1fr)) auto;
  gap: 10px;
  align-items: end;
  padding: 14px 16px 16px;
}

.bulk-deploy-mode-group {
  display: grid;
  gap: 6px;
  align-self: stretch;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.bulk-deploy-mode-group > span {
  color: var(--muted);
  font-size: 12px;
}

.bulk-deploy-mode-group small {
  color: var(--muted);
  font-size: 12px;
}

.bulk-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.detail-list {
  display: grid;
  padding: 8px 16px 16px;
}

.detail-list div {
  display: grid;
  grid-template-columns: 106px minmax(0, 1fr);
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.detail-list dt {
  color: var(--muted);
}

.detail-list dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.detail-list .auth-yes {
  color: var(--primary);
  font-weight: 700;
}

.detail-list .auth-no {
  color: var(--muted);
}

.filters-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

label {
  display: grid;
  gap: 5px;
}

select,
input {
  min-width: 150px;
  padding: 0 10px;
}

.analytics-grid {
  display: grid;
  grid-template-columns: 0.8fr 0.8fr 1.15fr 1.35fr;
  gap: 14px;
  margin-bottom: 14px;
}

.stat-panel {
  min-height: 162px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.stat-panel strong {
  font-size: 42px;
  line-height: 1;
}

.chart-panel {
  min-height: 194px;
  overflow: visible;
}

.donut-wrap {
  display: grid;
  grid-template-columns: 142px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  padding: 16px;
}

.donut-shell {
  width: 132px;
  height: 132px;
}

.segmented-donut {
  width: 132px;
  height: 132px;
  position: relative;
  isolation: isolate;
}

.segmented-donut.compact,
.segmented-donut.compact svg {
  width: 124px;
  height: 124px;
}

.segmented-donut svg {
  width: 132px;
  height: 132px;
  overflow: visible;
}

.donut-track,
.donut-segment {
  fill: none;
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
}

.donut-track {
  stroke: var(--neutral-200);
  stroke-width: 10;
}

.donut-segment {
  stroke: var(--segment-color);
  stroke-width: 11;
  opacity: 0.92;
  animation: donut-draw 360ms cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: var(--segment-delay, 0ms);
  transition:
    opacity 160ms ease,
    stroke-width 160ms cubic-bezier(0.22, 1, 0.36, 1),
    filter 160ms ease;
}

.segmented-donut.compact .donut-track {
  stroke-width: 14;
}

.segmented-donut.compact .donut-segment {
  stroke-width: 15;
}

.donut-arcs:hover .donut-segment {
  opacity: 0.48;
}

.donut-arcs .donut-segment:hover {
  opacity: 1;
  stroke-width: 14;
  filter: saturate(1.14) drop-shadow(0 4px 8px oklch(0.205 0.022 255 / 0.14));
}

.segmented-donut.compact .donut-arcs .donut-segment:hover {
  stroke-width: 18;
}

.donut-center {
  display: grid;
  place-items: center;
  position: absolute;
  inset: 26px;
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink);
  font-weight: 780;
  line-height: 1.05;
  text-align: center;
  box-shadow: inset 0 0 0 1px oklch(0.205 0.022 255 / 0.045);
}

.segmented-donut.compact .donut-center {
  inset: 31px;
}

.donut-center span {
  font-size: 20px;
}

.segmented-donut.compact .donut-center span {
  font-size: 18px;
}

.donut-center small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
}

.donut-float-tip {
  position: absolute;
  z-index: 6;
  left: var(--tip-x, 50%);
  top: var(--tip-y, 0%);
  max-width: 220px;
  padding: 7px 9px;
  border-radius: 7px;
  color: oklch(0.985 0 0);
  background: oklch(0.205 0.022 255);
  box-shadow: 0 8px 18px oklch(0.205 0.022 255 / 0.18);
  font-size: 12px;
  font-style: normal;
  line-height: 1.35;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -100%) translateY(-8px);
  transition: opacity 120ms ease, transform 120ms cubic-bezier(0.22, 1, 0.36, 1);
}

.segmented-donut.tip-visible .donut-float-tip {
  opacity: 1;
  transform: translate(-50%, -100%) translateY(-12px);
}

.week-bar::before,
.legend span::before {
  content: attr(data-tip);
  position: absolute;
  z-index: 4;
  left: 50%;
  bottom: calc(100% + 8px);
  max-width: 220px;
  padding: 7px 9px;
  border-radius: 7px;
  color: oklch(0.985 0 0);
  background: oklch(0.205 0.022 255);
  box-shadow: 0 8px 18px oklch(0.205 0.022 255 / 0.18);
  font-size: 12px;
  line-height: 1.35;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 4px);
  transition: opacity 140ms ease, transform 140ms cubic-bezier(0.22, 1, 0.36, 1);
}

.week-bar:hover::before,
.legend span:hover::before {
  opacity: 1;
  transform: translate(-50%, 0);
}

@keyframes donut-draw {
  from {
    stroke-dashoffset: 0;
    opacity: 0.34;
  }
}

.legend {
  display: grid;
  gap: 8px;
}

.compact-legend {
  gap: 7px;
}

.legend span {
  position: relative;
  gap: 8px;
  color: var(--muted);
  width: max-content;
  cursor: default;
  transition: color 160ms ease;
}

.legend span:hover {
  color: var(--ink);
}

.legend i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.legend .green { background: var(--success); }
.legend .red { background: var(--danger); }
.legend .gray { background: var(--neutral-200); }

.progress {
  height: 8px;
  border-radius: 999px;
  background: var(--neutral-200);
  overflow: hidden;
}

.progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.weekly-bars {
  display: grid;
  grid-template-columns: repeat(7, minmax(28px, 1fr));
  gap: 10px;
  align-items: end;
  min-height: 126px;
  padding: 22px 16px 16px;
}

.week-bar {
  position: relative;
  display: grid;
  grid-template-rows: 1fr auto auto;
  gap: 5px;
  align-items: end;
  min-height: 116px;
  text-align: center;
  cursor: default;
}

.week-stack {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  width: 100%;
  min-height: 2px;
  border-radius: 7px 7px 4px 4px;
  background: var(--neutral-200);
  overflow: hidden;
  box-shadow: inset 0 0 0 1px oklch(0.205 0.022 255 / 0.05);
  transform-origin: bottom;
  animation: bar-rise 260ms cubic-bezier(0.22, 1, 0.36, 1) both;
  transition: transform 160ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 160ms ease;
}

.week-stack i {
  display: block;
  width: 100%;
  min-height: 0;
  transition: filter 160ms ease;
}

.week-bar:hover .week-stack {
  transform: translateY(-2px);
  box-shadow: inset 0 0 0 1px oklch(0.205 0.022 255 / 0.06), 0 8px 18px oklch(0.205 0.022 255 / 0.12);
}

.week-bar:hover .week-stack i {
  filter: saturate(1.12);
}

.week-pass {
  background: var(--success);
}

.week-fail {
  background: var(--danger);
}

.week-bar strong {
  font-size: 12px;
}

.week-bar span {
  color: var(--muted);
  font-size: 12px;
}

@keyframes bar-rise {
  from {
    opacity: 0.72;
    transform: scaleY(0.82);
  }
  to {
    opacity: 1;
    transform: scaleY(1);
  }
}

.records-panel {
  margin-bottom: 18px;
}

.table-wrap {
  overflow: auto;
  max-height: 520px;
}

table {
  width: 100%;
  min-width: 1080px;
  border-collapse: collapse;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
  font-size: 14px;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: oklch(0.330 0.024 255);
  background: var(--surface-soft);
}

tbody tr:hover {
  background: var(--surface-soft);
}

tbody tr.row-cc-fail {
  background: oklch(0.970 0.020 28);
}

tbody tr.row-cc-fail:hover {
  background: oklch(0.950 0.030 28);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 50px;
  height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 13px;
  font-weight: 760;
}

.badge.pass {
  color: oklch(0.285 0.090 145);
  background: oklch(0.934 0.052 145);
}

.badge.fail {
  color: oklch(0.360 0.120 28);
  background: oklch(0.938 0.046 28);
}

.badge.unknown {
  color: var(--muted);
  background: var(--neutral-200);
}

.time-source-badge {
  display: inline-flex;
  align-items: center;
  height: 20px;
  margin-left: 8px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--neutral-200);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  vertical-align: middle;
}

.upgrade-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.upgrade-card {
  min-height: 150px;
  padding: 16px;
}

.upgrade-card strong {
  display: block;
  margin: 18px 0 10px;
  font-size: 24px;
}

.resource-console,
.ota-console {
  display: grid;
  grid-template-columns: minmax(360px, 0.75fr) minmax(0, 1.25fr);
  gap: 14px;
  margin-bottom: 14px;
}

.compact-list {
  padding: 0;
}

.firmware-uploader {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) auto;
  gap: 10px;
  align-items: end;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.firmware-uploader input {
  width: 100%;
}

.firmware-list {
  display: grid;
  gap: 8px;
  padding: 14px 16px 16px;
}

.firmware-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  transition: border-color 160ms ease, background 160ms ease;
}

.firmware-row:hover,
.firmware-row.active {
  border-color: var(--accent);
  background: var(--surface-soft);
}

.firmware-row.active {
  box-shadow: inset 0 0 0 1px var(--accent);
}

.firmware-row > button:first-child {
  min-height: 72px;
  padding: 10px 12px;
  border: 0;
  color: inherit;
  background: transparent;
  text-align: left;
}

.firmware-row > .icon-text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 10px;
  text-decoration: none;
}

.firmware-row strong,
.firmware-row small,
.firmware-row em {
  display: block;
}

.firmware-row small,
.firmware-row em {
  color: var(--muted);
  font-style: normal;
}

.firmware-row em {
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.firmware-url {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
}

.firmware-url b {
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.firmware-url.ok b {
  color: var(--success);
  background: oklch(0.950 0.035 145);
}

.firmware-url.warn b {
  color: var(--danger);
  background: oklch(0.955 0.035 28);
}

.firmware-url i {
  min-width: 0;
  overflow: hidden;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-detail-list {
  display: grid;
  gap: 6px;
  margin: 0;
}

.mini-detail-list div {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 8px;
}

.mini-detail-list dt {
  color: var(--muted);
}

.mini-detail-list dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.write-mode-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.mode-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  min-height: 70px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  transition: border-color 160ms ease, background 160ms ease;
}

.mode-option:hover {
  border-color: var(--accent);
}

.mode-option input {
  width: 18px;
  height: 18px;
  min-width: 0;
  margin-top: 2px;
}

.mode-option strong,
.mode-option small {
  display: block;
}

.mode-option small {
  margin-top: 4px;
  line-height: 1.45;
}

.danger-option {
  border-color: oklch(0.875 0.035 28);
  background: oklch(0.982 0.010 28);
}

.audio-pack-board {
  display: grid;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.audio-main-surface {
  display: grid;
  gap: 18px;
}

.subview-head {
  padding: 0 2px;
}

#view-audio-pack.view.active {
  display: grid;
  gap: 12px;
  align-content: start;
}

.audio-editor-panel {
  overflow: hidden;
}

.audio-pack-topbar {
  display: flex;
  justify-content: flex-end;
  padding: 2px 2px 0;
}

.audio-pack-library {
  padding-top: 0;
}

.audio-pack-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(140px, 0.72fr) minmax(220px, 1.15fr) auto;
  gap: 10px;
  align-items: end;
}

.audio-pack-form input {
  width: 100%;
}

.audio-pack-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.audio-pack-list {
  display: grid;
  gap: 8px;
}

.audio-sequence-panel {
  display: grid;
  gap: 8px;
  padding-top: 0;
}

.audio-sequence-list {
  display: grid;
  gap: 8px;
}

.audio-sequence-item {
  display: grid;
  grid-template-columns: 28px 34px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 58px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, opacity 180ms ease;
}

.audio-sequence-item:hover {
  border-color: var(--accent);
  background: var(--surface-soft);
}

.audio-sequence-item.dragging {
  opacity: 0.58;
  transform: scale(0.985);
}

.audio-sequence-item.over {
  transform: translateY(4px);
  border-color: var(--primary);
  background: var(--primary-soft);
}

.sequence-drag-handle {
  display: grid;
  grid-template-columns: repeat(2, 4px);
  grid-auto-rows: 4px;
  gap: 4px;
  place-content: center;
  width: 28px;
  height: 34px;
  border: 0;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
  cursor: grab;
}

.sequence-drag-handle:active {
  cursor: grabbing;
}

.sequence-drag-handle span {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
}

.audio-sequence-item > strong {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  color: var(--primary);
  background: var(--primary-soft);
  font-size: 13px;
}

.audio-sequence-item div {
  min-width: 0;
}

.audio-sequence-item div span,
.audio-sequence-item div small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.audio-sequence-item div small {
  margin-top: 3px;
  color: var(--muted);
}

.audio-pack-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  transition: border-color 160ms ease, background 160ms ease;
}

.audio-pack-row:hover,
.audio-pack-row.active {
  border-color: var(--accent);
  background: var(--surface-soft);
}

.audio-pack-row.active {
  box-shadow: inset 0 0 0 1px var(--accent);
}

.audio-pack-row > button:first-child {
  min-height: 82px;
  padding: 10px 12px;
  border: 0;
  color: inherit;
  background: transparent;
  text-align: left;
}

.audio-pack-row > .icon-text-button {
  align-self: center;
  margin-right: 0;
}

.audio-pack-row > .icon-text-button:last-child {
  margin-right: 10px;
}

.audio-pack-row strong,
.audio-pack-row small,
.audio-pack-row em {
  display: block;
}

.audio-pack-row small,
.audio-pack-row em {
  color: var(--muted);
  font-style: normal;
}

.audio-pack-row em {
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.audio-pack-row small:nth-of-type(2) {
  margin-top: 3px;
}

.library-subhead {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px 0;
}

.library-subhead h3 {
  font-size: 16px;
}

.library-subhead small {
  color: var(--muted);
}

.audio-upload-grid {
  display: grid;
  grid-template-columns: minmax(240px, 1.25fr) minmax(190px, 1fr) minmax(150px, 0.75fr) auto;
  gap: 10px;
  align-items: end;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.audio-upload-grid input,
.audio-upload-grid select {
  width: 100%;
}

.audio-upload-grid button {
  justify-self: start;
}

.file-picker input {
  padding-top: 7px;
}

.resource-list,
.audio-target-list {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.resource-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  min-height: 62px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  transition: background 160ms ease, border-color 160ms ease;
}

.resource-row:hover,
.target-device-card:hover {
  border-color: var(--accent);
  background: var(--surface-soft);
}

.resource-row.protected {
  color: var(--muted);
  background: var(--surface-soft);
}

.resource-row input {
  width: 18px;
  height: 18px;
  min-width: 0;
}

.resource-pick {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.resource-row strong,
.resource-row small,
.resource-row em {
  display: block;
}

.resource-row small,
.resource-row em,
.installed-audio-list small,
.target-device-head small {
  color: var(--muted);
  font-style: normal;
}

.resource-row em {
  font-size: 13px;
  white-space: nowrap;
}

.target-device-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  transition: background 160ms ease, border-color 160ms ease;
}

.target-device-head {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.target-device-head input {
  width: 18px;
  height: 18px;
  min-width: 0;
}

.target-device-card.offline .device-status-dot {
  background: var(--danger);
}

.audio-device-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  align-items: center;
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.audio-count-pill {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.audio-count-pill.ready {
  color: var(--success);
  background: color-mix(in oklab, var(--success) 12%, var(--surface-soft));
}

.audio-count-pill.updating {
  color: var(--warning);
  background: color-mix(in oklab, var(--warning) 14%, var(--surface-soft));
}

.icon-text-button {
  height: 30px;
  padding: 0 9px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  color: var(--muted);
  background: var(--surface);
}

.danger-button {
  border-color: var(--danger);
  background: var(--danger);
}

.installed-audio-list {
  display: grid;
  gap: 6px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.installed-audio-list li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 9px;
  border-radius: 7px;
  background: var(--surface-soft);
}

.installed-audio-list span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.audio-device-detail {
  display: none;
  gap: 10px;
}

.target-device-card.expanded .audio-device-detail {
  display: grid;
}

.audio-device-storage {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 9px;
  border-radius: 7px;
  background: var(--surface-soft);
}

.audio-device-storage small {
  color: var(--muted);
}

.audio-device-storage {
  flex-wrap: wrap;
}

.job-list {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.job-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.job-card small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.job-status {
  align-self: start;
  padding: 3px 8px;
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 12px;
  font-weight: 700;
}

.job-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.job-cancel-button,
.job-delete-button {
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface);
  font-size: 12px;
  font-weight: 700;
  transition: border-color 160ms ease, color 160ms ease, background 160ms ease;
}

.job-cancel-button:hover,
.job-delete-button:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: oklch(0.955 0.035 28);
}

.job-delete-button {
  border-color: oklch(0.840 0.040 28);
  color: var(--danger);
}

.job-status.running,
.job-status.claimed {
  color: var(--accent);
  background: oklch(0.950 0.030 235);
}

.job-status.success {
  color: var(--success);
  background: oklch(0.950 0.035 145);
}

.job-status.failed {
  color: var(--danger);
  background: oklch(0.955 0.035 28);
}

.progress {
  grid-column: 1 / -1;
}

.progress i {
  background: var(--primary);
}

.job-summary,
.job-message,
.job-device-list {
  grid-column: 1 / -1;
}

.job-message.failed {
  color: var(--danger);
}

.job-device-list {
  display: grid;
  gap: 6px;
  margin-top: 2px;
}

.job-device-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 10px;
  align-items: center;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-soft);
}

.job-device-line span,
.job-device-line em {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.job-device-line strong {
  color: var(--muted);
  font-size: 12px;
}

.job-device-line em {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.job-device-line.success strong {
  color: var(--success);
}

.job-device-line.failed strong,
.job-device-line.failed em {
  color: var(--danger);
}

.empty,
.empty-state {
  padding: 30px 16px;
  text-align: center;
  color: var(--muted);
}

.empty-state.small {
  padding: 22px 10px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
  background: oklch(0.205 0.022 255 / 0.38);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-panel {
  width: min(560px, 100%);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.modal-head,
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
}

.modal-head {
  border-bottom: 1px solid var(--line);
}

.modal-head small,
.modal-body p,
.modal-pack-list small {
  color: var(--muted);
}

.modal-body {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.modal-pack-list {
  display: grid;
  gap: 8px;
}

.modal-pack-list div {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.modal-pack-list strong,
.modal-pack-list small {
  display: block;
}

.modal-actions {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
}

@media (max-width: 1120px) {
  .console-shell {
    grid-template-columns: 1fr;
  }

  .side-nav {
    position: static;
    height: auto;
  }

  .module-nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .side-status {
    display: none;
  }

  .control-board,
  .device-layout,
  .analytics-grid,
  .upgrade-grid,
  .resource-console,
  .ota-console,
  .bulk-config-grid,
  .local-mode-grid,
  .local-diagnostics,
  .local-diagnostics dl {
    grid-template-columns: 1fr;
  }

  .mode-switch {
    grid-template-columns: 1fr;
  }

  .local-endpoint-card {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .local-actions {
    justify-content: flex-start;
  }

  .audio-upload-grid {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .audio-pack-form {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .firmware-uploader {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .audio-pack-note,
  .audio-pack-actions,
  .firmware-uploader button {
    grid-column: 1 / -1;
  }

  .write-mode-panel {
    grid-template-columns: 1fr;
  }

  .audio-upload-grid button {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .workspace {
    padding: 16px 12px 28px;
  }

  .workspace-header,
  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .module-nav,
  .metric-strip,
  .home-summary,
  .home-analytics,
  .local-diagnostics dl,
  .device-profile-form {
    grid-template-columns: 1fr;
  }

  .home-chart-body {
    grid-template-columns: 132px minmax(0, 1fr);
  }

  .metric-cell,
  .home-summary div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .metric-cell:last-child,
  .home-summary div:last-child {
    border-bottom: 0;
  }

  .filters-panel,
  .toolbar,
  .top-actions {
    align-items: stretch;
    flex-direction: column;
    width: 100%;
  }

  .primary-button,
  .ghost-button,
  select,
  input,
  textarea {
    width: 100%;
  }

  .audio-upload-grid {
    grid-template-columns: 1fr;
  }

  .audio-pack-form,
  .audio-pack-row,
  .firmware-uploader,
  .firmware-row {
    grid-template-columns: 1fr;
  }

  .audio-pack-row > .icon-text-button,
  .firmware-row > .icon-text-button {
    justify-self: start;
    margin: 0 0 10px 12px;
  }

  .audio-pack-actions {
    justify-content: stretch;
  }

  .resource-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .audio-sequence-item {
    grid-template-columns: 28px 34px minmax(0, 1fr);
  }

  .audio-sequence-item .icon-text-button {
    grid-column: 3;
    justify-self: start;
  }

  .target-device-head {
    grid-template-columns: auto auto minmax(0, 1fr);
  }

  .resource-row em,
  .resource-row .icon-text-button {
    justify-self: start;
  }

  .device-open {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .device-row-meta {
    grid-column: 2;
    justify-items: start;
    min-width: 0;
  }

  .device-storage-visual {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .storage-metrics {
    width: 100%;
  }

  .target-device-head .icon-text-button {
    grid-column: 3;
    justify-self: start;
  }

  .audio-device-storage {
    align-items: flex-start;
    flex-direction: column;
  }

  .modal-actions,
  .modal-head {
    align-items: stretch;
    flex-direction: column;
  }

  .donut-wrap {
    grid-template-columns: 1fr;
    justify-items: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}
