:root {
  --bg-0: #0b0e14;
  --bg-1: #121721;
  --bg-2: #19202e;
  --bg-3: #222b3d;
  --border: #2a354b;
  --text-0: #e6edf3;
  --text-1: #9da9bb;
  --text-2: #6b778c;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --green: #10b981;
  --amber: #f59e0b;
  --red: #ef4444;
  --cyan: #06b6d4;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "Fira Code", "Cascadia Code", "Consolas", monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg-0);
  color: var(--text-0);
  font-family: var(--font-sans);
  font-size: 13px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Localhost-Only Tools Gating */
body:not(.is-localhost) .localhost-only {
  display: none !important;
}

/* Mutually exclusive Connect / Disconnect in Topbar */
body:not(.ble-connected) #btnDisconnect {
  display: none !important;
}

body.ble-connected #btnConnect {
  display: none !important;
}

.mono {
  font-family: var(--font-mono);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
  gap: 12px;
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  line-height: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.brand-logo-link:hover {
  opacity: 0.88;
  transform: scale(1.02);
}

.brand-badge-logo {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(56, 189, 248, 0.25);
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.22s ease;
  flex-shrink: 0;
}

.brand-logo-link:hover .brand-badge-logo {
  transform: scale(1.08) rotate(4deg);
  box-shadow: 0 4px 14px rgba(56, 189, 248, 0.45), 0 0 0 1.5px rgba(56, 189, 248, 0.6);
}

.skyrc-logo {
  display: block;
  width: 79.996px;
  height: 19.673px;
  flex-shrink: 0;
}

.skyrc-logo .logo-qian polygon {
  fill: #ffffff;
}

.skyrc-logo .logo-hou polygon {
  fill: #d71718;
}

.brand-divider {
  width: 1px;
  height: 16px;
  background: rgba(255, 255, 255, 0.16);
  flex-shrink: 0;
}

.brand h1 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
  white-space: nowrap;
}

.badge {
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
}

.connection-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  background: var(--bg-2);
  border: 1px solid var(--border);
}

.status-pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-2);
}

.status-pill.connected .dot {
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
}

.status-pill.connecting .dot {
  background: var(--amber);
}

/* Keeper Global Status Pill - Vector Icon Indicator */
.keeper-status-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  flex-shrink: 0;
}

.keeper-status-icon svg {
  display: block;
}

#keeperGlobalStatus.disconnected {
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.08);
  color: #fca5a5;
}

#keeperGlobalStatus.disconnected .keeper-status-icon {
  color: #ef4444;
}

#keeperGlobalStatus.connected {
  border-color: rgba(56, 189, 248, 0.35);
  background: rgba(56, 189, 248, 0.08);
  color: #7dd3fc;
}

#keeperGlobalStatus.connected .keeper-status-icon {
  color: #38bdf8;
}

#keeperGlobalStatus.connected.is-running {
  border-color: rgba(34, 197, 94, 0.45);
  background: rgba(34, 197, 94, 0.12);
  color: #86efac;
}

#keeperGlobalStatus.connected.is-running .keeper-status-icon {
  color: #22c55e;
}

@keyframes keeperActivePulse {
  0%, 100% {
    transform: scale(1);
    filter: drop-shadow(0 0 2px rgba(34, 197, 94, 0.4));
  }
  50% {
    transform: scale(1.18);
    filter: drop-shadow(0 0 6px rgba(34, 197, 94, 0.85));
  }
}

.keeper-status-icon .active-pulse {
  animation: keeperActivePulse 1.6s ease-in-out infinite;
  transform-origin: center;
}

.filter-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-1);
  cursor: pointer;
  user-select: none;
  font-size: 12px;
}

.btn {
  background: var(--bg-3);
  color: var(--text-0);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}

.btn:hover:not(:disabled) {
  background: #2c384f;
  border-color: #3d4d6c;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn.primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn.danger {
  background: rgba(239, 68, 68, 0.16);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

.btn.secondary {
  background: rgba(6, 182, 212, 0.14);
  border-color: rgba(6, 182, 212, 0.4);
  color: #67e8f9;
}

.btn.small {
  padding: 4px 8px;
  font-size: 11px;
}

.warning-banner {
  background: rgba(245, 158, 11, 0.15);
  border-bottom: 1px solid rgba(245, 158, 11, 0.4);
  color: #fcd34d;
  padding: 8px 16px;
  font-size: 12px;
}

.hidden {
  display: none !important;
}

.workspace-grid {
  flex: 1;
  display: grid;
  grid-template-columns: 360px 440px 1fr;
  gap: 1px;
  background: var(--border);
  min-height: 0;
}

.panel {
  background: var(--bg-1);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  gap: 8px;
  flex-shrink: 0;
}

.panel-header h2 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-0);
}

.identity-card {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-0);
}

.kv-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
}

.kv {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.kv .k {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-2);
}

.kv .v {
  font-size: 12px;
  color: var(--text-0);
  word-break: break-all;
}

.kv .v.highlight {
  color: var(--green);
  font-weight: 600;
  font-family: var(--font-mono);
}

.custom-uuid-bar {
  display: flex;
  gap: 6px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-1);
}

.custom-uuid-bar input {
  flex: 1;
}

input[type="text"],
input[type="number"],
select {
  background: var(--bg-0);
  border: 1px solid var(--border);
  color: var(--text-0);
  padding: 5px 8px;
  border-radius: 4px;
  font-size: 12px;
}

.short-input {
  width: 56px;
}

.gatt-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.empty-state {
  color: var(--text-1);
  line-height: 1.5;
  padding: 20px 8px;
  text-align: center;
}

.service-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.service-header {
  padding: 7px 10px;
  background: var(--bg-3);
  font-weight: 600;
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.char-row {
  padding: 8px 10px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.char-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.char-uuid {
  font-weight: 600;
  color: #93c5fd;
  font-size: 11.5px;
}

.prop-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.prop-badge {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--bg-0);
  border: 1px solid var(--border);
  color: var(--text-1);
  font-family: var(--font-mono);
}

.prop-badge.active {
  border-color: var(--green);
  color: var(--green);
}

.char-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

.char-val {
  font-size: 11px;
  color: var(--text-1);
  background: var(--bg-0);
  padding: 4px 6px;
  border-radius: 3px;
  word-break: break-all;
}

/* Probe column */
.probe-panel {
  overflow-y: auto;
}

.char-selectors {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: var(--text-1);
}

.probe-section {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.probe-section h3 {
  font-size: 12px;
  font-weight: 600;
  color: var(--cyan);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.hint {
  font-size: 11.5px;
  color: var(--text-1);
  line-height: 1.4;
}

.probe-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.probe-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  text-align: left;
  padding: 7px 9px;
}

.probe-btn .cmd-title {
  font-weight: 600;
  font-size: 11.5px;
}

.probe-btn code {
  font-size: 10px;
  color: var(--text-1);
}

.input-row {
  display: flex;
  gap: 6px;
}

.input-row input {
  flex: 1;
}

.scanner-controls,
.dumper-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.scan-progress {
  font-size: 11.5px;
  color: var(--text-1);
  padding: 4px 0;
}

.opcode-hits {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 24px;
}

.opcode-chip {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.45);
  color: #6ee7b7;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
}

/* Packet Log column */
.log-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.packet-log {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px;
  background: var(--bg-0);
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11.5px;
}

.log-entry {
  padding: 6px 8px;
  border-radius: 4px;
  background: var(--bg-1);
  border-left: 3px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.log-entry.rx {
  border-left-color: var(--green);
}

.log-entry.tx {
  border-left-color: var(--accent);
}

.log-entry.sys {
  border-left-color: var(--amber);
}

.log-entry.err {
  border-left-color: var(--red);
  color: #fca5a5;
}

.log-meta {
  display: flex;
  justify-content: space-between;
  color: var(--text-2);
  font-size: 10.5px;
}

.log-hex {
  color: var(--text-0);
  word-break: break-all;
  line-height: 1.4;
}

.log-ascii {
  color: var(--cyan);
  font-size: 11px;
  word-break: break-all;
}

/* Race Prep Auto Voltage Keeper Dashboard */
.keeper-dashboard {
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
  padding: 10px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.keeper-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.keeper-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.keeper-title-group h2 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-0);
}

.keeper-badge {
  background: rgba(16, 185, 129, 0.16);
  border-color: rgba(16, 185, 129, 0.45);
  color: #34d399;
}

.keeper-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.keeper-body {
  display: block;
  width: 100%;
  min-width: 0;
}

.keeper-controls-card {
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.keeper-preset-row,
.keeper-slot-toggles {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.preset-label {
  font-size: 11px;
  color: var(--text-1);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-right: 2px;
}

.preset-btn.active {
  background: rgba(59, 130, 246, 0.22);
  border-color: var(--accent);
  color: #93c5fd;
}

.keeper-form-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px 8px;
}

.k-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.k-field span {
  font-size: 10.5px;
  color: var(--text-1);
}

.k-field input {
  width: 100%;
  background: var(--bg-1);
}

.highlight-input {
  border-color: var(--green) !important;
  color: #6ee7b7 !important;
  font-weight: 700;
  font-size: 13px !important;
}

.slot-check {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11.5px;
  cursor: pointer;
}

.keeper-note {
  font-size: 11px;
  color: var(--text-2);
  margin-left: auto;
}

/* Slot Configuration & Apply Mode Bar */
.slot-mode-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 10px;
}

.slot-mode-bar-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.slot-bar-tag {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.slot-pills-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.slot-pill-label {
  display: inline-flex;
  cursor: pointer;
  user-select: none;
}

.slot-pill-label input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.slot-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 600;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  transition: all 0.15s ease-in-out;
}

.slot-pill-btn .chk-icon {
  font-size: 11px;
  opacity: 0.35;
  transition: opacity 0.15s;
}

.slot-pill-label input[type="checkbox"]:checked + .slot-pill-btn {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.6);
  color: #10b981;
}

.slot-pill-label input[type="checkbox"]:checked + .slot-pill-btn .chk-icon {
  opacity: 1;
}

.slot-pill-label:hover .slot-pill-btn {
  border-color: var(--accent);
}

.slot-mode-bar-right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.slot-quick-btns {
  display: flex;
  align-items: center;
  gap: 4px;
}

.slot-filter-btn {
  font-size: 11px !important;
  padding: 3px 8px !important;
}

.slot-summary-indicator {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text-2);
}

.slot-summary-indicator.all-active {
  color: #10b981;
  border-color: rgba(16, 185, 129, 0.4);
}

.slot-summary-indicator.partial-active {
  color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.4);
}

.slot-summary-indicator.none-active {
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.4);
}

.slot-header-chk-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}

.slot-header-chk-label input[type="checkbox"] {
  cursor: pointer;
  accent-color: #10b981;
  width: 14px;
  height: 14px;
}

.slot-card.slot-disabled {
  opacity: 0.55;
  filter: grayscale(0.5);
  border-style: dashed;
  border-color: rgba(255, 255, 255, 0.15) !important;
  box-shadow: none !important;
}

.slot-card.slot-disabled .slot-name {
  color: var(--text-2);
}

/* 2-Column to 4-Column Master Pair & Slot Dashboard Grid (Maximizes available window width) */
.pairs-dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
  min-width: 0;
  margin-bottom: 8px;
}

.pair-master-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.pair-slots-subgrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.slot-card {
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 3px;
  min-height: 84px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.slot-card.charging {
  border-color: rgba(59, 130, 246, 0.65);
  box-shadow: inset 0 0 10px rgba(59, 130, 246, 0.1);
}

.slot-card.discharging {
  border-color: rgba(245, 158, 11, 0.65);
  box-shadow: inset 0 0 10px rgba(245, 158, 11, 0.1);
}

.slot-card.holding {
  border-color: rgba(16, 185, 129, 0.75);
  box-shadow: inset 0 0 10px rgba(16, 185, 129, 0.12);
}

.slot-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.slot-name {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-0);
  white-space: nowrap;
}

.slot-name code {
  font-size: 9px;
  color: var(--text-2);
  font-weight: 400;
}

.slot-hw-badge {
  font-size: 9.5px;
  font-family: var(--font-mono);
  padding: 1px 5px;
  border-radius: 999px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text-1);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.slot-hw-badge.charging {
  background: rgba(59, 130, 246, 0.25);
  border-color: rgba(59, 130, 246, 0.7);
  color: #bfdbfe;
  font-weight: 600;
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.35);
  animation: chargingBadgePulse 1.2s ease-in-out infinite;
}

.slot-hw-badge.discharging {
  background: rgba(245, 158, 11, 0.25);
  border-color: rgba(245, 158, 11, 0.7);
  color: #fde68a;
  font-weight: 600;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.35);
  animation: dischargingBadgePulse 1.2s ease-in-out infinite;
}

.slot-hw-badge.resting {
  background: rgba(139, 92, 246, 0.25);
  border-color: rgba(139, 92, 246, 0.7);
  color: #ddd6fe;
  box-shadow: 0 0 8px rgba(139, 92, 246, 0.3);
  animation: restingBadgeGlow 2.8s ease-in-out infinite;
}

.slot-hw-badge.standby {
  background: var(--bg-2);
  border-color: var(--border);
  color: var(--text-1);
}

.slot-hw-badge.done {
  background: rgba(16, 185, 129, 0.2);
  border-color: rgba(16, 185, 129, 0.6);
  color: #6ee7b7;
}

.slot-hw-badge.break {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.6);
  color: #fca5a5;
  font-weight: 600;
}

.slot-hw-badge.reconnecting {
  background: rgba(6, 182, 212, 0.2);
  border-color: rgba(6, 182, 212, 0.6);
  color: #67e8f9;
  font-weight: 600;
}

.slot-voltage-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px;
  margin: 1px 0;
}

.slot-voltage {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-0);
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.slot-delta {
  font-size: 9.5px;
  color: var(--text-1);
  white-space: nowrap;
}

.slot-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px 4px;
  font-size: 9.5px;
  color: var(--text-0);
  background: var(--bg-1);
  padding: 2px 4px;
  border-radius: 3px;
  line-height: 1.25;
}

.slot-metrics .k {
  color: var(--text-2);
  font-size: 8.5px;
  margin-right: 2px;
}

.slot-keeper-bar {
  display: flex;
  align-items: center;
  padding-top: 2px;
  border-top: 1px solid var(--border);
  min-height: 16px;
}

.keeper-phase {
  font-size: 9.5px;
  color: var(--cyan);
  font-weight: 600;
  line-height: 1.2;
  white-space: normal;
  word-break: break-word;
}

.highlight-field {
  border-color: rgba(6, 182, 212, 0.45);
  background: rgba(6, 182, 212, 0.05);
}

.field-label-accent {
  color: var(--cyan);
  font-weight: 600;
}

.pair-target-input {
  color: #67e8f9 !important;
  font-weight: 700;
}

.field-subnote {
  font-size: 10px;
  color: var(--cyan);
  margin-top: 2px;
}

.link-pairs-box {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(56, 189, 248, 0.04);
  border: 1px solid rgba(56, 189, 248, 0.22);
  border-radius: 6px;
  padding: 4px 8px;
  height: 38px;
  align-self: flex-end;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.link-pairs-box:hover {
  background: rgba(56, 189, 248, 0.08);
  border-color: rgba(56, 189, 248, 0.35);
}

.link-pairs-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  color: var(--text-0);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.link-pairs-label input[type="checkbox"] {
  accent-color: var(--accent);
  cursor: pointer;
  width: 14px;
  height: 14px;
}

.race-preset-select {
  flex: 1;
  min-width: 220px;
  padding: 6px 10px;
  font-size: 12px;
}

/* Race Ready Profile Organized Layout */
.race-targets-panel {
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(56, 189, 248, 0.22);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.race-targets-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.race-target-card {
  background: rgba(11, 15, 25, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.28);
  border-radius: 6px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.race-target-card:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.2);
}

.race-target-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.race-target-header .field-label-accent {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.02em;
}

.race-target-header .field-subnote {
  font-size: 10.5px;
  color: #93c5fd;
  background: rgba(56, 189, 248, 0.12);
  padding: 2px 6px;
  border-radius: 4px;
}

.race-target-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.race-target-input-wrap input.pair-target-input {
  width: 100%;
  font-size: 17px;
  font-weight: 700;
  padding: 6px 26px 6px 10px;
  background: #070a12;
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 5px;
  color: #38bdf8;
  letter-spacing: 0.02em;
}

.race-unit-affix {
  position: absolute;
  right: 10px;
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
  pointer-events: none;
}

.race-targets-panel .link-pairs-box {
  margin: 0;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(56, 189, 248, 0.06);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 6px;
  align-self: stretch;
  width: 100%;
}

.race-targets-panel .link-pairs-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  font-weight: 600;
  color: #bae6fd;
  cursor: pointer;
  user-select: none;
}

.race-section-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0 8px 0;
}

.race-section-divider::before,
.race-section-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(75, 85, 99, 0.35);
}

.section-divider-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #94a3b8;
  text-transform: uppercase;
}

.race-currents-grid {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 8px 10px !important;
  margin-bottom: 4px;
}

.race-dynamics-grid {
  display: grid !important;
  grid-template-columns: 1fr 1fr 1fr !important;
  gap: 8px 10px !important;
  margin-bottom: 12px;
}

/* Universal Form Grid Modifiers for Optimized Mode Layouts */
.keeper-form-grid.grid-2col {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 8px 10px !important;
  margin-bottom: 6px;
}

.keeper-form-grid.grid-3col {
  display: grid !important;
  grid-template-columns: 1fr 1fr 1fr !important;
  gap: 8px 10px !important;
  margin-bottom: 6px;
}

.mode-hero-card {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mode-hero-card .field-label-accent {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.02em;
}

.mode-hero-card input,
.mode-hero-card select {
  width: 100%;
  font-size: 15px;
  font-weight: 700;
  padding: 6px 10px;
  background: #070a12;
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 5px;
  color: #38bdf8;
}

/* Global Common Hardware Safety Panel */
.global-common-section {
  margin-top: 14px;
}

.temp-protect-panel {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(75, 85, 99, 0.35);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 10px;
}

.temp-protect-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.temp-field-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.temp-field-header .field-label-accent {
  font-size: 11px;
  font-weight: 700;
  color: #cbd5e1;
  letter-spacing: 0.02em;
}

.temp-field-header .field-subnote {
  font-size: 10.5px;
  color: #94a3b8;
  background: rgba(148, 163, 184, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
}

.temp-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.temp-input-wrap input.temp-input {
  width: 100%;
  font-size: 15px;
  font-weight: 700;
  padding: 6px 28px 6px 10px;
  background: #070a12;
  border: 1px solid rgba(75, 85, 99, 0.4);
  border-radius: 5px;
  color: var(--text-0);
}

/* Slide-in Presets & Configuration Drawer (GSAP Choreographed) */
.drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  justify-content: flex-end;
}

.drawer-overlay.hidden {
  display: none !important;
}

.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 7, 13, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.config-drawer {
  position: relative;
  width: 100%;
  max-width: 520px;
  height: 100%;
  background: #0f1523;
  border-left: 1px solid var(--border);
  box-shadow: -12px 0 36px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  z-index: 2001;
  will-change: transform;
}

.drawer-header {
  padding: 14px 18px;
  background: #0b0f19;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-header-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.drawer-header-title h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-0);
  margin: 0;
}

.drawer-header .version-badge {
  font-size: 11px;
  font-weight: 600;
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 4px;
  padding: 2px 7px;
  letter-spacing: 0.02em;
}

.close-drawer-btn {
  font-size: 12px;
  font-weight: 600;
  min-height: 34px;
  padding: 4px 12px;
  cursor: pointer;
}

.drawer-body {
  padding: 16px 18px;
  overflow-y: auto;
  flex: 1;
  -webkit-overflow-scrolling: touch;
}

.drawer-footer {
  padding: 12px 18px;
  background: #0b0f19;
  border-top: 1px solid var(--border);
}

.drawer-version-footer {
  margin-top: 10px;
  text-align: center;
  font-size: 11px;
  color: var(--text-2);
}

.drawer-version-footer strong {
  color: #38bdf8;
  font-weight: 600;
}

.btn.full-width {
  width: 100%;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
}

.config-toggle-btn {
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.45);
  color: #38bdf8;
  font-weight: 600;
}

.config-toggle-btn:hover {
  background: rgba(56, 189, 248, 0.22);
  border-color: rgba(56, 189, 248, 0.7);
}

.keeper-controls-card.in-drawer {
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
}

.keeper-audio-row {
  margin-top: 14px;
  padding: 10px 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.keeper-audio-row .audio-row-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.keeper-audio-row .preset-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-0);
}

.keeper-audio-row .keeper-note {
  font-size: 11px;
  color: var(--text-2);
  margin: 0;
  line-height: 1.4;
}

.keeper-audio-row #btnToggleAudio {
  flex-shrink: 0;
  min-width: 110px;
}

.keeper-fan-note {
  margin-top: 14px;
  padding: 10px 12px;
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 8px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 11px;
  line-height: 1.45;
  color: var(--text-1);
}

.keeper-fan-note .fan-icon {
  font-size: 14px;
  flex-shrink: 0;
  margin-top: 1px;
}

/* Deployed Version Card inside Drawer */
.keeper-version-card {
  margin-top: 14px;
  padding: 12px 14px;
  background: #0b0f19;
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.version-card-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.version-card-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-2);
}

.version-number-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.version-pill {
  font-size: 13px;
  font-weight: 700;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.14);
  border: 1px solid rgba(56, 189, 248, 0.35);
  padding: 2px 8px;
  border-radius: 4px;
}

.version-meta {
  font-size: 11px;
  color: var(--text-2);
}

.version-card-status {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
  padding: 4px 9px;
  border-radius: 9999px;
  flex-shrink: 0;
}

.version-status-indicator {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.7);
}

.version-channel {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #4ade80;
}

/* Mini 4WD Pair Live Summary Cards */
.pairs-summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}

.pair-card {
  background: linear-gradient(180deg, #131a27 0%, #0d121c 100%);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all 0.2s ease;
}

.pair-card.ready {
  border-color: rgba(16, 185, 129, 0.6);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.12);
}

.pair-card.balancing {
  border-color: rgba(59, 130, 246, 0.6);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.1);
}

.pair-card.stalled {
  border-color: rgba(239, 68, 68, 0.7);
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.18);
}

.pair-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pair-title-box {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pair-tag {
  background: rgba(6, 182, 212, 0.15);
  border: 1px solid rgba(6, 182, 212, 0.4);
  color: #67e8f9;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
}

.pair-subtext {
  font-size: 11px;
  color: var(--text-1);
}

.pair-badge {
  font-size: 10px;
  font-family: var(--font-mono);
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-2);
  color: var(--text-1);
  font-weight: 600;
  text-transform: uppercase;
}

.pair-badge.ready {
  background: rgba(16, 185, 129, 0.2);
  border-color: rgba(16, 185, 129, 0.6);
  color: #6ee7b7;
}

.pair-badge.balancing {
  background: rgba(59, 130, 246, 0.2);
  border-color: rgba(59, 130, 246, 0.6);
  color: #93c5fd;
}

.pair-badge.stalled {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.7);
  color: #fca5a5;
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Pair Individual Action Buttons */
.pair-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 1px 0 2px 0;
}

.pair-actions .btn {
  font-size: 11px;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.pair-actions .pair-start-btn {
  flex: 1;
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid rgba(16, 185, 129, 0.55);
  color: #6ee7b7;
  padding: 5px 10px;
}

.pair-actions .pair-start-btn:hover:not(:disabled) {
  background: rgba(16, 185, 129, 0.35);
  border-color: rgba(16, 185, 129, 0.8);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.3);
}

.pair-actions .pair-stop-btn {
  flex: 1;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.5);
  color: #fca5a5;
  padding: 5px 12px;
}

.pair-actions .pair-stop-btn:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.3);
  border-color: rgba(239, 68, 68, 0.8);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.3);
}

.pair-card-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  background: rgba(0, 0, 0, 0.25);
  padding: 6px 10px;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.pair-v-label {
  font-size: 9px;
  color: var(--text-2);
  font-weight: 600;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}

.pair-v-val {
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
}

.pair-v-delta {
  font-size: 10.5px;
  color: var(--text-1);
  margin-top: 1px;
}

.pair-diff-val {
  font-size: 16px;
  font-weight: 700;
  color: #38bdf8;
}

.pair-match-grade {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-2);
  margin-top: 2px;
}

.pair-match-grade.excellent {
  color: #34d399;
}

.pair-match-grade.good {
  color: #60a5fa;
}

.pair-match-grade.imbalanced {
  color: #fbbf24;
}

.pair-match-grade.fault {
  color: #f87171;
}

.pair-status-footer {
  font-size: 11px;
  color: var(--text-1);
  display: none; /* Hidden on desktop because per-slot subgrids appear directly below */
  align-items: center;
  justify-content: space-between;
}

/* Dual Horizontal Stacked Voltage Bars */
.pair-bars-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 5px;
  padding: 8px 10px;
}

.pair-bar-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.pair-bar-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
}

.pair-bar-name-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pair-bar-slot-name {
  font-weight: 700;
  color: #e2e8f0;
  letter-spacing: 0.02em;
}

.pair-bar-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  position: relative;
  font-size: 9.5px;
  font-family: var(--font-mono);
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  transition: all 0.2s ease;
  white-space: nowrap;
  line-height: 1.2;
}

.pair-bar-status-badge.charging {
  background: rgba(59, 130, 246, 0.25);
  border-color: rgba(59, 130, 246, 0.7);
  color: #bfdbfe;
  font-weight: 600;
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.35);
  animation: chargingBadgePulse 1.2s ease-in-out infinite;
}
@keyframes chargingBadgePulse {
  0%, 100% { box-shadow: 0 0 4px rgba(59, 130, 246, 0.2); }
  50% { box-shadow: 0 0 12px rgba(96, 165, 250, 0.6); }
}

.pair-bar-status-badge.discharging {
  background: rgba(245, 158, 11, 0.25);
  border-color: rgba(245, 158, 11, 0.7);
  color: #fde68a;
  font-weight: 600;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.35);
  animation: dischargingBadgePulse 1.2s ease-in-out infinite;
}
@keyframes dischargingBadgePulse {
  0%, 100% { box-shadow: 0 0 4px rgba(245, 158, 11, 0.2); }
  50% { box-shadow: 0 0 12px rgba(251, 191, 36, 0.6); }
}

.pair-bar-status-badge.resting {
  background: rgba(139, 92, 246, 0.25);
  border-color: rgba(139, 92, 246, 0.7);
  color: #ddd6fe;
  box-shadow: 0 0 8px rgba(139, 92, 246, 0.3);
  animation: restingBadgeGlow 2.8s ease-in-out infinite;
}
@keyframes restingBadgeGlow {
  0%, 100% { box-shadow: 0 0 4px rgba(139, 92, 246, 0.2); }
  50% { box-shadow: 0 0 10px rgba(167, 139, 250, 0.6); }
}

.pair-bar-status-badge.ready,
.pair-bar-status-badge.done {
  background: rgba(16, 185, 129, 0.25);
  border-color: rgba(16, 185, 129, 0.7);
  color: #6ee7b7;
  font-weight: 600;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.35);
}

.pair-bar-status-badge.stalled {
  background: rgba(239, 68, 68, 0.25);
  border-color: rgba(239, 68, 68, 0.7);
  color: #fca5a5;
  font-weight: 600;
}

.pair-bar-status-badge.standby {
  background: var(--bg-2);
  border-color: var(--border);
  color: var(--text-2);
}

/* Sleeping zzZZZ Animated Indicator */
.sleep-zzz {
  display: inline-flex;
  align-items: baseline;
  gap: 1px;
  margin-left: 3px;
  font-family: var(--font-mono);
  font-weight: 800;
  line-height: 1;
}
.sleep-zzz span {
  display: inline-block;
  opacity: 0;
  color: #c4b5fd;
  text-shadow: 0 0 6px rgba(196, 181, 253, 0.85);
  animation: zzzFloatDrift 2.2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  transform-origin: center bottom;
}
.sleep-zzz span:nth-child(1) { font-size: 7.5px; animation-delay: 0s; }
.sleep-zzz span:nth-child(2) { font-size: 9px; animation-delay: 0.45s; }
.sleep-zzz span:nth-child(3) { font-size: 11px; animation-delay: 0.9s; }

@keyframes zzzFloatDrift {
  0% {
    opacity: 0;
    transform: translateY(2px) scale(0.7);
  }
  30% {
    opacity: 1;
    transform: translateY(-1px) scale(0.95);
  }
  70% {
    opacity: 0.85;
    transform: translateY(-4px) scale(1.15) rotate(4deg);
  }
  100% {
    opacity: 0;
    transform: translateY(-8px) scale(1.3) rotate(10deg);
  }
}

.pair-bar-volt {
  font-size: 11.5px;
  font-weight: 700;
  color: #38bdf8;
}

.pair-bar-track-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pair-bar-track {
  position: relative;
  width: 100%;
  height: 14px;
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6);
}

.pair-bar-fill {
  position: relative;
  height: 100%;
  width: 0%;
  border-radius: 3px 0 0 3px;
  background: linear-gradient(90deg, #0284c7 0%, #38bdf8 100%);
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.pair-bar-fill.ready,
.pair-bar-fill.done {
  background: linear-gradient(90deg, #059669 0%, #10b981 100%);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

/* 1. Charging Animation: Left to Right Flow + Leading Plasma Tip */
.pair-bar-fill.charging {
  background: repeating-linear-gradient(
    -45deg,
    #0284c7 0px,
    #0284c7 10px,
    #38bdf8 10px,
    #38bdf8 20px,
    #60a5fa 20px,
    #60a5fa 30px
  );
  background-size: 42.43px 100%;
  animation: barFlowLeftToRight 0.85s linear infinite;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.5);
  will-change: background-position;
}

@keyframes barFlowLeftToRight {
  0% { background-position: 0 0; }
  100% { background-position: 42.43px 0; }
}

.pair-bar-fill.charging::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 8px;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.95) 100%);
  box-shadow: 0 0 12px #38bdf8, 0 0 4px #ffffff;
  border-radius: 0 3px 3px 0;
  animation: chargeTipGlow 0.8s ease-in-out infinite alternate;
}

@keyframes chargeTipGlow {
  0% { opacity: 0.5; filter: brightness(1); }
  100% { opacity: 1; filter: brightness(1.6) drop-shadow(0 0 6px #67e8f9); }
}

.pair-bar-fill.charging::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.35) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  background-size: 200% 100%;
  animation: chargeShimmerL2R 1.6s ease-in-out infinite;
  pointer-events: none;
}

@keyframes chargeShimmerL2R {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* 2. Discharging Animation: Right to Left Flow + Reverse Drain Shimmer */
.pair-bar-fill.discharging {
  background: repeating-linear-gradient(
    45deg,
    #b45309 0px,
    #b45309 10px,
    #d97706 10px,
    #d97706 20px,
    #f59e0b 20px,
    #f59e0b 30px
  );
  background-size: 42.43px 100%;
  animation: barFlowRightToLeft 0.85s linear infinite;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.5);
  will-change: background-position;
}

@keyframes barFlowRightToLeft {
  0% { background-position: 42.43px 0; }
  100% { background-position: 0 0; }
}

.pair-bar-fill.discharging::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 8px;
  background: linear-gradient(270deg, rgba(251, 191, 36, 0.95) 0%, transparent 100%);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.8);
  border-radius: 0 3px 3px 0;
  animation: dischargeTipPulse 0.8s ease-in-out infinite alternate;
}

@keyframes dischargeTipPulse {
  0% { opacity: 0.5; filter: brightness(1); }
  100% { opacity: 1; filter: brightness(1.5); }
}

.pair-bar-fill.discharging::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(
    270deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.3) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  background-size: 200% 100%;
  animation: dischargeShimmerR2L 1.6s ease-in-out infinite;
  pointer-events: none;
}

@keyframes dischargeShimmerR2L {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* 3. Resting Animation: Calm Breathing Glow & Floating zzZZZ */
.pair-bar-fill.resting {
  background: linear-gradient(90deg, #4f46e5 0%, #818cf8 50%, #6366f1 100%);
  animation: barBreatheGlow 3.0s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  position: relative;
  will-change: opacity, filter, box-shadow;
}

@keyframes barBreatheGlow {
  0%, 100% {
    opacity: 0.65;
    filter: brightness(0.9);
    box-shadow: 0 0 6px rgba(99, 102, 241, 0.3), inset 0 0 4px rgba(255, 255, 255, 0.1);
  }
  50% {
    opacity: 1;
    filter: brightness(1.25);
    box-shadow: 0 0 16px rgba(129, 140, 248, 0.85), 0 0 6px rgba(196, 181, 253, 0.6), inset 0 0 8px rgba(255, 255, 255, 0.4);
  }
}

.pair-bar-fill.resting::after {
  content: "z Z Z";
  position: absolute;
  right: 8px;
  top: 0;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 2px;
  color: #e0e7ff;
  text-shadow: 0 0 6px rgba(196, 181, 253, 0.9);
  animation: restFloatingZzz 2.6s ease-in-out infinite;
  pointer-events: none;
}

@keyframes restFloatingZzz {
  0% {
    opacity: 0;
    transform: translate(0, 3px) scale(0.8);
  }
  30% {
    opacity: 0.95;
    transform: translate(1px, -1px) scale(1);
  }
  70% {
    opacity: 0.8;
    transform: translate(3px, -5px) scale(1.15);
  }
  100% {
    opacity: 0;
    transform: translate(6px, -10px) scale(1.3);
  }
}

.pair-bar-fill.stalled {
  background: linear-gradient(90deg, #dc2626 0%, #ef4444 100%);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.6);
  animation: stalledBarPulse 1.2s ease-in-out infinite;
}
@keyframes stalledBarPulse {
  0%, 100% { opacity: 0.8; }
  50% { opacity: 1; filter: brightness(1.2); }
}

.pair-bar-target-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #facc15;
  box-shadow: 0 0 6px rgba(250, 204, 21, 0.85);
  z-index: 2;
  transform: translateX(-50%);
  pointer-events: none;
}

.pair-bar-target-line::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  border-left: 3px solid transparent;
  border-right: 3px solid transparent;
  border-top: 4px solid #facc15;
}

.pair-bar-scale {
  display: flex;
  justify-content: space-between;
  font-size: 8.5px;
  color: var(--text-2);
  font-family: var(--font-mono);
  padding: 0 1px;
}

.target-tick-label {
  color: #facc15;
  font-weight: 600;
}

/* Stalled / Defective Battery Warning Banner */
.slot-stall-banner,
.pair-stall-banner {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.6);
  border-radius: 5px;
  padding: 6px 8px;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin: 4px 0;
  animation: pulse 2s infinite;
}

.slot-stall-banner.hidden,
.pair-stall-banner.hidden {
  display: none !important;
}

.stall-icon {
  font-size: 14px;
  line-height: 1;
}

.stall-msg-box {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.stall-title {
  color: #fca5a5;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.stall-reason {
  color: #fee2e2;
  font-size: 10px;
  line-height: 1.3;
}

.dismiss-stall-btn {
  padding: 1px 6px !important;
  font-size: 9.5px !important;
  align-self: center;
  background: rgba(239, 68, 68, 0.3) !important;
  border-color: rgba(239, 68, 68, 0.6) !important;
  color: #fff !important;
}

.slot-card.stalled {
  border-color: rgba(239, 68, 68, 0.8) !important;
  box-shadow: inset 0 0 14px rgba(239, 68, 68, 0.15) !important;
}

.log-decoded {
  color: #fde68a;
  font-size: 11px;
}

/* Firebase Live Badge */
.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  transition: all 0.2s ease;
}
.live-badge:hover {
  background: rgba(74, 222, 128, 0.3) !important;
  border-color: rgba(74, 222, 128, 0.8) !important;
  box-shadow: 0 0 10px rgba(74, 222, 128, 0.3);
}

/* Pit Display Mode (Enlarged High-Contrast Focus View for Paddock Use) */
body.pit-mode .workspace-grid {
  display: none !important;
}
body.pit-mode .keeper-dashboard {
  flex: 1;
  max-height: none;
  overflow-y: auto;
  border-bottom: none;
  padding: 20px 24px;
  background: var(--bg-0);
}
body.pit-mode .pairs-summary-grid {
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 20px;
  margin: 16px 0 24px 0;
}
body.pit-mode .pair-card {
  padding: 24px;
  border-width: 2px;
  border-radius: 12px;
  background: var(--bg-1);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
body.pit-mode .pair-title,
body.pit-mode .pair-title-box {
  font-size: 1.25rem;
}
body.pit-mode .pair-v-val,
body.pit-mode .pair-voltage-hero {
  font-size: 2.8rem !important;
  font-weight: 900;
  letter-spacing: -0.02em;
}
body.pit-mode .pair-diff-val {
  font-size: 1.6rem !important;
}
body.pit-mode .pair-cell-line {
  font-size: 1.15rem;
  margin-bottom: 8px;
}
body.pit-mode .pair-match-grade {
  font-size: 1rem;
  padding: 8px 16px;
  border-radius: 8px;
}
body.pit-mode .slots-grid,
body.pit-mode .slot-telemetry-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
body.pit-mode .slot-card {
  padding: 18px;
  border-width: 2px;
  border-radius: 10px;
}
body.pit-mode .slot-voltage,
body.pit-mode .slot-voltage-hero {
  font-size: 2.1rem !important;
}
body.pit-mode #btnTogglePitMode {
  background: var(--accent) !important;
  color: #fff !important;
  font-weight: 700 !important;
  border-color: var(--accent) !important;
}

/* Mobile & Tablet Responsive Media Queries */

/* Tablet & Smaller Desktops (<= 1024px) */
@media (max-width: 1024px) {
  html, body {
    overflow-x: hidden !important;
    max-width: 100vw;
  }

  body:not(.pit-mode) {
    height: auto !important;
    min-height: 100vh;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch;
  }

  .keeper-dashboard {
    flex-shrink: 0;
    padding: 12px 14px;
    min-width: 0;
    max-width: 100%;
    width: 100%;
  }

  .keeper-body {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .keeper-controls-card {
    min-width: 0;
    max-width: 100%;
    width: 100%;
  }

  .pairs-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    min-width: 0;
    width: 100%;
  }

  .pair-card {
    min-width: 0;
    max-width: 100%;
  }

  .slots-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    min-width: 0;
    width: 100%;
  }

  .slot-card {
    min-width: 0;
    max-width: 100%;
  }

  .workspace-grid {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    min-height: auto;
    height: auto;
  }

  .panel {
    min-height: 380px;
    min-width: 0;
    max-width: 100%;
    width: 100%;
  }
}

/* Tablets & Large Phones (<= 768px) */
@media (max-width: 768px) {
  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 10px 14px;
    padding-top: max(10px, env(safe-area-inset-top));
  }

  .brand {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    flex-wrap: wrap;
    gap: 6px;
  }

  .brand h1 {
    font-size: 14px;
  }

  .connection-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    gap: 8px;
    align-items: center;
  }

  .connection-controls #statusIndicator,
  .connection-controls #keeperGlobalStatus {
    grid-column: span 1;
    justify-content: center;
    min-height: 38px;
  }

  .connection-controls .filter-toggle {
    grid-column: span 1;
    justify-content: center;
    font-size: 11px;
    min-height: 38px;
    padding: 0 4px;
  }

  #btnConnect {
    grid-column: span 1;
    min-height: 44px;
    font-size: 13px;
    font-weight: 700;
  }

  #btnTogglePitMode {
    grid-column: span 1;
    min-height: 44px;
    font-size: 12px;
    font-weight: 600;
  }

  #btnDisconnect {
    grid-column: span 1;
    min-height: 40px;
  }

  #btnExportSession {
    grid-column: span 1;
    min-height: 40px;
  }

  .connection-controls a.btn {
    grid-column: span 1;
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11.5px;
    padding: 6px 8px;
  }

  .panel-header .btn,
  .log-controls .btn,
  .custom-uuid-bar .btn,
  .scanner-controls .btn,
  .dumper-controls .btn {
    min-height: 38px;
    padding: 6px 12px;
    font-size: 12px;
  }

  /* Keeper Dashboard Mobile Polish */
  .keeper-dashboard {
    padding: 10px 12px;
    gap: 12px;
  }

  .keeper-header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .keeper-title-group {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
  }

  .keeper-title-group h2 {
    font-size: 13.5px;
  }

  .keeper-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    gap: 8px;
  }

  .keeper-actions .filter-toggle {
    grid-column: span 1;
    min-height: 38px;
    justify-content: flex-start;
  }

  #btnPollOnce {
    grid-column: span 1;
    min-height: 38px;
  }

  #btnStartKeeper,
  #btnStopKeeper {
    grid-column: span 1;
    min-height: 42px;
    font-size: 13px;
    font-weight: 700;
    box-shadow: 0 2px 10px rgba(59, 130, 246, 0.3);
  }

  .config-toggle-btn {
    grid-column: span 1;
    min-height: 42px;
    font-size: 13px;
  }

  /* Horizontal scrolling chip strip for presets */
  .keeper-preset-row {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 6px;
    padding: 4px 0 6px 0;
    scrollbar-width: thin;
    max-width: 100%;
    scroll-snap-type: x proximity;
  }

  .preset-label {
    flex-shrink: 0;
    align-self: center;
    font-size: 10.5px;
  }

  .preset-btn {
    flex-shrink: 0;
    min-height: 38px;
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
    white-space: nowrap;
    scroll-snap-align: start;
  }

  /* Keeper Settings Grid */
  .keeper-form-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .k-field input {
    min-height: 40px;
    font-size: 14px;
    padding: 6px 10px;
  }

  .link-pairs-box {
    grid-column: span 2;
    min-height: unset;
    height: 36px;
    padding: 4px 8px;
  }

  /* Slot toggles */
  .keeper-slot-toggles {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    width: 100%;
  }

  .keeper-slot-toggles .preset-label {
    grid-column: span 4;
    margin-bottom: 2px;
  }

  .slot-check {
    min-height: 38px;
    justify-content: center;
    font-size: 11px;
    padding: 4px 6px;
  }

  .keeper-note {
    grid-column: span 4;
    font-size: 10.5px;
    line-height: 1.35;
    margin-top: 4px;
  }

  /* Pair Cards & Dashboard */
  .pairs-summary-grid,
  .pairs-dashboard-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .pair-card {
    padding: 10px 12px;
    border-radius: 8px;
  }

  .pair-v-val {
    font-size: 24px;
  }

  .pair-diff-val {
    font-size: 18px;
  }

  .pair-match-grade {
    font-size: 11.5px;
    padding: 4px 10px;
  }

  /* On mobile / smaller screens, completely hide the SLOT cards */
  .pair-slots-subgrid {
    display: none !important;
  }

  /* Show the pair status footer on mobile screens */
  .pair-status-footer {
    display: block;
    font-size: 10.5px;
    color: var(--text-2);
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    margin-top: 4px;
    line-height: 1.35;
    text-align: center;
  }

  .pair-actions .btn {
    min-height: 36px;
    font-size: 11.5px;
  }
}

/* Small Smartphone Screens (iPhone SE, Galaxy A, <= 480px) */
@media (max-width: 480px) {
  .brand-badge-logo {
    width: 30px;
    height: 30px;
  }

  .skyrc-logo {
    width: 68px;
    height: 16.7px;
  }

  .brand-divider {
    height: 14px;
  }

  .brand h1 {
    font-size: 13px;
  }

  .live-badge {
    font-size: 10px;
    padding: 2px 6px;
  }

  .connection-controls {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  .keeper-form-grid {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  .highlight-field {
    grid-column: span 2;
  }

  .pair-slots-subgrid {
    display: none !important;
  }

  .pair-status-footer {
    display: block;
    font-size: 10px;
    padding-top: 5px;
  }

  .pair-actions {
    gap: 6px;
  }

  .pair-actions .btn {
    min-height: 40px;
    font-size: 12px;
  }

  .pair-bar-track {
    height: 16px;
  }

  .config-drawer {
    max-width: 100%;
  }

  .close-drawer-btn {
    min-height: 40px;
    font-size: 13px;
  }

  /* Pit Display Mode on Compact Screens */
  body.pit-mode .keeper-dashboard {
    padding: 14px 10px;
  }

  body.pit-mode .pairs-summary-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  body.pit-mode .pair-card {
    padding: 16px 14px;
  }

  body.pit-mode .pair-bar-track {
    height: 20px;
  }

  body.pit-mode .pair-v-val,
  body.pit-mode .pair-voltage-hero {
    font-size: 2.2rem !important;
  }

  body.pit-mode .slots-grid,
  body.pit-mode .slot-telemetry-grid {
    grid-template-columns: 1fr;
  }
}

/* Site Footer & dad-codes.com Attribution */
.site-footer {
  margin-top: 0;
  padding: 10px 20px;
  flex-shrink: 0;
  background: var(--bg-1);
  border-top: 1px solid var(--border);
  color: var(--text-2);
  font-size: 12px;
  width: 100%;
}

.site-footer .footer-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.site-footer .footer-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-2);
}

.site-footer .footer-title {
  font-weight: 600;
  color: var(--text-1);
}

.site-footer .footer-sep {
  color: var(--border);
}

.site-footer .footer-sub {
  color: var(--text-2);
}

.site-footer .footer-version {
  font-size: 11px;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.25);
  padding: 1px 6px;
  border-radius: 4px;
}

.site-footer .footer-credit {
  font-family: var(--font-mono);
  font-size: 11.5px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  color: var(--text-1);
}

.site-footer .footer-promo-link {
  color: #fbbf24;
  font-weight: 700;
  text-decoration: none;
  border-bottom: 1px solid rgba(251, 191, 36, 0.45);
  padding-bottom: 1px;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.site-footer .footer-promo-link:hover {
  color: #fde68a;
  border-bottom-color: #fbbf24;
}

.site-footer .dad-codes-link {
  color: #38bdf8;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.15s ease, border-color 0.15s ease;
  border-bottom: 1px solid rgba(56, 189, 248, 0.4);
  padding-bottom: 1px;
}

.site-footer .dad-codes-link:hover {
  color: #7dd3fc;
  border-bottom-color: #38bdf8;
}

@media (max-width: 600px) {
  .site-footer {
    padding: 16px;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    margin-top: 24px;
  }
  .site-footer .footer-container {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
  }
  .site-footer .footer-meta {
    flex-direction: column;
    gap: 2px;
  }
  .site-footer .footer-sep {
    display: none;
  }
}

/* ==========================================================================
   Working Modes & Profile Presets System
   ========================================================================== */
.mode-active-pill {
  background: rgba(59, 130, 246, 0.18);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.45);
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s ease;
}
.mode-active-pill:hover {
  background: rgba(59, 130, 246, 0.35);
  border-color: #3b82f6;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.keeper-mode-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(59, 130, 246, 0.35);
  border-radius: 8px;
  margin-bottom: 12px;
}

.mode-select, .profile-select {
  width: 100%;
  background: #0b0f19;
  border: 1px solid var(--border);
  color: #f3f4f6;
  padding: 9px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
}
.mode-select:focus, .profile-select:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
}

.profile-manager-box {
  background: rgba(17, 24, 39, 0.7);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.profile-row-top {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.profile-btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.profile-action-btn {
  flex: 1;
  min-width: 80px;
  font-size: 11px;
  padding: 7px 10px;
  text-align: center;
  font-weight: 600;
}
.profile-action-btn.danger {
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}
.profile-action-btn.danger:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.2);
  border-color: #ef4444;
}
.profile-action-btn:disabled {
  opacity: 0.38 !important;
  cursor: not-allowed !important;
  filter: grayscale(0.6);
  pointer-events: auto !important; /* Enable hover to view informative tooltip */
}

.mode-info-box {
  background: rgba(30, 58, 138, 0.2);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 12px;
  color: #93c5fd;
  line-height: 1.5;
  margin-top: 10px;
}
.mode-info-box strong {
  color: #bfdbfe;
}

/* Custom Toast Notifications (Anti-native alert replacement) */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  max-width: 380px;
  width: calc(100vw - 36px);
}

.toast {
  pointer-events: auto;
  background: #111827;
  border: 1px solid #1f2937;
  border-radius: 8px;
  padding: 12px 14px;
  color: #f3f4f6;
  font-size: 13px;
  line-height: 1.45;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.6), 0 0 12px rgba(56, 189, 248, 0.12);
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.info {
  border-left: 4px solid var(--accent, #38bdf8);
}

.toast.success {
  border-left: 4px solid #10b981;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.6), 0 0 12px rgba(16, 185, 129, 0.2);
}

.toast.warning {
  border-left: 4px solid #f59e0b;
}

.toast.error {
  border-left: 4px solid #ef4444;
}

.toast-icon {
  font-size: 16px;
  line-height: 1;
  flex-shrink: 0;
}

.toast-msg {
  flex: 1;
  word-break: break-word;
}

.toast-close {
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  padding: 0 4px;
  font-size: 18px;
  line-height: 1;
  margin-left: auto;
  transition: color 0.15s ease;
}

.toast-close:hover {
  color: #fff;
}

/* Custom Confirmation & Prompt Modal Dialog */
.custom-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.custom-modal-overlay.hidden {
  display: none !important;
}

.custom-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 7, 18, 0.78);
  backdrop-filter: blur(4px);
}

.custom-modal-card {
  position: relative;
  z-index: 1;
  background: #111827;
  border: 1px solid #374151;
  border-radius: 12px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.75), 0 0 20px rgba(56, 189, 248, 0.15);
  overflow: hidden;
}

.custom-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid #1f2937;
  background: rgba(255, 255, 255, 0.02);
}

.custom-modal-title {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  margin: 0;
}

.custom-modal-close {
  background: none;
  border: none;
  color: #9ca3af;
  font-size: 20px;
  cursor: pointer;
  padding: 2px 6px;
  line-height: 1;
  border-radius: 4px;
  transition: color 0.15s ease;
}

.custom-modal-close:hover {
  color: #fff;
}

.custom-modal-body {
  padding: 18px;
  font-size: 13.5px;
  color: #d1d5db;
  line-height: 1.5;
}

.custom-modal-message {
  margin: 0;
}

.custom-modal-input-wrap {
  margin-top: 12px;
}

.custom-modal-input-wrap.hidden {
  display: none !important;
}

.custom-modal-input {
  width: 100%;
  background: #030712;
  border: 1px solid #374151;
  border-radius: 6px;
  color: #fff;
  padding: 9px 12px;
  font-size: 13px;
  box-sizing: border-box;
}

.custom-modal-input:focus {
  outline: none;
  border-color: var(--accent, #38bdf8);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.custom-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 18px;
  border-top: 1px solid #1f2937;
  background: rgba(0, 0, 0, 0.2);
}

/* ============================================================================
   Application Tab Navigation (Dashboard vs Telemetry Analytics vs Diagnostics)
   ============================================================================ */
.app-tab-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  margin-bottom: 10px;
}

.tab-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text-1);
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
  user-select: none;
}

.tab-nav-btn:hover {
  background: var(--bg-3);
  color: var(--text-0);
  border-color: var(--text-2);
}

.tab-nav-btn.active {
  background: #0284c7;
  color: #fff;
  border-color: #38bdf8;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.3);
}

.tab-pulse-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  margin-left: 2px;
}

.tab-pulse-dot.pulsing {
  box-shadow: 0 0 6px #10b981;
  animation: tabDotPulse 1.2s infinite;
}

@keyframes tabDotPulse {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.6; }
  100% { transform: scale(1); opacity: 1; }
}

/* ============================================================================
   Telemetry Analytics View (Tab 2)
   ============================================================================ */
.analytics-tab-view {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  min-width: 0;
}

.analytics-tab-view.hidden {
  display: none !important;
}

/* Analytics Toolbar */
.analytics-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
}

.analytics-toolbar-left,
.analytics-toolbar-right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.analytics-bar-tag {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.analytics-slot-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.analytics-pill-btn {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 600;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.15s ease-in-out;
}

.analytics-pill-btn:hover {
  border-color: var(--accent);
  color: var(--text-0);
}

.analytics-pill-btn.active {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.8);
  color: #38bdf8;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.2);
}

.analytics-pill-btn.overlay-btn.active {
  background: rgba(192, 132, 252, 0.15);
  border-color: rgba(192, 132, 252, 0.8);
  color: #c084fc;
}

.analytics-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 4px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text-1);
}

.status-pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
}

/* Export Dropdown */
.export-dropdown-wrapper {
  position: relative;
}

.export-menu-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 190px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  z-index: 50;
}

.export-menu-dropdown.hidden {
  display: none !important;
}

.export-item {
  background: transparent;
  border: none;
  color: var(--text-0);
  padding: 7px 10px;
  text-align: left;
  font-size: 11.5px;
  font-weight: 500;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.12s;
  width: 100%;
}

.export-item:hover {
  background: var(--bg-3);
  color: var(--accent);
}

/* KPI Summary Ribbon */
.analytics-kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

@media (max-width: 1100px) {
  .analytics-kpi-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .analytics-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .analytics-kpi-grid {
    grid-template-columns: 1fr;
  }
}

.kpi-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.kpi-card.highlight-card {
  border-color: rgba(16, 185, 129, 0.4);
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.08) 0%, var(--bg-1) 100%);
}

.kpi-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kpi-label {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-2);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.kpi-sub-label {
  font-size: 10px;
  color: var(--text-2);
}

.kpi-val-row {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin: 2px 0;
}

.kpi-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-0);
  line-height: 1.1;
}

.kpi-unit {
  font-size: 11px;
  color: var(--text-2);
  font-weight: 600;
}

.kpi-footer-meta {
  font-size: 10.5px;
  color: var(--text-1);
}

.text-blue { color: #38bdf8 !important; }
.text-green { color: #10b981 !important; }
.text-purple { color: #c084fc !important; }
.text-amber { color: #f59e0b !important; }

/* Chart Container Card */
.analytics-chart-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 440px;
  height: 480px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.chart-title-group h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-0);
  margin: 0;
}

.chart-subtitle {
  font-size: 11px;
  color: var(--text-2);
}

.chart-metric-toggles-wrapper {
  display: flex;
  align-items: center;
}

.chart-metric-toggles {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.chart-overlay-pills {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.overlay-pills-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-2);
}

.overlay-metric-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 5px;
  font-size: 11.5px;
  font-weight: 600;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.15s ease-in-out;
}

.overlay-metric-pill:hover {
  border-color: var(--accent);
  color: var(--text-0);
}

.overlay-metric-pill.active {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.8);
  color: #38bdf8;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.2);
}

.overlay-metric-pill.active.text-green {
  background: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.8);
  color: #22c55e !important;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.2);
}

.overlay-metric-pill.active.text-purple {
  background: rgba(192, 132, 252, 0.15);
  border-color: rgba(192, 132, 252, 0.8);
  color: #c084fc !important;
  box-shadow: 0 0 8px rgba(192, 132, 252, 0.2);
}

.overlay-metric-pill.active.text-amber {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.8);
  color: #f59e0b !important;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.2);
}

.metric-toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}

.metric-toggle-label input[type="checkbox"] {
  accent-color: currentColor;
  width: 13px;
  height: 13px;
}

.chart-canvas-wrapper {
  position: relative;
  flex: 1;
  width: 100%;
  min-height: 340px;
}

/* NC3000 Hardware System Settings Card */
.hw-settings-card {
  margin-top: 14px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
}

.hw-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.hw-settings-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.hw-settings-action-row .btn {
  flex: 1 1 auto;
  min-height: 36px;
}

/* ============================================================================
   Battery Test / Mini 4WD Motor Dyno View (Tab 3)
   ============================================================================ */
.battery-test-tab-view {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  min-width: 0;
  padding-bottom: 16px;
}

.battery-test-tab-view.hidden {
  display: none !important;
}

.dyno-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dyno-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.dyno-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.dyno-title-wrap h3 {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-0);
  margin: 0;
}

.dyno-subtitle {
  font-size: 11px;
  color: var(--text-2);
}

.dyno-safety-pill {
  display: inline-block;
  font-size: 10.5px;
  color: #6ee7b7;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: 4px;
  padding: 2px 7px;
  width: fit-content;
}

.dyno-header-actions,
.dyno-ranking-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.dyno-chk-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--text-1);
  cursor: pointer;
  user-select: none;
}

.dyno-config-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1.5fr) 160px minmax(280px, 1.5fr) minmax(200px, 1fr);
  gap: 10px;
  align-items: end;
}

.dyno-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.dyno-field-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-1);
}

.dyno-select,
.dyno-input {
  width: 100%;
  background: var(--bg-0);
  border: 1px solid var(--border);
  color: var(--text-0);
  padding: 6px 9px;
  border-radius: 5px;
  font-size: 12px;
  min-height: 33px;
}

.dyno-select:focus,
.dyno-input:focus {
  outline: none;
  border-color: var(--accent);
}

.dyno-dur-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.dyno-dur-btn {
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text-1);
  padding: 5px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: all 0.14s ease;
}

.dyno-dur-btn:hover {
  border-color: var(--accent);
  color: var(--text-0);
}

.dyno-dur-btn.active {
  background: rgba(56, 189, 248, 0.2);
  border-color: #38bdf8;
  color: #38bdf8;
}

.dyno-banner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 11.5px;
  line-height: 1.4;
}

.dyno-banner-info {
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #bae6fd;
}

.dyno-banner-warn {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.45);
  color: #fde68a;
}

.dyno-banner-icon {
  font-size: 14px;
  flex-shrink: 0;
}

.dyno-banner-text {
  flex: 1 1 260px;
}

.dyno-banner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.dyno-slots-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.dyno-slot-card {
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-top: 3px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.15s, opacity 0.15s;
}

.dyno-slot-card.slot-color-0 { border-top-color: #38bdf8; }
.dyno-slot-card.slot-color-1 { border-top-color: #a78bfa; }
.dyno-slot-card.slot-color-2 { border-top-color: #34d399; }
.dyno-slot-card.slot-color-3 { border-top-color: #fb923c; }

.dyno-slot-card.unchecked {
  opacity: 0.55;
}

.dyno-slot-card.dyno-running {
  box-shadow: inset 0 0 12px rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.55);
}

.dyno-slot-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.dyno-slot-chk-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-weight: 700;
  font-size: 12px;
  user-select: none;
}

.dyno-slot-chk-label input[type="checkbox"] {
  accent-color: #10b981;
  width: 14px;
  height: 14px;
}

.dyno-slot-state {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text-1);
}

.dyno-slot-state.discharging {
  background: rgba(245, 158, 11, 0.2);
  border-color: rgba(245, 158, 11, 0.65);
  color: #fde68a;
}

.dyno-slot-state.done {
  background: rgba(16, 185, 129, 0.2);
  border-color: rgba(16, 185, 129, 0.6);
  color: #6ee7b7;
}

.dyno-slot-state.error {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.65);
  color: #fca5a5;
}

.dyno-slot-live {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11.5px;
  color: var(--text-0);
  background: var(--bg-1);
  border-radius: 4px;
  padding: 4px 6px;
}

.dyno-cell-name-input {
  width: 100%;
  background: var(--bg-1);
  border: 1px solid var(--border);
  color: var(--text-0);
  padding: 4px 7px;
  border-radius: 4px;
  font-size: 11.5px;
}

.dyno-launch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.dyno-slot-quick-group,
.dyno-run-btn-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.dyno-power-readout {
  font-size: 11px;
  color: var(--text-1);
  background: var(--bg-2);
  border: 1px solid var(--border);
  padding: 3px 8px;
  border-radius: 4px;
}

.dyno-power-readout.warn {
  color: #fde68a;
  border-color: rgba(245, 158, 11, 0.55);
  background: rgba(245, 158, 11, 0.12);
}

.dyno-run-btn {
  min-width: 165px;
  font-weight: 700;
}

.dyno-run-btn.confirm-armed {
  background: #d97706 !important;
  border-color: #f59e0b !important;
  color: #fff !important;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.45);
}

.dyno-progress-wrap {
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
}

.dyno-progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #fde68a;
}

.dyno-progress-track {
  width: 100%;
  height: 10px;
  background: var(--bg-2);
  border-radius: 999px;
  overflow: hidden;
}

.dyno-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #f59e0b 0%, #10b981 100%);
  transition: width 0.25s ease;
}

.dyno-warnings-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.dyno-warn-badge {
  font-size: 10.5px;
  font-family: var(--font-mono);
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(245, 158, 11, 0.16);
  border: 1px solid rgba(245, 158, 11, 0.45);
  color: #fde68a;
}

.dyno-warn-badge.danger {
  background: rgba(239, 68, 68, 0.16);
  border-color: rgba(239, 68, 68, 0.45);
  color: #fca5a5;
}

.dyno-warn-badge.info {
  background: rgba(56, 189, 248, 0.14);
  border-color: rgba(56, 189, 248, 0.4);
  color: #7dd3fc;
}

.dyno-svg-chart-container {
  width: 100%;
  min-height: 220px;
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px;
}

.dyno-svg-chart {
  width: 100%;
  height: 260px;
  display: block;
}

.dyno-svg-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 6px 4px 2px 4px;
  font-size: 11px;
  font-family: var(--font-mono);
}

.dyno-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text-0);
}

.dyno-legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  display: inline-block;
}

.dyno-empty-state,
.dyno-table-empty {
  color: var(--text-2);
  text-align: center;
  padding: 18px 10px;
  font-size: 12px;
}

.dyno-two-cell-delta-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 12px;
  font-family: var(--font-mono);
  color: #d1fae5;
}

.dyno-table-scroll {
  width: 100%;
  overflow-x: auto;
}

.dyno-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
  text-align: left;
}

.dyno-table th {
  background: var(--bg-2);
  color: var(--text-1);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 7px 8px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.dyno-table td {
  padding: 7px 8px;
  border-bottom: 1px solid rgba(42, 53, 75, 0.55);
  white-space: nowrap;
}

.dyno-table tbody tr:hover {
  background: rgba(59, 130, 246, 0.06);
}

.dyno-score-hero {
  font-weight: 700;
  color: #34d399;
  font-size: 12.5px;
}

.dyno-cell-tag {
  display: inline-block;
  font-size: 9.5px;
  padding: 1px 5px;
  border-radius: 3px;
  margin-left: 4px;
  font-family: var(--font-mono);
}

.dyno-cell-tag.trickle {
  background: rgba(56, 189, 248, 0.18);
  color: #7dd3fc;
}

.dyno-cell-tag.warn {
  background: rgba(245, 158, 11, 0.2);
  color: #fde68a;
}

.dyno-cell-tag.danger {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}

.dyno-filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.dyno-filter-pill {
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text-1);
  padding: 4px 10px;
  border-radius: 5px;
  font-size: 11px;
  font-family: var(--font-mono);
  cursor: pointer;
}

.dyno-filter-pill.active {
  background: rgba(56, 189, 248, 0.16);
  border-color: #38bdf8;
  color: #38bdf8;
  font-weight: 700;
}

.dyno-pair-recommender {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
}

.dyno-pair-rec-card {
  background: var(--bg-0);
  border: 1px solid rgba(16, 185, 129, 0.45);
  border-radius: 6px;
  padding: 9px 11px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dyno-pair-rec-card.rank-1 {
  border-color: rgba(250, 204, 21, 0.65);
  background: linear-gradient(180deg, rgba(250, 204, 21, 0.07) 0%, var(--bg-0) 100%);
}

.dyno-pair-rec-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
}

.dyno-pair-rec-meta {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-1);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.dyno-history-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 280px;
  overflow-y: auto;
}

.dyno-history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  cursor: pointer;
  transition: border-color 0.14s, background 0.14s;
}

.dyno-history-item:hover {
  border-color: var(--accent);
}

.dyno-history-item.active {
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.08);
}

.dyno-history-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dyno-history-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-0);
}

.dyno-history-sub {
  font-size: 11px;
  color: var(--text-2);
}

@media (max-width: 1100px) {
  .dyno-config-grid {
    grid-template-columns: 1fr 1fr;
  }
  .dyno-slots-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .dyno-config-grid,
  .dyno-slots-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================================================
   Mini4WDTournament.com Companion App Promotion UI (Non-Intrusive)
   ============================================================================ */

/* Top Nav Companion App Tabs Group */
.companion-tabs-group {
  margin-left: auto;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 100%;
}

.companion-suite-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #fde68a;
  background: rgba(245, 158, 11, 0.16);
  border: 1px solid rgba(245, 158, 11, 0.4);
  padding: 4px 8px;
  border-radius: 999px;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.companion-suite-badge:hover {
  background: rgba(245, 158, 11, 0.28);
  border-color: #fbbf24;
}

.tab-nav-ext-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 6px;
  text-decoration: none;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.14) 0%, rgba(56, 189, 248, 0.1) 100%);
  border: 1px solid rgba(245, 158, 11, 0.45);
  color: var(--text-0);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.tab-nav-ext-link .ext-arrow {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: #38bdf8;
}

.tab-nav-ext-link:hover {
  transform: translateY(-1px);
  border-color: #fbbf24;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.24) 0%, rgba(56, 189, 248, 0.18) 100%);
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.22);
  color: #fff;
}

/* Motor Dyno Contextual Callout */
.dyno-mini4wd-callout {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 7px 11px;
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.09) 0%, rgba(56, 189, 248, 0.08) 100%);
  border: 1px solid rgba(245, 158, 11, 0.35);
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--text-1);
}

.callout-badge {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #fde68a;
  background: rgba(245, 158, 11, 0.2);
  border: 1px solid rgba(245, 158, 11, 0.45);
  padding: 1px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}

.callout-text strong {
  color: var(--text-0);
}

.callout-inline-link {
  color: #bae6fd;
  text-decoration: none;
  border-bottom: 1px dotted rgba(56, 189, 248, 0.45);
}

.callout-inline-link:hover {
  color: #fff;
  border-bottom-color: #38bdf8;
}

.callout-link {
  font-family: var(--font-mono);
  font-weight: 700;
  color: #fbbf24;
  text-decoration: none;
  border-bottom: 1px solid rgba(251, 191, 36, 0.45);
  margin-left: auto;
  white-space: nowrap;
}

.callout-link:hover {
  color: #fde68a;
  border-bottom-color: #fbbf24;
}

/* Dedicated Ecosystem Spotlight Banner */
.mini4wd-promo-banner {
  background: linear-gradient(135deg, rgba(18, 23, 33, 0.96) 0%, rgba(25, 32, 46, 0.96) 60%, rgba(15, 28, 46, 0.96) 100%);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 8px;
  padding: 12px 14px;
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.mini4wd-promo-banner.is-compact {
  padding: 8px 12px;
  gap: 0;
}

.promo-banner-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.promo-brand-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
  min-width: 0;
}

.promo-eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #fde68a;
  background: rgba(245, 158, 11, 0.16);
  border: 1px solid rgba(245, 158, 11, 0.4);
  padding: 2px 7px;
  border-radius: 4px;
  white-space: nowrap;
}

.promo-heading {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-0);
  margin: 0;
}

.promo-heading-link {
  color: #38bdf8;
  font-weight: 700;
  text-decoration: none;
  border-bottom: 1px solid rgba(56, 189, 248, 0.4);
}

.promo-heading-link:hover {
  color: #7dd3fc;
  border-bottom-color: #38bdf8;
}

.promo-compact-inline-pills {
  display: none;
  font-family: var(--font-mono);
  font-size: 11px;
  color: #bae6fd;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.promo-compact-pill-link {
  color: #bae6fd;
  text-decoration: none;
  font-weight: 600;
}

.promo-compact-pill-link:hover {
  color: #fde68a;
  text-decoration: underline;
}

.mini4wd-promo-banner.is-compact .promo-compact-inline-pills {
  display: inline-flex;
}

.mini4wd-promo-banner.is-compact .promo-features-grid {
  display: none;
}

.promo-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.promo-cta-btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  font-weight: 700;
}

.promo-toggle-btn {
  color: var(--text-1);
}

.promo-features-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.promo-feature-card {
  display: flex;
  flex-direction: column;
  gap: 5px;
  text-decoration: none;
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
  min-width: 0;
}

.promo-feature-card:hover {
  border-color: #38bdf8;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(56, 189, 248, 0.14);
}

.promo-feature-card[data-promo-feature="motor_break_in"]:hover {
  border-color: #fbbf24;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.16);
}

.promo-feature-head {
  display: flex;
  align-items: center;
  gap: 6px;
}

.promo-feature-icon {
  font-size: 14px;
  line-height: 1;
}

.promo-feature-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-0);
}

.promo-feature-arrow {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  color: #38bdf8;
}

.promo-feature-desc {
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--text-1);
  margin: 0;
}

@media (max-width: 960px) {
  .companion-tabs-group {
    margin-left: 0;
    width: 100%;
  }
  .promo-features-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .tab-nav-ext-link {
    padding: 5px 8px;
    font-size: 11px;
  }
  .callout-link {
    margin-left: 0;
  }
  .promo-header-actions {
    width: 100%;
  }
  .promo-cta-btn {
    flex: 1;
    justify-content: center;
  }
}

/* Minimalist Monochrome UI Icon Alignment */
.ui-icon {
  display: inline-block;
  width: 14px;
  height: 14px;
  vertical-align: -0.15em;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tab-icon .ui-icon {
  width: 14px;
  height: 14px;
}

.btn .ui-icon,
.overlay-metric-pill .ui-icon,
.companion-tabs-group .ui-icon {
  margin-right: 5px;
}


