:root {
    /* MODO CLARO (Default) */
    --primary: #002D62;
    --primary-light: #004a9e;
    --secondary: #2d3748;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --bg-admin: #f0f2f5;
    --sidebar-bg: #1a202c;
    --card-bg-admin: #ffffff;
    --text-main-admin: #2d3748;
    --text-gray: #718096;
    --glass-bg: rgba(255, 255, 255, 0.9);
    --border-admin: #edf2f7;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
    /* MODO OSCURO (Elegant) */
    --primary: #63b3ed;
    --primary-light: #90cdf4;
    --secondary: #e2e8f0;
    --bg-admin: #0f172a;
    --sidebar-bg: #1e293b;
    --card-bg-admin: #1e293b;
    --text-main-admin: #f7fafc;
    --text-gray: #a0aec0;
    --glass-bg: rgba(30, 41, 59, 0.9);
    --border-admin: rgba(255, 255, 255, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
    transition: background 0.3s ease, color 0.3s ease;
}

.admin-body {
    background: var(--bg-admin);
    color: var(--text-main-admin);
    min-height: 100vh;
    overflow-x: hidden;
}

.admin-body.is-logged-in {
    background: var(--bg-admin);
}

/* Cinematic Login Screen */
.admin-login-screen {
    height: 100vh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 9999;
    overflow: hidden;
    background: #000;
    transition: opacity 0.5s ease, visibility 0.5s;
}

.admin-login-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.login-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('https://images.unsplash.com/photo-1541849546-216549ae216d?q=80&w=2070&auto=format&fit=crop') center/cover no-repeat;
    filter: brightness(0.4) saturate(1.2);
    transform: scale(1.1);
    animation: slowZoom 40s infinite alternate;
}

@keyframes slowZoom {
    from {
        transform: scale(1);
    }

    to {
        transform: scale(1.15);
    }
}

.login-box { position: relative; z-index: 10; transform: translateZ(0);
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 440px;
    padding: 50px;
    border-radius: 35px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 50px 100px -20px rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(20px) saturate(180%);
    background: rgba(255, 255, 255, 0.08);
}

.institutional-badge {
    background: white;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.institutional-badge img {
    height: 55px;
}

.login-header h2 { text-align: center; white-space: nowrap; width: 100%; display: block;
    color: white;
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 5px;
}

.login-header p {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
    margin-bottom: 30px;
}

.input-modern-admin {
    margin-bottom: 25px;
}

.input-modern-admin label {
    display: block;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.input-modern-admin label i {
    margin-right: 8px;
    color: var(--primary-light);
}

.input-modern-admin input {
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 14px 18px;
    border-radius: 15px;
    color: white;
    font-size: 1rem;
    outline: none;
    transition: 0.3s;
}

.input-modern-admin input:focus {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--primary-light);
    box-shadow: 0 0 15px rgba(144, 205, 244, 0.2);
}

.btn-login-premium {
    width: 100%;
    background: linear-gradient(135deg, #2b6cb0, #002D62);
    color: white;
    padding: 16px;
    border-radius: 15px;
    border: none;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 10px 20px rgba(0, 45, 98, 0.3);
}

.btn-login-premium:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 30px rgba(0, 45, 98, 0.5);
    background: linear-gradient(135deg, #3182ce, #002D62);
}

.login-footer {
    margin-top: 30px;
    text-align: center;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.75rem;
}

.error-msg-modern {
    background: rgba(239, 68, 68, 0.15);
    color: #feb2b2;
    padding: 12px;
    border-radius: 10px;
    margin-top: 20px;
    font-size: 0.85rem;
    text-align: center;
    display: none;
}

/* Layout Dashboard */
.admin-dashboard-layout {
    display: grid;
    grid-template-columns: auto 1fr;
    height: 100vh;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Sidebar */
.sidebar {
    background: var(--sidebar-bg);
    color: white;
    display: flex;
    flex-direction: column;
    padding: 0;
    width: 280px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 100;
}

.sidebar.collapsed {
    width: 85px;
}

.sidebar-header {
    background: var(--card-bg-admin);
    padding: 0 20px;
    height: 115px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid var(--border-admin);
    box-shadow: var(--shadow-sm);
    z-index: 10;
    position: relative;
}

.logo-container-admin {
    display: flex;
    align-items: center;
    gap: 12px;
    transition: 0.3s;
    width: 100%;
    /* overflow: hidden; removed so logo can overflow when collapsed */
}

.admin-sidebar-logo {
    height: 95px; /* Made much larger for readability */
    width: 100%;
    object-fit: contain;
    object-position: left center;
    transition: all 0.3s ease;
}

.logo-text {
    font-size: 1.1rem;
    white-space: nowrap;
    transition: 0.3s;
    display: none;
}

.sidebar.collapsed .logo-text {
    opacity: 0;
    pointer-events: none;
    width: 0;
}

.sidebar.collapsed .sidebar-header {
    justify-content: flex-start;
}

.sidebar.collapsed .logo-container-admin {
    position: absolute;
    left: 70px; /* After padding + button + gap */
    width: 300px; /* Fixed wide width to prevent any shrinking */
}

.btn-toggle-sidebar {
    background: var(--primary);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s;
}

.btn-toggle-sidebar:hover {
    background: var(--primary-light);
}

.sidebar.collapsed .btn-toggle-sidebar i {
    transform: rotate(180deg);
}

.sidebar-nav {
    flex: 1;
}

.nav-item {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-gray);
    padding: 15px 25px;
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: 0.3s;
    text-align: left;
    overflow: hidden;
}

.nav-item i {
    font-size: 1.2rem;
    min-width: 25px;
    text-align: center;
}

.nav-item span {
    white-space: nowrap;
    transition: 0.3s;
}

.sidebar.collapsed .nav-item {
    padding: 15px 30px;
}

.sidebar.collapsed .nav-item span {
    opacity: 0;
    width: 0;
    pointer-events: none;
}

.nav-item:hover,
.nav-item.active {
    color: white;
    background: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
    border-left: 4px solid var(--primary-light);
    color: white;
    background: rgba(0, 45, 98, 0.2);
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    overflow: hidden;
}

.btn-logout {
    width: 100%;
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
    padding: 12px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    transition: 0.3s;
}

.btn-logout i {
    font-size: 1.1rem;
    min-width: 25px;
}

.btn-logout span {
    white-space: nowrap;
    transition: 0.3s;
}

.sidebar.collapsed .btn-logout {
    padding: 12px 25px;
}

.sidebar.collapsed .btn-logout span {
    opacity: 0;
    width: 0;
    pointer-events: none;
}

.btn-logout:hover {
    background: var(--danger);
    color: white;
}

/* Content Area */
.dashboard-content {
    background: var(--bg-admin);
    position: relative;
    overflow-y: auto;
}

.dashboard-watermark {
    position: fixed;
    top: 50%;
    left: 55%;
    transform: translate(-50%, -50%);
    width: 500px;
    opacity: 0.03;
    pointer-events: none;
    z-index: 0;
}

.dashboard-watermark img {
    width: 100%;
    filter: grayscale(1);
}

.content-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--card-bg-admin);
    padding: 0 40px;
    height: 115px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
    border-bottom: 1px solid var(--border-admin);
}

.content-header h2 {
    transition: margin-left 0.4s ease;
}

/* Evitar solapamiento con el logo cuando está minimizado */
.admin-dashboard-layout:has(.sidebar.collapsed) .content-header h2 {
    margin-left: 280px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.avatar {
    width: 40px;
    height: 40px;
    background: var(--bg-admin);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
}

.dashboard-view {
    display: none;
    padding: 40px;
    animation: fadeIn 0.4s ease;
}

.dashboard-view.active {
    display: block;
}

/* Stats Grid Premium */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    margin-bottom: 40px;
}

.stat-card {
    position: relative;
    padding: 35px;
    border-radius: 24px;
    background: var(--card-bg-admin);
    border: 1px solid var(--border-admin);
    display: flex;
    align-items: center;
    gap: 25px;
    overflow: hidden;
    transition: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: var(--shadow-sm);
}

.stat-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
    border-color: var(--primary-light);
}

.stat-card::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 150px;
    height: 150px;
    background: var(--primary);
    opacity: 0.03;
    border-radius: 50%;
    transition: 0.4s;
}

.stat-card:hover::after {
    opacity: 0.06;
    transform: scale(1.2);
}

.stat-card i {
    font-size: 2.2rem;
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 45, 98, 0.05);
    color: var(--primary);
    border-radius: 20px;
    transition: 0.4s;
}

.stat-card:hover i {
    background: var(--primary);
    color: white;
}

.stat-card .label {
    display: block;
    color: var(--text-gray);
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card h3 {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-main-admin);
    letter-spacing: -1px;
}

/* Charts Analytics Area */
.analytics-row {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 30px;
}

.chart-container {
    background: var(--card-bg-admin);
    border-radius: 30px;
    padding: 35px;
    border: 1px solid var(--border-admin);
    box-shadow: var(--shadow-sm);
    min-height: 480px;
    display: flex;
    flex-direction: column;
}

.chart-container h4 {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 30px;
}

.chart-container h4 i {
    color: var(--primary-light);
}

.chart-canvas-wrapper {
    flex: 1;
    position: relative;
    height: 100%;
    width: 100%;
    min-height: 350px;
}
.table-container {
    margin-top: 30px;
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    padding: 15px 20px;
    text-align: left;
    border-bottom: 1px solid #edf2f7;
}

.admin-table th {
    background: #f8fafc;
    color: var(--text-gray);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
}

.admin-table tbody tr:hover {
    background: #f8fafc;
}

/* Badges */
.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-admin {
    background: #fee2e2;
    color: #991b1b;
}

.badge-oficial {
    background: #e0f2fe;
    color: #075985;
}

/* Buttons General */
.btn-primary-admin {
    background: var(--primary);
    color: white;
}

.btn-primary-admin:hover {
    background: var(--primary-light);
}

.btn-success-admin {
    background: linear-gradient(135deg, #e53e3e 0%, #b9101b 100%);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 12px 24px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 10px 20px -5px rgba(185, 16, 27, 0.4);
}

.btn-success-admin:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 15px 30px -8px rgba(185, 16, 27, 0.6);
}

box-shadow: 0 15px 30px -8px rgba(16, 185, 129, 0.6);
}

.btn-success-admin i {
    font-size: 1.1rem;
}

.btn-action {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    margin-right: 10px;
}

.btn-delete {
    color: var(--danger);
}

.btn-edit {
    color: var(--primary);
}

/* Modals */
.admin-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.admin-modal.active {
    display: flex;
}

.modal-content {
    width: 100%;
    max-width: 500px;
    background: var(--card-bg-admin);
    border-radius: 28px;
    border: 1px solid var(--border-admin);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.modal-wide {
    max-width: 950px;
    padding: 0;
    overflow: hidden;
    border-radius: 30px;
}

.modal-flex {
    display: flex;
    min-height: 550px;
}

.modal-form-side {
    flex: 1.3;
    padding: 50px;
    background: var(--card-bg-admin);
}

.modal-form-side h2 {
    font-size: 1.5rem;
    margin-bottom: 30px;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-preview-side {
    flex: 0.7;
    padding: 50px;
    background: #f8fafc;
    border-left: 1px solid var(--border-admin);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

[data-theme="dark"] .modal-preview-side {
    background: rgba(0, 0, 0, 0.2);
}

/* Modern Form Fields */
.input-field {
    margin-bottom: 25px;
}

.input-field label {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-gray);
    margin-bottom: 10px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper i {
    position: absolute;
    left: 18px;
    color: var(--primary);
    opacity: 0.6;
    font-size: 1.1rem;
}

.input-wrapper input {
    width: 100%;
    padding: 14px 18px 14px 45px;
    border: 1.5px solid var(--border-admin);
    border-radius: 14px;
    font-size: 1rem;
    background: var(--bg-admin);
    color: var(--text-main-admin);
    transition: all 0.3s ease;
}

.input-wrapper input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--card-bg-admin);
    box-shadow: 0 0 0 4px rgba(0, 45, 98, 0.08);
}

.input-row-modern {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* Icon Selection Modern */
.icon-quick-select-modern {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 10px;
    margin-top: 15px;
}

.icon-quick-select-modern span {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--border-admin);
    border-radius: 12px;
    cursor: pointer;
    transition: 0.3s;
    color: var(--primary);
}

.icon-quick-select-modern span:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-3px);
}

/* Modal Actions */
.modal-actions-modern {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    margin-top: 35px;
    padding-top: 20px;
    border-top: 1px solid var(--border-admin);
}

.btn-save-modern {
    background: var(--primary);
    color: white;
    padding: 14px 28px;
    border-radius: 14px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: 0.3s;
}

.btn-save-modern:hover {
    background: var(--primary-light);
    transform: translateY(-2px);
}

.btn-cancel-modern {
    background: transparent;
    color: var(--text-gray);
    border: 1px solid var(--border-admin);
    padding: 14px 28px;
    border-radius: 14px;
    font-weight: 600;
    cursor: pointer;
}

.btn-cancel-modern:hover {
    background: var(--bg-admin);
    color: var(--danger);
}

/* Preview Card Admin */
.service-card-preview-admin {
    background: var(--card-bg-admin);
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 300px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-admin);
    margin-bottom: 20px;
}

.preview-icon-admin {
    font-size: 2.2rem;
    color: var(--primary);
    margin-bottom: 20px;
    background: rgba(0, 45, 98, 0.05);
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
}

.preview-prices-admin {
    display: flex;
    flex-direction: column;
}

.preview-prices-admin strong {
    font-size: 1.5rem;
    color: var(--primary);
}

.preview-prices-admin small {
    color: var(--text-gray);
}

.preview-hint {
    font-size: 0.85rem;
    color: var(--text-gray);
    font-style: italic;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* --- Gestión de Usuarios --- */
.modal-narrow {
    max-width: 480px;
    padding: 45px;
}

.modal-narrow h2 {
    margin-bottom: 30px;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 15px;
}

.modal-narrow h2 i {
    font-size: 1.8rem;
    color: var(--primary-light);
}

.field-hint {
    display: block;
    font-size: 0.75rem;
    color: var(--text-gray);
    margin-top: 5px;
}

.user-row {
    animation: slideInLeft 0.3s ease forwards;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@media (max-width: 1024px) {
    .admin-dashboard-layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        display: none;
    }

    /* En producción esto sería un menú tipo burger */
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* --- Evoluci�n �lite V2 Styles --- */
.analytics-row {
    display: flex;
    gap: 25px;
    margin-top: 35px;
}

.chart-container {
    flex: 1;
    min-height: 400px;
    padding: 30px;
    background: var(--card-bg-admin);
    border-radius: 24px;
    border: 1px solid var(--border-admin);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

.chart-container h4 {
    margin-bottom: 25px;
    color: var(--primary);
    font-size: 1.1rem;
    font-weight: 700;
}

.view-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    gap: 20px;
}

.search-box-admin {
    position: relative;
    flex: 1;
    max-width: 500px;
}

.search-box-admin i {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-box-admin input {
    width: 100%;
    padding: 14px 20px 14px 50px;
    border-radius: 16px;
    border: 1.5px solid var(--border-admin);
    background: var(--bg-admin);
    color: var(--text-main-admin);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.search-box-admin input:focus {
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 4px rgba(0, 45, 98, 0.08);
    outline: none;
}

#login-official-seal {
    width: 130px;
    height: 130px;
    margin-bottom: 25px;
    filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.15));
}

.btn-success-admin {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    transition: transform 0.2s ease;
}

.btn-success-admin:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(39, 174, 96, 0.3);
}

.mt-8 {
    margin-top: 2rem;
}

.chart-container {
    height: 380px !important;
    max-height: 380px;
    overflow: hidden;
}

.nav-logo {
    height: 110px !important;
}

.official-badge-mini {
    left: 75px !important;
    bottom: -5px !important;
}

/* --- MODAL EXPEDIENTE (Elegante & Moderno) --- */
.modal-sidebar-info {
    flex: 0.8;
    background: linear-gradient(180deg, #002D62 0%, #001a3d 100%);
    color: white;
    padding: 40px;
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.expediente-badge-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.expediente-badge-header i {
    font-size: 2.2rem;
    color: #93c5fd; /* Bright, legible light blue */
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

.expediente-badge-header .label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #93c5fd;
}

.expediente-badge-header h2 {
    font-size: 1.4rem;
    font-weight: 700;
}

.info-group-modern label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #93c5fd; /* Bright, legible light blue */
    margin-bottom: 6px;
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5); /* Crisp dark shadow for contrast */
}

.info-group-modern p {
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.4;
}

.modal-main-body {
    flex: 1.2;
    padding: 40px;
    background: var(--card-bg-admin);
    display: flex;
    flex-direction: column;
    gap: 30px;
    position: relative;
    max-height: 85vh;
    overflow-y: auto;
}

.expediente-status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-admin);
}

.status-current .label {
    font-size: 0.8rem;
    color: var(--text-gray);
    margin-right: 10px;
}

.btn-close-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--bg-admin);
    color: var(--text-gray);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s;
}

.btn-close-circle:hover {
    background: var(--danger);
    color: white;
    transform: rotate(90deg);
}

.services-list-container h3,
.status-management-box h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 15px;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.exp-servs-grid {
    display: grid;
    gap: 12px;
    margin-bottom: 15px;
}

.exp-item-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    background: var(--bg-admin);
    border-radius: 12px;
    border: 1px solid var(--border-admin);
}

.exp-item-card span {
    font-weight: 600;
    font-size: 0.95rem;
}

.exp-total-row {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 15px;
    padding-top: 15px;
    border-top: 2px dashed var(--border-admin);
}

.exp-total-row strong {
    font-size: 1.3rem;
    color: var(--primary);
}

.comment-box {
    background: #fff9db;
    padding: 15px;
    border-radius: 12px;
    border-left: 4px solid #f1c40f;
    font-size: 0.95rem;
    color: #856404;
    line-height: 1.5;
}

[data-theme="dark"] .comment-box {
    background: rgba(241, 196, 15, 0.1);
    color: #f1c40f;
}

.status-options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    margin-top: 15px;
}

.status-opt {
    padding: 12px;
    border-radius: 12px;
    border: 1.5px solid var(--border-admin);
    background: var(--bg-admin);
    color: var(--text-main-admin);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.status-opt:hover {
    border-color: var(--primary);
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 45, 98, 0.2);
}

.status-opt.active-status {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    color: white !important;
}

/* Colores específicos por estado */
.active-PAGADO {
    background: #10b981 !important; /* Esmeralda */
    border-color: #059669 !important;
}

.active-REGISTRADO {
    background: #8b5cf6 !important; /* Violeta */
    border-color: #7c3aed !important;
}

.active-VERIFICACION {
    background: #f59e0b !important; /* Ámbar/Naranja */
    border-color: #d97706 !important;
}

.active-APROBADO {
    background: #22c55e !important; /* Verde brillante */
    border-color: #16a34a !important;
}

.active-TERMINADO {
    background: #3b82f6 !important; /* Azul brillante */
    border-color: #2563eb !important;
}

.active-RECHAZADO {
    background: #ef4444 !important; /* Rojo */
    border-color: #dc2626 !important;
}

.status-opt.active-status i {
    color: white !important;
}

.status-opt.opt-danger:hover {
    background: var(--danger);
    border-color: var(--danger);
    box-shadow: 0 5px 15px rgba(239, 68, 68, 0.2);
}

/* Status Badges Colors */
.badge-pagado { background: #dcfce7 !important; color: #166534 !important; }
.badge-registrado { background: #f1f5f9 !important; color: #475569 !important; }
.badge-verificacion { background: #fef9c3 !important; color: #854d0e !important; }
.badge-aprobado { background: #ecfdf5 !important; color: #065f46 !important; }
.badge-terminado { background: #e0e7ff !important; color: #3730a3 !important; }
.badge-rechazado { background: #fee2e2 !important; color: #991b1b !important; }

[data-theme="dark"] .badge-pagado { background: rgba(22, 101, 52, 0.2) !important; color: #4ade80 !important; }
[data-theme="dark"] .badge-registrado { background: rgba(71, 85, 105, 0.2) !important; color: #94a3b8 !important; }
[data-theme="dark"] .badge-verificacion { background: rgba(133, 77, 14, 0.2) !important; color: #fde047 !important; }
[data-theme="dark"] .badge-aprobado { background: rgba(6, 95, 70, 0.2) !important; color: #34d399 !important; }
[data-theme="dark"] .badge-terminado { background: rgba(55, 48, 163, 0.2) !important; color: #818cf8 !important; }
[data-theme="dark"] .badge-rechazado { background: rgba(153, 27, 27, 0.2) !important; color: #f87171 !important; }

/* --- ADMIN MODALS (Yesterday Style) --- */
.admin-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    opacity: 0;
    transition: all 0.3s ease;
}

.admin-modal.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: #fff;
    border-radius: 24px;
    width: 100%;
    max-width: 1000px;
    max-height: 90vh;
    overflow: hidden;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    display: block; /* Debe ser block, modal-flex maneja el layout interno */
    animation: modalScaleIn 0.3s ease-out;
}

.modal-content-mini {
    background: #fff;
    border-radius: 24px;
    width: 100%;
    max-width: 450px;
    max-height: 90vh;
    overflow: hidden;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    display: block; /* Vertical */
    animation: modalScaleIn 0.3s ease-out;
}

@keyframes modalScaleIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-flex {
    display: flex;
    width: 100%;
    height: 100%;
}

.modal-sidebar-info {
    width: 350px;
    background: #002D62;
    padding: 40px;
    color: white;
    overflow-y: auto;
}

.modal-main-body {
    flex: 1;
    display: flex;
    flex-direction: column; /* Cambiamos a columna para separar cabecera y cuerpo */
    background: #fff;
    position: relative;
    overflow: hidden; /* El scroll ahora está en modal-body-scroll */
}

.modal-body-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 0 40px 40px 40px;
}

.btn-close-circle {
    /* Mantenido por si se usa en otros modales como el de rechazo */
    position: absolute;
    top: 20px;
    right: 20px;
    background: #f1f5f9;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #64748b;
    transition: 0.2s;
    z-index: 10;
}

.btn-close-circle:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.btn-close-circle-inline {
    background: #f1f5f9;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #64748b;
    transition: 0.2s;
}

.btn-close-circle-inline:hover {
    background: #e2e8f0;
    color: #ef4444; /* Rojo suave al pasar el ratón para cerrar */
    transform: rotate(90deg);
}

/* Sidebar Details */
.expediente-badge-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 35px;
}

.expediente-badge-header i {
    font-size: 2.5rem;
    color: #3b82f6;
}

.expediente-badge-header .label {
    display: block;
    font-size: 0.75rem;
    color: rgba(255,255,255,0.6);
    text-transform: uppercase;
    font-weight: 700;
}

.expediente-badge-header h2 {
    font-size: 1.3rem;
    font-weight: 800;
    margin-top: 2px;
}

.info-group-modern {
    margin-bottom: 25px;
}

.info-group-modern label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.7rem;
    font-weight: 800;
    color: #93c5fd; /* Lighter blue for contrast */
    text-transform: uppercase;
    margin-bottom: 6px;
    letter-spacing: 0.05em;
}

.info-group-modern p {
    font-size: 1rem;
    font-weight: 700;
    color: #ffffff;
}

/* Main Body Details */
.expediente-status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 25px 40px 20px 40px;
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0; /* Evita que la cabecera se encoja */
    z-index: 50;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); /* Sombra más sutil y pegada */
}

.status-current {
    font-size: 0.85rem;
    font-weight: 700;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-current strong {
    color: #0f172a;
    text-transform: uppercase;
    background: #f1f5f9;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    border: 1px solid #e2e8f0;
}

.section-title-modern {
    font-size: 1.1rem;
    font-weight: 800;
    color: #002D62;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Services */
.exp-servs-list-modern {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.service-item-admin {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 12px 20px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
    font-size: 0.95rem;
    color: #1e293b;
    transition: 0.2s;
}

.service-item-admin:hover {
    border-color: #cbd5e1;
    background: #f1f5f9;
}

.service-item-admin .check-icon {
    color: #10b981;
    font-size: 1.1rem;
}

.exp-totals-summary {
    text-align: right;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #e2e8f0;
}

.exp-totals-summary span {
    color: #64748b;
    font-weight: 600;
    font-size: 0.9rem;
    margin-right: 10px;
}

.exp-totals-summary strong {
    font-size: 1.3rem;
    font-weight: 800;
    color: #002D62;
}

/* Comments */
.comments-container-modern {
    background: #fffbeb;
    border-left: 4px solid #f59e0b;
    padding: 20px 25px;
    border-radius: 0 12px 12px 0;
    margin-top: 10px;
    box-shadow: 0 4px 6px -1px rgba(245, 158, 11, 0.1);
}

.comments-container-modern p {
    color: #92400e;
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Status Grid (3 columns) */
.management-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 15px;
}

.btn-status-opt {
    background: #f1f5f9;
    border: none;
    padding: 14px;
    border-radius: 12px;
    font-weight: 700;
    color: #475569;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.8rem;
    transition: 0.2s;
}

.btn-status-opt:hover {
    background: #e2e8f0;
}

.btn-status-opt.active-status {
    background: #002D62;
    color: white;
}

.btn-status-opt.opt-rechazado:hover {
    background: #ef4444;
    color: white;
}

/* File items (Elegant Side-by-Side) */
#exp-archivos-list {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    width: 100%;
}

.file-admin-item {
    background: rgba(255,255,255,0.03);
    padding: 8px !important;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.08);
    width: calc(50% - 4px) !important; /* Forzado a 2 por fila */
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: 0.3s;
    box-sizing: border-box;
}

.file-admin-item:hover {
    background: rgba(255,255,255,0.07);
    border-color: rgba(255,255,255,0.2);
}

.file-header-mini {
    display: flex;
    align-items: center;
    gap: 8px;
}

.file-header-mini i {
    font-size: 1rem;
    color: #3b82f6;
}

.file-header-mini .file-label {
    font-size: 0.65rem;
    font-weight: 800;
    color: rgba(255,255,255,0.5);
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.img-preview-container {
    position: relative;
    width: 100%;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
}

.img-preview-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: 0.4s;
}

.img-preview-container:hover img {
    transform: scale(1.1);
}

.img-overlay-zoom {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: 0.3s;
    color: white;
    font-size: 1.2rem;
}

.img-preview-container:hover .img-overlay-zoom {
    opacity: 1;
}

.btn-download-boutique {
    background: rgba(255,255,255,0.1);
    color: white;
    text-decoration: none;
    padding: 6px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    transition: 0.2s;
}

.btn-download-boutique:hover {
    background: #fff;
    color: #002D62;
}

/* Modal Visor de Imagen */
.image-viewer-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    z-index: 3000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 40px;
    backdrop-filter: blur(5px);
}

.image-viewer-modal.active {
    display: flex;
}

.image-viewer-modal img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 12px;
    box-shadow: 0 0 40px rgba(0,0,0,0.5);
    animation: zoomIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes zoomIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.close-viewer {
    position: absolute;
    top: 30px;
    right: 30px;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    background: rgba(255,255,255,0.1);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s;
}

.close-viewer:hover {
    background: #ef4444;
    transform: rotate(90deg);
}

