* {
    box-sizing: border-box;
    font-family: Arial, sans-serif;
}

body {
    margin: 0;
    background: #f4f6f8;
    color: #1f2937;
}

h1, h2 {
    margin-top: 0;
}

input,
select,
textarea {
    width: 100%;
    min-height: 52px;
    padding: 14px;
    margin-bottom: 12px;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    font-size: 16px;
    background: #fff;
}

textarea {
    min-height: 120px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #111827;
}

label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 700;
}

button {
    width: 100%;
    min-height: 54px;
    border: none;
    border-radius: 12px;
    background: #111827;
    color: white;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
}

button:hover {
    background: #374151;
}

button:active {
    transform: scale(0.98);
}

.btn-secondary {
    background: #e5e7eb;
    color: #111827;
}

.btn-secondary:hover {
    background: #d1d5db;
}

.error,
.success {
    margin-bottom: 16px;
    padding: 12px;
    border-radius: 10px;
    font-weight: 700;
}

.error {
    background: #fee2e2;
    color: #991b1b;
}

.success {
    background: #dcfce7;
    color: #166534;
}

.card {
    background: #ffffff;
    padding: 24px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
    width: 100%;
}

/* LOGIN */

.login-container {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px;
}

.login-card {
    max-width: 440px;
    padding: 34px 26px;
    border-radius: 26px;
}

.login-card h1 {
    font-size: 34px;
    line-height: 1.1;
    text-align: center;
    margin-bottom: 10px;
}

.login-card p {
    font-size: 18px;
    text-align: center;
    color: #6b7280;
    margin-bottom: 28px;
}

.login-card input,
.login-card button {
    min-height: 64px;
    font-size: 18px;
    border-radius: 16px;
}

/* WIZARD VENTA */

.wizard-page {
    min-height: 100vh;
    min-height: 100dvh;
    background: #f4f6f8;
    padding: 16px;
}

.wizard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 520px;
    margin: 0 auto 16px;
}

.wizard-header h1 {
    margin: 0;
    font-size: 24px;
}

.wizard-header p {
    margin: 4px 0 0;
    color: #6b7280;
    font-size: 14px;
}

.wizard-header a {
    color: #111827;
    text-decoration: none;
    font-weight: 700;
}

.wizard-card {
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
    background: #ffffff;
    padding: 22px;
    border-radius: 22px;
    box-shadow: 0 14px 36px rgba(0,0,0,0.08);
}

.progress {
    display: flex;
    align-items: center;
    margin-bottom: 28px;
}

.progress-step {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #e5e7eb;
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.progress-step.active {
    background: #111827;
    color: white;
}

.progress-line {
    flex: 1;
    height: 3px;
    background: #e5e7eb;
}

.step {
    display: none !important;
}

.step.active {
    display: block !important;
}

.step h2 {
    font-size: 22px;
    text-align: center;
    margin-bottom: 22px;
}

.wizard-buttons {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.wizard-buttons button {
    flex: 1;
}

/* DASHBOARD ADMIN */

.dashboard {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: #111827;
    color: white;
    padding: 24px;
    display: flex;
    flex-direction: column;
}

.brand h2 {
    margin: 0;
    font-size: 22px;
}

.brand p {
    margin-top: 8px;
    color: #9ca3af;
}

.menu {
    margin-top: 32px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.menu a {
    color: #d1d5db;
    text-decoration: none;
    padding: 14px;
    border-radius: 12px;
}

.menu a:hover,
.menu a.active {
    background: #374151;
    color: white;
}

.logout {
    margin-top: auto;
    color: #fca5a5;
    text-decoration: none;
    padding: 14px;
}

.main-content,
.content {
    flex: 1;
    padding: 24px;
}

/* BACKOFFICE */

.bo-page {
    min-height: 100vh;
    background: #f4f6f8;
    padding: 16px;
}

.bo-header {
    max-width: 1500px;
    margin: 0 auto 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.bo-header h1 {
    margin: 0;
    font-size: 26px;
}

.bo-header p {
    margin: 4px 0 0;
    color: #6b7280;
}

.bo-logout {
    padding: 10px 14px;
    border-radius: 12px;
    background: #111827;
    color: white !important;
    text-decoration: none;
    font-weight: 700;
}

.bo-card {
    max-width: 1500px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    padding: 18px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.08);
}

.bo-toolbar {
    display: grid;
    grid-template-columns: 180px 180px 1fr;
    gap: 14px;
    align-items: end;
    margin-bottom: 14px;
}

.bo-field input {
    margin-bottom: 0;
}

.bo-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.bo-actions button {
    width: auto;
    min-width: 130px;
    padding: 0 18px;
}

.bo-summary {
    font-size: 14px;
    color: #6b7280;
    margin: 8px 0 14px;
}

.table-responsive,
.bo-table-wrapper {
    width: 100%;
    overflow-x: visible;
}

.bo-table-wrapper {
    border-radius: 14px;
    border: 1px solid #e5e7eb;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

th,
td {
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
}

.bo-table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
}

.bo-table th,
.bo-table td {
    font-size: 11px;
    padding: 8px 6px;
    white-space: normal;
    word-break: break-word;
    vertical-align: middle;
}

.bo-table th {
    background: #f9fafb;
    color: #374151;
}

.bo-table th:nth-child(1),
.bo-table td:nth-child(1) { width: 9%; }

.bo-table th:nth-child(2),
.bo-table td:nth-child(2) { width: 9%; }

.bo-table th:nth-child(3),
.bo-table td:nth-child(3) { width: 7%; }

.bo-table th:nth-child(4),
.bo-table td:nth-child(4) { width: 7%; }

.bo-table th:nth-child(5),
.bo-table td:nth-child(5) { width: 8%; }

.bo-table th:nth-child(6),
.bo-table td:nth-child(6) { width: 9%; }

.bo-table th:nth-child(7),
.bo-table td:nth-child(7),
.bo-table th:nth-child(8),
.bo-table td:nth-child(8) { width: 7%; }

.bo-table th:nth-child(9),
.bo-table td:nth-child(9),
.bo-table th:nth-child(10),
.bo-table td:nth-child(10),
.bo-table th:nth-child(11),
.bo-table td:nth-child(11) { width: 6%; }

.bo-table th:nth-child(12),
.bo-table td:nth-child(12) { width: 7%; }

.bo-table th:nth-child(13),
.bo-table td:nth-child(13),
.bo-table th:nth-child(14),
.bo-table td:nth-child(14) {
    width: 5%;
    text-align: center;
}

.mini-btn {
    width: auto;
    min-height: auto;
    padding: 5px 8px;
    border-radius: 10px;
    font-size: 11px;
}

.file-icon {
    font-size: 18px;
    text-decoration: none;
}

.muted {
    color: #9ca3af;
}

/* MODAL */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    padding: 20px;
    z-index: 999;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal-box {
    background: white;
    width: 100%;
    max-width: 520px;
    border-radius: 20px;
    padding: 24px;
}

.modal-box p {
    white-space: pre-wrap;
    line-height: 1.5;
}

/* RESPONSIVE */

@media (max-width: 900px) {
    .dashboard {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        padding: 16px;
    }

    .menu {
        flex-direction: row;
        margin-top: 16px;
    }

    .menu a {
        flex: 1;
        text-align: center;
    }

    .main-content,
    .content {
        padding: 16px;
    }

    .bo-header {
        align-items: flex-start;
    }

    .bo-toolbar {
        grid-template-columns: 1fr;
    }

    .bo-actions {
        justify-content: stretch;
    }

    .bo-actions button {
        width: 100%;
    }

    .bo-card {
        padding: 14px;
    }

    .bo-table-wrapper,
    .table-responsive {
        overflow-x: auto;
    }

    .bo-table {
        min-width: 1300px;
        table-layout: auto;
    }

    .bo-table th,
    .bo-table td {
        font-size: 13px;
        padding: 10px;
        white-space: nowrap;
    }
}

@media (max-width: 480px) {
    .login-card {
        max-width: 100%;
        padding: 32px 22px;
    }

    .login-card h1 {
        font-size: 32px;
    }

    .login-card p {
        font-size: 17px;
    }
}

@media (min-width: 768px) {
    .wizard-page {
        padding: 32px;
    }

    .wizard-card {
        padding: 30px;
    }
}

/* BACKOFFICE - TABLA RESPONSIVE DESKTOP SIN SCROLL */

.bo-table-wrapper {
    overflow-x: visible !important;
    width: 100%;
}

.bo-table {
    width: 100% !important;
    min-width: 0 !important;
    table-layout: fixed;
}

.bo-table th,
.bo-table td {
    font-size: 11px;
    padding: 8px 6px;
    white-space: normal;
    word-break: break-word;
}

.bo-table th:nth-child(1),
.bo-table td:nth-child(1) {
    width: 9%;
}

.bo-table th:nth-child(2),
.bo-table td:nth-child(2) {
    width: 9%;
}

.bo-table th:nth-child(3),
.bo-table td:nth-child(3) {
    width: 7%;
}

.bo-table th:nth-child(4),
.bo-table td:nth-child(4) {
    width: 7%;
}

.bo-table th:nth-child(5),
.bo-table td:nth-child(5) {
    width: 8%;
}

.bo-table th:nth-child(6),
.bo-table td:nth-child(6) {
    width: 9%;
}

.bo-table th:nth-child(7),
.bo-table td:nth-child(7),
.bo-table th:nth-child(8),
.bo-table td:nth-child(8) {
    width: 7%;
}

.bo-table th:nth-child(9),
.bo-table td:nth-child(9),
.bo-table th:nth-child(10),
.bo-table td:nth-child(10),
.bo-table th:nth-child(11),
.bo-table td:nth-child(11) {
    width: 6%;
}

.bo-table th:nth-child(12),
.bo-table td:nth-child(12) {
    width: 7%;
}

.bo-table th:nth-child(13),
.bo-table td:nth-child(13),
.bo-table th:nth-child(14),
.bo-table td:nth-child(14) {
    width: 5%;
    text-align: center;
}

.file-icon {
    font-size: 18px;
}

.mini-btn {
    padding: 5px 8px;
    font-size: 11px;
}

/* En mobile sí permitimos scroll horizontal */
@media (max-width: 900px) {
    .bo-table-wrapper {
        overflow-x: auto !important;
    }

    .bo-table {
        min-width: 1300px !important;
        table-layout: auto;
    }

    .bo-table th,
    .bo-table td {
        font-size: 13px;
        padding: 10px;
        white-space: nowrap;
    }
}

.estado-pendiente td:not(:last-child) {
    background: #fef9c3;
}

.estado-aprobada td:not(:last-child) {
    background: #dcfce7;
}

.estado-rechazada td:not(:last-child) {
    background: #fee2e2;
}

.estado-actions {
    display: flex;
    gap: 6px;
    justify-content: center;
    align-items: center;
}

.estado-dot {
    width: 18px;
    height: 18px;
    min-height: 18px;
    padding: 0;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 0 0 1px #9ca3af;
    cursor: pointer;
}

.dot-pendiente {
    background: #facc15;
}

.dot-aprobada {
    background: #22c55e;
}

.dot-rechazada {
    background: #ef4444;
}

/* FIX BACKOFFICE TABLA CON ESTADO + ACCIONES */

.bo-table {
    width: 100%;
    table-layout: fixed;
}

.bo-table th,
.bo-table td {
    font-size: 10.5px;
    padding: 8px 5px;
    white-space: normal;
    word-break: normal;
    overflow-wrap: anywhere;
    vertical-align: middle;
}

.bo-table th:nth-child(1),
.bo-table td:nth-child(1) {
    width: 9%;
}

.bo-table th:nth-child(2),
.bo-table td:nth-child(2) {
    width: 6%;
}

.bo-table th:nth-child(3),
.bo-table td:nth-child(3) {
    width: 8%;
}

.bo-table th:nth-child(4),
.bo-table td:nth-child(4) {
    width: 6%;
}

.bo-table th:nth-child(5),
.bo-table td:nth-child(5) {
    width: 7%;
}

.bo-table th:nth-child(6),
.bo-table td:nth-child(6) {
    width: 7%;
}

.bo-table th:nth-child(7),
.bo-table td:nth-child(7) {
    width: 8%;
}

.bo-table th:nth-child(8),
.bo-table td:nth-child(8),
.bo-table th:nth-child(9),
.bo-table td:nth-child(9) {
    width: 6%;
}

.bo-table th:nth-child(10),
.bo-table td:nth-child(10),
.bo-table th:nth-child(11),
.bo-table td:nth-child(11),
.bo-table th:nth-child(12),
.bo-table td:nth-child(12) {
    width: 5%;
}

.bo-table th:nth-child(13),
.bo-table td:nth-child(13) {
    width: 7%;
}

.bo-table th:nth-child(14),
.bo-table td:nth-child(14),
.bo-table th:nth-child(15),
.bo-table td:nth-child(15) {
    width: 4%;
    text-align: center;
}

.bo-table th:nth-child(16),
.bo-table td:nth-child(16) {
    width: 6%;
    text-align: center;
}

.estado-actions {
    display: flex;
    gap: 5px;
    justify-content: center;
    align-items: center;
    min-width: 54px;
}

.estado-dot {
    width: 14px;
    height: 14px;
    min-height: 14px;
    min-width: 14px;
    padding: 0;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 0 0 1px #9ca3af;
}

.file-icon {
    font-size: 16px;
}

/* Mobile: ahí sí dejamos scroll horizontal */
@media (max-width: 900px) {
    .bo-table-wrapper,
    .table-responsive {
        overflow-x: auto;
    }

    .bo-table {
        min-width: 1500px;
        table-layout: auto;
    }

    .bo-table th,
    .bo-table td {
        font-size: 13px;
        padding: 10px;
        white-space: nowrap;
    }
}

.bo-table td.estado-actions {
    background: #ffffff !important;
}


.modal-estado-box {
    text-align: center;
}

.modal-estado-icon {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    margin: 0 auto 16px;
    box-shadow: 0 0 0 6px #f3f4f6;
}

.modal-icon-pendiente {
    background: #facc15;
}

.modal-icon-aprobada {
    background: #22c55e;
}

.modal-icon-rechazada {
    background: #ef4444;
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.modal-actions button {
    flex: 1;
}

#btnConfirmarEstado:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}