:root {
  --bg-a: #0d1b2a;
  --bg-b: #1b263b;
  --card: rgba(255, 255, 255, 0.08);
  --line: rgba(255, 255, 255, 0.18);
  --text: #e0e1dd;
  --muted: #95a7b8;
  --accent: #fca311;
  --accent-soft: rgba(252, 163, 17, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 10% 20%, #415a77 0%, transparent 35%),
    radial-gradient(circle at 85% 10%, #2f3e46 0%, transparent 32%),
    linear-gradient(135deg, var(--bg-a), var(--bg-b));
}

.shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.host-shell {
  padding-top: 48px;
  padding-bottom: 48px;
}

.card {
  width: min(860px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 28px;
  backdrop-filter: blur(8px);
  box-shadow: 0 14px 50px rgba(0, 0, 0, 0.35);
  display: grid;
  gap: 18px;
}

.glow {
  box-shadow: 0 0 0 1px rgba(252, 163, 17, 0.25), 0 20px 60px rgba(0, 0, 0, 0.45);
}

h1 {
  margin: 0 0 8px;
  font-size: clamp(1.8rem, 3vw, 2.8rem);
}

.title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.title-copy {
  min-width: 0;
  flex: 1;
}

.title-name-input {
  width: min(360px, 100%);
  margin-top: -2px;
}

.arm-hero-btn {
  width: 100%;
  margin-top: 0;
  border: 1px solid rgba(255, 124, 124, 0.62);
  border-radius: 14px;
  padding: 14px 18px;
  background: linear-gradient(180deg, #cf3c3c, #8d1f1f);
  color: #fff4f4;
  font-family: "IBM Plex Mono", monospace;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(141, 31, 31, 0.42);
}

.arm-hero-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(141, 31, 31, 0.54);
}

.meta,
.hint {
  margin: 8px 0 0;
  color: var(--muted);
}

.panel {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  background: rgba(7, 17, 27, 0.28);
}

.panel-label {
  margin: 0;
  font-size: 0.78rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.sync-policy-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.sync-policy-btn {
  margin-top: 0;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.7rem;
  letter-spacing: 0.03em;
}

.sync-policy-btn.sync-policy-btn--on {
  border-color: rgba(116, 230, 161, 0.82);
  background: rgba(38, 165, 99, 0.22);
  color: rgba(233, 255, 244, 0.98);
}

.sync-policy-btn.sync-policy-btn--off {
  border-color: rgba(255, 116, 116, 0.86);
  background: rgba(184, 41, 41, 0.2);
  color: rgba(255, 236, 236, 0.98);
}

.join-qr-corner {
  width: 76px;
  height: 76px;
  display: inline-flex;
  border-radius: 14px;
  border: 1px solid rgba(252, 163, 17, 0.45);
  padding: 5px;
  background: rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.join-qr-corner:hover {
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

.join-qr-image {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
  background: #fff;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.roster-random-buttons {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.roster-random-btn {
  margin-top: 0;
  min-width: 132px;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  color: rgba(252, 163, 17, 0.7);
  font-size: 0.82rem;
  font-family: "IBM Plex Mono", monospace;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  letter-spacing: 0.03em;
  box-shadow: none;
}

.roster-random-btn:hover,
.roster-random-btn:focus {
  border-color: rgba(252, 163, 17, 0.5);
  box-shadow: 0 4px 12px rgba(252, 163, 17, 0.1);
}

.roster-random-btn:disabled {
  opacity: 0.52;
  box-shadow: none;
  cursor: default;
}

.roster-random-btn-icon {
  font-size: 1.15rem;
  line-height: 1;
}

.roster-random-btn-label {
  white-space: nowrap;
}

.roster-chaos-btn {
  border-color: var(--line);
  background: var(--card);
  color: rgba(252, 163, 17, 0.7);
  box-shadow: none;
}

.roster-chaos-btn:hover,
.roster-chaos-btn:focus {
  border-color: rgba(252, 163, 17, 0.5);
  box-shadow: 0 4px 12px rgba(252, 163, 17, 0.1);
}

.roster-chaos-btn.roster-random-btn--active {
  border-color: rgba(255, 160, 95, 0.92);
  background: linear-gradient(180deg, #ff8345, #d64018);
  color: #2a0900;
  box-shadow: 0 12px 30px rgba(214, 64, 24, 0.4);
}

.waveform-window-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  color: var(--muted);
}

.waveform-head-right {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.waveform-time {
  margin: 0;
  min-width: 7.5em;
  text-align: right;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.82rem;
  color: var(--text);
}

.waveform-window-controls input {
  width: 58px;
  padding: 5px 6px;
  text-align: right;
  font-size: 0.74rem;
}

.song-title {
  margin: 2px 0 6px;
  font-size: clamp(1.1rem, 1.9vw, 1.45rem);
  line-height: 1.15;
}

h2 {
  margin: 24px 0 8px;
  font-size: 1.2rem;
}

.label {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

#transport,
#timecode,
#socket,
#state,
#clients {
  margin: 6px 0 0;
  font-family: "IBM Plex Mono", monospace;
}

.controls {
  display: grid;
  gap: 8px;
}

.playback-head,
.client-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
}

.playback-time {
  margin: 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 1rem;
}

.transport-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 2px;
}

.transport-row .btn {
  margin-top: 0;
}

.transport-row input[type="range"] {
  width: 100%;
  min-width: 0;
  padding: 0;
  appearance: none;
  background: transparent;
  border: none;
}

.transport-row input[type="range"]::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(252, 163, 17, 0.9), rgba(255, 255, 255, 0.22));
}

.transport-row input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  margin-top: -6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff4d6;
  border: 2px solid rgba(252, 163, 17, 0.95);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
}

.transport-row input[type="range"]::-moz-range-track {
  height: 8px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(252, 163, 17, 0.9), rgba(255, 255, 255, 0.22));
}

.transport-row input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff4d6;
  border: 2px solid rgba(252, 163, 17, 0.95);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
}

input,
select {
  width: min(300px, 100%);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: "IBM Plex Mono", monospace;
}

.btn {
  margin-top: 18px;
  border: none;
  border-radius: 11px;
  padding: 11px 16px;
  font-weight: 700;
  background: var(--accent);
  color: #1c1b1b;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(252, 163, 17, 0.35);
}

.btn-ghost {
  margin-top: 0;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}

.btn-test-active {
  background: transparent;
  color: var(--accent);
  border-color: var(--accent);
}

.button-row {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.panel-player select {
  margin-top: 2px;
}

.track-current-title {
  margin: 0;
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  line-height: 1.2;
  font-weight: 700;
  color: var(--text);
}

.track-current-meta {
  margin: -4px 0 2px;
  color: var(--muted);
  font-size: 0.88rem;
  letter-spacing: 0.02em;
}

.panel-player .track-current-meta {
  margin: -2px 0 8px;
}

.track-picker-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 52px;
  gap: 10px;
  align-items: center;
}

.panel-player .track-picker-row {
  margin-bottom: 10px;
}

.track-picker-trigger {
  width: 100%;
  max-width: none;
  min-width: 0;
  margin-top: 0;
  padding: 13px 46px 13px 14px;
  border-radius: 14px;
  border: 1px solid rgba(252, 163, 17, 0.28);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.04)),
    linear-gradient(135deg, rgba(252, 163, 17, 0.08), rgba(255, 255, 255, 0.02));
  color: var(--text);
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.98rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-align: left;
  cursor: pointer;
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(252, 163, 17, 0.95) 50%),
    linear-gradient(135deg, rgba(252, 163, 17, 0.95) 50%, transparent 50%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.04));
  background-position:
    calc(100% - 22px) calc(50% - 3px),
    calc(100% - 16px) calc(50% - 3px),
    0 0;
  background-size: 6px 6px, 6px 6px, 100% 100%;
  background-repeat: no-repeat;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  color-scheme: dark;
}

.track-picker-trigger:hover,
.track-picker-trigger:focus {
  border-color: rgba(252, 163, 17, 0.55);
  outline: none;
  box-shadow: 0 0 0 3px rgba(252, 163, 17, 0.14);
}

.track-picker-trigger:disabled {
  opacity: 0.55;
  cursor: default;
  box-shadow: none;
}

.track-picker-popup {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
}

.track-picker-popup--open {
  display: block;
}

.track-picker-scrim {
  position: absolute;
  inset: 0;
  background: rgba(6, 11, 18, 0.72);
  backdrop-filter: blur(2px);
}

.track-picker-panel {
  position: relative;
  width: min(640px, calc(100% - 24px));
  max-height: min(76vh, 720px);
  margin: min(12vh, 120px) auto 0;
  border-radius: 16px;
  border: 1px solid rgba(252, 163, 17, 0.36);
  background: linear-gradient(180deg, rgba(19, 30, 43, 0.98), rgba(10, 19, 30, 0.98));
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.5);
  padding: 14px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
}

.track-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.track-picker-title {
  margin: 0;
  font-family: "IBM Plex Mono", monospace;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  font-size: 0.74rem;
}

.track-picker-close-btn {
  margin-top: 0;
  height: 34px;
  padding: 0 10px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.75rem;
}

.track-picker-list {
  overflow: auto;
  display: grid;
  gap: 8px;
  padding-right: 2px;
}

.track-picker-item {
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 10px 12px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  text-align: left;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.95rem;
  cursor: pointer;
}

.track-picker-item:hover,
.track-picker-item:focus {
  border-color: rgba(252, 163, 17, 0.7);
  outline: none;
  box-shadow: 0 0 0 2px rgba(252, 163, 17, 0.2);
}

.track-picker-item--active {
  border-color: rgba(116, 230, 161, 0.86);
  background: linear-gradient(135deg, rgba(38, 165, 99, 0.22), rgba(103, 209, 143, 0.13));
}

.track-picker-item-index {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  color: var(--muted);
}

.track-picker-item-title {
  min-width: 0;
}

.track-picker-empty {
  margin: 4px 0;
  font-family: "IBM Plex Mono", monospace;
  color: var(--muted);
}

.track-nav-btn {
  min-width: 52px;
  width: 52px;
  height: 52px;
  margin-top: 0;
  padding: 0;
  border-radius: 14px;
  font-size: 1.55rem;
  line-height: 1;
}

.track-nav-btn:disabled {
  opacity: 0.45;
  cursor: default;
  box-shadow: none;
}

.waveforms-grid {
  margin-top: 8px;
  display: grid;
  gap: 8px;
}

.waveform-row {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.18);
}

.waveform-side {
  display: grid;
  gap: 6px;
  align-items: start;
}

.waveform-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
}

.waveform-action-btn {
  height: 24px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.6rem;
  letter-spacing: 0.03em;
  padding: 0 5px;
  cursor: pointer;
}

.waveform-action-btn:hover {
  border-color: rgba(252, 163, 17, 0.6);
  color: var(--text);
}

.waveform-row--active {
  border-color: rgba(116, 230, 161, 0.8);
  box-shadow: inset 0 0 0 1px rgba(116, 230, 161, 0.25);
}

.waveform-label {
  margin: 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.78rem;
  color: var(--text);
}

.waveform-canvas {
  width: 100%;
  height: 46px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.03);
}

.waveform-meta {
  margin: 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  color: var(--muted);
}

.waveform-devices {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}

.waveform-device-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.68rem;
  color: var(--text);
  line-height: 1;
}

.waveform-device-chip--muted {
  opacity: 0.65;
}

.waveform-device-chip--armed {
  border-color: rgba(116, 230, 161, 0.85);
  background: rgba(38, 165, 99, 0.2);
}

.waveform-device-chip--unarmed {
  border-color: rgba(255, 116, 116, 0.9);
  background: rgba(184, 41, 41, 0.2);
}

.waveform-devices-empty {
  margin: 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.68rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.icon-btn {
  min-width: 48px;
  width: 48px;
  padding: 11px 0;
  font-size: 1rem;
  line-height: 1;
}

.roster {
  margin-top: 18px;
  padding-left: 20px;
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
}

.roster-grid {
  margin-top: 8px;
  display: grid;
  gap: 10px;
}

.sync-overview {
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.04);
}

.sync-overview-line {
  margin: 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  color: var(--muted);
}

.sync-overview-chips {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sync-overview-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 2px 8px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.68rem;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.sync-overview-chip--good {
  border-color: rgba(116, 230, 161, 0.9);
  background: rgba(38, 165, 99, 0.2);
}

.sync-overview-chip--warn {
  border-color: rgba(252, 163, 17, 0.95);
  background: rgba(154, 90, 17, 0.24);
}

.sync-overview-chip--bad {
  border-color: rgba(255, 116, 116, 0.92);
  background: rgba(184, 41, 41, 0.24);
}

.roster-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.16);
  padding: 7px 10px;
}

.roster-row--disconnected {
  opacity: 0.45;
  border-style: dashed;
}

.roster-row--disabled {
  border-color: rgba(255, 116, 116, 0.55);
  background: rgba(120, 22, 22, 0.16);
}

.roster-left {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  column-gap: 7px;
  min-width: 0;
}

.roster-status-pill {
  height: 24px;
  min-width: 70px;
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 0 9px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
}

.roster-status-pill:hover:not(:disabled) {
  border-color: rgba(255, 255, 255, 0.55);
}

.roster-status-pill:disabled {
  opacity: 0.55;
  cursor: default;
}

.roster-status-pill--muted {
  border-color: rgba(255, 116, 116, 0.92);
  background: rgba(184, 41, 41, 0.26);
  color: rgba(255, 236, 236, 0.98);
}

.roster-status-pill--loading {
  border-color: rgba(252, 163, 17, 0.95);
  background: rgba(154, 90, 17, 0.26);
  color: rgba(255, 233, 193, 0.98);
}

.roster-status-pill--ready,
.roster-status-pill--playing {
  border-color: rgba(116, 230, 161, 0.9);
  background: rgba(38, 165, 99, 0.22);
  color: rgba(233, 255, 244, 0.98);
}

.roster-status-pill--disabled {
  border-color: rgba(149, 167, 184, 0.78);
  background: rgba(50, 66, 81, 0.32);
  color: rgba(223, 230, 237, 0.92);
}

.roster-label {
  margin: 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.82rem;
  color: var(--text);
}

.roster-meta--sync {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.roster-meta-state {
  color: var(--muted);
}

.sync-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 1px 7px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.sync-badge--good {
  border-color: rgba(116, 230, 161, 0.9);
  color: rgba(233, 255, 244, 0.98);
  background: rgba(38, 165, 99, 0.24);
}

.sync-badge--warn {
  border-color: rgba(252, 163, 17, 0.95);
  color: rgba(255, 233, 193, 0.98);
  background: rgba(154, 90, 17, 0.28);
}

.sync-badge--bad,
.sync-badge--stale {
  border-color: rgba(255, 116, 116, 0.92);
  color: rgba(255, 236, 236, 0.98);
  background: rgba(184, 41, 41, 0.28);
}

.sync-metric {
  color: var(--muted);
  font-size: 0.74rem;
}

.roster-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.roster-action-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
}

.roster-action-btn {
  width: 34px;
  min-width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.95rem;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.roster-action-btn:hover:not(:disabled) {
  border-color: rgba(255, 255, 255, 0.55);
}

.roster-action-btn--muted {
  border-color: rgba(255, 116, 116, 0.9);
  background: rgba(184, 41, 41, 0.2);
}

.roster-action-btn--active {
  border-color: rgba(116, 230, 161, 0.9);
  background: rgba(38, 165, 99, 0.2);
}

.roster-action-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.disc-buttons {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.stats-grid {
  margin-top: 4px;
  display: grid;
  gap: 6px;
}

.stats-list {
  display: grid;
  gap: 8px;
}

.stats-list--compact {
  gap: 6px;
}

.stats-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.14);
}

.stats-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.7rem;
}

.stats-table th,
.stats-table td {
  padding: 7px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  text-align: left;
  white-space: nowrap;
  color: var(--text);
}

.stats-table th {
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.04);
}

.stats-table tbody tr:last-child td {
  border-bottom: none;
}

.stats-cell-device {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stats-cell-status {
  width: 88px;
}

.stats-cell-offset {
  width: 88px;
}

.stats-table-value {
  font-size: 0.68rem;
}

.stats-status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 62px;
  height: 19px;
  padding: 0 6px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.stats-status-badge--good {
  border-color: rgba(116, 230, 161, 0.9);
  background: rgba(38, 165, 99, 0.22);
  color: rgba(233, 255, 244, 0.98);
}

.stats-status-badge--warn {
  border-color: rgba(255, 116, 116, 0.92);
  background: rgba(184, 41, 41, 0.24);
  color: rgba(255, 236, 236, 0.98);
}

.stats-status-badge--stale {
  border-color: rgba(149, 167, 184, 0.78);
  background: rgba(50, 66, 81, 0.32);
  color: rgba(223, 230, 237, 0.92);
}

.stats-item {
  margin: 0;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03));
  display: grid;
  gap: 6px;
}

.stats-item--compact {
  padding: 7px 8px;
  gap: 8px;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  overflow-x: auto;
}

.stats-item--compact .stats-item-head {
  flex: 0 0 130px;
  min-width: 0;
}

.stats-item--compact .stats-offset-row {
  flex: 0 0 auto;
}

.stats-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.stats-item-name {
  margin: 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.7rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stats-state-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 62px;
  height: 19px;
  padding: 0 6px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.stats-state-chip--fast {
  border-color: rgba(116, 230, 161, 0.9);
  background: rgba(38, 165, 99, 0.22);
  color: rgba(233, 255, 244, 0.98);
}

.stats-state-chip--slow {
  border-color: rgba(255, 116, 116, 0.92);
  background: rgba(184, 41, 41, 0.24);
  color: rgba(255, 236, 236, 0.98);
}

.stats-state-chip--stale {
  border-color: rgba(149, 167, 184, 0.78);
  background: rgba(50, 66, 81, 0.32);
  color: rgba(223, 230, 237, 0.92);
}

.stats-trend-canvas {
  width: 100%;
  height: 80px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.12);
}

.stats-trend-canvas--shared {
  margin-top: 2px;
}

.stats-item-metric,
.stats-item-detail {
  margin: 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.71rem;
  color: var(--text);
}

.stats-inline-metrics {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
}

.stats-inline-metrics .stats-metric-cell {
  flex: 0 0 auto;
}

.stats-metric-cell {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.12);
  padding: 3px 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.stats-metric-label {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.53rem;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.stats-metric-value {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.62rem;
  color: var(--text);
  line-height: 1;
}

.stats-metric-value--ok,
.stats-metric-value--ahead {
  color: rgba(201, 255, 227, 0.96);
}

.stats-metric-value--behind {
  color: rgba(255, 224, 224, 0.96);
}

.stats-metric-value--active {
  color: rgba(255, 236, 180, 0.98);
}

.stats-metric-value--stale {
  color: rgba(201, 208, 215, 0.95);
}

.stats-item-detail {
  color: var(--muted);
}

.stats-offset-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.stats-offset-label,
.stats-offset-unit {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.62rem;
  color: var(--muted);
}

.stats-offset-input {
  width: 74px;
  height: 28px;
  font-size: 0.72rem;
}

.stats-offset-input--table {
  width: 68px;
  height: 24px;
  font-size: 0.66rem;
}

.stats-empty {
  margin: 0;
  font-family: "IBM Plex Mono", monospace;
  color: var(--muted);
  font-size: 0.78rem;
}

.offset-input {
  width: 84px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.8rem;
  padding: 0 8px;
  text-align: right;
}

.offset-input:disabled {
  opacity: 0.5;
}

.volume-control {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 254px;
  height: 34px;
  padding: 0 8px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
}

.volume-action-buttons {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.volume-control .roster-action-btn {
  width: 28px;
  min-width: 28px;
  height: 28px;
  border-radius: 7px;
  font-size: 0.82rem;
}

.volume-icon {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.68rem;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.volume-slider {
  width: 74px;
  min-width: 74px;
  padding: 0;
  appearance: none;
  background: transparent;
  border: none;
}

.volume-slider::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
}

.volume-slider::-webkit-slider-thumb {
  appearance: none;
  margin-top: -5px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff4d6;
  border: 2px solid rgba(252, 163, 17, 0.95);
}

.volume-slider::-moz-range-track {
  height: 6px;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
}

.volume-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(252, 163, 17, 0.95);
  border-radius: 50%;
  background: #fff4d6;
}

.volume-slider:disabled {
  opacity: 0.5;
}

.volume-value {
  min-width: 36px;
  text-align: right;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.74rem;
  color: var(--text);
}

.disc-btn {
  min-width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.82rem;
  font-weight: 600;
  transition: border-color 120ms ease, background 120ms ease, color 120ms ease;
}

.disc-btn:hover:not(:disabled) {
  border-color: rgba(255, 255, 255, 0.45);
  color: var(--text);
}

.disc-btn--active {
  background: linear-gradient(135deg, rgba(38, 165, 99, 0.42), rgba(103, 209, 143, 0.3));
  border-color: rgba(116, 230, 161, 0.92);
  color: rgba(233, 255, 244, 0.98);
}

.disc-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.panel-status {
  padding-top: 12px;
  padding-bottom: 12px;
}

.status-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chip {
  margin: 0;
  padding: 8px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.16);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.88rem;
  color: var(--muted);
}

.chip span {
  color: var(--text);
}

@media (max-width: 640px) {
  .panel-head {
    align-items: stretch;
    flex-direction: column;
  }

  .panel-clients .panel-head {
    align-items: flex-start;
    flex-direction: row;
  }

  .sync-policy-controls {
    width: 100%;
    justify-content: stretch;
  }

  .sync-policy-btn {
    flex: 1 1 0;
  }

  .roster-random-buttons {
    width: auto;
    margin-left: auto;
    justify-content: flex-end;
    gap: 5px;
  }

  .roster-random-btn {
    width: 40px;
    min-width: 40px;
    min-height: 34px;
    padding: 0;
    border-radius: 10px;
    gap: 0;
  }

  .roster-random-btn-label {
    display: none;
  }

  .roster-random-btn-icon {
    font-size: 0.96rem;
  }

  .stats-item--compact {
    padding: 6px 7px;
    gap: 6px;
    overflow-x: auto;
  }

  .stats-item--compact .stats-item-head {
    flex-basis: 112px;
  }

  .stats-state-chip {
    min-width: 54px;
  }

  .stats-table {
    min-width: 700px;
  }

  .stats-table th,
  .stats-table td {
    padding: 6px 7px;
  }

  .stats-status-badge {
    min-width: 54px;
  }

  .stats-offset-label,
  .stats-offset-unit {
    font-size: 0.58rem;
  }

  .stats-offset-input {
    width: 66px;
    height: 26px;
    font-size: 0.68rem;
    padding: 0 6px;
  }

  .stats-trend-canvas {
    height: 68px;
  }

  .card {
    padding: 16px;
    border-radius: 16px;
  }

  .panel {
    padding: 14px;
  }

  h1 {
    font-size: 1.5rem;
  }

  .title-row {
    gap: 10px;
  }

  .join-qr-corner {
    width: 64px;
    height: 64px;
    padding: 4px;
    border-radius: 12px;
  }

  .transport-row {
    align-items: stretch;
  }

  .track-picker-row {
    grid-template-columns: 44px minmax(0, 1fr) 44px;
  }

  .track-picker-panel {
    width: calc(100% - 12px);
    margin-top: 8px;
    max-height: calc(100vh - 16px);
    border-radius: 14px;
  }

  .track-picker-item {
    grid-template-columns: 34px minmax(0, 1fr);
    padding: 11px 10px;
  }

  /* Mix Matrix: label + meta share top row, canvas spans full width below */
  .waveform-row {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
  }

  .waveform-side {
    grid-column: 1;
    grid-row: 1;
  }

  .waveform-label {
    grid-column: 1;
    grid-row: 1;
    align-self: center;
  }

  .waveform-canvas {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .waveform-devices {
    grid-column: 1 / -1;
    grid-row: 3;
  }

  /* Device Controls: stack name above controls */
  .roster-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .roster-controls {
    width: 100%;
    flex-wrap: wrap;
    gap: 6px;
  }

  .disc-buttons {
    flex-wrap: wrap;
  }

  .offset-input {
    width: 76px;
  }

  .playback-head,
  .client-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .waveform-head-right {
    width: 100%;
    justify-content: space-between;
  }

}
