/* ==========================================================================
   SISTEMA DE DISEÑO · PORTAL DE COMPLIANCE PENAL (INNOVA IBÉRICA)
   Variables, tipografía, componentes base.
   ========================================================================== */
:root {
    /* Paleta principal */
    --blue-primary: #143f4d;
    --blue-primary-hover: #0e2e3a;
    --blue-dark: #0e2e3a;
    --blue-medium: #1d5a6e;
    --blue-soft: #f0f7fa;
    --blue-border: #bae6fd;

    --orange-primary: #ff6a00;
    --orange-hover: #e85f00;
    --orange-soft: #fff0e6;
    --orange-dark: #9a3412;
    --orange-border: #fdba74;

    /* Estados semánticos */
    --success: #15803d;
    --success-dark: #166534;
    --success-bg: #ecfdf5;
    --success-border: #86efac;

    --warning: #b45309;
    --warning-bg: #fffbea;
    --warning-border: #fdba74;

    --danger: #b91c1c;
    --danger-dark: #991b1b;
    --danger-bg: #fef2f2;
    --danger-border: #fca5a5;

    --info: #075985;
    --info-bg: #f0f7fa;
    --info-border: #bae6fd;

    /* Niveles de riesgo */
    --risk-low: #bbf7d0;
    --risk-low-text: #166534;
    --risk-medium: #fef3c7;
    --risk-medium-text: #854d0e;
    --risk-high: #fed7aa;
    --risk-high-text: #9a3412;
    --risk-critical: #fecaca;
    --risk-critical-text: #991b1b;

    /* Superficies */
    --bg-page: #eef3f5;
    --bg-section: #fafcfd;
    --bg-card: #ffffff;
    --bg-neutral: #f8fafc;

    /* Texto */
    --text-primary: #1a1a1a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --text-soft: #94a3b8;

    /* Bordes */
    --border-soft: #e2e8f0;
    --border-medium: #cbd5e1;
    --border-strong: #94a3b8;

    /* Radios */
    --radius-xs: 6px;
    --radius-sm: 8px;
    --radius-md: 10px;
    --radius-lg: 12px;
    --radius-xl: 14px;
    --radius-2xl: 16px;
    --radius-pill: 999px;

    /* Sombras */
    --shadow-soft: 0 4px 12px rgba(15, 23, 42, 0.06);
    --shadow-medium: 0 8px 18px rgba(15, 23, 42, 0.08);
    --shadow-strong: 0 15px 40px rgba(0, 0, 0, 0.15);
    --shadow-orange: 0 8px 18px rgba(255, 106, 0, 0.25);
}

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

body {
    font-family: 'Inter', system-ui, sans-serif;
    background-color: var(--bg-page);
    color: var(--text-primary);
    line-height: 1.55;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 15px;
}

/* ============================================================================
   TIPOGRAFÍA — JERARQUÍA VISUAL
   ----------------------------------------------------------------------------
   Cada nivel de título tiene un tamaño, peso y tracking claramente
   diferenciados para que la jerarquía sea evidente sin esfuerzo visual.
   ============================================================================ */

h1, h2, h3, h4, h5 {
    color: var(--blue-primary);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

/* h1 — Título de página (raramente usado, principalmente para hero/landing) */
h1 {
    font-size: 32px;
    line-height: 1.15;
    margin-bottom: 12px;
    letter-spacing: -0.02em;
    font-weight: 800;
}

/* h2 — Cabecera principal de cada pantalla (Mapa de riesgos, Cuestionario, etc.) */
h2 {
    font-size: 26px;
    line-height: 1.2;
    margin-bottom: 8px;
    letter-spacing: -0.015em;
    font-weight: 700;
}

/* h3 — Cabecera de bloque/sección dentro de una pantalla */
h3 {
    font-size: 20px;
    line-height: 1.25;
    margin-bottom: 8px;
    margin-top: 4px;
    letter-spacing: -0.01em;
    font-weight: 650;
}

/* h4 — Cabecera menor (tarjetas, sub-bloques) */
h4 {
    font-size: 16px;
    line-height: 1.3;
    margin-bottom: 6px;
    letter-spacing: 0;
    font-weight: 600;
    color: var(--text-primary);
}

/* h5 — Etiquetas mini (poco usado) */
h5 {
    font-size: 13px;
    line-height: 1.3;
    margin-bottom: 4px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--text-secondary);
}

.subtitle {
    font-size: 15px;
    color: var(--text-muted);
    margin-bottom: 24px;
    line-height: 1.55;
    font-weight: 400;
}

/* Subtítulo más compacto, para usar pegado al título sin tanto margen inferior */
.subtitle-tight {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 16px;
    line-height: 1.5;
    font-weight: 400;
}

.hidden { display: none !important; }

.app-wrapper {
    width: 100%;
    max-width: 1100px;
    padding: 20px 20px 40px;
}

/* ==========================================================================
   CABECERA DE MARCA (se repite en todas las pantallas internas)
   ========================================================================== */
.portal-header {
    background: var(--bg-card);
    padding: 14px 22px;
    border-radius: var(--radius-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    border: 1px solid var(--border-soft);
}

.portal-header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.portal-header-logo {
    width: 32px;
    height: 32px;
    background: var(--blue-dark);
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 800;
    font-size: 13px;
    overflow: hidden;
}

.portal-header-logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.portal-header-title {
    font-weight: 700;
    font-size: 13px;
    color: var(--blue-primary);
    line-height: 1.1;
}

.portal-header-subtitle {
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: 0.3px;
    margin-top: 2px;
}

.portal-header-step {
    display: flex;
    align-items: center;
    gap: 6px;
}

.portal-step-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 600;
}

.portal-step-badge .step-num {
    background: var(--blue-primary);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
}

.portal-step-separator {
    color: var(--border-medium);
    font-size: 11px;
}

.portal-step-total {
    font-size: 11px;
    color: var(--text-soft);
}

.brand-container { display: none; }

/* ==========================================================================
   TARJETA PRINCIPAL
   ========================================================================== */
.card-panel {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: 28px 28px 24px;
    box-shadow: var(--shadow-soft);
    width: 100%;
    border: 1px solid var(--border-soft);
    margin-bottom: 16px;
}

.card-panel h1 { font-size: 28px; margin-bottom: 6px; text-align: left; letter-spacing: -0.02em; }
.card-panel h2 { font-size: 24px; margin-bottom: 6px; text-align: left; letter-spacing: -0.015em; }
.card-panel > .subtitle { font-size: 14.5px; text-align: left; margin-bottom: 22px; }

/* ==========================================================================
   FORMULARIO
   ========================================================================== */
.form-group {
    margin-bottom: 16px;
    text-align: left;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    letter-spacing: 0.1px;
}

.form-group input,
.form-group select,
.form-group textarea,
#resumenEjecutivoInput,
#actividadRealInput,
#nombreEntidad {
    width: 100% !important;
    padding: 10px 12px !important;
    border: 1px solid var(--border-medium) !important;
    border-radius: var(--radius-sm) !important;
    font-size: 14px !important;
    background-color: var(--bg-card) !important;
    font-family: 'Inter', system-ui, sans-serif !important;
    color: var(--text-primary) !important;
    transition: border-color 0.15s, box-shadow 0.15s !important;
    outline: none !important;
    box-sizing: border-box !important;
    display: block !important;
    line-height: 1.5 !important;
}

.form-group input:hover,
.form-group select:hover,
.form-group textarea:hover {
    border-color: var(--border-strong) !important;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--blue-primary) !important;
    box-shadow: 0 0 0 3px rgba(20, 63, 77, 0.1) !important;
}

#nombreEntidad {
    font-weight: 700 !important;
    color: var(--blue-primary) !important;
}

.form-group select {
    appearance: none !important;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23143f4d'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    background-size: 16px !important;
    padding-right: 36px !important;
}

/* ==========================================================================
   BOTONES
   ========================================================================== */
.blue-button {
    background-color: var(--orange-primary);
    color: white;
    border: none;
    padding: 13px 28px;
    border-radius: var(--radius-lg);
    font-weight: 700;
    cursor: pointer;
    font-size: 14px;
    transition: transform 0.15s ease, background-color 0.15s, box-shadow 0.15s;
    text-decoration: none;
    display: inline-block;
    box-shadow: var(--shadow-orange);
    letter-spacing: 0.2px;
    font-family: inherit;
}

.blue-button:hover {
    background-color: var(--orange-hover);
    transform: translateY(-1px);
}

.blue-button:active { transform: translateY(0); }

.blue-button.secondary-button {
    background: var(--bg-card);
    color: var(--blue-primary);
    border: 1px solid var(--blue-primary);
    box-shadow: none;
}

.blue-button.secondary-button:hover {
    background: var(--blue-soft);
}

.btn-primary {
    background: var(--blue-primary);
    color: white;
    border: none;
    border-radius: var(--radius-lg);
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.15s, transform 0.15s;
    font-family: inherit;
    font-size: 14px;
}

.btn-primary:hover { background: var(--blue-primary-hover); transform: translateY(-1px); }
.btn-large { padding: 14px 30px; font-size: 13px; letter-spacing: 0.3px; }

/* ==========================================================================
   SECCIÓN EJECUTIVA
   ========================================================================== */
.executive-section {
    text-align: left;
    margin-bottom: 20px;
    padding: 22px;
    background: var(--bg-section);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-soft);
}

.executive-section > h4 {
    font-size: 13px;
    font-weight: 700;
    color: var(--blue-primary);
    letter-spacing: 0.2px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-soft);
    margin-bottom: 16px;
}

/* ==========================================================================
   BLOQUE FICHA CIF (pantalla de acceso inicial)
   ========================================================================== */
.bloque-cif {
    width: 100%;
    margin: 0;
    padding: 0;
    background: transparent;
    box-shadow: none;
    border-radius: 0;
    border: none;
}

.bloque-cif .form-group { margin-bottom: 18px; }

.upload-box {
    border: 1.5px dashed var(--border-medium);
    border-radius: var(--radius-lg);
    padding: 20px 22px;
    background: var(--bg-section);
    margin: 20px 0 18px;
    transition: background 0.15s, border-color 0.15s;
}

.upload-box:hover {
    border-color: var(--orange-primary);
    background: var(--orange-soft);
}

#cifInput {
    font-size: 16px !important;
    font-weight: 700 !important;
    letter-spacing: 0.5px;
    color: var(--blue-primary) !important;
}

.bloque-cif-btn {
    width: 100%;
    max-width: 560px;
    display: block;
    margin: 22px auto 0;
    font-size: 14px;
    padding: 14px 28px;
}

#documentosInput {
    width: 100%;
    font-size: 13px;
    padding: 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-medium);
    background: var(--bg-card);
    cursor: pointer;
}

#documentosInput::file-selector-button {
    background: var(--blue-primary);
    color: white;
    border: none;
    padding: 8px 14px;
    border-radius: var(--radius-xs);
    margin-right: 12px;
    font-weight: 600;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.15s;
    font-family: inherit;
}

#documentosInput::file-selector-button:hover {
    background: var(--blue-primary-hover);
}

/* ==========================================================================
   BLOQUES CON NÚMERO E INSTRUCCIONES (Ficha técnica)
   ========================================================================== */
.ficha-3-bloques {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
    margin-bottom: 22px;
}

.ficha-bloque {
    background: var(--bg-section);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.bloque-con-numero {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
}

.bloque-numero {
    width: 24px;
    height: 24px;
    border-radius: var(--radius-xs);
    background: var(--blue-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
    flex-shrink: 0;
}

.bloque-titulo {
    font-size: 14px;
    font-weight: 700;
    color: var(--blue-primary);
    letter-spacing: 0.1px;
}

.instruccion-bloque {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.55;
    margin-bottom: 14px;
    padding-left: 34px;
}

.instruccion-bloque strong { color: var(--text-secondary); }

/* Banner entidad localizada */
.entidad-localizada {
    background: var(--success-bg);
    border: 1px solid var(--success-border);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    margin-bottom: 22px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.entidad-localizada-check {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--success);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 13px;
    flex-shrink: 0;
}

.entidad-localizada-content {
    flex: 1;
    min-width: 200px;
}

.entidad-localizada-label {
    font-size: 11px;
    color: #065f46;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.entidad-localizada-name {
    font-size: 14px;
    color: #064e3b;
    font-weight: 700;
    margin-top: 2px;
}

.entidad-localizada-name .cif-gray {
    font-weight: 500;
    color: #047857;
}

.entidad-localizada-date {
    font-size: 11px;
    color: #059669;
    font-weight: 600;
}

/* Bloques destacados */
.bloque-destacado {
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    margin: 18px 0;
}

.bloque-destacado-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    flex-wrap: wrap;
    gap: 8px;
}

.bloque-destacado-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.1px;
}

.bloque-destacado-icon {
    width: 24px;
    height: 24px;
    border-radius: var(--radius-xs);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
}

.bloque-actividad-real {
    background: #fff7ed;
    border: 1px solid var(--orange-border);
}

.bloque-actividad-real .bloque-destacado-title { color: #9a3412; }
.bloque-actividad-real .bloque-destacado-icon { background: #c2410c; }
.bloque-actividad-real .instruccion-bloque { color: #7c2d12; margin-bottom: 10px; padding-left: 34px; }
.bloque-actividad-real textarea {
    border: 1px solid var(--orange-border) !important;
    background: var(--bg-card) !important;
    line-height: 1.55 !important;
}

.bloque-resumen-ia {
    background: var(--blue-soft);
    border: 1px solid var(--info-border);
}

.bloque-resumen-ia .bloque-destacado-title { color: var(--blue-primary); }
.bloque-resumen-ia .bloque-destacado-icon { background: var(--blue-primary); }
.bloque-resumen-ia .instruccion-bloque { color: var(--text-secondary); margin-bottom: 10px; padding-left: 34px; }
.bloque-resumen-ia textarea {
    border: 1px solid var(--info-border) !important;
    background: var(--bg-card) !important;
}

#analisisDocumentalContainer {
    background: var(--danger-bg) !important;
    border: 1px solid var(--danger-border) !important;
    border-radius: var(--radius-lg) !important;
    padding: 18px 20px !important;
    margin: 16px 0 !important;
}

#analisisDocumentalContainer > label {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    color: #991b1b !important;
    margin-bottom: 6px !important;
    letter-spacing: 0.1px !important;
}

#analisisDocumentalContainer > label::before {
    content: "!";
    width: 24px;
    height: 24px;
    border-radius: var(--radius-xs);
    background: var(--danger);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 13px;
    flex-shrink: 0;
}

#resumenDocumentalIA {
    font-size: 13px;
    color: #7f1d1d;
    line-height: 1.55;
    background: var(--bg-card);
    border: 1px solid var(--danger-border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    margin-top: 10px;
    white-space: pre-wrap;
}

/* Píldoras */
.pill {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.pill-orange { background: #fef3c7; color: #92400e; }
.pill-blue { background: #dbeafe; color: #1e40af; }
.pill-red { background: #fee2e2; color: #991b1b; }
.pill-green { background: #dcfce7; color: #166534; }
.pill-gray { background: var(--bg-neutral); color: var(--text-secondary); }

/* ==========================================================================
   CUESTIONARIO
   ========================================================================== */
.question-card {
    background: var(--bg-card);
    padding: 20px;
    border-radius: var(--radius-lg);
    margin-bottom: 14px;
    border: 1px solid var(--border-soft);
    box-shadow: var(--shadow-soft);
}

.question-title-main {
    font-size: 16px;
    line-height: 1.45;
    color: var(--blue-primary);
    font-weight: 700;
    margin-bottom: 10px;
    text-align: left;
}

.question-title {
    font-size: 15px;
    color: var(--blue-primary);
    margin-bottom: 10px;
    display: block;
    font-weight: 700;
}

.question-related-crimes {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 12px;
    background: var(--bg-neutral);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
}

.options-group {
    display: flex;
    gap: 20px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.options-group-vertical { flex-direction: column; gap: 8px; }

.options-group label,
.options-group-vertical label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    padding: 2px 0;
}

.options-group input[type="radio"],
.options-group-vertical input[type="radio"] {
    accent-color: var(--orange-primary);
    transform: scale(1.1);
    cursor: pointer;
}

/* ==========================================================================
   PANTALLA DE RESULTADOS
   ========================================================================== */
.empresa-banner {
    background: var(--bg-neutral);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.empresa-banner-identity {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 200px;
}

.empresa-banner-avatar {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-xs);
    background: var(--blue-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 11px;
    flex-shrink: 0;
}

.empresa-banner-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--blue-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.empresa-banner-meta {
    font-size: 11px;
    color: var(--text-muted);
}

.empresa-banner-profile {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
    padding-left: 16px;
    border-left: 1px solid var(--border-soft);
    text-align: right;
}

.empresa-banner-profile strong { color: var(--blue-primary); }

.resultados-title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 14px;
    flex-wrap: wrap;
    gap: 12px;
}

.resultados-fecha {
    text-align: right;
}

.resultados-fecha-label {
    font-size: 11px;
    color: var(--text-soft);
    font-weight: 500;
}

.resultados-fecha-valor {
    font-size: 12px;
    color: var(--blue-primary);
    font-weight: 700;
}

.resultados-hero {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 16px;
    margin-bottom: 22px;
}

.score-box {
    background: linear-gradient(140deg, var(--blue-primary) 0%, var(--blue-medium) 100%);
    border-radius: var(--radius-xl);
    padding: 22px 20px;
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    position: relative;
    overflow: hidden;
    min-height: 150px;
}

.score-box::before {
    content: "";
    position: absolute;
    top: -40px;
    right: -40px;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(255, 106, 0, 0.1);
}

.score-box-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.8px;
    color: rgba(255, 255, 255, 0.75);
    text-transform: uppercase;
    margin-bottom: 8px;
    position: relative;
    z-index: 2;
}

.score-number {
    font-size: 54px;
    font-weight: 800;
    color: white;
    line-height: 1;
    margin-bottom: 6px;
    position: relative;
    z-index: 2;
}

.score-number .score-percent {
    font-size: 28px;
    font-weight: 700;
    color: var(--orange-primary);
}

.score-box-desc {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.4;
    position: relative;
    z-index: 2;
    max-width: 180px;
}

.contadores-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 10px;
}

.contador-card {
    border-radius: var(--radius-lg);
    padding: 14px 14px 12px;
    border: 1px solid;
}

.contador-card-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

.contador-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.contador-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.contador-numero {
    font-size: 28px;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 3px;
}

.contador-desc {
    font-size: 10px;
    line-height: 1.3;
}

.contador-critico { background: var(--danger-bg); border-color: var(--danger-border); }
.contador-critico .contador-dot { background: var(--danger); }
.contador-critico .contador-label, .contador-critico .contador-numero, .contador-critico .contador-desc { color: var(--danger-dark); }

.contador-alto { background: #fff7ed; border-color: var(--orange-border); }
.contador-alto .contador-dot { background: #c2410c; }
.contador-alto .contador-label, .contador-alto .contador-numero, .contador-alto .contador-desc { color: #9a3412; }

.contador-medio { background: #fefce8; border-color: #fde047; }
.contador-medio .contador-dot { background: #a16207; }
.contador-medio .contador-label, .contador-medio .contador-numero, .contador-medio .contador-desc { color: #854d0e; }

.contador-bajo { background: var(--success-bg); border-color: var(--success-border); }
.contador-bajo .contador-dot { background: var(--success); }
.contador-bajo .contador-label, .contador-bajo .contador-numero, .contador-bajo .contador-desc { color: var(--success-dark); }

#textoResultadoGlobal { display: none; }

/* Matriz */
.matrix-container {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    margin: 0 0 16px 0;
    width: 100%;
}

/* ==========================================================================
   DOBLE MATRIZ (Chile · Ley 20.393): Inherente + Residual lado a lado
   ========================================================================== */
.matrices-doble {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin: 0 0 16px 0;
    width: 100%;
}

.matriz-columna {
    background: var(--bg-section);
    border-radius: var(--radius-xl);
    padding: 18px;
    border: 1px solid var(--border-soft);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.matriz-columna-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
}

.matriz-columna-titulo {
    font-size: 13px;
    font-weight: 700;
    color: var(--blue-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 0.1px;
}

.matriz-columna-titulo-icon {
    width: 20px;
    height: 20px;
    border-radius: var(--radius-xs);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 800;
    font-size: 11px;
}

.matriz-columna-titulo-icon.icon-inherente {
    background: var(--warning);
}

.matriz-columna-titulo-icon.icon-residual {
    background: var(--success);
}

.matriz-columna-subtitulo {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 2px;
}

.reduccion-banner {
    background: var(--success-bg);
    border: 1px solid var(--success-border);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    margin: 0 0 16px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.reduccion-banner-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--success-dark);
    letter-spacing: 0.2px;
}

.reduccion-banner-valor {
    font-size: 20px;
    font-weight: 800;
    color: var(--success-dark);
    line-height: 1;
}

.reduccion-banner-desc {
    font-size: 11px;
    color: #166534;
    line-height: 1.45;
    flex: 1;
    min-width: 180px;
}

@media (max-width: 900px) {
    .matrices-doble {
        grid-template-columns: 1fr;
    }
}

.matrix-block {
    background: var(--bg-section);
    border-radius: var(--radius-xl);
    padding: 22px;
    border: 1px solid var(--border-soft);
    width: 100%;
    margin: 0 auto;
}

.matrix-title-main {
    font-size: 14px;
    font-weight: 700;
    color: var(--blue-primary);
    margin-bottom: 14px;
}

.criterio-matriz {
    background: var(--info-bg);
    border: 1px solid var(--info-border);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    margin-bottom: 14px;
}

.criterio-matriz-title {
    font-size: 12px;
    font-weight: 700;
    color: #0c4a6e;
    margin-bottom: 6px;
}

.criterio-matriz-text {
    font-size: 12px;
    color: #075985;
    line-height: 1.55;
}

.aviso-probabilidad {
    background: var(--warning-bg);
    border-left: 4px solid var(--warning);
    border-radius: var(--radius-xs);
    padding: 12px 16px;
    margin-bottom: 22px;
}

.aviso-probabilidad-title {
    font-size: 11px;
    font-weight: 700;
    color: #92400e;
    margin-bottom: 3px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.aviso-probabilidad-text {
    font-size: 12px;
    color: #78350f;
    line-height: 1.55;
}

/* Tabla delitos */
.tabla-delitos-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 10px;
}

.tabla-delitos-header-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--blue-primary);
    line-height: 1.2;
}

.tabla-delitos-header-sub {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.compliance-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-soft);
}

.compliance-table th {
    background: var(--blue-primary);
    color: white;
    padding: 12px 14px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    text-align: center;
}

.compliance-table td {
    padding: 14px 14px;
    border-bottom: 1px solid var(--border-soft);
    text-align: center;
    vertical-align: middle;
    font-size: 13px;
}

.compliance-table tbody tr:last-child td { border-bottom: none; }
.compliance-table tbody tr:hover { background: var(--bg-neutral); }

.text-left {
    text-align: left !important;
    padding-left: 18px !important;
}

.crime-name-cell {
    font-weight: 700;
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.4;
}

.metric-number {
    font-size: 18px;
    font-weight: 800;
    color: var(--blue-primary);
    line-height: 1;
    margin-bottom: 3px;
}

.metric-text {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 600;
}

/* Badge riesgo */
.badge-risk {
    display: inline-block;
    font-size: 10px;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.badge-risk.bajo, .badge-risk.riesgo-bajo, .badge-risk.risk-bajo {
    background: var(--success-bg);
    color: var(--success-dark);
}

.badge-risk.medio, .badge-risk.riesgo-medio, .badge-risk.risk-medio {
    background: #fefce8;
    color: #854d0e;
}

.badge-risk.alto, .badge-risk.riesgo-alto, .badge-risk.risk-alto {
    background: #fff7ed;
    color: #9a3412;
}

.badge-risk.critico, .badge-risk.riesgo-critico, .badge-risk.risk-critico {
    background: var(--danger-bg);
    color: var(--danger-dark);
}

/* Badge grande de riesgo (Nivel riesgo en la tabla): usa el color exacto
   de la celda de la matriz via inline-style en JS */
.badge-risk-big {
    display: inline-block;
    min-width: 44px;
    padding: 7px 14px;
    border-radius: var(--radius-pill);
    font-size: 18px;
    font-weight: 800;
    color: #0e2e3a;
    letter-spacing: 0.3px;
    line-height: 1;
    text-align: center;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.prob-muy-baja .metric-number, .impacto-muy-bajo .metric-number { color: var(--success-dark); }
.prob-baja .metric-number, .impacto-bajo .metric-number { color: #166534; }
.prob-media .metric-number, .impacto-medio .metric-number { color: #854d0e; }
.prob-alta .metric-number, .impacto-alto .metric-number { color: #9a3412; }
.prob-muy-alta .metric-number, .impacto-muy-alto .metric-number { color: var(--danger-dark); }

.prob-muy-baja .metric-text, .impacto-muy-bajo .metric-text { color: var(--success-dark); }
.prob-baja .metric-text, .impacto-bajo .metric-text { color: #166534; }
.prob-media .metric-text, .impacto-medio .metric-text { color: #854d0e; }
.prob-alta .metric-text, .impacto-alto .metric-text { color: #9a3412; }
.prob-muy-alta .metric-text, .impacto-muy-alto .metric-text { color: var(--danger-dark); }

.status-pill {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    letter-spacing: 0.3px;
}

.status-pill.pill-blue { background: #dbeafe; color: #1e40af; }
.status-pill.pill-gray { background: var(--bg-neutral); color: var(--text-muted); }

.btn-expand {
    background: var(--bg-card);
    border: 1px solid var(--border-medium);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
    padding: 5px 11px;
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: background 0.15s;
    font-family: inherit;
}

.btn-expand:hover { background: var(--bg-neutral); }
.btn-expand .icon { color: var(--orange-primary); font-weight: 700; margin-right: 3px; }

.detail-cell {
    padding: 0 !important;
    background: var(--bg-section);
}

.detail-wrapper {
    padding: 18px 22px;
    text-align: left;
}

.detail-block { margin-bottom: 18px; }
.detail-block:last-child { margin-bottom: 0; }

/* ==========================================================================
   DELITOS INDIVIDUALES (Bloque 6 expandible · Chile · Ley 20.393)
   ========================================================================== */
.delitos-individuales-lista {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.delito-individual-card {
    background: white;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: border-color 0.15s ease;
}

.delito-individual-card:hover {
    border-color: var(--blue-primary);
}

.delito-individual-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    cursor: pointer;
    gap: 12px;
    background: var(--bg-section);
    transition: background 0.15s ease;
}

.delito-individual-header:hover {
    background: var(--bg-section-hover, #eef4f7);
}

.delito-individual-titulo {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.delito-individual-numero {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--blue-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

.delito-individual-nombre {
    font-size: 13px;
    font-weight: 600;
    color: var(--blue-primary);
    line-height: 1.4;
}

.delito-individual-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.delito-individual-impacto {
    font-size: 11px;
    font-weight: 700;
    color: #0e2e3a;
    padding: 4px 10px;
    border-radius: var(--radius-md);
    letter-spacing: 0.2px;
}

.delito-individual-toggle {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 1px solid var(--border-soft);
    border-radius: 50%;
    font-size: 16px;
    font-weight: 700;
    color: var(--blue-primary);
    line-height: 1;
}

.delito-individual-body {
    padding: 12px 14px 14px;
    background: white;
    border-top: 1px solid var(--border-soft);
}

.delito-individual-fila {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-light, #f1f5f9);
    font-size: 12.5px;
    line-height: 1.5;
}

.delito-individual-fila:last-child {
    border-bottom: none;
}

.delito-individual-label {
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 10.5px;
    letter-spacing: 0.4px;
    padding-top: 2px;
}

.delito-individual-valor {
    color: var(--text-primary);
}

.delito-individual-valor em {
    color: var(--text-muted);
    font-style: italic;
}

@media (max-width: 600px) {
    .delito-individual-fila {
        grid-template-columns: 1fr;
        gap: 4px;
    }
    .delito-individual-label {
        padding-top: 0;
    }
}

.detail-block-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--blue-primary);
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-soft);
}

.detail-block-description {
    background: #fff7ed;
    border: 1px solid var(--orange-border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    margin-bottom: 18px;
}

.detail-block-description .detail-block-title {
    color: #9a3412;
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 4px;
}

.detail-description-text {
    font-size: 12px;
    color: #7c2d12;
    line-height: 1.6;
    font-style: italic;
}

.detail-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.detail-item {
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
}

.detail-item-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--blue-primary);
    margin-bottom: 6px;
}

.detail-item-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.detail-item-text {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.55;
}

.detail-empty {
    font-size: 12px;
    color: var(--text-muted);
    font-style: italic;
    padding: 10px 0;
}

/* ============================================================================
   CONTROLES MITIGADORES — VISTA EN PANTALLA (dentro del detalle de cada categoría)
   Agrupación por estado, tarjetas con dimensiones y % de reducción. Layout
   equivalente al bloque del PDF para dar la misma información al usuario.
   ============================================================================ */
.ctrl-group-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-top: 14px;
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border-soft);
}
.ctrl-group-title-implantado     { color: #16a085; }
.ctrl-group-title-parcial        { color: #e67e22; }
.ctrl-group-title-no_implantado  { color: #c0392b; }

.ctrl-card {
    border: 1px solid var(--border-soft);
    border-radius: 6px;
    padding: 10px 12px;
    margin-bottom: 6px;
    background: white;
}
.ctrl-card-implantado     { border-left: 3px solid #16a085; }
.ctrl-card-parcial        { border-left: 3px solid #e67e22; }
.ctrl-card-no_implantado  { border-left: 3px solid #c0392b; }

.ctrl-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 6px;
}
.ctrl-card-nombre {
    flex: 1;
    font-size: 13px;
    font-weight: 700;
    color: var(--blue-primary);
    line-height: 1.35;
}
.ctrl-card-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    font-size: 11px;
}
.ctrl-dim-tag {
    display: inline-block;
    background: var(--bg-neutral);
    color: var(--blue-primary);
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 7px;
    border-radius: 3px;
    font-size: 10px;
    letter-spacing: 0.3px;
}
.ctrl-doc-badge {
    display: inline-block;
    background: var(--blue-primary);
    color: #ffffff;
    font-weight: 700;
    font-size: 10px;
    padding: 2px 7px;
    border-radius: 3px;
}
/* Badge que indica qué reduce cada control (probabilidad / impacto / ambos).
   Codificado por color y complementa el % numérico en la esquina derecha. */
.ctrl-reduce-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 3px;
    letter-spacing: 0.2px;
    text-transform: none;
}
.ctrl-reduce-badge-probabilidad {
    background: #dbeafe;
    color: #1e40af;
}
.ctrl-reduce-badge-impacto {
    background: #fae8d8;
    color: #9a3412;
}
.ctrl-reduce-badge-ambos {
    background: #d1fae5;
    color: #065f46;
}

.ctrl-reduccion {
    margin-left: auto;
    font-size: 13px;
    font-weight: 700;
    color: #16a085;
    white-space: nowrap;
}
.ctrl-reduccion-off {
    color: #c0392b;
}
.ctrl-cita {
    background: var(--blue-soft);
    border-left: 2px solid var(--blue-primary);
    padding: 6px 10px;
    margin-top: 6px;
    font-size: 11.5px;
    color: var(--blue-primary);
    font-style: italic;
    border-radius: 0 3px 3px 0;
    line-height: 1.45;
}
.ctrl-cita strong {
    font-style: normal;
    font-weight: 700;
}
.ctrl-resumen {
    margin-top: 12px;
    padding: 10px 14px;
    background: var(--bg-neutral);
    border: 1px solid var(--border-soft);
    border-radius: 6px;
}
.ctrl-resumen-fila {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    padding: 3px 0;
    color: var(--blue-primary);
}
.ctrl-resumen-aplicada {
    color: #16a085;
    font-size: 13px;
}

/* ============================================================================
   CAJA "RIESGO TRAS APLICACIÓN DE CONTROLES" — vista en pantalla
   ============================================================================ */
.riesgo-residual-caja {
    background: var(--bg-neutral);
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    padding: 14px 16px;
}
.riesgo-residual-cambio {
    border-left: 4px solid #16a085;
}
.riesgo-residual-sin-cambio {
    border-left: 4px solid #94a3b8;
}
.riesgo-residual-fila {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 4px 0;
    font-size: 12.5px;
    color: var(--blue-primary);
    line-height: 1.5;
}
.riesgo-residual-fila-key {
    border-top: 1px solid var(--border-soft);
    padding-top: 7px;
    margin-top: 3px;
}
.riesgo-residual-destacado {
    color: #16a085;
}
.riesgo-residual-cambio .riesgo-residual-destacado {
    color: #16a085;
}
.riesgo-residual-sin-cambio .riesgo-residual-destacado {
    color: #64748b;
}
.riesgo-residual-destacado-grande {
    font-size: 14px;
}
.riesgo-residual-era {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 11.5px;
}
.riesgo-residual-resumen {
    margin-top: 9px;
    padding-top: 8px;
    border-top: 1px solid var(--border-soft);
    font-size: 11.5px;
    font-style: italic;
    text-align: center;
    line-height: 1.45;
    color: var(--text-muted);
}
.riesgo-residual-cambio .riesgo-residual-resumen {
    color: #16a085;
}

.detail-footer-note {
    font-size: 11px;
    color: var(--text-muted);
    text-align: right;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border-soft);
}

.badge-control-state,
.badge-control-effect,
.badge-doc-type {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: var(--radius-pill);
    letter-spacing: 0.2px;
}

/* ---------------------------------------------------------------------------
   Badges de estado de control — los selectores usan las claves que realmente
   envía el backend ('implantado', 'parcial', 'no_implantado'). Colores
   saturados alineados con la paleta de iconos de las matrices:
     verde #16a085  · naranja #e67e22  · rojo #c0392b
   --------------------------------------------------------------------------- */
.badge-control-state {
    background: var(--bg-neutral);
    color: var(--text-muted);
    text-transform: uppercase;
}
.badge-control-state-implantado {
    background: #16a085;
    color: #ffffff;
}
.badge-control-state-parcial {
    background: #e67e22;
    color: #ffffff;
}
.badge-control-state-no_implantado {
    background: #c0392b;
    color: #ffffff;
}

/* Mantengo las reglas antiguas por compatibilidad con cualquier vista vieja
   que aún genere los badges con capitalización distinta */
.badge-control-state-Implantado { background: #16a085; color: #ffffff; }
.badge-control-state-Parcial { background: #e67e22; color: #ffffff; }
.badge-control-state-NoImplantado { background: #c0392b; color: #ffffff; }

.badge-control-effect { background: var(--info-bg); color: var(--info); }
.badge-doc-type { background: var(--blue-soft); color: var(--blue-primary); }

.row-highlight {
    background: #fff7ed !important;
    animation: highlightRow 2s ease;
}

@keyframes highlightRow {
    0%, 50% { background: #fde68a !important; }
    100% { background: #fff7ed !important; }
}

.resultados-acciones {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    padding: 20px 0 4px;
    border-top: 1px solid var(--border-soft);
    margin-top: 22px;
}

.resultados-acciones-nota {
    text-align: center;
    font-size: 11px;
    color: var(--text-soft);
    margin-top: 8px;
}

/* Matriz 5x5 */
.risk-matrix-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    overflow: visible;
    position: relative;
    z-index: 2;
}

.risk-matrix-layout {
    display: flex;
    align-items: stretch;
    justify-content: center;
    gap: 8px;
    width: 100%;
    max-width: 620px;
}

.matrix-title-left {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 0;
}

.risk-matrix-grid {
    display: grid;
    grid-template-columns: 60px repeat(5, 1fr);
    grid-template-rows: auto repeat(5, 1fr);
    gap: 3px;
    flex: 1;
}

.matrix-axis-label {
    font-size: 10px;
    color: var(--text-muted);
    text-align: center;
    font-weight: 600;
    padding: 4px 2px;
}

.matrix-cell {
    border-radius: var(--radius-xs);
    min-height: 56px;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: transform 0.15s;
}

.matrix-cell:hover { transform: scale(1.02); z-index: 3; }

.matrix-count {
    font-size: 22px;
    font-weight: 800;
    color: #0e2e3a;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.6);
}

.matrix-count-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: var(--radius-xs);
    font-family: inherit;
    font-weight: 800;
    font-size: 22px;
    color: #0e2e3a;
    position: relative;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.6);
    transition: transform 0.15s;
}

.matrix-count-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
}

.matrix-tooltip {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(6px);
    background: var(--blue-primary);
    color: white;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 500;
    white-space: normal;
    min-width: 180px;
    max-width: 260px;
    z-index: 10;
    box-shadow: var(--shadow-medium);
    text-align: center;
    line-height: 1.4;
}

.matrix-count-btn:hover .matrix-tooltip,
.matrix-count-btn:focus .matrix-tooltip { display: block; }

.matrix-title-bottom {
    grid-column: 2 / -1;
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    padding-top: 6px;
}

/* ==========================================================================
   PRELOADER
   ========================================================================== */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(238, 243, 245, 0.95);
    backdrop-filter: blur(8px);
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.spinner {
    width: 56px;
    height: 56px;
    border: 5px solid var(--bg-neutral);
    border-top: 5px solid var(--orange-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    font-weight: 700;
    color: var(--blue-primary);
    font-size: 14px;
    text-align: center;
    max-width: 400px;
    line-height: 1.5;
}

/* ==========================================================================
   PRELOADER CON BARRA DE PROGRESO Y ETAPAS (flujo descarga PDF largo)
   ========================================================================== */
#preloaderProgressWrap {
    width: 100%;
    max-width: 480px;
    margin-top: 28px;
    padding: 0 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

#preloaderEtapaActual {
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: var(--blue-primary);
    padding: 12px 18px;
    background: white;
    border-radius: 10px;
    border: 1px solid var(--border-soft);
    box-shadow: 0 2px 8px rgba(15, 49, 66, 0.08);
    min-height: 24px;
    transition: all 0.3s ease;
}

.preloader-barra-exterior {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
    position: relative;
}

.preloader-barra-interior {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--blue-primary) 0%, var(--orange-primary) 100%);
    border-radius: 999px;
    transition: width 0.6s ease;
    position: relative;
    overflow: hidden;
}

.preloader-barra-interior::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.4) 50%,
        transparent 100%
    );
    animation: shimmer 1.8s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

#preloaderEtapasLista {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 12.5px;
    color: var(--text-muted);
}

.preloader-etapa {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 0;
    transition: color 0.3s ease;
}

.preloader-etapa-icon {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    flex-shrink: 0;
    border: 2px solid #cbd5e1;
    background: white;
    color: transparent;
    transition: all 0.3s ease;
}

.preloader-etapa.activa {
    color: var(--blue-primary);
    font-weight: 600;
}

.preloader-etapa.activa .preloader-etapa-icon {
    border-color: var(--orange-primary);
    background: var(--orange-primary);
    color: white;
    animation: pulse-etapa 1.5s ease-in-out infinite;
}

.preloader-etapa.completada {
    color: #0f6e56;
}

.preloader-etapa.completada .preloader-etapa-icon {
    border-color: #0f6e56;
    background: #0f6e56;
    color: white;
}

.preloader-etapa.completada .preloader-etapa-icon::before {
    content: "✓";
}

@keyframes pulse-etapa {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 111, 0, 0.5); }
    50%      { box-shadow: 0 0 0 6px rgba(255, 111, 0, 0); }
}

.preloader-aviso {
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    padding: 10px 16px;
    background: var(--info-bg);
    border-radius: 8px;
    border: 1px solid var(--info-border);
    line-height: 1.5;
}

.preloader-aviso strong {
    color: var(--info-dark);
}

/* ==========================================================================
   PANTALLA DE BIENVENIDA (portada pública)
   ========================================================================== */
.section {
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px 20px;
    background: linear-gradient(140deg, var(--blue-dark) 0%, var(--blue-primary) 45%, var(--blue-medium) 100%);
    position: relative;
    overflow: hidden;
}

.section::before {
    content: "";
    position: absolute;
    top: -120px;
    right: -120px;
    width: 360px;
    height: 360px;
    border-radius: 50%;
    background: rgba(255, 106, 0, 0.08);
    pointer-events: none;
}

.section::after {
    content: "";
    position: absolute;
    bottom: -80px;
    left: -80px;
    width: 260px;
    height: 260px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.04);
    pointer-events: none;
}

.section-brand {
    position: absolute;
    top: 30px;
    left: 40px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 2;
}

.section-brand-logo {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.section-brand-logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.section-brand-name {
    color: white;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.2px;
}

.section-brand-descriptor {
    position: absolute;
    top: 36px;
    right: 40px;
    color: rgba(255, 255, 255, 0.65);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    z-index: 2;
}

.welcome-container {
    max-width: 460px;
    width: 100%;
    text-align: center;
    background: white;
    border-radius: var(--radius-2xl);
    padding: 40px 34px;
    box-shadow: var(--shadow-strong);
    position: relative;
    z-index: 2;
}

.welcome-badge {
    display: inline-block;
    background: var(--orange-soft);
    color: #993C1D;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    padding: 5px 12px;
    border-radius: var(--radius-pill);
    margin-bottom: 20px;
}

.welcome-title {
    font-size: 28px;
    line-height: 1.15;
    font-weight: 800;
    color: var(--blue-primary);
    margin-bottom: 12px;
}

.welcome-text {
    font-size: 14px;
    line-height: 1.55;
    color: #4a5568;
    margin-bottom: 26px;
}

.welcome-button {
    background: var(--orange-primary);
    color: white;
    border: none;
    padding: 14px 22px;
    border-radius: var(--radius-lg);
    font-weight: 700;
    font-size: 14px;
    width: 100%;
    cursor: pointer;
    letter-spacing: 0.3px;
    box-shadow: var(--shadow-orange);
    transition: background 0.15s, transform 0.15s;
    font-family: inherit;
}

.welcome-button:hover {
    background: var(--orange-hover);
    transform: translateY(-1px);
}

.welcome-info {
    margin-top: 22px;
    padding-top: 20px;
    border-top: 1px solid var(--border-soft);
    text-align: left;
}

.welcome-info p {
    font-size: 12.5px;
    line-height: 1.6;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.welcome-info p:last-child {
    margin-bottom: 0;
}

.welcome-info strong {
    color: var(--blue-primary);
    font-weight: 700;
}

.section-footer {
    position: absolute;
    bottom: 20px;
    left: 40px;
    right: 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: rgba(255, 255, 255, 0.55);
    font-size: 11px;
    z-index: 2;
}

.section-footer a {
    color: rgba(255, 255, 255, 0.65);
    text-decoration: none;
    font-weight: 500;
}

.section-footer a:hover {
    color: white;
    text-decoration: underline;
}

.section-footer-links {
    display: flex;
    gap: 16px;
}

/* ==========================================================================
   FOOTER (dentro del flujo, bajo el card-panel)
   ========================================================================== */
footer, .footer {
    margin: 30px 0 10px;
    color: var(--text-muted);
    font-size: 12px;
    text-align: center;
    width: 100%;
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.footer-copy {
    color: var(--text-muted);
    font-size: 12px;
}

.footer-links {
    font-size: 11px;
    color: var(--text-soft);
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
}

.footer-links a:hover {
    text-decoration: underline;
    color: var(--blue-primary);
}

/* ==========================================================================
   MODALES
   ========================================================================== */
.pantalla-formulario {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(14, 46, 58, 0.55);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
    overflow-y: auto;
}

.pantalla-formulario[style*="display: flex"],
.pantalla-formulario[style*="display:flex"] { display: flex !important; }

.formulario-box {
    background: white;
    border-radius: var(--radius-xl);
    padding: 0;
    width: 100%;
    max-width: 540px;
    max-height: 96vh;
    overflow-y: auto;
    box-shadow: var(--shadow-strong);
}

.privacy-modal-box {
    max-width: 820px;
    max-height: 92vh;
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Cabecera del modal: logo Innova + título + subtítulo + cerrar.
   No encoge dentro del flex column. */
.privacy-modal-box .formulario-header {
    background: linear-gradient(135deg, var(--blue-primary) 0%, var(--blue-medium) 100%);
    padding: 22px 28px;
    border-bottom: none;
    color: #fff;
    align-items: flex-start;
    gap: 16px;
    flex-shrink: 0;
}

.privacy-modal-header-content {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1;
    min-width: 0;
}

.privacy-modal-header-logo {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.92);
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.privacy-modal-header-logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.privacy-modal-header-text {
    min-width: 0;
}

.privacy-modal-header-text h2 {
    font-size: 22px !important;
    color: #fff !important;
    margin: 0 !important;
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1.2;
}

.privacy-modal-header-text .privacy-modal-subtitle {
    font-size: 12.5px;
    color: rgba(255, 255, 255, 0.85);
    margin-top: 4px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    font-weight: 500;
}

/* Botón cerrar adaptado al header oscuro */
.privacy-modal-box .btn-cerrar-modal {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #fff;
    width: 36px;
    height: 36px;
    font-size: 16px;
    flex-shrink: 0;
}

.privacy-modal-box .btn-cerrar-modal:hover {
    background: rgba(255, 255, 255, 0.28);
    color: #fff;
}

/* Cuerpo del modal: tipografía mejorada. Hace de zona scrollable. */
.privacy-modal-content {
    padding: 28px 32px 24px;
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.65;
    flex: 1 1 auto;
    overflow-y: auto;
    min-height: 0;
}

.privacy-modal-content > p:first-of-type,
.privacy-modal-content > p:nth-of-type(2) {
    color: var(--text-secondary);
    font-size: 14.5px;
    line-height: 1.7;
}

.privacy-modal-content h3 {
    font-size: 17px;
    color: var(--blue-primary);
    margin: 26px 0 10px;
    font-weight: 700;
    letter-spacing: -0.005em;
    padding-left: 12px;
    border-left: 3px solid var(--blue-primary);
    line-height: 1.3;
}

.privacy-modal-content h3:first-of-type { margin-top: 4px; }

.privacy-modal-content p {
    margin-bottom: 12px;
    font-size: 14px;
    color: var(--text-primary);
}

.privacy-modal-content ul {
    margin: 10px 0 14px 0;
    padding: 0;
    list-style: none;
}

.privacy-modal-content ul li {
    margin-bottom: 8px;
    line-height: 1.6;
    font-size: 14px;
    padding-left: 20px;
    position: relative;
}

.privacy-modal-content ul li::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 9px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--blue-primary);
    opacity: 0.55;
}

.privacy-modal-content strong {
    color: var(--blue-primary);
    font-weight: 600;
}

.privacy-modal-content a {
    color: var(--blue-primary);
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-thickness: 1px;
}

.privacy-modal-content a:hover {
    color: var(--blue-primary-hover);
    text-decoration-thickness: 2px;
}

.privacy-modal-content .legal-updated {
    display: inline-block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 18px;
    font-style: normal;
    background: var(--bg-neutral);
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid var(--border-soft);
    font-weight: 500;
}

.privacy-modal-content .legal-updated em {
    font-style: normal;
}

/* Pie del modal con marca Innova. No encoge dentro del flex column. */
.privacy-modal-actions {
    padding: 18px 28px 22px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    border-top: 1px solid var(--border-soft);
    background: var(--bg-section);
    flex-shrink: 0;
}

.privacy-modal-actions-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11.5px;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}

.privacy-modal-actions-brand img {
    height: 22px;
    width: auto;
    opacity: 0.75;
}

.privacy-modal-actions .blue-button {
    padding: 11px 28px;
    font-size: 14px;
}

/* Móvil: cabecera más compacta */
@media (max-width: 640px) {
    .privacy-modal-box .formulario-header {
        padding: 16px 18px;
        gap: 10px;
    }
    .privacy-modal-header-logo {
        width: 38px;
        height: 38px;
    }
    .privacy-modal-header-text h2 {
        font-size: 18px !important;
    }
    .privacy-modal-header-text .privacy-modal-subtitle {
        font-size: 11px;
    }
    .privacy-modal-content {
        padding: 20px 18px 18px;
        font-size: 13.5px;
    }
    .privacy-modal-content h3 {
        font-size: 15px;
        margin: 20px 0 8px;
    }
    .privacy-modal-content p,
    .privacy-modal-content ul li {
        font-size: 13.5px;
    }
    .privacy-modal-actions {
        padding: 14px 18px 18px;
        flex-direction: column-reverse;
        gap: 10px;
        align-items: stretch;
    }
    .privacy-modal-actions .blue-button {
        width: 100%;
    }
    .privacy-modal-actions-brand {
        justify-content: center;
    }
}

.formulario-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border-soft);
}

.formulario-header h2 {
    font-size: 18px;
    margin: 0;
}

.btn-cerrar-modal {
    background: var(--bg-neutral);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-xs);
    width: 30px;
    height: 30px;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    transition: background 0.15s;
}

.btn-cerrar-modal:hover {
    background: var(--border-soft);
    color: var(--text-primary);
}

.subtexto-formulario {
    padding: 16px 24px 0;
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.55;
}

.pantalla-formulario form { padding: 14px 24px 16px; }

.grupo-campo { margin-bottom: 10px; }

.grupo-campo label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.grupo-campo input,
.grupo-campo textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    color: var(--text-primary);
    background: white;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    box-sizing: border-box;
}

.grupo-campo input:focus,
.grupo-campo textarea:focus {
    border-color: var(--blue-primary);
    box-shadow: 0 0 0 3px rgba(20, 63, 77, 0.1);
}

.grupo-campo textarea {
    min-height: 70px;
    resize: vertical;
    line-height: 1.5;
}

.privacy-box {
    background: var(--bg-section);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    padding: 14px;
}

.privacy-intro {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 10px;
    line-height: 1.5;
}

.privacy-check {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-primary);
    line-height: 1.5;
    margin-bottom: 10px;
}

.privacy-check:last-child { margin-bottom: 0; }

.privacy-check input[type="checkbox"] {
    margin-top: 2px;
    transform: scale(1.1);
    accent-color: var(--orange-primary);
    cursor: pointer;
    flex-shrink: 0;
}

.privacy-check a {
    color: var(--blue-primary);
    text-decoration: underline;
    font-weight: 600;
}

.actions-formulario {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding: 16px 24px 20px;
    border-top: 1px solid var(--border-soft);
}

.actions-formulario .blue-button { padding: 11px 22px; font-size: 13px; }

.mensaje-exito {
    padding: 16px 24px;
    background: var(--success-bg);
    color: var(--success-dark);
    font-weight: 600;
    font-size: 13px;
    text-align: center;
    border-top: 1px solid var(--success-border);
}

/* (Estilos antiguos de .privacy-modal-content y .privacy-modal-actions
    eliminados en sub-sesión D — ahora están definidos arriba con el nuevo
    diseño de cabecera con logo Innova, h3 con borde lateral y pie con marca.) */

/* ==========================================================================
   MENSAJE "CIF NO AUTORIZADO"
   ========================================================================== */
.cif-no-autorizado-box {
    background: var(--warning-bg);
    border-left: 4px solid var(--warning);
    border-radius: var(--radius-md);
    padding: 20px 22px;
    margin-top: 16px;
    text-align: left;
}

.cif-no-autorizado-title {
    font-size: 14px;
    font-weight: 700;
    color: #92400e;
    margin-bottom: 8px;
}

.cif-no-autorizado-text {
    font-size: 13px;
    color: #78350f;
    line-height: 1.55;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 900px) {
    .resultados-hero { grid-template-columns: 1fr; }
    .contadores-grid { grid-template-columns: 1fr 1fr; }
    .ficha-3-bloques { grid-template-columns: 1fr !important; }
}

@media (max-width: 640px) {
    body { font-size: 14px; }
    .app-wrapper { padding: 14px 12px 30px; }
    .card-panel { padding: 20px 18px 18px; border-radius: var(--radius-lg); }
    .portal-header { padding: 12px 16px; }
    .portal-header-title { font-size: 12px; }
    .portal-header-subtitle { font-size: 9px; }
    h1 { font-size: 24px; }
    h2 { font-size: 21px; }
    h3 { font-size: 17px; }
    h4 { font-size: 14.5px; }
    .card-panel h1 { font-size: 22px; }
    .card-panel h2 { font-size: 20px; }
    .welcome-container { padding: 30px 22px; }
    .welcome-title { font-size: 24px; }
    .section-brand { top: 20px; left: 20px; }
    .section-brand-descriptor { top: 26px; right: 20px; }
    .section-footer { flex-direction: column; gap: 8px; left: 20px; right: 20px; }
    .contadores-grid { grid-template-columns: 1fr 1fr; }
    .score-box { min-height: 120px; padding: 18px; }
    .score-number { font-size: 42px; }
    .empresa-banner { flex-direction: column; align-items: flex-start; gap: 10px; }
    .empresa-banner-profile { border-left: none; padding-left: 0; padding-top: 10px; border-top: 1px solid var(--border-soft); width: 100%; text-align: left; }
    .resultados-acciones { flex-direction: column; }
    .resultados-acciones .blue-button { width: 100%; }
    .compliance-table { font-size: 12px; }
    .compliance-table th, .compliance-table td { padding: 10px 8px; }
    .text-left { padding-left: 10px !important; }
}

/* ==========================================================================
   CUESTIONARIO DE CONTROLES (Hito 2 · Chile · Ley 20.393)
   ========================================================================== */

.cuestionario-controles-cargando {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 14px;
    font-style: italic;
}

.banner-deteccion-doc {
    background: var(--info-bg);
    border: 1px solid var(--info-border);
    border-left: 4px solid var(--info);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    margin-bottom: 22px;
    font-size: 13.5px;
    line-height: 1.55;
    color: var(--info-dark);
}

.banner-deteccion-doc strong {
    color: var(--info-dark);
    font-weight: 700;
}

.control-seccion {
    margin-bottom: 28px;
}

.control-seccion-titulo {
    font-size: 15px;
    font-weight: 700;
    color: var(--blue-primary);
    margin: 0 0 6px 0;
    letter-spacing: 0.2px;
}

.control-seccion-desc {
    font-size: 12.5px;
    color: var(--text-muted);
    margin-bottom: 14px;
    line-height: 1.5;
}

.control-seccion-lista {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.control-card {
    background: white;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.control-card:hover {
    border-color: var(--blue-primary);
}

.control-card-detectado {
    border-color: var(--info);
    border-left: 3px solid var(--info);
    background: linear-gradient(180deg, var(--info-bg) 0%, white 12%);
}

.control-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 10px;
}

.control-card-titulo-bloque {
    flex: 1;
    min-width: 0;
}

.control-card-titulo {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--blue-primary);
    line-height: 1.4;
    margin-bottom: 4px;
}

.control-card-desc {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
}

.control-categoria-tag {
    display: inline-block;
    font-size: 10.5px;
    font-weight: 600;
    color: var(--blue-primary);
    background: var(--bg-section);
    padding: 3px 9px;
    border-radius: var(--radius-sm);
    margin-top: 6px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.badge-detectado {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--info);
    color: white;
    padding: 5px 10px;
    border-radius: var(--radius-md);
    font-size: 11px;
    font-weight: 600;
    cursor: help;
    flex-shrink: 0;
}

.badge-detectado-icon {
    font-size: 12px;
}

.badge-detectado-text {
    white-space: nowrap;
}

.control-cita-literal {
    background: var(--info-bg);
    border-left: 3px solid var(--info);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--info-dark);
    line-height: 1.5;
    margin-bottom: 12px;
    font-style: italic;
}

.control-cita-literal strong {
    font-style: normal;
    font-weight: 700;
}

.control-card-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.control-dimensiones {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
}

.control-dim {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.control-dim label {
    font-size: 10.5px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-weight: 600;
}

.control-dim select {
    font-size: 12px;
    padding: 6px 8px;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    background: white;
    color: var(--blue-primary);
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.15s ease;
}

.control-dim select:hover, .control-dim select:focus {
    border-color: var(--blue-primary);
    outline: none;
}

.control-estado {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.control-estado-titulo {
    font-size: 11.5px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-weight: 600;
    margin-bottom: 2px;
}

.control-estado-opciones {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.control-estado-opcion {
    cursor: pointer;
    flex: 1;
    min-width: 90px;
}

.control-estado-opcion input[type="radio"] {
    display: none;
}

.control-estado-pill {
    display: block;
    text-align: center;
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    font-size: 11.5px;
    font-weight: 600;
    border: 1.5px solid var(--border-soft);
    background: white;
    color: var(--text-muted);
    transition: all 0.15s ease;
}

.control-estado-opcion:hover .control-estado-pill {
    border-color: var(--blue-primary);
}

.control-estado-opcion input[type="radio"]:checked + .control-estado-pill-si {
    background: var(--success-bg);
    border-color: var(--success);
    color: var(--success-dark);
}

.control-estado-opcion input[type="radio"]:checked + .control-estado-pill-parcial {
    background: var(--warning-bg, #fef3c7);
    border-color: var(--warning, #f59e0b);
    color: var(--warning-dark, #92400e);
}

.control-estado-opcion input[type="radio"]:checked + .control-estado-pill-no {
    background: var(--danger-bg, #fee2e2);
    border-color: var(--danger, #dc2626);
    color: var(--danger-dark, #991b1b);
}

@media (max-width: 800px) {
    .control-card-body {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .control-dimensiones {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   RESUMEN GLOBAL DE CONTROLES APLICADOS (pantalla resultados · Hito 2)
   ========================================================================== */
.resumen-controles-header {
    margin-bottom: 16px;
}
.resumen-controles-titulo {
    font-size: 17px;
    font-weight: 700;
    color: var(--blue-primary);
    margin: 0 0 6px 0;
}
.resumen-controles-subtitulo {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.55;
}
.resumen-controles-metricas {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 22px;
}
.resumen-metrica {
    background: white;
    border-radius: var(--radius-md);
    padding: 16px 14px;
    text-align: center;
    border: 1px solid var(--border-soft);
    border-top: 3px solid var(--blue-primary);
}
.resumen-metrica-implantados { border-top-color: #0f6e56; }
.resumen-metrica-parciales { border-top-color: #b45309; }
.resumen-metrica-no { border-top-color: #991b1b; }
.resumen-metrica-reduccion { border-top-color: var(--blue-primary); }
.resumen-metrica-num {
    font-size: 28px;
    font-weight: 800;
    color: var(--blue-primary);
    line-height: 1.1;
    margin-bottom: 4px;
}
.resumen-metrica-implantados .resumen-metrica-num { color: #0f6e56; }
.resumen-metrica-parciales .resumen-metrica-num { color: #b45309; }
.resumen-metrica-no .resumen-metrica-num { color: #991b1b; }
.resumen-metrica-label {
    font-size: 11.5px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-weight: 600;
}

.resumen-control-grupo {
    margin-bottom: 18px;
}
.resumen-control-grupo-titulo {
    font-size: 13px;
    font-weight: 700;
    margin: 0 0 8px 0;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    color: white;
    display: inline-block;
}
.resumen-control-grupo-titulo.gr-implantado { background: #0f6e56; }
.resumen-control-grupo-titulo.gr-parcial { background: #b45309; }
.resumen-control-grupo-titulo.gr-no { background: #991b1b; }

.resumen-control-card {
    background: white;
    border: 1px solid var(--border-soft);
    border-left: 3px solid var(--border-soft);
    border-radius: var(--radius-md);
    padding: 11px 14px;
    margin-bottom: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}
.resumen-control-card.bd-implantado { border-left-color: #0f6e56; }
.resumen-control-card.bd-parcial { border-left-color: #b45309; }
.resumen-control-card.bd-no { border-left-color: #991b1b; }

.resumen-control-info {
    flex: 1;
    min-width: 200px;
}
.resumen-control-nombre {
    font-size: 13px;
    font-weight: 600;
    color: var(--blue-primary);
    line-height: 1.4;
    margin-bottom: 4px;
}
.resumen-control-dims {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.resumen-control-dim {
    font-size: 10.5px;
    background: var(--bg-section);
    color: var(--blue-primary);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-weight: 600;
}
.resumen-control-detectado-badge {
    font-size: 10.5px;
    background: var(--info);
    color: white;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-weight: 600;
}
.resumen-control-reduccion {
    font-size: 14px;
    font-weight: 700;
    color: #0f6e56;
    white-space: nowrap;
}
.resumen-control-card.bd-no .resumen-control-reduccion {
    color: var(--text-muted);
}
.resumen-control-cita {
    flex-basis: 100%;
    background: var(--info-bg);
    border-left: 2px solid var(--info);
    padding: 6px 10px;
    margin-top: 8px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 11.5px;
    color: var(--info-dark);
    font-style: italic;
    line-height: 1.5;
}
@media (max-width: 700px) {
    .resumen-controles-metricas {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================================================
   PLAN DE ACCIÓN 12 MESES · Ley 20.393 + Ley 21.595
   ============================================================================
   Bloque que aparece tras el análisis de riesgo residual y antes del botón de
   descarga del PDF. Permite al usuario generar un plan de acción de 12 meses
   personalizado por la IA y editarlo antes de incluirlo en el informe.
   ============================================================================ */

.plan-accion-container {
    margin: 32px 0 24px 0;
    padding: 24px;
    background: var(--blue-soft);
    border: 1px solid var(--blue-border);
    border-radius: 14px;
}

.plan-accion-header {
    margin-bottom: 18px;
}

.plan-accion-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 700;
    color: var(--blue-primary);
    margin: 0 0 8px 0;
}

.plan-accion-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: var(--blue-primary);
    color: #fff;
    border-radius: 8px;
    font-size: 16px;
}

.plan-accion-intro {
    font-size: 13.5px;
    line-height: 1.55;
    color: #334155;
    margin: 0;
}

.plan-accion-boton-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px 0 4px 0;
}

/* Loader cuando Gemini está generando el plan */
.plan-accion-loader {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 22px;
    background: #fff;
    border: 1px solid var(--blue-border);
    border-radius: 12px;
    max-width: 520px;
    margin: 0 auto;
}

.plan-accion-spinner {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    border: 3px solid var(--blue-border);
    border-top-color: var(--blue-primary);
    border-radius: 50%;
    animation: planAccionSpin 0.9s linear infinite;
}

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

.plan-accion-loader-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 13.5px;
    color: #334155;
}

.plan-accion-loader-text strong {
    color: var(--blue-primary);
    font-size: 14px;
}

/* Contenedor del plan una vez renderizado */
.plan-accion-contenido {
    margin-top: 18px;
    padding: 18px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
}

.plan-accion-edicion-nota {
    margin: 0 0 16px 0;
    padding: 10px 14px;
    background: var(--warning-bg);
    border-left: 3px solid var(--warning);
    border-radius: 6px;
    font-size: 12.5px;
    color: var(--warning);
    font-weight: 500;
}

/* Card por cada mes */
.plan-accion-mes-card {
    margin-bottom: 18px;
    padding: 16px 18px;
    background: #fafbfc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
}

.plan-accion-mes-card:last-child {
    margin-bottom: 0;
}

.plan-accion-mes-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.plan-accion-mes-badge {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 64px;
    padding: 4px 10px;
    background: var(--blue-primary);
    color: #fff;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.plan-accion-mes-titulo {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--blue-primary);
    line-height: 1.35;
}

.plan-accion-mes-objetivo {
    margin: 0 0 12px 0;
    padding: 0 0 10px 0;
    font-size: 13px;
    line-height: 1.5;
    color: #475569;
    font-style: italic;
    border-bottom: 1px dashed #e2e8f0;
}

/* Tabla editable por mes */
.plan-accion-tabla {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin-top: 8px;
}

.plan-accion-tabla thead {
    background: #f1f5f9;
}

.plan-accion-tabla th {
    padding: 8px 10px;
    text-align: left;
    font-size: 11.5px;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    border-bottom: 2px solid #cbd5e1;
}

.plan-accion-tabla td {
    padding: 10px;
    vertical-align: top;
    border-bottom: 1px solid #e2e8f0;
    line-height: 1.45;
    color: #1e293b;
    outline: none;
    transition: background 0.15s;
}

.plan-accion-tabla td[contenteditable="true"]:hover {
    background: #f8fafc;
    cursor: text;
}

.plan-accion-tabla td[contenteditable="true"]:focus {
    background: #fef9c3;
    box-shadow: inset 0 0 0 2px #eab308;
    border-radius: 4px;
}

.plan-accion-td-accion { font-weight: 500; }
.plan-accion-td-responsable { color: var(--blue-primary); font-weight: 600; font-size: 12.5px; }
.plan-accion-td-kpi { color: #166534; font-weight: 500; font-size: 12.5px; }

.plan-accion-nota-final {
    margin-top: 20px;
    padding: 14px 16px;
    background: var(--info-bg);
    border-left: 3px solid var(--info);
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.55;
    color: var(--info);
}

.plan-accion-nota-final:empty {
    display: none;
}

/* Ajustes responsive para pantallas estrechas */
@media (max-width: 720px) {
    .plan-accion-container {
        padding: 16px;
    }
    .plan-accion-tabla {
        font-size: 12px;
    }
    .plan-accion-tabla th,
    .plan-accion-tabla td {
        padding: 6px 8px;
    }
    .plan-accion-mes-titulo {
        font-size: 14px;
    }
}

/* ============================================================================
   PLAN DE ACCIÓN · Estados por acción (ya_ejecutado / parcial / pendiente)
   ============================================================================ */

/* Resumen global del plan en pantalla */
.pa-resumen-global-pantalla {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 22px;
}
.pa-resumen-item-p {
    padding: 12px 10px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    text-align: center;
    border-top: 3px solid #94a3b8;
}
.pa-resumen-ok-p { border-top-color: #16a34a; }
.pa-resumen-parcial-p { border-top-color: #eab308; }
.pa-resumen-pendiente-p { border-top-color: #dc2626; }
.pa-resumen-avance-p { border-top-color: var(--blue-primary); background: var(--blue-soft); }
.pa-resumen-num-p {
    font-size: 26px;
    font-weight: 800;
    line-height: 1;
    color: var(--blue-primary);
}
.pa-resumen-ok-p .pa-resumen-num-p { color: #16a34a; }
.pa-resumen-parcial-p .pa-resumen-num-p { color: #b45309; }
.pa-resumen-pendiente-p .pa-resumen-num-p { color: #dc2626; }
.pa-resumen-label-p {
    font-size: 10.5px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-top: 6px;
    font-weight: 600;
}

/* Chip resumen por mes */
.pa-mes-resumen-p {
    margin: 0 0 10px 0;
    padding: 0;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.pa-resumen-chip {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.2px;
}
.pa-chip-ok { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.pa-chip-parcial { background: #fef3c7; color: #854d0e; border: 1px solid #fcd34d; }
.pa-chip-pendiente { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }

/* Selector de estado en la tabla */
.pa-estado-select {
    width: 100%;
    padding: 5px 6px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid #cbd5e1;
    border-radius: 5px;
    background: #fff;
    color: #1e293b;
    cursor: pointer;
    outline: none;
}
.pa-estado-select:focus {
    border-color: var(--blue-primary);
    box-shadow: 0 0 0 2px rgba(20, 63, 77, 0.15);
}

/* Fila con color según estado */
.pa-fila.pa-estado-ok-p { background: #f0fdf4; }
.pa-fila.pa-estado-parcial-p { background: #fffbeb; }
.pa-fila.pa-estado-pendiente-p { background: #ffffff; }

.pa-td-estado {
    padding: 10px !important;
    vertical-align: middle !important;
}

/* Bloque editable de observación */
.pa-observacion-p {
    margin-top: 6px;
    padding: 6px 10px;
    background: #f8fafc;
    border-left: 2px solid #64748b;
    border-radius: 4px;
    font-size: 12px;
    color: #475569;
    font-style: italic;
    min-height: 18px;
}
.pa-observacion-p:empty::before {
    content: attr(data-placeholder);
    color: #94a3b8;
    font-style: italic;
}
.pa-observacion-p:focus {
    background: #fef9c3;
    box-shadow: inset 0 0 0 2px #eab308;
    outline: none;
}

.pa-editable {
    outline: none;
    transition: background 0.15s;
}
.pa-editable:focus {
    background: #fef9c3;
    box-shadow: inset 0 0 0 2px #eab308;
    border-radius: 4px;
}

@media (max-width: 720px) {
    .pa-resumen-global-pantalla {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================================================
   AVISO DE SECTOR INFERIDO desde la actividad real
   ============================================================================ */

.aviso-sector-inferido {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin: 0 0 22px 0;
    padding: 16px 20px;
    background: linear-gradient(to right, #eff6ff, #f8fafc);
    border: 1px solid #bfdbfe;
    border-left: 4px solid var(--blue-primary);
    border-radius: 10px;
    animation: fadeIn 0.45s ease forwards;
}

.aviso-sector-icon {
    flex-shrink: 0;
    font-size: 22px;
    line-height: 1;
    margin-top: 2px;
}

.aviso-sector-texto {
    flex: 1;
}

.aviso-sector-titulo {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--blue-primary);
    margin-bottom: 4px;
    letter-spacing: 0.2px;
}

.aviso-sector-detalle {
    font-size: 13px;
    line-height: 1.5;
    color: #334155;
}

.aviso-sector-detalle strong {
    color: var(--blue-primary);
    background: #dbeafe;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 700;
}

.aviso-sector-metodo {
    display: inline-block;
    margin-left: 4px;
    font-size: 11.5px;
    color: #64748b;
    font-style: italic;
}

/* ============================================================================
   BOTÓN VERDE (Descargar Excel) y layout de 4 botones de acciones finales
   ============================================================================ */

.blue-button.green-button {
    background: #16a34a;
    color: #fff;
    border: 1px solid #15803d;
    box-shadow: 0 1px 2px rgba(22, 101, 52, 0.18);
}

.blue-button.green-button:hover {
    background: #15803d;
    border-color: #166534;
}

.blue-button.green-button:active {
    background: #166534;
}

/* Asegurar que los 4 botones de "resultados-acciones" caben sin desbordar.
   Mantenemos wrap para que en pantallas estrechas se apilen automáticamente. */
.resultados-acciones {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    align-items: center;
    margin-top: 28px;
}

@media (max-width: 720px) {
    .resultados-acciones {
        flex-direction: column;
    }
    .resultados-acciones .blue-button {
        width: 100%;
        text-align: center;
    }
}

/* ============================================================================
   BLOQUES COLAPSABLES (sub-sesión B)
   --------------------------------------------------------------------------
   Componente <details>/<summary> nativo HTML5 estilizado para que la pantalla
   de resultados sea más limpia. Cada bloque grande (matrices, tabla análisis,
   resumen controles) se pliega/despliega con click en su cabecera.
   ============================================================================ */

.bloque-colapsable {
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    margin-top: 24px;
    overflow: hidden;
    transition: box-shadow 0.18s ease;
}

.bloque-colapsable[open] {
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.04);
}

.bloque-colapsable > summary {
    list-style: none;
    cursor: pointer;
    padding: 18px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: var(--bg-card);
    user-select: none;
    transition: background 0.15s ease;
}

.bloque-colapsable > summary::-webkit-details-marker {
    display: none;
}

.bloque-colapsable > summary:hover {
    background: var(--bg-neutral);
}

.bloque-colapsable[open] > summary {
    border-bottom: 1px solid var(--border-soft);
}

.bloque-colapsable-titulo-wrap {
    flex: 1;
    min-width: 0;
}

.bloque-colapsable-titulo {
    font-size: 19px;
    font-weight: 700;
    color: var(--blue-primary);
    line-height: 1.25;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    letter-spacing: -0.01em;
}

.bloque-colapsable-titulo-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--blue-soft);
    color: var(--blue-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
}

.bloque-colapsable-subtitulo {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 6px;
    line-height: 1.45;
}

.bloque-colapsable-meta {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.bloque-colapsable-tag {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-neutral);
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid var(--border-soft);
}

.bloque-colapsable-chevron {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--bg-neutral);
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: transform 0.22s ease, background 0.15s ease;
}

.bloque-colapsable[open] > summary .bloque-colapsable-chevron {
    transform: rotate(180deg);
    background: var(--blue-soft);
    color: var(--blue-primary);
}

.bloque-colapsable-cuerpo {
    padding: 22px;
    background: var(--bg-card);
}

/* Compatibilidad: cuando el cuerpo contiene la doble matriz, no añadir doble
   padding (la matriz ya tiene su propio espaciado interno). */
.bloque-colapsable-cuerpo > .matrices-doble:first-child {
    margin-top: 0;
}

/* Móvil: cabeceras más compactas */
@media (max-width: 640px) {
    .bloque-colapsable > summary {
        padding: 14px 16px;
    }
    .bloque-colapsable-titulo {
        font-size: 15px;
    }
    .bloque-colapsable-subtitulo {
        font-size: 12px;
    }
    .bloque-colapsable-cuerpo {
        padding: 16px 14px;
    }
}

/* ============================================================================
 * SUB-SESIÓN: PANTALLA DE VALIDACIÓN DE CATEGORÍAS
 * ----------------------------------------------------------------------------
 * Estilos para `screenCategorias` (entre la ficha de empresa y el cuestionario).
 * Coherente con el resto del portal: azules corporativos, tipografía sub-sesión
 * C, tarjetas con bordes suaves.
 * ========================================================================== */

/* Barra de resumen superior: dos cuadros lado a lado (sector + conteo) */
.categorias-resumen-bar {
    display: flex;
    gap: 12px;
    margin: 0 0 22px 0;
    flex-wrap: wrap;
}
.categorias-resumen-card {
    flex: 1;
    min-width: 220px;
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid var(--border-soft);
    background: var(--bg-section);
}
.categorias-resumen-card-info {
    background: var(--blue-soft);
    border-color: var(--blue-border);
}
.categorias-resumen-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}
.categorias-resumen-card-info .categorias-resumen-label {
    color: var(--info);
}
.categorias-resumen-valor {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}
.categorias-resumen-card-info .categorias-resumen-valor {
    color: var(--blue-primary);
}

/* Títulos de bloques dentro de la pantalla */
.categorias-bloque-titulo {
    margin: 0 0 10px 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.2px;
}
.categorias-bloque-subtitulo {
    margin: 0 0 14px 0;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.55;
}

/* Bloque 1: chips de las recomendadas (no editables) */
.categorias-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 8px;
    margin: 0 0 26px 0;
}
.categoria-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid var(--blue-border);
    background: var(--blue-soft);
    cursor: not-allowed;
}
.categoria-chip-recomendada .categoria-chip-nombre {
    font-size: 13px;
    font-weight: 600;
    color: var(--blue-primary);
}
.categoria-chip input[type="checkbox"] {
    margin: 0;
    accent-color: var(--blue-primary);
    flex-shrink: 0;
}
.categorias-vacio {
    margin: 0;
    padding: 12px 16px;
    background: var(--bg-neutral);
    border: 1px dashed var(--border-soft);
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 13px;
}

/* Bloques 2 y 3: tarjetas verticales para opcionales */
.categorias-lista-vertical {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0 0 22px 0;
}
.categoria-tarjeta {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid var(--border-soft);
    background: var(--bg-card);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.categoria-tarjeta:hover {
    border-color: var(--blue-medium);
    background: var(--bg-section);
}
.categoria-tarjeta-disabled {
    opacity: 0.55;
    cursor: not-allowed;
}
.categoria-tarjeta-disabled:hover {
    border-color: var(--border-soft);
    background: var(--bg-card);
}
.categoria-tarjeta-check {
    margin: 3px 0 0 0;
    flex-shrink: 0;
    accent-color: var(--blue-primary);
    cursor: pointer;
}
.categoria-tarjeta-disabled .categoria-tarjeta-check {
    cursor: not-allowed;
}
.categoria-tarjeta-contenido {
    flex: 1;
    min-width: 0;
}
.categoria-tarjeta-cabecera {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 3px;
}
.categoria-tarjeta-nombre {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}
.categoria-tarjeta-grupo {
    font-size: 11px;
    color: var(--text-muted);
    background: var(--bg-neutral);
    padding: 2px 8px;
    border-radius: 999px;
    white-space: nowrap;
    flex-shrink: 0;
    border: 1px solid var(--border-soft);
}
.categoria-tarjeta-motivo {
    font-size: 12.5px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-top: 2px;
}

/* Acordeón "Ver otras categorías menos típicas" */
.categorias-acordeon {
    margin: 0 0 22px 0;
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    background: var(--bg-section);
}
.categorias-acordeon[open] {
    background: var(--bg-card);
}
.categorias-acordeon-summary {
    padding: 12px 18px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    list-style: none;
    user-select: none;
}
.categorias-acordeon-summary::-webkit-details-marker {
    display: none;
}
.categorias-acordeon-summary::before {
    content: '▸';
    display: inline-block;
    margin-right: 8px;
    font-size: 11px;
    color: var(--text-muted);
    transition: transform 0.15s;
}
.categorias-acordeon[open] .categorias-acordeon-summary::before {
    transform: rotate(90deg);
}
.categorias-acordeon-cuerpo {
    padding: 4px 16px 14px 16px;
    border-top: 1px solid var(--border-soft);
}
.categorias-acordeon-aviso {
    font-size: 12.5px;
    color: var(--text-muted);
    margin: 12px 0 12px 0;
    line-height: 1.5;
    font-style: italic;
}

/* Aviso amarillo sobre el tope de 8 adicionales */
.categorias-aviso-tope {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    background: var(--warning-bg);
    border: 1px solid var(--warning-border);
    margin: 0 0 18px 0;
    font-size: 12.5px;
    color: var(--warning);
    line-height: 1.5;
}
.categorias-aviso-tope.categorias-aviso-tope-alcanzado {
    background: var(--orange-soft);
    border-color: var(--orange-border);
    color: var(--orange-dark);
    font-weight: 600;
}
.categorias-aviso-icono {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--warning);
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    font-style: normal;
    flex-shrink: 0;
}
.categorias-aviso-tope.categorias-aviso-tope-alcanzado .categorias-aviso-icono {
    background: var(--orange-primary);
}

/* Pie con contador y botones de acción */
.categorias-pie {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    padding-top: 18px;
    border-top: 1px solid var(--border-soft);
    flex-wrap: wrap;
}
.categorias-contador {
    font-size: 13px;
    color: var(--text-secondary);
}
.categorias-contador strong {
    color: var(--text-primary);
    font-weight: 700;
}
.categorias-pie-acciones {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

/* Móvil: pie en columna y tarjetas más compactas */
@media (max-width: 640px) {
    .categorias-pie {
        flex-direction: column;
        align-items: stretch;
    }
    .categorias-pie-acciones {
        justify-content: stretch;
    }
    .categorias-pie-acciones .blue-button,
    .categorias-pie-acciones .secondary-button {
        flex: 1;
    }
    .categoria-tarjeta-cabecera {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
}

/* ============================================================================
 * SUB-SESIÓN: VALIDACIÓN VISUAL DE CAMPOS DE LA FICHA DE EMPRESA
 * ----------------------------------------------------------------------------
 * Cuando los datos de la empresa no se pueden recuperar de fuentes externas,
 * los campos vacíos se marcan visualmente para que el usuario sepa qué falta:
 *   - .campo-pendiente-obligatorio: borde rojo + etiqueta "Obligatorio"
 *   - .campo-pendiente-opcional:    borde naranja + etiqueta "Opcional"
 *
 * Cuando se rellenan, se quita la clase y desaparece la marca.
 *
 * Si al pulsar "Iniciar análisis" falta algún obligatorio, se muestra el
 * mensaje de error inline (.campo-error-mensaje) bajo el campo afectado.
 * ========================================================================== */

/* Etiqueta pequeña al lado del label original */
.form-group .campo-aviso-tag {
    display: none;
    margin-left: 8px;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.2px;
    vertical-align: middle;
    text-transform: none;
    line-height: 1.55;
}

/* Estado: campo OBLIGATORIO sin rellenar */
.form-group.campo-pendiente-obligatorio input,
.form-group.campo-pendiente-obligatorio select,
.form-group.campo-pendiente-obligatorio textarea {
    border-color: var(--danger-border) !important;
    background-color: var(--danger-bg);
}
.form-group.campo-pendiente-obligatorio input:focus,
.form-group.campo-pendiente-obligatorio select:focus,
.form-group.campo-pendiente-obligatorio textarea:focus {
    border-color: var(--danger) !important;
    box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.12);
}
.form-group.campo-pendiente-obligatorio .campo-aviso-tag {
    display: inline-block;
    background: var(--danger-bg);
    color: var(--danger-dark);
    border: 1px solid var(--danger-border);
}
.form-group.campo-pendiente-obligatorio .campo-aviso-tag::before {
    content: '! ';
    font-weight: 700;
}

/* Estado: campo OPCIONAL sin rellenar */
.form-group.campo-pendiente-opcional input,
.form-group.campo-pendiente-opcional select,
.form-group.campo-pendiente-opcional textarea {
    border-color: var(--orange-border) !important;
    background-color: var(--orange-soft);
}
.form-group.campo-pendiente-opcional input:focus,
.form-group.campo-pendiente-opcional select:focus,
.form-group.campo-pendiente-opcional textarea:focus {
    border-color: var(--orange-primary) !important;
    box-shadow: 0 0 0 3px rgba(255, 106, 0, 0.10);
}
.form-group.campo-pendiente-opcional .campo-aviso-tag {
    display: inline-block;
    background: var(--orange-soft);
    color: var(--orange-dark);
    border: 1px solid var(--orange-border);
}

/* Mensaje de error inline (sólo se muestra cuando intentas continuar y faltan obligatorios) */
.campo-error-mensaje {
    display: none;
    margin-top: 6px;
    padding: 6px 10px;
    background: var(--danger-bg);
    border-left: 3px solid var(--danger);
    color: var(--danger-dark);
    font-size: 12.5px;
    border-radius: 3px;
    line-height: 1.5;
}
.form-group.campo-error-visible .campo-error-mensaje {
    display: block;
    animation: fadeInDown 0.2s ease;
}
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Banner global arriba de la ficha cuando hay obligatorios pendientes
   (aparece tras pulsar "Iniciar análisis") */
.ficha-validacion-banner {
    display: none;
    margin: 0 0 22px 0;
    padding: 12px 16px;
    background: var(--danger-bg);
    border: 1px solid var(--danger-border);
    border-left: 4px solid var(--danger);
    border-radius: 8px;
    color: var(--danger-dark);
    font-size: 13px;
    line-height: 1.5;
}
.ficha-validacion-banner.visible {
    display: block;
    animation: fadeInDown 0.25s ease;
}
.ficha-validacion-banner strong {
    color: var(--danger-dark);
}

/* Resumen pequeño bajo el bloque CIF tras autorrellenar (informativo) */
.ficha-resumen-relleno {
    margin: 0 0 18px 0;
    padding: 10px 14px;
    background: var(--info-bg);
    border: 1px solid var(--blue-border);
    border-radius: 8px;
    font-size: 12.5px;
    color: var(--info);
    line-height: 1.5;
}
.ficha-resumen-relleno.con-pendientes {
    background: var(--warning-bg);
    border-color: var(--warning-border);
    color: var(--warning);
}
.ficha-resumen-relleno.con-pendientes strong {
    color: var(--warning);
}


/* ============================================================================
   FASE 2 · Versión Free
   ============================================================================
   Estilos para:
   - Banner naranja "Versión Free" en la pantalla de resultados
   - Bloque CTA morado "Solicitar versión Premium"
   - Regla [data-premium-only] que se aplica desde JS para ocultar bloques
     premium en cuentas Free
   ============================================================================ */

/* Banner Free arriba de los resultados */
.banner-version-free {
    display: flex;
    align-items: center;
    gap: 16px;
    background: linear-gradient(135deg, #fff8f1 0%, #ffe8d4 100%);
    border: 1.5px solid #ff8c3a;
    border-left: 6px solid #ff6a00;
    border-radius: 12px;
    padding: 18px 22px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.banner-version-free-icono {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    background: #ff6a00;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
}
.banner-version-free-cuerpo {
    flex: 1;
    min-width: 240px;
}
.banner-version-free-titulo {
    font-size: 16px;
    font-weight: 700;
    color: #b8500a;
    margin-bottom: 4px;
    letter-spacing: -0.2px;
}
.banner-version-free-texto {
    font-size: 13px;
    color: #7c2d12;
    line-height: 1.55;
}
.banner-version-free-cta {
    flex-shrink: 0;
    display: inline-block;
    padding: 10px 18px;
    background: #5b21b6;
    color: white;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    transition: background 0.15s;
    white-space: nowrap;
}
.banner-version-free-cta:hover {
    background: #4c1d95;
    color: white;
    text-decoration: none;
}

/* Bloque CTA Premium al final de los resultados Free */
.cta-premium-bloque {
    margin-top: 36px;
    padding: 36px 32px;
    background: linear-gradient(135deg, #faf7ff 0%, #f3e8ff 100%);
    border: 2px solid #5b21b6;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(91, 33, 182, 0.12);
}
.cta-premium-icono {
    font-size: 48px;
    line-height: 1;
    margin-bottom: 14px;
}
.cta-premium-titulo {
    font-size: 24px;
    font-weight: 800;
    color: #5b21b6;
    margin: 0 0 12px;
    letter-spacing: -0.4px;
}
.cta-premium-texto {
    font-size: 15px;
    color: #1f2937;
    line-height: 1.6;
    max-width: 600px;
    margin: 0 auto 22px;
}
.cta-premium-texto strong { color: #5b21b6; }
.cta-premium-lista {
    list-style: none;
    padding: 0;
    margin: 0 auto 28px;
    max-width: 360px;
    text-align: left;
}
.cta-premium-lista li {
    padding: 7px 0;
    font-size: 14px;
    color: #1f2937;
    border-bottom: 1px solid #e9d5ff;
}
.cta-premium-lista li:last-child { border-bottom: none; }
.cta-premium-boton {
    padding: 14px 32px;
    background: #5b21b6;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
    box-shadow: 0 4px 14px rgba(91, 33, 182, 0.3);
    letter-spacing: 0.2px;
}
.cta-premium-boton:hover {
    background: #4c1d95;
    box-shadow: 0 6px 20px rgba(91, 33, 182, 0.4);
}
.cta-premium-boton:active { transform: scale(0.98); }
.cta-premium-boton:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
    box-shadow: none;
}
.cta-premium-confirmacion {
    margin-top: 18px;
    padding: 11px 16px;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-left: 3px solid #10b981;
    border-radius: 8px;
    color: #065f46;
    font-size: 13.5px;
    line-height: 1.5;
}

/* Cuando estamos en modo Free, los bloques marcados con data-premium-only
   se ocultan completamente. La clase 'modo-free-activo' se añade al body
   desde JS al detectar versionAnalisis === 'FREE'. */
body.modo-free-activo [data-premium-only="true"] {
    display: none !important;
}

/* La columna de matriz inherente, cuando es la única, se centra */
body.modo-free-activo .matrices-doble {
    grid-template-columns: 1fr !important;
    max-width: 720px;
    margin: 0 auto;
}

/* =============================================================================
   [LOTE 11] MODAL CORPORATIVO REUTILIZABLE
   ----------------------------------------------------------------------------
   Sustituye los confirm() y alert() nativos del navegador con un modal de
   paleta Innova (azul corporativo + naranja de acento). Activado desde
   client.js mediante abrirModalConfirmacionInnova(). Tiene estados:
     - icono (warning, info, error, exito) según el tipo
     - botones aceptar/cancelar configurables
     - opción "solo aceptar" (sin cancelar) para errores que no permiten elección
   ============================================================================= */
.innova-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(20, 63, 77, 0.6);
    backdrop-filter: blur(2px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: innovaModalFadeIn 0.18s ease-out;
}
@keyframes innovaModalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.innova-modal {
    background: white;
    border-radius: 14px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
    max-width: 520px;
    width: 100%;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    animation: innovaModalSlide 0.22s ease-out;
}
@keyframes innovaModalSlide {
    from { transform: translateY(-12px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.innova-modal-cabecera {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 22px 26px 14px 26px;
    border-bottom: 1px solid #f1f5f9;
}
.innova-modal-icono {
    font-size: 28px;
    line-height: 1;
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff3e6;
}
.innova-modal-icono.innova-modal-icono-aviso { background: #fff3e6; }
.innova-modal-icono.innova-modal-icono-error { background: #fef2f2; }
.innova-modal-icono.innova-modal-icono-info  { background: #eff6ff; }
.innova-modal-icono.innova-modal-icono-exito { background: #ecfdf5; }
.innova-modal-titulo {
    margin: 0;
    color: #143f4d;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.3;
}
.innova-modal-cuerpo {
    padding: 18px 26px 24px 26px;
    color: #1f2937;
    font-size: 14.5px;
    line-height: 1.6;
}
.innova-modal-cuerpo p {
    margin: 0 0 12px 0;
}
.innova-modal-cuerpo p:last-child {
    margin-bottom: 0;
}
.innova-modal-cuerpo strong {
    color: #143f4d;
}
.innova-modal-cuerpo .innova-modal-aviso {
    background: #fff8f0;
    border-left: 3px solid #ff6a00;
    padding: 11px 14px;
    border-radius: 6px;
    margin-top: 14px;
    font-size: 13.5px;
    color: #422006;
}
.innova-modal-acciones {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 26px 22px 26px;
    background: #f8fafc;
    border-top: 1px solid #f1f5f9;
}
.innova-modal-boton {
    padding: 10px 22px;
    border-radius: 8px;
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
}
.innova-modal-boton-primario {
    background: #ff6a00;
    color: white;
    box-shadow: 0 2px 6px rgba(255, 106, 0, 0.25);
}
.innova-modal-boton-primario:hover {
    background: #e55a00;
    box-shadow: 0 4px 10px rgba(255, 106, 0, 0.35);
    transform: translateY(-1px);
}
.innova-modal-boton-secundario {
    background: white;
    color: #475569;
    border: 1px solid #cbd5e1;
}
.innova-modal-boton-secundario:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}
/* Variante destructiva (para acciones irreversibles), usa rojo */
.innova-modal-boton-destructivo {
    background: #dc2626;
    color: white;
    box-shadow: 0 2px 6px rgba(220, 38, 38, 0.25);
}
.innova-modal-boton-destructivo:hover {
    background: #b91c1c;
    box-shadow: 0 4px 10px rgba(220, 38, 38, 0.35);
}

/* Botón "Volver a editar respuestas" cuando ya se ha consumido la edición */
#btnVolverAEditarRespuestas.btn-edicion-consumida {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* ==========================================================================
   [LOTE IA-AUTOCOMPLETAR-FRONTEND] Sugerencias IA del cuestionario
   --------------------------------------------------------------------------
   Banner superior que aparece mientras la IA propone respuestas (estado
   "cargando" → "listo") y bloques individuales bajo cada pregunta con la
   justificación editable. Tres estados visuales:
     - "evidencia"  (azul):   IA encontró base concreta para responder
     - "estimada"   (naranja): IA no pudo responder, propuesta a revisar
     - "revisada"   (verde):   el usuario interactuó (cambió opción o edito)
   ========================================================================== */

/* ----- Banner superior de estado global ----- */
.banner-sugerencias-ia {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border-radius: var(--radius-lg);
    margin-bottom: 18px;
    border: 1px solid var(--border-soft);
    box-shadow: var(--shadow-soft);
    animation: fadeIn 0.4s ease;
}

/* [LOTE BANNER-IA-VISIBILIDAD] El estado "cargando" gana mucha más
   presencia visual: borde izquierdo grueso azul (ancla la atención),
   fondo con shimmer suave que recorre el banner cada 3s (comunica
   "vivo" sin distraer), y padding ligeramente mayor. El "listo" mantiene
   la estética sobria porque ya no necesita captar atención. */
.banner-sugerencias-ia--cargando {
    background: linear-gradient(135deg, #e0efff 0%, #f5fbff 50%, #e0efff 100%);
    background-size: 200% 100%;
    border-color: #93c5fd;
    border-left: 4px solid #2563eb;
    padding: 16px 20px;
    animation: fadeIn 0.4s ease, bannerShimmer 3s ease-in-out infinite;
}

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

.banner-sugerencias-ia--listo {
    background: linear-gradient(135deg, #f0fdf4 0%, #ffffff 100%);
    border-color: #bbf7d0;
}

.banner-sugerencias-ia__icono {
    font-size: 28px;
    line-height: 1;
    flex-shrink: 0;
}

/* [LOTE BANNER-IA-VISIBILIDAD] Mientras el banner está cargando, el
   icono late suavemente (1.6s) — es lo que más comunica "sigo trabajando".
   En el banner "listo" el icono queda fijo. */
.banner-sugerencias-ia--cargando .banner-sugerencias-ia__icono {
    font-size: 32px;
    animation: iconoLatido 1.6s ease-in-out infinite;
    transform-origin: center;
}

@keyframes iconoLatido {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.12); }
}

.banner-sugerencias-ia__texto {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 13px;
    line-height: 1.45;
}

.banner-sugerencias-ia__texto strong {
    color: var(--blue-primary);
    font-size: 14px;
    font-weight: 700;
}

/* [LOTE BANNER-IA-VISIBILIDAD] En cargando, el título sube un punto
   y gana algo de tracking para reforzar presencia. */
.banner-sugerencias-ia--cargando .banner-sugerencias-ia__texto strong {
    font-size: 15px;
    letter-spacing: 0.1px;
}

.banner-sugerencias-ia__texto span {
    color: var(--text-muted);
}

/* [LOTE BANNER-IA-VISIBILIDAD] Spinner notablemente más grande y
   con borde más grueso para que se vea con claridad incluso de reojo.
   La velocidad se mantiene (0.9s) — más rápida agobia, más lenta
   parece colgada. */
.banner-sugerencias-ia__spinner {
    width: 36px;
    height: 36px;
    border: 4px solid #bfd4f0;
    border-top-color: var(--blue-primary);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
    flex-shrink: 0;
}

.banner-sugerencias-ia__cerrar {
    background: transparent;
    border: 0;
    cursor: pointer;
    font-size: 16px;
    color: var(--text-muted);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: background 0.15s ease;
}

.banner-sugerencias-ia__cerrar:hover {
    background: var(--bg-neutral);
    color: var(--blue-primary);
}

/* ----- Bloque individual de sugerencia bajo cada pregunta ----- */
.ia-sugerencia-slot {
    /* Contenedor neutro: cuando no hay sugerencia, queda invisible y sin
       espacio para no estropear el layout original. */
}

.ia-sugerencia-bloque {
    margin: 10px 0 14px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    border-left: 4px solid;
    background: var(--bg-neutral);
    animation: fadeIn 0.4s ease;
}

.ia-sugerencia-bloque--evidencia {
    background: #f0f7ff;
    border-left-color: #2563eb;
}

.ia-sugerencia-bloque--estimada {
    background: #fff7ed;
    border-left-color: #ea580c;
}

.ia-sugerencia-bloque--revisada {
    background: #f0fdf4;
    border-left-color: #15803d;
}

.ia-sugerencia-bloque__header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.ia-sugerencia-bloque__badge {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 12px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.ia-sugerencia-bloque--evidencia .ia-sugerencia-bloque__badge {
    background: #dbeafe;
    color: #1e40af;
}

.ia-sugerencia-bloque--estimada .ia-sugerencia-bloque__badge {
    background: #fed7aa;
    color: #9a3412;
}

.ia-sugerencia-bloque--revisada .ia-sugerencia-bloque__badge {
    background: #bbf7d0;
    color: #14532d;
}

.ia-sugerencia-bloque__justificacion {
    width: 100%;
    box-sizing: border-box;
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--text-primary);
    font-family: inherit;
    resize: vertical;
    min-height: 44px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ia-sugerencia-bloque__justificacion:focus {
    outline: none;
    border-color: var(--blue-primary);
    box-shadow: 0 0 0 3px rgba(20, 63, 77, 0.12);
}

.ia-sugerencia-bloque__fuentes {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px dashed var(--border-soft);
}

.ia-sugerencia-bloque__fuentes strong {
    color: var(--blue-primary);
    font-weight: 600;
}

/* Responsive: en pantallas estrechas, el banner reorganiza su layout. */
@media (max-width: 600px) {
    .banner-sugerencias-ia {
        flex-wrap: wrap;
        padding: 12px 14px;
    }

    .banner-sugerencias-ia__texto {
        font-size: 12px;
    }

    .banner-sugerencias-ia__texto strong {
        font-size: 13px;
    }
}
