/* PrevenCloud · estilos (sin dependencias externas; compatible con CSP 'self': nada de estilos en línea)
 *
 * Identidad: manual de Grupo Inprex (matriz) — verde Pantone 368 C #61bf1a y gris del logotipo #473a3a —
 * y manual de Mediprex — azules P-298C, P-300C y P-295C —. La marca cambia con el servicio activo (.marca-*).
 * Tipografías libres alojadas aquí (OFL): Jost (equivalente a la Futura del logotipo) para títulos y cifras,
 * Inter para el texto. Licencias en public/fonts/.
 */
@font-face { font-family: "Jost"; font-weight: 500; font-display: swap; src: url("../fonts/jost-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Jost"; font-weight: 600; font-display: swap; src: url("../fonts/jost-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Jost"; font-weight: 700; font-display: swap; src: url("../fonts/jost-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 400; font-display: swap; src: url("../fonts/inter-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 500; font-display: swap; src: url("../fonts/inter-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 600; font-display: swap; src: url("../fonts/inter-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 700; font-display: swap; src: url("../fonts/inter-latin-700-normal.woff2") format("woff2"); }

:root, .marca-inprex {
    /* Marca (Grupo Inprex por defecto) */
    --p: #61bf1a;          /* verde corporativo: gráficos, barras, detalles (no para texto: poco contraste) */
    --pd: #3d7a1f;         /* verde oscuro: botones, enlaces y texto de marca */
    --pdd: #2f6117;        /* hover de botones */
    --ps: #eef7e6;         /* fondo suave */
    --pb: #c9e6b1;         /* borde suave */
    --pl: #bfe59f;         /* tono claro para gráficos */
    --ink: #473a3a;        /* gris del logotipo: títulos y cifras */
    --foco: rgba(97, 191, 26, .45);
}
.marca-mediprex {
    --p: #59b3de;          /* P-298C */
    --pd: #005eb8;         /* P-300C */
    --pdd: #004a91;
    --ps: #e8f4fb;
    --pb: #b9dff2;
    --pl: #b9dff2;
    --ink: #002e60;        /* P-295C */
    --foco: rgba(0, 94, 184, .35);
}
:root, .app {
    /* Nombres antiguos, que siguen usando muchas pantallas (se declaran también en .app para que tomen la marca) */
    --verde: var(--p);
    --verde-osc: var(--pd);
    --verde-claro: var(--ps);
    --gris: var(--ink);
    --gris-claro: var(--fondo);
}
:root {
    /* Neutros y estados (no cambian con la marca) */
    --fondo: #f4f5f3;
    --superficie: #ffffff;
    --borde: #e4e2df;
    --borde-suave: #efedea;
    --texto: #2b2626;
    --suave: #6b6461;
    --ok: #2f6a12; --ok-claro: #e7f5dd; --ok-borde: #bcdcaa;
    --ambar: #8a5300; --ambar-claro: #fff3dc; --ambar-borde: #f0d199;
    --rojo: #b42318; --rojo-claro: #fdeaea; --rojo-borde: #f1b5b0;
    --radio: 10px;
    --radio-g: 14px;
    --sombra: 0 1px 2px rgba(40, 30, 25, .04), 0 6px 18px rgba(40, 30, 25, .05);
    --titulos: "Jost", "Futura", "Century Gothic", "Segoe UI", sans-serif;
    font-family: "Inter", "Segoe UI", Arial, "Liberation Sans", sans-serif;
    color: var(--texto);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--fondo); line-height: 1.5; font-size: 15px; }
a { color: var(--pd); }
h1, h2, h3 { font-family: var(--titulos); font-weight: 600; color: var(--ink); }
h1 { font-size: 1.85rem; margin: 0 0 1rem; line-height: 1.2; }
h2 { font-size: 1.2rem; margin: 0 0 .5rem; }
:focus-visible { outline: 3px solid var(--foco); outline-offset: 2px; }
.icono { width: 1.25em; height: 1.25em; flex-shrink: 0; }
/* Controles de formulario: mismo aspecto en toda la aplicación (:where no suma especificidad: cualquier regla concreta manda) */
:where(select, textarea, input:not([type=checkbox]):not([type=radio]):not([type=hidden]):not([type=submit]):not([type=button]):not([type=range]):not([type=color])) {
    min-height: 40px; padding: .45rem .7rem; border: 1px solid #d9d6d2; border-radius: 8px; font: inherit; font-size: .95rem; color: var(--texto);
    background-color: #fff; max-width: 100%; }
:where(select) { padding-right: 2rem; cursor: pointer; }
:where(input[type=file]) { padding: .35rem .5rem; }

/* Estructura: menú lateral + cuerpo */
.app { display: flex; min-height: 100vh; background: linear-gradient(90deg, var(--superficie) 0 255px, var(--borde) 255px 256px, transparent 256px); }
.app__cuerpo { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.menu-abrir { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.menu { width: 256px; flex-shrink: 0; background: var(--superficie); border-right: 1px solid var(--borde); padding: 1rem .8rem 2rem;
    position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.menu ul { list-style: none; margin: 0; padding: 0; }
.menu__logo { display: flex; flex-direction: column; align-items: center; gap: .35rem; padding: .3rem .5rem 1rem; margin-bottom: .6rem;
    border-bottom: 1px solid var(--borde-suave); text-decoration: none; }
.menu__logo img { width: auto; height: 62px; max-width: 100%; }
.menu__producto { font-family: var(--titulos); font-size: .95rem; color: var(--suave); letter-spacing: .02em; }
.menu__producto b { color: var(--pd); font-weight: 600; }
.menu__item { display: flex; align-items: center; gap: .75rem; padding: .55rem .75rem; margin: 1px 0; border-radius: var(--radio);
    color: #4a4341; text-decoration: none; font-size: .93rem; }
.menu__icono { width: 20px; height: 20px; flex-shrink: 0; color: #8a8380; }
.menu__item:hover { background: var(--fondo); color: var(--texto); }
.menu__item--activo, .menu__item--activo:hover { background: var(--ps); color: var(--pd); font-weight: 600; }
.menu__item--activo .menu__icono { color: var(--pd); }
.menu__item--pendiente, .menu__item--pendiente:hover { color: #a29b97; background: none; cursor: default; }
.menu__item--pendiente::after { content: "pronto"; margin-left: auto; font-size: .68rem; padding: 0 .4rem; border-radius: 999px; background: var(--fondo); }
.menu__grupo { margin-top: 1rem; }
.menu__titulo { display: block; padding: 0 .75rem .3rem; color: var(--suave); font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }
.contenido { flex: 1; padding: 1.75rem 2rem 3rem; min-width: 0; width: 100%; max-width: 1320px; }

/* Barra superior */
.barra { display: flex; align-items: center; flex-wrap: wrap; gap: .75rem; background: var(--superficie); border-bottom: 1px solid var(--borde);
    padding: .7rem 2rem; position: sticky; top: 0; z-index: 5; }
.barra__menu { display: none; align-items: center; justify-content: center; width: 44px; height: 44px; border: 1px solid var(--borde);
    border-radius: var(--radio); cursor: pointer; color: var(--texto); }
.barra__buscar { flex: 1 1 260px; max-width: 440px; display: flex; align-items: center; gap: .6rem; height: 42px; padding: 0 .8rem; margin: 0;
    background: var(--fondo); border: 1px solid var(--borde); border-radius: var(--radio); color: var(--suave); }
.barra__buscar:focus-within { border-color: var(--pd); box-shadow: 0 0 0 3px var(--foco); }
.barra__buscar input { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; color: var(--texto); outline: none; }
.barra__hueco { flex: 1 1 0; }
.barra__usuario { display: flex; align-items: center; gap: .65rem; }
.barra__quien { display: flex; flex-direction: column; line-height: 1.2; }
.barra__nombre { font-weight: 600; font-size: .92rem; }
.barra__rol { font-size: .78rem; color: var(--suave); }
.barra__salir { margin: 0; }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
    background: var(--ink); color: #fff; font-family: var(--titulos); font-weight: 600; font-size: .95rem; }

/* Botones */
.boton { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 40px; padding: .45rem 1rem;
    border: 1px solid #d9d6d2; border-radius: var(--radio); background: var(--superficie); color: var(--texto); font: inherit; font-weight: 600;
    font-size: .92rem; cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s; }
.boton:hover { border-color: var(--pd); color: var(--pd); }
.boton--principal { background: var(--pd); border-color: var(--pd); color: #fff; }
.boton--principal:hover { background: var(--pdd); border-color: var(--pdd); color: #fff; }
.boton--claro { min-height: 34px; padding: .25rem .8rem; }
.boton--icono { width: 40px; padding: 0; }
.boton--ancho { width: 100%; }
.boton--microsoft { width: 100%; padding: .75rem 1rem; background: #fff; border-color: #8c8c8c; color: var(--texto); }
.boton .icono { width: 18px; height: 18px; }

/* Chips de rol */
.chip { display: inline-block; padding: .1rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--fondo); border: 1px solid var(--borde); }
.chip--tecnico { background: #e8f1fb; border-color: #b9d3ef; color: #1d4f86; }
.chip--coordinador { background: var(--ok-claro); border-color: var(--ok-borde); color: var(--ok); }
.chip--director { background: var(--ambar-claro); border-color: var(--ambar-borde); color: var(--ambar); }
.chip--admin { background: #f3e8f8; border-color: #d7b8e6; color: #6b2d86; }
.chip--aviso { background: var(--rojo-claro); border-color: var(--rojo-borde); color: var(--rojo); }

/* Avisos */
.aviso { padding: .75rem 1rem; border-radius: var(--radio); background: var(--superficie); border: 1px solid var(--borde); margin: 0 0 1rem; }
.aviso ul { margin: 0; padding-left: 1.2rem; }
.aviso--ok { background: var(--ok-claro); border-color: var(--ok-borde); color: #234f0e; }
.aviso--error { background: var(--rojo-claro); border-color: var(--rojo-borde); color: #8a1c1c; }
.aviso--atencion { background: var(--ambar-claro); border-color: var(--ambar-borde); color: #6b4300; }
.texto-suave { color: var(--suave); }

/* Acceso */
.acceso { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; background: var(--fondo); }
.acceso__caja { width: 100%; max-width: 400px; background: #fff; padding: 2rem; border-radius: var(--radio-g); border: 1px solid var(--borde);
    box-shadow: var(--sombra); }
.acceso__logo { display: block; margin: 0 auto .8rem; height: 84px; width: auto; }
.acceso__marca { font-size: 1.8rem; margin: 0; text-align: center; }
.acceso__marca b { color: var(--pd); }
.acceso__sub { text-align: center; color: var(--suave); margin: .2rem 0 1.5rem; }
.acceso__local { text-align: center; margin: 1.2rem 0 0; font-size: .85rem; }

/* Formularios */
.formulario { max-width: 560px; background: var(--superficie); padding: 1.5rem; border-radius: var(--radio-g); border: 1px solid var(--borde); box-shadow: var(--sombra); }
.campo { display: block; margin-bottom: 1rem; }
.campo > span { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .3rem; }
.campo input[type=text], .campo input[type=email], .campo input[type=password], .campo input[type=search], .campo input[type=tel], .campo select {
    width: 100%; min-height: 40px; padding: .5rem .7rem; border: 1px solid #d9d6d2; border-radius: 8px; font: inherit; background: #fff; }
.campo small { display: block; color: var(--suave); margin-top: .25rem; }
.campo--check { display: flex; align-items: center; gap: .5rem; }
.campo--check > span { margin: 0; }
.acciones { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.2rem; }

/* Listados */
.cabecera { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem; margin-bottom: 1rem; }
.cabecera h1 { margin: 0; }
.buscador { display: flex; gap: .5rem; margin-bottom: 1rem; max-width: 520px; }
.buscador input { flex: 1; min-height: 40px; padding: .5rem .7rem; border: 1px solid #d9d6d2; border-radius: 8px; font: inherit; background: #fff; }
.tabla { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio-g); overflow: hidden; }
.tabla th, .tabla td { padding: .65rem .8rem; text-align: left; border-bottom: 1px solid var(--borde-suave); }
.tabla tr:last-child td { border-bottom: 0; }
.tabla thead th { background: #faf9f8; font-size: .74rem; font-weight: 600; color: var(--suave); text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--borde); }
.tabla tbody tr:hover td { background: #fbfbfa; }
.tabla__fila--baja td { color: var(--suave); }
.pagination { display: flex; gap: .3rem; list-style: none; padding: 0; }
.pagination a { display: block; min-width: 34px; padding: .35rem .65rem; border: 1px solid var(--borde); border-radius: 8px; background: #fff; text-decoration: none; text-align: center; }
.pagination .active a { background: var(--pd); color: #fff; border-color: var(--pd); }

/* Tarjetas genéricas */
.tarjetas { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.tarjeta { background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio-g); padding: 1.1rem 1.2rem; box-shadow: var(--sombra); }
.tarjeta p { margin: 0; }

@media (max-width: 900px) {
    .app { background: none; }
    .menu { position: fixed; z-index: 20; left: 0; top: 0; transform: translateX(-105%); transition: transform .2s; box-shadow: 0 0 40px rgba(0, 0, 0, .2); }
    .menu-abrir:checked ~ .menu { transform: none; }
    .barra { padding: .6rem 1rem; }
    .barra__menu { display: inline-flex; }
    .barra__quien { display: none; }
    .contenido { padding: 1rem; }
    .tabla { display: block; overflow-x: auto; }
}

/* Importación */
.acciones--cabecera { margin: 0; }
.bloque { background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio-g); padding: 1.1rem 1.25rem; margin-bottom: 1rem; box-shadow: var(--sombra); }
.bloque h2 { display: flex; align-items: center; gap: .5rem; }
.contador { display: inline-block; min-width: 1.6rem; padding: 0 .45rem; border-radius: 999px; background: var(--gris-claro);
    border: 1px solid var(--borde); font-size: .85rem; text-align: center; }
.contador--verde { background: var(--ps); border-color: var(--pb); color: var(--pd); font-weight: 600; }
.contador--rojo { background: var(--rojo-claro); border-color: var(--rojo-borde); color: var(--rojo); font-weight: 600; }
.resumen { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.resumen .tarjeta { min-width: 180px; }
.resumen strong { font-family: var(--titulos); font-size: 1.9rem; font-weight: 600; display: block; color: var(--ink); line-height: 1.1; }

/* Formularios anchos, módulos de permisos, zona de peligro */
.formulario--ancho, .bloque--ancho { max-width: 900px; }
.fila { display: flex; gap: 1rem; flex-wrap: wrap; }
.fila > .campo { flex: 1 1 220px; }
.fila > .campo--corto, .campo--corto { flex: 0 1 160px; }
.fila--multiple > .campo { flex: 0 1 150px; }
.grupo-campos { border: 1px solid var(--borde); border-radius: var(--radio); padding: .8rem 1rem 1rem; margin: 0 0 1rem; }
.grupo-campos legend { font-weight: bold; padding: 0 .4rem; color: var(--gris); }
.grupo-campos .campo--check { display: flex; align-items: flex-start; gap: .5rem; margin: .35rem 0; }
.modulos { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .8rem 1.5rem; }
.modulo h3 { font-family: inherit; font-size: .8rem; margin: .2rem 0 .3rem; color: var(--pd); text-transform: uppercase; letter-spacing: .05em; }
.en-linea { display: inline; margin: 0; }
.boton--peligro { border-color: var(--rojo-borde); color: var(--rojo); }
.boton--peligro:hover { background: var(--rojo-claro); border-color: var(--rojo); }
.zona-peligro { display: flex; align-items: center; gap: .8rem; margin-top: 1.5rem; }
code { font-size: .85em; background: var(--gris-claro); padding: .05rem .3rem; border-radius: 3px; }

/* Selector de servicio (barra superior), filtros del registro */
.servicio { display: flex; align-items: center; gap: .55rem; margin: 0; height: 42px; padding: 0 .4rem 0 .8rem; border: 1px solid var(--borde);
    border-radius: var(--radio); background: var(--superficie); font-weight: 600; position: relative; }
.servicio:focus-within { border-color: var(--pd); box-shadow: 0 0 0 3px var(--foco); }
.servicio__punto { width: 10px; height: 10px; border-radius: 50%; background: var(--p); flex-shrink: 0; }
.servicio select { appearance: none; -webkit-appearance: none; border: 0; background: transparent; font: inherit; color: var(--texto);
    padding: 0 1.8rem 0 0; height: 100%; max-width: 280px; cursor: pointer; outline: none; }
.servicio::after { content: ""; position: absolute; right: .9rem; top: 50%; width: .4rem; height: .4rem; margin-top: -.3rem;
    border-right: 2px solid var(--suave); border-bottom: 2px solid var(--suave); transform: rotate(45deg); pointer-events: none; }
.servicio--fijo { padding-right: .9rem; }
.servicio--fijo::after { display: none; }
.filtros { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1rem; }
.filtros input, .filtros select { padding: .45rem .6rem; border: 1px solid var(--borde); border-radius: var(--radio); font: inherit; background: #fff; }
.filtros .campo--check { display: flex; align-items: center; gap: .3rem; }
.tabla--compacta th, .tabla--compacta td { padding: .35rem .5rem; font-size: .85rem; vertical-align: top; }
.nowrap { white-space: nowrap; }
.solo-lectura { color: var(--suave); }

/* IA */
.tarjetas--espacio { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); margin-top: 1rem; }
.lista-estado { list-style: none; padding: 0; margin: .4rem 0 0; }
.lista-estado li { margin: .15rem 0; }
.instrucciones { white-space: pre-wrap; background: #fff; border: 1px solid var(--borde); border-radius: var(--radio); padding: 1rem 1.2rem;
    font-family: Consolas, "Liberation Mono", monospace; font-size: .85rem; line-height: 1.5; max-width: 1000px; }

/* Generar EV */
.separado { margin-top: 1rem; }
.modal { border: 0; border-radius: var(--radio-g); padding: 1.5rem; max-width: 460px; width: calc(100% - 2rem); border-top: 6px solid var(--ambar);
    box-shadow: 0 10px 40px rgba(0, 0, 0, .25); }
.modal::backdrop { background: rgba(30, 30, 30, .45); }
.modal h2 { margin-top: 0; }
.modal--ancho { max-width: 560px; border-top-color: var(--verde); }
.opciones { border: 1px solid #e3e3e3; border-radius: 8px; padding: .5rem .9rem .7rem; margin: 0 0 .9rem; }
.opciones legend { font-weight: 600; padding: 0 .3rem; }
.opciones label { display: block; padding: .25rem 0; cursor: pointer; }
.opciones input { margin-right: .45rem; }
.opciones--lista { max-height: 40vh; overflow-y: auto; }
.opciones--lista label { padding: .35rem 0; border-bottom: 1px solid #f0f0f0; }
.generando { margin-left: .8rem; color: var(--suave); }
.tabla th[scope], .tabla tbody th { width: 190px; background: var(--gris-claro); }

/* Estado de la copia en el gestor documental (resultado de Generar EV) */
.texto-ok { color: var(--ok); font-weight: 600; }
.texto-error { color: #8a1c1c; }
.boton--pequeno { padding: .2rem .6rem; font-size: .85rem; margin-left: .5rem; }

/* Empresas y Plan de Prevención */
.miga { margin: 0 0 .3rem; font-size: .85rem; color: var(--suave); }
.miga a { color: var(--suave); }
.ficha { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .7rem 1.2rem; background: var(--superficie);
    border: 1px solid var(--borde); border-radius: var(--radio-g); padding: 1.1rem 1.25rem; margin: 0 0 1rem; box-shadow: var(--sombra); }
.ficha dt { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--suave); }
.ficha dd { margin: .1rem 0 0; font-weight: 600; }
.pestanas { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 1rem; }
.pestanas a { display: inline-flex; align-items: center; gap: .4rem; padding: .35rem .8rem; background: #fff; border: 1px solid var(--borde);
    border-radius: 999px; text-decoration: none; color: var(--gris); font-size: .9rem; }
.pestanas a:hover { border-color: var(--pd); color: var(--pd); }
.bloque .cabecera { margin-bottom: .6rem; }
.bloque .cabecera h2 { margin: 0; }
.num, .tabla th.num, .tabla td.num { text-align: right; }
.estado { display: inline-block; padding: .05rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600; vertical-align: middle; border: 1px solid; }
.estado--borrador { background: var(--ambar-claro); border-color: var(--ambar-borde); color: var(--ambar); }
.estado--finalizado { background: var(--ok-claro); border-color: var(--ok-borde); color: var(--ok); }
h1 .estado { font-size: .8rem; margin-left: .4rem; }
h1 small { font-weight: normal; }
fieldset.sin-borde { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset[disabled] input, fieldset[disabled] select { background: var(--gris-claro); color: var(--texto); }
.campo input[type=date] { padding: .5rem .6rem; border: 1px solid var(--borde); border-radius: var(--radio); font: inherit; }
.tabla--formulario td { padding: .3rem .35rem; }
.tabla--formulario input, .tabla--formulario select { width: 100%; min-width: 6rem; padding: .35rem .45rem; border: 1px solid var(--borde);
    border-radius: var(--radio); font: inherit; font-size: .88rem; background: #fff; }
.organigrama { margin: 0 0 1rem; }
.organigrama img { max-width: 100%; max-height: 360px; border: 1px solid var(--borde); border-radius: var(--radio); background: #fff; }
.barra-acciones { position: sticky; bottom: 0; background: var(--fondo); padding: .8rem 0; margin: 0 0 1rem; border-top: 1px solid var(--borde); z-index: 2; }
.boton--generar { background: var(--ink); border-color: var(--ink); color: #fff; }
.boton--generar:hover { background: #2a2121; border-color: #2a2121; color: #fff; }
.filtros--en-tabla { margin: 0; }
.plan-form .bloque { max-width: 1100px; }

/* Ficha: contratos del NIF */
.subtitulo { margin: .2rem 0 0; color: var(--suave); font-size: .9rem; }
.contratos { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: .8rem; margin: 0 0 1.4rem; }
.contrato { display: flex; flex-direction: column; gap: .25rem; padding: .8rem 1rem; background: #fff; border: 1px solid var(--borde);
    border-radius: var(--radio); text-decoration: none; color: var(--texto); border-top: 4px solid var(--borde); transition: border-color .15s, box-shadow .15s; }
.contrato:hover { border-color: var(--pb); box-shadow: var(--sombra); }
.contrato--actual { border-color: var(--p); border-top-color: var(--p); box-shadow: var(--sombra); }
.contrato--baja { opacity: .7; }
.contrato__num { font-size: .8rem; font-weight: bold; letter-spacing: .04em; color: var(--verde-osc); }
.contrato__act { font-weight: bold; font-size: 1rem; line-height: 1.3; }
.contrato__meta { font-size: .82rem; color: var(--suave); }
.contrato__srv { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .35rem; }
.sello { display: inline-block; padding: .05rem .5rem; border-radius: 999px; font-size: .74rem; border: 1px solid var(--borde); background: var(--gris-claro); color: var(--gris); }
.sello--verde { background: var(--ps); border-color: var(--pb); color: var(--pd); font-weight: 700; }
.sello--azul { background: #e8f1fb; border-color: #b9d3ef; color: #1d4f86; }
.sello--rojo { background: var(--rojo-claro); border-color: var(--rojo-borde); color: var(--rojo); }
.sello--gris { color: var(--suave); }
.contrato-titulo { display: flex; align-items: baseline; gap: .6rem; margin: 0 0 .6rem; font-size: 1.15rem; }
.contrato-titulo small { font-weight: normal; color: var(--suave); font-size: .9rem; }
.historico { margin-top: .8rem; }
.historico summary { cursor: pointer; color: var(--verde-osc); font-size: .9rem; margin-bottom: .5rem; }

/* Medidas de emergencia: fotos de la inspección y observaciones */
.bloque textarea { width: 100%; box-sizing: border-box; font: inherit; padding: .5rem .6rem; border: 1px solid var(--borde, #cfd3cc); border-radius: 6px; resize: vertical; }
.fotos { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .8rem; margin: 0 0 1rem; }
.foto { margin: 0; display: flex; flex-direction: column; gap: .35rem; }
.foto img { width: 100%; height: 130px; object-fit: cover; border-radius: 6px; border: 1px solid var(--borde, #cfd3cc); background: #f4f5f2; }
.foto input[type=text] { width: 100%; box-sizing: border-box; }
.separado-abajo { display: block; margin: 0 0 1rem; }

/* Evaluaciones psicosociales: niveles de riesgo y barras de distribución (SVG con atributos, sin estilos en línea) */
.nivel { display: inline-block; padding: .05rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600; border: 1px solid; white-space: nowrap; }
.nivel--0 { background: var(--ok-claro); border-color: var(--ok-borde); color: var(--ok); }
.nivel--1 { background: #f3f8e4; border-color: #d6e6a6; color: #55701a; }
.nivel--2 { background: #fff7e6; border-color: #f0d199; color: #6b4300; }
.nivel--3 { background: var(--rojo-claro); border-color: #f1b5b0; color: #8a1c1c; }
.nivel--oculto { background: var(--gris-claro); border-color: var(--borde); color: var(--suave); font-weight: normal; }
.dist { display: block; width: 100%; min-width: 140px; height: 14px; border-radius: 3px; overflow: hidden; }
.dist .r0 { fill: #5aa832; } .dist .r1 { fill: #a8c84a; } .dist .r2 { fill: #e0a32e; } .dist .r3 { fill: #c62828; } .dist .vacio { fill: #e4e6e1; }
.leyenda { display: flex; flex-wrap: wrap; gap: .4rem .9rem; font-size: .8rem; color: var(--suave); margin: .4rem 0 .8rem; }
.enlace-psico { display: flex; gap: 1.2rem; align-items: flex-start; flex-wrap: wrap; }
.enlace-psico img { width: 150px; height: 150px; border: 1px solid var(--borde); border-radius: var(--radio); background: #fff; }
.enlace-psico input[type=text] { width: 100%; max-width: 560px; padding: .5rem .6rem; border: 1px solid var(--borde); border-radius: var(--radio); font: inherit; font-size: .85rem; }
.enlace-psico__datos { flex: 1 1 300px; }
.unidades { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .1rem 1rem; max-height: 320px; overflow-y: auto; }
.matriz th, .matriz td { text-align: center; }
.matriz th:first-child, .matriz td:first-child { text-align: left; }
.textos-dim { border-top: 1px solid var(--borde); padding-top: .8rem; margin-top: .8rem; }
.textos-dim h3 { display: flex; align-items: center; gap: .5rem; font-size: 1rem; margin: 0 0 .5rem; }
.campo textarea, .campo input[type=number] { width: 100%; padding: .5rem .6rem; border: 1px solid var(--borde); border-radius: var(--radio); font: inherit; }
.campo input[type=number] { max-width: 9rem; }
.json { font-family: Consolas, "Liberation Mono", monospace; font-size: .82rem; line-height: 1.45; min-height: 420px; }
.tabla-scroll { overflow-x: auto; }
/* Formación: convocatorias por Teams */
.oculto { position: absolute; left: -9999px; width: 1px; height: 1px; }
.pasos-conv { display: flex; flex-wrap: wrap; gap: .4rem; list-style: none; padding: 0; margin: .5rem 0 1rem; counter-reset: paso; }
.pasos-conv li { counter-increment: paso; padding: .35rem .7rem; border: 1px solid var(--borde); border-radius: 999px; font-size: .85rem; color: var(--suave); background: #fff; }
.pasos-conv li::before { content: counter(paso) ". "; font-weight: 700; }
.pasos-conv li.hecho { color: var(--pd); border-color: var(--pb); background: var(--ps); }
.pasos-conv li.actual { color: #fff; background: var(--pd); border-color: var(--pd); font-weight: 600; }
.bloque--teams { border-left: 4px solid #5b5fc7; }
.guion { border: 1px solid var(--borde); border-left: 4px solid var(--p); background: #fff; padding: .8rem 1rem; border-radius: var(--radio); font-size: 1.02rem; line-height: 1.55; }
.guion p { margin: 0 0 .6rem; }
.vista-texto { white-space: pre-wrap; font-family: inherit; background: var(--gris-claro); border: 1px solid var(--borde); border-radius: var(--radio); padding: .7rem .9rem; margin: .3rem 0 0; }
details > summary { cursor: pointer; padding: .2rem 0; }
.ficha dd code { word-break: break-all; }
/* Paginación de tablas (data-paginar) */
tr.pag-fuera { display: none; }
.paginacion { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; margin: .5rem 0 0; }
.paginacion__info { color: var(--suave); font-size: .85rem; margin-right: .4rem; }
.paginacion__salto { color: var(--suave); padding: 0 .2rem; }
/* Apartados de la ficha del cliente con el aspecto de las tarjetas de contrato */
.apartado { padding: 1.1rem 1.25rem 1.2rem; }
.apartado__titulo { display: flex; align-items: center; flex-wrap: wrap; gap: .6rem; margin: 0; font-size: 1.15rem; }
.apartado__icono { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: var(--radio);
    background: var(--ps); color: var(--pd); flex-shrink: 0; }
.apartado__icono .icono { width: 20px; height: 20px; }
.apartado__titulo .sello { font-size: .78rem; }
.apartado__pie { margin: .4rem 0 0; font-size: .82rem; color: var(--suave); }
.apartado h3 { font-family: inherit; font-size: .76rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--suave); margin: 1rem 0 .4rem; }
.apartado > .cabecera, .apartado > .apartado__titulo { margin-bottom: .7rem; }
.apartado .tabla { margin-bottom: 0; }


/* Inicio: cuadro de mando */
.saludo { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.saludo h1 { margin: .15rem 0 0; font-size: 2.1rem; }
.saludo__fecha { margin: 0; font-size: .85rem; color: var(--suave); }
.saludo__texto { margin: .35rem 0 0; color: #5c5552; }
.saludo__acciones { display: flex; flex-wrap: wrap; gap: .6rem; }
.cifras { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.cifra { display: grid; grid-template-columns: auto 1fr; grid-template-areas: "icono etq" "valor valor" "pie pie"; align-items: center; column-gap: .75rem; row-gap: .55rem;
    padding: 1.1rem 1.2rem; background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio-g); box-shadow: var(--sombra);
    color: inherit; text-decoration: none; transition: border-color .15s, transform .15s; }
.cifra:hover { border-color: var(--pb); transform: translateY(-1px); }
.cifra__icono { grid-area: icono; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: var(--radio);
    background: var(--ps); color: var(--pd); flex-shrink: 0; }
.cifra__etq { grid-area: etq; font-weight: 500; color: #5c5552; font-size: .92rem; }
.cifra__valor { grid-area: valor; font-family: var(--titulos); font-weight: 600; font-size: 2.5rem; line-height: 1; color: var(--ink); }
.cifra__pie { grid-area: pie; font-size: .8rem; color: var(--suave); }
.sello--ambar { background: var(--ambar-claro); border-color: var(--ambar-borde); color: var(--ambar); font-weight: 600; }
.sello--ok { background: var(--ok-claro); border-color: var(--ok-borde); color: var(--ok); font-weight: 600; }
.paneles { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 1rem; }
.panel { flex: 1 1 340px; min-width: 0; background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio-g); box-shadow: var(--sombra);
    padding: 1.2rem 1.25rem; display: flex; flex-direction: column; gap: .8rem; }
.panel--ancho { flex: 2 1 520px; }
.panel--solo { margin-bottom: 1rem; }
.panel__cab { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem; }
.panel__cab h2 { margin: 0; font-size: 1.15rem; }
.panel__sub { margin: .1rem 0 0; font-size: .8rem; color: var(--suave); }
.panel__enlace { font-size: .88rem; font-weight: 600; text-decoration: none; }
.panel__vacio { margin: 0; color: var(--suave); }
.leyenda-graf { display: flex; flex-wrap: wrap; gap: .3rem 1rem; list-style: none; margin: 0; padding: 0; font-size: .8rem; color: #5c5552; }
.leyenda-graf li { display: flex; align-items: center; gap: .4rem; }
.leyenda-graf__marca { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.grafico { display: block; height: auto; font-family: inherit; }
.grafico__rejilla { stroke: #eceae7; stroke-width: 1; }
.grafico__eje { fill: var(--suave); font-size: 12px; }
.grafico__total { fill: #4a4341; font-size: 12px; font-weight: 600; }
.g-ev { fill: var(--ink); background: var(--ink); }
.g-planes { fill: var(--p); background: var(--p); }
.g-emergencias { fill: var(--pl); background: var(--pl); }
.g-psico { fill: #b9b0ab; background: #b9b0ab; }
.donut { position: relative; display: flex; justify-content: center; }
.donut svg { transform: rotate(0deg); }
.donut__fondo { stroke: #f0eeec; }
.d-ok { stroke: var(--p); background: var(--p); }
.d-ambar { stroke: #e8a33d; background: #e8a33d; }
.d-rojo { stroke: #c4473a; background: #c4473a; }
.donut__centro { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.donut__centro strong { font-family: var(--titulos); font-weight: 600; font-size: 2.2rem; line-height: 1; color: var(--ink); }
.donut__centro span { font-size: .8rem; color: var(--suave); }
.donut__leyenda { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .45rem; }
.donut__leyenda li { display: flex; align-items: center; gap: .6rem; }
.donut__leyenda li span:nth-child(2) { flex: 1; color: #4a4341; }
.donut__leyenda strong { font-family: var(--titulos); font-size: 1.05rem; }
.agenda, .tareas { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.agenda__fila { display: flex; align-items: center; gap: .9rem; padding: .6rem; border: 1px solid var(--borde-suave); border-radius: 12px; color: inherit; text-decoration: none; }
.agenda__fila:hover, .tareas__fila:hover { background: #fafaf9; border-color: var(--pb); }
.agenda__fecha { flex: 0 0 56px; height: 58px; border-radius: var(--radio); background: var(--ps); color: var(--pd); display: flex; flex-direction: column;
    align-items: center; justify-content: center; line-height: 1.05; }
.agenda__fecha strong { font-family: var(--titulos); font-size: 1.45rem; font-weight: 700; }
.agenda__fecha span { font-size: .7rem; font-weight: 600; text-transform: uppercase; }
.agenda__texto, .tareas__texto { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.agenda__titulo, .tareas__titulo { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agenda__detalle, .tareas__detalle { font-size: .8rem; color: var(--suave); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agenda__sellos { display: flex; flex-direction: column; align-items: flex-end; gap: .25rem; }
.tareas { gap: 0; }
.tareas__fila { display: flex; align-items: center; gap: .8rem; padding: .6rem .4rem; border-bottom: 1px solid var(--borde-suave); border-radius: 8px; color: inherit; text-decoration: none; }
.tareas li:last-child .tareas__fila { border-bottom: 0; }
.tareas__icono { flex: 0 0 36px; height: 36px; border-radius: var(--radio); display: inline-flex; align-items: center; justify-content: center; }
.tareas__icono .icono { width: 18px; height: 18px; }
.tareas__icono--ambar { background: var(--ambar-claro); color: var(--ambar); }
.tareas__icono--rojo { background: var(--rojo-claro); color: var(--rojo); }
.tareas__icono--marca { background: var(--ps); color: var(--pd); }
.tareas__cuando { font-size: .8rem; color: var(--suave); white-space: nowrap; }
.tabla--plana { border: 0; box-shadow: none; border-radius: 0; }
.tabla--plana thead th { background: transparent; }
.plazo { display: inline-flex; align-items: center; gap: .6rem; }
.plazo__fondo { fill: #f0eeec; }
.plazo__valor--rojo { fill: #c4473a; } .plazo__valor--ambar { fill: #e8a33d; } .plazo__valor--ok { fill: var(--p); }
.plazo__texto { font-size: .8rem; font-weight: 600; color: #4a4341; }
.plazo__texto--rojo { color: var(--rojo); } .plazo__texto--ambar { color: var(--ambar); }
.atajos { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }
.atajo { display: flex; align-items: center; gap: .8rem; padding: .9rem 1rem; background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio-g);
    color: inherit; text-decoration: none; }
.atajo:hover { border-color: var(--pb); }
.atajo > span:last-child { display: flex; flex-direction: column; font-size: .88rem; }
.buscador select, .filtros select { min-height: 40px; padding: .4rem .6rem; border: 1px solid #d9d6d2; border-radius: 8px; font: inherit; background: #fff; }
.texto-ambar { color: var(--ambar); font-weight: 600; }
/* Ficha de la empresa: cabecera */
.empresa-cab { background: var(--superficie); border: 1px solid var(--borde); border-radius: 16px; box-shadow: var(--sombra); overflow: hidden; margin: 0 0 1.2rem;
    border-top: 6px solid var(--p); }
.empresa-cab__cuerpo { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 1rem 1.5rem; padding: 1.3rem 1.4rem; }
.empresa-cab__id { display: flex; gap: 1rem; align-items: center; min-width: 0; flex: 1 1 420px; }
.empresa-cab__id h1 { margin: 0; font-size: 1.75rem; }
.empresa-cab__avatar { flex: 0 0 64px; height: 64px; border-radius: 16px; background: var(--ps); color: var(--pd); display: inline-flex; align-items: center;
    justify-content: center; font-family: var(--titulos); font-weight: 700; font-size: 1.5rem; }
.empresa-cab__meta { display: flex; flex-wrap: wrap; gap: .2rem 1.1rem; margin: .3rem 0 0; font-size: .85rem; color: #5c5552; }
.empresa-cab__sellos { display: flex; flex-wrap: wrap; gap: .4rem; margin: .6rem 0 0; }
.empresa-cab__sellos .sello { font-size: .78rem; padding: .15rem .6rem; }
.empresa-cab__acciones { display: flex; flex-wrap: wrap; gap: .5rem; }
.empresa-cab__cifras { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin: 0; border-top: 1px solid var(--borde-suave); }
.empresa-cab__cifras > div { padding: .8rem 1.4rem; border-right: 1px solid var(--borde-suave); }
.empresa-cab__cifras > div:last-child { border-right: 0; }
.empresa-cab__cifras dt { font-size: .76rem; color: var(--suave); }
.empresa-cab__cifras dd { margin: 0; font-family: var(--titulos); font-weight: 600; font-size: 1.6rem; color: var(--ink); line-height: 1.2; }
@media (max-width: 600px) {
    .cifras { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; }
    .cifra { padding: .9rem; }
    .cifra__valor { font-size: 2rem; }
    .cifra__etq { font-size: .82rem; }
    .agenda__sellos .sello:first-child { display: none; }
    .saludo h1 { font-size: 1.7rem; }
    .empresa-cab__id { flex-direction: column; align-items: flex-start; }
}
.campo input[type=date], .campo input[type=time], .campo input[type=datetime-local], .campo input[type=number], .campo input[type=file], .campo textarea {
    min-height: 40px; padding: .45rem .6rem; border: 1px solid #d9d6d2; border-radius: 8px; font: inherit; background: #fff; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--foco); outline-offset: 1px; border-color: var(--pd); }
/* Formularios en línea (filtros, «Nueva inspección»…): todo alineado por abajo y las aclaraciones en la misma línea de la etiqueta */
.filtros { align-items: flex-end; }
.filtros .campo { margin-bottom: 0; }
.campo > span small { display: inline; margin: 0 0 0 .25rem; font-weight: 400; color: var(--suave); }
.en-linea { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .5rem; vertical-align: middle; }
.barra__buscar input { min-height: 0; padding: 0; border: 0; background: transparent; }
.servicio select { min-height: 0; border: 0; }
