body {
    font-family: 'Roboto', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f4f7f8;
    margin: 0;
    padding: 20px;
    color: #000000;
}

h1 {
    text-align: center;
    color: #000000;
    margin-bottom: 30px;
    font-size: 20px;
}

form {
    max-width: 100%;
    margin: 0 auto;
    background: #fff;
    padding: 25px 30px;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    overflow: auto;
    max-height: 70vh;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    min-width: 2530px; /* ✅ ajustado a 18 columnas (se agregó Especialidad) */
    table-layout: fixed;
}

th,
td {
    padding: 8px 10px;
    border: 1px solid #ddd;
    text-align: center;
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 13px;
    white-space: nowrap;
}

/* ✅ IMPORTANTE: permitir click/hover correcto en la columna Acción */
td:last-child {
    overflow: visible;      /* evita que el botón se "corte" */
    position: relative;
}

/* Encabezados */
th {
    background-color: #071E61;
    color: white;
    font-weight: normal;
    font-size: 12px;
    position: sticky;
    top: 0;
    z-index: 10;
    white-space: normal;
    line-height: 1.2em;
    padding: 10px 8px;
    word-wrap: break-word;
}

/* ✅ Anchos por columna (18 columnas totales) */
th:nth-child(1),  td:nth-child(1)  { width: 150px; } /* Fecha procedimiento */
th:nth-child(2),  td:nth-child(2)  { width: 150px; } /* Iniciales */
th:nth-child(3),  td:nth-child(3)  { width: 150px; } /* Fecha nacimiento */
th:nth-child(4),  td:nth-child(4)  { width: 90px;  } /* Edad */
th:nth-child(5),  td:nth-child(5)  { width: 150px; } /* Tipo cirugía */
th:nth-child(6),  td:nth-child(6)  { width: 180px; } /* ✅ Especialidad */

th:nth-child(7),  td:nth-child(7)  { width: 150px; } /* Verificación pre */
th:nth-child(8),  td:nth-child(8)  { width: 150px; } /* Consentimientos */
th:nth-child(9),  td:nth-child(9)  { width: 150px; } /* Docs/estudios/imágenes */
th:nth-child(10), td:nth-child(10) { width: 150px; } /* Equipos/dispositivos */
th:nth-child(11), td:nth-child(11) { width: 150px; } /* Alergias */
th:nth-child(12), td:nth-child(12) { width: 150px; } /* Esterilización */
th:nth-child(13), td:nth-child(13) { width: 150px; } /* Recuento */
th:nth-child(14), td:nth-child(14) { width: 150px; } /* Pausa quirúrgica */
th:nth-child(15), td:nth-child(15) { width: 150px; } /* Time out */
th:nth-child(16), td:nth-child(16) { width: 150px; } /* Presentación team */
th:nth-child(17), td:nth-child(17) { width: 150px; } /* Firma team */

/* ✅ Columna Acción (última) */
th:nth-child(18), td:nth-child(18) { width: 80px; }

/* Inputs y selects */
input[type="date"],
input[type="text"],
input[type="number"],
select {
    width: 100%;
    box-sizing: border-box;
    padding: 6px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

input:focus,
select:focus {
    border-color: #8CBDEE;
    outline: none;
}

/* Campo readonly */
input[readonly] {
    background-color: #f1f3f4;
    cursor: not-allowed;
}

/* Botones generales */
button {
    background-color: #071E61;
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    margin-right: 10px;
    transition: background-color 0.3s ease;
}

button:hover {
    background-color: #8CBDEE;
}

/* 🔴 Botón eliminar fila (más "clickeable" y sin recorte) */
.btn-eliminar {
    background: transparent !important;
    border: none;
    cursor: pointer;
    font-size: 20px;
    padding: 6px;
    line-height: 1;
    color: #C62828; /* rojo principal */
    position: relative;
    z-index: 20;
    pointer-events: auto;
}

.btn-eliminar:hover {
    color: #B71C1C; /* rojo más oscuro */
    transform: scale(1.15); /* antes 1.2 (evita recortes) */
}

.btn-eliminar:focus {
    outline: none;
}

/* ✅ Reemplazo de :has() (mejor compatibilidad) */
tbody tr:hover td {
    background-color: #f8fbff; /* resaltado suave de fila */
}
tbody tr:hover td:last-child {
    background-color: #fdecea; /* resaltado en la celda acción */
}

/* Responsive */
@media (max-width: 768px) {
    form {
        padding: 15px;
        max-height: 75vh;
    }

    table {
        min-width: 2050px; /* ✅ ajustado por 18 columnas */
    }

    th,
    td {
        padding: 6px 8px;
        font-size: 11px;
    }

    button {
        width: 100%;
        margin-bottom: 10px;
    }
}

@media (max-width: 480px) {
    table {
        min-width: 1550px; /* ✅ ajustado por 18 columnas */
    }
}

/* Header */
.header {
    display: flex;
    align-items: center;
    padding-bottom: 20px;
    border-bottom: 2px solid #071E61;
    margin-bottom: 30px;
}

.logo {
    max-height: 60px;
    width: auto;
    margin-right: 20px;
}
