/* ═══════════════════════════════════════════════════════════
   Sistema PDT / Informes - Estilos compartidos
   Color distintivo: teal (SIGA usa azul)
   ═══════════════════════════════════════════════════════════ */
:root {
    --primario: #0b5f58;
    --primario-oscuro: #073f3b;
    --primario-claro: #0f766e;
    --primario-suave: #e0f0ed;
    --fondo: #e8eeed;
    --texto: #0f1b19;
    --texto-suave: #3d4b48;
    --borde: #b4c4c1;
}

* { box-sizing: border-box; }

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--fondo);
    color: var(--texto);
    margin: 0;
    font-size: 1rem;
}
body.compacto { font-size: .94rem; }

/* ── Encabezado ─────────────────────────────────────────── */
.encabezado {
    background: linear-gradient(135deg, var(--primario-oscuro) 0%, var(--primario) 55%, var(--primario-claro) 100%);
    color: white;
    box-shadow: 0 4px 14px rgba(15, 118, 110, 0.35);
}
.encabezado-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 22px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}
.logo-link { display: flex; align-items: center; gap: 14px; text-decoration: none; color: white; }
.encabezado-icono { font-size: 2.5rem; line-height: 1; }
.encabezado-h1 { display: block; font-size: 1.9rem; font-weight: 700; letter-spacing: .3px; line-height: 1.1; }
.encabezado-sub { display: block; font-size: .95rem; opacity: .85; margin-top: 3px; }
.encabezado-usuario { display: flex; align-items: center; gap: 14px; font-size: .95rem; }
.btn-salir {
    color: white; text-decoration: none; padding: 7px 16px;
    border: 1px solid rgba(255,255,255,.6); border-radius: 20px; font-size: .9rem;
}
.btn-volver {
    color: white; text-decoration: none; padding: 7px 16px;
    background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.6); border-radius: 20px; font-size: .9rem;
}
.btn-volver:hover { background: rgba(255,255,255,.32); }
.btn-volver, .btn-salir { white-space: nowrap; }
.btn-salir:hover { background: rgba(255,255,255,.18); }

/* ── Contenedor y tarjetas ──────────────────────────────── */
.contenedor { padding: 26px 24px 40px; }
.card {
    background: white; border-radius: 12px; padding: 24px 28px;
    max-width: 900px; margin: 0 auto;
    box-shadow: 0 4px 16px rgba(0,0,0,0.06);
    border-top: 4px solid var(--primario);
}
.card.angosta { max-width: 760px; }
.card.muy-ancha { max-width: 1100px; }
.titulo-modulo { font-size: 1.45rem; color: var(--primario); margin: 0 0 4px; }
.subtitulo { color: var(--texto-suave); margin: 0 0 20px; }
.top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
a.volver { color: var(--texto-suave); text-decoration: none; }
a.volver:hover { color: var(--primario); }

/* ── Formularios ────────────────────────────────────────── */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px 18px; margin-bottom: 20px; }
label { display: block; font-size: .86em; color: var(--texto-suave); margin-bottom: 3px; }
input, select {
    width: 100%; padding: 8px 10px; border: 1px solid var(--borde);
    border-radius: 6px; font-size: 1em; font-family: inherit; background: white;
}
input:focus, select:focus { outline: none; border-color: var(--primario); box-shadow: 0 0 0 3px rgba(20,184,166,.18); }

.btn { padding: 9px 16px; border: none; border-radius: 6px; font-size: 1em; cursor: pointer; font-family: inherit; }
.btn-primario { background: var(--primario); color: white; }
.btn-primario:hover { background: var(--primario-oscuro); }
.btn-secundario { background: #e4ecea; color: var(--texto); }
.btn-secundario:hover { background: #d3dfdc; }
.btn-mini { padding: 6px 12px; font-size: .92em; }
.acciones { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; border-top: 1px solid var(--borde); padding-top: 14px; }

/* ── Tablas ─────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; margin-bottom: 8px; }
th { text-align: left; padding: 8px 6px; color: var(--texto-suave); font-weight: 600; font-size: .86em; border-bottom: 2px solid var(--primario-suave); }
td { padding: 8px 6px; border-bottom: 1px solid #edf2f1; }

/* ── Pantalla de carga de PDT ───────────────────────────── */
.seccion-titulo { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--borde); padding-top: 16px; margin-bottom: 10px; }
.seccion-titulo p { font-weight: 700; font-size: 1.1em; margin: 0; color: var(--primario); }
th button.aplicar { border: none; background: none; cursor: pointer; color: #9bb0ad; font-size: 1em; }
th button.aplicar:hover { color: var(--primario); }
.fila-agregar { text-align: right; margin-bottom: 14px; }
.quitar { color: #c0392b; cursor: pointer; background: none; border: none; font-size: .92em; }

/* ── ABM ────────────────────────────────────────────────── */
.form-agregar { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.form-agregar input[name="nombre"] { flex: 1; min-width: 180px; width: auto; }
.form-agregar input, .form-agregar select { width: auto; }
.estado { font-size: .85em; padding: 3px 10px; border-radius: 10px; }
.activo { background: #e6f4ea; color: #1e7e34; }
.inactivo { background: #fbeaea; color: #b02a2a; }
.btn-toggle { border: none; background: none; color: var(--primario); font-size: .95em; cursor: pointer; text-decoration: underline; font-family: inherit; }

/* ── Validación ─────────────────────────────────────────── */
.invalido { border-color: #c0392b !important; background: #fdf2f1 !important; box-shadow: 0 0 0 3px rgba(192,57,43,.15) !important; }
.req { color: #c0392b; font-weight: 700; }
.error ul { margin: 6px 0 0 18px; padding: 0; }

/* ── Mensajes ───────────────────────────────────────────── */
.msg-ok, .mensaje-ok { background: #e6f4ea; color: #1e7e34; padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }
.msg-error, .error { background: #fdecea; color: #c0392b; padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }

/* ── Menú de tarjetas ───────────────────────────────────── */
.seccion { margin: 26px 0 10px; font-size: .86em; color: var(--texto-suave); text-transform: uppercase; letter-spacing: .8px; font-weight: 600; max-width: 900px; margin-left: auto; margin-right: auto; }
.grid-menu { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; max-width: 900px; margin: 0 auto; }
a.tarjeta {
    background: white; border-radius: 12px; padding: 24px 16px; text-decoration: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06); text-align: center; color: var(--texto);
    border-bottom: 4px solid transparent; transition: transform .1s, box-shadow .1s, border-color .1s;
}
a.tarjeta:hover { transform: translateY(-3px); box-shadow: 0 8px 18px rgba(15,118,110,0.18); border-bottom-color: var(--primario-claro); }
a.tarjeta .icono { font-size: 32px; margin-bottom: 8px; display: block; }
a.tarjeta .titulo { font-weight: 600; font-size: 1.05em; }
a.tarjeta.destacada { background: var(--primario); color: white; }
a.tarjeta.destacada:hover { background: var(--primario-oscuro); }

/* ── Login ──────────────────────────────────────────────── */
body.login { min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--primario-oscuro) 0%, var(--primario) 55%, var(--primario-claro) 100%); }
.login-box { background: white; border-radius: 16px; padding: 40px; width: 100%; max-width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,0.25); }
.login-box h1 { font-size: 24px; color: var(--primario); margin: 0 0 4px; }
.login-box p.subtitulo { margin-bottom: 24px; }
.login-box input { margin-bottom: 16px; }
.login-box button { width: 100%; padding: 12px; border: none; border-radius: 8px; background: var(--primario); color: white; font-size: 1em; font-weight: 600; cursor: pointer; }
.login-box button:hover { background: var(--primario-oscuro); }

/* ── Listado y detalle de PDT ───────────────────────────── */
.card.ancha { max-width: 1000px; }
.filtros { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 18px; padding: 14px; background: var(--primario-suave); border-radius: 8px; }
.filtros > div { flex: 1; min-width: 120px; }
.filtros .btn { white-space: nowrap; }
.link-limpiar { color: var(--texto-suave); font-size: .92em; align-self: center; }
a.link-pdt { color: var(--primario); font-weight: 700; text-decoration: none; font-variant-numeric: tabular-nums; }
a.link-pdt:hover { text-decoration: underline; }
.mensaje-ok a { color: #1e7e34; }
.muted { color: var(--texto-suave); }
.paginacion { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; color: var(--texto-suave); font-size: .92em; }
.paginacion a { color: var(--primario); text-decoration: none; padding: 5px 12px; border: 1px solid var(--borde); border-radius: 6px; margin-left: 6px; }
.paginacion a:hover { background: var(--primario-suave); }
.detalle { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 20px; margin-bottom: 22px; }
.detalle dt { font-size: .82em; color: var(--texto-suave); margin: 0 0 2px; }
.detalle dd { margin: 0; font-weight: 600; }
.detalle .ancho-completo { grid-column: 1 / -1; }
.badge-estado { font-size: .85em; padding: 3px 10px; border-radius: 10px; white-space: nowrap; }
.est-pend { background: #fff4d6; color: #8a6200; }
.est-anal { background: #dff1fb; color: #0b5d86; }
.est-emit { background: var(--primario-suave); color: var(--primario-oscuro); }
.est-env  { background: #e6f4ea; color: #1e7e34; }
.est-fact { background: #e8e8ee; color: #50506a; }

@media (max-width: 640px) {
    .detalle { grid-template-columns: 1fr; }
    .grid { grid-template-columns: 1fr; }
    .encabezado-h1 { font-size: 1.5rem; }
}

/* ═══════════════════════════════════════════════════════════
   Listado y detalle de PDT (mismo lenguaje visual que SIGA/RIE)
   ═══════════════════════════════════════════════════════════ */
.panel { max-width: 1200px; margin: 0 auto; background: white; border-radius: 12px; overflow: hidden; box-shadow: 0 6px 16px rgba(0,0,0,0.10); }
.panel-titulo { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding: 24px 35px; background: linear-gradient(135deg, var(--primario-suave), #ffffff); border-bottom: 1px solid var(--borde); }
.icono-circulo { width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 25px; color: white; background: linear-gradient(135deg, var(--primario), var(--primario-claro)); box-shadow: 0 4px 10px rgba(15,118,110,.3); flex-shrink: 0; }
.panel-titulo h1 { font-size: 1.75rem; font-weight: 600; color: var(--primario); margin: 0; line-height: 1.2; }
.panel-titulo p { margin: 3px 0 0; color: var(--texto-suave); }
.acciones-titulo { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.acciones-titulo .btn { text-decoration: none; display: inline-flex; align-items: center; gap: 7px; }
.panel-contenido { padding: 30px 35px 38px; }

/* Tarjetas de estadísticas */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 18px; margin-bottom: 28px; }
.stat-card { color: white; padding: 22px 18px; border-radius: 12px; text-align: center; transition: transform .2s; }
.stat-card:hover { transform: translateY(-4px); }
.stat-card .numero { font-size: 2.4rem; font-weight: 700; line-height: 1.1; }
.stat-card .etiqueta { font-size: .92em; opacity: .93; margin-top: 7px; }
.stat-card.total     { background: linear-gradient(135deg, #0f766e, #2dd4bf); }
.stat-card.muestras  { background: linear-gradient(135deg, #0369a1, #38bdf8); }
.stat-card.pendientes{ background: linear-gradient(135deg, #d97706, #fbbf24); }
.stat-card.urgentes  { background: linear-gradient(135deg, #be123c, #fb7185); }
.stat-card.ok        { background: linear-gradient(135deg, #15803d, #4ade80); }
.stat-card.facturado { background: linear-gradient(135deg, #475569, #94a3b8); }

/* Panel de filtros */
.filtros-panel { background: #f4f8f7; border: 1px solid var(--borde); padding: 22px 24px; border-radius: 10px; margin-bottom: 28px; }
.filtros-panel h3 { color: var(--primario); margin: 0 0 16px; font-size: 1.1rem; }
.filtros-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px 16px; }
.filtros-grid label { font-weight: 600; color: #4b5d5a; }
.filtros-acciones { text-align: right; margin-top: 18px; }
.filtros-acciones .btn { text-decoration: none; display: inline-flex; align-items: center; gap: 7px; margin-left: 6px; }

/* Tabla de datos */
.tabla-wrap { overflow-x: auto; border-radius: 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
table.tabla-datos { width: 100%; border-collapse: collapse; margin: 0; font-size: .95em; }
.tabla-datos th { background: var(--primario); color: white; padding: 14px 12px; text-align: left; font-weight: 600; border-bottom: none; position: sticky; top: 0; white-space: nowrap; }
.tabla-datos td { padding: 12px; border-bottom: 1px solid #edf2f1; background: white; vertical-align: middle; }
.tabla-datos tbody tr:nth-child(even) td { background: #f8fbfa; }
.tabla-datos tbody tr:hover td { background: var(--primario-suave); }
.tabla-datos .btn { text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
a.link-pdt { font-size: 1.05em; }
.chip-num { display: inline-block; min-width: 30px; padding: 3px 12px; border-radius: 12px; background: var(--primario-suave); color: var(--primario-oscuro); font-weight: 700; }
.num-informe { color: var(--primario); font-variant-numeric: tabular-nums; }
.sin-resultados { text-align: center; padding: 60px 20px; color: #8a9a97; }
.sin-resultados i { font-size: 3.8rem; margin-bottom: 16px; opacity: .5; }
.sin-resultados h3 { color: var(--texto); margin: 0 0 6px; }
.sin-resultados .btn { text-decoration: none; }

/* Chips y estados */
.chip { display: inline-block; background: white; border: 1px solid var(--borde); border-radius: 20px; padding: 4px 12px; font-size: .88em; color: var(--texto); margin-left: 6px; }
.chip i { color: var(--primario); margin-right: 5px; }
.chip-urgente { background: #fdecea; border-color: #f5b7b1; color: #b02a2a; font-weight: 700; }
.chip-urgente i { color: #b02a2a; }
.est-urg { background: #fdecea; color: #b02a2a; font-weight: 700; }

/* Paginación */
.paginacion-box { margin-top: 26px; padding: 18px 24px; background: #f4f8f7; border-radius: 12px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 14px; }
.paginacion-info { color: var(--texto-suave); font-weight: 600; }
.paginacion-nav { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.paginacion-nav a, .paginacion-nav span { padding: 9px 15px; border-radius: 8px; text-decoration: none; font-weight: 600; font-size: .92em; display: inline-flex; align-items: center; gap: 6px; transition: all .2s; }
.paginacion-nav a { background: white; color: var(--primario); border: 2px solid var(--borde); }
.paginacion-nav a:hover { background: var(--primario); color: white; border-color: var(--primario); transform: translateY(-2px); }
.paginacion-nav .activa { background: var(--primario); color: white; border: 2px solid var(--primario); }
.paginacion-nav .deshabilitado { background: #e9eeed; color: #aab5b3; border: 2px solid var(--borde); }
.paginacion-nav .puntos { color: var(--texto-suave); padding: 9px 4px; }

/* Detalle de un PDT */
.ficha { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; padding: 22px 28px; margin-bottom: 26px; border-radius: 12px; background: linear-gradient(135deg, var(--primario-suave), #ffffff); border: 1px solid var(--borde); border-left: 6px solid var(--primario); }
.ficha-numero span { display: block; font-size: .78em; color: var(--texto-suave); text-transform: uppercase; letter-spacing: 1.2px; margin-bottom: 2px; }
.ficha-numero strong { font-size: 2.9rem; line-height: 1; color: var(--primario); font-variant-numeric: tabular-nums; letter-spacing: 1px; }
.ficha-resumen { flex: 1; min-width: 240px; }
.ficha-cliente { font-size: 1.45rem; font-weight: 700; margin-bottom: 10px; }
.ficha-cliente i { color: var(--primario); margin-right: 6px; }
.ficha-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.ficha-chips .chip { margin-left: 0; }
.seccion-h2 { color: var(--primario); font-size: 1.25rem; margin: 32px 0 16px; display: flex; align-items: center; gap: 10px; padding-bottom: 9px; border-bottom: 2px solid var(--primario-suave); }
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin-bottom: 8px; }
.info-field { background: #f6faf9; padding: 15px 18px; border-radius: 10px; border: 1px solid var(--borde); border-left: 4px solid var(--primario-claro); }
.info-label { font-weight: 600; color: var(--primario); margin-bottom: 6px; font-size: .9em; display: flex; align-items: center; gap: 8px; }
.info-value { font-size: 1.08em; color: var(--texto); font-weight: 500; }
.nota-box { background: #fff8e1; border-left: 5px solid #f5b400; padding: 16px 20px; border-radius: 10px; margin: 18px 0 6px; }
.nota-box label { font-weight: 600; color: #8a6200; display: block; margin-bottom: 6px; }
.nota-box p { margin: 0; }
.meta-registro { color: var(--texto-suave); font-size: .9em; margin-top: 26px; padding-top: 14px; border-top: 1px dashed var(--borde); }

@media print {
    body { background: white; }
    .encabezado, .acciones-titulo, .no-print, .paginacion-box, .filtros-panel { display: none !important; }
    .panel { box-shadow: none; border-radius: 0; }
    .contenedor { padding: 0; }
    .stat-card, .tabla-datos th, .icono-circulo, .badge-estado, .ficha { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .stat-card:hover { transform: none; }
}
@media (max-width: 640px) {
    .panel-titulo, .panel-contenido { padding-left: 18px; padding-right: 18px; }
    .acciones-titulo { margin-left: 0; }
    .ficha-numero strong { font-size: 2.3rem; }
}

/* ═══════════════════════════════════════════════════════════
   LEGIBILIDAD / ALTO CONTRASTE
   Todos los colores de este bloque están medidos con la fórmula
   de contraste WCAG: texto >= 7:1 (nivel AAA) y bordes de campos
   >= 3:1. Va al final a propósito: pisa lo anterior.
   ═══════════════════════════════════════════════════════════ */
:root { --borde-fuerte: #5f6f6c; --foco: #f5b400; }
body { line-height: 1.5; }

/* Encabezado superior: oscuro en toda su extensión */
.encabezado { background: linear-gradient(135deg, #073f3b 0%, #0b5f58 60%, #0f766e 100%); }
.encabezado-sub { opacity: 1; }
.btn-volver, .btn-salir { border: 2px solid #ffffff; font-weight: 600; background: rgba(255,255,255,.12); white-space: nowrap; }
.btn-volver:hover, .btn-salir:hover { background: #ffffff; color: #073f3b; }
.ctl-letra { display: inline-flex; gap: 4px; }
.ctl-letra button { background: rgba(255,255,255,.12); color: #ffffff; border: 2px solid #ffffff; border-radius: 8px; padding: 3px 10px; font-weight: 700; cursor: pointer; font-family: inherit; line-height: 1.3; }
.ctl-letra button:hover { background: #ffffff; color: #073f3b; }
.ctl-letra .a-chica { font-size: .85rem; }
.ctl-letra .a-grande { font-size: 1.15rem; }

/* Campos: borde bien visible, texto oscuro, más altos para clickear */
input, select, textarea { border: 1.5px solid var(--borde-fuerte); color: var(--texto); min-height: 42px; padding: 9px 11px; }
input::placeholder { color: #5c6b68; opacity: 1; }
input:focus, select:focus, textarea:focus { border-color: var(--primario); box-shadow: 0 0 0 4px rgba(11,95,88,.30); outline: none; }
.campo-fijo, input:disabled, select:disabled { background: #e0e9e7; color: #1f2c2a; -webkit-text-fill-color: #1f2c2a; opacity: 1; border-style: dashed; }
label { color: var(--texto-suave); font-weight: 600; font-size: .95em; }
a:focus-visible, button:focus-visible, .btn:focus-visible { outline: 3px solid var(--foco); outline-offset: 2px; }

/* Botones */
.btn { font-weight: 600; min-height: 40px; }
.btn-secundario { background: #dfe8e6; color: var(--texto); border: 1.5px solid var(--borde-fuerte); }
.btn-secundario:hover { background: #cddad7; }
.btn-toggle { font-weight: 600; }

/* Tarjetas y paneles con borde que se distinga del fondo */
.card, .panel { border: 1px solid var(--borde); }
.card { border-top: 5px solid var(--primario); }
a.tarjeta { border: 1.5px solid var(--borde); border-bottom: 4px solid transparent; }
.seccion { font-weight: 700; }

/* Tablas */
th { color: #1f2c2a; font-weight: 700; border-bottom: 2px solid var(--borde-fuerte); }
td { border-bottom: 1px solid var(--borde); }
.tabla-datos th { background: var(--primario); color: #ffffff; border-bottom: none; }
.tabla-datos tbody tr:nth-child(even) td { background: #f1f6f5; }
.tabla-datos tbody tr:hover td { background: #d9ece9; }
a.link-pdt { font-weight: 800; text-decoration: underline; text-underline-offset: 3px; }
.num-informe { font-weight: 800; }

/* Cajitas del detalle */
.info-field { background: #eef4f3; border: 1.5px solid #9db0ac; border-left: 5px solid var(--primario); }
.info-label { font-weight: 700; }
.info-value { font-weight: 600; }
.ficha { border: 1.5px solid #9db0ac; border-left: 6px solid var(--primario); }
.ficha-numero span { font-weight: 700; }
.seccion-h2 { border-bottom: 2px solid var(--borde); }
.chip { border: 1.5px solid #9db0ac; font-weight: 600; }
.chip-num { background: #d3eeea; color: #0a4f49; }
.nota-box { background: #fff6d9; border-left-color: #c58a00; }
.nota-box label { color: #5c3d00; }
.meta-registro { color: var(--texto-suave); }

/* Tarjetas de resumen: degradés oscuros, texto blanco >= 7:1 */
.stat-card .numero { font-weight: 800; }
.stat-card .etiqueta { opacity: 1; font-weight: 600; font-size: 1rem; }
.stat-card.total      { background: linear-gradient(135deg, #073f3b, #0b5f58); }
.stat-card.muestras   { background: linear-gradient(135deg, #0c4a6e, #075985); }
.stat-card.pendientes { background: linear-gradient(135deg, #78350f, #92400e); }
.stat-card.urgentes   { background: linear-gradient(135deg, #881337, #9f1239); }
.stat-card.ok         { background: linear-gradient(135deg, #14532d, #166534); }
.stat-card.facturado  { background: linear-gradient(135deg, #1e293b, #334155); }

/* Estados (badges): texto oscuro sobre fondo claro, con borde */
.badge-estado { font-weight: 700; border: 1px solid currentColor; }
.est-pend { background: #ffefb8; color: #5c3d00; }
.est-anal { background: #d3eaf8; color: #07476b; }
.est-emit { background: #d3eeea; color: #0a4f49; }
.est-env  { background: #d0eed9; color: #14532d; }
.est-fact { background: #e1e4ec; color: #2f3447; }
.est-urg, .chip-urgente { background: #fbdcd8; color: #8a1717; }
.chip-urgente { border-color: #8a1717; }
.chip-urgente i { color: #8a1717; }
.activo   { background: #d0eed9; color: #14532d; font-weight: 700; }
.inactivo { background: #fbdcd8; color: #8a1717; font-weight: 700; }

/* Mensajes */
.msg-ok, .mensaje-ok { background: #e3f4e8; color: #14532d; border: 1px solid #14532d; font-weight: 600; }
.mensaje-ok a { color: #14532d; text-decoration: underline; }
.msg-error, .error { background: #fdeceb; color: #8a1717; border: 1px solid #8a1717; font-weight: 600; }
.req { color: #b4231d; }
.quitar { color: #a11919; font-weight: 600; }
.invalido { border-width: 2px !important; border-color: #b4231d !important; }

/* Paginación */
.paginacion-nav a { border: 2px solid var(--borde-fuerte); color: var(--primario); }
.paginacion-nav .deshabilitado { background: #dfe6e5; color: #4a5855; border-color: #9db0ac; }
.paginacion-info { color: var(--texto-suave); }
th button.aplicar { color: var(--primario); }

/* Combos largos: que no se corten con letra grande */
select { text-overflow: ellipsis; }
#tablaMuestras select { min-width: 0; }

/* ═══ Búsqueda en vivo ═══ */
.cargando { opacity: .5; transition: opacity .15s; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* Tabla de muestras agrupada por informe: el color alterna por informe, no por renglón */
.tabla-datos.tabla-grupos tbody tr td { background: #ffffff; }
.tabla-datos.tabla-grupos tbody tr.g-par td { background: #f1f6f5; }
.tabla-datos.tabla-grupos tbody tr.g-inicio td { border-top: 2px solid var(--borde); }
.tabla-datos.tabla-grupos tbody tr:first-child td { border-top: none; }

/* Nuevo PDT: renglones que comparten un mismo informe */
#tablaMuestras tr.grupo-a td { background: #e0f0ed; }
#tablaMuestras tr.grupo-b td { background: #ebe9fb; }
#tablaMuestras tr.grupo-a td:first-child, #tablaMuestras tr.grupo-b td:first-child { border-left: 4px solid var(--primario); }
.etq-informe { font-size: .78em; font-weight: 600; color: var(--texto-suave); margin-top: 2px; }
.resumen-informes { color: var(--texto-suave); font-weight: 600; margin: 6px 0 10px; font-size: .95em; }

/* ═══ Modal de PDT guardado ═══ */
body.modal-abierto { overflow: hidden; }
.modal-fondo { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(7, 63, 59, .62); animation: fondoEntra .2s ease-out; }
.modal-exito { position: relative; width: 100%; max-width: 600px; max-height: calc(100vh - 40px); overflow-y: auto; background: #ffffff; border-radius: 16px; border-top: 8px solid var(--primario); padding: 26px 30px 22px; text-align: center; box-shadow: 0 24px 60px rgba(0,0,0,.35); animation: modalEntra .28s ease-out; }
.modal-cerrar { position: absolute; top: 8px; right: 14px; border: none; background: none; font-size: 2rem; line-height: 1; cursor: pointer; color: var(--texto-suave); }
.modal-cerrar:hover { color: var(--texto); }
.check-anim { width: 78px; height: 78px; display: block; margin: 0 auto 6px; }
.check-circulo { fill: #e0f0ed; stroke: var(--primario); stroke-width: 3; stroke-dasharray: 151; stroke-dashoffset: 151; animation: dibujar .55s ease-out forwards; }
.check-marca { fill: none; stroke: var(--primario); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 48; stroke-dashoffset: 48; animation: dibujar .35s .5s ease-out forwards; }
.modal-exito h2 { margin: 4px 0 6px; color: var(--primario); font-size: 1.6rem; }
.modal-cuentas { margin: 0 0 16px; font-size: 1.2rem; }
.modal-datos { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 14px; margin: 0 0 16px; text-align: left; }
.modal-datos > div { background: #eef4f3; border: 1.5px solid #9db0ac; border-left: 4px solid var(--primario); border-radius: 8px; padding: 7px 12px; }
.modal-datos dt { font-size: .78em; font-weight: 700; color: var(--primario); margin: 0; }
.modal-datos dd { margin: 2px 0 0; font-weight: 600; }
.modal-informes { text-align: left; border: 1.5px solid var(--borde); border-radius: 10px; margin-bottom: 18px; max-height: 200px; overflow-y: auto; }
.modal-informes table { margin: 0; }
.modal-informes th { position: sticky; top: 0; background: #ffffff; font-size: .82em; padding: 8px 12px; }
.modal-informes td { padding: 8px 12px; }
.modal-acciones { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.modal-acciones .btn { text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
.modal-barra { height: 6px; margin-top: 18px; background: #dfe8e6; border-radius: 3px; overflow: hidden; }
.modal-barra-relleno { width: 100%; height: 100%; background: var(--primario); }
.modal-aviso { margin: 8px 0 0; font-size: .85em; color: var(--texto-suave); }
@keyframes dibujar { to { stroke-dashoffset: 0; } }
@keyframes modalEntra { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes fondoEntra { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
    .modal-fondo, .modal-exito { animation: none; }
    .check-circulo, .check-marca { animation: none; stroke-dashoffset: 0; }
}
@media (max-width: 560px) { .modal-datos { grid-template-columns: 1fr; } .modal-exito { padding: 22px 18px 18px; } }
@media print { .modal-fondo { display: none; } }

/* ═══ ABM de catálogos: editar / activar / eliminar ═══ */
.acciones-fila { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; align-items: center; }
.acciones-fila form { margin: 0; display: inline; }
.btn-fila { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; background: #ffffff; color: var(--texto); border: 1.5px solid #8aa19c; border-radius: 7px; cursor: pointer; font-family: inherit; font-size: .88em; font-weight: 600; text-decoration: none; line-height: 1.3; }
.btn-fila:hover { background: var(--primario-suave); border-color: var(--primario); }
.btn-fila.peligro { color: #8a1717; border-color: #8a1717; }
.btn-fila.peligro:hover { background: #fbdcd8; }
tr.fila-edicion td { background: #fff6d9 !important; }
.btn-peligro { background: #8a1717; color: #ffffff; border: 2px solid #8a1717; }
.btn-peligro:hover { background: #6b1212; border-color: #6b1212; }
.modal-confirmar { max-width: 460px; }
.icono-alerta { font-size: 3rem; color: #8a1717; margin-bottom: 6px; }
.modal-texto { margin: 6px 0 18px; font-size: 1.1rem; }

/* Nuevo PDT: "+" para sumar otro ensayo a la misma muestra */
.celda-ensayo { display: flex; gap: 6px; align-items: stretch; }
.celda-ensayo select { flex: 1; min-width: 0; }
.mas-ensayo { flex: 0 0 auto; width: 38px; padding: 0; border: 2px solid var(--primario); background: #ffffff; color: var(--primario); border-radius: 8px; font-family: inherit; font-size: 1.35em; font-weight: 800; line-height: 1; cursor: pointer; }
.mas-ensayo:hover, .mas-ensayo:focus-visible { background: var(--primario); color: #ffffff; }

/* El N° de informe nunca se parte en dos renglones; lo que se acomoda es la lista de ensayos */
.modal-informes td:first-child { white-space: nowrap; }

/* Nuevo PDT: botón rojo con cruz blanca para quitar un renglón (del mismo alto que los campos) */
#tablaMuestras td.celda-quitar { padding-left: 4px; padding-right: 4px; text-align: center; }
#tablaMuestras .quitar { display: inline-flex; align-items: center; justify-content: center; width: max(42px, calc(1.1em + 21px)); height: max(42px, calc(1.1em + 21px)); padding: 0; border: 2px solid #a11919; border-radius: 8px; background: #a11919; color: #ffffff; font-size: 1em; cursor: pointer; }
#tablaMuestras .quitar:hover, #tablaMuestras .quitar:focus-visible { background: #7a1010; border-color: #7a1010; }

/* ═══ Estados del informe: liberación, anulados, historial ═══ */
.est-anul { background: #ececec; color: #444444; }
.liberado { margin-top: 7px; font-size: .84em; line-height: 1.4; color: var(--texto-suave); }
.liberado strong { color: var(--texto); }
.liberado i { color: var(--primario); }
.liberado-sin { font-style: italic; }
.acc-mini { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.acc-mini .btn-fila { padding: 4px 9px; font-size: .82em; }
.tabla-datos.tabla-grupos tbody tr.fila-anulada td:not(.sin-tachar) { text-decoration: line-through; color: #7a7575; }
details.historial { margin-top: 24px; }
details.historial summary { cursor: pointer; font-weight: 700; color: var(--primario); padding: 8px 0; }
details.historial summary:hover { text-decoration: underline; }
.modal-accion { max-width: 500px; text-align: left; }
.modal-accion h2 { text-align: left; }
.modal-sub { margin: 4px 0 14px; font-size: 1.05rem; }
.modal-etiqueta { display: block; font-weight: 700; color: var(--primario); margin: 12px 0 5px; }
.modal-accion input[type=date], .modal-accion textarea { width: 100%; box-sizing: border-box; }
.modal-nota { margin: 12px 0 4px; font-size: .95em; color: var(--texto-suave); }
.modal-nota-roja { color: #8a1717; font-weight: 600; }
.modal-errores { margin-top: 12px; }
.modal-accion .modal-acciones { margin-top: 18px; justify-content: flex-end; }

/* Pantalla de ingreso: el logo del sistema reemplaza al título de texto */
.login-box h1.login-logo { margin: 0 -8px 24px; line-height: 0; }
.login-logo img { display: block; width: 100%; height: auto; }
.login-logo + p.subtitulo { text-align: center; margin: 10px 0 22px; letter-spacing: .04em; }

/* ═══ Pantalla de Informes: plazos, selección en lote ═══ */
.stat-card.alerta { background: linear-gradient(135deg, #6b4500, #8a5a00); }
.leyenda-plazos { margin: 14px 0 6px; font-size: .95em; color: var(--texto-suave); line-height: 1.5; }
.col-chk { width: 36px; text-align: center; }
.col-chk input { width: 18px; height: 18px; cursor: pointer; accent-color: var(--primario); }
.dias { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-weight: 700; font-size: .95em; white-space: nowrap; }
.dias-ok { background: #e3eeec; color: #17332f; }
.dias-alerta { background: #ffe9a0; color: #5c4200; }
.dias-vencido { background: #fbd0d0; color: #8a1212; }
.dias-neutro { background: transparent; color: var(--texto-suave); padding-left: 0; }
.nota-chica { display: block; margin-top: 3px; font-size: .8em; color: var(--texto-suave); font-weight: 400; }
.ensayos-lista { color: var(--texto-suave); }
.barra-lote { position: sticky; bottom: 16px; z-index: 5; display: none; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 16px; padding: 12px 18px; background: #ffffff; border: 2px solid var(--primario); border-radius: 12px; box-shadow: 0 8px 28px rgba(0, 0, 0, .18); }
.barra-lote strong { color: var(--primario); }
tr.fila-seleccionada td { background: #e6f3f0 !important; }

/* ═══ Campo de fecha: se escribe y se ve siempre como dd/mm/aaaa ═══ */
.campo-fecha { position: relative; display: block; }
.campo-fecha .campo-fecha-texto { width: 100%; box-sizing: border-box; padding-right: 46px; }
.campo-fecha-boton { position: absolute; right: 5px; top: 4px; width: 34px; height: 34px; padding: 0; border: none; border-radius: 6px; background: transparent; color: var(--primario); font-size: 1.05em; cursor: pointer; }
.campo-fecha-boton:hover { background: #e3eeec; }
.campo-fecha-boton:focus-visible { outline: 3px solid var(--primario); outline-offset: 1px; }
.campo-fecha .campo-fecha-picker { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 1px; min-height: 0; padding: 0; border: 0; opacity: 0; pointer-events: none; }
.campo-fecha-msg { display: block; margin-top: 4px; font-size: .85em; line-height: 1.3; color: #8a1212; }
.campo-fecha-msg:empty { display: none; }
.campo-fecha .campo-fecha-error { border-color: #b4231d !important; box-shadow: 0 0 0 3px rgba(180, 35, 29, .15); }

/* ═══ Ensayos dados de baja y PDT cancelados ═══ */
.fila-baja td:not(.sin-tachar) { text-decoration: line-through; color: #7a7575; }
.tachado { text-decoration: line-through; color: #7a7575; }
.est-baja { background: #fdebd0; color: #7a4a00; }
.baja-info { display: block; margin-top: 6px; font-size: .86em; line-height: 1.4; color: var(--texto-suave); }
.baja-info .badge-estado { margin-bottom: 4px; }
.baja-motivo strong { color: var(--texto); }
.baja-quien { color: var(--texto-suave); }
.baja-aviso { margin-top: 3px; font-weight: 600; }
.aviso-pendiente { color: #8a4b00; }
.aviso-avisado { color: #0b5f58; }
.aviso-no_corresponde { color: #5a6663; }
.banner-cancelado { display: flex; gap: 14px; align-items: flex-start; margin: 0 0 18px; padding: 14px 18px; background: #fbe9e7; border: 2px solid #b4231d; border-radius: 10px; color: #5c1410; line-height: 1.5; }
.banner-cancelado > i { font-size: 1.6em; color: #b4231d; margin-top: 2px; }
.chip-cancelado { background: #fbdcd8; border-color: #b4231d; color: #8a1717; font-weight: 700; }
.chip-cancelado i { color: #8a1717; }
@media print { .banner-cancelado { border-width: 2px; } }
.fila-cancelada td { color: #7a7575; }
.est-canc { background: #fbdcd8; color: #8a1717; }

/* Casilla dentro de los carteles (por ejemplo "También cancelar el PDT" al anular el último informe) */
.modal-check { display: flex; align-items: center; gap: 10px; margin: 10px 0 4px; font-weight: 700; cursor: pointer; }
.modal-check input { width: 20px; height: 20px; min-height: 0; margin: 0; flex: 0 0 auto; }

/* ═══ Técnicos y operadores: desplegable "Agregar…" y fichas con ×; en la ficha del PDT, la lista de nombres ═══ */
.personas-agregar { width: 100%; }
.personas-chips { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.personas-chips:empty { display: none; }
.persona-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 11px; background: #e3eeec; border: 1px solid #9db0ac; border-radius: 999px; font-weight: 700; color: #0b5f58; }
.persona-chip button { width: 24px; height: 24px; padding: 0; border: none; border-radius: 50%; background: #a11919; color: #fff; font-size: 16px; line-height: 1; cursor: pointer; }
.persona-chip button:hover { background: #6b1212; }
.persona-chip button:focus-visible { outline: 3px solid #0b5f58; outline-offset: 1px; }
.ayuda-personal { display: block; margin-top: 4px; color: #8a4b00; }

/* Catálogos: buscador y filtro sobre el listado */
.barra-busqueda { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 6px 0 12px; }
.barra-busqueda input[type=search] { flex: 1 1 260px; min-width: 200px; }
.barra-busqueda select { flex: 0 1 300px; max-width: 100%; }
table tbody tr[hidden] { display: none; }

/* Nuevo PDT: ayuda de la lista de ensayos del yacimiento, y el aviso cuando se vacían ensayos al cambiar de yacimiento */
.ayuda-ensayos { margin: 8px 0 0; font-size: .92em; }
.ayuda-ensayos:empty { display: none; }
.aviso-ensayos { margin: 8px 0 0; padding: 10px 14px; background: #fff4d6; border: 2px solid #b87b00; border-radius: 8px; font-weight: 700; color: #5c3d00; }
.aviso-ensayos[hidden] { display: none; }

/* Detalle del PDT: código de certificación debajo del ensayo */
.cod-cert { margin-top: 2px; font-size: .8em; color: #5a6663; }

/* Insignia "En uso" con enlaces (ej. Listas de ensayos: "136 ensayos y 1 yacimiento" lleva a cada catálogo filtrado) */
.badge-estado a { color: inherit; text-decoration: underline; }
.badge-estado a:hover, .badge-estado a:focus-visible { text-decoration-thickness: 2px; }
