/* Componentes Especializados + Kody Mascot Widget */

/* Widget Flotante de Kody */
.kody-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

/* Ocultar Kody durante pantalla de bloqueo */
#auth-gate:not(.hidden) ~ .kody-widget,
#auth-gate:not(.hidden) ~ #kody-companion-container {
  display: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.kody-avatar-wrapper {
  position: relative;
  width: 90px;
  height: 90px;
  cursor: pointer;
  pointer-events: auto;
  transition: transform 0.2s ease;
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.6));
}

.kody-avatar-wrapper:hover {
  transform: scale(1.08) translateY(-4px);
}

.kody-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  animation: kodyFloat 3.5s ease-in-out infinite;
}

.kody-badge-indicator {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--color-kode-primary);
  color: #141414;
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #191919;
  box-shadow: 0 0 10px rgba(255, 172, 0, 0.6);
}

/* Bocadillo de Texto de Kody */
.kody-speech-bubble {
  position: relative;
  background: #1c1c1c;
  border: 1px solid var(--color-kode-primary);
  box-shadow: var(--shadow-md), 0 0 20px rgba(255, 172, 0, 0.2);
  border-radius: var(--radius-md);
  padding: 12px 36px 12px 16px;
  max-width: 320px;
  font-size: 0.84rem;
  color: #fff;
  margin-bottom: 12px;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: auto;
  transition: all 0.3s ease;
}

.kody-speech-bubble.show {
  opacity: 1;
  transform: translateY(0);
}

.kody-speech-bubble::after {
  content: '';
  position: absolute;
  bottom: -8px;
  right: 36px;
  border-width: 8px 8px 0 8px;
  border-style: solid;
  border-color: var(--color-kode-primary) transparent transparent transparent;
}

.kody-bubble-close {
  position: absolute;
  top: 8px;
  right: 8px;
  background: none;
  border: none;
  color: var(--color-kode-text-dim);
  cursor: pointer;
  font-size: 11px;
  padding: 2px 6px;
}
.kody-bubble-close:hover { color: #fff; }

/* Selector de Poses de Kody */
.kody-quick-controls {
  pointer-events: auto;
  margin-top: 6px;
}
.kody-pose-selector {
  display: flex;
  gap: 4px;
  background: rgba(25, 25, 25, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid var(--color-kode-border);
  border-radius: var(--radius-full);
  padding: 3px 6px;
  box-shadow: var(--shadow-sm);
}
.kody-pose-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  padding: 4px 6px;
  border-radius: var(--radius-full);
  transition: var(--transition-fast);
  opacity: 0.65;
}
.kody-pose-btn:hover { opacity: 1; transform: scale(1.15); }
.kody-pose-btn.active {
  background: rgba(255, 172, 0, 0.25);
  opacity: 1;
}

@keyframes kodyFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}
@keyframes kodyWiggle {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-8deg) scale(1.05); }
  75% { transform: rotate(8deg) scale(1.05); }
}
@keyframes kodyBounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}
.kody-wiggle { animation: kodyWiggle 0.5s ease; }
.kody-bounce { animation: kodyBounce 0.4s ease; }

/* Kody Mobile Adaptation */
@media (max-width: 768px) {
  .kody-widget {
    bottom: 16px;
    right: 16px;
  }
  .kody-avatar-wrapper {
    width: 56px;
    height: 56px;
  }
  .kody-badge-indicator {
    width: 18px;
    height: 18px;
    font-size: 10px;
    bottom: 0px;
    right: 0px;
  }
  .kody-speech-bubble {
    max-width: 260px;
    font-size: 0.8rem;
    padding: 10px 30px 10px 12px;
  }
}

/* Kody Sand Theme Overrides */
body[data-theme="sand"] .kody-speech-bubble {
  background: #ffffff;
  color: #1a1a1a;
  border-color: var(--color-kode-primary);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
}
body[data-theme="sand"] .kody-speech-bubble::after {
  border-color: var(--color-kode-primary) transparent transparent transparent;
}
body[data-theme="sand"] .kody-bubble-close {
  color: #71717a;
}
body[data-theme="sand"] .kody-bubble-close:hover {
  color: #09090b;
}
body[data-theme="sand"] .kody-pose-selector {
  background: rgba(255, 255, 255, 0.95);
  border-color: #c9c1b5;
}

/* Kody Minimized & Collapsed Modes */
.kody-widget.minimized .kody-speech-bubble,
.kody-widget.minimized .kody-quick-controls {
  display: none !important;
}
.kody-widget.minimized .kody-avatar-wrapper {
  width: 42px;
  height: 42px;
  opacity: 0.85;
}
.kody-widget.minimized .kody-badge-indicator {
  display: none;
}
.kody-widget.kody-hidden {
  display: none !important;
}
.kody-minimize-toggle {
  position: absolute;
  top: -4px;
  left: -4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #191919;
  border: 1px solid var(--color-kode-border);
  color: var(--color-kode-text-dim);
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: var(--transition-fast);
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}
.kody-minimize-toggle:hover {
  background: var(--color-kode-primary);
  color: #191919;
  border-color: var(--color-kode-primary);
}
body[data-theme="sand"] .kody-minimize-toggle {
  background: #ffffff;
  border-color: #c9c1b5;
  color: #554f47;
}

/* 1. Display Studio - Marco Realista del Kode Dot AMOLED 410x502 */
.kodedot-frame-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px;
  background: #161616;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-kode-border);
  max-width: 100%;
  overflow-x: auto;
}

body[data-theme="sand"] .kodedot-frame-wrapper {
  background: #ede6dc;
  border-color: #c9c1b5;
}

@media (max-width: 500px) {
  .kodedot-frame-wrapper {
    padding: 12px 6px;
    overflow: hidden;
  }
  .kodedot-device {
    transform: scale(0.72);
    transform-origin: top center;
    margin-bottom: -150px;
  }
}
@media (max-width: 380px) {
  .kodedot-device {
    transform: scale(0.60);
    margin-bottom: -210px;
  }
}

.kodedot-device {
  width: 444px;
  height: 546px;
  background: #1c1c1c;
  border-radius: 40px;
  padding: 16px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.9), inset 0 1px 2px rgba(255, 255, 255, 0.15), 0 0 25px rgba(255, 172, 0, 0.1);
  border: 3px solid #2e2e2e;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.kodedot-screen-bezel {
  width: 410px;
  height: 502px;
  background: #000;
  border-radius: 24px;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.9);
  border: 1px solid #111;
}

#amoled-canvas {
  width: 410px;
  height: 502px;
  display: block;
  image-rendering: pixelated;
}

.kodedot-notch-label {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.65rem;
  font-family: var(--font-mono);
  color: rgba(255, 255, 255, 0.4);
  letter-spacing: 2px;
}

/* 2. Pixel Art Canvas Editor */
.pixel-editor-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.pixel-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.pixel-grid-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  background: #101010;
  border: 1px solid var(--color-kode-border);
  border-radius: var(--radius-md);
  padding: 16px;
}
#pixel-canvas {
  background: #161616;
  cursor: crosshair;
  border: 1px solid #2a2a2a;
  image-rendering: -moz-crisp-edges;
  image-rendering: pixelated;
  touch-action: none;
}
.pixel-palette {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.palette-swatch {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: var(--transition-fast);
}
.palette-swatch.active {
  border-color: #fff;
  transform: scale(1.15);
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.4);
}

/* 3. 3D Canvas IMU Container */
.telemetry-3d-box {
  width: 100%;
  height: 380px;
  background: radial-gradient(circle at 50% 50%, #1f1f1f 0%, #0d0d0d 100%);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-kode-border);
  overflow: hidden;
  position: relative;
}
#threejs-canvas {
  width: 100%;
  height: 100%;
  display: block;
}
.telemetry-readouts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.readout-card {
  background: #1e1e1e;
  border: 1px solid var(--color-kode-border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  text-align: center;
}
.readout-val {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: bold;
  color: var(--color-kode-primary);
}
.readout-lbl {
  font-size: 0.72rem;
  color: var(--color-kode-text-dim);
  text-transform: uppercase;
}

/* 4. Mini Osciloscopio & ADC */
.scope-screen {
  background: #060b08;
  border: 1px solid #133a22;
  border-radius: var(--radius-md);
  padding: 10px;
  position: relative;
}
#scope-canvas {
  width: 100%;
  height: 200px;
  display: block;
}

/* 5. Chiptune Piano Keyboard */
.piano-keyboard {
  display: flex;
  position: relative;
  height: 130px;
  margin: 16px 0;
  user-select: none;
  border-radius: var(--radius-md);
  overflow-x: auto;
  overflow-y: hidden;
  box-shadow: var(--shadow-md);
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}
.piano-key {
  position: relative;
  cursor: pointer;
  transition: background 0.1s ease;
}
.piano-key.white {
  flex: 1 0 36px;
  max-width: 52px;
  height: 100%;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 0 0 5px 5px;
  z-index: 1;
}
.piano-key.white:active, .piano-key.white.pressed {
  background: var(--color-kode-primary);
  box-shadow: 0 0 15px rgba(255, 172, 0, 0.8);
}
.piano-key.black {
  width: 24px;
  height: 65%;
  background: #181818;
  border: 1px solid #333;
  margin-left: -12px;
  margin-right: -12px;
  z-index: 2;
  border-radius: 0 0 4px 4px;
}
.piano-key.black:active, .piano-key.black.pressed {
  background: var(--color-kode-accent);
  box-shadow: 0 0 15px rgba(2, 138, 194, 0.8);
}
.key-label {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.68rem;
  font-family: var(--font-mono);
  color: #64748b;
}

/* 6. Macro Pad / Stream Deck Grid */
.macropad-grid {
  display: grid;
  gap: 14px;
  padding: 16px;
  background: #141414;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-kode-border);
}
.macro-key {
  background: #222222;
  border: 1px solid var(--color-kode-border);
  border-radius: var(--radius-md);
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: var(--transition-fast);
}
.macro-key:hover {
  border-color: var(--color-kode-primary);
  transform: translateY(-2px);
  box-shadow: 0 0 15px rgba(255, 172, 0, 0.25);
}
.macro-key.key-pressed {
  transform: scale(0.95);
  box-shadow: 0 0 20px var(--color-kode-primary);
  border-color: #fff;
}
.macro-key.active-editing {
  border-color: #38bdf8 !important;
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.5) !important;
}
.macro-key-edit-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.15s, background 0.15s;
}
.macro-key-edit-btn:hover {
  opacity: 1;
  background: var(--color-kode-primary);
  color: #121212;
}
.macro-key-icon { font-size: 24px; }
.macro-key-title { font-size: 0.82rem; font-weight: 600; color: #fff; }
.macro-key-sub { font-size: 0.7rem; font-family: var(--font-mono); color: var(--color-kode-text-dim); }

.macro-color-chip {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
}
.macro-color-chip:hover {
  transform: scale(1.15);
  border-color: #fff;
}

/* Estilos Creador de Iconos & Launcher Mock para SD Packager */
.pkg-emoji-chip {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #1e1e1e;
  border: 1px solid var(--color-kode-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
}
.pkg-emoji-chip:hover {
  transform: scale(1.15);
  border-color: var(--color-kode-primary);
}
.pkg-color-chip {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,0.2);
  transition: transform 0.15s;
}
.pkg-color-chip:hover {
  transform: scale(1.15);
  border-color: #fff;
}
.pkg-launcher-mock {
  background: #000;
  border-radius: 20px;
  border: 2px solid #2a2a2a;
  padding: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.6);
  position: relative;
  overflow: hidden;
}

/* 7. I2C Scanner Grid */
.i2c-matrix {
  display: grid;
  grid-template-columns: repeat(16, 1fr);
  gap: 4px;
  padding: 12px;
  background: #101010;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-kode-border);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  overflow-x: auto;
  min-width: 0;
  -webkit-overflow-scrolling: touch;
}
.i2c-cell {
  aspect-ratio: 1;
  min-width: 18px;
  min-height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1c1c1c;
  border-radius: 4px;
  color: var(--color-kode-text-dim);
  cursor: pointer;
  transition: var(--transition-fast);
}
.i2c-cell:hover { background: #2a2a2a; color: #fff; }
.i2c-cell.detected {
  background: rgba(255, 172, 0, 0.2);
  color: var(--color-kode-primary);
  font-weight: bold;
  border: 1px solid var(--color-kode-primary);
  box-shadow: 0 0 10px rgba(255, 172, 0, 0.35);
}

/* 8. Code Output Boxes */
.code-preview-box {
  background: #0d0d0d;
  border: 1px solid var(--color-kode-border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  max-height: 240px;
  overflow-y: auto;
  overflow-x: auto;
  max-width: 100%;
  color: #93c5fd;
  white-space: pre;
}

/* 9. Flasher Cards */
.flash-file-card {
  background: #242424;
  border: 1px solid var(--color-kode-border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.flash-offset-input {
  background: #191919;
  border: 1px solid var(--color-kode-border);
  color: var(--color-kode-primary);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  width: 90px;
  text-align: center;
}
.flash-progress-bar {
  width: 100%;
  height: 12px;
  background: #191919;
  border-radius: var(--radius-full);
  overflow: hidden;
  margin: 14px 0;
  border: 1px solid var(--color-kode-border);
}
.flash-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--color-kode-primary), #10b981);
  box-shadow: 0 0 12px rgba(255, 172, 0, 0.5);
  transition: width 0.2s ease;
}

/* 10. Indicador de Red (Online / Offline) */
.net-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  font-family: var(--font-mono);
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
  transition: all 0.3s ease;
}
.net-status-badge.offline {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.4);
}
.net-status-badge .net-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
}
.net-status-badge.offline .net-dot {
  background: #ef4444;
}

/* 11. Banner de Compatibilidad de Hardware en Dashboard */
.dash-compat-banner {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin: 14px 0;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: border-color 0.2s;
}
.dash-compat-banner.full-compat {
  border-left: 4px solid #10b981;
}
.dash-compat-banner.partial-compat {
  border-left: 4px solid #f59e0b;
}
.dash-compat-icon {
  font-size: 1.4rem;
  line-height: 1;
}
.dash-compat-info {
  flex: 1;
}
.dash-compat-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-kode-text);
  margin-bottom: 2px;
}
.dash-compat-desc {
  font-size: 0.74rem;
  color: var(--color-kode-text-dim);
  font-family: var(--font-mono);
}
.badge-compat {
  display: inline-block;
  font-size: 0.68rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: bold;
  margin-left: 6px;
}
.badge-compat.ok {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
}
.badge-compat.warn {
  background: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
}

/* 12. Modal de Atajos de Teclado */
.shortcuts-table {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.shortcut-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
}
.shortcut-row kbd {
  background: #2a2a2a;
  color: var(--color-kode-primary);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.4);
  border-radius: 4px;
  padding: 2px 7px;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: bold;
}
.shortcut-desc {
  margin-left: auto;
  color: var(--color-kode-text-dim);
  font-size: 0.78rem;
}

/* ==========================================================================
   TEMA SAND — OVERRIDES PARA COMPONENTES ESPECIALIZADOS
   ========================================================================== */

/* 1. Bloques de Código y Salida */
body[data-theme="sand"] .code-preview-box {
  background: #fdfbf7;
  border-color: #c9c1b5;
  color: #0f172a;
}

/* 2. Tarjetas de Telemetría 3D y Métricas */
body[data-theme="sand"] .telemetry-3d-box {
  background: radial-gradient(circle at 50% 50%, #f7f2eb 0%, #ded7cd 100%);
  border-color: #c9c1b5;
}
body[data-theme="sand"] .readout-card {
  background: #f7f2eb;
  border-color: #c9c1b5;
}
body[data-theme="sand"] .readout-val {
  color: #b45309;
}
body[data-theme="sand"] .readout-lbl {
  color: #635e58;
}

/* 3. Osciloscopio y Pantalla ADC */
body[data-theme="sand"] .scope-screen {
  background: #f0f7f2;
  border-color: #86efac;
}

/* 4. Stream Deck / Macropad */
body[data-theme="sand"] .macropad-grid {
  background: #ebe4d8;
  border-color: #c9c1b5;
}
body[data-theme="sand"] .macro-key {
  background: #f7f2eb;
  border-color: #c9c1b5;
}
body[data-theme="sand"] .macro-key:hover {
  background: #ffffff;
  border-color: var(--color-kode-primary);
}
body[data-theme="sand"] .macro-key-title {
  color: #191919;
}
body[data-theme="sand"] .macro-key-sub {
  color: #635e58;
}

/* 5. Matriz de Escáner I2C */
body[data-theme="sand"] .i2c-matrix {
  background: #ebe4d8;
  border-color: #c9c1b5;
}
body[data-theme="sand"] .i2c-cell {
  background: #f7f2eb;
  color: #635e58;
}
body[data-theme="sand"] .i2c-cell:hover {
  background: #ffffff;
  color: #191919;
}
body[data-theme="sand"] .i2c-cell.detected {
  background: rgba(255, 172, 0, 0.25);
  color: #8c5b00;
  border-color: #d97706;
}

/* 6. Tarjetas de Flasheo Web */
body[data-theme="sand"] .flash-file-card {
  background: #f7f2eb;
  border-color: #c9c1b5;
}
body[data-theme="sand"] .flash-offset-input {
  background: #ffffff;
  border-color: #c9c1b5;
  color: #b45309;
}
body[data-theme="sand"] .flash-progress-bar {
  background: #ebe4d8;
  border-color: #c9c1b5;
}

/* 7. Banner de Compatibilidad y Atajos */
body[data-theme="sand"] .dash-compat-banner {
  background: rgba(0, 0, 0, 0.02);
  border-color: #c9c1b5;
}
body[data-theme="sand"] .dash-compat-title {
  color: #191919;
}
body[data-theme="sand"] .dash-compat-desc {
  color: #635e58;
}
body[data-theme="sand"] .shortcut-row {
  background: rgba(0, 0, 0, 0.03);
}
body[data-theme="sand"] .shortcut-row kbd {
  background: #f0ebe2;
  color: #8c5b00;
  border-color: #c9c1b5;
  box-shadow: 0 2px 0 #b3a99b;
}
body[data-theme="sand"] .shortcut-desc {
  color: #554f47;
}

/* 8. Pixel Art Editor Canvas */
body[data-theme="sand"] .pixel-grid-wrap {
  background: #ebe4d8;
  border-color: #c9c1b5;
}

/* ==========================================================================
   9. COMMAND PALETTE (CTRL+K / CMD+K)
   ========================================================================== */
.cmd-palette-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 70px 16px 32px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.18s ease, visibility 0.18s ease;
}

.cmd-palette-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.cmd-palette-window {
  background: var(--color-kode-sidebar-surface, #181818);
  border: 1px solid var(--color-kode-border, #333333);
  border-radius: 12px;
  width: 100%;
  max-width: 620px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 172, 0, 0.15);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: translateY(-10px) scale(0.98);
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.cmd-palette-backdrop.open .cmd-palette-window {
  transform: translateY(0) scale(1);
}

.cmd-palette-search-wrap {
  display: flex;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--color-kode-border, #2a2a2a);
  background: var(--color-kode-sidebar, #121212);
  gap: 12px;
}

.cmd-palette-search-icon {
  color: var(--color-kode-primary, #ffac00);
  flex-shrink: 0;
}

.cmd-palette-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 0.96rem;
  color: var(--color-kode-text, #ffffff);
  font-family: inherit;
}

.cmd-palette-input::placeholder {
  color: var(--color-kode-text-dim, #777);
  font-size: 0.88rem;
}

.cmd-palette-esc-hint {
  font-size: 0.68rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--color-kode-text-dim, #888);
  border: 1px solid var(--color-kode-border, #444);
}

.cmd-palette-results {
  max-height: 380px;
  overflow-y: auto;
  padding: 8px;
  scrollbar-width: thin;
}

.cmd-group-title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-kode-text-dim, #777);
  padding: 8px 10px 4px;
}

.cmd-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s ease;
  color: var(--color-kode-text, #ddd);
  text-decoration: none;
  user-select: none;
}

.cmd-item:hover,
.cmd-item.active {
  background: rgba(255, 172, 0, 0.12);
  color: var(--color-kode-text, #ffffff);
}

body[data-theme="sand"] .cmd-item:hover,
body[data-theme="sand"] .cmd-item.active {
  background: rgba(180, 83, 9, 0.12);
}

.cmd-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.cmd-item-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-kode-primary, #ffac00);
  flex-shrink: 0;
}

.cmd-item-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.cmd-item-title {
  font-size: 0.86rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cmd-item-desc {
  font-size: 0.72rem;
  color: var(--color-kode-text-dim, #888);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cmd-badge {
  font-size: 0.68rem;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--color-kode-border, #333);
  color: var(--color-kode-text-dim, #999);
  flex-shrink: 0;
}

.cmd-palette-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 16px;
  background: var(--color-kode-sidebar, #121212);
  border-top: 1px solid var(--color-kode-border, #2a2a2a);
  font-size: 0.72rem;
  color: var(--color-kode-text-dim, #888);
}

.cmd-palette-footer span {
  display: flex;
  align-items: center;
  gap: 4px;
}

body[data-theme="sand"] .cmd-palette-window {
  background: #fdfbf7;
  border-color: #d8d0c5;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(180, 83, 9, 0.15);
}

body[data-theme="sand"] .cmd-palette-search-wrap,
body[data-theme="sand"] .cmd-palette-footer {
  background: #f4efe6;
  border-color: #d8d0c5;
}

body[data-theme="sand"] .cmd-palette-input {
  color: #1a1714;
}

body[data-theme="sand"] .cmd-badge,
body[data-theme="sand"] .cmd-palette-esc-hint {
  background: #ebe4d8;
  border-color: #c9c1b5;
  color: #645b50;
}

/* ==========================================================================
   RESUMEN GENERAL: TOOL HUB LAUNCHER & DRILL-DOWN INTERACTIVO
   ========================================================================== */
.dash-quick-launcher {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--color-kode-border, #262626);
  border-radius: var(--radius-md, 8px);
  padding: 10px 14px;
  margin: 14px 0 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.dash-quick-launcher-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--color-kode-text-dim, #888);
  white-space: nowrap;
}

.dash-quick-chips {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1;
}

.dash-quick-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--color-kode-border, #333);
  color: var(--color-kode-text, #e5e7eb);
  font-size: 0.76rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s ease;
  user-select: none;
}

.dash-quick-chip:hover {
  background: rgba(0, 229, 255, 0.12);
  border-color: var(--color-kode-primary, #00f0ff);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 229, 255, 0.15);
}

.dash-quick-chip .chip-icon {
  font-size: 0.85rem;
}

/* Tarjetas y buses clickables con animación de salto */
.dash-card.clickable,
.dash-bus-item.clickable {
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.dash-card.clickable:hover {
  transform: translateY(-2px);
  border-color: rgba(0, 229, 255, 0.45);
  box-shadow: 0 6px 20px rgba(0, 229, 255, 0.08);
}

.dash-bus-item.clickable:hover {
  border-color: rgba(0, 229, 255, 0.4);
  background: rgba(0, 229, 255, 0.03);
}

.dash-card-drill-arrow {
  font-size: 0.82rem;
  color: var(--color-kode-text-dim, #666);
  transition: transform 0.2s ease, color 0.2s ease;
  font-weight: bold;
}

.dash-card.clickable:hover .dash-card-drill-arrow,
.dash-bus-item.clickable:hover .dash-card-drill-arrow {
  transform: translateX(3px);
  color: var(--color-kode-primary, #00f0ff);
}

.dash-mini-action-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--color-kode-border, #333);
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 2px 6px;
  transition: all 0.2s ease;
}

.dash-mini-action-btn:hover {
  background: rgba(236, 72, 153, 0.2);
  border-color: #ec4899;
  transform: scale(1.08);
}

/* AMOLED Mini Screen Multimodo */
.mini-screen-mode-view {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.mini-screen-imu-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
}

.mini-compass-ring {
  width: 38px;
  height: 38px;
  border: 1.5px solid rgba(16, 185, 129, 0.4);
  border-radius: 50%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mini-compass-needle {
  width: 2px;
  height: 28px;
  background: linear-gradient(to bottom, #ef4444 50%, #10b981 50%);
  border-radius: 1px;
  transition: transform 0.1s linear;
}

.mini-screen-logo-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 4px;
}

.mini-screen-logo-text {
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 2px;
  color: #00f0ff;
  text-shadow: 0 0 8px rgba(0, 240, 255, 0.6);
}

.mini-eq-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 12px;
}

.mini-eq-bars .eq-b {
  width: 3px;
  background: #00f0ff;
  border-radius: 1px;
  animation: eqPulse 1s infinite ease-in-out alternate;
}
.mini-eq-bars .eq-b:nth-child(1) { height: 6px; animation-delay: 0.1s; }
.mini-eq-bars .eq-b:nth-child(2) { height: 11px; animation-delay: 0.3s; }
.mini-eq-bars .eq-b:nth-child(3) { height: 8px; animation-delay: 0.2s; }
.mini-eq-bars .eq-b:nth-child(4) { height: 12px; animation-delay: 0.4s; }
.mini-eq-bars .eq-b:nth-child(5) { height: 5px; animation-delay: 0.15s; }

@keyframes eqPulse {
  0% { transform: scaleY(0.3); }
  100% { transform: scaleY(1); }
}

/* ==========================================================================
   MODAL: AUTO-DIAGNÓSTICO (SELF-TEST)
   ========================================================================== */
.self-test-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.self-test-window {
  width: 100%;
  max-width: 520px;
  background: #141414;
  border: 1px solid var(--color-kode-border, #333);
  border-radius: var(--radius-lg, 12px);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(0, 229, 255, 0.2);
  overflow: hidden;
  animation: modalScaleIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.self-test-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: #1a1a1a;
  border-bottom: 1px solid var(--color-kode-border, #2a2a2a);
}

.self-test-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-kode-primary, #00f0ff);
  box-shadow: 0 0 8px var(--color-kode-primary, #00f0ff);
  animation: pulseDot 1.4s infinite;
}

.self-test-body {
  padding: 20px;
}

.self-test-progress-strip {
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 12px;
}

.self-test-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-kode-primary, #00f0ff), #10b981);
  transition: width 0.35s ease;
}

.self-test-status-text {
  font-size: 0.78rem;
  color: var(--color-kode-text-dim, #888);
  margin-bottom: 16px;
  font-family: var(--font-mono, monospace);
}

.self-test-steps-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.self-test-step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--color-kode-border, #282828);
  border-radius: 8px;
  transition: all 0.2s ease;
}

.self-test-step.running {
  border-color: var(--color-kode-primary, #00f0ff);
  background: rgba(0, 229, 255, 0.04);
}

.self-test-step.passed {
  border-color: rgba(16, 185, 129, 0.4);
  background: rgba(16, 185, 129, 0.03);
}

.self-test-step.failed {
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.03);
}

.st-step-icon {
  font-size: 1.2rem;
  width: 28px;
  text-align: center;
  flex-shrink: 0;
}

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

.st-step-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 2px;
}

.st-step-desc {
  font-size: 0.7rem;
  color: var(--color-kode-text-dim, #888);
  line-height: 1.3;
}

.st-step-result.ok {
  color: #10b981 !important;
}

.st-step-result.err {
  color: #ef4444 !important;
}

.st-step-result.testing {
  color: var(--color-kode-primary, #00f0ff) !important;
}

.self-test-summary {
  margin-top: 16px;
  padding: 14px;
  background: rgba(16, 185, 129, 0.06);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 8px;
  animation: fadeIn 0.3s ease;
}

.self-test-score-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
}

.self-test-score-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid #10b981;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.82rem;
  color: #10b981;
  flex-shrink: 0;
}

.self-test-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  background: #1a1a1a;
  border-top: 1px solid var(--color-kode-border, #2a2a2a);
}

/* ==========================================================================
   SAND THEME ADAPTATIONS: DASHBOARD V2 & SELF-TEST
   ========================================================================== */
body[data-theme="sand"] .dash-quick-launcher {
  background: #f4efe6;
  border-color: #d8d0c5;
}

body[data-theme="sand"] .dash-quick-chip {
  background: #ede6dc;
  border-color: #c9c1b5;
  color: #2b2621;
}

body[data-theme="sand"] .dash-quick-chip:hover {
  background: rgba(217, 119, 6, 0.15);
  border-color: #d97706;
  color: #b45309;
}

body[data-theme="sand"] .self-test-window {
  background: #fdfbf7;
  border-color: #d8d0c5;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(217, 119, 6, 0.2);
}

body[data-theme="sand"] .self-test-header,
body[data-theme="sand"] .self-test-footer {
  background: #f4efe6;
  border-color: #d8d0c5;
}

body[data-theme="sand"] .self-test-header h3,
body[data-theme="sand"] .st-step-title {
  color: #1a1714;
}

body[data-theme="sand"] .self-test-step {
  background: #ede6dc;
  border-color: #c9c1b5;
}

body[data-theme="sand"] .dash-card.clickable:hover {
  border-color: rgba(217, 119, 6, 0.4);
  box-shadow: 0 6px 20px rgba(217, 119, 6, 0.1);
}

body[data-theme="sand"] .dash-bus-item.clickable:hover {
  background: rgba(217, 119, 6, 0.05);
  border-color: rgba(217, 119, 6, 0.35);
}

/* ==========================================================================
   DASHBOARD V2 COMPONENTS
   ========================================================================== */

/* 1. Selector de Perfiles de Energía PMIC */
.dash-power-profile-wrap {
  margin: 8px 0 4px 0;
  width: 100%;
}

.dash-power-select {
  width: 100%;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--color-kode-border, #333);
  border-radius: 6px;
  color: #10b981;
  font-size: 0.72rem;
  font-family: var(--font-mono, monospace);
  padding: 4px 8px;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
}

.dash-power-select:focus,
.dash-power-select:hover {
  border-color: #10b981;
}

/* 2. Modo Táctil CST820 en AMOLED */
.mini-touch-surface {
  position: relative;
  width: 100%;
  height: 64px;
  background: radial-gradient(circle at center, rgba(245, 158, 11, 0.12) 0%, rgba(0, 0, 0, 0.8) 75%);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 6px;
  margin: 4px 0;
  overflow: hidden;
  cursor: crosshair;
  user-select: none;
}

.mini-touch-grid-bg {
  position: absolute;
  inset: 0;
  background-image: 
    linear-gradient(to right, rgba(255,255,255,0.04) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 10px 10px;
  pointer-events: none;
}

.mini-touch-crosshair {
  position: absolute;
  width: 12px;
  height: 12px;
  border: 1.5px solid #f59e0b;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.8);
  pointer-events: none;
  transition: transform 0.05s ease-out;
  left: 50%;
  top: 50%;
}

.mini-touch-crosshair::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 4px;
  height: 4px;
  background: #fff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

/* 3. LEDs de Tráfico en Buses Hardware */
.bus-traffic-led {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #333;
  box-shadow: none;
  transition: all 0.1s ease;
  flex-shrink: 0;
}

.bus-traffic-led.active {
  background: #00f0ff;
  box-shadow: 0 0 8px #00f0ff, 0 0 14px rgba(0, 240, 255, 0.6);
  transform: scale(1.3);
}

.bus-traffic-led.active-amber {
  background: #ffb703;
  box-shadow: 0 0 8px #ffb703, 0 0 14px rgba(255, 183, 3, 0.6);
  transform: scale(1.3);
}

.bus-traffic-led.active-green {
  background: #10b981;
  box-shadow: 0 0 8px #10b981, 0 0 14px rgba(16, 185, 129, 0.6);
  transform: scale(1.3);
}

/* 4. Mini-Mapa Inspector de Pines GPIO */
.dash-gpio-minimap {
  margin: 12px 0;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--color-kode-border, #262626);
  border-radius: 8px;
}

.dash-gpio-minimap-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.dash-gpio-chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.gpio-pin-chip {
  background: #1e1e1e;
  border: 1px solid var(--color-kode-border, #333);
  border-radius: 4px;
  padding: 3px 7px;
  font-family: var(--font-mono, monospace);
  font-size: 0.7rem;
  color: #e2e8f0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.18s ease;
}

.gpio-pin-chip small {
  color: var(--color-kode-primary, #00f0ff);
  font-weight: 700;
  font-size: 0.65rem;
}

.gpio-pin-chip:hover {
  border-color: var(--color-kode-primary, #00f0ff);
  background: rgba(0, 240, 255, 0.1);
  color: #fff;
  transform: translateY(-1px);
}

.gpio-pin-chip:active {
  transform: scale(0.96);
}

/* 5. Consola Rápida de Comandos Serie */
.dash-quick-cmd-box {
  margin-bottom: 12px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--color-kode-border, #282828);
  border-radius: 8px;
}

.dash-quick-cmd-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #111;
  border: 1px solid var(--color-kode-border, #333);
  border-radius: 6px;
  padding: 3px 8px;
}

.dash-quick-cmd-input-wrap:focus-within {
  border-color: var(--color-kode-primary, #00f0ff);
  box-shadow: 0 0 0 1px rgba(0, 240, 255, 0.3);
}

.cmd-prompt-symbol {
  font-family: var(--font-mono, monospace);
  font-weight: 800;
  color: var(--color-kode-primary, #00f0ff);
  font-size: 0.85rem;
  user-select: none;
}

.dash-cmd-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--font-mono, monospace);
  font-size: 0.78rem;
  color: #fff;
  min-width: 0;
}

.dash-cmd-send-btn {
  background: var(--color-kode-primary, #00f0ff);
  color: #000;
  font-weight: 700;
  font-size: 0.7rem;
  border: none;
  border-radius: 4px;
  padding: 4px 10px;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.dash-cmd-send-btn:hover {
  opacity: 0.88;
}

.dash-quick-cmd-tags {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}

.cmd-tag-chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  padding: 2px 6px;
  font-family: var(--font-mono, monospace);
  font-size: 0.68rem;
  color: var(--color-kode-text-dim, #888);
  cursor: pointer;
  transition: all 0.15s ease;
}

.cmd-tag-chip:hover {
  background: rgba(0, 240, 255, 0.12);
  border-color: var(--color-kode-primary, #00f0ff);
  color: var(--color-kode-primary, #00f0ff);
}

/* 6. Contador numérico en botones de filtro */
.filter-count {
  font-size: 0.65rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 1px 4px;
  margin-left: 3px;
}

.dash-log-filter-btn.active .filter-count {
  background: rgba(0, 0, 0, 0.3);
  color: #fff;
}

/* ==========================================================================
   SAND THEME ADAPTATIONS: DASHBOARD V2
   ========================================================================== */
body[data-theme="sand"] .dash-power-select {
  background: #ede6dc;
  border-color: #c9c1b5;
  color: #047857;
}

body[data-theme="sand"] .dash-gpio-minimap {
  background: #f4efe6;
  border-color: #d8d0c5;
}

body[data-theme="sand"] .gpio-pin-chip {
  background: #ede6dc;
  border-color: #c9c1b5;
  color: #2b2621;
}

body[data-theme="sand"] .gpio-pin-chip small {
  color: #d97706;
}

body[data-theme="sand"] .gpio-pin-chip:hover {
  border-color: #d97706;
  background: rgba(217, 119, 6, 0.12);
  color: #b45309;
}

body[data-theme="sand"] .dash-quick-cmd-box {
  background: #f4efe6;
  border-color: #d8d0c5;
}

body[data-theme="sand"] .dash-quick-cmd-input-wrap {
  background: #fff;
  border-color: #c9c1b5;
}

body[data-theme="sand"] .cmd-prompt-symbol {
  color: #d97706;
}

body[data-theme="sand"] .dash-cmd-input {
  color: #1a1714;
}

body[data-theme="sand"] .dash-cmd-send-btn {
  background: #d97706;
  color: #fff;
}

body[data-theme="sand"] .cmd-tag-chip {
  background: #ede6dc;
  border-color: #c9c1b5;
  color: #574e44;
}

body[data-theme="sand"] .cmd-tag-chip:hover {
  border-color: #d97706;
  background: rgba(217, 119, 6, 0.15);
  color: #b45309;
}

/* ==========================================================================
   FAVORITES BAR & QUICK STAR TOGGLE
   ========================================================================== */
.sidebar-favorites-container {
  padding: 8px 12px;
  border-bottom: 1px solid var(--color-kode-border);
  background: rgba(255, 255, 255, 0.02);
}
.sidebar-fav-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.sidebar-fav-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #ffac00;
}
.sidebar-fav-count {
  background: rgba(255, 172, 0, 0.15);
  color: #ffac00;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 10px;
}
.sidebar-fav-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.fav-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  font-size: 0.72rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--color-kode-text-dim);
  border: 1px solid var(--color-kode-border);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.fav-pill:hover {
  background: rgba(255, 172, 0, 0.15);
  color: #fff;
  border-color: rgba(255, 172, 0, 0.4);
  transform: translateY(-1px);
}
.fav-pill.active {
  background: rgba(255, 172, 0, 0.22);
  color: #ffac00;
  border-color: #ffac00;
  font-weight: 600;
}
.icon-btn-fav {
  border: none;
  background: transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  color: var(--color-kode-text-dim);
  transition: all 0.2s ease;
}
.icon-btn-fav:hover {
  color: #ffac00;
  background: rgba(255, 172, 0, 0.1);
}
.icon-btn-fav.active {
  color: #ffac00;
}

/* ==========================================================================
   NOTIFICATIONS DRAWER & BADGE
   ========================================================================== */
.notif-btn-wrap {
  position: relative;
}
.notif-badge-pill {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 15px;
  height: 15px;
  padding: 0 4px;
  border-radius: 10px;
  background: #ef4444;
  color: #fff;
  font-size: 0.6rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  pointer-events: none;
  border: 2px solid #000;
  animation: pulseBadge 1.8s infinite;
}
@keyframes pulseBadge {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}
.notifications-drawer {
  position: fixed;
  top: 54px;
  right: 16px;
  width: 360px;
  max-width: calc(100vw - 32px);
  max-height: 480px;
  background: rgba(18, 18, 20, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--color-kode-border);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  z-index: 9999;
  transform: translateY(-8px) scale(0.96);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.notifications-drawer.open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}
.notif-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-kode-border);
}
.notif-drawer-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--color-kode-text-bright, #fff);
}
.btn-notif-clear {
  background: transparent;
  border: 1px solid var(--color-kode-border);
  color: var(--color-kode-text-dim);
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-notif-clear:hover {
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.1);
}
.notifications-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 400px;
}
.notif-empty-state {
  padding: 36px 16px;
  text-align: center;
}
.notif-item {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border-left: 3px solid #3b82f6;
  transition: background 0.15s ease;
}
.notif-item:hover {
  background: rgba(255, 255, 255, 0.06);
}
.notif-item.notif-info { border-left-color: #3b82f6; }
.notif-item.notif-success { border-left-color: #10b981; }
.notif-item.notif-warning { border-left-color: #f59e0b; }
.notif-item.notif-danger { border-left-color: #ef4444; }
.notif-icon {
  font-size: 1rem;
  flex-shrink: 0;
  line-height: 1.2;
}
.notif-content {
  flex: 1;
  min-width: 0;
}
.notif-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 2px;
}
.notif-title {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--color-kode-text-bright, #fff);
}
.notif-time {
  font-size: 0.65rem;
  color: var(--color-kode-text-dim);
  font-family: var(--font-mono);
}
.notif-message {
  font-size: 0.74rem;
  color: var(--color-kode-text-dim);
  line-height: 1.35;
  word-break: break-word;
}

/* ==========================================================================
   TERMINAL PANIC BANNER
   ========================================================================== */
.term-panic-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  margin-bottom: 12px;
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.18) 0%, rgba(220, 38, 38, 0.06) 100%);
  border: 1px solid rgba(239, 68, 68, 0.45);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.18);
  animation: panicPulse 2.2s infinite ease-in-out;
}
@keyframes panicPulse {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.3); }
  50% { box-shadow: 0 0 0 4px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}
.panic-banner-content {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
  color: #fca5a5;
}
.panic-icon {
  font-size: 1.2rem;
  line-height: 1;
}
.panic-banner-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn-panic-action {
  background: #dc2626;
  color: #fff;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
  white-space: nowrap;
}
.btn-panic-action:hover {
  background: #b91c1c;
  transform: translateY(-1px);
}
.btn-panic-close {
  background: transparent;
  border: none;
  color: #fca5a5;
  font-size: 0.9rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}
.btn-panic-close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

/* ==========================================================================
   STUDIO INTERACTIVE TOUR (SPOTLIGHT & POPOVER)
   ========================================================================== */
.tour-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 100000;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  pointer-events: auto;
}
.tour-target-spotlight {
  position: relative !important;
  z-index: 100002 !important;
  box-shadow: 0 0 0 4px #ffac00, 0 0 24px rgba(255, 172, 0, 0.55) !important;
  border-radius: 8px !important;
  transition: box-shadow 0.25s ease;
}
.tour-popover {
  position: fixed;
  z-index: 100003;
  width: 350px;
  max-width: calc(100vw - 32px);
  background: #161618;
  border: 1px solid #ffac00;
  border-radius: 12px;
  padding: 18px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.8), 0 0 15px rgba(255, 172, 0, 0.2);
  animation: popoverIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes popoverIn {
  from { opacity: 0; transform: scale(0.94); }
  to { opacity: 1; transform: scale(1); }
}
.tour-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.tour-badge {
  background: rgba(255, 172, 0, 0.18);
  color: #ffac00;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 12px;
  border: 1px solid rgba(255, 172, 0, 0.3);
}
.tour-title {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
  color: #fff;
}
.tour-body {
  font-size: 0.8rem;
  line-height: 1.5;
  color: #d1d5db;
  margin-bottom: 16px;
}
.tour-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.tour-btn {
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.tour-btn-skip {
  background: transparent;
  color: #9ca3af;
}
.tour-btn-skip:hover {
  color: #fff;
}
.tour-btn-prev {
  background: rgba(255, 255, 255, 0.1);
  color: #e5e7eb;
}
.tour-btn-prev:hover {
  background: rgba(255, 255, 255, 0.2);
}
.tour-btn-next {
  background: #ffac00;
  color: #000;
  font-weight: 700;
}
.tour-btn-next:hover {
  background: #e09700;
}

/* ==========================================================================
   SAND THEME ADAPTATIONS: FAVORITES, NOTIFICATIONS & TOUR
   ========================================================================== */
body[data-theme="sand"] .sidebar-favorites-container {
  background: rgba(0, 0, 0, 0.02);
  border-color: #d8d0c5;
}
body[data-theme="sand"] .sidebar-fav-label {
  color: #d97706;
}
body[data-theme="sand"] .sidebar-fav-count {
  background: rgba(217, 119, 6, 0.15);
  color: #b45309;
}
body[data-theme="sand"] .fav-pill {
  background: #ede6dc;
  color: #443c34;
  border-color: #c9c1b5;
}
body[data-theme="sand"] .fav-pill:hover {
  background: rgba(217, 119, 6, 0.15);
  color: #92400e;
  border-color: #d97706;
}
body[data-theme="sand"] .fav-pill.active {
  background: rgba(217, 119, 6, 0.22);
  color: #b45309;
  border-color: #b45309;
}
body[data-theme="sand"] .icon-btn-fav:hover,
body[data-theme="sand"] .icon-btn-fav.active {
  color: #d97706;
}
body[data-theme="sand"] .notifications-drawer {
  background: #fdfbf7;
  border-color: #d8d0c5;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
}
body[data-theme="sand"] .notif-drawer-header {
  border-color: #e5dfd5;
}
body[data-theme="sand"] .notif-drawer-title {
  color: #2b2621;
}
body[data-theme="sand"] .btn-notif-clear {
  border-color: #d8d0c5;
  color: #574e44;
}
body[data-theme="sand"] .btn-notif-clear:hover {
  color: #dc2626;
  border-color: #fca5a5;
  background: #fee2e2;
}
body[data-theme="sand"] .notif-item {
  background: #f5eedb;
  border-color: #d8d0c5;
}
body[data-theme="sand"] .notif-item:hover {
  background: #ece3cf;
}
body[data-theme="sand"] .notif-title {
  color: #1a1714;
}
body[data-theme="sand"] .notif-message {
  color: #574e44;
}
body[data-theme="sand"] .notif-time {
  color: #78716c;
}
body[data-theme="sand"] .tour-popover {
  background: #fdfbf7;
  border-color: #d97706;
  color: #1a1714;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22);
}
body[data-theme="sand"] .tour-title {
  color: #1a1714;
}
body[data-theme="sand"] .tour-body {
  color: #443c34;
}
body[data-theme="sand"] .tour-btn-prev {
  background: #ede6dc;
  color: #2b2621;
}
body[data-theme="sand"] .tour-btn-prev:hover {
  background: #d8d0c5;
}
body[data-theme="sand"] .tour-btn-next {
  background: #d97706;
  color: #fff;
}
body[data-theme="sand"] .tour-btn-next:hover {
  background: #b45309;
}
body[data-theme="sand"] .term-panic-banner {
  background: linear-gradient(90deg, #fee2e2 0%, #fef2f2 100%);
  border-color: #fca5a5;
}
body[data-theme="sand"] .panic-banner-content {
  color: #991b1b;
}
body[data-theme="sand"] .btn-panic-close {
  color: #991b1b;
}






