* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    margin: 0;
    background: #f0f2f5;
    color: #1a1a1a;
}

.cabecera {
    background: #818b97;
    color: #fff;
    padding: 0.4rem 1.5rem 0.6rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
}

.cabecera-contenido {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.5rem;
}

.logo-verifacto {
    height: 80px;
    width: auto;
    display: block;
}

.cabecera nav {
    margin-top: 0;
    margin-left: 0.75rem;
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.5rem;
    align-items: center;
    font-size: 0.95rem;
}

.cabecera nav a {
    color: #ffffff;
    text-decoration: none;
    font-weight: 500;
}

.cabecera nav a:hover {
    text-decoration: underline;
}

.usuario {
    margin-left: auto;
    padding-left: 2rem;
    border-left: 1px solid rgba(255, 255, 255, 0.3);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#btn-logout {
    background: transparent;
    border: 1px solid #fff;
    color: #fff;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    border-radius: 4px;
}

#btn-logout:hover {
    background: rgba(255, 255, 255, 0.2);
}

#contenido {
    max-width: 900px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.card {
    background: #fff;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 1rem;
}

.card h2 {
    margin-top: 0;
}

.oculto {
    display: none !important;
}

.error {
    color: #c00;
    font-size: 0.9rem;
}

#form-login {
    max-width: 320px;
    margin: 3rem auto;
}

#form-login label {
    display: block;
    margin-bottom: 0.75rem;
}

#form-login input {
    width: 100%;
    padding: 0.5rem;
    margin-top: 0.25rem;
}

#form-login button {
    width: 100%;
    padding: 0.6rem;
    background: #1e3a5f;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 0.5rem;
}

#form-login button:hover {
    background: #2a4a7a;
}

.tabla {
    width: 100%;
    border-collapse: collapse;
}

.tabla th,
.tabla td {
    text-align: left;
    padding: 0.5rem;
    border-bottom: 1px solid #eee;
    font-size: 0.92rem;
    vertical-align: middle;
}

.tabla th {
    background: #f5f5f5;
    font-weight: 600;
}

.tabla tbody tr {
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.tabla tbody tr.clickable {
    cursor: pointer;
}

.tabla tbody tr.clickable:hover {
    background-color: #f0f7ff;
    box-shadow: inset 2px 0 0 #1e3a5f;
}

.tabla tbody tr.selected {
    background-color: #e1efff;
    box-shadow: inset 3px 0 0 #1e3a5f;
}

button.sec {
    background: #6c757d;
    color: #fff;
    border: none;
    padding: 0.35rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    margin-right: 0.5rem;
}

button.sec:hover {
    background: #5a6268;
}

button.prim {
    background: #1e3a5f;
    color: #fff;
    border: none;
    padding: 0.35rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
}

button.prim:hover {
    background: #2a4a7a;
}

button.danger {
    background: #dc3545;
    color: #fff;
    border: none;
    padding: 0.35rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
}

button.danger:hover {
    background: #b02a37;
}

#listado-plantillas table,
#listado-pruebas table,
#listado-usuarios table {
    margin-top: 1rem;
}

.grupo-subida {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid #eee;
}

.grupo-subida h4 {
    margin: 0 0 0.25rem 0;
    font-size: 0.95rem;
}

.grupo-subida p {
    margin: 0 0 0.5rem 0;
    font-size: 0.85rem;
    color: #555;
}

.grupo-subida input[type="file"] {
    display: block;
    margin-bottom: 0.5rem;
}

.badge {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    border-radius: 10px;
    font-size: 0.75rem;
    background: #e9ecef;
    color: #495057;
}

.badge.badge-global {
    background: #e3f2ff;
    color: #0c5460;
}

.validacion-ok {
    color: #0a0;
}

.validacion-ko {
    color: #c00;
}

.acciones-usuario button {
    margin-right: 0.25rem;
    margin-bottom: 0.15rem;
}

.panel-form {
    margin: 0.5rem 0 1.25rem 0;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    background: #f8fafc;
    border: 1px solid #dde4f0;
}

.panel-form h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
}

.cabecera-panel {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    gap: 0.5rem;
}

.cabecera-panel h3 {
    margin: 0;
    font-size: 1rem;
}

.fila-form {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.fila-form label {
    flex: 1 1 200px;
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
}

.fila-form select {
    width: 100%;
    padding: 0.35rem;
    margin-top: 0.25rem;
}

.fila-form input[type="text"],
.fila-form input[type="password"],
.fila-form input[type="email"] {
    width: 100%;
    padding: 0.35rem;
    margin-top: 0.25rem;
}

#opciones-operaciones {
    margin: 0.75rem 0 0.5rem;
    padding-right: 0;
}

.grupo-operaciones {
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #eee;
}

.grupo-operaciones h4 {
    margin: 0 0 0.35rem 0;
    font-size: 0.95rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.grupo-operaciones small {
    font-weight: normal;
    color: #666;
    font-size: 0.8rem;
}

.grupo-operaciones .lista-tipos {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.35rem 0.75rem;
}

.grupo-operaciones .lista-tipos label {
    font-size: 0.95rem;
    padding: 0.2rem 0.1rem;
}

#resumen-coste {
    font-size: 0.9rem;
    margin: 0.5rem 0 0.75rem 0;
}

.preview-excel-wrap {
    margin-top: 0.5rem;
}

.preview-excel-scroll {
    overflow-x: auto;
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid #dde4f0;
    border-radius: 4px;
}

.preview-excel-tabla {
    font-size: 0.8rem;
    min-width: max-content;
}

.preview-excel-tabla th {
    position: sticky;
    top: 0;
    background: #eef2f8;
    z-index: 1;
    white-space: nowrap;
    padding: 0.35rem 0.6rem;
}

.preview-excel-tabla td {
    padding: 0.3rem 0.6rem;
    white-space: nowrap;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preview-excel-tabla tbody tr:hover {
    background: #f5f8ff;
}

.menu-dashboard {
    margin-top: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
}

.menu-dashboard-item {
    display: inline-block;
    padding: 0.6rem 1.4rem;
    border-radius: 999px;
    background: #1e3a5f;
    color: #fff;
    text-decoration: none;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}

.menu-dashboard-item:hover {
    background: #2a4a7a;
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
}

/* Spinner inline para botones con operación en curso */
.btn-spinner {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    cursor: not-allowed;
    opacity: 0.75;
}

.btn-spinner::before {
    content: '';
    display: inline-block;
    width: 0.85em;
    height: 0.85em;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    flex-shrink: 0;
}

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

/* Modal de confirmación personalizado */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.modal-box {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.22);
    padding: 1.6rem 2rem 1.4rem;
    max-width: 480px;
    width: 94%;
}

.modal-box--wide {
    max-width: min(720px, 96vw);
}

.modal-box .modal-scroll {
    max-height: min(60vh, 420px);
    overflow: auto;
    margin: 0 0 1rem;
    border: 1px solid #e8e8e8;
    border-radius: 6px;
}

.modal-box .modal-seccion {
    margin: 0 0 1rem;
    font-size: 0.88rem;
    color: #333;
}

.modal-box .modal-seccion strong {
    display: block;
    margin-bottom: 0.35rem;
}

.label-nombre-prueba {
    flex: 1 1 100%;
    min-width: 100%;
}

.label-nombre-prueba input {
    width: 100%;
    max-width: 100%;
    padding: 0.45rem 0.5rem;
    margin-top: 0.25rem;
}

.tabla tr.fila-prueba {
    cursor: pointer;
}

.tabla tr.fila-prueba:hover {
    background: #f5f7fa;
}

.td-prueba {
    min-width: 12rem;
}

.celda-prueba-titulo {
    font-weight: 600;
    color: #1a1a1a;
}

.celda-prueba-plantilla {
    font-size: 0.82rem;
    color: #5a5a5a;
    margin-top: 0.2rem;
    font-weight: 400;
}

.modal-titulo-prueba {
    margin: 0 0 0.35rem;
}

.modal-linea-plantilla {
    margin: 0 0 0.5rem;
    font-size: 1rem;
    color: #333;
}

.modal-etiqueta {
    display: inline-block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #666;
    margin-right: 0.35rem;
    font-weight: 600;
}

.modal-linea-meta {
    margin: 0 0 1rem;
    font-size: 0.88rem;
    color: #555;
}

.modal-bloque-elegidas {
    background: #f8f9fb;
    border: 1px solid #e8eaef;
    border-radius: 6px;
    padding: 0.75rem 1rem;
}

.modal-lista-operaciones-elegidas {
    margin: 0.4rem 0 0 1.1rem;
    padding: 0;
}

.modal-bloque-confirma {
    margin-top: 0.75rem;
}

.modal-texto-muted {
    margin: 0.35rem 0 0;
    color: #666;
    font-size: 0.9rem;
    line-height: 1.45;
}

.ayuda-listado-pruebas {
    font-size: 0.88rem;
    color: #555;
    margin: 0 0 0.75rem;
}

.modal-box h3 {
    margin: 0 0 0.6rem;
    font-size: 1.05rem;
    color: #222;
}

.modal-box p {
    margin: 0 0 1.2rem;
    color: #444;
    font-size: 0.93rem;
    line-height: 1.5;
}

.modal-actions {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* Estado "lanzado": botón sustituido por badge de confirmación */
.badge-lanzado {
    display: inline-block;
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    border-radius: 4px;
    padding: 0.2rem 0.6rem;
    font-size: 0.85rem;
    font-weight: 600;
}