/**
 * Fijate Tools - Diagnóstico de saltos en cuadro eléctrico
 * Estilos canónicos, cuadro eléctrico virtual en carril DIN, controles táctiles y modo oscuro.
 */

:root {
  --font-main: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-heading: 'Outfit', 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --font-sans: var(--font-main);
  --font-title: var(--font-heading);

  /* Paleta cromática tema claro */
  --cuadro-bg: #f8fafc;
  --cuadro-surface: #ffffff;
  --cuadro-card: #ffffff;
  --cuadro-card-border: #e2e8f0;
  --cuadro-card-hover: #f1f5f9;
  --cuadro-text: #0f172a;
  --cuadro-text-muted: #64748b;
  --cuadro-primary: #0284c7;
  --cuadro-primary-hover: #0369a1;
  --cuadro-primary-light: #e0f2fe;

  /* Semáforos de estado y seguridad */
  --color-safe: #16a34a;
  --color-safe-bg: #dcfce7;
  --color-warning: #d97706;
  --color-warning-bg: #fef3c7;
  --color-danger: #dc2626;
  --color-danger-bg: #fee2e2;

  /* Componentes del cuadro eléctrico técnico */
  --breaker-din-rail: #94a3b8;
  --breaker-din-bg: #cbd5e1;
  --breaker-body-bg: #f1f5f9;
  --breaker-body-border: #cbd5e1;
  --breaker-lever-bg: #1e293b;
  --breaker-lever-active: #dc2626;
  --breaker-indicator-on: #ef4444;
  --breaker-indicator-off: #22c55e;
  --breaker-test-btn: #eab308;
  --breaker-test-hover: #ca8a04;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.08);
}

/* Modo oscuro canónico */
[data-theme="dark"] {
  --cuadro-bg: #0b0f17;
  --cuadro-surface: #131b2a;
  --cuadro-card: #151d2c;
  --cuadro-card-border: #243247;
  --cuadro-card-hover: #1c273b;
  --cuadro-text: #f1f5f9;
  --cuadro-text-muted: #94a3b8;
  --cuadro-primary: #38bdf8;
  --cuadro-primary-hover: #0ea5e9;
  --cuadro-primary-light: rgba(56, 189, 248, 0.15);

  --color-safe: #4ade80;
  --color-safe-bg: rgba(34, 197, 94, 0.16);
  --color-warning: #fbbf24;
  --color-warning-bg: rgba(245, 158, 11, 0.16);
  --color-danger: #f87171;
  --color-danger-bg: rgba(239, 68, 68, 0.16);

  --breaker-din-rail: #334155;
  --breaker-din-bg: #0f172a;
  --breaker-body-bg: #1e293b;
  --breaker-body-border: #334155;
  --breaker-lever-bg: #0f172a;
}

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-main);
  background-color: var(--cuadro-bg);
  color: var(--cuadro-text);
  line-height: 1.5;
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  letter-spacing: -0.02em;
  margin-top: 0;
}

button, input, select, textarea {
  font-family: inherit;
}

/* -------------------------------------------------------------
   BARRA DE ACCESO RÁPIDO Y LINTERNA DE EMERGENCIA
   ------------------------------------------------------------- */
.emergency-top-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  background: var(--cuadro-surface);
  border: 1px solid var(--cuadro-card-border);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.emergency-bar-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.emergency-live-indicator {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--cuadro-text-muted);
}

.pulse-led {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--color-safe);
  box-shadow: 0 0 8px var(--color-safe);
  animation: pulseLed 2s infinite ease-in-out;
}

@keyframes pulseLed {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.btn-emergency-torch {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background-color: #f59e0b;
  color: #000000;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.55rem 1rem;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  min-height: 40px;
  transition: all 0.15s ease;
  box-shadow: 0 2px 6px rgba(245, 158, 11, 0.35);
}

.btn-emergency-torch:hover {
  background-color: #d97706;
  transform: translateY(-1px);
}

.btn-emergency-torch:active {
  transform: translateY(0);
}

.btn-safety-guide {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: transparent;
  color: var(--cuadro-text-muted);
  border: 1px solid var(--cuadro-card-border);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.85rem;
  font-size: 0.85rem;
  cursor: pointer;
  min-height: 40px;
  transition: all 0.15s ease;
}

.btn-safety-guide:hover {
  color: var(--cuadro-text);
  border-color: var(--cuadro-text-muted);
}

/* -------------------------------------------------------------
   CAPA DE LINTERNA DE PANTALLA COMPLETA
   ------------------------------------------------------------- */
.screen-torch-overlay {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background-color: #ffffff !important;
  z-index: 999999;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  padding: 2rem;
  text-align: center;
  box-sizing: border-box;
}

.torch-dialog-box {
  background: rgba(0, 0, 0, 0.06);
  border: 2px dashed rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-lg);
  padding: 1.5rem 2rem;
  max-width: 440px;
  color: #111111;
}

.torch-icon-big {
  color: #d97706;
  margin-bottom: 0.75rem;
}

.torch-title {
  font-size: 1.35rem;
  font-weight: 800;
  margin: 0 0 0.5rem;
}

.torch-desc {
  font-size: 0.95rem;
  color: #333333;
  margin: 0 0 1.25rem;
}

.btn-close-torch {
  background: #111111;
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.65rem 1.4rem;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  min-height: 44px;
}

/* -------------------------------------------------------------
   PESTAÑAS DE NAVEGACIÓN
   ------------------------------------------------------------- */
.tool-tabs-wrapper {
  margin-bottom: 1.5rem;
}

.tool-tab-nav {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid var(--cuadro-card-border);
  padding-bottom: 0.5rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tab-navigation-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: transparent;
  color: var(--cuadro-text-muted);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0.65rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  min-height: 42px;
  transition: all 0.15s ease;
}

.tab-navigation-btn:hover {
  color: var(--cuadro-text);
  background: var(--cuadro-card-hover);
}

.tab-navigation-btn.active {
  color: var(--cuadro-primary);
  background: var(--cuadro-primary-light);
  border-color: rgba(2, 132, 199, 0.25);
  font-weight: 700;
}

.tab-badge {
  font-size: 0.75rem;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
  font-family: var(--font-mono);
}

.tool-tab-panel {
  display: none;
}

.tool-tab-panel.active {
  display: block;
  animation: fadeInPanel 0.2s ease-out;
}

@keyframes fadeInPanel {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* -------------------------------------------------------------
   ASISTENTE INTERACTIVO PASO A PASO
   ------------------------------------------------------------- */
.assistant-container-card {
  background: var(--cuadro-surface);
  border: 1px solid var(--cuadro-card-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 2rem;
}

.assistant-progress-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.step-progress-item {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--cuadro-card-hover);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--cuadro-text-muted);
  transition: all 0.2s ease;
}

.step-progress-item.active {
  background: var(--cuadro-primary-light);
  color: var(--cuadro-primary);
  font-weight: 700;
}

.step-progress-item.completed {
  background: var(--color-safe-bg);
  color: var(--color-safe);
}

.step-number {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: currentColor;
  color: var(--cuadro-surface);
  font-size: 0.75rem;
  font-family: var(--font-mono);
}

.assistant-step-view {
  display: none;
}

.assistant-step-view.active {
  display: block;
}

.step-headline {
  font-size: 1.35rem;
  font-weight: 800;
  margin-bottom: 0.4rem;
}

.step-lead {
  font-size: 0.95rem;
  color: var(--cuadro-text-muted);
  margin-bottom: 1.5rem;
}

/* Opciones de respuesta */
.binary-choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.btn-choice-action {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
  background: var(--cuadro-card);
  border: 2px solid var(--cuadro-card-border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  text-align: left;
  cursor: pointer;
  min-height: 84px;
  transition: all 0.15s ease;
}

.btn-choice-action:hover {
  border-color: var(--cuadro-primary);
  background: var(--cuadro-card-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.choice-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--cuadro-text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.choice-desc {
  font-size: 0.85rem;
  color: var(--cuadro-text-muted);
}

/* Cuadrícula de síntomas del cuadro */
.symptom-choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.symptom-choice-card {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  background: var(--cuadro-card);
  border: 1px solid var(--cuadro-card-border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}

.symptom-choice-card:hover {
  border-color: var(--cuadro-primary);
  background: var(--cuadro-card-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.symptom-tag {
  display: inline-block;
  align-self: flex-start;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-family: var(--font-mono);
}

.tag-differential { background: var(--color-danger-bg); color: var(--color-danger); }
.tag-pia { background: var(--color-warning-bg); color: var(--color-warning); }
.tag-icp { background: var(--cuadro-primary-light); color: var(--cuadro-primary); }
.tag-iga { background: rgba(147, 51, 234, 0.12); color: #9333ea; }
.tag-custom { background: var(--cuadro-card-hover); color: var(--cuadro-text-muted); }

.symptom-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0;
  color: var(--cuadro-text);
}

.symptom-explanation {
  font-size: 0.85rem;
  color: var(--cuadro-text-muted);
  margin: 0;
}

/* Pantalla de corte exterior */
.external-outage-card {
  background: var(--cuadro-card);
  border: 1px solid var(--cuadro-card-border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
}

.outage-alert-box {
  display: flex;
  gap: 1rem;
  background: var(--cuadro-primary-light);
  border-left: 4px solid var(--cuadro-primary);
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.distributors-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin-top: 1rem;
}

.distributors-table th, .distributors-table td {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--cuadro-card-border);
  text-align: left;
}

.distributors-table th {
  background: var(--cuadro-card-hover);
  font-weight: 700;
}

.phone-link {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--cuadro-primary);
  text-decoration: none;
}

.phone-link:hover {
  text-decoration: underline;
}

/* Subpasos de protocolos */
.protocol-substep {
  display: none;
  background: var(--cuadro-card);
  border: 1px solid var(--cuadro-card-border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.protocol-substep.active {
  display: block;
}

.substep-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}

.substep-badge {
  background: var(--cuadro-primary);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-family: var(--font-mono);
}

.substep-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
}

.instruction-box {
  background: var(--cuadro-card-hover);
  border-radius: var(--radius-sm);
  padding: 1rem;
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 1.25rem;
}

.instruction-box ol, .instruction-box ul {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
}

.instruction-box li {
  margin-bottom: 0.35rem;
}

.circuit-buttons-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.btn-test-circuit {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  background: var(--cuadro-surface);
  border: 2px solid var(--cuadro-card-border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 54px;
}

.btn-test-circuit:hover {
  border-color: var(--color-danger);
  background: var(--color-danger-bg);
}

.circuit-code-badge {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--cuadro-text);
}

.circuit-name-sub {
  font-size: 0.75rem;
  color: var(--cuadro-text-muted);
}

/* Lista de electrodomésticos sospechosos */
.suspect-chips-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.suspect-chip-item {
  background: var(--cuadro-card-hover);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  transition: background 0.15s ease;
}

.suspect-label {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  cursor: pointer;
  font-size: 0.9rem;
}

/* Temporizador contador telegestionado */
.icp-countdown-box {
  background: var(--cuadro-surface);
  border: 2px solid var(--cuadro-primary);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  text-align: center;
  margin: 1rem 0;
}

.icp-countdown-number {
  font-size: 3.5rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--cuadro-primary);
  line-height: 1;
}

/* Botones genéricos de acción */
.btn-primary-action {
  background-color: var(--cuadro-primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.65rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.15s ease;
}

.btn-primary-action:hover {
  background-color: var(--cuadro-primary-hover);
  transform: translateY(-1px);
}

.btn-secondary-action {
  background: transparent;
  color: var(--cuadro-text);
  border: 1px solid var(--cuadro-card-border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.15s ease;
}

.btn-secondary-action:hover {
  background: var(--cuadro-card-hover);
}

/* -------------------------------------------------------------
   SIMULADOR VISUAL DEL CUADRO ELÉCTRICO EN CARRIL DIN
   ------------------------------------------------------------- */
.din-rail-panel {
  background: var(--cuadro-surface);
  border: 1px solid var(--cuadro-card-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-md);
  margin-bottom: 1.5rem;
}

.din-rail-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--cuadro-card-border);
  margin-bottom: 1.25rem;
}

.din-rail-brand {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--cuadro-text);
}

.din-rail-badge {
  font-size: 0.75rem;
  background: var(--cuadro-card-hover);
  color: var(--cuadro-text-muted);
  border-radius: 4px;
  padding: 0.15rem 0.5rem;
  margin-left: 0.5rem;
}

.din-rail-indicator {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: var(--color-safe-bg);
  color: var(--color-safe);
  transition: all 0.2s ease;
}

.din-rail-indicator.power-cut {
  background: var(--color-danger-bg);
  color: var(--color-danger);
}

.power-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background-color: currentColor;
}

.din-rail-chassis {
  position: relative;
  background: var(--breaker-din-bg);
  border-radius: var(--radius-md);
  padding: 1.5rem 0.75rem;
  border: 2px solid var(--breaker-din-rail);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.din-rail-bar {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 35px;
  transform: translateY(-50%);
  background: repeating-linear-gradient(
    90deg,
    var(--breaker-din-rail),
    var(--breaker-din-rail) 12px,
    rgba(0, 0, 0, 0.15) 12px,
    rgba(0, 0, 0, 0.15) 24px
  );
  z-index: 1;
  pointer-events: none;
}

.breaker-grid {
  position: relative;
  z-index: 2;
  display: flex;
  gap: 6px;
  min-width: max-content;
  align-items: stretch;
}

/* Módulo individual de disyuntor */
.breaker-module {
  width: 90px;
  background: var(--breaker-body-bg);
  border: 1px solid var(--breaker-body-border);
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.12), inset 0 1px 0 rgba(255,255,255,0.4);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
  position: relative;
}

.breaker-module:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.18);
}

.breaker-module:focus-visible {
  outline: 2px solid var(--cuadro-primary);
  outline-offset: 2px;
}

.breaker-module.module-type-differential {
  width: 104px;
  background: var(--breaker-body-bg);
  border-color: #94a3b8;
}

.breaker-top-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.35rem 0.45rem;
  border-bottom: 1px solid var(--breaker-body-border);
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.breaker-code {
  font-weight: 800;
  color: var(--cuadro-text);
}

.breaker-rating {
  font-size: 0.7rem;
  color: var(--cuadro-text-muted);
}

.breaker-body {
  padding: 0.5rem 0.35rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.45rem;
  flex: 1;
}

.breaker-label-box {
  min-height: 42px;
}

.breaker-name {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.15;
  color: var(--cuadro-text);
}

.breaker-subname {
  display: block;
  font-size: 0.62rem;
  color: var(--cuadro-text-muted);
  line-height: 1.15;
  margin-top: 2px;
}

/* Botón de Test del diferencial */
.btn-breaker-test {
  background: var(--breaker-test-btn);
  color: #000000;
  border: 1px solid var(--breaker-test-hover);
  border-radius: 3px;
  padding: 0.15rem 0.35rem;
  font-size: 0.65rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.2rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.btn-breaker-test:hover {
  background: var(--breaker-test-hover);
}

.test-letter {
  font-size: 0.75rem;
  font-family: var(--font-mono);
}

/* Pozo y palanca biomecánica */
.breaker-lever-well {
  width: 44px;
  height: 64px;
  background: #0f172a;
  border-radius: 4px;
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.6);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0.25rem 0;
}

.breaker-lever {
  width: 32px;
  height: 32px;
  background: #334155;
  border-radius: 3px;
  box-shadow: 0 3px 5px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.3);
  position: absolute;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
}

.lever-handle {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lever-notch {
  width: 16px;
  height: 3px;
  background: #64748b;
  border-radius: 1px;
}

/* Palanca en posición ARRIBA (ON) */
.breaker-module.is-on .breaker-lever {
  top: 4px;
  background: #1e293b;
  border-top: 3px solid #ef4444; /* Indicador rojo normalizado UNE: contactos cerrados/en tensión */
}

/* Palanca en posición BAJADO (OFF) */
.breaker-module.is-off .breaker-lever {
  bottom: 4px;
  background: #0f172a;
  border-bottom: 3px solid #22c55e; /* Indicador verde normalizado UNE: abierto/seguro */
}

/* Lector de estado */
.breaker-state-readout {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.62rem;
  font-weight: 700;
  font-family: var(--font-mono);
}

.breaker-module.is-on .status-indicator-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--breaker-indicator-on);
}

.breaker-module.is-off .status-indicator-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--breaker-indicator-off);
}

.breaker-module.is-on .breaker-status-text {
  color: var(--cuadro-text);
}

.breaker-module.is-off .breaker-status-text {
  color: var(--cuadro-text-muted);
}

.breaker-footer-pin {
  display: flex;
  justify-content: space-between;
  padding: 0.25rem 0.45rem;
  border-top: 1px solid var(--breaker-body-border);
  font-size: 0.65rem;
  color: var(--cuadro-text-muted);
  font-family: var(--font-mono);
}

/* Controles de presets para el cuadro */
.box-presets-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.btn-box-preset {
  background: var(--cuadro-surface);
  border: 1px solid var(--cuadro-card-border);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--cuadro-text-muted);
  cursor: pointer;
  min-height: 40px;
  transition: all 0.15s ease;
}

.btn-box-preset:hover {
  color: var(--cuadro-text);
  border-color: var(--cuadro-text-muted);
}

.btn-box-preset.active {
  background: var(--cuadro-primary-light);
  color: var(--cuadro-primary);
  border-color: var(--cuadro-primary);
}

/* -------------------------------------------------------------
   CALCULADORA DE POTENCIA SIMULTÁNEA
   ------------------------------------------------------------- */
.calculator-container-card {
  background: var(--cuadro-surface);
  border: 1px solid var(--cuadro-card-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 2rem;
}

.calc-power-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--cuadro-card-border);
}

.contracted-power-selector-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.selector-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--cuadro-text-muted);
}

.power-select-dropdown {
  background-color: var(--cuadro-card);
  color: var(--cuadro-text);
  border: 1px solid var(--cuadro-card-border);
  border-radius: var(--radius-sm);
  padding: 0.55rem 2.5rem 0.55rem 0.85rem;
  font-size: 0.95rem;
  font-weight: 700;
  min-height: 42px;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 16px;
}

.power-select-dropdown option {
  background-color: var(--cuadro-card);
  color: var(--cuadro-text);
}

/* Indicadores KPI de potencia */
.power-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.power-kpi-card {
  background: var(--cuadro-card-hover);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.kpi-label {
  font-size: 0.8rem;
  color: var(--cuadro-text-muted);
}

.kpi-value {
  font-family: var(--font-mono);
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--cuadro-text);
  line-height: 1.1;
}

/* Barra de carga visual */
.power-gauge-wrapper {
  margin-bottom: 1.5rem;
}

.gauge-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.gauge-bar-track {
  width: 100%;
  height: 16px;
  background: var(--cuadro-card-border);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.gauge-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  transition: width 0.3s ease, background-color 0.3s ease;
}

.gauge-bar-fill.fill-safe { background-color: var(--color-safe); }
.gauge-bar-fill.fill-warning { background-color: var(--color-warning); }
.gauge-bar-fill.fill-trip_slow { background-color: #f97316; }
.gauge-bar-fill.fill-trip_fast, .gauge-bar-fill.fill-trip_instant { background-color: var(--color-danger); }

.power-status-feedback-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  background: var(--cuadro-card-hover);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
}

.power-status-badge {
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
}

.power-status-badge.status-safe { background: var(--color-safe-bg); color: var(--color-safe); }
.power-status-badge.status-warning { background: var(--color-warning-bg); color: var(--color-warning); }
.power-status-badge.status-trip_slow { background: #ffedd5; color: #c2410c; }
.power-status-badge.status-trip_fast, .power-status-badge.status-trip_instant { background: var(--color-danger-bg); color: var(--color-danger); }

/* Cuadrícula de selección de electrodomésticos */
.appliances-checklist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.appliance-item-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--cuadro-card);
  border: 1px solid var(--cuadro-card-border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  cursor: pointer;
  min-height: 52px;
  transition: all 0.15s ease;
}

.appliance-item-card:hover {
  border-color: var(--cuadro-primary);
  background: var(--cuadro-card-hover);
}

.appliance-item-card.is-selected {
  border-color: var(--cuadro-primary);
  background: var(--cuadro-primary-light);
}

.appliance-checkbox {
  margin-right: 0.65rem;
  width: 18px;
  height: 18px;
  accent-color: var(--cuadro-primary);
  cursor: pointer;
}

.appliance-info {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.appliance-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--cuadro-text);
}

.appliance-power {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--cuadro-text-muted);
}

.appliance-check-mark {
  opacity: 0;
  color: var(--cuadro-primary);
  font-weight: 800;
  transition: opacity 0.15s ease;
}

.appliance-item-card.is-selected .appliance-check-mark {
  opacity: 1;
}

/* -------------------------------------------------------------
   MODALES ACCESIBLES
   ------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay.active {
  display: flex;
}

.modal-card {
  background: var(--cuadro-surface);
  border: 1px solid var(--cuadro-card-border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--cuadro-card-border);
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 800;
  margin: 0;
}

.btn-modal-close {
  background: transparent;
  border: none;
  color: var(--cuadro-text-muted);
  cursor: pointer;
  padding: 0.4rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  min-width: 40px;
}

.btn-modal-close:hover {
  color: var(--cuadro-text);
  background: var(--cuadro-card-hover);
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  font-size: 0.95rem;
  line-height: 1.6;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--cuadro-card-border);
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.75rem;
}

.report-textarea {
  width: 100%;
  height: 260px;
  background: var(--cuadro-card);
  color: var(--cuadro-text);
  border: 1px solid var(--cuadro-card-border);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.4;
  resize: vertical;
}

/* -------------------------------------------------------------
   TOAST FLOTANTE
   ------------------------------------------------------------- */
.app-floating-toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #0f172a;
  color: #ffffff;
  padding: 0.75rem 1.4rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  z-index: 100000;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.app-floating-toast.is-visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* -------------------------------------------------------------
   GUÍA TÉCNICA SEO Y FAQ
   ------------------------------------------------------------- */
.seo-guide-section {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--cuadro-card-border);
}

.seo-guide-headline {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 1rem;
}

.seo-guide-prose {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--cuadro-text-muted);
}

.seo-guide-prose h3 {
  color: var(--cuadro-text);
  margin-top: 1.5rem;
}

.faq-accordion-group {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.faq-item-card {
  background: var(--cuadro-surface);
  border: 1px solid var(--cuadro-card-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.faq-summary {
  padding: 1rem 1.25rem;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}

.faq-summary::-webkit-details-marker {
  display: none;
}

.faq-summary::after {
  content: "+";
  font-size: 1.3rem;
  font-weight: 400;
  color: var(--cuadro-primary);
  transition: transform 0.2s ease;
}

.faq-item-card[open] .faq-summary::after {
  content: "−";
}

.faq-answer-content {
  padding: 0 1.25rem 1.25rem;
  font-size: 0.95rem;
  color: var(--cuadro-text-muted);
  line-height: 1.65;
}

/* -------------------------------------------------------------
   RESPONSIVE DESIGN (MOBILE FIRST CONTROLS)
   ------------------------------------------------------------- */
@media (max-width: 768px) {
  .emergency-top-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .btn-emergency-torch, .btn-safety-guide {
    width: 100%;
    justify-content: center;
  }

  .calc-power-header {
    flex-direction: column;
    align-items: stretch;
  }

  .power-select-dropdown {
    width: 100%;
  }

  .step-progress-item span:not(.step-number) {
    display: none;
  }

  .assistant-container-card, .calculator-container-card {
    padding: 1rem;
  }
}
