:root {
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', Consolas, monospace;

  /* Colores Corporativos MicroArea */
  --bg-app: #f4f7fb;
  --bg-card: #ffffff;
  --border-color: #e2e8f0;
  --border-focus: #0288d1;

  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;

  --primary: #0288d1;
  --primary-hover: #0277bd;
  --primary-dark: #015385;
  --primary-light: #e1f5fe;

  --accent: #00b4ff;
  --accent-light: #e0f2fe;

  --success: #10b981;
  --success-light: #ecfdf5;
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --danger: #ef4444;
  --danger-light: #fef2f2;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(2, 83, 133, 0.08);
  --shadow-lg: 0 10px 25px -5px rgba(2, 83, 133, 0.12);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.5;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* =======================================================
   HEADER CORPORATIVO MICROAREA
======================================================= */
.app-header {
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  flex-shrink: 0;
}

.header-content {
  max-width: 100%;
  margin: 0 auto;
  padding: 0.65rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-link {
  display: flex;
  align-items: center;
  text-decoration: none;
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.brand-link:hover {
  opacity: 0.85;
  transform: translateY(-1px);
}

.brand-logo {
  height: 36px;
  width: auto;
  object-fit: contain;
}

.brand-divider {
  width: 1px;
  height: 30px;
  background-color: var(--border-color);
}

.title-with-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header-content h1 {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--primary-dark);
  letter-spacing: -0.02em;
}

.product-pill {
  background: linear-gradient(135deg, #0288d1, #015385);
  color: #ffffff;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  letter-spacing: 0.05em;
}

.subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.badge-vertex-counter {
  background-color: #0288d1;
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  min-width: 20px;
  text-align: center;
}

.api-status-badge {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.775rem;
  font-weight: 600;
  border: 1px solid transparent;
}

.api-status-badge.connected {
  background-color: var(--success-light);
  color: var(--success);
  border-color: rgba(16, 185, 129, 0.2);
}

.api-status-badge.not-configured {
  background-color: var(--warning-light);
  color: var(--warning);
  border-color: rgba(245, 158, 11, 0.2);
}

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

.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.5rem 0.25rem 0.35rem;
  background-color: #f1f5f9;
  border: 1px solid var(--border-color);
  border-radius: 9999px;
  font-size: 0.775rem;
  font-weight: 600;
  color: var(--text-main);
}

.user-avatar-img {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border-color);
}

.user-email-text {
  max-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-logout, .btn-logout-header {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background-color: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.2s ease;
  cursor: pointer;
}

.btn-logout:hover, .btn-logout-header:hover {
  background-color: #ef4444;
  color: #ffffff;
  border-color: #ef4444;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.3);
}

.btn-close-case {
  background-color: #f1f5f9;
  border: 1px solid var(--border-color);
  color: var(--primary-dark);
  font-weight: 700;
}

.btn-close-case:hover {
  background-color: #e2e8f0;
  color: var(--primary);
}

/* =======================================================
   PANEL CENTRAL (3 COLUMNAS ADAPTABLES AL VIEWPORT)
======================================================= */
.main-container {
  flex: 1;
  max-width: 100%;
  width: 100%;
  margin: 0;
  padding: 0.75rem 1.25rem;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.panels-grid {
  display: grid;
  grid-template-columns: 1fr 1.12fr 1.38fr;
  gap: 1.15rem;
  align-items: stretch;
  height: 100%;
  min-height: 0;
}

.panel-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  transition: box-shadow 0.2s ease;
}

.panel-card:hover {
  box-shadow: var(--shadow-lg);
}

.panel-header {
  padding: 0.85rem 1.15rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: linear-gradient(to right, #ffffff, #f8fafc);
  flex-shrink: 0;
}

.step-badge {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(2, 136, 209, 0.3);
}

.panel-title-group h2 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.panel-title-group p {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.panel-body {
  padding: 1rem 1.15rem;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  overflow-y: auto;
}

.panel-body.flex-column {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* =======================================================
   COLUMNA 1: EVIDENCIAS & DROPZONE
======================================================= */
.capture-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Botón de Captura con Sensación de Movimiento y Alto Impacto Visual */
#btnCaptureScreen {
  position: relative;
  overflow: hidden;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0.85rem 1.25rem;
  letter-spacing: 0.01em;
  background: linear-gradient(135deg, #0288d1 0%, #0369a1 50%, #0288d1 100%);
  background-size: 200% auto;
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 4px 14px rgba(2, 136, 209, 0.35);
  animation: capturePulseMotion 3s infinite ease-in-out, captureGradientMove 4s ease infinite;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

#btnCaptureScreen svg {
  flex-shrink: 0;
  animation: captureCameraBounce 2.8s infinite ease-in-out;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.2));
}

#btnCaptureScreen::after {
  content: '';
  position: absolute;
  top: -60%;
  left: -80%;
  width: 50%;
  height: 220%;
  background: linear-gradient(
    65deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.45) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: rotate(25deg);
  animation: captureShimmerSweep 3.2s infinite cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

#btnCaptureScreen:hover {
  transform: translateY(-2px) scale(1.015);
  box-shadow: 0 8px 22px rgba(2, 136, 209, 0.5), 0 0 0 4px rgba(2, 136, 209, 0.15);
  background-position: right center;
}

#btnCaptureScreen:active {
  transform: translateY(0) scale(0.985);
  box-shadow: 0 2px 8px rgba(2, 136, 209, 0.4);
}

@keyframes capturePulseMotion {
  0% {
    transform: scale(1);
    box-shadow: 0 4px 14px rgba(2, 136, 209, 0.35), 0 0 0 0 rgba(2, 136, 209, 0.45);
  }
  50% {
    transform: scale(1.02);
    box-shadow: 0 6px 20px rgba(2, 136, 209, 0.45), 0 0 0 6px rgba(2, 136, 209, 0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 4px 14px rgba(2, 136, 209, 0.35), 0 0 0 0 rgba(2, 136, 209, 0);
  }
}

@keyframes captureGradientMove {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes captureShimmerSweep {
  0% { left: -90%; }
  35% { left: 140%; }
  100% { left: 140%; }
}

@keyframes captureCameraBounce {
  0%, 100% {
    transform: translateY(0) rotate(0deg) scale(1);
  }
  20% {
    transform: translateY(-2px) rotate(-5deg) scale(1.08);
  }
  40% {
    transform: translateY(1px) rotate(4deg) scale(1.02);
  }
  60% {
    transform: translateY(0) rotate(-2deg) scale(1);
  }
}

.helper-text {
  font-size: 0.775rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* TARJETAS SEPARADAS DE MÉTODOS DE EVIDENCIA */
.evidence-method-card {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: var(--radius-md);
  padding: 0.65rem 0.75rem;
  margin-bottom: 0.35rem;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
  transition: all 0.2s ease;
}

.evidence-method-card:hover {
  border-color: #94a3b8;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.05);
}

.evidence-method-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
}

.evidence-method-badge {
  font-size: 0.675rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.15rem 0.55rem;
  border-radius: 9999px;
  white-space: nowrap;
}

.badge-blue {
  background: #e0f2fe;
  color: #0288d1;
  border: 1px solid #bae6fd;
}

.badge-emerald {
  background: #dcfce7;
  color: #059669;
  border: 1px solid #bbf7d0;
}

.evidence-method-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: #334155;
}

/* SEPARADOR VISUAL DE MÉTODOS */
.evidence-methods-divider {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.4rem 0;
  text-align: center;
}

.divider-line {
  flex: 1;
  height: 1px;
  background: #e2e8f0;
}

.divider-label {
  font-size: 0.625rem;
  font-weight: 800;
  color: #64748b;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: #f1f5f9;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

/* ZONA DE ARRASTRE MEJORADA Y DESTACADA */
.drop-zone-enhanced {
  border: 2px dashed #0288d1;
  border-radius: 10px;
  padding: 0.75rem 0.65rem;
  text-align: center;
  background: linear-gradient(180deg, #f0f9ff 0%, #ffffff 100%);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 1px 3px rgba(2, 136, 209, 0.06);
}

.drop-zone-enhanced:hover, .drop-zone-enhanced.drag-over {
  border-color: #01579b;
  background: #e0f2fe;
  box-shadow: 0 0 0 3px rgba(2, 136, 209, 0.2), 0 4px 12px rgba(2, 136, 209, 0.1);
  transform: translateY(-1px);
}

.drop-zone-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.drop-zone-icon-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #ffffff;
  border: 1.5px solid #bae6fd;
  color: #0288d1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(2, 136, 209, 0.12);
  margin-bottom: 0.15rem;
  transition: transform 0.2s ease;
}

.drop-zone-enhanced:hover .drop-zone-icon-circle {
  transform: scale(1.1);
  color: #01579b;
}

.drop-zone-primary-text {
  font-size: 0.825rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0;
  line-height: 1.25;
}

.drop-zone-secondary-text {
  font-size: 0.725rem;
  color: #475569;
  margin: 0;
}

.drop-zone-formats {
  display: flex;
  justify-content: center;
  gap: 0.35rem;
  margin-top: 0.35rem;
}

.format-tag {
  font-size: 0.625rem;
  font-weight: 700;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #475569;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
}

.gallery-wrapper {
  background: #f8fafc;
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.65rem;
  flex: 1;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.gallery-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  flex-shrink: 0;
}

.gallery-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-count {
  background-color: #e2e8f0;
  color: var(--text-main);
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 600;
}

.captures-grid {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}

.empty-state {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-light);
}

.empty-state svg {
  margin-bottom: 0.5rem;
  stroke: var(--text-light);
}

.empty-state p {
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--text-muted);
}

.empty-state .sub-hint {
  font-size: 0.725rem;
  color: var(--text-light);
  display: block;
  margin-top: 0.2rem;
}

.capture-item {
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-color);
  background: white;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.capture-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.capture-thumb-wrapper {
  position: relative;
  width: 100%;
  height: 110px;
  background-color: #0f172a;
  cursor: pointer;
  overflow: hidden;
}

.capture-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.capture-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
  color: white;
  font-size: 0.775rem;
  font-weight: 600;
  gap: 0.35rem;
}

.capture-thumb-wrapper:hover .capture-overlay {
  opacity: 1;
}

.doc-thumb-placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  color: white;
}

.doc-thumb-ext {
  font-family: var(--font-mono);
  font-size: 0.725rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.2);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
}

.capture-info-bar {
  padding: 0.4rem 0.65rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #ffffff;
  border-top: 1px solid var(--border-color);
}

.capture-name {
  font-size: 0.775rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.btn-delete-capture {
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  padding: 3px;
  border-radius: var(--radius-sm);
  display: flex;
}

.btn-delete-capture:hover {
  color: var(--danger);
  background-color: var(--danger-light);
}

/* =======================================================
   COLUMNA 2: FORMULARIO Y SELECTOR DE TIPO
======================================================= */
.problem-type-container {
  margin-bottom: 0.75rem;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.75rem;
}

.section-subheading-label {
  display: block;
  margin-bottom: 0.45rem;
}

.subheading-title {
  font-size: 0.775rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--primary-dark);
}

.problem-type-selector-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
  width: 100%;
  box-sizing: border-box;
}

@media (max-width: 520px) {
  .problem-type-selector-grid {
    grid-template-columns: 1fr;
  }
}

.type-option-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.75rem;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  min-width: 0;
  box-sizing: border-box;
}

.type-option-card:hover {
  border-color: #94a3b8;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.06);
}

.type-option-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.icon-fallo {
  background: #fee2e2;
  color: #dc2626;
}

.icon-problema {
  background: #e0f2fe;
  color: #0288d1;
}

.icon-mejora {
  background: #dcfce7;
  color: #16a34a;
}

.icon-comercial {
  background: #fef3c7;
  color: #d97706;
}

.type-option-texts {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.type-option-title {
  font-size: 0.83rem;
  font-weight: 800;
  color: #1e293b;
  line-height: 1.25;
}

.type-option-hint {
  font-size: 0.71rem;
  color: #64748b;
  margin-top: 2px;
  line-height: 1.25;
}

/* Estados Activos según Tipo */
.type-option-card.active[data-type="fallo"] {
  border-color: #ef4444;
  background: #fff5f5;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.25), 0 4px 10px rgba(239, 68, 68, 0.1);
}
.type-option-card.active[data-type="fallo"] .type-option-title {
  color: #b91c1c;
}

.type-option-card.active[data-type="problema"] {
  border-color: #0288d1;
  background: #f0f9ff;
  box-shadow: 0 0 0 2px rgba(2, 136, 209, 0.25), 0 4px 10px rgba(2, 136, 209, 0.1);
}
.type-option-card.active[data-type="problema"] .type-option-title {
  color: #0369a1;
}

.type-option-card.active[data-type="mejora"] {
  border-color: #10b981;
  background: #f0fdf4;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25), 0 4px 10px rgba(16, 185, 129, 0.1);
}
.type-option-card.active[data-type="mejora"] .type-option-title {
  color: #047857;
}

.type-option-card.active[data-type="comercial"] {
  border-color: #f59e0b;
  background: #fffbeb;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.25), 0 4px 10px rgba(245, 158, 11, 0.1);
}
.type-option-card.active[data-type="comercial"] .type-option-title {
  color: #b45309;
}

/* Contenedor y Bloques de Preguntas de Alta Visibilidad */
.problem-fields-container {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.problem-block {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: var(--radius-md);
  padding: 0.65rem 0.8rem;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.problem-block:hover {
  border-color: #94a3b8;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.problem-block:focus-within {
  border-color: #0288d1;
  box-shadow: 0 0 0 3px rgba(2, 136, 209, 0.15), 0 2px 8px rgba(0, 0, 0, 0.05);
}

.problem-block-header {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin-bottom: 0.4rem;
}

.problem-block-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0288d1, #01579b);
  color: #ffffff;
  font-size: 0.725rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.urgency-block .problem-block-num {
  background: linear-gradient(135deg, #f59e0b, #d97706);
}

.problem-block-labels {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.problem-block-title {
  font-size: 0.875rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.25;
}

.problem-block-desc {
  font-size: 0.725rem;
  color: #64748b;
  margin-top: 1px;
}

.problem-block textarea {
  width: 100%;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  line-height: 1.45;
  color: #0f172a;
  padding: 0.5rem 0.65rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background-color: #f8fafc;
  transition: all 0.15s ease;
  resize: vertical;
}

.problem-block textarea:focus {
  background-color: #ffffff;
  border-color: #0288d1;
  outline: none;
  box-shadow: 0 0 0 2px rgba(2, 136, 209, 0.12);
}

.problem-block select {
  width: 100%;
  font-family: var(--font-sans);
  font-size: 0.825rem;
  font-weight: 600;
  color: #0f172a;
  padding: 0.5rem 0.65rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background-color: #f8fafc;
  cursor: pointer;
}

.problem-block select:focus {
  background-color: #ffffff;
  border-color: #0288d1;
  outline: none;
  box-shadow: 0 0 0 2px rgba(2, 136, 209, 0.12);
}

/* =======================================================
   BOTONES Y EFECTO RESPLANDOR MICROAREA
======================================================= */
button {
  font-family: var(--font-sans);
  cursor: pointer;
  border-radius: var(--radius-md);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

button:active {
  transform: scale(0.98);
}

.btn-primary {
  background: linear-gradient(135deg, #0288d1, #015385);
  color: white;
  border: none;
  padding: 0.75rem 1.25rem;
  font-size: 0.875rem;
  box-shadow: 0 2px 4px rgba(2, 83, 133, 0.2);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #0277bd, #01436b);
}

/* Estilo oficial WinLab comprar/enviar con aura pulsante */
@keyframes luzResplandor {
  0% {
    box-shadow: 0 0 0 0 rgba(2, 113, 180, 0), 0 0 5px rgba(0, 180, 255, 0.2), inset 0 0 4px rgba(255, 255, 255, 0.2);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 16px 5px rgba(0, 180, 255, 0.6), 0 0 30px 8px rgba(2, 113, 180, 0.3), inset 0 0 8px rgba(255, 255, 255, 0.5);
    transform: scale(1.02);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(2, 113, 180, 0), 0 0 5px rgba(0, 180, 255, 0.2), inset 0 0 4px rgba(255, 255, 255, 0.2);
    transform: scale(1);
  }
}

.btn-nav-comprar {
  background: linear-gradient(135deg, #0288d1, #015385) !important;
  color: #ffffff !important;
  font-weight: 800 !important;
  font-size: 0.92rem !important;
  padding: 0.85rem 1.5rem !important;
  border-radius: 25px !important;
  border: 1px solid rgba(255, 255, 255, 0.6) !important;
  animation: luzResplandor 2.4s infinite ease-in-out !important;
  letter-spacing: 0.4px !important;
  text-transform: uppercase !important;
}

.btn-nav-comprar:hover {
  animation: none !important;
  filter: brightness(1.1);
  box-shadow: 0 6px 18px rgba(2, 136, 209, 0.45) !important;
}

.btn-secondary {
  background-color: #ffffff;
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 0.5rem 0.9rem;
  font-size: 0.825rem;
}

.btn-secondary:hover {
  background-color: #f1f5f9;
  border-color: #cbd5e1;
}

.btn-full {
  width: 100%;
}

.btn-small {
  padding: 0.45rem 0.85rem;
  font-size: 0.775rem;
  border-radius: var(--radius-sm);
}

.btn-icon-small {
  background-color: #f1f5f9;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
}

.btn-icon-small:hover {
  background-color: #e2e8f0;
}

.btn-vertex-star.active {
  background-color: #fef3c7;
  border-color: #f59e0b;
  color: #b45309;
}

.btn-speak-highlight {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%) !important;
  color: #ffffff !important;
  border: 1px solid #0284c7 !important;
  border-radius: 6px !important;
  padding: 0.42rem 0.95rem !important;
  font-size: 0.82rem !important;
  font-weight: 700 !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.45rem !important;
  cursor: pointer !important;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.35) !important;
  transition: all 0.2s ease !important;
}

.btn-speak-highlight:hover {
  background: linear-gradient(135deg, #0369a1 0%, #075985 100%) !important;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.5) !important;
  transform: translateY(-1px);
}

.btn-speak-highlight.speaking,
.btn-speak-report.speaking {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%) !important;
  border-color: #1d4ed8 !important;
  color: #ffffff !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.35) !important;
  animation: pulse-speak 1.5s infinite;
}

.btn-stop-highlight {
  background-color: #fee2e2 !important;
  border-color: #fca5a5 !important;
  color: #b91c1c !important;
  font-weight: 600 !important;
}
.btn-stop-highlight:hover {
  background-color: #fecaca !important;
}

@keyframes pulse-speak {
  0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.5); }
  70% { box-shadow: 0 0 0 6px rgba(59, 130, 246, 0); }
  100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}


/* =======================================================
   COLUMNA 3: ASISTENTE IA & REPORTE
======================================================= */
.ai-empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem 1.5rem;
}

.ai-icon-large {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-lg);
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
}

.ai-empty-state h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
  color: var(--primary-dark);
}

.ai-empty-state p {
  color: var(--text-muted);
  font-size: 0.85rem;
  max-width: 320px;
  margin-bottom: 1.5rem;
}

.ai-features-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  text-align: left;
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-main);
}

.feature-item svg {
  color: var(--success);
  flex-shrink: 0;
}

/* Loading State */
.ai-loading-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4rem 1.5rem;
}

.spinner-gemini {
  width: 44px;
  height: 44px;
  border: 4px solid #e2e8f0;
  border-top-color: var(--primary);
  border-right-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 1.25rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.progress-steps {
  display: flex;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

.step-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background-color: var(--border-color);
}

.step-dot.active {
  background-color: var(--primary);
}

.step-dot.pulse {
  background-color: var(--accent);
  animation: pulse 1.2s infinite ease-in-out;
}

@keyframes pulse {
  0%, 100% { opacity: 0.3; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.2); }
}

/* Report View */
.ai-report-state {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.report-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.75rem;
  margin-bottom: 0.85rem;
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
  gap: 0.5rem;
}

.report-tags-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.report-tag {
  background-color: var(--primary-light);
  color: var(--primary-dark);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
}

.db-saved-badge {
  background-color: var(--success-light);
  color: var(--success);
  font-size: 0.725rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
}

.toolbar-actions {
  display: flex;
  gap: 0.4rem;
}

.report-content-body {
  flex: 1;
  overflow-y: auto;
  padding-right: 0.5rem;
  font-size: 0.875rem;
  line-height: 1.6;
  min-height: 0;
}

.report-content-body h2 {
  font-size: 1.1rem;
  color: var(--primary-dark);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.35rem;
  margin-top: 1rem;
  margin-bottom: 0.5rem;
}

.report-content-body h3 {
  font-size: 0.95rem;
  color: var(--primary);
  margin-top: 0.85rem;
  margin-bottom: 0.4rem;
}

.report-content-body p {
  margin-bottom: 0.65rem;
}

.report-content-body ul, .report-content-body ol {
  margin-bottom: 0.75rem;
  padding-left: 1.25rem;
}

.report-content-body code {
  font-family: var(--font-mono);
  background-color: #f1f5f9;
  color: #0284c7;
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  font-size: 0.85em;
}

.report-content-body pre {
  background-color: #0f172a;
  color: #f8fafc;
  padding: 0.85rem;
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin-bottom: 0.85rem;
}

.followup-chat-box {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
}

.chat-input-wrapper {
  display: flex;
  gap: 0.5rem;
}

.chat-input-wrapper input {
  flex: 1;
}

.btn-send-chat {
  background: var(--primary);
  color: white;
  border: none;
  padding: 0 1rem;
  border-radius: var(--radius-md);
}

/* =======================================================
   MODALES
======================================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-card {
  background: white;
  border-radius: var(--radius-lg);
  max-width: 520px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* =======================================================
   MODAL PANEL DE CONSULTAS - PANTALLA COMPLETA & RESPONSIVE
======================================================= */
#historyModal.modal-overlay {
  padding: 0;
  background: rgba(15, 23, 42, 0.82);
  backdrop-filter: blur(6px);
}

#historyModal.is-fullscreen.modal-overlay {
  padding: 0 !important;
}

#historyModal.is-fullscreen .modal-card {
  width: 100vw !important;
  max-width: 100vw !important;
  height: 100vh !important;
  max-height: 100vh !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  border: none !important;
}

#historyModal:not(.is-fullscreen) {
  padding: 1.25rem !important;
}

#historyModal:not(.is-fullscreen) .modal-card {
  width: 96vw !important;
  max-width: 1800px !important;
  height: 94vh !important;
  max-height: 94vh !important;
  border-radius: 12px !important;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.4) !important;
}

.modal-extra-wide {
  width: 100vw;
  max-width: 100vw;
  height: 100vh;
  max-height: 100vh;
}

.history-modal-body {
  padding: 1rem 1.75rem 1.5rem 1.75rem;
  display: flex;
  flex-direction: column;
  flex: 1;
  height: calc(100vh - 72px);
  min-height: 0;
  overflow: hidden;
}

#historyModal:not(.is-fullscreen) .history-modal-body {
  height: calc(94vh - 72px);
}

.history-detail-panel {
  margin-top: 1rem;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
  animation: fadeIn 0.2s ease-out;
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #e2e8f0;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.detail-header h4 {
  font-size: 1.05rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.detail-block {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
}

.detail-block h5 {
  margin: 0 0 0.5rem 0;
  font-size: 0.84rem;
  font-weight: 700;
  color: #1e293b;
}

.detail-block pre {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0.85rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  color: #334155;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 440px;
  overflow-y: auto;
  line-height: 1.45;
}

.detail-rendered-response {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 1rem;
  font-size: 0.82rem;
  color: #0f172a;
  line-height: 1.55;
  max-height: 440px;
  overflow-y: auto;
}

/* Miniaturas de capturas en el detalle */
.detail-capture-card {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  padding: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.detail-capture-card:hover {
  border-color: #0284c7;
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(2, 132, 199, 0.2);
}

.detail-capture-card img {
  width: 140px;
  height: 95px;
  object-fit: cover;
  border-radius: 6px;
  display: block;
}

.detail-capture-name {
  font-size: 0.68rem;
  font-weight: 700;
  color: #475569;
  margin-top: 4px;
  max-width: 135px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-header {
  padding: 1.15rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8fafc;
}

.modal-title-group h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.modal-title-group p {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.btn-close-modal {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-light);
  line-height: 1;
}

.btn-close-modal:hover {
  color: var(--text-main);
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  background: #f8fafc;
}

.notice-box {
  display: flex;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background-color: var(--primary-light);
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  color: var(--primary-dark);
}

/* Historial list */
.history-filter-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.filter-tabs {
  display: flex;
  gap: 0.5rem;
}

.filter-tab {
  background: #f1f5f9;
  border: 1px solid var(--border-color);
  padding: 0.4rem 0.8rem;
  border-radius: 9999px;
  font-size: 0.775rem;
  color: var(--text-muted);
}

.filter-tab.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.history-list-scroll {
  flex: 1;
  height: 100%;
  max-height: none !important;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding-right: 0.35rem;
  min-height: 0;
}

.ticket-history-row {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #ffffff;
  transition: all 0.15s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.ticket-history-row:hover {
  background-color: #f8fafc;
  border-color: #0288d1;
  box-shadow: 0 4px 12px rgba(2, 136, 209, 0.08);
}

.preview-modal-card {
  max-width: 90vw;
  max-height: 90vh;
}

.preview-image-container img {
  max-width: 100%;
  max-height: 75vh;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}

.hidden {
  display: none !important;
}

/* =======================================================
   FOOTER CORPORATIVO MICROAREA
======================================================= */
.app-footer {
  background: linear-gradient(135deg, #f5f7fb 0%, #edf1f7 100%);
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  padding: 0.5rem 1.5rem;
  margin-top: auto;
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.footer-container {
  max-width: 100%;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.footer-logo {
  height: 24px;
  width: auto;
  object-fit: contain;
}

.footer-slogan {
  font-size: 0.725rem;
  color: var(--text-light);
}

.footer-legal {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.footer-legal p {
  line-height: 1.3;
}

.footer-links a, .footer-legal a {
  color: var(--primary);
  text-decoration: none;
}

.footer-links a:hover, .footer-legal a:hover {
  text-decoration: underline;
}

/* Responsive & Viewport Adaptation */
@media (max-width: 1100px), (max-height: 660px) {
  body {
    height: auto;
    min-height: 100vh;
    overflow-y: auto;
  }
  .main-container {
    height: auto;
    margin: 1rem auto;
  }
  .panels-grid {
    grid-template-columns: 1fr;
    height: auto;
  }
  .panel-card {
    height: auto;
    min-height: 460px;
  }
  .captures-grid {
    max-height: 320px;
  }
  .report-content-body {
    max-height: 480px;
  }
}

/* =======================================================
   MODAL DE ACCESO / LOGIN FLOTANTE SOBRE LA APLICACIÓN
======================================================= */
.login-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 1.5rem;
  animation: fadeIn 0.25s ease-out;
}

.login-card-modal {
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(16px);
  border-radius: 20px;
  box-shadow: 0 25px 50px -12px rgba(1, 83, 133, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.9);
  max-width: 480px;
  max-height: 95vh;
  overflow-y: auto;
  width: 100%;
  padding: 1.75rem 2rem;
  text-align: center;
  position: relative;
  animation: scaleUp 0.25s ease-out;
  transition: max-width 0.25s ease, padding 0.25s ease;
}

/* Banner visual de MIA con logotipo en la cabecera del modal de Login */
.login-mia-banner-container {
  width: calc(100% + 4rem);
  margin: -1.75rem -2rem 1.25rem -2rem;
  border-radius: 20px 20px 0 0;
  overflow: hidden;
  background: #0b1120;
  border-bottom: 2px solid #2563eb;
  line-height: 0;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.12);
}

.login-mia-banner-img {
  width: 100%;
  height: 175px;
  object-fit: cover;
  object-position: center;
  display: block;
}

/* Modo horizontal ampliado para formulario de registro y verificación */
.login-card-modal.modal-wide {
  max-width: 860px;
  padding: 1.25rem 2rem 1.5rem 2rem;
}

.login-card-modal.modal-wide .brand-header {
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
}

.login-card-modal.modal-wide .logo-img {
  height: 38px;
  margin-bottom: 0;
}

.login-card-modal.modal-wide .brand-header-text {
  text-align: left;
}

.login-card-modal.modal-wide .brand-header-text h2 {
  font-size: 1.25rem;
  margin-bottom: 0.1rem;
}

.login-card-modal.modal-wide .brand-header-text .subtitle {
  font-size: 0.775rem;
}

@keyframes scaleUp {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.login-card-modal .brand-header {
  margin-bottom: 1.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.login-card-modal .logo-img {
  height: 52px;
  max-width: 220px;
  width: auto;
  object-fit: contain;
  margin: 0 auto 1.25rem auto;
  display: block;
}

.login-card-modal h2,
.login-card-modal .brand-header-text h2 {
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--primary-dark);
  letter-spacing: -0.02em;
  margin-bottom: 0.35rem;
  text-align: center;
}

.login-card-modal .subtitle,
.login-card-modal .brand-header-text .subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
  text-align: center;
}

.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  width: 100%;
  padding: 0.85rem 1.25rem;
  background-color: #ffffff;
  color: #374151;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
  cursor: pointer;
  margin-top: 1rem;
}

.btn-google:hover {
  background-color: #f9fafb;
  border-color: #9ca3af;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}

.google-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.domain-badge {
  display: inline-block;
  margin-top: 1.25rem;
  padding: 0.35rem 0.85rem;
  background-color: var(--primary-light);
  color: var(--primary-dark);
  border-radius: 9999px;
  font-size: 0.775rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.security-notice {
  margin-top: 0.85rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.alert-error {
  background-color: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  font-size: 0.825rem;
  font-weight: 600;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-align: left;
}

/* Divisor de métodos de acceso */
.modal-auth-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 1.15rem 0 1rem 0;
  color: var(--text-muted);
  font-size: 0.775rem;
}

.modal-auth-divider::before,
.modal-auth-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--border-color);
}

.modal-auth-divider span {
  padding: 0 0.75rem;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.form-group-compact {
  text-align: left;
}

.form-group-compact input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  font-size: 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background-color: #ffffff;
  color: var(--text-main);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group-compact input:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(2, 136, 209, 0.15);
}

.compact-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.2rem;
}

.btn-auth-submit {
  padding: 0.75rem 1rem !important;
  font-size: 0.9rem !important;
  margin-top: 0.35rem;
  font-weight: 700 !important;
  border-radius: 10px !important;
}

.auth-extra-links {
  margin-top: 1rem;
}

.auth-extra-links a {
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
}

.auth-extra-links a:hover {
  text-decoration: underline;
}

.auth-footer-notice {
  margin-top: 0.75rem;
}

/* Banner de Google pendiente de asociar */
.pending-google-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background-color: #eff6ff;
  border: 1px solid #bfdbfe;
  color: var(--primary-dark);
  padding: 0.6rem 0.85rem;
  border-radius: 10px;
  font-size: 0.8rem;
  margin-bottom: 0.85rem;
}

.google-icon-sm {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.register-hint-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 1rem;
  text-align: left;
}

.checkbox-wrapper {
  text-align: left;
  margin: 0.35rem 0;
}

.checkbox-wrapper label {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-main);
  cursor: pointer;
  line-height: 1.35;
}

.checkbox-wrapper input[type="checkbox"] {
  margin-top: 2px;
  accent-color: var(--primary);
}

/* Feedback de verificación de cliente MaGestCloud */
.magest-feedback-box {
  margin-top: 0.35rem;
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  line-height: 1.35;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  transition: all 0.2s ease;
}

.magest-feedback-box.is-loading {
  background-color: #f0f9ff;
  border: 1px solid #bae6fd;
  color: #0369a1;
}

.magest-feedback-box.is-valid {
  background-color: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #15803d;
}

.magest-feedback-box.is-invalid {
  background-color: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
}

/* Grid y campos de verificación de cliente */
.input-readonly {
  background-color: #f1f5f9 !important;
  color: #475569 !important;
  cursor: not-allowed;
  border-color: #cbd5e1 !important;
  font-weight: 600;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

@media (max-width: 480px) {
  .form-grid-2 {
    grid-template-columns: 1fr;
  }
}

.auth-section-title {
  font-size: 0.775rem;
  font-weight: 700;
  color: var(--primary-dark);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0.85rem 0 0.45rem 0;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.25rem;
}

.input-hint-micro {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  display: block;
}

.badge-address-verified {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.68rem;
  font-weight: 700;
  color: #15803d;
  background-color: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 6px;
  padding: 0.15rem 0.45rem;
}

/* Posicionamiento superior del autocompletado de Google Maps sobre el modal */
.pac-container {
  z-index: 100000 !important;
  border-radius: 10px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2);
  border: 1px solid #e2e8f0;
  font-family: inherit;
}

/* Caja de consentimiento explícito de comunicaciones */
.authorization-box {
  background-color: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 0.75rem 0.85rem;
  margin: 0.75rem 0 0.5rem 0;
  transition: border-color 0.2s ease;
}

.authorization-box:hover {
  border-color: var(--primary);
}

.authorization-box input[type="checkbox"] {
  accent-color: var(--primary);
  width: 17px;
  height: 17px;
  cursor: pointer;
  flex-shrink: 0;
}

/* Estructura horizontal en 2 columnas para monitores compactos y de baja resolución */
.register-columns-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  text-align: left;
  margin-top: 0.35rem;
}

.register-col {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.register-col .form-group-compact {
  margin-bottom: 0.35rem;
}

.register-col .compact-label {
  font-size: 0.72rem;
  font-weight: 700;
  margin-bottom: 0.15rem;
  display: block;
}

.register-col input {
  padding: 0.42rem 0.65rem;
  font-size: 0.825rem;
  border-radius: 8px;
}

.register-col .form-grid-2 {
  gap: 0.5rem;
}

.register-bottom-actions {
  margin-top: 0.75rem;
}

/* =======================================================
   TARJETA DESTACADA DE VINCULACIÓN CON GOOGLE WORKSPACE
======================================================= */
.google-link-card-inline {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  padding: 1rem 1.35rem;
  border-radius: 14px;
  margin: 0.85rem 0 1.1rem 0;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

.google-link-card-inline.is-unlinked {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 50%, #e0e7ff 100%);
  border: 2px solid #3b82f6;
  border-left: 6px solid #2563eb;
  box-shadow: 0 4px 20px rgba(37, 99, 235, 0.2);
}

.google-link-card-inline.is-unlinked:hover {
  border-color: #1d4ed8;
  border-left-color: #1d4ed8;
  box-shadow: 0 6px 24px rgba(37, 99, 235, 0.28);
}

.google-link-card-inline.is-linked {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 50%, #d1fae5 100%);
  border: 2px solid #10b981;
  border-left: 6px solid #059669;
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.25);
}

.google-card-left {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  text-align: left;
  flex: 1;
}

.google-card-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
  flex-shrink: 0;
  border: 1.5px solid #e2e8f0;
}

.google-card-header-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  margin-bottom: 0.25rem;
}

.google-card-title {
  font-weight: 800;
  font-size: 1rem;
  color: #0f172a;
  line-height: 1.25;
}

.is-linked .google-card-title {
  color: #064e3b;
}

.is-unlinked .google-card-title {
  color: #1e3a8a;
}

.google-card-email-highlight {
  color: #ffffff;
  font-weight: 800;
  background: #059669;
  padding: 0.18rem 0.55rem;
  border-radius: 7px;
  box-shadow: 0 1px 3px rgba(5, 150, 105, 0.3);
  word-break: break-all;
}

.google-card-badge {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.google-card-badge.badge-recommended {
  background: #2563eb;
  color: #ffffff;
  border: 1px solid #1d4ed8;
}

.google-card-badge.badge-linked {
  background: #059669;
  color: #ffffff;
  border: 1px solid #047857;
}

.google-card-sub {
  font-size: 0.8rem;
  line-height: 1.4;
  margin: 0;
}

.is-unlinked .google-card-sub {
  color: #1e40af;
  font-weight: 500;
}

.is-linked .google-card-sub {
  color: #065f46;
  font-weight: 600;
}

.btn-google-prominent-action {
  flex-shrink: 0;
}

.btn-google-connect {
  padding: 0.65rem 1.2rem;
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: 9px;
  border: 1.5px solid #1d4ed8;
  background: #2563eb;
  color: #ffffff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
  transition: all 0.2s ease;
}

.btn-google-connect:hover {
  background: #1d4ed8;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
  transform: translateY(-1px);
}

.btn-google-change {
  padding: 0.55rem 1.05rem;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: 9px;
  border: 1.5px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-google-change:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #0f172a;
}

.is-linked .btn-google-change {
  border: 1.5px solid #059669;
  color: #065f46;
  font-weight: 700;
  background: #ffffff;
}

.is-linked .btn-google-change:hover {
  background: #f0fdf4;
  border-color: #047857;
  color: #047857;
}

@media (max-width: 768px) {
  .login-card-modal.modal-wide {
    max-width: 520px;
    padding: 1.25rem;
  }
  .login-card-modal.modal-wide .brand-header {
    flex-direction: column;
    text-align: center;
  }
  .register-columns-layout {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  .google-link-card-inline {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 0.85rem 1rem;
  }
  .btn-google-prominent-action {
    width: 100%;
  }
  .btn-google-connect, .btn-google-change {
    width: 100%;
    justify-content: center;
  }
}

/* =======================================================
   MODAL DE CONFIRMACIÓN ESTILIZADO (MICROAREA CONSULTA AI)
======================================================= */
.confirm-dialog-card {
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.4), 0 0 0 1px rgba(15, 23, 42, 0.08);
  width: 90%;
  max-width: 440px;
  overflow: hidden;
  animation: confirmDialogAppear 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes confirmDialogAppear {
  from {
    opacity: 0;
    transform: scale(0.94) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.confirm-dialog-header {
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid #f1f5f9;
  background: #f8fafc;
}

.confirm-header-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.confirm-dialog-title {
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: #0288d1;
  text-transform: uppercase;
}

.confirm-dialog-body {
  padding: 1.35rem 1.25rem 1.25rem 1.25rem;
}

.confirm-dialog-body p {
  font-size: 0.9rem;
  line-height: 1.5;
  color: #1e293b;
  margin: 0;
  font-weight: 500;
}

.confirm-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 0.85rem 1.25rem 1rem 1.25rem;
  background: #f8fafc;
  border-top: 1px solid #f1f5f9;
}

.btn-danger-confirm {
  background: #ef4444;
  color: #ffffff;
  border: none;
  padding: 0.5rem 1.15rem;
  font-size: 0.825rem;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.25);
}

.btn-danger-confirm:hover {
  background: #dc2626;
  box-shadow: 0 4px 10px rgba(239, 68, 68, 0.35);
}

.input-error-highlight {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.25) !important;
  animation: shakeInput 0.3s ease;
}

@keyframes shakeInput {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* =======================================================
   ALERTA DE TELÉFONO FIJO EN FICHA DE CLIENTE
======================================================= */
.box-aviso-fijo {
  background: #fffbeb;
  border: 1.5px solid #fde68a;
  border-left: 5px solid #d97706;
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
  font-size: 0.75rem;
  line-height: 1.4;
  color: #92400e;
  margin: 0.4rem 0 0.2rem 0;
  text-align: left;
}

/* =======================================================
   MODAL DE VERIFICACIÓN TELEFÓNICA POR VOZ CON MIA
======================================================= */
.voice-modal-overlay {
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(5px);
}

.voice-modal-card {
  background: #ffffff;
  border-radius: 18px;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.45), 0 0 0 1px rgba(15, 23, 42, 0.08);
  width: 92%;
  max-width: 480px;
  overflow: hidden;
  animation: confirmDialogAppear 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.voice-modal-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.4rem;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.voice-avatar-circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #eff6ff;
  border: 2px solid #bfdbfe;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
}

.voice-avatar-circle.is-calling {
  background: #f0fdf4;
  border-color: #86efac;
}

.calling-pulse-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid #22c55e;
  animation: pulseRing 1.6s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

@keyframes pulseRing {
  0% { transform: scale(0.95); opacity: 0.9; }
  50% { transform: scale(1.4); opacity: 0.3; }
  100% { transform: scale(1.7); opacity: 0; }
}

.voice-modal-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  color: #0f172a;
}

.voice-modal-sub {
  margin: 2px 0 0 0;
  font-size: 0.775rem;
  color: #64748b;
}

.voice-modal-body {
  padding: 1.35rem 1.4rem;
  text-align: left;
}

.voice-confirm-question {
  margin: 0 0 0.85rem 0;
  font-size: 0.88rem;
  color: #1e293b;
  line-height: 1.45;
}

.voice-phone-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 2px solid #cbd5e1;
  border-radius: 12px;
  padding: 0.75rem 1rem;
  margin: 0.65rem 0 1rem 0;
}

.voice-phone-flag {
  font-size: 1rem;
  font-weight: 700;
  color: #64748b;
}

.voice-phone-number {
  font-size: 1.35rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: 1px;
  font-family: monospace;
}

.voice-instruction-hint {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 9px;
  padding: 0.75rem 0.85rem;
  font-size: 0.775rem;
  line-height: 1.45;
  color: #1e40af;
}

.voice-code-instruction {
  font-size: 0.88rem;
  color: #1e293b;
  margin: 0 0 0.85rem 0;
  line-height: 1.4;
}

.voice-code-input-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0.85rem 0 0.5rem 0;
}

.voice-code-input {
  width: 280px;
  max-width: 90%;
  text-align: center;
  font-size: 2rem !important;
  font-weight: 800;
  letter-spacing: 12px;
  font-family: 'Consolas', 'Monaco', monospace;
  padding: 0.5rem 0.5rem 0.5rem 14px !important;
  border: 2.5px solid #2563eb !important;
  border-radius: 14px !important;
  background: #ffffff !important;
  color: #0f172a !important;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.15);
  transition: all 0.2s ease;
}

.voice-code-input::placeholder {
  color: #94a3b8;
  opacity: 0.6;
  letter-spacing: 12px;
  font-weight: 500;
}

.voice-code-input:focus {
  border-color: #1d4ed8 !important;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.25) !important;
  background: #ffffff !important;
  outline: none;
}

.voice-error-box {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  font-size: 0.78rem;
  margin-top: 0.5rem;
  text-align: center;
}

.voice-retry-container {
  margin-top: 0.85rem;
  text-align: center;
}

.voice-countdown-label {
  font-size: 0.775rem;
  color: #64748b;
}

.btn-link-action {
  background: none;
  border: none;
  color: #2563eb;
  font-size: 0.8rem;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
  padding: 0.2rem 0.5rem;
}

.btn-link-action:hover {
  color: #1d4ed8;
}

.voice-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 0.95rem 1.4rem 1.15rem 1.4rem;
  background: #f8fafc;
  border-top: 1px solid #f1f5f9;
}




/* =======================================================
   BANNER DE DECISIÓN DE SOPORTE & ASIGNACIÓN DE TICKET
======================================================= */
.ticket-decision-card {
  background: linear-gradient(135deg, #f0f9ff 0%, #ffffff 100%);
  border: 2px solid #0288d1;
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  margin-bottom: 0.75rem;
  box-shadow: 0 4px 14px rgba(2, 136, 209, 0.12);
}

.ticket-decision-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.ticket-id-tag-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ticket-num-badge {
  font-size: 0.85rem;
  font-weight: 800;
  color: #0288d1;
  background: #e0f2fe;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  letter-spacing: -0.01em;
}

.ticket-state-badge {
  font-size: 0.725rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.15rem 0.55rem;
  border-radius: 9999px;
  letter-spacing: 0.02em;
}

.badge-state-open {
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #fca5a5;
}

.badge-state-pending {
  background: #fef3c7;
  color: #d97706;
  border: 1px solid #fde68a;
}

.badge-state-closed {
  background: #dcfce7;
  color: #16a34a;
  border: 1px solid #bbf7d0;
}

.ticket-auto-save-tag {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.725rem;
  font-weight: 600;
  color: #059669;
  background: #ecfdf5;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  border: 1px solid #a7f3d0;
}

.ticket-decision-instruction {
  font-size: 0.825rem;
  color: #334155;
  margin: 0 0 0.65rem 0;
  line-height: 1.4;
}

.ticket-decision-button-row {
  display: flex;
  gap: 0.5rem;
}

.btn-support-ticket-action {
  background: linear-gradient(135deg, #0288d1, #01579b);
  color: #ffffff;
  font-size: 0.875rem;
  font-weight: 800;
  padding: 0.65rem 1.25rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 4px 12px rgba(2, 136, 209, 0.35);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-support-ticket-action:hover {
  background: #01579b;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(2, 136, 209, 0.45);
}

.btn-support-ticket-action.sent {
  background: #10b981 !important;
  color: #ffffff !important;
  cursor: default !important;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.35) !important;
  transform: none !important;
}

.ticket-status-select {
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 6px;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  border: 1.5px solid #cbd5e1;
  background: #ffffff;
  transition: all 0.2s ease;
}

.ticket-status-select:focus {
  outline: none;
  border-color: #0288d1;
  box-shadow: 0 0 0 2px rgba(2, 136, 209, 0.2);
}

/* =======================================================
   ESTILOS DE INVESTIGACIÓN PROFUNDA, FEEDBACK Y ENVÍO DE EMAIL
   ======================================================= */

/* Contenedor del Bloque de Investigación Profunda */
.deep-investigation-result-card {
  margin-top: 1.5rem;
  padding: 1.25rem 1.5rem;
  background: #f8fafc;
  border: 1.5px solid #818cf8;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.08);
  animation: fadeIn 0.3s ease-out;
}

.deep-investigation-result-card h3 {
  color: #4338ca;
  font-size: 1.05rem;
  font-weight: 700;
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.deep-investigation-result-card a {
  color: #2563eb;
  font-weight: 600;
  text-decoration: underline;
}

.deep-investigation-result-card a:hover {
  color: #1d4ed8;
}

/* Tarjeta de Feedback y Satisfacción */
.feedback-evaluation-card {
  margin-top: 1.5rem;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
  overflow: hidden;
  animation: fadeIn 0.3s ease-out;
}

.feedback-card-header {
  padding: 1rem 1.25rem;
  background: linear-gradient(135deg, #f0f7ff 0%, #e8f2fe 100%);
  border-bottom: 1px solid #dbeafe;
}

.feedback-title-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.feedback-badge-icon {
  font-size: 1.4rem;
  line-height: 1;
}

.feedback-card-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: #0f2d59;
}

.feedback-card-sub {
  margin: 0.15rem 0 0 0;
  font-size: 0.75rem;
  color: #64748b;
}

.feedback-card-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.feedback-question-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.feedback-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: #334155;
}

.feedback-solved-buttons {
  display: flex;
  gap: 0.75rem;
}

.btn-solved-choice {
  flex: 1;
  padding: 0.6rem 1rem;
  border: 1.5px solid #cbd5e1;
  background: #ffffff;
  border-radius: 8px;
  font-size: 0.825rem;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

.btn-solved-choice:hover {
  border-color: #94a3b8;
  background: #f8fafc;
}

.btn-solved-choice.selected-yes {
  border-color: #10b981;
  background: #ecfdf5;
  color: #065f46;
  font-weight: 700;
}

.btn-solved-choice.selected-no {
  border-color: #f59e0b;
  background: #fffbeb;
  color: #92400e;
  font-weight: 700;
}

/* Selector de Estrellas Interactivo */
.star-rating-container {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.star-btn {
  background: none;
  border: none;
  font-size: 1.6rem;
  color: #cbd5e1;
  cursor: pointer;
  padding: 0 0.15rem;
  transition: color 0.15s ease, transform 0.15s ease;
  line-height: 1;
}

.star-btn:hover,
.star-btn.hovered,
.star-btn.active {
  color: #f59e0b;
  transform: scale(1.15);
}

.star-rating-label {
  margin-left: 0.6rem;
  font-size: 0.775rem;
  font-weight: 600;
  color: #64748b;
}

/* Botón de Modo Profundo */
.deep-search-trigger-box {
  background: #faf5ff;
  border: 1px dashed #d8b4fe;
  border-radius: 10px;
  padding: 1rem;
  text-align: center;
}

.deep-search-prompt-text {
  margin: 0 0 0.65rem 0;
  font-size: 0.78rem;
  color: #6b21a8;
  line-height: 1.4;
}

.btn-trigger-deep {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  background: linear-gradient(135deg, #7c3aed 0%, #6366f1 100%);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-size: 0.825rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(124, 58, 237, 0.25);
  transition: all 0.2s ease;
}

.btn-trigger-deep:hover {
  background: linear-gradient(135deg, #6d28d9 0%, #4f46e5 100%);
  transform: translateY(-1px);
  box-shadow: 0 5px 14px rgba(124, 58, 237, 0.35);
}

.btn-trigger-deep:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

.deep-search-progress-bar {
  margin-top: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: #7c3aed;
}

.deep-search-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid #e9d5ff;
  border-top-color: #7c3aed;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Tarjeta de Envío de Copia Oficial en PDF por Correo */
.email-report-card {
  margin-top: 1.25rem;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
  overflow: hidden;
  animation: fadeIn 0.3s ease-out;
}

.email-card-header {
  padding: 1rem 1.25rem;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.email-header-icon {
  color: #0288d1;
}

.email-card-title {
  margin: 0;
  font-size: 0.925rem;
  font-weight: 700;
  color: #0f172a;
}

.email-card-sub {
  margin: 0.15rem 0 0 0;
  font-size: 0.75rem;
  color: #64748b;
}

.email-card-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.email-input-group {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.input-recipient-email {
  flex: 1;
  min-width: 220px;
  padding: 0.6rem 0.85rem;
  font-size: 0.85rem;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  outline: none;
  transition: border-color 0.2s ease;
}

.input-recipient-email:focus {
  border-color: #0288d1;
  box-shadow: 0 0 0 2px rgba(2, 136, 209, 0.15);
}

.btn-send-email-copy {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.6rem 1.1rem;
  background: #091c4f;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-size: 0.825rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-send-email-copy:hover {
  background: #1e3a8a;
  transform: translateY(-1px);
}

.btn-send-email-copy:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-direct-download-pdf {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.6rem 1rem;
  background: #ffffff;
  color: #0288d1;
  border: 1.5px solid #0288d1;
  border-radius: 8px;
  font-size: 0.825rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-direct-download-pdf:hover {
  background: #f0f9ff;
  transform: translateY(-1px);
}

.email-feedback-banner {
  padding: 0.6rem 0.85rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
}

.email-feedback-banner.success {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.email-feedback-banner.error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.email-disclaimer-notice {
  font-size: 0.725rem;
  color: #92400e;
  background: #fffbeb;
  border: 1px solid #fef3c7;
  border-radius: 6px;
  padding: 0.65rem 0.85rem;
  line-height: 1.45;
}

/* =======================================================
   ESTILOS DE EXPORTACIÓN DE PROMPT PARA ANTIGRAVITY / CLAUDE
   ======================================================= */

.btn-agent-prompt {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%) !important;
  color: #ffffff !important;
  border: 1px solid #6366f1 !important;
  font-weight: 700 !important;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3) !important;
  transition: all 0.2s ease !important;
}

.btn-agent-prompt:hover {
  background: linear-gradient(135deg, #4338ca 0%, #6d28d9 100%) !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.45) !important;
}

.agent-modal-card {
  background: #ffffff;
  border-radius: 14px;
  width: 90%;
  max-width: 860px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.35);
  border: 1px solid #cbd5e1;
  overflow: hidden;
  animation: modalScaleUp 0.25s ease-out;
}

.agent-modal-header {
  padding: 1.1rem 1.4rem;
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
  color: #ffffff;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.agent-header-title-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.agent-icon-badge {
  font-size: 1.75rem;
  line-height: 1;
}

.agent-modal-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  color: #ffffff;
}

.agent-modal-sub {
  margin: 0.2rem 0 0 0;
  font-size: 0.75rem;
  color: #c7d2fe;
}

.btn-close-agent-modal {
  background: none;
  border: none;
  color: #c7d2fe;
  font-size: 1.8rem;
  cursor: pointer;
  line-height: 1;
  padding: 0 0.25rem;
  transition: color 0.15s ease;
}

.btn-close-agent-modal:hover {
  color: #ffffff;
}

.agent-modal-body {
  padding: 1.25rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  overflow-y: auto;
  flex: 1;
  background: #f8fafc;
}

.agent-security-banner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: #fffbeb;
  border: 1.5px solid #fde68a;
  border-left: 4px solid #f59e0b;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.78rem;
  color: #92400e;
  line-height: 1.45;
}

.agent-prompt-preview-container {
  flex: 1;
  display: flex;
}

.agent-prompt-textarea {
  width: 100%;
  height: 380px;
  background: #0f172a;
  color: #e2e8f0;
  font-family: Consolas, Monaco, "Courier New", Courier, monospace;
  font-size: 0.78rem;
  line-height: 1.5;
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid #334155;
  outline: none;
  resize: vertical;
  white-space: pre-wrap;
}

.agent-prompt-textarea:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.25);
}

.agent-modal-footer {
  padding: 0.9rem 1.4rem;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.agent-copy-notice {
  font-size: 0.78rem;
  font-weight: 700;
  color: #15803d;
}

.agent-modal-action-buttons {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
}

.btn-copy-agent-main {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.35rem;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(79, 70, 229, 0.3);
  transition: all 0.2s ease;
}

.btn-copy-agent-main:hover {
  background: linear-gradient(135deg, #4338ca 0%, #6d28d9 100%);
  transform: translateY(-1px);
  box-shadow: 0 5px 15px rgba(79, 70, 229, 0.45);
}

/* =======================================================
   ESTILOS DE OPTIMIZACIÓN INTELIGENTE DE CAMPOS (BLUR IA)
   ======================================================= */

.ai-opt-badge-container {
  margin-left: auto;
  display: flex;
  align-items: center;
}

.ai-opt-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.25s ease;
  cursor: default;
}

.ai-opt-badge.loading {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  animation: pulseOpt 1.2s infinite ease-in-out;
}

.ai-opt-badge.success {
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #bbf7d0;
  box-shadow: 0 1px 4px rgba(22, 163, 74, 0.15);
}

.textarea-optimizing {
  border-color: #3b82f6 !important;
  background-color: #f8fafc !important;
  transition: border-color 0.3s ease;
}

.textarea-optimized-flash {
  border-color: #10b981 !important;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2) !important;
  transition: all 0.4s ease;
}

@keyframes pulseOpt {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(0.98); }
}

/* =======================================================
   ESTILOS DEL MODAL / MSGBOX PROACTIVO DE ENVÍO DE EMAIL
   ======================================================= */

.email-deep-modal-card {
  background: #ffffff;
  border-radius: 14px;
  width: 90%;
  max-width: 600px;
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.35);
  border: 1px solid #cbd5e1;
  overflow: hidden;
  animation: modalScaleUp 0.25s ease-out;
  display: flex;
  flex-direction: column;
}

.email-deep-modal-header {
  padding: 1.15rem 1.35rem;
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.email-deep-header-icon {
  background: rgba(255, 255, 255, 0.2);
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.email-deep-header-titles {
  flex: 1;
}

.email-deep-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.3;
}

.email-deep-subtitle {
  margin: 0.25rem 0 0 0;
  font-size: 0.76rem;
  color: #e0f2fe;
}

.email-deep-modal-body {
  padding: 1.35rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: #f8fafc;
}

.email-deep-disclaimer-box {
  background: #fffbeb;
  border: 1.5px solid #fde68a;
  border-left: 4px solid #f59e0b;
  border-radius: 8px;
  padding: 0.85rem 1rem;
}

.email-deep-disclaimer-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.76rem;
  font-weight: 800;
  color: #92400e;
  margin-bottom: 0.4rem;
}

.email-deep-disclaimer-text {
  margin: 0;
  font-size: 0.76rem;
  color: #78350f;
  line-height: 1.45;
}

.email-deep-pdf-preview-info {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.75rem 1rem;
}

.email-deep-input-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.email-deep-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: #334155;
}

.email-deep-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.email-deep-input-wrapper svg {
  position: absolute;
  left: 0.85rem;
  pointer-events: none;
}

.email-deep-input {
  width: 100%;
  padding: 0.65rem 0.85rem 0.65rem 2.4rem;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.85rem;
  outline: none;
  background: #ffffff;
  transition: border-color 0.2s ease;
}

.email-deep-input:focus {
  border-color: #0284c7;
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.2);
}

.email-deep-modal-footer {
  padding: 1rem 1.35rem;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.btn-send-deep-email {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.35rem;
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(2, 132, 199, 0.3);
  transition: all 0.2s ease;
}

.btn-send-deep-email:hover {
  background: linear-gradient(135deg, #0369a1 0%, #075985 100%);
  transform: translateY(-1px);
  box-shadow: 0 5px 14px rgba(2, 132, 199, 0.45);
}

/* Botón prominente de Panel Administrador en Header */
.btn-admin-header-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.85rem;
  background: #0f172a;
  color: #ffffff !important;
  border: 1.5px solid #334155;
  border-radius: 9px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.25);
  transition: all 0.2s ease;
}

.btn-admin-header-pill:hover {
  background: #1e293b;
  border-color: #64748b;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.35);
}

.btn-admin-header-pill svg {
  color: #38bdf8;
}

.btn-admin-header-pill .badge-vertex-counter {
  background: #ef4444;
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 0.15rem 0.45rem;
  border-radius: 10px;
  line-height: 1;
}

/* Botones en filas de tickets (ZIP y Prompt de Agente) */
.btn-row-zip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.35rem 0.65rem;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: #ffffff !important;
  border: none;
  border-radius: 6px;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(79, 70, 229, 0.25);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-row-zip:hover {
  background: linear-gradient(135deg, #4338ca 0%, #6d28d9 100%);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(79, 70, 229, 0.4);
}

.btn-row-prompt {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.35rem 0.65rem;
  background: #ffffff;
  color: #4338ca !important;
  border: 1px solid #c7d2fe;
  border-radius: 6px;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-row-prompt:hover {
  background: #eef2ff;
  border-color: #818cf8;
}

.btn-row-vertex {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.35rem 0.65rem;
  background: #f0f9ff;
  color: #0369a1 !important;
  border: 1px solid #bae6fd;
  border-radius: 6px;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-row-vertex:hover {
  background: #e0f2fe;
  border-color: #38bdf8;
  color: #0284c7 !important;
  transform: translateY(-1px);
}

/* Bloque de acceso directo a Administración en la Primera Ventana (Panel 1) */
.admin-access-block-panel1 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: #f1f5f9;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  padding: 0.65rem 0.85rem;
  margin-bottom: 1rem;
}

.btn-admin-pill-card {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: #0f172a;
  color: #ffffff !important;
  border: none;
  border-radius: 8px;
  padding: 0.45rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-admin-pill-card:hover {
  background: #1e293b;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(15, 23, 42, 0.25);
}

.btn-admin-pill-card svg {
  color: #38bdf8;
}

.admin-access-note {
  font-size: 0.72rem;
  color: #475569;
  font-weight: 600;
  line-height: 1.25;
}

/* =======================================================
   CENTRO DE GESTIÓN Y CONSULTA COMERCIAL (MICROAREA)
   ======================================================= */
.commercial-hub-container {
  display: none;
  flex-direction: column;
  gap: 1.1rem;
  margin-top: 0.8rem;
  animation: fadeIn 0.3s ease-in-out;
}

.commercial-hub-container.active {
  display: flex;
}

.comm-client-header {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 1.5px solid #fde68a;
  border-radius: 12px;
  padding: 0.9rem 1.1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  box-shadow: 0 2px 6px rgba(217, 119, 6, 0.08);
}

.comm-client-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.comm-client-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: #92400e;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.comm-client-meta {
  font-size: 0.78rem;
  color: #78350f;
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.comm-client-meta span {
  font-weight: 600;
}

.comm-actions-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.9rem;
}

@media (max-width: 768px) {
  .comm-actions-grid {
    grid-template-columns: 1fr;
  }
}

.comm-card {
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.comm-card:hover {
  border-color: #94a3b8;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.07);
  transform: translateY(-1px);
}

.comm-card.is-selected {
  border-color: #0284c7 !important;
  box-shadow: 0 0 0 2.5px rgba(2, 132, 199, 0.25), 0 4px 12px rgba(2, 132, 199, 0.1) !important;
  background: #f8fafc !important;
}

.comm-card-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.comm-card-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.icon-comm-bank { background: #e0f2fe; color: #0284c7; }
.icon-comm-cart { background: #fef3c7; color: #d97706; }
.icon-comm-pay  { background: #dcfce7; color: #16a34a; }
.icon-comm-debt { background: #fee2e2; color: #dc2626; }

.comm-card-title {
  font-size: 0.88rem;
  font-weight: 800;
  color: #0f172a;
}

.comm-card-desc {
  font-size: 0.78rem;
  color: #64748b;
  line-height: 1.35;
}

.comm-card-meta {
  font-size: 0.76rem;
  font-weight: 700;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  color: #334155;
}

.comm-btn-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.55rem 0.9rem;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all 0.2s ease;
  margin-top: auto;
}

.comm-btn-primary {
  background: #0284c7;
  color: #ffffff !important;
}
.comm-btn-primary:hover {
  background: #0369a1;
  transform: translateY(-1px);
}

.comm-btn-amber {
  background: #d97706;
  color: #ffffff !important;
}
.comm-btn-amber:hover {
  background: #b45309;
  transform: translateY(-1px);
}

.comm-btn-green {
  background: #16a34a;
  color: #ffffff !important;
}
.comm-btn-green:hover {
  background: #15803d;
  transform: translateY(-1px);
}

.comm-btn-slate {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
}
.comm-btn-slate:hover {
  background: #e2e8f0;
  color: #0f172a;
}

/* Modal / Subpanel Cambio de IBAN */
.comm-iban-panel {
  display: none;
  background: #f8fafc;
  border: 1.5px solid #0284c7;
  border-radius: 10px;
  padding: 0.9rem;
  margin-top: 0.5rem;
  animation: fadeIn 0.2s ease;
}

.comm-iban-input-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.4rem;
}

.comm-iban-input {
  width: 100%;
  font-family: monospace;
  font-size: 1rem;
  letter-spacing: 1.5px;
  font-weight: 700;
  padding: 0.55rem 0.75rem;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  color: #0f172a;
  background: #ffffff;
  outline: none;
  text-transform: uppercase;
}

.comm-iban-input:focus {
  border-color: #0284c7;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.2);
}

.comm-iban-status {
  font-size: 0.76rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.25rem;
}

.status-valid { color: #16a34a; }
.status-invalid { color: #dc2626; }

/* Subpanel Recibos e Impagados */
.comm-receipts-panel {
  display: none;
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  padding: 0.9rem;
  margin-top: 0.5rem;
  overflow-x: auto;
  animation: fadeIn 0.2s ease;
}

.comm-receipts-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  text-align: left;
}

.comm-receipts-table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 700;
  padding: 0.5rem 0.6rem;
  border-bottom: 2px solid #e2e8f0;
}

.comm-receipts-table td {
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid #f1f5f9;
  color: #1e293b;
}

.badge-paid {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  background: #dcfce7;
  color: #16a34a;
  border-radius: 4px;
  font-weight: 800;
  font-size: 0.68rem;
}

.badge-unpaid {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  background: #fee2e2;
  color: #dc2626;
  border-radius: 4px;
  font-weight: 800;
  font-size: 0.68rem;
}

/* Caja de Consulta Comercial Escrita */
.comm-custom-inquiry {
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.comm-custom-title {
  font-size: 0.88rem;
  font-weight: 800;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.comm-custom-textarea {
  width: 100%;
  min-height: 85px;
  padding: 0.7rem;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.82rem;
  font-family: inherit;
  color: #0f172a;
  resize: vertical;
}

.comm-custom-textarea:focus {
  border-color: #f59e0b;
  outline: none;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
}

/* =======================================================
   ESTILOS PARA PROGRAMAS Y MANTENIMIENTOS DEL CLIENTE
   ======================================================= */
.comm-programs-section {
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 1rem 1.1rem;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
}

.comm-programs-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #f1f5f9;
}

.comm-programs-title {
  font-size: 0.9rem;
  font-weight: 800;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.comm-programs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 0.85rem;
}

.comm-prog-card {
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.comm-prog-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
  border-color: #94a3b8;
}

.comm-prog-card.is-active {
  border-color: #86efac;
  background: linear-gradient(135deg, #f0fdf4 0%, #ffffff 100%);
  box-shadow: 0 2px 6px rgba(34, 197, 94, 0.08);
}

.comm-prog-card.is-historical {
  border-color: #e2e8f0;
  background: #f8fafc;
  opacity: 0.88;
}

.comm-prog-card.is-selected {
  border-color: #0284c7 !important;
  box-shadow: 0 0 0 2.5px rgba(2, 132, 199, 0.3), 0 4px 14px rgba(2, 132, 199, 0.15) !important;
  background: #f0f9ff !important;
  transform: translateY(-2px);
}

.comm-prog-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}

.comm-prog-name {
  font-size: 0.9rem;
  font-weight: 800;
  color: #0f172a;
}

.comm-prog-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  white-space: nowrap;
}

.badge-active-maint {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.badge-historical-maint {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #cbd5e1;
}

.comm-prog-meta {
  font-size: 0.77rem;
  color: #475569;
  line-height: 1.4;
}

.comm-prog-modules-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.25rem;
}

.comm-module-chip {
  font-size: 0.7rem;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #334155;
  padding: 0.15rem 0.45rem;
  border-radius: 5px;
  font-weight: 600;
}

.comm-prog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: auto;
  padding-top: 0.4rem;
}

.comm-prog-btn {
  font-size: 0.74rem;
  font-weight: 700;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.comm-prog-btn-cart {
  background: #f59e0b;
  color: #ffffff !important;
}

.comm-prog-btn-cart:hover {
  background: #d97706;
  transform: translateY(-1px);
}

.comm-prog-btn-info {
  background: #f1f5f9;
  color: #334155 !important;
  border: 1px solid #cbd5e1;
}

.comm-prog-btn-info:hover {
  background: #e2e8f0;
  color: #0f172a !important;
}

/* ========================================================
   MODO COMERCIAL: LAYOUT ADAPTATIVO (2 COLUMNAS)
   ======================================================== */
.panels-grid.is-commercial-mode {
  grid-template-columns: 1.05fr 1.35fr !important;
}

.panels-grid.is-commercial-mode #sectionCapture,
.panels-grid.is-commercial-mode #btnGenerateTicket,
.panels-grid.is-commercial-mode #problemFieldsContainer,
.panels-grid.is-commercial-mode .urgency-block,
.panels-grid.is-commercial-mode .urgency-selector-container {
  display: none !important;
}

/* Espacio de Trabajo Comercial en Columna 3 */
.commercial-workstation-state {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  padding: 0.25rem 0.15rem;
}

.comm-ws-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.85rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
  gap: 0.75rem;
}

.comm-ws-title-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.comm-ws-icon-circle {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #16a34a;
  flex-shrink: 0;
}

.comm-ws-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
  line-height: 1.2;
}

.comm-ws-sub {
  font-size: 0.75rem;
  color: #64748b;
  margin: 2px 0 0 0;
}

.comm-ws-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #334155;
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  font-size: 0.775rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  transition: all 0.15s ease;
}

.comm-ws-back-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}

/* Contenedor de contenido dinámico */
.comm-ws-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Tarjetas y componentes dentro del Espacio Comercial */
.ws-overview-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.ws-kpi-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 0.85rem 1rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.ws-kpi-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  font-weight: 700;
  color: #64748b;
  letter-spacing: 0.5px;
}

.ws-kpi-val {
  font-size: 1.15rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0.35rem 0;
}

.ws-kpi-link {
  font-size: 0.75rem;
  color: #2563eb;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.ws-kpi-link:hover {
  text-decoration: underline;
}

.ws-section-box {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1.15rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}

.ws-section-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Listado de módulos en Columna 3 */
.ws-module-item {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.65rem;
  transition: border-color 0.15s, background-color 0.15s;
}

.ws-module-item:hover {
  border-color: #cbd5e1;
  background: #ffffff;
}

.ws-module-info {
  display: flex;
  flex-direction: column;
}

.ws-module-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: #0f172a;
}

.ws-module-desc {
  font-size: 0.75rem;
  color: #64748b;
  margin-top: 2px;
}

.ws-module-btn {
  background: #0284c7;
  color: #ffffff;
  border: none;
  padding: 0.4rem 0.85rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}

.ws-module-btn:hover {
  background: #0369a1;
}

.ws-table-container {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.ws-module-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.ws-module-price {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.84rem;
  font-weight: 800;
  color: #0f172a;
  background: #f1f5f9;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  white-space: nowrap;
}

.ws-module-price small {
  font-size: 0.65rem;
  color: #64748b;
  font-weight: 600;
}

.ws-module-btn.is-added {
  background: #16a34a !important;
}

.ws-module-btn.is-added:hover {
  background: #15803d !important;
}

/* Carrito Comercial Totalizado */
.ws-cart-box {
  background: #ffffff;
  border: 2px solid #0284c7;
  border-radius: 12px;
  padding: 1.1rem 1.25rem;
  box-shadow: 0 4px 16px rgba(2, 132, 199, 0.09);
  margin-top: 1rem;
}

.ws-cart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid #e2e8f0;
}

.ws-cart-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  font-weight: 800;
  color: #0f172a;
}

.ws-cart-badge-count {
  background: #0284c7;
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.15rem 0.55rem;
  border-radius: 10px;
}

.ws-cart-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 0.85rem;
}

.ws-cart-table th {
  font-size: 0.72rem;
  text-transform: uppercase;
  color: #64748b;
  font-weight: 700;
  padding: 0.45rem 0.65rem;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}

.ws-cart-table td {
  padding: 0.6rem 0.65rem;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.8rem;
  color: #1e293b;
  vertical-align: middle;
}

.ws-cart-qty-group {
  display: inline-flex;
  align-items: center;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  overflow: hidden;
}

.ws-cart-qty-btn {
  background: #f8fafc;
  border: none;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: 800;
  color: #334155;
  transition: background 0.15s;
}

.ws-cart-qty-btn:hover {
  background: #e2e8f0;
}

.ws-cart-qty-num {
  padding: 0 0.5rem;
  font-weight: 700;
  font-size: 0.78rem;
}

.ws-cart-btn-del {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 0.25rem 0.4rem;
  border-radius: 4px;
  font-size: 0.85rem;
  transition: color 0.15s;
}

.ws-cart-btn-del:hover {
  color: #dc2626;
  background: #fee2e2;
}

.ws-cart-summary {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.ws-cart-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  color: #475569;
}

.ws-cart-summary-row.is-total {
  font-size: 1.05rem;
  font-weight: 800;
  color: #0f172a;
  border-top: 1.5px solid #cbd5e1;
  padding-top: 0.5rem;
  margin-top: 0.25rem;
}

.ws-cart-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  justify-content: flex-end;
}









