/* ==========================================
   VARIABLES DE COLORES - PALETA MEDSURSA
   ========================================== */
:root {
    --naranja: #ED6B37;
    --azul: #3B7FA8;
    --azul-oscuro: #185E83;
    --amarillo: #FBD136;
    --naranja-claro: #F27B36;
    --celeste: #239CD4;
    --gris-oscuro: #3E3A38;
    --gris-medio: #71615B;
    --blanco: #FDFDFD;
    --crema: #F5CAA7;
    --radius: 12px;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-md: 0 8px 30px rgba(24, 94, 131, 0.12);
    --shadow-lg: 0 16px 50px rgba(24, 94, 131, 0.18);
    --transition: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================
   ESTILOS GENERALES
   ========================================== */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #eef2f5;
    min-height: 100vh;
    position: relative;
    color: var(--gris-oscuro);
    -webkit-font-smoothing: antialiased;
}

.background-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-image: url('../images/fondo.jpg');
    background-size: cover; background-position: center; background-repeat: no-repeat;
    filter: blur(3px) brightness(0.85);
    z-index: -2;
}

.background-overlay::after {
    content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(160deg, rgba(24, 94, 131, 0.55) 0%, rgba(59, 127, 168, 0.35) 100%);
    pointer-events: none;
}

.particles {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; z-index: -1; overflow: hidden;
}

.particle {
    position: absolute; border-radius: 50%; opacity: 0;
    background: rgba(255,255,255,0.15);
    animation: particleFloat linear infinite;
}

@keyframes particleFloat {
    0% { opacity: 0; transform: translateY(100vh) scale(0); }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { opacity: 0; transform: translateY(-10vh) scale(1); }
}

/* ==========================================
   CONTENEDOR PRINCIPAL
   ========================================== */
.container {
    max-width: 860px;
    margin: 30px auto;
    background: var(--blanco);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    position: relative;
    z-index: 1;
    animation: containerEntry 0.8s var(--transition) both;
}

@keyframes containerEntry {
    from { opacity: 0; transform: translateY(40px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ==========================================
   CABECERA
   ========================================== */
.header {
    background: linear-gradient(135deg, var(--azul-oscuro) 0%, var(--azul) 50%, var(--celeste) 100%);
    color: white;
    padding: 0;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.header::before {
    content: ''; position: absolute; top: -50%; right: -20%; width: 300px; height: 300px;
    background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
    border-radius: 50%;
}

.header-content {
    display: flex; align-items: center; gap: 24px; padding: 28px 32px 20px;
    position: relative; z-index: 1;
}

.header .logo {
    width: 80px; height: 80px; object-fit: contain;
    background: white; padding: 10px; border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    flex-shrink: 0;
    animation: logoFloat 3s ease-in-out infinite alternate;
}

@keyframes logoFloat {
    from { transform: translateY(0); }
    to { transform: translateY(-4px); }
}

.header-text { text-align: left; }

.header h1 {
    font-size: 20px; font-weight: 800; margin-bottom: 6px;
    letter-spacing: 0.5px; text-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.header p {
    font-size: 13px; opacity: 0.9; line-height: 1.5; font-weight: 300;
}

.header-wave { width: 100%; line-height: 0; margin-top: -2px; }
.header-wave svg { width: 100%; height: 30px; }

/* ==========================================
   BARRA DE PROGRESO
   ========================================== */
.progress-bar {
    padding: 28px 32px 20px;
    background: #faf5f0;
    position: relative;
}

.progress-track {
    position: absolute;
    top: 46px;
    left: 68px;
    right: 68px;
    height: 4px;
    background: #e0d5cc;
    border-radius: 4px;
    z-index: 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--azul), var(--celeste));
    border-radius: 4px;
    width: 0%;
    transition: width 0.6s var(--transition);
}

.progress-steps {
    display: flex;
    justify-content: space-between;
    position: relative;
    z-index: 1;
}

.progress-step {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    transition: all 0.4s var(--transition);
}

.step-circle {
    width: 42px; height: 42px; border-radius: 50%;
    background: white; border: 3px solid #d5ccc5;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 15px; color: #b0a59c;
    transition: all 0.4s var(--transition);
    position: relative;
}

.step-label {
    font-size: 11px; font-weight: 600; color: #b0a59c;
    transition: all 0.3s ease; text-transform: uppercase; letter-spacing: 0.5px;
}

.progress-step.active .step-circle {
    background: linear-gradient(135deg, var(--naranja), var(--naranja-claro));
    border-color: var(--naranja);
    color: white;
    transform: scale(1.15);
    box-shadow: 0 4px 15px rgba(237, 107, 55, 0.4);
}

.progress-step.active .step-circle::after {
    content: ''; position: absolute; inset: -6px; border-radius: 50%;
    border: 2px solid rgba(237, 107, 55, 0.3);
    animation: stepPulse 2s ease-in-out infinite;
}

@keyframes stepPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.15); opacity: 0; }
}

.progress-step.active .step-label {
    color: var(--naranja); font-weight: 700;
}

.progress-step.completed .step-circle {
    background: linear-gradient(135deg, var(--azul), var(--azul-oscuro));
    border-color: var(--azul-oscuro);
    color: white;
    box-shadow: 0 3px 10px rgba(59, 127, 168, 0.3);
}

.progress-step.completed .step-label {
    color: var(--azul-oscuro);
}

/* ==========================================
   FORMULARIO
   ========================================== */
form {
    padding: 32px;
    background: #faf5f0;
}

.form-page {
    display: none;
}

.form-page.active {
    display: block;
    animation: pageSlideIn 0.55s var(--transition) both;
}

@keyframes pageSlideIn {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Page header */
.page-header {
    display: flex; align-items: center; gap: 16px;
    margin-bottom: 28px; padding-bottom: 18px;
    border-bottom: 2px solid rgba(24, 94, 131, 0.1);
}

.page-icon {
    width: 52px; height: 52px; border-radius: 14px;
    background: linear-gradient(135deg, var(--azul), var(--azul-oscuro));
    display: flex; align-items: center; justify-content: center;
    color: white; flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(24, 94, 131, 0.25);
}

.page-header h2 {
    color: var(--azul-oscuro); font-size: 22px; font-weight: 800;
    margin: 0; border: none; padding: 0; letter-spacing: -0.3px;
}

.page-subtitle {
    color: var(--gris-medio); font-size: 13px; margin-top: 2px; font-weight: 400;
}

/* Form grids */
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
@media (max-width: 700px) {
    .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
}

.form-divider {
    height: 1px; background: linear-gradient(90deg, transparent, rgba(24,94,131,0.15), transparent);
    margin: 24px 0;
}

.form-section-title {
    font-size: 14px; font-weight: 700; color: var(--azul-oscuro);
    text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 16px;
    display: flex; align-items: center; gap: 8px;
}

.form-section-title::before {
    content: ''; width: 4px; height: 18px; border-radius: 4px;
    background: linear-gradient(180deg, var(--naranja), var(--naranja-claro));
}

/* Animations on scroll */
.anim-on-view {
    opacity: 0; transform: translateY(16px);
    transition: opacity 0.5s var(--transition), transform 0.5s var(--transition);
}

.anim-on-view.visible { opacity: 1; transform: translateY(0); }

/* Form groups */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block; margin-bottom: 6px;
    color: var(--gris-oscuro); font-weight: 600; font-size: 13px;
}

.required { color: var(--naranja); font-size: 14px; }

.input-wrapper {
    position: relative;
}

.input-icon {
    position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
    pointer-events: none; z-index: 1;
}

.input-wrapper input {
    padding-left: 42px !important;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="date"],
.form-group select,
.form-group input[type="file"] {
    width: 100%; padding: 11px 14px;
    border: 2px solid #e0dbd6; border-radius: 10px;
    font-size: 14px; font-family: inherit;
    transition: all 0.3s var(--transition);
    background: white; color: var(--gris-oscuro);
}

.form-group input::placeholder {
    color: #bbb; font-weight: 400;
}

.form-group input:focus,
.form-group select:focus {
    outline: none; border-color: var(--azul);
    box-shadow: 0 0 0 4px rgba(59, 127, 168, 0.1);
    background: #fefefe;
}

.form-group input.error-field { border-color: #b71c1c; }
.form-group input.success-field { border-color: #1b7e20; }

.form-group select {
    cursor: pointer; appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%233E3A38' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 14px center;
    padding-right: 40px;
}

.form-group small {
    display: block; margin-top: 4px;
    color: var(--gris-medio); font-size: 11.5px;
}

.error-message {
    color: #b71c1c; font-size: 12px; margin-top: 4px;
    display: none; font-weight: 500;
}

.error-message.show { display: block; animation: shakeIn 0.4s ease; }

@keyframes shakeIn {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* ==========================================
   RADIO BUTTONS
   ========================================== */
.radio-group { display: flex; gap: 12px; flex-wrap: wrap; }

.radio-label {
    display: flex; align-items: center; gap: 10px;
    cursor: pointer; padding: 11px 20px;
    border: 2px solid #e0dbd6; border-radius: 10px;
    transition: all 0.3s var(--transition);
    flex: 1; position: relative; overflow: hidden;
}

.radio-label::before {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(135deg, rgba(59,127,168,0.05), rgba(59,127,168,0.02));
    opacity: 0; transition: opacity 0.3s ease;
}

.radio-label:hover { border-color: var(--azul); }
.radio-label:hover::before { opacity: 1; }

.radio-label input[type="radio"] {
    position: absolute; opacity: 0; width: 0; height: 0;
}

.radio-custom {
    width: 20px; height: 20px; border: 2px solid #ccc; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.3s var(--transition); flex-shrink: 0;
}

.radio-custom::after {
    content: ''; width: 10px; height: 10px; border-radius: 50%;
    background: var(--azul); transform: scale(0);
    transition: transform 0.3s var(--transition);
}

.radio-label input:checked ~ .radio-custom {
    border-color: var(--azul);
}

.radio-label input:checked ~ .radio-custom::after {
    transform: scale(1);
}

.radio-label input:checked ~ span:last-child {
    color: var(--azul-oscuro); font-weight: 700;
}

.radio-label:has(input:checked) {
    border-color: var(--azul);
    background: rgba(59, 127, 168, 0.04);
}

/* ==========================================
   BOTONES
   ========================================== */
.form-buttons {
    display: flex; gap: 14px; justify-content: space-between;
    margin-top: 32px;
}

.btn-prev, .btn-next, .btn-submit, .btn-reload {
    padding: 13px 28px; border: none; border-radius: 12px;
    font-size: 15px; font-weight: 700; cursor: pointer;
    transition: all 0.3s var(--transition);
    display: inline-flex; align-items: center; gap: 8px;
    font-family: inherit; letter-spacing: 0.3px;
    position: relative; overflow: hidden;
}

.btn-prev, .btn-next, .btn-submit, .btn-reload {
    text-transform: none;
}

.btn-prev::after, .btn-next::after, .btn-submit::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
    opacity: 0; transition: opacity 0.3s ease;
}

.btn-prev:hover::after, .btn-next:hover::after, .btn-submit:hover::after { opacity: 1; }

.btn-prev {
    background: #8d8178; color: white;
}

.btn-prev:hover {
    background: var(--gris-oscuro);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.btn-next, .btn-submit {
    background: linear-gradient(135deg, var(--naranja) 0%, var(--naranja-claro) 100%);
    color: white; flex: 1; justify-content: center;
    box-shadow: 0 4px 15px rgba(237, 107, 55, 0.25);
}

.btn-next:hover, .btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(237, 107, 55, 0.4);
}

.btn-submit:disabled {
    background: #ccc; cursor: not-allowed; transform: none; box-shadow: none;
}

.btn-submit:disabled::after { display: none; }

/* Ripple effect */
.btn-ripple {
    position: absolute; border-radius: 50%;
    background: rgba(255,255,255,0.35);
    transform: scale(0); animation: ripple 0.6s ease-out;
    pointer-events: none;
}

@keyframes ripple {
    to { transform: scale(4); opacity: 0; }
}

/* ==========================================
   FICHAS - DESCARGA Y SUBIDA
   ========================================== */
.fichas-step-label {
    display: flex; align-items: center; gap: 12px; margin-bottom: 18px;
}

.fichas-step-number {
    width: 34px; height: 34px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: white; flex-shrink: 0;
}

.fichas-step-number.step-blue { background: linear-gradient(135deg, var(--azul), var(--azul-oscuro)); box-shadow: 0 3px 10px rgba(59,127,168,0.3); }
.fichas-step-number.step-orange { background: linear-gradient(135deg, var(--naranja), var(--naranja-claro)); box-shadow: 0 3px 10px rgba(237,107,55,0.3); }

.fichas-step-label h3 {
    font-size: 15px; font-weight: 700; color: var(--azul-oscuro); margin: 0;
}

.fichas-download-section {
    background: linear-gradient(145deg, #f2f8fb 0%, #e6f1f7 100%);
    border: 2px solid rgba(59, 127, 168, 0.25);
    border-radius: 16px; padding: 24px;
    margin-bottom: 22px; position: relative; overflow: hidden;
}

.fichas-download-section::before {
    content: ''; position: absolute; top: -40px; right: -40px;
    width: 120px; height: 120px;
    background: radial-gradient(circle, rgba(59,127,168,0.08) 0%, transparent 70%);
    border-radius: 50%;
}

.fichas-upload-section {
    background: linear-gradient(145deg, #fef9f4 0%, #fdf3ea 100%);
    border: 2px solid rgba(237, 107, 55, 0.25);
    border-radius: 16px; padding: 24px;
    margin-bottom: 20px; position: relative; overflow: hidden;
}

.fichas-upload-section::before {
    content: ''; position: absolute; top: -40px; right: -40px;
    width: 120px; height: 120px;
    background: radial-gradient(circle, rgba(237,107,55,0.08) 0%, transparent 70%);
    border-radius: 50%;
}

.fichas-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
}

@media (max-width: 600px) { .fichas-grid { grid-template-columns: 1fr; } }

.ficha-download-card {
    display: flex; align-items: center; gap: 14px;
    background: white; border: 2px solid #e0e8ee; border-radius: 14px;
    padding: 16px 18px; text-decoration: none; color: var(--gris-oscuro);
    transition: all 0.35s var(--transition); cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.ficha-download-card:hover {
    border-color: var(--azul);
    box-shadow: 0 8px 25px rgba(59, 127, 168, 0.15);
    transform: translateY(-3px);
}

.ficha-icon {
    width: 50px; height: 50px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    background: linear-gradient(135deg, #e8f4f8, #d4ecf5);
}

.ficha-info { flex: 1; min-width: 0; }
.ficha-info strong { display: block; font-size: 13px; color: var(--azul-oscuro); margin-bottom: 2px; font-weight: 700; }
.ficha-info small { font-size: 11px; color: var(--gris-medio); line-height: 1.3; }

.ficha-btn {
    background: linear-gradient(135deg, var(--azul), var(--azul-oscuro));
    color: white; padding: 8px 16px; border-radius: 8px;
    font-size: 11px; font-weight: 700; white-space: nowrap;
    transition: all 0.3s ease; flex-shrink: 0;
    box-shadow: 0 3px 10px rgba(59, 127, 168, 0.25);
    display: flex; align-items: center; gap: 5px;
}

.ficha-download-card:hover .ficha-btn {
    box-shadow: 0 5px 15px rgba(24, 94, 131, 0.4);
}

/* Upload areas */
.upload-drop-area {
    border: 2px dashed #d4c5b5; border-radius: 14px;
    padding: 24px 16px; text-align: center;
    background: white; transition: all 0.35s var(--transition);
    cursor: pointer; position: relative;
}

.upload-drop-area:hover, .upload-drop-area.dragover {
    border-color: var(--naranja); background: #fffaf6;
    transform: translateY(-2px); box-shadow: 0 6px 20px rgba(237,107,55,0.1);
}

.upload-drop-area.file-selected {
    border-color: #1b7e20; border-style: solid; background: #f6fdf6;
}

.upload-drop-area.file-compressing {
    border-color: var(--naranja);
    border-style: solid;
    background: linear-gradient(135deg, #fff8f0, #fff3e6);
    pointer-events: none;
    position: relative;
    overflow: hidden;
}
.upload-drop-area.file-compressing::after {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(237, 107, 55, 0.1), transparent);
    animation: compressShimmer 1.2s ease-in-out infinite;
}
@keyframes compressShimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

.upload-icon-svg { margin-bottom: 8px; }

.upload-drop-area label {
    display: block; font-size: 13px; font-weight: 600;
    color: var(--azul-oscuro); margin-bottom: 4px; cursor: pointer;
}

.upload-drop-area small { font-size: 11px; color: var(--gris-medio); }
.upload-drop-area input[type="file"] { display: none; }

.upload-photo-area {
    padding: 30px 16px;
    border-color: rgba(59,127,168,0.25);
}

.upload-photo-area:hover {
    border-color: var(--azul); background: #f6fbfe;
}

.upload-file-name {
    display: none; align-items: center; gap: 6px; justify-content: center;
    margin-top: 10px; padding: 8px 14px;
    background: #e8f5e9; border-radius: 8px;
    font-size: 12px; color: #145e18; font-weight: 600;
}

.upload-file-name.show {
    display: flex;
    animation: fileNamePop 0.4s var(--transition);
}

@keyframes fileNamePop {
    from { opacity: 0; transform: translateY(5px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ==========================================
   MODAL ARCHIVOS - DASHBOARD
   ========================================== */
.files-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 18px;
}

@media (max-width: 700px) { .files-grid { grid-template-columns: 1fr; } }

.file-panel {
    border: 2px solid #e4e8ec; border-radius: 14px;
    padding: 18px; background: #fafbfc;
    transition: all 0.3s var(--transition);
}

.file-panel:hover { box-shadow: 0 6px 20px rgba(0,0,0,0.06); transform: translateY(-2px); }

.file-panel.panel-orange { border-color: rgba(237,107,55,0.35); background: linear-gradient(180deg, #fef9f4 0%, #fff 60%); }

.file-panel-header {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid #eee;
}

.file-panel-header .panel-icon {
    width: 36px; height: 36px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; flex-shrink: 0;
}

.file-panel-header .panel-icon.icon-blue { background: linear-gradient(135deg, #e8f4f8, #d4ecf5); }
.file-panel-header .panel-icon.icon-orange { background: linear-gradient(135deg, #fef0e6, #fde4d2); }
.file-panel-header h4 { font-size: 13px; font-weight: 700; color: var(--azul-oscuro); margin: 0; }
.file-panel.panel-orange .file-panel-header h4 { color: #c75520; }

.file-panel .file-preview {
    width: 100%; height: 170px;
    border: 2px dashed #d8dde2; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 12px; background: white; overflow: hidden;
    font-size: 12px; color: #aaa;
}

.file-panel.panel-orange .file-preview { border-color: #e4cdb8; }
.file-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }

.file-panel-actions { display: flex; gap: 8px; margin-bottom: 10px; }

.file-panel-actions button {
    flex: 1; padding: 7px 10px; border: none; border-radius: 8px;
    font-size: 11.5px; font-weight: 600; cursor: pointer;
    transition: all 0.2s ease; display: flex; align-items: center;
    justify-content: center; gap: 4px;
}

.file-panel-actions .btn-view { background: #e8f4f8; color: var(--azul-oscuro); }
.file-panel-actions .btn-view:hover { background: #d4ecf5; }
.file-panel-actions .btn-download { background: linear-gradient(135deg, var(--azul), var(--azul-oscuro)); color: white; }
.file-panel-actions .btn-download:hover { box-shadow: 0 3px 10px rgba(59, 127, 168, 0.35); }

.file-panel input[type="file"] {
    width: 100%; padding: 6px 8px;
    border: 1.5px solid #ddd; border-radius: 8px;
    font-size: 11px; background: white; transition: border-color 0.2s;
}

.file-panel input[type="file"]:hover { border-color: var(--azul); }

/* ==========================================
   TOAST NOTIFICATIONS
   ========================================== */
.toast-container {
    position: fixed; top: 24px; right: 24px; z-index: 10000;
    display: flex; flex-direction: column; gap: 10px;
}

.toast {
    padding: 14px 20px; border-radius: 12px;
    font-size: 13px; font-weight: 600; font-family: inherit;
    display: flex; align-items: center; gap: 10px;
    min-width: 300px; max-width: 420px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    animation: toastIn 0.4s var(--transition);
    backdrop-filter: blur(10px);
}

.toast.toast-out { animation: toastOut 0.3s var(--transition) forwards; }

.toast-success { background: rgba(232,245,233,0.97); color: #145e18; border-left: 4px solid #1b7e20; }
.toast-error { background: rgba(255,235,238,0.97); color: #8e1414; border-left: 4px solid #b71c1c; }
.toast-warning { background: rgba(255,243,210,0.97); color: #a06300; border-left: 4px solid #e67e00; }
.toast-info { background: rgba(227,242,253,0.95); color: var(--azul-oscuro); border-left: 4px solid var(--celeste); }

@keyframes toastIn { from { opacity: 0; transform: translateX(60px) scale(0.95); } to { opacity: 1; transform: translateX(0) scale(1); } }
@keyframes toastOut { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(60px); } }

/* ==========================================
   MENSAJE DE EXITO
   ========================================== */
.success-message {
    text-align: center; padding: 60px 30px;
    animation: successEntry 0.6s var(--transition);
}

@keyframes successEntry {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.success-animation { margin-bottom: 24px; }

.checkmark { border-radius: 50%; display: block; margin: 0 auto; }
.checkmark-circle { stroke: #1b7e20; stroke-width: 2; stroke-dasharray: 166; stroke-dashoffset: 166; animation: checkStroke 0.6s 0.2s var(--transition) forwards; }
.checkmark-check { stroke: #1b7e20; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 48; stroke-dashoffset: 48; animation: checkStroke 0.3s 0.7s var(--transition) forwards; }

@keyframes checkStroke { to { stroke-dashoffset: 0; } }

.success-message h2 {
    color: var(--azul-oscuro); font-size: 28px; font-weight: 800;
    margin-bottom: 10px; letter-spacing: -0.3px;
}

.success-message p {
    color: var(--gris-medio); font-size: 16px; margin-bottom: 30px;
}

.btn-reload {
    background: linear-gradient(135deg, var(--azul) 0%, var(--azul-oscuro) 100%);
    color: white; justify-content: center;
    box-shadow: 0 4px 15px rgba(59, 127, 168, 0.3);
}

.btn-reload:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(59, 127, 168, 0.4);
}

/* ==========================================
   PANEL DE ADMINISTRACION
   ========================================== */
.admin-container {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 15px;
}

.admin-header {
    background: linear-gradient(135deg, var(--azul-oscuro) 0%, var(--azul) 100%);
    color: white;
    padding: 15px 20px;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    box-shadow: 0 5px 20px rgba(24, 94, 131, 0.3);
}

.admin-header h1 {
    font-size: 22px;
}

.admin-header .user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-logout {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid white;
    padding: 6px 16px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    text-decoration: none;
    font-size: 13px;
}

.btn-logout:hover {
    background: white;
    color: var(--azul-oscuro);
}

/* ==========================================
   SIDEBAR NAVIGATION
   ========================================== */
.admin-layout {
    display: flex;
    gap: 15px;
    min-height: calc(100vh - 80px);
}

.admin-sidebar {
    width: 200px;
    min-width: 200px;
    background: var(--blanco);
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 10px 0;
    height: fit-content;
    position: sticky;
    top: 15px;
}

.sidebar-nav {
    list-style: none;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    color: var(--gris-oscuro);
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.sidebar-nav li a:hover,
.sidebar-nav li a.active {
    background: rgba(59, 127, 168, 0.08);
    color: var(--azul-oscuro);
    border-left-color: var(--naranja);
}

.sidebar-nav li a .nav-icon {
    font-size: 16px;
}

.admin-main {
    flex: 1;
    min-width: 0;
}

/* ==========================================
   ESTADISTICAS CARDS
   ========================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--blanco);
    padding: 18px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    text-align: center;
    border-top: 3px solid var(--azul);
    transition: transform 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
}

.stat-card .stat-number {
    font-size: 32px;
    font-weight: bold;
    color: var(--azul-oscuro);
}

.stat-card .stat-label {
    color: var(--gris-medio);
    margin-top: 5px;
    font-size: 13px;
}

.stat-card.orange { border-top-color: #d84e00; }
.stat-card.orange .stat-number { color: #d84e00; }
.stat-card.green { border-top-color: #1b7e20; }
.stat-card.green .stat-number { color: #1b7e20; }
.stat-card.yellow { border-top-color: #c89400; }
.stat-card.yellow .stat-number { color: #b08200; }
.stat-card.red { border-top-color: #b71c1c; }
.stat-card.red .stat-number { color: #b71c1c; }

/* ==========================================
   FILTROS Y BUSQUEDA
   ========================================== */
.filters-section {
    background: var(--blanco);
    padding: 18px;
    border-radius: 10px;
    margin-bottom: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.filters-section h3 {
    color: var(--azul-oscuro);
    margin-bottom: 15px;
    font-size: 16px;
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 15px;
}

.filter-group {
    display: flex;
    flex-direction: column;
}

.filter-group label {
    margin-bottom: 5px;
    font-weight: 600;
    color: var(--gris-oscuro);
    font-size: 12px;
}

.filter-group input,
.filter-group select {
    padding: 8px 10px;
    border: 2px solid #e0e0e0;
    border-radius: 5px;
    font-size: 13px;
}

.filter-group input:focus,
.filter-group select:focus {
    border-color: var(--azul);
    outline: none;
}

.action-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-search,
.btn-export-excel,
.btn-clear {
    padding: 8px 18px;
    border: none;
    border-radius: 5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 13px;
}

.btn-search {
    background: var(--naranja);
    color: white;
}

.btn-search:hover {
    background: var(--naranja-claro);
}

.btn-export-excel {
    background: var(--azul);
    color: white;
}

.btn-export-excel:hover {
    background: var(--azul-oscuro);
}

.btn-clear {
    background: var(--gris-medio);
    color: white;
}

.btn-clear:hover {
    background: var(--gris-oscuro);
}

.btn-columns {
    background: var(--azul-oscuro);
    color: white;
    padding: 8px 18px;
    border: none;
    border-radius: 5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 13px;
}

.btn-columns:hover {
    background: var(--azul);
}

/* ==========================================
   PANEL DE COLUMNAS CONFIGURABLES
   ========================================== */
.columns-panel {
    margin-top: 12px;
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    animation: fadeIn 0.2s ease;
}

.columns-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: var(--azul-oscuro);
    color: white;
    font-size: 13px;
}

.columns-panel-header button {
    color: white !important;
}

.columns-panel-body {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
    gap: 4px 12px;
    padding: 12px 14px;
}

.col-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 500;
    color: var(--gris-oscuro);
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
    user-select: none;
}

.col-toggle:hover {
    background: rgba(59, 127, 168, 0.1);
}

.col-toggle input[type="checkbox"] {
    width: 15px;
    height: 15px;
    accent-color: var(--azul);
    cursor: pointer;
    flex-shrink: 0;
}

.columns-panel-footer {
    display: flex;
    gap: 8px;
    padding: 8px 14px;
    border-top: 1px solid #e0e0e0;
    background: #f0f0f0;
}

/* ==========================================
   TABLA DE REGISTROS
   ========================================== */
.table-container {
    background: var(--blanco);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.table-header-bar {
    padding: 12px 15px;
    background: #f8f8f8;
    border-bottom: 2px solid #e0e0e0;
    font-size: 13px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.data-table thead {
    background: var(--azul-oscuro);
    color: white;
}

.data-table thead th {
    padding: 10px 8px;
    text-align: left;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    white-space: nowrap;
}

.data-table tbody tr {
    border-bottom: 1px solid #e8e8e8;
    transition: background 0.2s ease;
}

.data-table tbody tr:hover {
    background: rgba(59, 127, 168, 0.05);
}

.data-table tbody td {
    padding: 8px;
    font-size: 12px;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.data-table tbody td.table-actions {
    max-width: none;
    overflow: visible;
    white-space: normal;
    padding: 6px 4px;
}

.table-actions {
    display: flex;
    gap: 3px;
    flex-wrap: wrap;
    min-width: 220px;
    max-width: none !important;
    overflow: visible !important;
    white-space: normal !important;
}

.btn-action {
    padding: 4px 8px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-edit,
.btn-delete,
.btn-pdf,
.btn-fotocheck,
.btn-files,
.btn-accept,
.btn-reject,
.btn-trash {
    padding: 5px 7px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s ease;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    min-height: 28px;
}

.btn-edit {
    background: var(--azul);
    color: white;
}

.btn-edit:hover {
    background: var(--azul-oscuro);
}

.btn-delete {
    background: #b71c1c;
    color: white;
}

.btn-delete:hover {
    background: #8e1414;
}

.btn-pdf {
    background: var(--naranja);
    color: white;
    font-size: 10px;
    font-weight: 700;
}

.btn-pdf:hover {
    background: var(--naranja-claro);
}

.btn-files {
    background: var(--amarillo);
    color: var(--gris-oscuro);
}

.btn-files:hover {
    background: #e6c030;
}

.btn-fotocheck {
    background: var(--celeste);
    color: white;
    font-size: 10px;
    font-weight: 700;
}

.btn-fotocheck:hover {
    background: var(--azul);
}

.btn-accept {
    background: #1b7e20;
    color: white;
}

.btn-accept:hover {
    background: #145e18;
}

.btn-reject {
    background: #b71c1c;
    color: white;
}

.btn-reject:hover {
    background: #8e1414;
}

.btn-trash {
    background: #4b636e;
    color: white;
}

.btn-trash:hover {
    background: #37474f;
}

/* Status badges */
.badge {
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: bold;
    text-transform: uppercase;
    white-space: nowrap;
}

.badge-aceptado {
    background: #1b7e20;
    color: #fff;
}

.badge-rechazado {
    background: #b71c1c;
    color: #fff;
}

.badge-pendiente {
    background: #e67e00;
    color: #fff;
}

.badge-tipo {
    background: rgba(59, 127, 168, 0.1);
    color: var(--azul-oscuro);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: bold;
}

/* ==========================================
   MODAL
   ========================================== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    animation: fadeIn 0.3s ease;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--blanco);
    border-radius: 10px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideIn 0.3s ease;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    background: linear-gradient(135deg, var(--azul-oscuro) 0%, var(--azul) 100%);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 10px 10px 0 0;
}

.modal-header h2 {
    font-size: 18px;
}

.close-modal {
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
}

.modal-body {
    padding: 20px;
}

.modal-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn-save,
.btn-cancel {
    padding: 8px 20px;
    border: none;
    border-radius: 5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 13px;
}

.btn-save {
    background: var(--naranja);
    color: white;
}

.btn-save:hover {
    background: var(--naranja-claro);
}

.btn-cancel {
    background: var(--gris-medio);
    color: white;
}

.btn-cancel:hover {
    background: var(--gris-oscuro);
}

/* ==========================================
   LOGIN
   ========================================== */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-box {
    background: var(--blanco);
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(24, 94, 131, 0.2);
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    color: var(--azul-oscuro);
    margin-bottom: 30px;
    text-align: center;
    font-size: 24px;
}

.login-box .form-group {
    margin-bottom: 20px;
}

.login-box input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
}

.login-box input:focus {
    border-color: var(--azul);
    outline: none;
}

.login-box button {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, var(--naranja) 0%, var(--naranja-claro) 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.login-box button:hover {
    background: linear-gradient(135deg, var(--naranja-claro) 0%, var(--naranja) 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(237, 107, 55, 0.4);
}

/* ==========================================
   GALERIA DE FOTOS
   ========================================== */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 15px;
}

.gallery-card {
    background: var(--blanco);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.gallery-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.gallery-card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

/* Badge de estado en gallery card */
.gallery-card-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    z-index: 2;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.gallery-card-badge.badge-aceptado {
    background: #1b7e20;
    color: #fff;
}
.gallery-card-badge.badge-pendiente {
    background: #e67e00;
    color: #fff;
}
.gallery-card-badge.badge-rechazado {
    background: #b71c1c;
    color: #fff;
}

.gallery-card .gallery-info {
    padding: 10px;
    text-align: center;
}

.gallery-card .gallery-info h4 {
    font-size: 12px;
    color: var(--gris-oscuro);
    margin-bottom: 3px;
}

.gallery-card .gallery-info p {
    font-size: 11px;
    color: var(--gris-medio);
}

.gallery-card .gallery-date {
    display: block;
    font-size: 10px;
    color: #aaa;
    margin-top: 4px;
}

/* Gallery filter bar (contador + limpiar) */
.gallery-filter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    padding: 8px 14px;
    background: #f7f9fc;
    border-radius: 8px;
    border: 1px solid #eef1f6;
}

.gallery-count {
    font-size: 13px;
    font-weight: 600;
    color: var(--azul-oscuro);
}

.btn-clear-filters {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 6px;
    font-size: 12px;
    color: var(--gris-medio);
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn-clear-filters:hover {
    border-color: #f44336;
    color: #f44336;
    background: #fff5f5;
}

/* ===== ROLES & USUARIOS ===== */

/* Badge de rol en el header */
.user-role-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.user-role-badge.role-administrador {
    background: #1b7e20;
    color: #fff;
    border: 1px solid #15691a;
}
.user-role-badge.role-supervisor {
    background: #0d5baa;
    color: #fff;
    border: 1px solid #094a8c;
}
.user-role-badge.role-jefe {
    background: #d84e00;
    color: #fff;
    border: 1px solid #b84300;
}
.user-role-badge.role-basico {
    background: #555;
    color: #fff;
    border: 1px solid #444;
}

/* Tag de rol en tabla de usuarios */
.user-role-tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}
.user-role-tag.role-administrador {
    background: #1b7e20;
    color: #fff;
}
.user-role-tag.role-supervisor {
    background: #0d5baa;
    color: #fff;
}
.user-role-tag.role-jefe {
    background: #d84e00;
    color: #fff;
}
.user-role-tag.role-basico {
    background: #555;
    color: #fff;
}

/* Selector de roles (cards) en modal */
.roles-selector {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
}

.role-option {
    cursor: pointer;
    display: block;
}

.role-option input[type="radio"] {
    display: none;
}

.role-option .role-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border: 2px solid #e8e8e8;
    border-radius: 10px;
    background: #fafafa;
    transition: all 0.2s ease;
}

.role-option:hover .role-card {
    border-color: #ccc;
    background: #f5f5f5;
}

.role-option input[type="radio"]:checked + .role-card {
    border-color: var(--azul);
    background: #f0f7ff;
    box-shadow: 0 0 0 1px var(--azul);
}

.role-option .role-icon {
    font-size: 22px;
    flex-shrink: 0;
    margin-top: 1px;
}

.role-option .role-card strong {
    display: block;
    font-size: 13px;
    color: var(--azul-oscuro);
    margin-bottom: 2px;
}

.role-option .role-card small {
    display: block;
    font-size: 11px;
    color: #888;
    line-height: 1.4;
}

/* Color accent per role when selected */
.role-opt-admin input:checked + .role-card {
    border-color: #1b7e20;
    background: #e8f5e9;
    box-shadow: 0 0 0 1px #1b7e20;
}
.role-opt-admin input:checked + .role-card strong { color: #1b7e20; }

.role-opt-supervisor input:checked + .role-card {
    border-color: #0d5baa;
    background: #e1f0fc;
    box-shadow: 0 0 0 1px #0d5baa;
}
.role-opt-supervisor input:checked + .role-card strong { color: #0d5baa; }

.role-opt-jefe input:checked + .role-card {
    border-color: #d84e00;
    background: #fff0e0;
    box-shadow: 0 0 0 1px #d84e00;
}
.role-opt-jefe input:checked + .role-card strong { color: #d84e00; }

.role-opt-basico input:checked + .role-card {
    border-color: #555;
    background: #f0f0f0;
    box-shadow: 0 0 0 1px #555;
}
.role-opt-basico input:checked + .role-card strong { color: #555; }

/* ========== PERSON DETAIL OVERLAY (galería) ========== */
.person-overlay {
    display: none;
    position: fixed;
    z-index: 1000;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    justify-content: center;
    align-items: center;
}
.person-overlay.show { display: flex; }

/* Card horizontal: imagen izquierda · datos derecha */
.person-detail-card {
    display: flex;
    flex-direction: row;
    width: min(96vw, 1060px);
    max-height: 90vh;
    border-radius: 16px;
    overflow: hidden;
    animation: slideIn 0.3s ease;
    box-shadow: 0 20px 70px rgba(0, 0, 0, 0.45);
}

/* ---------- Columna izquierda: foto ---------- */
.pd-photo-col {
    width: 500px;
    flex-shrink: 0;
    background: linear-gradient(155deg, var(--azul-oscuro) 0%, var(--azul) 100%);
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 24px;
    text-align: center;
}
.pd-photo-col img {
    width: 450px;
    height: 450px;
    border-radius: 12px;
    object-fit: cover;
    border: 4px solid rgba(255, 255, 255, 0.85);
    cursor: zoom-in;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    flex-shrink: 0;
}
.pd-photo-col img:hover {
    transform: scale(1.02);
    box-shadow: 0 0 0 7px rgba(255, 255, 255, 0.22);
}
.pd-photo-info h2 {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.35;
    margin: 0 0 4px;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}
.pd-photo-info p {
    font-size: 12.5px;
    opacity: 0.88;
    margin: 0;
}

/* ---------- Columna derecha: datos ---------- */
.pd-info-col {
    flex: 1;
    background: white;
    padding: 18px 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow: hidden;
    position: relative;
    min-width: 0;
}
.pd-close-btn {
    position: absolute;
    top: 10px;
    right: 12px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #888;
    line-height: 1;
    padding: 2px 7px;
    border-radius: 5px;
    transition: background 0.15s, color 0.15s;
}
.pd-close-btn:hover { background: #f2f2f2; color: #111; }

.pd-info-titulo {
    display: block;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--naranja);
    padding-top: 4px;
    padding-right: 40px;
}

/* Grid 2 columnas para los 19 campos */
.pd-body-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 10px;
    overflow: hidden;
}
.pd-body-grid .detail-row {
    display: flex;
    flex-direction: column;
    padding: 5px 4px;
    border-bottom: 1px solid #f0f0f0;
    min-width: 0;
}
.pd-body-grid .detail-row .label {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #aaa;
    white-space: nowrap;
}
.pd-body-grid .detail-row .value {
    font-size: 12.5px;
    font-weight: 500;
    color: #1a1a1a;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Responsive: pantallas < 1100px */
@media (max-width: 1100px) {
    .pd-photo-col { width: 360px; }
    .pd-photo-col img { width: 310px; height: 310px; }
}
/* Responsive: tablets/móvil — apila verticalmente */
@media (max-width: 820px) {
    .person-detail-card {
        flex-direction: column;
        width: 95vw;
        max-height: 92vh;
        overflow-y: auto;
    }
    .pd-photo-col {
        width: 100%;
        padding: 20px;
        flex-direction: row;
        gap: 16px;
        justify-content: flex-start;
    }
    .pd-photo-col img { width: 110px; height: 110px; flex-shrink: 0; }
}

/* ==========================================
   ESTADISTICAS / CHARTS
   ========================================== */
/* Filtros de estadísticas */
.stats-filters-bar {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
    padding: 14px 18px;
    background: var(--blanco);
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    margin-bottom: 15px;
    border-left: 4px solid var(--naranja);
}

.stats-filters-bar .filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 130px;
}

.stats-filters-bar .filter-group label {
    font-size: 11px;
    font-weight: 600;
    color: var(--gris-medio);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stats-filters-bar .filter-group select {
    padding: 7px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
    color: var(--azul-oscuro);
    background: #f8f9fa;
    cursor: pointer;
    transition: border 0.2s;
}

.stats-filters-bar .filter-group select:focus {
    border-color: var(--naranja);
    outline: none;
}

.btn-clear-stat-filters {
    padding: 7px 16px;
    background: var(--azul-oscuro);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}

.btn-clear-stat-filters:hover {
    background: var(--naranja);
}

/* Gráficos */
.chart-container {
    background: var(--blanco);
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    margin-bottom: 0;
    position: relative;
    overflow: hidden;
}

/* Wrapper con altura fija para Chart.js */
.chart-canvas-wrap {
    position: relative;
    height: 250px;
    width: 100%;
}

.chart-canvas-wrap.chart-wrap-square {
    height: 260px;
}

.chart-container canvas {
    max-height: 100%;
}

.chart-container h3 {
    color: var(--azul-oscuro);
    margin-bottom: 15px;
    font-size: 15px;
    border-bottom: 2px solid var(--naranja);
    padding-bottom: 8px;
}

.chart-wide {
    grid-column: 1 / -1;
    min-height: auto;
}

.chart-wide .chart-canvas-wrap {
    height: 220px;
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 15px;
}

/* Simple bar chart */
.bar-chart {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bar-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.bar-label {
    width: 120px;
    font-size: 12px;
    font-weight: 600;
    color: var(--gris-oscuro);
    text-align: right;
    flex-shrink: 0;
}

.bar-track {
    flex: 1;
    height: 24px;
    background: #f0f0f0;
    border-radius: 12px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    border-radius: 12px;
    background: linear-gradient(90deg, var(--azul) 0%, var(--celeste) 100%);
    transition: width 0.8s ease;
    display: flex;
    align-items: center;
    padding-left: 10px;
    color: white;
    font-size: 11px;
    font-weight: bold;
    min-width: fit-content;
}

/* ==========================================
   FOTOCHECK GENERATOR
   ========================================== */
.fotocheck-preview {
    width: 340px;
    height: 215px;
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    margin: 0 auto;
}

.fotocheck-preview .fotocheck-bg {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
}

.fotocheck-preview .fotocheck-photo {
    position: absolute;
    width: 80px;
    height: 100px;
    object-fit: cover;
    border: 2px solid white;
    border-radius: 5px;
}

.fotocheck-preview .fotocheck-text {
    position: absolute;
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
    font-weight: bold;
}

/* Section title for modal grouping */
.section-title-modal {
    color: var(--azul-oscuro);
    margin: 20px 0 12px;
    border-bottom: 2px solid var(--naranja);
    padding-bottom: 8px;
    font-size: 15px;
}

.section-title-modal:first-of-type {
    margin-top: 0;
}

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 768px) {
    .container { margin: 12px; border-radius: 16px; }
    .header-content { flex-direction: column; text-align: center; padding: 24px 20px 16px; gap: 14px; }
    .header-text { text-align: center; }
    .header h1 { font-size: 18px; }
    .header .logo { width: 65px; height: 65px; }
    .progress-bar { padding: 20px 16px 14px; }
    .progress-track { left: 40px; right: 40px; top: 38px; }
    .step-circle { width: 36px; height: 36px; font-size: 13px; }
    .step-label { font-size: 9px; }
    form { padding: 20px; }
    .page-header h2 { font-size: 18px; }
    .page-icon { width: 44px; height: 44px; border-radius: 12px; }
    .form-buttons { flex-direction: column; }
    .btn-prev, .btn-next, .btn-submit { width: 100%; justify-content: center; }
    .radio-group { flex-direction: column; }
    .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
    .fichas-grid { grid-template-columns: 1fr; }

    .admin-header { flex-direction: column; gap: 10px; text-align: center; }
    .admin-layout { flex-direction: column; }
    .admin-sidebar { width: 100%; min-width: 100%; position: static; }
    .sidebar-nav { display: flex; overflow-x: auto; }
    .sidebar-nav li a { white-space: nowrap; padding: 10px 15px; border-left: none; border-bottom: 3px solid transparent; }
    .sidebar-nav li a:hover, .sidebar-nav li a.active { border-left-color: transparent; border-bottom-color: var(--naranja); }
    .filters-grid { grid-template-columns: 1fr; }
    .table-container { overflow-x: auto; }
    .modal-content { width: 95%; margin: 10px; }
    .modal-form-grid { grid-template-columns: 1fr; }
    .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
    .charts-grid { grid-template-columns: 1fr; }
    .chart-wide { grid-column: auto; }
    .stats-filters-bar { flex-direction: column; align-items: stretch; }
    .stats-filters-bar .filter-group { min-width: auto; }
    .files-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .header-content { padding: 18px 16px 12px; }
    .header .logo { width: 55px; height: 55px; padding: 8px; }
    .header h1 { font-size: 16px; }
    .step-circle { width: 32px; height: 32px; font-size: 12px; }
    .step-label { display: none; }
    .form-group input, .form-group select { font-size: 16px; }
    .page-header { flex-direction: column; text-align: center; }
    .toast { min-width: unset; max-width: calc(100vw - 40px); }
}

/* ==========================================
   LOADING SPINNER
   ========================================== */
.loading {
    display: none; position: fixed; top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(4px);
    z-index: 9999; justify-content: center; align-items: center;
}

.loading.show { display: flex; }

.loading-content { text-align: center; }
.loading-content p { margin-top: 16px; color: var(--gris-medio); font-weight: 600; font-size: 14px; }

.spinner {
    width: 48px; height: 48px;
    border: 4px solid #e8e4e0;
    border-top: 4px solid var(--naranja);
    border-right: 4px solid var(--azul);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* ==========================================
   ALERTAS (legacy compat)
   ========================================== */
.alert {
    padding: 12px 18px; border-radius: 10px;
    margin-bottom: 15px; font-weight: 600; font-size: 13px;
}

.alert-success { background: #e8f5e9; color: #145e18; border-left: 4px solid #1b7e20; }
.alert-error { background: #ffebee; color: #8e1414; border-left: 4px solid #b71c1c; }
.alert-warning { background: #fff3d2; color: #a06300; border-left: 4px solid #e67e00; }
.alert-info { background: #e3f2fd; color: var(--azul-oscuro); border-left: 4px solid var(--celeste); }

/* View tabs for admin sections */
.view-section {
    display: none;
}

.view-section.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-top: 15px;
    padding: 10px;
}

.pagination button {
    padding: 6px 12px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.pagination button:hover,
.pagination button.active {
    background: var(--azul);
    color: white;
    border-color: var(--azul);
}

/* ==========================================
   NOTIFICACIONES
   ========================================== */
.notif-bell {
    position: relative;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.2s;
    line-height: 1;
}
.notif-bell:hover {
    background: rgba(255,255,255,0.15);
}
.notif-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #b71c1c;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 17px;
    height: 17px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    line-height: 1;
    border: 2px solid var(--azul-oscuro);
    font-family: system-ui, sans-serif;
}
.sidebar-badge {
    background: #b71c1c;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    margin-left: 6px;
    line-height: 1;
}

/* Vista de notificaciones */
.notif-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    background: #fff;
    border-radius: 10px;
    margin-bottom: 15px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.notif-header h3 {
    margin: 0;
    font-size: 18px;
    color: var(--azul-oscuro);
}
.btn-mark-all {
    background: #0d5baa;
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-mark-all:hover {
    background: #094a8a;
}

/* Tarjeta de notificación */
.notif-card {
    display: flex;
    gap: 14px;
    padding: 16px 20px;
    background: #fff;
    border-radius: 10px;
    margin-bottom: 10px;
    border-left: 4px solid #ddd;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    transition: all 0.2s;
    cursor: default;
}
.notif-card:hover {
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}
.notif-card.unread {
    background: #edf5ff;
    border-left-color: #0d5baa;
    cursor: pointer;
}
.notif-card.unread:hover {
    background: #e0eefa;
}
.notif-icon {
    font-size: 28px;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.notif-body {
    flex: 1;
    min-width: 0;
}
.notif-title {
    font-weight: 700;
    font-size: 14px;
    color: #1a1a2e;
    margin-bottom: 4px;
}
.notif-msg {
    font-size: 13px;
    color: #555;
    margin-bottom: 8px;
}
.notif-personas {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}
.notif-persona {
    background: #f0f4f8;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    color: #333;
    border: 1px solid #e0e6ed;
}
.notif-persona small {
    color: #888;
}
.notif-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
}
.notif-date {
    color: #888;
}
.notif-read-tag {
    color: #1b7e20;
    font-weight: 600;
    font-size: 11px;
}
.notif-mark-btn {
    background: none;
    border: 1px solid #0d5baa;
    color: #0d5baa;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}
.notif-mark-btn:hover {
    background: #0d5baa;
    color: #fff;
}
.notif-empty {
    text-align: center;
    padding: 40px 20px;
    color: #999;
    font-size: 14px;
    background: #fff;
    border-radius: 10px;
}

/* Responsive notificaciones */
@media (max-width: 768px) {
    .notif-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    .notif-card {
        padding: 12px 14px;
    }
    .notif-personas {
        flex-direction: column;
    }
}

/* ==========================================
   AUTOCOMPLETADO
   ========================================== */
.autocomplete-wrapper {
    position: relative;
}
.autocomplete-list {
    display: none;
    position: fixed;
    background: #fff;
    border: 1px solid #d0d5dd;
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 9999;
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}
.autocomplete-item {
    padding: 9px 14px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid #f0f0f0;
}
.autocomplete-item:last-child {
    border-bottom: none;
}
.autocomplete-item:hover,
.autocomplete-item.active {
    background: #edf5ff;
    color: #0d5baa;
}

/* Sección rápida en formulario */
.quick-select-section {
    background: #f0f7ff;
    border: 1px solid #c8ddf0;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}
.quick-select-section .form-grid-2 {
    margin-top: 12px;
}

/* ==========================================
   GESTOR DE CONFIGURACIÓN (DASHBOARD)
   ========================================== */
.config-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.config-section {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    overflow: hidden;
}
.config-section-header {
    padding: 18px 20px;
    border-bottom: 1px solid #eee;
}
.config-section-header h3 {
    margin: 0 0 12px 0;
    font-size: 16px;
    color: var(--azul-oscuro);
}
.config-add-form {
    display: flex;
    gap: 8px;
}
.config-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    font-size: 13px;
    transition: border-color 0.2s;
}
.config-input:focus {
    outline: none;
    border-color: var(--azul);
    box-shadow: 0 0 0 2px rgba(13,91,170,0.12);
}
.btn-config-add {
    background: #0d5baa;
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
}
.btn-config-add:hover {
    background: #094a8a;
}
.config-table {
    font-size: 13px;
}
.config-table td {
    padding: 8px 12px;
    vertical-align: middle;
}
.config-edit-input {
    width: 100%;
    padding: 5px 8px;
    border: 1px solid #0d5baa;
    border-radius: 4px;
    font-size: 13px;
    box-sizing: border-box;
}

@media (max-width: 900px) {
    .config-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================
   BANNER DE AVISO DE COMPRESIÓN DE DOCUMENTOS
   ========================================== */
.compress-warn-banner {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    padding: 6px 10px;
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 6px;
    font-size: 0.78rem;
    color: #92400e;
    line-height: 1.3;
}

.compress-warn-banner--done {
    background: #d1fae5;
    border-color: #10b981;
    color: #064e3b;
}

.compress-warn-banner svg {
    flex-shrink: 0;
}

/* ==========================================
   LIGHTBOX - MAXIMIZAR IMAGEN
   ========================================== */
#imgLightbox {
    display: none;
    position: fixed;
    z-index: 9999;
    inset: 0;
    background: rgba(0, 0, 0, 0.93);
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
    animation: fadeIn 0.2s ease;
}
#imgLightbox.show {
    display: flex;
}
#imgLightbox img {
    max-width: 92vw;
    max-height: 92vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 0 80px rgba(0, 0, 0, 0.7);
    cursor: default;
    user-select: none;
}
.lightbox-close-btn {
    position: fixed;
    top: 14px;
    right: 18px;
    font-size: 1.9rem;
    color: white;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    line-height: 1;
    z-index: 10000;
}
.lightbox-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}
.lightbox-hint {
    position: fixed;
    bottom: 18px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.78rem;
    letter-spacing: 0.03em;
    pointer-events: none;
}

/* Botón maximizar en paneles fotocheck / DNI */
.file-panel .btn-maximize {
    background: linear-gradient(135deg, #0d5baa, #1185c2);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 0.78rem;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.15s;
    white-space: nowrap;
}
.file-panel .btn-maximize:hover {
    opacity: 0.88;
    transform: translateY(-1px);
}

/* Preview fotocheck y DNI: mayor altura para identificación */
#fotocheck_preview,
#dni_preview {
    height: 230px !important;
}
#fotocheck_preview img,
#dni_preview img {
    cursor: zoom-in;
    transition: transform 0.2s ease;
}
#fotocheck_preview img:hover,
#dni_preview img:hover {
    transform: scale(1.02);
}
