* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, sans-serif;
    background: #f0f2f5;
    margin: 0;
}

/* ==============================
   CONTENEDOR
================================ */
#all,
.main-container {
    max-width: 900px;
    margin: auto;
    background: #fff;
    padding: 40px;
    border-top: 8px solid #004a87;
}

/* ==============================
   HEADER
================================ */
#header {
    text-align: center;
    margin-bottom: 30px;
}

#header img {
    width: 90px;
}

#header h1 {
    color: #004a87;
    margin-bottom: 5px;
}

/* ==============================
   TABLA (FIX DEFINITIVO)
================================ */
table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed; /* 🔑 IMPRESCINDIBLE */
}

td {
    padding: 12px 15px;
    vertical-align: top;
}

/* Anchos fijos de columnas */
td:first-child {
    width: 35%;
}

td:last-child {
    width: 65%;
}

/* ==============================
   FORMULARIO
================================ */
label {
    font-weight: 600;
    display: block;
}

/* 🔒 Evita que <small> se comporte como inline */
small {
    display: block;
}

input,
select,
textarea {
    width: 100%;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #ccc;
}

textarea {
    min-height: 140px;
    line-height: 1.5;
}

/* ==============================
   FOCUS
================================ */
input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #1976d2;
    box-shadow: 0 0 0 3px rgba(25,118,210,.15);
}

/* ==============================
   LABEL HELP (ANTI-BUG)
================================ */
.label-help {
    display: block;
    margin-top: 8px;
    padding: 8px 10px;
    font-size: 0.85rem;
    line-height: 1.4;
    background: #e3f2fd;
    color: #003049;
    border-left: 4px solid #1976d2;
    border-radius: 6px;

    /* 🔥 FIXES CLAVES */
    width: 100%;
    max-width: 100%;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: break-word;
}

/* ==============================
   BOTONES – DESKTOP / MÓVIL
================================ */

.button-group {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 24px;
    margin-top: 40px;
    flex-wrap: nowrap; /* 🔥 CLAVE: nunca se apilan en desktop */
}

/* Botones */
.button-group input[type="submit"],
.button-group button[type="reset"] {
    min-width: 190px;
    padding: 14px 38px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    white-space: nowrap;
}



/* BOTÓN PRINCIPAL */
.button-group input[type="submit"] {
    background: linear-gradient(135deg, #004a87, #006bb3);
    color: #fff;
    box-shadow: 0 6px 14px rgba(0, 74, 135, 0.25);
}

.button-group input[type="submit"]:hover {
    background: linear-gradient(135deg, #00325f, #005999);
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(0, 74, 135, 0.35);
}

.button-group input[type="submit"]:active {
    transform: translateY(0);
    box-shadow: 0 4px 10px rgba(0, 74, 135, 0.25);
}

/* BOTÓN SECUNDARIO */
.button-group button[type="reset"] {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
}

.button-group button[type="reset"]:hover {
    background: #e5e7eb;
    box-shadow: 0 6px 12px rgba(0,0,0,0.08);
}

.button-group button[type="reset"]:active {
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.12);
}

/* Mobile */
@media (max-width: 768px) {
    .button-group {
        flex-direction: column;
        gap: 16px;
    }

    .button-group input[type="submit"],
    .button-group button[type="reset"] {
        width: 100%;
        min-width: unset;
    }
}



/* FIX CHECKBOX */
input[type="checkbox"] {
    width: auto !important;
    height: auto;
    margin: 0;
    transform: translateY(1px); /* micro ajuste visual */
}

/* ==============================
   ERROR
================================ */
.error-box {
    background: #ffebee;
    color: #b71c1c;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 6px;
}

/* ==============================
   MOBILE
================================ */
@media (max-width: 768px) {

    table,
    tr,
    td {
        display: block;
        width: 100%;
    }

    td {
        padding: 8px 0;
    }

    td:first-child,
    td:last-child {
        width: 100%;
    }
}

/* ==============================
   PRINT
================================ */
@media print {
    body { background: #fff; }
    * { box-shadow: none !important; }
}

/* ==============================
   GESTOR DE ARCHIVOS
================================ */
.file-upload-container {
    border: 2px dashed #ccc;
    padding: 22px;
    text-align: center;
    border-radius: 8px;
    background: #fafafa;
    position: relative;
    transition: all 0.2s ease;
}

.file-upload-container:hover {
    border-color: #004a87;
    background: #f0f7ff;
}

.file-upload-container.dragover {
    border-color: #1976d2;
    background: #e3f2fd;
}

#adjunto_usuario {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.upload-btn-text {
    color: #004a87;
    font-weight: bold;
    font-size: 0.95rem;
    pointer-events: none;
}

#file-status-msg {
    font-size: 0.85rem;
    margin-top: 6px;
    color: #666;
    font-style: italic;
}

#file-list {
    margin-top: 12px;
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f1f1f1;
    padding: 8px 12px;
    margin-bottom: 6px;
    border-radius: 5px;
    border-left: 4px solid #004a87;
    font-size: 0.9rem;
}

.file-remove {
    background: none;
    border: none;
    color: #d32f2f;
    cursor: pointer;
    font-size: 1.1rem;
}

.file-remove:hover {
    transform: scale(1.15);
}

/* ==============================
   CHECKBOX COPIA (FIX MOBILE)
================================ */

.checkbox-line {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}


.checkbox-line:hover {
    background: #f0f7ff;
}


/* Mobile: evitar que se rompa */
@media (max-width: 768px) {
    .row-checkbox td {
        display: block !important;
        width: 100% !important;
    }

    .checkbox-line {
        display: flex;
        align-items: flex-start;
        gap: 10px;
    }
}
