:root {
  --md-primary: #3f51b5;
  --md-primary-dark: #303f9f;
  --md-primary-light: #c5cae9;
  --md-on-primary: #ffffff;
  --md-accent: #ff4081;
  --md-background: #f5f5f7;
  --md-surface: #ffffff;
  --md-text-primary: rgba(0, 0, 0, 0.87);
  --md-text-secondary: rgba(0, 0, 0, 0.6);
  --md-divider: rgba(0, 0, 0, 0.12);
  --md-error: #d32f2f;
  --md-success: #2e7d32;

  --elevation-1: 0 2px 1px -1px rgba(0, 0, 0, 0.2), 0 1px 1px 0 rgba(0, 0, 0, 0.14), 0 1px 3px 0 rgba(0, 0, 0, 0.12);
  --elevation-4: 0 2px 4px -1px rgba(0, 0, 0, 0.2), 0 4px 5px 0 rgba(0, 0, 0, 0.14), 0 1px 10px 0 rgba(0, 0, 0, 0.12);
  --elevation-8: 0 5px 5px -3px rgba(0, 0, 0, 0.2), 0 8px 10px 1px rgba(0, 0, 0, 0.14), 0 3px 14px 2px rgba(0, 0, 0, 0.12);

  --appbar-height: 64px;
  --drawer-width: 280px;

  color-scheme: light;
  font-family: 'Roboto', system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--md-background);
  color: var(--md-text-primary);
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--md-text-secondary);
  font-size: 0.875rem;
}

.error {
  color: var(--md-error);
  font-size: 0.875rem;
  margin: 0.5rem 0 0;
}

/* --- Buttons --- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: none;
  border-radius: 4px;
  padding: 0.6rem 1.1rem;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease;
}

.btn .material-icons {
  font-size: 1.1rem;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--md-primary);
  color: var(--md-on-primary);
  box-shadow: var(--elevation-1);
}

.btn-primary:hover:not(:disabled) {
  background: var(--md-primary-dark);
  box-shadow: var(--elevation-4);
}

.btn-outlined {
  background: transparent;
  color: var(--md-primary);
  border: 1px solid var(--md-divider);
}

.btn-outlined:hover:not(:disabled) {
  background: rgba(63, 81, 181, 0.08);
}

.btn-text {
  background: transparent;
  color: var(--md-primary);
  padding: 0.6rem 0.75rem;
}

.btn-text:hover:not(:disabled) {
  background: rgba(63, 81, 181, 0.08);
}

.btn-block {
  width: 100%;
  justify-content: center;
}

.btn-danger {
  color: var(--md-error);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.14);
}

.icon-btn.on-surface:hover {
  background: rgba(0, 0, 0, 0.06);
}

/* --- Login screen --- */

.login-screen {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow: hidden;
}

.login-watermark {
  position: absolute;
  bottom: -8vh;
  right: -8vh;
  width: 55vh;
  height: 55vh;
  opacity: 0.6;
  pointer-events: none;
  z-index: 0;
}

.login-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 360px;
  background: var(--md-surface);
  border-radius: 8px;
  box-shadow: var(--elevation-8);
  padding: 2rem;
}

.login-logo {
  display: block;
  height: 40px;
  margin: 0 0 1rem;
}

.login-card .muted {
  margin: 0 0 1.5rem;
}

.login-card .btn {
  margin-top: 0.5rem;
}

/* --- Form fields --- */

.field {
  display: block;
  margin-bottom: 1rem;
}

.field span {
  display: block;
  font-size: 0.75rem;
  color: var(--md-text-secondary);
  margin-bottom: 0.3rem;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--md-divider);
  border-radius: 4px;
  background: var(--md-surface);
  color: var(--md-text-primary);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--md-primary);
  box-shadow: 0 0 0 1px var(--md-primary);
}

.field textarea {
  resize: vertical;
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1rem;
  align-items: start;
}

.inline-form .field.grow {
  flex: 1;
  min-width: 160px;
}

.inline-form .field.full {
  flex-basis: 100%;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

/* --- App bar --- */

.appbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--appbar-height);
  background: var(--md-primary);
  color: var(--md-on-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 0.75rem;
  box-shadow: var(--elevation-4);
  z-index: 20;
}

.appbar-title {
  font-size: 1.15rem;
  font-weight: 500;
  margin: 0;
  white-space: nowrap;
}

.appbar-spacer {
  flex: 1;
}

.appbar-user {
  font-size: 0.875rem;
  opacity: 0.9;
  margin-right: 0.25rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  font-size: 0.8rem;
}

.chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #9e9e9e;
}

.chip-ok .chip-dot {
  background: #69f0ae;
}

.chip-error .chip-dot {
  background: #ff5252;
}

/* --- Drawer --- */

.drawer {
  position: fixed;
  top: var(--appbar-height);
  left: 0;
  bottom: 0;
  width: var(--drawer-width);
  background: var(--md-surface);
  box-shadow: var(--elevation-1);
  overflow-y: auto;
  z-index: 15;
  transition: transform 0.2s ease;
}

.drawer-header {
  padding: 1rem 1.25rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--md-text-secondary);
}

.drawer-scrim {
  display: none;
}

.device-nav-list {
  padding: 0.25rem 0.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.device-nav-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  border-radius: 24px;
  padding: 0.6rem 0.9rem;
  cursor: pointer;
  color: var(--md-text-primary);
  font-family: inherit;
}

.device-nav-item:hover {
  background: rgba(0, 0, 0, 0.05);
}

.device-nav-item.active {
  background: var(--md-primary-light);
  color: var(--md-primary-dark);
  font-weight: 500;
}

.device-nav-item .material-icons {
  color: var(--md-text-secondary);
}

.device-nav-item.active .material-icons {
  color: var(--md-primary-dark);
}

.device-nav-text {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.device-nav-text .name {
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-nav-text .hostname {
  font-size: 0.72rem;
  color: var(--md-text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drawer-empty {
  padding: 1rem 1.25rem;
  color: var(--md-text-secondary);
  font-size: 0.85rem;
}

/* --- Content --- */

.content {
  margin-top: var(--appbar-height);
  margin-left: var(--drawer-width);
  padding: 1.5rem;
  max-width: 900px;
}

.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.detail-header h2 {
  margin: 0;
}

.switch-field {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--md-text-secondary);
  cursor: pointer;
  user-select: none;
}

.switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}

.switch input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 1;
}

.switch-track {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.26);
  border-radius: 999px;
  transition: background-color 0.15s ease;
}

.switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: var(--elevation-1);
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.switch input:checked ~ .switch-track {
  background: var(--md-primary-light);
}

.switch input:checked ~ .switch-track .switch-thumb {
  transform: translateX(16px);
  background: var(--md-primary);
}

.card {
  background: var(--md-surface);
  border-radius: 8px;
  box-shadow: var(--elevation-1);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.card h3 {
  margin: 0 0 0.85rem;
  font-size: 1rem;
}

/* --- Tabs --- */

.tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid var(--md-divider);
  margin: -0.25rem -0.25rem 1.1rem;
  overflow-x: auto;
}

.tab {
  appearance: none;
  border: none;
  background: transparent;
  padding: 0.75rem 1rem;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--md-text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.tab:hover {
  color: var(--md-text-primary);
}

.tab.active {
  color: var(--md-primary);
  border-bottom-color: var(--md-primary);
}

.tab-toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.subtabs {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.subtab {
  appearance: none;
  border: 1px solid var(--md-divider);
  background: var(--md-surface);
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--md-text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.subtab:hover {
  color: var(--md-text-primary);
}

.subtab.active {
  color: var(--md-on-primary);
  background: var(--md-primary);
  border-color: var(--md-primary);
}

.result {
  white-space: pre-wrap;
  word-break: break-word;
  background: rgba(0, 0, 0, 0.04);
  padding: 0.75rem;
  border-radius: 4px;
  min-height: 1.5em;
  max-height: 420px;
  overflow-y: auto;
  font-size: 0.85rem;
  margin: 0;
  opacity: 1;
  transition: opacity 0.15s ease;
}

.result.loading {
  opacity: 0.45;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 4rem 1rem;
  color: var(--md-text-secondary);
  text-align: center;
}

.empty-icon {
  font-size: 3rem;
  opacity: 0.4;
}

/* --- Status graphic (central_info) --- */

.status-graphic {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  opacity: 1;
  transition: opacity 0.15s ease;
}

.status-graphic.loading {
  opacity: 0.45;
}

.status-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.5rem;
  font-size: 0.8rem;
  color: var(--md-text-secondary);
  padding: 0 0.2rem;
}

.status-meta b {
  color: var(--md-text-primary);
  font-weight: 500;
}

.status-panel {
  background: var(--md-background);
  border-radius: 6px;
  padding: 0.9rem 1.1rem 1.15rem;
}

.status-section-title {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--md-text-secondary);
  margin: 0 0 0.7rem;
}

.led-row {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.led-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.led-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #cfcfcf;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15);
}

.led-dot.on-power {
  background: #43a047;
  box-shadow: 0 0 6px #43a04799;
}

.led-dot.on-fault {
  background: #f9a825;
  box-shadow: 0 0 6px #f9a82599;
}

.led-dot.on-alarm {
  background: #e53935;
  box-shadow: 0 0 6px #e5393599;
}

.led-dot.blink {
  animation: led-blink 1s step-start infinite;
}

@keyframes led-blink {
  50% {
    opacity: 0.25;
  }
}

.alarm-banner {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.85rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 500;
}

.alarm-banner.tone-ok {
  background: rgba(46, 125, 50, 0.12);
  color: var(--md-success);
}

.alarm-banner.tone-warn {
  background: rgba(249, 168, 37, 0.18);
  color: #8a5800;
}

.alarm-banner.tone-error {
  background: rgba(211, 47, 47, 0.12);
  color: var(--md-error);
}

.chip-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}

@media (max-width: 480px) {
  .chip-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.io-chip {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.5rem 0.65rem;
  border-radius: 4px;
  background: var(--md-surface);
  border-left: 3px solid #cfcfcf;
  font-size: 0.8rem;
}

.io-chip .io-label {
  color: var(--md-text-secondary);
  font-size: 0.7rem;
}

.io-chip .io-value {
  font-weight: 500;
}

.io-chip.tone-neutral {
  border-left-color: #cfcfcf;
}

.io-chip.tone-active {
  border-left-color: var(--md-success);
}

.io-chip.tone-active .io-value {
  color: var(--md-success);
}

.io-chip.tone-error {
  border-left-color: var(--md-error);
}

.io-chip.tone-error .io-value {
  color: var(--md-error);
}

.fault-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.35rem 1rem;
}

.fault-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.3rem 0;
  font-size: 0.82rem;
  border-bottom: 1px solid var(--md-divider);
}

.fault-row .fault-label {
  color: var(--md-text-primary);
}

.fault-status {
  font-size: 0.7rem;
  font-weight: 500;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  white-space: nowrap;
}

.fault-status.tone-ok {
  background: rgba(46, 125, 50, 0.12);
  color: var(--md-success);
}

.fault-status.tone-error {
  background: rgba(211, 47, 47, 0.12);
  color: var(--md-error);
}

.status-modules-note {
  font-size: 0.82rem;
  color: var(--md-text-secondary);
}

/* --- Stat tables (eth stats itp.) --- */

.table-scroll {
  overflow-x: auto;
}

.stat-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  white-space: nowrap;
}

.stat-table th,
.stat-table td {
  padding: 0.4rem 0.7rem;
  text-align: right;
  border-bottom: 1px solid var(--md-divider);
}

.stat-table th:first-child,
.stat-table td:first-child {
  text-align: left;
}

.stat-table thead th {
  color: var(--md-text-secondary);
  font-weight: 500;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-table tbody tr:hover {
  background: rgba(0, 0, 0, 0.03);
}

.stat-value.tone-error {
  color: var(--md-error);
  font-weight: 500;
}

.mem-bar-wrap {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
}

.mem-bar {
  display: inline-block;
  width: 60px;
  height: 6px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.mem-bar-fill {
  display: block;
  height: 100%;
  background: var(--md-primary);
}

.mem-bar-fill.tone-warn {
  background: #f9a825;
}

.mem-bar-fill.tone-error {
  background: var(--md-error);
}

/* --- Moduly (karty CD/analogowe/CDRPO/COLPG/MP-BUS/N0110) --- */

.module-card {
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--md-divider);
}

.module-card:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.module-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  font-size: 0.82rem;
}

.module-card-header .sn {
  font-weight: 500;
}

.fault-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.68rem;
  font-weight: 500;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: rgba(211, 47, 47, 0.12);
  color: var(--md-error);
  cursor: help;
}

.module-subrow-label {
  font-size: 0.68rem;
  color: var(--md-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 0.4rem 0 0.3rem;
}

.actuator-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.5rem;
}

.actuator-card {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.5rem 0.6rem;
  border-radius: 4px;
  background: var(--md-surface);
  border-left: 3px solid var(--md-success);
  font-size: 0.72rem;
}

.actuator-card.tone-error {
  border-left-color: var(--md-error);
}

.actuator-card .a-title {
  font-weight: 500;
  font-size: 0.78rem;
}

.actuator-card .a-serial {
  color: var(--md-text-secondary);
  font-family: monospace;
}

.colpg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(28px, 1fr));
  gap: 2px;
}

.colpg-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 2px;
  cursor: help;
}

.colpg-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  font-size: 0.72rem;
  color: var(--md-text-secondary);
  margin-top: 0.6rem;
}

.colpg-legend .swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  border: 1px solid rgba(0, 0, 0, 0.2);
  margin-right: 0.3rem;
  vertical-align: middle;
}

.modules-loading {
  color: var(--md-text-secondary);
  font-size: 0.85rem;
}

/* --- Mapa sieci (uproszczona, patrz komentarz w app.js) --- */

.net-map {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  overflow-x: auto;
  padding: 0.35rem 0.1rem 0.6rem;
}

.net-node {
  flex: 0 0 auto;
  min-width: 118px;
  border: 1px solid var(--md-divider);
  border-radius: 6px;
  background: var(--md-surface);
  padding: 0.45rem 0.6rem;
  font-size: 0.72rem;
}

.net-node.root {
  background: var(--md-primary);
  color: var(--md-on-primary);
  border-color: var(--md-primary);
}

.net-node .sn {
  font-weight: 500;
}

.net-node .type {
  color: var(--md-text-secondary);
  font-size: 0.68rem;
}

.net-node.root .type {
  color: rgba(255, 255, 255, 0.8);
}

.net-node.tone-error {
  border-color: var(--md-error);
  background: rgba(211, 47, 47, 0.06);
}

.net-node.tone-warn {
  border-color: #f9a825;
  background: rgba(249, 168, 37, 0.08);
}

.net-connector {
  flex: 0 0 auto;
  color: var(--md-text-secondary);
  font-size: 0.95rem;
}

.net-connector-error {
  color: var(--md-error);
  font-size: 0.72rem;
  font-weight: 500;
  white-space: nowrap;
}

.net-map-subtitle {
  margin: 0.9rem 0 0.35rem;
  font-size: 0.72rem;
  color: var(--md-text-secondary);
}

/* --- Logi (dekodowany plik binarny) --- */

.logs-table-wrap {
  max-height: 480px;
  overflow-y: auto;
  overflow-x: auto;
}

.logs-table-wrap .stat-table td,
.logs-table-wrap .stat-table th {
  text-align: left;
  white-space: normal;
}

.logs-table-wrap .stat-table td:first-child,
.logs-table-wrap .stat-table th:first-child {
  white-space: nowrap;
}

.logs-table-wrap thead th {
  position: sticky;
  top: 0;
  background: var(--md-surface);
  box-shadow: 0 1px 0 var(--md-divider);
}

.crc-bad {
  color: var(--md-error);
  font-weight: 500;
  cursor: help;
}

.spinner {
  display: inline-block;
  width: 15px;
  height: 15px;
  border: 2px solid rgba(0, 0, 0, 0.15);
  border-top-color: var(--md-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8rem;
  color: var(--md-text-secondary);
}

.logs-filter-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
  font-size: 0.8rem;
  color: var(--md-text-secondary);
}

.logs-filter-row select {
  font-family: inherit;
  font-size: 0.8rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--md-divider);
  border-radius: 4px;
  background: var(--md-surface);
  color: var(--md-text-primary);
  max-width: 340px;
}

.stat-table tbody tr.log-tone-error { background: rgba(211, 47, 47, 0.05); }
.stat-table tbody tr.log-tone-warn { background: rgba(249, 168, 37, 0.07); }
.stat-table tbody tr.log-tone-active { background: rgba(46, 125, 50, 0.05); }
.stat-table tbody tr.log-tone-dev { background: rgba(126, 87, 194, 0.06); }
.stat-table tbody tr.log-tone-neutral { background: transparent; }

.stat-table tbody tr.log-tone-error td:first-child { border-left: 3px solid var(--md-error); }
.stat-table tbody tr.log-tone-warn td:first-child { border-left: 3px solid #f9a825; }
.stat-table tbody tr.log-tone-active td:first-child { border-left: 3px solid var(--md-success); }
.stat-table tbody tr.log-tone-dev td:first-child { border-left: 3px solid #7e57c2; }
.stat-table tbody tr.log-tone-neutral td:first-child { border-left: 3px solid #cfcfcf; }

/* --- Settings: device table --- */

.device-table {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.device-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--md-surface);
  border-radius: 8px;
  box-shadow: var(--elevation-1);
  padding: 0.85rem 1.1rem;
  flex-wrap: wrap;
}

.device-row-info {
  flex: 1;
  min-width: 180px;
}

.device-row-info .name {
  font-weight: 500;
}

.device-row-info .meta {
  font-size: 0.8rem;
  color: var(--md-text-secondary);
}

.device-row-actions {
  display: flex;
  gap: 0.25rem;
}

/* --- Responsive: drawer becomes an overlay --- */

@media (max-width: 900px) {
  .content {
    margin-left: 0;
  }

  .drawer {
    transform: translateX(-100%);
  }

  .drawer.open {
    transform: translateX(0);
    z-index: 25;
  }

  .drawer-scrim.open {
    display: block;
    position: fixed;
    inset: var(--appbar-height) 0 0 0;
    background: rgba(0, 0, 0, 0.32);
    z-index: 24;
  }
}
