/* =============================================================================
   CAN Diagnostics Suite — Web Edition v7.0
   Dashboard Layout & Panels
   ============================================================================= */

/* ---------------------------------------------------------------------------
   App Shell
   --------------------------------------------------------------------------- */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ---------------------------------------------------------------------------
   Sidebar
   --------------------------------------------------------------------------- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--color-bg-secondary);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: calc(var(--z-sticky) + 10);   /* always over the page, even scrolled sideways */
  transition: width var(--transition-normal);
}

.sidebar-header {
  cursor: pointer;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: var(--header-height);
}

.sidebar-header img {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
}

.sidebar-header h1 {
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--color-text-primary);
  white-space: nowrap;
}

.sidebar-header .version {
  font-size: var(--text-xs);
  color: var(--color-accent);
  font-weight: 500;
}

.sidebar-nav {
  flex: 1;
  padding: var(--space-3);
  overflow-y: auto;
}

.sidebar-section {
  margin-bottom: var(--space-4);
}

.sidebar-section-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: var(--space-2) var(--space-3);
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: all var(--transition-fast);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.sidebar-link:hover {
  background: var(--color-bg-hover);
  color: var(--color-text-primary);
}

.sidebar-link.active {
  background: var(--color-accent-subtle);
  color: var(--color-accent);
}

.sidebar-link .icon {
  font-size: var(--text-md);
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-link .badge {
  margin-left: auto;
  padding: 1px 8px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  background: var(--color-accent);
  color: white;
}

.sidebar-link .badge.success {
  background: var(--color-success);
}

.sidebar-link .badge.warning {
  background: var(--color-warning);
  color: var(--color-text-inverse);
}

.sidebar-link .badge.error {
  background: var(--color-error);
}

/* User section at bottom */
.sidebar-user {
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.sidebar-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--color-accent-subtle);
  color: var(--color-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: var(--text-sm);
  flex-shrink: 0;
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user-name {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-transform: capitalize;
}

.sidebar-user-role.admin {
  color: var(--color-admin);
}

/* ---------------------------------------------------------------------------
   Sidebar Collapsed State
   --------------------------------------------------------------------------- */
.sidebar-collapsed .sidebar {
  width: 64px;
}

.sidebar-collapsed .sidebar-header {
  padding: var(--space-4) 0;
  justify-content: center;
}

.sidebar-collapsed .sidebar-logo-icon,
.sidebar-collapsed .sidebar-title-wrap {
  display: none;
}

.sidebar-collapsed .sidebar-toggle .hamburger-icon {
  display: none;
}

.sidebar-collapsed .sidebar-toggle .satellite-icon {
  display: inline !important;
}

.sidebar-collapsed .sidebar-section-label,
.sidebar-collapsed .sidebar-link span:not(.icon),
.sidebar-collapsed .sidebar-user-info,
.sidebar-collapsed .sidebar-user button {
  display: none;
}

.sidebar-collapsed .sidebar-link {
  justify-content: center;
  padding: var(--space-2) 0;
}

.sidebar-collapsed .sidebar-link .icon {
  margin: 0;
}

.sidebar-collapsed .sidebar-add-dropdown .panel-add-menu {
  left: 64px;
  top: 0;
  width: max-content;
}

.sidebar-toggle {
  background: none;
  border: none;
  color: var(--color-text-secondary);
  cursor: pointer;
  padding: var(--space-2);
  border-radius: var(--radius-md);
  margin-left: auto;
}

.sidebar-collapsed .sidebar-toggle {
  margin: 0;
}

.sidebar-toggle:hover,
.sidebar-header:hover .sidebar-toggle {
  background: var(--color-bg-hover);
  color: var(--color-text-primary);
}

/* Who made it, and the way back to the hub */
.sidebar-credit {
  padding: 0 var(--space-4) var(--space-3);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
}
.sidebar-credit a { color: var(--color-text-secondary); }
.sidebar-credit a:hover { color: var(--color-accent); }
.sidebar-collapsed .sidebar-credit { display: none; }

.sidebar-add-dropdown {
  position: relative;
  width: 100%;
}

/* Full sidebar: Add Panel opens as a section in the sidebar and stays open */
.sidebar-add-dropdown .panel-add-menu {
  position: static;
  width: 100%;
  margin: var(--space-1) 0 var(--space-2);
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: none;
  max-height: none;
  overflow: visible;
}

.sidebar-add-chevron {
  margin-left: auto;
  font-size: 0.8em;
  opacity: 0.7;
  transition: transform 0.15s ease;
}
.sidebar-add-dropdown.open .sidebar-add-chevron { transform: rotate(90deg); }
.sidebar-collapsed .sidebar-add-chevron { display: none; }

/* Collapsed (icons-only) sidebar: a pop-out beside it */
.sidebar-collapsed .sidebar-add-dropdown .panel-add-menu {
  position: absolute;
  margin: 0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  z-index: 1000;
  max-height: 60vh;
  overflow-y: auto;
}

.sidebar-collapsed .sidebar-add-dropdown .panel-add-menu {
  left: 64px;
  top: 0;
  width: max-content;
}

/* ---------------------------------------------------------------------------
   Main Content Area
   --------------------------------------------------------------------------- */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left var(--transition-normal);
}

.sidebar-collapsed .main-content {
  margin-left: 64px;
}

/* Top Header Bar */
.top-bar {
  height: var(--header-height);
  background: var(--color-bg-secondary);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-6);
  position: sticky;
  top: 0;
  left: 0;                      /* stays put when a wide page is scrolled sideways */
  z-index: var(--z-sticky);
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

/* With the menu open, the highlighted item already says where you are */
.top-bar-title { display: none; }
.sidebar-collapsed .top-bar-title { display: block; }

.top-bar-title {
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--color-text-primary);
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* Hardware status indicators */
.hw-status {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 500;
}

.hw-status.connected {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.hw-status.disconnected {
  background: var(--color-bg-tertiary);
  color: var(--color-text-muted);
}

.hw-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.hw-status.connected .hw-status-dot {
  animation: pulse 2s infinite;
}

/* ---------------------------------------------------------------------------
   Content Panels
   --------------------------------------------------------------------------- */
.content-area {
  flex: 1;
  padding: var(--panel-gap);
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto 1fr;
  gap: var(--panel-gap);
  align-content: start;
}

.content-area.single-col {
  grid-template-columns: 1fr;
}

.panel {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: fadeIn 0.3s ease;
}

.panel.full-width {
  grid-column: 1 / -1;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  min-height: 44px;
  flex-shrink: 0;
}

.panel-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.panel-title .icon {
  font-size: var(--text-md);
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.panel-body {
  flex: 1;
  padding: var(--space-4);
  overflow-y: auto;
}

.panel-body.no-pad {
  padding: 0;
}

/* ---------------------------------------------------------------------------
   CAN Feed Panel
   --------------------------------------------------------------------------- */
.can-feed {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: 1.6;
}

.can-feed-row {
  display: flex;
  gap: var(--space-3);
  padding: 2px var(--space-4);
  border-bottom: 1px solid rgba(45, 63, 90, 0.3);
  transition: background var(--transition-fast);
}

.can-feed-row:hover {
  background: var(--color-bg-hover);
}

.can-feed-row .timestamp {
  color: var(--color-text-muted);
  min-width: 85px;
  flex-shrink: 0;
}

.can-feed-row .can-id {
  color: var(--color-accent);
  min-width: 70px;
  font-weight: 500;
  flex-shrink: 0;
}

.can-feed-row .pgn-name {
  color: var(--color-text-secondary);
  min-width: 140px;
  flex-shrink: 0;
}

.can-feed-row .data {
  color: var(--color-text-primary);
  flex: 1;
}

.can-feed-row .src-badge {
  padding: 0 6px;
  border-radius: var(--radius-sm);
  font-size: 10px;
  font-weight: 600;
  flex-shrink: 0;
}

.can-feed-row .src-badge.arc1 {
  background: rgba(239, 68, 68, 0.15);
  color: var(--color-arc1);
}

.can-feed-row .src-badge.arc2 {
  background: var(--color-accent-subtle);
  color: var(--color-arc2);
}

.can-feed-row .src-badge.arc3 {
  background: rgba(107, 114, 128, 0.15);
  color: var(--color-arc3);
}

.can-feed-row.tx {
  border-left: 2px solid var(--color-feed-tx);
}

.can-feed-row.rx {
  border-left: 2px solid var(--color-feed-rx);
}

/* Feed controls */
.feed-controls {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-4);
  border-top: 1px solid var(--color-border);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.feed-counter {
  font-family: var(--font-mono);
  color: var(--color-text-secondary);
}

/* ---------------------------------------------------------------------------
   Telemetry Cards
   --------------------------------------------------------------------------- */
.telemetry-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-3);
}

.telemetry-card {
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
}

.telemetry-card-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-1);
}

.telemetry-card-value {
  font-family: var(--font-mono);
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--color-text-primary);
}

.telemetry-card-unit {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  font-weight: 400;
  margin-left: var(--space-1);
}

/* Device cards */
.device-card {
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.device-status {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.device-status.online {
  background: var(--color-success);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.4);
}

.device-status.offline {
  background: var(--color-text-muted);
}

/* --- Telemetry device cards (device-centric) --- */
.telemetry-devices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-2);
}

.telem-device-card {
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  position: relative;
  overflow: hidden;
}

.telem-device-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
}

.telem-device-card.tractor::before {
  background: linear-gradient(90deg, #e74c3c, #c0392b);
}

.telem-device-card.camera::before {
  background: linear-gradient(90deg, #3498db, #2980b9);
}

.telem-device-card.reel::before {
  background: linear-gradient(90deg, #2ecc71, #27ae60);
}

.telem-device-card.controller::before {
  background: linear-gradient(90deg, #f39c12, #e67e22);
}

.telem-device-card.console::before {
  background: linear-gradient(90deg, #9b59b6, #8e44ad);
}

.telem-device-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-1);
}

.telem-device-name {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.telem-device-name .dev-icon {
  font-size: var(--text-lg);
}

.telem-device-name h3 {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-primary);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.telem-device-name .src-addr {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-family: var(--font-mono);
}

.telem-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.telem-status-dot.online {
  background: var(--color-success);
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.5);
}

.telem-status-dot.offline {
  background: var(--color-text-muted);
}

.telem-fields {
  display: grid;
  /* as many across as the card's width takes (9.26.3, bug #31: two across made a wide card tall) */
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: var(--space-1);
}

.telem-field {
  background: var(--color-bg-secondary);
  border-radius: var(--radius-sm);
  padding: var(--space-1) var(--space-2);
  min-width: 0;
  overflow: hidden;
}

.telem-field-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.telem-field-value {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-primary);
  font-family: var(--font-mono);
  display: flex;
  align-items: baseline;
  gap: 2px;
  white-space: nowrap;
  overflow: hidden;
}

.telem-field-value .unit {
  font-size: var(--text-xs);
  font-weight: 400;
  color: var(--color-text-muted);
}

.telem-field-value.updated {
  animation: telem-flash 0.4s ease;
}

.telem-field .edit-icon {
  font-size: 9px;
  opacity: 0.5;
  margin-left: 4px;
}

.telem-no-data {
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  text-align: center;
  padding: var(--space-2);
  font-style: italic;
  grid-column: 1 / -1;
}

@keyframes telem-flash {
  0% {
    background: rgba(217, 48, 37, 0.35);
  }

  100% {
    background: transparent;
  }
}

/* Stabilizer limit banner */
.stab-limit {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2) var(--space-3);
  margin: var(--space-1) 0;
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stab-limit.up {
  background: rgba(46, 204, 113, 0.15);
  color: #2ecc71;
  border: 1px solid rgba(46, 204, 113, 0.4);
}

.stab-limit.down {
  background: rgba(52, 152, 219, 0.15);
  color: #3498db;
  border: 1px solid rgba(52, 152, 219, 0.4);
}

/* Camera controls on camera card */
.cam-controls {
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: var(--space-2);
  padding: var(--space-1);
  margin: var(--space-1) 0;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-md);
}

.cam-btn {
  background: #2980b9;
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  padding: 4px 8px;
  cursor: pointer;
  font-size: var(--text-xs);
  flex: none;
  white-space: nowrap;   /* (9.14.6: "⓪ Zero" broke onto two lines beside the footage's source) */
}

.cam-controls > span { flex: 1 1 auto; min-width: 0; }

.cam-sel {
  background: var(--color-bg-secondary);
  color: var(--color-text-primary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 4px;
  font-size: var(--text-xs);
  cursor: pointer;
}

/* Temp toggle in panel header */
.temp-toggle {
  display: inline-flex;
  gap: 1px;
}

.temp-btn {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  padding: 2px 6px;
  font-size: var(--text-xs);
  cursor: pointer;
  min-height: auto;
}

.temp-btn:first-child {
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.temp-btn:last-child {
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.temp-btn.active {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
}

/* Bus devices section below cards */
.bus-devices-section {
  margin-top: var(--space-4);
}

.bus-devices-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-2);
}

.bus-devices-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.device-card-title {
  font-weight: 500;
  font-size: var(--text-sm);
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.device-card-sub {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* --- CAN Identifiers panel --- */
.identifiers-shell {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.id-drop-zone {
  border: 2px dashed var(--color-accent);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  text-align: center;
  background: rgba(217, 48, 37, 0.05);
  color: var(--color-accent);
  font-size: var(--text-sm);
  transition: background var(--transition-fast);
}

.id-drop-zone.drag-over {
  background: rgba(217, 48, 37, 0.12);
  border-style: solid;
}

.id-add-form {
  display: none;
}

.id-add-form.visible {
  display: block;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
}

.id-form-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: var(--space-2);
}

.id-form-row {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.id-form-row .id-f-pgn {
  width: 90px;
}

.id-form-row .id-f-name {
  flex: 1;
}

.id-form-row .id-f-arc {
  width: 90px;
}

.id-form-actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.id-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.id-item {
  display: grid;
  grid-template-columns: auto 1fr auto auto auto;
  align-items: center;
  gap: var(--space-2);
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: var(--space-1) var(--space-2);
}

.id-item .id-pgn {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--color-accent);
  font-size: var(--text-sm);
}

.id-item .id-name {
  font-size: var(--text-sm);
  font-weight: 500;
}

.id-item .id-arc {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.id-item .id-desc {
  grid-column: 1 / -1;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.id-edit,
.id-remove {
  background: none;
  border: none;
  cursor: pointer;
  opacity: 0.6;
  font-size: var(--text-xs);
  padding: 2px 4px;
}

.id-edit:hover,
.id-remove:hover {
  opacity: 1;
}

.id-remove {
  color: var(--color-error);
}

/* --- Feed recording box + Logs recordings list --- */
.feed-recording-box {
  position: relative;
  border: 2px dashed var(--color-error);
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-2) var(--space-2);
  margin: var(--space-1) 0;
}

.feed-recording-box .recording-label {
  position: absolute;
  top: calc(var(--space-2) * -1);
  left: var(--space-2);
  background: var(--color-bg-primary);
  padding: 0 var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-error);
  font-weight: 600;
}

.feed-recording-box.active {
  animation: rec-border-pulse 1.5s ease-in-out infinite alternate;
}

.feed-recording-box.complete {
  border-style: solid;
}

.feed-recording-box .can-feed-row {
  animation: none;
}

@keyframes rec-border-pulse {
  0% {
    border-color: var(--color-error);
  }

  100% {
    border-color: rgba(239, 68, 68, 0.4);
  }
}

.recordings-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.recording-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: var(--space-1) var(--space-2);
}

.recording-badge {
  background: var(--color-error);
  color: #fff;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 700;
}

.recording-name {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  flex: 1;
}

.recording-count {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.recording-dl {
  background: none;
  border: none;
  cursor: pointer;
  font-size: var(--text-sm);
  opacity: 0.7;
}

.recording-dl:hover {
  opacity: 1;
}

/* --- Burn-In panel: one station (8.19) --- */
.burnin-station {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.burnin-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}

.burnin-row select { flex: 1 1 140px; min-width: 0; }
.burnin-ids input { flex: 1 1 90px; min-width: 0; }
.burnin-row .bi-go { min-width: 5.5em; }
.burnin-row .bi-add { white-space: nowrap; width: auto; height: auto; padding: 4px 10px; font-size: var(--text-xs); border-color: var(--color-border); color: var(--color-text-secondary); }

.burnin-now {
  color: var(--color-text-secondary);
  min-height: 1.4em;
}

.burnin-warn { color: var(--color-warning); }

.burnin-confirm {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
  padding: var(--space-2);
  border: 1px solid var(--color-error);
  border-radius: var(--radius-md);
  color: var(--color-text-primary);
}

.burnin-confirm span { flex: 1 1 200px; }

.burnin-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-3);
  color: var(--color-text-secondary);
}

.burnin-legend i {
  display: inline-block;
  width: 10px;
  height: 3px;
  margin-right: 4px;
  vertical-align: middle;
}

/* Each value: lit when it's charted, a click charts it or takes it off (9.14.6) */
.burnin-legend .bi-key {
  font: inherit;
  color: var(--color-text-muted);
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 1px 8px;
  cursor: pointer;
}
.burnin-legend .bi-key b { color: inherit; }
.burnin-legend .bi-key:not(.on) i { opacity: 0.35; }
.burnin-legend .bi-key.on { color: var(--color-text-primary); background: var(--color-bg-secondary); border-color: var(--color-border-light, var(--color-border)); }
.burnin-legend .bi-key:hover { border-color: var(--color-text-muted); }
.bh-legend .bi-key { cursor: default; }

/* Nothing in a station squeezes under the next (9.14.6: the open steps list ran over the buttons) */
.burnin-station > :not(.burnin-chart-wrap) { flex-shrink: 0; }

.burnin-steps summary { cursor: pointer; color: var(--color-text-secondary); }
.burnin-steps ol { margin: var(--space-1) 0 0; padding-left: 1.6em; max-height: 220px; overflow: auto; font-family: var(--font-mono); }

.burnin-timer {
  font-family: var(--font-mono);
  font-size: var(--text-xl);
  color: var(--color-data, var(--color-info));
  text-align: center;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-1) var(--space-2);
}

.burnin-timer .text-muted { font-size: var(--text-md); }

.sidebar-link.sidebar-stop { color: var(--color-error); }

.burnin-chart-wrap {
  flex: 1;
  min-height: 140px;
  background: var(--color-bg-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  overflow: hidden;
}

.burnin-chart-wrap canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.burnin-cat-footer {
  display: flex;
  gap: var(--space-2);
  justify-content: flex-end;
  margin-top: auto;
}

.burnin-status-badge {
  font-size: var(--text-xs);
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--color-bg-secondary);
  color: var(--color-text-secondary);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.burnin-status-badge.running {
  background: linear-gradient(135deg, #f39c12, #e67e22);
  color: #fff;
  animation: burnin-pulse 1.5s ease-in-out infinite alternate;
}

.burnin-status-badge.completed {
  background: linear-gradient(135deg, #2ecc71, #27ae60);
  color: #fff;
}

.burnin-status-badge.stopped {
  background: linear-gradient(135deg, #95a5a6, #7f8c8d);
  color: #fff;
}

.burnin-status-badge.error {
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  color: #fff;
}

@keyframes burnin-pulse {
  0% {
    opacity: 0.85;
    transform: scale(1);
  }

  100% {
    opacity: 1;
    transform: scale(1.05);
  }
}

/* ---------------------------------------------------------------------------
   Session Sharing
   --------------------------------------------------------------------------- */
.session-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.session-item {
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  transition: border-color var(--transition-fast);
}

.session-item:hover {
  border-color: var(--color-border-light);
}

.session-user-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--color-accent-subtle);
  color: var(--color-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: var(--text-md);
  flex-shrink: 0;
}

.session-info {
  flex: 1;
  min-width: 0;
}

.session-info .username {
  font-weight: 500;
  color: var(--color-text-primary);
}

.session-info .hardware {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: 2px;
}

.session-actions {
  display: flex;
  gap: var(--space-2);
}

/* Spectating / Collaborating Banner */
.session-banner {
  padding: var(--space-2) var(--space-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--text-sm);
  font-weight: 500;
}

.session-banner.spectating {
  background: var(--color-spectate-bg);
  border-bottom: 2px solid var(--color-spectate);
  color: var(--color-spectate);
}

.session-banner.collaborating {
  background: var(--color-collab-bg);
  border-bottom: 2px solid var(--color-collab);
  color: var(--color-collab);
}

/* ---------------------------------------------------------------------------
   Video Panel
   --------------------------------------------------------------------------- */
.video-container {
  position: relative;
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
  aspect-ratio: 16 / 9;
}

.video-container video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.video-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--space-3) var(--space-4);
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: white;
  font-size: var(--text-xs);
}

.video-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  color: var(--color-text-muted);
  padding: var(--space-8);
}

.video-placeholder .icon {
  font-size: 48px;
  opacity: 0.3;
}

/* ---------------------------------------------------------------------------
   Admin Dashboard
   --------------------------------------------------------------------------- */
.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.admin-stat-card {
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-5);
}

.admin-stat-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.admin-stat-value {
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--color-text-primary);
  margin-top: var(--space-1);
}

/* Admin sessions table */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.admin-table th {
  text-align: left;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--color-border);
}

.admin-table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid rgba(45, 63, 90, 0.3);
  color: var(--color-text-secondary);
}

.admin-table tr:hover td {
  background: var(--color-bg-hover);
}

/* ---------------------------------------------------------------------------
   Toast Notifications
   --------------------------------------------------------------------------- */
.toast-container {
  position: fixed;
  top: var(--space-4);
  right: var(--space-4);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
}

.toast {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  box-shadow: var(--shadow-lg);
  font-size: var(--text-sm);
  pointer-events: auto;
  animation: slideUp 0.3s ease;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 300px;
  max-width: 450px;
}

.toast.success {
  border-left: 3px solid var(--color-success);
}

.toast.error {
  border-left: 3px solid var(--color-error);
}

.toast.warning {
  border-left: 3px solid var(--color-warning);
}

.toast.info {
  border-left: 3px solid var(--color-info);
}

.toast.exiting {
  animation: fadeOut 0.2s ease forwards;
}

/* ---------------------------------------------------------------------------
   Modal
   --------------------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  animation: slideUp 0.3s ease;
}

.modal-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: var(--text-lg);
  font-weight: 600;
}

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-lg);
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: var(--color-bg-hover);
  color: var(--color-text-primary);
}

.modal-body {
  padding: var(--space-6);
}

.modal-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
}

/* ---------------------------------------------------------------------------
   Empty State
   --------------------------------------------------------------------------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-10);
  color: var(--color-text-muted);
  text-align: center;
}

.empty-state .icon {
  font-size: 48px;
  opacity: 0.3;
  margin-bottom: var(--space-4);
}

.empty-state h3 {
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-2);
}

.empty-state p {
  font-size: var(--text-sm);
  max-width: 320px;
}

/* ---------------------------------------------------------------------------
   Responsive
   --------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .content-area {
    grid-template-columns: 1fr;
  }
}

/* =============================================================================
   Panel System — Phase 2 Upgrade
   ============================================================================= */

/* ---------------------------------------------------------------------------
   Panel Toolbar
   --------------------------------------------------------------------------- */
.panel-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-4);
  gap: var(--space-3);
  flex-wrap: wrap;
}

.panel-toolbar-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text-primary);
}

.panel-toolbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.panel-toolbar-btn {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-text-secondary);
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.panel-toolbar-btn:hover {
  background: var(--color-bg-hover);
  color: var(--color-text-primary);
  border-color: var(--color-accent);
}

.panel-toolbar-btn.active {
  background: var(--color-accent-subtle);
  color: var(--color-accent);
  border-color: var(--color-accent);
}

/* Add Panel Dropdown */
.panel-add-dropdown {
  position: relative;
}

.panel-add-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-2);
  min-width: 200px;
  z-index: var(--z-dropdown);
}

.panel-add-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  transition: background var(--transition-fast);
}

.panel-add-item:hover {
  background: var(--color-bg-hover);
  color: var(--color-text-primary);
}

.panel-add-item.active {
  color: var(--color-accent);
}

.panel-add-item .check {
  margin-left: auto;
  color: var(--color-success);
  font-weight: 700;
}

/* Panel Management: an open panel's name shows it; its ✕ closes it */
.panel-add-row { display: flex; align-items: center; gap: 2px; }
.panel-add-row .panel-add-item { flex: 1; min-width: 0; }
.panel-add-x { flex: 0 0 auto; background: none; border: 1px solid transparent; color: var(--color-text-muted); border-radius: 4px; cursor: pointer; font-size: 11px; line-height: 1; padding: 3px 6px; }
.panel-add-x:hover { color: #e5484d; border-color: rgba(229, 72, 77, 0.5); }
button.panel-sub-name { background: none; border: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; padding: 0; }
button.panel-sub-name:hover { color: var(--color-text-primary); text-decoration: underline; }
/* "Here it is": the border glows twice */
.dash-panel.panel-flash { animation: panel-flash 0.8s ease-in-out 2; }
@keyframes panel-flash {
  0%, 100% { box-shadow: 0 0 0 0 transparent; }
  50% { box-shadow: 0 0 0 2px var(--color-accent, #3b82f6), 0 0 18px 4px var(--color-accent-glow, rgba(59, 130, 246, 0.5)); }
}

/* Controllers under Controller Slots (Panel Management) */
.panel-sub-list { display: flex; flex-direction: column; gap: 1px; margin: 0 0 var(--space-1) var(--space-5); border-left: 1px solid var(--color-border); padding-left: var(--space-2); }
.panel-sub-item { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-xs); color: var(--color-text-secondary); padding: 2px var(--space-1); border-radius: var(--radius-sm); }
.panel-sub-item:hover { background: var(--color-bg-hover); }
.panel-sub-item.dismissed { opacity: 0.6; }
.panel-sub-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.panel-sub-x { background: none; border: 1px solid transparent; color: var(--color-text-muted); border-radius: 4px; cursor: pointer; font-size: 11px; line-height: 1; padding: 2px 5px; }
.panel-sub-x:hover { color: #e5484d; border-color: rgba(229, 72, 77, 0.5); }

/* ---------------------------------------------------------------------------
   Panel Grid
   --------------------------------------------------------------------------- */
.panel-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
}

/* Wide screens (4K): 3 or 4 panels across, by the dashboard's own width (not the screen's,
   so the sidebar counts). Full-width panels still span the row. */
#panel-container { container-type: inline-size; }
@container (min-width: 1800px) {
  /* Wide panels take two columns rather than the whole row, and later panels fill the gaps */
  .panel-grid { grid-template-columns: repeat(3, 1fr); grid-auto-flow: row dense; }
  .panel-grid > .panel-w-full { grid-column: span 2; }
}
@container (min-width: 2500px) { .panel-grid { grid-template-columns: repeat(4, 1fr); } }
/* Settings → Appearance → Panels across: a most (body[data-max-cols]); Auto never goes past what fits */
@container (min-width: 2500px) { body[data-max-cols="3"] .panel-grid { grid-template-columns: repeat(3, 1fr); } }
@container (min-width: 1800px) {
  body[data-max-cols="2"] .panel-grid { grid-template-columns: repeat(2, 1fr); grid-auto-flow: row; }
  body[data-max-cols="2"] .panel-grid > .panel-w-full { grid-column: 1 / -1; }
}
body[data-max-cols="1"] .panel-grid { grid-template-columns: 1fr !important; }
body[data-max-cols="1"] .panel-grid > .dash-panel { grid-column: 1 / -1 !important; }
/* A session window laid out like its host's wide screen (SessionWindows sets .wide) */
.sw-grid.wide { grid-auto-flow: row dense; }
.sw-grid.wide > .panel-w-full { grid-column: span 2; }

@media (max-width: 1200px) {
  .panel-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------------------------------------------------------------------------
   Panel Element
   --------------------------------------------------------------------------- */
.dash-panel {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: box-shadow var(--transition-fast), border-color var(--transition-fast);
}

.dash-panel:hover {
  border-color: rgba(255, 255, 255, 0.08);
}

/* Width variants */
.panel-w-full {
  grid-column: 1 / -1;
}

.panel-w-half {
  grid-column: span 1;
}

/* Fullscreen panel (native Fullscreen API) */
.dash-panel:fullscreen,
.dash-panel:-webkit-full-screen {
  background: var(--color-bg-primary);
  border: none;
  border-radius: 0;
  width: 100vw !important;
  height: 100vh !important;
  max-height: 100vh !important;
  overflow-y: auto;
}

.dash-panel:fullscreen .dash-panel-body,
.dash-panel:-webkit-full-screen .dash-panel-body {
  max-height: calc(100vh - 48px);
  overflow-y: auto;
}

/* Fullscreen fallback (CSS overlay for browsers that don't support requestFullscreen) */
.dash-panel.panel-fullscreen {
  position: fixed !important;
  top: 0;
  left: 0;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 9999;
  border-radius: 0;
  border: none;
  background: var(--color-bg-primary);
  overflow-y: auto;
}

.dash-panel.panel-fullscreen .dash-panel-body {
  max-height: calc(100vh - 48px);
  overflow-y: auto;
}

/* Unlocked mode */
.dash-panel.unlocked {
  border-color: var(--color-accent-border);
  box-shadow: 0 0 0 1px var(--color-accent-glow);
}

.dash-panel.unlocked:hover {
  box-shadow: 0 0 0 2px var(--color-accent-glow);
}

/* Dragging */
.dash-panel.dragging {
  opacity: 0.5;
  border-color: var(--color-accent);
}

.dash-panel.drag-over {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 2px var(--color-accent);
}

.dash-panel.resizing {
  user-select: none;
}

/* ---------------------------------------------------------------------------
   Panel Header
   --------------------------------------------------------------------------- */
.dash-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  gap: var(--space-2);
  min-height: 44px;
}

.dash-panel-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-primary);
  white-space: nowrap;
}

.dash-panel-title .panel-icon {
  font-size: var(--text-md);
}

.drag-handle {
  cursor: grab;
  color: var(--color-text-muted);
  font-size: var(--text-md);
  padding: 2px;
  user-select: none;
}

.drag-handle:active {
  cursor: grabbing;
  color: var(--color-accent);
}

.dash-panel-actions {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.panel-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  font-size: 13px;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--color-text-muted);
  transition: all var(--transition-fast);
  padding: 0;
}

.panel-btn:hover {
  background: var(--color-bg-hover);
  color: var(--color-text-primary);
  border-color: var(--color-border);
}

.panel-btn-warn:hover {
  background: rgba(239, 68, 68, 0.15);
  color: var(--color-error);
  border-color: rgba(239, 68, 68, 0.3);
}

/* ---------------------------------------------------------------------------
   Panel Body
   --------------------------------------------------------------------------- */
.dash-panel-body {
  flex: 1;
  overflow: auto;
  padding: var(--space-4);
}

/* ---------------------------------------------------------------------------
   Panel Resize Handle
   --------------------------------------------------------------------------- */
.dash-panel-resize {
  height: 6px;
  cursor: ns-resize;
  background: transparent;
  transition: background var(--transition-fast);
  position: relative;
}

.dash-panel-resize::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 32px;
  height: 3px;
  border-radius: 2px;
  background: var(--color-border);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.dash-panel-resize:hover::after {
  opacity: 1;
}

.dash-panel-resize:hover {
  background: var(--color-accent-subtle);
}

/* =============================================================================
   Panel Content: CAN Feed Enhanced
   ============================================================================= */

.can-feed {
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 12px;
  line-height: 1.7;
  max-height: 450px;
  overflow-y: auto;
  scroll-behavior: smooth;
}

.can-feed .feed-line {
  display: grid;
  grid-template-columns: 90px 85px 60px 1fr auto;
  gap: var(--space-2);
  padding: 2px var(--space-2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.02);
  transition: background var(--transition-fast);
  align-items: center;
}

.can-feed .feed-line:hover {
  background: var(--color-bg-hover);
}

.can-feed .feed-ts {
  color: var(--color-text-muted);
}

.can-feed .feed-id {
  color: var(--color-data);
  font-weight: 600;
}

.can-feed .feed-pgn {
  color: #a78bfa;
}

.can-feed .feed-data {
  color: var(--color-text-secondary);
  word-break: break-all;
}

.can-feed .feed-name {
  color: #34d399;
  font-size: 11px;
}

.can-feed .feed-line.tx {
  border-left: 2px solid var(--color-accent);
}

.can-feed .feed-line.rx {
  border-left: 2px solid transparent;
}

.can-feed .feed-line.error {
  background: rgba(239, 68, 68, 0.05);
  border-left: 2px solid var(--color-error);
}

.feed-controls {
  display: flex;
  align-items: center;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  border-top: 1px solid var(--color-border);
}

.feed-counter {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
}

/* =============================================================================
   Panel Content: Commands
   ============================================================================= */

.commands-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.commands-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.commands-row {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.commands-divider {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: var(--space-1) 0;
}

.cmd-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.cmd-btn {
  flex: 1;
  min-width: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  font-weight: 500;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  color: var(--color-text-primary);
  background: var(--color-bg-tertiary);
}

.cmd-btn:hover {
  background: var(--color-bg-hover);
  border-color: rgba(255, 255, 255, 0.1);
}

.cmd-btn:active {
  transform: scale(0.97);
}

.cmd-icon {
  font-size: var(--text-md);
}

.cmd-estop {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

.cmd-estop:hover {
  background: rgba(239, 68, 68, 0.25);
}

.cmd-heartbeat {
  background: var(--color-accent-subtle);
  border-color: var(--color-accent-border);
}

.cmd-identity {
  background: rgba(168, 85, 247, 0.1);
  border-color: rgba(168, 85, 247, 0.2);
}

.cmd-poweron {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.2);
}

.cmd-primary {
  background: var(--color-accent);
  color: white;
  border-color: var(--color-accent);
}

.cmd-success {
  background: var(--color-success);
  color: white;
  border-color: var(--color-success);
}

.cmd-danger {
  background: var(--color-error);
  color: white;
  border-color: var(--color-error);
}

.cmd-secondary {
  background: var(--color-bg-tertiary);
}

.cmd-slider {
  width: 100%;
  accent-color: var(--color-accent);
}

/* Command line entries */
.command-lines {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-height: 300px;
  overflow-y: auto;
  padding: var(--space-2);
  background: rgba(0, 0, 0, 0.15);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}

.command-line-entry {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.command-line-entry select,
.command-line-entry input {
  padding: var(--space-2);
  font-size: var(--text-xs);
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-primary);
}

.command-line-entry .cmd-type {
  width: 80px;
}

.command-line-entry .cmd-code {
  flex: 1;
}

.command-line-entry .cmd-data {
  flex: 1;
}

.command-line-entry .cmd-duration {
  width: 80px;
}

.cmd-remove {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--color-text-muted);
  font-size: 14px;
  transition: all var(--transition-fast);
}

.cmd-remove:hover {
  background: rgba(239, 68, 68, 0.15);
  color: var(--color-error);
  border-color: rgba(239, 68, 68, 0.3);
}

/* =============================================================================
   Panel Content: Identifiers
   ============================================================================= */

.identifiers-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.id-search input {
  width: 100%;
}

.id-list {
  max-height: 350px;
  overflow-y: auto;
}

.id-item {
  display: grid;
  grid-template-columns: 80px 1fr 2fr;
  gap: var(--space-2);
  padding: var(--space-2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  font-size: var(--text-xs);
  transition: background var(--transition-fast);
}

.id-item:hover {
  background: var(--color-bg-hover);
}

.id-pgn {
  color: var(--color-data);
  font-family: monospace;
  font-weight: 600;
}

.id-name {
  color: var(--color-text-primary);
  font-weight: 500;
}

.id-desc {
  color: var(--color-text-muted);
}

/* =============================================================================
   Panel Content: System Logs
   ============================================================================= */

.logs-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.log-controls {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.log-level-filter {
  display: flex;
  gap: var(--space-3);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.log-level-filter label {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  cursor: pointer;
}

.log-entries {
  max-height: 300px;
  overflow-y: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  line-height: 1.7;
  background: rgba(0, 0, 0, 0.1);
  border-radius: var(--radius-md);
  padding: var(--space-2);
}

.log-entry {
  display: flex;
  gap: var(--space-3);
  padding: 1px var(--space-2);
  border-left: 2px solid transparent;
}

.log-entry.log-info {
  border-left-color: var(--color-accent);
}

.log-entry.log-warn {
  border-left-color: #f59e0b;
}

.log-entry.log-error {
  border-left-color: var(--color-error);
}

.log-ts {
  color: var(--color-text-muted);
  white-space: nowrap;
  min-width: 70px;
}

.log-msg {
  color: var(--color-text-secondary);
}

.log-entry.log-warn .log-msg {
  color: #fbbf24;
}

.log-entry.log-error .log-msg {
  color: #fca5a5;
}

/* =============================================================================
   Panel Content: Video
   ============================================================================= */

.video-container {
  position: relative;
  width: 100%;
  min-height: 250px;
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.video-container video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.video-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.video-placeholder .icon {
  font-size: 48px;
  opacity: 0.3;
  margin-bottom: var(--space-3);
}

/* =============================================================================
   Feed Settings Modal
   ============================================================================= */
.feed-settings-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
}

.feed-settings-dialog {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  max-width: 500px;
  width: 90%;
}

.feed-settings-dialog h3 {
  font-size: var(--text-md);
  font-weight: 600;
  margin-bottom: var(--space-4);
}

.feed-settings-dialog .form-group {
  margin-bottom: var(--space-4);
}

/* =============================================================================
   Gamepad Top-Bar Indicator
   ============================================================================= */
.gamepad-status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  transition: all var(--transition-fast);
}

/* Read-only (sniffer) mode — visible whenever TX is blocked */
.readonly-indicator {
  display: inline-flex;
  align-items: center;
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: var(--color-warning-bg);
  border: 1px solid var(--color-warning);
  color: var(--color-warning);
  cursor: pointer;
}
.readonly-indicator.hidden { display: none; }
.sidebar-link.readonly-on { color: var(--color-warning); }

.gamepad-status-indicator.connected {
  background: var(--color-success-bg);
  border-color: rgba(34, 197, 94, 0.4);
  color: var(--color-success);
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.2);
}

.gamepad-status-indicator .gamepad-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-text-muted);
}

.gamepad-status-indicator.connected .gamepad-dot {
  background: var(--color-success);
  box-shadow: 0 0 6px var(--color-success);
  animation: pulse-dot 2s infinite;
}

/* =============================================================================
   Virtual Xbox Controller Panel
   ============================================================================= */
.vc-wrapper {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  width: 100%;
  height: 100%;
}

.vc-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  flex-wrap: wrap;
  padding: 4px 0;
  border-bottom: 1px solid var(--color-border);
}

.vc-top-left {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.vc-top-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* Collapsible top & bottom bars */
.vc-top-bar.collapsed {
  max-height: 0;
  padding: 0;
  overflow: hidden;
  border: none;
  opacity: 0;
  transition: max-height 0.3s ease, padding 0.2s ease, opacity 0.2s ease;
}

.vc-top-bar:not(.collapsed) {
  max-height: 200px;
  transition: max-height 0.3s ease, opacity 0.2s ease;
}

.vc-custom-section.collapsed {
  max-height: 0;
  padding: 0;
  overflow: hidden;
  border: none;
  opacity: 0;
  transition: max-height 0.3s ease, padding 0.2s ease, opacity 0.2s ease;
}

.vc-custom-section:not(.collapsed) {
  max-height: 500px;
  transition: max-height 0.3s ease, opacity 0.2s ease;
}

.vc-collapse-tab {
  display: block;
  width: 100%;
  background: var(--color-bg-tertiary);
  border: none;
  border-radius: 0;
  color: var(--color-text-muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 0;
  text-align: center;
  transition: background 0.15s ease, color 0.15s ease;
}

.vc-collapse-tab:hover {
  background: var(--color-bg-secondary);
  color: var(--color-text-primary);
}

.vc-controller-viewport {
  position: relative;
  width: 100%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 0;
  background: radial-gradient(circle at 50% 50%, rgba(30, 41, 59, 0.4) 0%, transparent 80%);
  border-radius: var(--radius-lg);
}

.vc-controller {
  position: relative;
  width: 660px;
  max-width: 96%;
  aspect-ratio: 1.62;
  background: radial-gradient(ellipse at 50% 50%, #1e293b 0%, #0f172a 75%, #080d1a 100%);
  border-radius: 50px;
  border: 2px solid rgba(148, 163, 184, 0.25);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6), inset 0 2px 8px rgba(255, 255, 255, 0.08);
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

/* Base button */
.vc-btn {
  position: absolute;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  transition: transform 0.06s ease, filter 0.08s ease, box-shadow 0.08s ease;
  z-index: 10;
  -webkit-tap-highlight-color: transparent;
}

.vc-btn:active, .vc-btn.active {
  filter: brightness(1.7) contrast(1.1);
  transform: scale(0.92);
}

/* Face Buttons (Right Cluster: A, B, X, Y) */
.vc-face-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 16px;
  font-family: var(--font-sans);
  color: #ffffff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5), inset 0 2px 4px rgba(255, 255, 255, 0.35);
  border: 2px solid rgba(255, 255, 255, 0.15);
}

.vc-btn-a {
  top: 50%;
  right: 12%;
  background: radial-gradient(circle at 35% 30%, #22c55e, #15803d);
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.35), inset 0 2px 4px rgba(255, 255, 255, 0.4);
}
.vc-btn-b {
  top: 36%;
  right: 4%;
  background: radial-gradient(circle at 35% 30%, #ef4444, #b91c1c);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35), inset 0 2px 4px rgba(255, 255, 255, 0.4);
}
.vc-btn-x {
  top: 36%;
  right: 20%;
  background: radial-gradient(circle at 35% 30%, #3b82f6, #1d4ed8);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35), inset 0 2px 4px rgba(255, 255, 255, 0.4);
}
.vc-btn-y {
  top: 22%;
  right: 12%;
  background: radial-gradient(circle at 35% 30%, #eab308, #a16207);
  box-shadow: 0 4px 12px rgba(234, 179, 8, 0.35), inset 0 2px 4px rgba(255, 255, 255, 0.4);
}

/* Bumpers (LB, RB) */
.vc-bumper {
  width: 84px;
  height: 28px;
  border-radius: 6px;
  font-size: 11px;
  letter-spacing: 0.5px;
  background: linear-gradient(180deg, #334155, #1e293b);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
  box-shadow: 0 3px 6px rgba(0,0,0,0.4);
}
.vc-bumper:hover { color: #fff; border-color: rgba(255,255,255,0.3); }
.vc-bumper.active { background: #3b82f6; color: #fff; box-shadow: 0 0 12px rgba(59,130,246,0.6); }

.vc-bumper-lb { top: 7%; left: 8%; }
.vc-bumper-rb { top: 7%; right: 8%; }

/* Triggers (LT, RT) with fill bar */
.vc-trigger {
  width: 68px;
  height: 42px;
  border-radius: 8px 8px 16px 16px;
  font-size: 11px;
  font-weight: 700;
  background: linear-gradient(180deg, #1e293b, #0f172a);
  border: 1px solid rgba(148, 163, 184, 0.3);
  color: #94a3b8;
  flex-direction: column;
  gap: 3px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.5);
}
.vc-trigger:hover { color: #fff; }
.vc-trigger.active { background: #334155; color: #fff; border-color: var(--color-accent); }

.vc-trigger-lt { top: -1%; left: 8%; }
.vc-trigger-rt { top: -1%; right: 8%; }

.vc-fill-bar {
  width: 44px;
  height: 4px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 2px;
  overflow: hidden;
}
.vc-fill {
  height: 100%;
  background: #f59e0b;
  width: 0%;
  border-radius: 2px;
  transition: width 0.05s ease;
}

/* Center Buttons: VIEW, MENU, XBOX */
.vc-center-btn {
  width: 40px;
  height: 24px;
  border-radius: 12px;
  font-size: 8px;
  letter-spacing: 0.5px;
  background: #1e293b;
  border: 1px solid rgba(148, 163, 184, 0.25);
  color: #94a3b8;
  box-shadow: 0 2px 5px rgba(0,0,0,0.4);
}
.vc-center-btn:hover { color: #fff; border-color: rgba(255,255,255,0.3); }
.vc-btn-view { bottom: 6%; left: 38%; }
.vc-btn-menu { bottom: 6%; right: 38%; }

.vc-btn-xbox {
  bottom: 6%;
  left: 50%;
  transform: translateX(-50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 16px;
  background: radial-gradient(circle at 35% 35%, #334155, #0f172a);
  border: 2px solid rgba(148, 163, 184, 0.35);
  color: #cbd5e1;
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.6);
}
.vc-btn-xbox:hover { border-color: var(--color-success); color: var(--color-success); box-shadow: 0 0 10px rgba(34, 197, 94, 0.4); }

/* D-Pad (Left bottom cluster) */
.vc-dpad-wrap {
  position: absolute;
  top: 72%;
  left: 24%;   /* 9.18.2: in from the edge, as on an Xbox controller (was 14%, right under the left stick) */
  transform: translate(-50%, -50%);
  width: 96px;
  height: 96px;
}

.vc-dpad-btn {
  position: absolute;
  background: #1e293b;
  border: 1px solid rgba(148, 163, 184, 0.3);
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}
.vc-dpad-btn:hover { color: #fff; background: #334155; }
.vc-dpad-btn.active { background: #3b82f6; color: #fff; border-color: #60a5fa; }

.vc-dpad-up    { top: 0; left: 32px; width: 32px; height: 32px; border-radius: 6px 6px 0 0; }
.vc-dpad-down  { bottom: 0; left: 32px; width: 32px; height: 32px; border-radius: 0 0 6px 6px; }
.vc-dpad-left  { top: 32px; left: 0; width: 32px; height: 32px; border-radius: 6px 0 0 6px; }
.vc-dpad-right { top: 32px; right: 0; width: 32px; height: 32px; border-radius: 0 6px 6px 0; }
.vc-dpad-center {
  position: absolute;
  top: 32px;
  left: 32px;
  width: 32px;
  height: 32px;
  background: #151e2e;
  pointer-events: none;
}

/* Analog Sticks (Left & Right) */
.vc-stick-zone {
  position: absolute;
  width: 104px;
  height: 104px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 40%, #1a2333, #0a0f18);
  border: 2px solid rgba(148, 163, 184, 0.2);
  box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.6);
}
.vc-stick-zone-l { top: 40%; left: 14%; transform: translate(-50%, -50%); }
.vc-stick-zone-r { top: 72%; right: 24%; transform: translate(50%, -50%); }   /* 9.18.2: in from the edge (was 14%) */

.vc-stick-thumb {
  position: absolute;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #334155, #1e293b);
  border: 2px solid rgba(148, 163, 184, 0.4);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
  cursor: grab;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 20;
  touch-action: none;
}
.vc-stick-thumb:active, .vc-stick-thumb.dragging {
  cursor: grabbing;
  box-shadow: 0 0 16px rgba(59, 130, 246, 0.5);
  border-color: #3b82f6;
}

.vc-stick-label {
  position: absolute;
  font-size: 9px;
  font-weight: 700;
  color: #94a3b8;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.25);
  z-index: 5;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.vc-stick-label:hover { color: #fff; border-color: rgba(255,255,255,0.4); }
.vc-stick-label.active { color: #fff; background: #3b82f6; border-color: #60a5fa; }
.vc-stick-label-l { top: 58%; left: 14%; transform: translate(-50%, 0); }
.vc-stick-label-r { top: 92%; right: 24%; transform: translate(50%, 0); }

/* Profile Action Badges (.vc-btn-label) */
.vc-btn-label {
  position: absolute;
  font-size: 8px;
  font-weight: 600;
  color: #f87171;
  pointer-events: auto;
  cursor: default;
  z-index: 31;
  background: rgba(15, 23, 42, 0.9);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(248, 113, 113, 0.4);
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
  transition: opacity 0.2s ease, font-size 0.2s ease;
  letter-spacing: 0.3px;
}
.vc-btn-label:hover { z-index: 999 !important; box-shadow: 0 0 12px rgba(0,0,0,0.9); }
.vc-btn-label.label-back { color: #ec4899; border-color: rgba(236, 72, 153, 0.5); }
.vc-btn-label.label-start { color: #c084fc; border-color: rgba(192, 132, 252, 0.5); }
.vc-btn-label .mod-back { color: #ec4899; font-size: 0.9em; margin-top: 2px; padding-top: 2px; border-top: 1px dotted rgba(236, 72, 153, 0.4); }
.vc-btn-label .mod-start { color: #c084fc; font-size: 0.9em; margin-top: 2px; padding-top: 2px; border-top: 1px dotted rgba(192, 132, 252, 0.4); }

.vc-btn-label.ptr-right::after {
  content: ''; position: absolute; right: -7px; top: 50%; transform: translateY(-50%);
  border-width: 4px 0 4px 7px; border-style: solid;
  border-color: transparent transparent transparent rgba(248, 113, 113, 0.7);
}
.vc-btn-label.ptr-left::before {
  content: ''; position: absolute; left: -7px; top: 50%; transform: translateY(-50%);
  border-width: 4px 7px 4px 0; border-style: solid;
  border-color: transparent rgba(248, 113, 113, 0.7) transparent transparent;
}

.vc-labels-hidden .vc-btn-label { opacity: 0; pointer-events: none; }
.vc-labels-large .vc-btn-label { font-size: 11px; padding: 4px 8px; border-width: 2px; }

/* Keyboard hints */
.vc-key-hint {
  position: absolute;
  font-size: 8px;
  color: #facc15;
  font-weight: 700;
  pointer-events: none;
  z-index: 30;
  background: rgba(0, 0, 0, 0.65);
  padding: 1px 4px;
  border-radius: 3px;
  border: 1px solid rgba(250, 204, 21, 0.3);
}
.vc-hints-hidden .vc-key-hint { display: none; }

/* Custom Buttons Bar */
.vc-custom-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid var(--color-border);
}

.vc-custom-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.vc-custom-list {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

/* =============================================================================
   Basic Control Panel
   ============================================================================= */
.bp-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  height: 100%;
}

.bp-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  flex-wrap: wrap;
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--color-border);
}

.bp-category-section {
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  margin-bottom: var(--space-3);
}

.bp-category-title {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--color-accent);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.bp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: var(--space-2);
}

/* Push / Tap / Latch Card */
.bp-card {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  min-height: 42px;
  transition: all var(--transition-fast);
}

.bp-card:hover {
  background: var(--color-bg-hover);
  border-color: var(--color-border-light);
}

.bp-card:active, .bp-card.held {
  transform: scale(0.97);
  background: var(--color-accent-subtle);
  border-color: var(--color-accent);
  box-shadow: 0 0 10px var(--color-accent-glow);
}

.bp-card.latched {
  background: rgba(34, 197, 94, 0.12);
  border-color: var(--color-success);
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.25);
  animation: pulse-latched 2s infinite alternate;
}

@keyframes pulse-latched {
  0% { box-shadow: 0 0 4px rgba(34, 197, 94, 0.2); }
  100% { box-shadow: 0 0 12px rgba(34, 197, 94, 0.5); }
}

.bp-card-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

/* Latch Switch Thumb */
.bp-latch-toggle {
  width: 26px;
  height: 14px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.15);
  position: relative;
  flex-shrink: 0;
  transition: background-color var(--transition-fast);
}
.bp-latch-thumb {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ffffff;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: left var(--transition-fast);
}

.bp-card.latched .bp-latch-toggle {
  background: var(--color-success);
}
.bp-card.latched .bp-latch-thumb {
  left: 14px;
}

/* Compound Directional Widget (e.g. Pan / Tilt / Zoom pairs) */
.bp-compound {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-2);
  grid-column: span 2;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bp-compound-header {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--color-text-muted);
  font-weight: 700;
}

.bp-compound-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.bp-dir-btn {
  flex: 1;
  padding: 8px 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-bg-tertiary);
  color: var(--color-text-primary);
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all var(--transition-fast);
  user-select: none;
  touch-action: none;
}
.bp-dir-btn:hover { background: var(--color-bg-hover); }
.bp-dir-btn:active, .bp-dir-btn.held {
  background: var(--color-accent-subtle);
  border-color: var(--color-accent);
  color: #fff;
  box-shadow: 0 0 8px var(--color-accent-glow);
  transform: scale(0.96);
}

/* 3-Way Rocker Switch */
.bp-tri-rocker {
  width: 44px;
  height: 20px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  position: relative;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  cursor: pointer;
}
.bp-tri-rocker-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #94a3b8;
  position: absolute;
  top: 2px;
  left: 14px;
  transition: left var(--transition-fast), background var(--transition-fast);
}
.bp-tri-rocker.state-left { background: rgba(59, 130, 246, 0.2); }
.bp-tri-rocker.state-left .bp-tri-rocker-thumb { left: 3px; background: var(--color-accent); }
.bp-tri-rocker.state-right { background: rgba(59, 130, 246, 0.2); }
.bp-tri-rocker.state-right .bp-tri-rocker-thumb { left: 25px; background: var(--color-accent); }

/* Latching 3-way switch standing up (Up / Down pairs, the vertical arm of a cross) */
.bp-tri-rocker.vertical { width: 20px; height: 44px; }
.bp-tri-rocker.vertical .bp-tri-rocker-thumb { left: 2px; top: 14px; transition: top var(--transition-fast), background var(--transition-fast); }
.bp-tri-rocker.vertical.state-left .bp-tri-rocker-thumb { left: 2px; top: 3px; }
.bp-tri-rocker.vertical.state-right .bp-tri-rocker-thumb { left: 2px; top: 25px; }
.bp-latch-rocker.state-left, .bp-latch-rocker.state-right { box-shadow: 0 0 8px var(--color-accent-glow); }

/* Up above Down */
.bp-compound.bp-vertical { grid-column: span 1; }
.bp-vstack { display: flex; flex-direction: column; gap: 6px; flex: 1; }

/* Drive / camera cross: forward on top, back below, left and right either side */
.bp-compound.bp-cross-card { grid-column: 1 / -1; }
.bp-cross-row { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.bp-cross { display: grid; grid-template-columns: repeat(3, minmax(64px, 1fr)); grid-template-rows: repeat(3, 40px); gap: 4px; flex: 1; min-width: 200px; }
.bp-cross .bp-dir-btn { display: flex; align-items: center; justify-content: center; }
.bp-cross-stop { color: #e5484d; opacity: 0.85; }
.bp-cross-stop svg { display: block; }
.bp-cross-stop:hover { opacity: 1; background: rgba(229, 72, 77, 0.12); border-color: rgba(229, 72, 77, 0.5); }
/* Pairs in a column, single buttons stacked beside them */
.bp-body { display: flex; flex-direction: column; gap: 6px; }
/* (9.8.8) the singles go under the pairs when there isn't room beside them, instead of on top */
.bp-duo { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-start; }
.bp-duo-pairs { flex: 1 1 190px; min-width: 190px; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px; }
.bp-duo-singles { flex: 0 0 150px; display: flex; flex-direction: column; gap: 6px; }
/* (9.14.4) pairs on their own in a section's column: their natural height (the 190px basis is a width, beside singles) */
.bp-body > .bp-duo-pairs { flex: 0 0 auto; }
.bp-layout .bp-compound, .bp-layout .bp-compound.bp-vertical { grid-column: auto; }
.bp-cam-model { margin-left: auto; font-size: 11px; text-transform: none; letter-spacing: 0; background: var(--color-bg-secondary); color: var(--color-text-secondary); border: 1px solid var(--color-border); border-radius: 6px; padding: 1px 4px; }
.bp-cross-latches { display: grid; grid-template-columns: auto auto; align-items: center; gap: 6px 8px; }
.bp-cross-latches label { font-size: 10px; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.6px; font-weight: 700; }
.bp-footage { font-size: var(--text-xs); color: var(--color-text-primary); text-transform: none; letter-spacing: 0; margin-left: 6px; font-weight: 600; }
.bp-clutch { justify-content: center; }
.bp-footage[role="button"] { cursor: pointer; border-bottom: 1px dotted currentColor; }

/* Compact layout (8.11): reel along the top, tractor left, camera right, the rest below */
.bp-container { container-type: inline-size; }
.bp-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-2); align-items: start; }
.bp-area { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.bp-layout .bp-category-section { margin-bottom: 0; padding: var(--space-2); }
.bp-layout .bp-category-title { margin-bottom: var(--space-2); padding-bottom: var(--space-1); }
.bp-layout .bp-grid { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 6px; align-items: start; }
.bp-layout .bp-card { min-height: 34px; padding: 4px var(--space-2); }
.bp-layout .bp-compound { padding: 6px; gap: 4px; }
.bp-layout .bp-dir-btn { padding: 6px 4px; }
.bp-layout .bp-slider-card { padding: 4px var(--space-2); }
.bp-layout .bp-slider-card label { min-width: 90px; }
/* The reel: one strip — title and footage, speed slider, clutch */
.bp-layout .bp-cat-reel { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.bp-layout .bp-cat-reel .bp-category-title { margin: 0; padding: 0; border: 0; white-space: nowrap; }
.bp-layout .bp-cat-reel .bp-grid { display: flex; flex-wrap: wrap; flex: 1; align-items: center; gap: var(--space-2); min-width: 0; }
.bp-layout .bp-cat-reel .bp-slider-card { flex: 1 1 200px; min-width: 0; }
.bp-layout .bp-slider-card input[type="range"] { min-width: 0; }
.bp-layout .bp-cat-reel .bp-card { flex: 0 0 auto; min-width: 110px; }
/* Crosses, condensed */
.bp-layout .bp-cross { grid-template-columns: repeat(3, minmax(44px, 76px)); grid-template-rows: repeat(3, 30px); gap: 3px; min-width: 0; flex: 0 1 auto; }
.bp-layout .bp-cross .bp-dir-btn { font-size: 11px; padding: 2px; }
.bp-layout .bp-cross-row { gap: var(--space-2); justify-content: space-between; }
@container (min-width: 620px) {
  .bp-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "top top" "left right" "bottom bottom"; }
  .bp-area-top { grid-area: top; } .bp-area-left { grid-area: left; } .bp-area-right { grid-area: right; } .bp-area-bottom { grid-area: bottom; }
  .bp-layout:not(:has(.bp-area-right)) .bp-area-left, .bp-layout:not(:has(.bp-area-left)) .bp-area-right { grid-column: 1 / -1; }
}

/* Slider Card */
.bp-slider-card {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.bp-slider-card label {
  min-width: 110px;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-secondary);
}

.bp-slider-card input[type="range"] {
  flex: 1;
  accent-color: var(--color-accent);
}

.bp-slider-card .bp-val {
  min-width: 40px;
  text-align: right;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-primary);
  font-weight: 600;
}

/* =============================================================================
   GUI Profile Rebind Builder
   ============================================================================= */
.pe-tabs {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-border);
  padding-bottom: var(--space-2);
}

.pe-tab-btn {
  background: transparent;
  border: none;
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.pe-tab-btn.active {
  background: var(--color-bg-tertiary);
  color: var(--color-accent);
}

.pe-builder-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  overflow-y: auto;
  max-height: 52vh;
  padding-right: var(--space-2);
}

.pe-builder-row {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  background: var(--color-bg-tertiary);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  flex-wrap: wrap;
}

.pe-bindings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-xs);
}

.pe-bindings-table th, .pe-bindings-table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

.pe-bindings-table th {
  color: var(--color-text-muted);
  font-weight: 600;
  text-transform: uppercase;
}

/* =============================================================================
   Mobile Responsiveness
   ============================================================================= */
@media (max-width: 768px) {
  /* Make main content full width on mobile regardless of sidebar state */
  .main-content {
    margin-left: 0 !important;
  }

  /* Open Sidebar on mobile floats above content, full labels, never wider than the screen */
  .sidebar {
    width: min(var(--sidebar-width), 85vw);
    box-shadow: 2px 0 12px rgba(0,0,0,0.5);
    z-index: var(--z-overlay); /* Must be higher than top-bar's --z-sticky */
  }

  /* Collapsed Sidebar completely hides, leaving only the floating toggle button */
  .sidebar-collapsed .sidebar {
    width: 0;
    border-right: none;
    box-shadow: none;
    overflow: visible;
  }

  .sidebar-collapsed .sidebar-nav,
  .sidebar-collapsed .sidebar-user {
    display: none;
  }

  .sidebar-collapsed .sidebar-header {
    padding: 0;
  }

  .sidebar-collapsed .sidebar-toggle {
    position: fixed;
    top: 8px;
    left: 8px;
    z-index: var(--z-modal); /* Must be higher than everything so it's always clickable */
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 6px 8px;
    margin: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  }

  /* Make room in top bar for the floating toggle when collapsed */
  .sidebar-collapsed .top-bar {
    padding-left: 55px;
  }

  /* Top bar: keep status dots and buttons, drop their text so nothing is clipped */
  .top-bar {
    padding-right: var(--space-3);
    gap: var(--space-2);
  }
  .top-bar-left {
    min-width: 0;
  }
  .top-bar-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .top-bar-right {
    gap: var(--space-2);
    flex-shrink: 0;
  }
  #hw-status-bar-text,
  #gamepad-status-text {
    display: none;
  }
}
/* ---------------------------------------------------------------------------
   Node Link panel
   --------------------------------------------------------------------------- */
.node-link h4 {
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-1);
}

.nl-note {
  background: var(--color-warning-bg);
  border-left: 3px solid var(--color-warning);
  color: var(--color-warning);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-3);
  font-size: var(--text-sm);
}

.nl-status {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  font-size: var(--text-sm);
}

.nl-status.connected .hw-status-dot { background: var(--color-success); }

.nl-request {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  margin-bottom: var(--space-3);
}

.nl-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-4);
}

.nl-addr {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-mono, monospace);
  font-size: var(--text-sm);
  padding: 2px 0;
}

/* ---------------------------------------------------------------------------
   Live CAN Feed scroller — the rows sit in an absolutely placed box, so they
   never make the panel taller; the panel keeps its own size and the feed
   scrolls inside it.
   --------------------------------------------------------------------------- */
.dash-panel-body.can-feed-host {
  position: relative;
  padding: 0;
  overflow: hidden;
  min-height: 0;
}

.can-feed-host > .can-feed-scroll {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overflow-anchor: none; /* Feed.js keeps the view steady itself when old rows are trimmed */
  padding: var(--space-2) 0;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: 1.6;
}

.can-feed-host > .can-feed-latest {
  position: absolute;
  right: var(--space-4);
  bottom: var(--space-3);
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--color-accent-border);
  border-radius: var(--radius-full, 999px);
  background: var(--color-bg-secondary);
  color: var(--color-accent);
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.can-feed-host > .can-feed-latest[hidden] {
  display: none;
}

/* ---------------------------------------------------------------------------
   Function colours — tractor / camera / reel … (Basic Panel sections, preset buttons).
   The same hues as the telemetry cards' top stripes, so a function matches its device.
   --------------------------------------------------------------------------- */
.bp-cat-tractor      { --cat: #e5484d; }
.bp-cat-camera       { --cat: #3b82f6; }
.bp-cat-reel         { --cat: #22c55e; }
.bp-cat-cutter       { --cat: #f59e0b; }
.bp-cat-articulation { --cat: #a855f7; }
.bp-cat-system       { --cat: #94a3b8; }

.bp-category-section[class*="bp-cat-"] { border-left: 4px solid var(--cat); }
.bp-category-section[class*="bp-cat-"] .bp-category-title { color: var(--cat); }
.bp-category-section[class*="bp-cat-"] .bp-card,
.bp-category-section[class*="bp-cat-"] .bp-slider-card,
.bp-category-section[class*="bp-cat-"] .bp-compound { box-shadow: inset 3px 0 0 var(--cat); }
.bp-category-section[class*="bp-cat-"] .bp-card:active,
.bp-category-section[class*="bp-cat-"] .bp-card.held,
.bp-category-section[class*="bp-cat-"] .bp-card.latched { border-color: var(--cat); }
.btn.bp-cat-camera { border-color: var(--cat); }
.bp-preset { min-width: 64px; justify-content: center; }
.bp-preset { color: var(--color-text-primary); font-weight: 600; font-size: var(--text-sm); }
/* Share (Xbox Series): the official layouts' beacon */
.vc-btn-share { bottom: 19%; left: 50%; transform: translateX(-50%); width: 26px; height: 18px; font-size: 11px; border-radius: 6px; }

/* Virtual Controller: each label's View / Menu function, and the modifiers latched by a double-click */
.vc-btn-label .vc-lbl-main { display: block; }
.vc-btn-label .vc-lbl-mod { display: block; font-size: 0.78em; color: #c084fc; opacity: 0.85; white-space: nowrap; }
.vc-mod-8 .vc-btn-label .vc-lbl-main,
.vc-mod-9 .vc-btn-label .vc-lbl-main { opacity: 0.3; }
.vc-mod-8 .vc-btn-label .vc-lbl-mod-8,
.vc-mod-9 .vc-btn-label .vc-lbl-mod-9 { opacity: 1; font-weight: 700; font-size: 1em; color: #e9d5ff; }
.vc-mod-8 .vc-btn-label.no-mod-8,
.vc-mod-9 .vc-btn-label.no-mod-9 { opacity: 0.3; }
.vc-btn.latched { box-shadow: 0 0 0 3px #a855f7, 0 0 12px rgba(168, 85, 247, 0.7); }
/* Labels are information only: a click on one goes to the button underneath */
.vc-profile-labels-group, .vc-profile-labels-group .vc-btn-label { pointer-events: none; }


/* =============================================================================
   Session windows (8.13): someone's CDS in a window here, tabs under Sessions
   ============================================================================= */
/* Beside the sidebar, so the tabs under Sessions stay in reach */
.session-window { position: fixed; top: 3vh; bottom: 3vh; right: 2vw; left: calc(var(--sidebar-width) + 12px); z-index: 900; display: flex; flex-direction: column;
  background: var(--color-bg-primary); border: 1px solid var(--color-border-light, var(--color-border));
  border-radius: var(--radius-lg); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); overflow: hidden; }
.session-window.hidden { display: none; }
.session-window.operating { border-color: #f59e0b; box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.35), 0 20px 60px rgba(0, 0, 0, 0.5); }
.sw-header { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--color-border); background: var(--color-bg-secondary); }
.sw-title { font-weight: 600; font-size: var(--text-sm); }
.sw-body { position: relative; flex: 1; overflow: auto; padding: 8px; }
.sw-scaler { position: relative; overflow: hidden; }
.sw-grid { transform-origin: top left; position: absolute; top: 0; left: 0; }
.sw-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: var(--text-sm); }
/* Their rail and top bar around the panels (Bug #76), in the window rather than fixed to this screen */
.sw-frame { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.sw-main { flex: 1; min-height: 0; display: flex; }
.sw-main.rail-bottom { flex-direction: column-reverse; }
.sw-main > .sw-body { min-width: 0; }
.sw-topbar { flex-shrink: 0; display: flex; align-items: center; gap: 8px; height: var(--header-height); padding: 0 12px; overflow-x: auto; scrollbar-width: none;
  background: var(--color-bg-secondary); border-bottom: 1px solid var(--color-border); }
.sw-topbar * { pointer-events: none; }   /* their STOP, adapters and sharing are theirs only */
.sw-topbar > .tb-stop { margin-left: auto; }
.sw-rail { flex-shrink: 0; width: 84px; display: flex; flex-direction: column; gap: 2px; padding: 10px 0; overflow-y: auto; scrollbar-width: none;
  background: var(--color-sidebar-bg, var(--color-bg-secondary)); border-right: 1px solid var(--color-border); }
.sw-main.rail-bottom > .sw-rail { width: auto; flex-direction: row; align-items: stretch; padding: 0 4px; overflow-x: auto; overflow-y: hidden; gap: 0;
  border-right: 0; border-top: 1px solid var(--color-border); }
.sw-main.rail-bottom > .sw-rail .rail-logo, .sw-main.rail-bottom > .sw-rail .rail-grow { display: none; }
.sw-main.rail-bottom > .sw-rail .rail-item { margin: 4px 1px; padding: 6px 8px; min-width: 62px; flex-shrink: 0; justify-content: center; }
.sw-main.rail-bottom > .sw-rail .rail-item.active::before { display: none; }
.sw-rail .rail-item:not([data-page]), .session-window:not(.operating) .sw-rail .rail-item { cursor: default; }
.session-window:not(.operating) .sw-rail .rail-item:not(.active):hover { background: none; color: var(--color-sidebar-text, var(--color-text-secondary)); }
.sw-page { grid-column: 1 / -1; min-width: 0; }
.sw-page-hidden { padding: var(--space-6); text-align: center; color: var(--color-text-muted); }
@media (max-width: 559px) { .sw-main:not(.rail-bottom) > .sw-rail { width: 64px; } .sw-rail .rail-item span { font-size: 9px; } }
.session-window:not(.operating) .sw-grid input,
.session-window:not(.operating) .sw-grid select,
.session-window:not(.operating) .sw-grid textarea { pointer-events: none; }
.session-window:not(.operating) .sw-grid button,
.session-window:not(.operating) .sw-grid [role=button] { cursor: default; }
.session-tabs { display: flex; flex-direction: column; gap: 2px; margin: 0 0 var(--space-1) var(--space-5); }
.session-tabs:empty { display: none; }
.session-tab { display: flex; align-items: center; gap: 2px; border-radius: var(--radius-sm); }
.session-tab.open { background: var(--color-bg-hover); }
.session-tab .st-open { flex: 1; min-width: 0; text-align: left; background: none; border: 0; color: var(--color-text-secondary);
  font-size: var(--text-xs); padding: 3px 6px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session-tab .st-x { background: none; border: 1px solid transparent; color: var(--color-text-muted); border-radius: 4px; cursor: pointer; font-size: 11px; padding: 1px 5px; }
.session-tab .st-x:hover { color: #e5484d; border-color: rgba(229, 72, 77, 0.5); }
body.sidebar-collapsed .session-tabs { margin-left: 0; }
body.sidebar-collapsed .session-window { left: 76px; }
@media (max-width: 768px) { .session-window { left: 8px; right: 8px; top: 56px; bottom: 8px; } }
body.sidebar-collapsed .session-tab .st-open span { display: none; }
/* Being watched: a gentle glow on Sessions (amber while someone is operating) */
.sidebar-link.being-watched { box-shadow: inset 3px 0 0 var(--color-accent, #3b82f6); animation: watched-glow 3s ease-in-out infinite; }
.sidebar-link.being-operated { box-shadow: inset 3px 0 0 #f59e0b; }
@keyframes watched-glow { 0%, 100% { background: transparent; } 50% { background: rgba(59, 130, 246, 0.12); } }
.session-banner.operated { border-color: #f59e0b; }
.session-banner .watch-tuck { margin-left: auto; }

/* --- Burn-in: procedure list, editor, history (8.20) --- */
.bi-picker { position: relative; flex: 1 1 180px; min-width: 0; }
.bi-picker .bi-proc {
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: var(--space-2);
  text-align: left;
  cursor: pointer;
}
.bi-picker .bi-proc span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bi-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 30;
  max-height: 360px;
  overflow: auto;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  padding: var(--space-1);
}
.bi-group { font-size: var(--text-xs); font-weight: 700; color: var(--color-text-muted); text-transform: uppercase; padding: var(--space-2) var(--space-2) var(--space-1); }
.bi-item { display: flex; align-items: center; border-radius: var(--radius-sm); }
.bi-item.current { background: var(--color-accent-subtle); }
.bi-item:hover { background: var(--color-bg-tertiary); }
.bi-item button { background: none; border: 0; color: var(--color-text-primary); cursor: pointer; padding: 6px var(--space-2); }
.bi-item .bi-pick { flex: 1; text-align: left; -webkit-touch-callout: none; user-select: none; }
.bi-item .bi-pick small { color: var(--color-text-muted); margin-left: var(--space-1); }
.bi-item .bi-more { color: var(--color-text-secondary); }
.bi-rowmenu { display: flex; flex-wrap: wrap; gap: var(--space-1); align-items: center; padding: var(--space-1) var(--space-2) var(--space-2) var(--space-4); }
.bi-rowmenu button:not(.cmd-btn) {
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-primary);
  padding: 3px 10px;
  cursor: pointer;
  font-size: var(--text-xs);
}
.bi-rowmenu span { font-size: var(--text-xs); flex: 1 1 100%; }
.bi-none { padding: var(--space-1) var(--space-2); }
.bi-listfoot { display: flex; gap: var(--space-2); padding: var(--space-2); border-top: 1px solid var(--color-border); margin-top: var(--space-1); }
.bi-listfoot label { cursor: pointer; }
.be-spacer { flex: 1; }

.modal.burnin-editor, .modal.burnin-history { max-width: 860px; }
.burnin-editor .modal-header, .burnin-history .modal-header { display: flex; gap: var(--space-2); align-items: center; }
.burnin-editor .modal-header h3 { flex: 1; margin: 0; }
.burnin-history .modal-header h3 { flex: 1; margin: 0; }
.be-name { font-size: var(--text-lg); font-weight: 700; width: 100%; }
.be-meta { margin-bottom: var(--space-2); }
.be-top { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); align-items: center; margin-bottom: var(--space-3); }
.be-top input[type=number] { width: 5.5em; display: inline-block; }
.be-top select { width: auto; display: inline-block; }
.be-total b { font-family: var(--font-mono); font-size: var(--text-lg); color: var(--color-data, var(--color-info)); }
.be-steps { list-style: none; margin: 0; padding: 0; max-height: 46vh; overflow: auto; border: 1px solid var(--color-border); border-radius: var(--radius-md); }
.be-step { display: flex; gap: var(--space-2); align-items: flex-start; padding: var(--space-2); border-bottom: 1px solid var(--color-border); background: var(--color-bg-secondary); }
.be-step:last-child { border-bottom: 0; }
.be-step.ticked { background: var(--color-accent-subtle); }
.be-step.dragging { opacity: 0.6; }
.be-step.drop-before { box-shadow: inset 0 3px 0 var(--color-accent); }
.be-empty { padding: var(--space-3); }
.be-handle { cursor: grab; touch-action: none; color: var(--color-text-muted); padding: 2px 4px; user-select: none; }
.be-no { color: var(--color-text-muted); font-family: var(--font-mono); min-width: 2.2em; font-size: var(--text-sm); }
.be-what { flex: 1; min-width: 0; font-size: var(--text-sm); display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.be-small { flex-basis: 100%; font-size: 11px; font-family: var(--font-mono); color: var(--color-text-muted); }
.be-secs { white-space: nowrap; font-size: var(--text-sm); }
.be-secs input { width: 5.5em; display: inline-block; }
.be-num { width: 4.5em !important; display: inline-block !important; }
.be-chip { display: inline-flex; gap: 4px; align-items: center; padding: 2px 8px; border-radius: 12px; background: var(--color-bg-tertiary); border: 1px solid var(--color-border); }
.be-chip input[type=number] { width: 5em; }
.be-chip select { background: transparent; color: inherit; border: 0; }
.be-chip code { font-size: 11px; }
.be-hex { width: auto !important; font-family: var(--font-mono); }
.be-chip-x, .be-with { background: none; border: 0; color: var(--color-text-muted); cursor: pointer; padding: 0 2px; font-size: var(--text-sm); }
.be-with { border: 1px dashed var(--color-border-light); border-radius: 10px; padding: 0 6px; }
.be-every { color: var(--color-text-muted); flex-basis: 100%; }
.be-add { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: var(--space-2) 0; }
.be-menu, .be-quickbox { border: 1px solid var(--color-border-light); border-radius: var(--radius-md); padding: var(--space-2); margin-bottom: var(--space-2); background: var(--color-bg-tertiary); max-height: 280px; overflow: auto; }
.be-mg { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: var(--space-2); }
.be-mh { flex-basis: 100%; font-size: var(--text-xs); font-weight: 700; color: var(--color-text-muted); text-transform: uppercase; }
.be-mi { background: var(--color-bg-secondary); border: 1px solid var(--color-border); border-radius: var(--radius-sm); color: var(--color-text-primary); padding: 4px 10px; cursor: pointer; font-size: var(--text-sm); }
.be-mi small { color: var(--color-text-muted); font-family: var(--font-mono); font-size: 10px; }
.be-mi:hover { border-color: var(--color-accent); }
.be-quickrow { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; margin-top: var(--space-2); }
.be-quickrow select { width: auto; flex: 1 1 150px; }
.be-quickrow input { width: 5em; display: inline-block; }
.be-record { margin: var(--space-3) 0; }
.be-fields { width: 100%; border-collapse: collapse; margin-top: var(--space-2); }
.be-fields td, .be-fields th { padding: 2px 6px; text-align: left; }
.be-fields input[type=number] { width: 6em; }
.be-notes-label { display: block; }
.be-notes { width: 100%; margin-top: 4px; }
.be-error { color: var(--color-error); }
.be-footer { flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.be-footer label { cursor: pointer; margin: 0; }

.bh-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: var(--space-2); margin-bottom: var(--space-3); }
.bh-card { background: var(--color-bg-tertiary); border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: var(--space-2) var(--space-3); }
.bh-num { font-size: var(--text-xl); font-weight: 700; font-family: var(--font-mono); color: var(--color-data, var(--color-info)); }
.bh-label { font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; color: var(--color-text-secondary); }
.bh-sub { font-size: 11px; color: var(--color-text-muted); }
.bh-split { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--space-3); margin-bottom: var(--space-2); }
.bh-table { width: 100%; border-collapse: collapse; margin-bottom: var(--space-2); }
.bh-table th { text-align: left; color: var(--color-text-muted); font-weight: 600; border-bottom: 1px solid var(--color-border); padding: 4px 6px; }
.bh-table td { padding: 4px 6px; border-bottom: 1px solid var(--color-border); vertical-align: top; }
.bh-runs tr.bh-run { cursor: pointer; }
.bh-runs tr.bh-run:hover, .bh-runs tr.bh-run:focus { background: var(--color-bg-tertiary); outline: none; }
.bh-completed { color: var(--color-success); }
.bh-failed { color: var(--color-error); }
.bh-stopped { color: var(--color-text-secondary); }
.bh-fails { margin-bottom: var(--space-3); color: var(--color-text-secondary); }
.bh-q { width: 100%; margin: var(--space-2) 0; }
.bh-keys { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-3); margin: var(--space-2) 0; }
.bh-run-view .burnin-chart-wrap { height: 200px; }
.bh-actions { display: flex; gap: var(--space-2); justify-content: flex-end; }
.burnin-editor input[type=number] { padding: 4px 6px; height: auto; }
.burnin-editor .be-chip input[type=number], .burnin-editor .be-num { width: 5.5em !important; }

/* --- System Logs panel (8.21) --- */
.cds-logs { gap: var(--space-2); }
.lp-head { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; justify-content: space-between; }
.lp-tabs { display: flex; border: 1px solid var(--color-border); border-radius: var(--radius-md); overflow: hidden; }
.lp-tab { background: var(--color-bg-secondary); color: var(--color-text-secondary); border: 0; border-right: 1px solid var(--color-border);
  padding: 6px 14px; font-size: var(--text-sm); font-weight: 600; cursor: pointer; }
.lp-tab:last-child { border-right: 0; }
.lp-tab.active { background: var(--color-accent-subtle); color: var(--color-text-primary); box-shadow: inset 0 -2px 0 var(--color-accent); }
.lp-whose { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-xs); color: var(--color-text-muted); flex: 0 1 280px; min-width: 0; }
.lp-whose select { flex: 1; min-width: 0; }
.lp-when { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.lp-seg { display: flex; flex-wrap: wrap; gap: 2px; background: var(--color-bg-secondary); border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: 2px; }
.lp-seg-btn { background: none; border: 0; border-radius: var(--radius-sm); color: var(--color-text-secondary); padding: 3px 10px; font-size: var(--text-xs); cursor: pointer; }
.lp-seg-btn.active { background: var(--color-bg-tertiary); color: var(--color-text-primary); box-shadow: 0 0 0 1px var(--color-border-light); }
.lp-range { display: flex; flex-wrap: wrap; gap: var(--space-1); align-items: center; font-size: var(--text-xs); color: var(--color-text-muted); }
.lp-range input { width: auto; }
.lp-live { display: flex; gap: 4px; align-items: center; font-size: var(--text-xs); color: var(--color-text-secondary); cursor: pointer; }
.lp-filter { display: flex; gap: var(--space-2); }
.lp-filter .lp-text { flex: 1; min-width: 0; }
.lp-filter select { width: auto; flex: 0 0 auto; }
.lp-statusbar { display: flex; justify-content: space-between; align-items: center; gap: var(--space-2); font-size: var(--text-xs); color: var(--color-text-muted); }
.lp-rows { overflow: auto; max-height: 420px; min-height: 120px; border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-bg-secondary); }
.lp-empty { padding: var(--space-6) var(--space-3); text-align: center; color: var(--color-text-muted); font-size: var(--text-sm); }
.lp-table { width: 100%; border-collapse: collapse; font-size: var(--text-xs); }
.lp-table th { position: sticky; top: 0; z-index: 1; text-align: left; font-weight: 600; color: var(--color-text-muted); background: var(--color-bg-tertiary);
  padding: 5px 8px; border-bottom: 1px solid var(--color-border); white-space: nowrap; }
.lp-table td { padding: 3px 8px; border-bottom: 1px solid var(--color-border); white-space: nowrap; vertical-align: top; color: var(--color-text-primary); }
.lp-table tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--color-bg-tertiary) 45%, transparent); }
.lp-table .lp-t { font-family: var(--font-mono); color: var(--color-text-secondary); }
.lp-table .lp-m { font-family: var(--font-mono); }
.lp-table .lp-msg { white-space: normal; width: 100%; }
.lp-table .lp-tx { color: var(--color-accent); font-weight: 600; }
.lp-row-bad .lp-msg { color: var(--color-error); }
.lp-pill { display: inline-block; padding: 0 7px; border-radius: 9px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; }
.lp-pill.lp-info { background: var(--color-bg-tertiary); color: var(--color-text-secondary); }
.lp-pill.lp-ok { background: color-mix(in srgb, var(--color-success) 16%, transparent); color: var(--color-success); }
.lp-pill.lp-warn { background: color-mix(in srgb, var(--color-warning) 18%, transparent); color: var(--color-warning); }
.lp-pill.lp-bad { background: color-mix(in srgb, var(--color-error) 16%, transparent); color: var(--color-error); }
.lp-foot { display: flex; flex-direction: column; gap: var(--space-1); border-top: 1px solid var(--color-border); padding-top: var(--space-2); font-size: var(--text-xs); color: var(--color-text-secondary); }
.lp-foot-row { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-3); align-items: center; min-height: 28px; }
.lp-foot-title { font-weight: 700; color: var(--color-text-primary); min-width: 9.5em; }
.lp-storage, .lp-foot-note { flex: 1 1 240px; color: var(--color-text-muted); }
.lp-upload label { display: flex; gap: 4px; align-items: center; cursor: pointer; }
.lp-upload-state { color: var(--color-text-muted); }
.lp-upload-state.lp-bad { color: var(--color-warning); }
.lp-name-label { margin-left: auto; }
.lp-name-label input { width: 12em; }
.lp-clear.armed { color: var(--color-error); border-color: var(--color-error); }
@media (max-width: 600px) { .lp-foot-title { min-width: 0; flex-basis: 100%; } .lp-name-label { margin-left: 0; } }
.cds-logs .panel-btn { width: auto; min-width: 0; height: auto; white-space: nowrap; padding: 4px 10px; font-size: var(--text-xs); border-color: var(--color-border); color: var(--color-text-secondary); }
.badge.ctl-channel { background: var(--color-bg-tertiary); color: var(--color-text-secondary); font-weight: 700; margin-left: 4px; }
.badge.ctl-channel.off { color: var(--color-warning); box-shadow: inset 0 0 0 1px var(--color-warning); }

/* --- Pop-outs (8.22) --- */
.popout-page { margin: 0; height: 100vh; overflow: hidden; background: var(--color-bg-primary); padding: var(--space-3); box-sizing: border-box; }
.popout-panel { height: 100%; display: flex; flex-direction: column; min-height: 0 !important; }
.popout-panel > .dash-panel-body { flex: 1; min-height: 0; overflow: auto; }
.popped-out { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 160px; height: 100%; text-align: center; color: var(--color-text-secondary); font-size: var(--text-sm); }
.popped-out p { margin: 0; }
.popped-out-icon { font-size: 28px; color: var(--color-text-muted); }
.popped-out-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); justify-content: center; }

/* --- Live Camera: whose camera (8.23) --- */
.video-source-tabs { position: absolute; top: 8px; right: 8px; z-index: 10; display: flex; gap: 2px; padding: 2px;
  background: rgba(0, 0, 0, 0.6); border-radius: 6px; }
.video-source-tabs.hidden { display: none; }
.video-source-tabs button { background: none; border: 0; color: rgba(255, 255, 255, 0.75); font-size: 12px; padding: 4px 10px; border-radius: 4px; cursor: pointer; }
.video-source-tabs button.active { background: rgba(255, 255, 255, 0.18); color: #fff; font-weight: 600; }

/* =============================================================================
   Easy bind (9.7): use a control, then click the panel control it should do
   ============================================================================= */
.pe-easy { display: flex; flex-direction: column; flex: 1; min-height: 0; gap: var(--space-3); }
.pe-easy-top { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.pe-easy-live {
  border: 1px solid var(--color-border); border-radius: var(--radius-md);
  background: var(--color-bg-tertiary); padding: var(--space-3); min-height: 64px;
}
.pe-easy-live:has(.pe-easy-armed) { border-color: var(--color-accent); box-shadow: 0 0 0 1px var(--color-accent) inset; }
.pe-easy-prompt, .pe-easy-empty { color: var(--color-text-secondary); font-size: var(--text-sm); }
.pe-easy-armed { display: flex; flex-direction: column; gap: 4px; }
.pe-easy-who { color: var(--color-text-muted); font-size: var(--text-sm); }
.pe-easy-what { font-size: var(--text-lg); color: var(--color-accent); }
.pe-easy-body { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: var(--space-3); flex: 1; min-height: 0; }
.pe-easy-panel { overflow: auto; min-height: 0; }
.pe-easy-side { display: flex; flex-direction: column; min-height: 0; border: 1px solid var(--color-border); border-radius: var(--radius-md); }
.pe-easy-side-head { display: flex; justify-content: space-between; align-items: center; padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--color-border); font-size: var(--text-sm); }
.pe-easy-list { overflow-y: auto; padding: var(--space-2); display: flex; flex-direction: column; gap: 2px; }
.pe-easy-row { display: grid; grid-template-columns: 1fr auto 1fr auto; gap: 6px; align-items: center; font-size: var(--text-xs); padding: 4px 6px; border-radius: var(--radius-sm, 4px); cursor: pointer; }
.pe-easy-row:hover { background: var(--color-bg-hover); }
.pe-easy-row.idle { grid-template-columns: 1fr; color: var(--color-text-muted); }
.pe-easy-in { font-weight: 600; }
.pe-easy-arrow { color: var(--color-text-muted); }
.pe-easy-out { color: var(--color-text-secondary); }
.pe-easy-x { padding: 0 4px; line-height: 1.2; }
.pe-easy-idle-head { margin-top: var(--space-2); padding: 0 6px; }
@media (max-width: 860px) { .pe-easy-body { grid-template-columns: 1fr; } .pe-easy-side { max-height: 240px; } }

/* The Basic Panel in pick mode: every control is a choice, nothing is sent */
.bp-picking [data-target], .bp-picking .bp-latch-rocker { cursor: pointer; position: relative; }
.bp-picking [data-target]:hover { outline: 2px solid var(--color-accent); outline-offset: 1px; }
.bp-picking .bp-slider-card input[type="range"] { pointer-events: none; }
.bp-armed [data-target] { box-shadow: 0 0 0 1px color-mix(in srgb, var(--color-accent) 55%, transparent); }
.bp-picking .bp-bound { outline: 1px dashed var(--color-accent); outline-offset: 1px; }
.bp-bind-tag {
  position: absolute; top: -7px; right: -4px; max-width: 120px; z-index: 2;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; pointer-events: none;
  font-size: 9px; font-weight: 700; line-height: 1.4; padding: 0 4px; border-radius: 6px;
  background: var(--color-accent); color: var(--color-bg-primary, #000);
}
.bp-slider-card > .bp-bind-tag { top: 2px; right: 4px; }   /* (cards clip what sticks out) */
.bp-picking .bp-card.bp-bound { flex-direction: column; gap: 2px; }
.bp-card > .bp-bind-tag { position: static; display: block; max-width: 100%; margin-top: 2px; align-self: flex-start; }
.bp-flash { animation: bp-flash 0.9s ease-out; }
@keyframes bp-flash { 0% { box-shadow: 0 0 0 4px var(--color-accent); } 100% { box-shadow: 0 0 0 0 transparent; } }

/* CAN controllers in Controller Slots */
.cs-can-form[hidden] { display: none; }
.cs-can-form { border: 1px solid var(--color-border); border-radius: 10px; padding: var(--space-3); margin-bottom: var(--space-3); display: flex; flex-direction: column; gap: var(--space-2); }
.cs-can-row { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }
.cs-can-row .cs-can-dev { width: auto; max-width: 100%; }
.cs-can-heard { display: flex; gap: var(--space-1); align-items: center; flex-wrap: wrap; }
.cs-can-more { margin-bottom: var(--space-2); }
.cs-can-more summary { cursor: pointer; color: var(--color-text-secondary); }
.cs-can-opts { display: flex; flex-direction: column; gap: 4px; padding: var(--space-2) 0 0 var(--space-2); }
.cs-can-opt { font-size: var(--text-xs); display: flex; align-items: center; gap: 6px; }

/* A popped-out panel (9.7.1): a thin bar where it was, so the panels beside it get the room */
.popped-out-short, .popped-out-title { display: none; }
.dash-panel.is-popped { min-height: 0 !important; height: auto !important; }
/* Minimised to its header bar (9.9.3: Inspect's Telemetry) */
.dash-panel.is-minimised { min-height: 0 !important; height: auto !important; }
.dash-panel.is-minimised > .dash-panel-body { display: none !important; }
.dash-panel.is-popped > .dash-panel-header { display: none; }   /* (the bar names it) */
.dash-panel.is-popped > .dash-panel-body { flex: 0 0 auto; min-height: 0 !important; padding: 6px 10px !important; overflow: hidden; }
.dash-panel.is-popped .popped-out { flex-direction: row; justify-content: flex-start; align-items: center; gap: 8px; padding: 0; min-height: 0; height: auto; }
.dash-panel.is-popped .popped-out-icon { font-size: 16px; }
.dash-panel.is-popped .popped-out p { font-size: var(--text-xs); color: var(--color-text-muted); white-space: nowrap; }
.dash-panel.is-popped .popped-out-title { display: inline; color: var(--color-text-primary); font-size: var(--text-sm); margin-right: 6px; }
.dash-panel.is-popped .popped-out-long { display: none; }
.dash-panel.is-popped .popped-out-short { display: inline; }
.dash-panel.is-popped .popped-out-actions { flex-wrap: nowrap; gap: 6px; }
.dash-panel.is-popped .popped-out-actions .btn { padding: 2px 8px; font-size: var(--text-xs); }

/* The cutting motor (9.8.2): Arm then Run as one pair. While it runs both are lit, and bright
   spots run round the pair counter-clockwise, the way the bit spins */
@property --cut-a { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
/* 9.8.8: Arm above Run, one cell beside the Stabilizer (owner: side by side took a whole row) */
.bp-cutter { position: relative; display: grid; grid-template-columns: 1fr; gap: 6px; padding: 5px; border-radius: 14px; align-self: start; }
.bp-cutter .bp-card { margin: 0; }
.bp-cut-glow { position: absolute; inset: 0; border-radius: 14px; padding: 3px; pointer-events: none; opacity: 0; transition: opacity .3s;
  background: repeating-conic-gradient(from var(--cut-a), transparent 0deg 62deg, rgba(255, 196, 92, .35) 74deg, #ffe3a3 84deg, rgba(255, 196, 92, .35) 86deg, transparent 90deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  filter: drop-shadow(0 0 5px rgba(255, 190, 80, .9)); }
.bp-cutter.running .bp-cut-glow { opacity: 1; animation: bp-cut-spin 1.1s linear infinite; }
.bp-cutter.running { box-shadow: 0 0 18px rgba(255, 170, 60, .28); }
@keyframes bp-cut-spin { to { --cut-a: -360deg; } }   /* decreasing: counter-clockwise */
@media (prefers-reduced-motion: reduce) { .bp-cutter.running .bp-cut-glow { animation-duration: 3s; } }
.bp-nudge { animation: bp-nudge .35s; }
@keyframes bp-nudge { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

/* 9.8.11 — Disable as a small switch: on the Drive control's title line, and the reel's (Wolverine) */
.bp-layout .bp-card.bp-disable, .bp-card.bp-disable { display: inline-flex; align-items: center; justify-content: center; min-height: 0; width: auto;
  padding: 2px 10px; margin: 0; font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; border-radius: 999px; cursor: pointer; flex: 0 0 auto; }
.bp-card.bp-disable.latched { color: #fff; background: var(--color-danger, #d33); border-color: var(--color-danger, #d33); box-shadow: 0 0 10px rgba(220, 50, 50, .45); }
.bp-compound-header:has(.bp-disable) { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
/* The reel on two lines: title, footage, clutch … Disable; then its speed, the full width */
.bp-layout .bp-cat-reel.bp-reel-2line { display: block; }
.bp-reel-2line .bp-category-title { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; margin-bottom: var(--space-2); }
.bp-reel-2line .bp-reel-line { display: inline-flex; align-items: center; gap: 6px; }
.bp-reel-2line .bp-reel-line .bp-card { min-height: 0; padding: 3px 10px; margin: 0; text-transform: none; letter-spacing: 0; }
.bp-reel-2line .bp-category-title > .bp-disable { margin-left: auto; }
.bp-layout .bp-reel-2line .bp-grid { display: block; }
.bp-layout .bp-reel-2line .bp-slider-card { width: 100%; }

/* 9.8.11 — the camera's direction buttons, three speeds: left third slow, middle, right third fast */
.bp-dir-btn.bp-3stage { position: relative; overflow: hidden; isolation: isolate; }
.bp-3stage .bp-lv { position: absolute; inset: 0; display: flex; pointer-events: none; z-index: -1; }
.bp-3stage .bp-lv i { flex: 1; background: transparent; transition: background-color .12s; }
.bp-3stage .bp-lv i + i { border-left: 1px dashed color-mix(in srgb, var(--color-text-muted) 35%, transparent); }
.bp-3stage.lv1 .bp-lv i:nth-child(1),
.bp-3stage.lv2 .bp-lv i:nth-child(1), .bp-3stage.lv3 .bp-lv i:nth-child(1) { background: color-mix(in srgb, var(--color-accent) 33%, transparent); }
.bp-3stage.lv2 .bp-lv i:nth-child(2), .bp-3stage.lv3 .bp-lv i:nth-child(2) { background: color-mix(in srgb, var(--color-accent) 66%, transparent); }
.bp-3stage.lv3 .bp-lv i:nth-child(3) { background: var(--color-accent); }
.bp-3stage .bp-lv-label { position: relative; pointer-events: none; }
.bp-3stage.lv1, .bp-3stage.lv2, .bp-3stage.lv3 { color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.6); }

/* 9.8.11 — the Sidewinder's lateral reel (LC400): Auto at the right of its title line */
.bp-card.bp-auto2 { display: inline-flex; align-items: center; justify-content: center; width: auto; flex: 0 0 auto; min-height: 0; padding: 2px 12px; margin: 0 0 0 auto; font-size: 11px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; border-radius: 999px; cursor: pointer; }
.bp-card.bp-auto2.latched { color: #fff; background: var(--color-success, #2a8); border-color: var(--color-success, #2a8); box-shadow: 0 0 10px rgba(40, 170, 120, .45); }
.bp-cat-reel2.bp-auto-on .bp-clutch2, .bp-cat-reel2.bp-auto-on .bp-slider-card { opacity: .45; pointer-events: none; }

/* Pad view: a button's key rides in its label (9.8.18), so labels and keys both show; the key's own
   hint stands down while labels show. Hints left on their own (WASD, arrows) sit above the labels. */
.vc-key-hint { z-index: 32; }
.vc-controller-viewport:not(.vc-labels-hidden) .vc-key-hint.in-label { display: none; }
.vc-btn-label .vc-lbl-key {
  display: inline-block; margin-right: 4px; padding: 0 3px; border-radius: 3px;
  font: inherit; font-size: 0.9em; font-weight: 700; color: #facc15;
  background: rgba(0, 0, 0, 0.6); border: 1px solid rgba(250, 204, 21, 0.45);
}
.vc-hints-hidden .vc-btn-label .vc-lbl-key { display: none; }
.bp-pad-full .vc-lbl-key { display: none !important; }

/* Camera Home in a camera cross's top-right corner (9.14.4: Sidewinder-ARC3, as the PC5000 page) */
/* Camera Home above the cross's toggles (9.26.3) */
.bp-card.bp-home-corner { grid-column: 1 / -1; justify-content: center; min-height: 0; padding: 3px 10px; }
.bp-card.bp-home-corner .bp-card-label { font-size: var(--text-xs); text-transform: none; letter-spacing: 0; }

/* Live Camera's source, resolution, remote fps and codec: in the panel's title bar, off the picture (bug #115); on the
   video as before should a panel have no title bar */
.video-overlay-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; flex: 1; }
.video-container > .video-overlay-controls { position: absolute; top: 8px; left: 8px; z-index: 10; flex: none; padding: 4px;
  background: rgba(0,0,0,0.6); border-radius: 4px; }
.video-container > .video-overlay-controls .video-bar-select { color: white; border-color: rgba(255,255,255,0.3); }
.dash-panel-header > .video-overlay-controls { margin-left: var(--space-3); }
.video-overlay-controls .video-bar-select { width: auto; max-width: 180px; height: 28px; padding: 2px 6px; font-size: 12px;
  background: transparent; color: var(--color-text-primary); border: 1px solid var(--color-border); border-radius: var(--radius-md); }
/* 9.18.4: the Live Camera bar's dropdowns are white on the dark video bar; their open lists are the theme's own (the
   options took the white too, on the browser's light list, so only the highlighted one could be read — dark and light) */
.video-bar-select option, .video-bar-select optgroup { background: var(--color-bg-secondary); color: var(--color-text-primary); }
.video-bar-select option:checked { background: var(--color-bg-primary); }
