/* =============================================================================
   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: var(--z-sticky);
  transition: width var(--transition-normal);
}

.sidebar-header {
  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 {
  background: var(--color-bg-hover);
  color: var(--color-text-primary);
}

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

.sidebar-add-dropdown .panel-add-menu {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  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;
  z-index: var(--z-sticky);
}

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

.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: rgba(59, 130, 246, 0.15);
  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;
  grid-template-columns: 1fr 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);
}

.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 --- */
.burnin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-4);
}

.burnin-category {
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  position: relative;
  overflow: hidden;
}

.burnin-category::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #e74c3c, #f39c12, #2ecc71);
  opacity: 0.6;
}

.burnin-cat-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-md);
  font-weight: 700;
  color: var(--color-text-primary);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--color-border);
}

.burnin-cat-header .cat-icon {
  font-size: var(--text-xl);
}

.burnin-cat-header .cat-name {
  flex: 1;
}

.burnin-cat-controls {
  display: flex;
  gap: var(--space-2);
  align-items: stretch;
}

.burnin-cat-controls select {
  flex: 1;
  min-width: 0;
}

.burnin-timer {
  font-family: var(--font-mono);
  font-size: var(--text-xl);
  color: #5dade2;
  text-align: center;
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-md);
  padding: var(--space-2);
}

.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: rgba(59, 130, 246, 0.15);
  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 Grid
   --------------------------------------------------------------------------- */
.panel-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
}

@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: rgba(59, 130, 246, 0.3);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.1);
}

.dash-panel.unlocked:hover {
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* 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: rgba(59, 130, 246, 0.05);
}

/* =============================================================================
   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: #60a5fa;
  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: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.2);
}

.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: #60a5fa;
  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);
}

.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: 14%;
  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: 14%; transform: translate(50%, -50%); }

.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: 14%; 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); }

/* 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;
  }
}