:root {
    --primary: #1e3a8a;
    --primary-light: #3b82f6;
    --secondary: #64748b;
    --accent: #10b981;
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.12);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --radius: 12px;
    --sidebar-w: 260px;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: 'Inter', 'Open Sans', sans-serif;
    margin: 0;
    line-height: 1.6;
    overflow-x: hidden;
    overflow-y: auto;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Navbar & Sidebar Header */
.navbar-default {
    background: var(--bg-card);
    border: none;
    box-shadow: var(--shadow-sm);
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1030; /* Below sidebar and modals */
}

.navbar-default .container-fluid {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.hamburger-btn {
    font-size: 20px;
    color: var(--primary);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background 0.2s;
}

.hamburger-btn:hover {
    background: #eff6ff;
}

/* Sidebar */
.sidenav {
    height: 100%;
    width: 0;
    position: fixed;
    z-index: 1035; /* Above navbar (1030), below modal backdrop (1040) */
    top: 0;
    left: 0;
    background-color: var(--primary);
    overflow-x: hidden;
    transition: 0.3s;
    padding-top: 60px;
    border-right: none;
}

.sidenav-header {
    padding: 14px 24px 32px 24px;
    text-align: center;
}

.sidenav-header h2 {
    color: var(--primary-text);
    font-size: 20px;
    letter-spacing: 1px;
    margin: 0;
}

.sidenav-links {
    padding: 0 16px;
    flex-grow: 1;
}

.sidenav a {
    padding: 14px 16px;
    text-decoration: none;
    font-size: 15px;
    color: var(--primary-text);
    opacity: 0.7;
    display: flex;
    align-items: center;
    border-radius: 8px;
    margin-bottom: 4px;
    transition: all 0.2s;
}

.sidenav a i {
    width: 24px;
    margin-right: 12px;
    font-size: 18px;
}

.sidenav a:hover {
    background: rgba(255,255,255,0.15);
    color: var(--primary-text);
    opacity: 1;
    padding-left: 20px;
}

.sidenav a.active {
    background: rgba(255,255,255,0.95);
    color: var(--primary-on-white) !important;
    opacity: 1;
    font-weight: 800;
    border-left: none;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.sidenav a.active i {
    color: var(--primary-on-white);
}

.sidenav .closebtn {
    position: absolute;
    top: 6px; /* Optimized for vertical center Y=35 */
    right: 20px;
    font-size: 32px;
    color: var(--primary-text);
    opacity: 0.8;
}

.sidenav .closebtn:hover {
    opacity: 1;
    transform: scale(1.1);
}

.sidenav-footer {
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,0.05);
}

.disabled-dept, .disabled-user {
    
    opacity: 0.6;
}

.sidenav-footer a {
    color: var(--primary-text) !important;
    opacity: 0.8;
}

.sidenav-footer a:hover {
    opacity: 1;
}

/* Cards & Layout */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid rgba(0,0,0,0.05);
    padding: 24px;
    margin-bottom: 24px;
    transition: box-shadow 0.2s;
}


.card-title {
    font-weight: 700;
    font-size: 18px;
    color: var(--primary-on-white);
}

/* Custom Balance Cards */
.card-deck {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.card-custom-1, .card-custom-2 {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: var(--primary-text)!important;
    text-align: center;
}

.card-custom-1 .card-title, .card-custom-2 .card-title {
    color: var(--primary-text);
    opacity: 0.8;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-custom-1 .card-text, .card-custom-2 .card-text {
    font-size: 32px;
    font-weight: 800;
}

/* Lists and Tables */
.table {
    margin-bottom: 0 !important;
    margin-top: 0 !important;
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 6px;
}

.table tr {
    background: white;
}

.table th {
    padding: 12px;
    font-size: 13px;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
}

.table td {
    padding: 16px 12px;
    border-top: 1px solid #f1f5f9;
    border-bottom: 1px solid #f1f5f9;
}

.table td:first-child { border-left: 1px solid #f1f5f9; border-radius: 8px 0 0 8px; }
.table td:last-child { border-right: 1px solid #f1f5f9; border-radius: 0 8px 8px 0; }

.badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 12px;
}

.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef9c3; color: #854d0e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-visto { background: #ffedd5; color: #9a3412; }
.badge-pre-aprobada { background: #fef3c7; color: #92400e; }
.badge-cancelada { background: #f1f5f9; color: #475569; }

/* Push Effect */
body {
    overflow-x: hidden;
}

#main {
    transition: margin-left .3s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-pushed {
    margin-left: 260px;
    width: calc(100% - 260px) !important;
}

/* Modal Centering & Styling */
.modal-dialog-centered {
    display: flex;
    align-items: center;
    min-height: calc(100% - (0.5rem * 2));
}

@media (min-width: 576px) {
    .modal-dialog-centered {
        min-height: calc(100% - (1.75rem * 2));
    }
}

/* Timeline Fixes (Centering) */
.timeline-icon {
    display: flex !important;
    align-items: center;
    justify-content: center;
    line-height: normal !important;
}

.timeline-icon i {
    margin: 0 !important;
    top: auto !important; /* Remove any bootstrap icon offset */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .historial-row {
        flex-direction: column;
    }
}

/* Dynamic Table & Pagination */
.dynamic-table-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 180px); /* Fill most of viewport */
    overflow: hidden;
    position: relative;
    border: 1px solid #e2e8f0;
}

.dynamic-table-container .table-responsive {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 0;
}

.table-pagination-footer {
    padding: 12px 24px;
    background: white; /* or #f8fafc */
    border-top: 1px solid #f1f5f9;
    flex-shrink: 0; /* Prevent shrinking */
    
}

/* Force DataTables wrapper injected by JS to act as a Flex column */
.dataTables_wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Force the actual table to push subsequent siblings (like pagination) to the bottom */
.dataTables_wrapper .table {
    margin-bottom: auto !important;
}

/* Adjust card to use full available height if needed */
.full-height-card {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Scrollbar styling for table */
.table-responsive::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
.table-responsive::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}
.table-responsive::-webkit-scrollbar-track {
  background: #f1f5f9;
}
/* DataTables Global Premium Overrides */
.dataTables_wrapper {
    padding: 0 !important;
}

.dataTables_filter {
    padding: 16px 24px !important;
    background: #f8fafc;
    border-bottom: 1px solid #f1f5f9;
    text-align: right !important;
}

.dataTables_filter input {
    border-radius: 20px !important;
    border: 1px solid #e2e8f0 !important;
    padding: 6px 16px !important;
    font-size: 14px !important;
    width: 200px !important;
    transition: all 0.2s;
}

.dataTables_filter input:focus {
    border-color: var(--primary-light) !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1) !important;
    outline: none !important;
}

.dataTables_info {
    padding: 16px 24px !important;
    font-size: 13px !important;
    color: var(--text-muted) !important;
}

.dataTables_paginate {
    padding: 12px 24px !important;
    margin-bottom: 20px !important;
    text-align: center !important;
    border-top: 1px solid #f1f5f9;
    background: white !important;
    position: sticky !important;
    bottom: 0 !important;
    z-index: 100 !important;
    margin-top: auto !important; /* Forces it to the bottom of the flex container */
}


/* Clean up generic DataTables pagination to prevent conflicts */
.dataTables_paginate .paginate_button {
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
}

.dataTables_paginate .paginate_button:hover,
.dataTables_paginate .paginate_button:active {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
}

/* Fix for Bootstrap 3 override - Target the Anchor tag specifically */
.dataTables_wrapper .pagination {
    margin: 0 !important;
    display: flex !important;
    justify-content: center !important;
    box-shadow: none !important;
}

.dataTables_wrapper .pagination > li {
    display: inline-block;
    margin: 0 3px;
}

.dataTables_wrapper .pagination > li > a {
    margin: 0 !important;
    border: 1px solid #e2e8f0 !important;
    color: var(--text-muted) !important;
    font-weight: 700 !important;
    padding: 6px 16px !important;
    background: white !important;
    font-size: 13px !important;
    transition: all 0.2s ease !important;
    text-decoration: none !important;
}

.dataTables_wrapper .pagination > li > a:hover {
    background: #f8fafc !important;
    color: var(--primary) !important;
    border-color: #cbd5e1 !important;
}

.dataTables_wrapper .pagination > .active > a,
.dataTables_wrapper .pagination > .active > a:hover {
    background-color: var(--primary) !important;
    border-color: var(--primary) !important;
    color: var(--primary-text) !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06) !important;
}

.dataTables_wrapper .pagination > .disabled > a {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
    background: #f1f5f9 !important;
    box-shadow: none !important;
}

/* Hide DataTables Info and Length by default as requested */
.dataTables_info, .dataTables_length {
    display: none !important;
}

/* Request History Accordion Styles */
.request-item {
    background: white;
    margin-bottom: 2px !important;
    border-radius: 4px !important;
    border: none !important;
    border-bottom: 1px solid #e2e8f0 !important;
    transition: background 0.2s;
}

.request-item:last-child {
    border-bottom: none !important;
}

.request-header {
    background: transparent;
    padding: 16px 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 4px solid transparent; /* Status indicator */
    transition: background 0.2s;
}

.request-header:hover {
    background: #f8fafc;
}

.request-header[aria-expanded="true"] {
    background: #f1f5f9;
}

/* Status Colors for Borders */
.request-item[data-status="Approved"] .request-header { border-left-color: #22c55e; }
.request-item[data-status="Pre-aprobada"] .request-header { border-left-color: #f59e0b; }
.request-item[data-status="Pending"] .request-header { border-left-color: #ffc107; }
.request-item[data-status="Declined"] .request-header { border-left-color: #ef4444; }
.request-item[data-status="Canceled"] .request-header { border-left-color: #94a3b8; }

.request-body {
    padding: 20px;
    background: #f8fafc; /* Lighter background for body */
    border-top: 1px solid #e2e8f0;
}

.request-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.btn-subtle {
    background: white;
    color: var(--text-muted);
    border: 1px solid #e2e8f0;
    font-size: 11px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 16px; /* Pill shape */
    transition: all 0.2s;
}

.btn-subtle:hover {
    background: #f1f5f9;
    color: var(--text-main);
    border-color: #cbd5e1;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* Timeline Redesign */
.request-timeline-container {
    padding: 0;
    margin-top: 24px;
    background: transparent;
    border: none;
    position: relative;
    max-height: 250px;
    overflow-y: auto;
    padding-right: 8px; /* Space for scrollbar */
}

/* Continuous Vertical Line */
.request-timeline-container::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 20px; /* Line position */
    width: 2px;
    background: #e2e8f0;
    z-index: 0;
}

.timeline-item {
    position: relative;
    padding-left: 50px; /* Space for dot and line */
    padding-bottom: 24px;
    z-index: 1;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

/* Timeline Dot */
.timeline-dot {
    position: absolute;
    left: 11px; /* Center on line (20px line - 10px half dot width + adjustment) */
    top: 0;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 0 0 2px #e2e8f0; /* Outer ring matches line color */
    background: white; /* Fallback */
    z-index: 2;
}

.timeline-dot-aprobada { background: #22c55e; box-shadow: 0 0 0 3px #dcfce7; }
.timeline-dot-rechazada, .timeline-dot-cancelada { background: #ef4444; box-shadow: 0 0 0 3px #fee2e2; }
.timeline-dot-default { background: #3b82f6; box-shadow: 0 0 0 3px #dbeafe; }

/* Timeline Text Styles */
.timeline-action {
    font-weight: 700;
    color: var(--text-main);
    font-size: 14px;
    line-height: 1.2;
}

.timeline-time {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 500;
    margin-top: 2px;
}

.timeline-user {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.timeline-comment {
    font-size: 12px;
    color: var(--text-main);
    background: white;
    padding: 10px 14px;
    border-radius: 8px;
    margin-top: 8px;
    border: 1px solid #e2e8f0;
    box-shadow: var(--shadow-sm);
    position: relative;
}

.timeline-comment::before {
    content: '';
    position: absolute;
    top: -5px;
    left: 20px;
    width: 10px;
    height: 10px;
    background: white;
    transform: rotate(45deg);
    border-top: 1px solid #e2e8f0;
    border-left: 1px solid #e2e8f0;
}

/* Flexbox Layout for Pagination Footer */
.historial-container {
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    position: relative !important;
    border-radius: 12px;
    background: white;
}

#requests-list {
    flex: 1; /* Takes available space */
    overflow-y: auto;
    padding: 0;
    /* No bottom padding needed as pagination is separate block */
}

#requests-list::-webkit-scrollbar {
    width: 6px;
}
#requests-list::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 3px;
}

#dashRequestsTable_wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
}

#dashRequestsTable {
    width: 100% !important;
    margin-bottom: 0 !important;
    border-bottom: none !important;
}

/* Sticky Pagination Footer for Dashboard */
#dashRequestsTable_paginate {
    position: sticky !important;
    bottom: 0 !important;
    width: 100% !important;
    min-height: 60px; /* Fixed height footer */
    background: white !important;
    border-top: 1px solid #f1f5f9;
    padding: 0 !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    z-index: 100 !important;
}

.dataTables_paginate .pagination {
    margin: 0 !important;
    justify-content: center !important;
    display: flex;
    align-items: center;
}

.dataTables_wrapper .pagination > li > a {
    border: none !important;
    background: transparent !important;
    color: var(--text-muted) !important;
    font-weight: 600;
    font-size: 13px;
    padding: 8px 14px !important;
    margin: 0 4px;
    border-radius: 8px !important;
    transition: all 0.2s;
}

.dataTables_wrapper .pagination > li.active > a {
    background: var(--primary) !important;
    color: var(--primary-text) !important;
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.2);
}

.dataTables_wrapper .pagination > li:not(.active) > a:hover {
    background: #f8fafc !important;
    color: var(--text-main) !important;
}

/* Calendar Opacity for days of other months */
.fc-day-other {
    opacity: 0.4 !important;
}

.fc-day-other .fc-daygrid-day-number {
    opacity: 0.6;
}

/* Utilities Extracted from layout.html */
body {
    height: 100vh;
    overflow: hidden;
}
#main {
    height: calc(100% - 64px);
    overflow-y: auto;
    padding-bottom: 40px;
}
/* En pantallas grandes, #main ocupa exactamente lo que queda debajo de la barra superior.
   Antes medía 100vh (por el min-height) y su parte de abajo quedaba fuera de la pantalla
   sin poder scrollearla, así que se cortaba el final de las páginas largas. */
@media (min-width: 769px) {
    body {
        display: flex;
        flex-direction: column;
    }
    body > nav {
        flex-shrink: 0;
    }
    #main {
        flex: 1 1 auto;
        height: auto;
        min-height: 0;
        /* El espacio con la barra va adentro: así lo que se scrollea llega justo hasta la barra */
        padding-top: 20px;
        padding-bottom: 20px;
    }
}
@media (max-width: 768px) {
    body {
        overflow: auto;
        max-height: none;
    }
    #main {
        height: auto;
        overflow-y: visible;
    }
}

.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 4px !important; }
.mb-2 { margin-bottom: 8px !important; }
.mb-3 { margin-bottom: 16px !important; }
.mb-4 { margin-bottom: 24px !important; }
.mb-5 { margin-bottom: 48px !important; }
.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 4px !important; }
.mt-2 { margin-top: 8px !important; }
.mt-3 { margin-top: 16px !important; }
.mt-4 { margin-top: 24px !important; }
.mt-5 { margin-top: 48px !important; }
.ml-auto { margin-left: auto !important; }
.mr-auto { margin-right: auto !important; }
.p-0 { padding: 0 !important; }
.p-1 { padding: 4px !important; }
.p-2 { padding: 8px !important; }
.p-3 { padding: 16px !important; }
.p-4 { padding: 24px !important; }
.d-flex { display: flex !important; }
.flex-column { flex-direction: column !important; }
.flex-row { flex-direction: row !important; }
.align-items-center { align-items: center !important; }
.justify-content-between { justify-content: space-between !important; }
.justify-content-center { justify-content: center !important; }
.w-100 { width: 100% !important; }
.gap-1 { gap: 4px !important; }
.gap-2 { gap: 8px !important; }
.gap-3 { gap: 16px !important; }
.password-container {
    position: relative;
}
.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--text-muted);
    z-index: 10;
    background: none;
    border: none;
    padding: 0;
}

/* Global Styled Alert */
#globalAlertContainer {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    width: 90%;
    max-width: 400px;
    pointer-events: none;
}
.styled-alert {
    background: white;
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-left: 5px solid var(--primary);
    animation: alertSlideIn 0.3s ease-out;
    pointer-events: all;
}
@keyframes alertSlideIn {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.styled-alert.alert-danger { border-left-color: #ef4444; color: #991b1b; background: #fef2f2; }
.styled-alert.alert-success { border-left-color: #10b981; color: #065f46; background: #ecfdf5; }
.styled-alert.alert-warning { border-left-color: #f59e0b; color: #92400e; background: #fffbeb; }
.styled-alert-icon { font-size: 20px; }
.styled-alert-message { font-weight: 600; font-size: 14px; flex: 1; }
.styled-alert-close { cursor: pointer; opacity: 0.5; font-size: 18px; }
.styled-alert-close:hover { opacity: 1; }

/* =====================================================================
   Vuelta de tuerca visual y versión para celular (nov 2026)
   Todo usa las variables del color del departamento (--primary, etc.).
   ===================================================================== */
:root {
    --bg-main: #f3f5f8;
    --border: #e5e9f0;
    --radius: 14px;
    --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.04), 0 2px 8px rgba(15, 23, 42, 0.04);
}
body {
    background: var(--bg-main);
    -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { letter-spacing: -0.3px; }

/* --- Barra superior --- */
.navbar-default.app-navbar {
    padding: 10px 20px;
    min-height: 64px;
    margin-bottom: 0;
    border-bottom: 1px solid var(--border);
    box-shadow: none;
}
.app-navbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
/* Bootstrap 3 agrega ::before/::after (clearfix) que en flex cuentan como elementos y corren todo al centro */
.app-navbar-inner::before, .app-navbar-inner::after, .navbar-default.app-navbar::before, .navbar-default.app-navbar::after { display: none !important; }
.app-navbar-left, .app-navbar-right { display: flex; align-items: center; min-width: 0; }
.app-navbar-left { gap: 10px; }
.app-navbar-right { gap: 14px; }
.hamburger-btn {
    border: none;
    background: transparent;
    color: var(--primary-on-white);
    width: 40px;
    height: 40px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-size: 18px;
}
.hamburger-btn:hover { background: #f1f5f9; }
.app-brand { display: flex; align-items: center; gap: 10px; text-decoration: none !important; min-width: 0; }
.app-brand-mark {
    width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0;
    background: var(--primary); color: var(--primary-text);
    font-weight: 800; font-size: 16px;
    display: flex; align-items: center; justify-content: center;
}
.app-brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.app-brand-name { font-weight: 800; color: var(--text-main); font-size: 15px; letter-spacing: -0.2px; }
.app-brand-sub { font-size: 11px; color: var(--text-muted); font-weight: 500; }

.user-info-navbar { display: flex; align-items: center; gap: 10px; min-width: 0; }
.user-info-text { text-align: right; min-width: 0; }
.user-info-name { font-weight: 700; color: var(--text-main); font-size: 14px; line-height: 1.2; white-space: nowrap; }
.user-info-role {
    font-size: 11px; color: var(--primary-on-white); font-weight: 600; opacity: 0.85;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px;
}
.user-avatar {
    width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
    background: var(--primary); color: var(--primary-text);
    font-size: 17px;
    display: flex; align-items: center; justify-content: center;
}

/* --- Campanita --- */
.app-bell { position: relative; }
.app-bell-btn {
    position: relative; width: 40px; height: 40px; padding: 0;
    border-radius: 10px; border: 1px solid var(--border); background: #fff;
    color: var(--text-muted); font-size: 16px;
    display: inline-flex; align-items: center; justify-content: center;
    transition: color 0.2s, border-color 0.2s;
}
.app-bell-btn:hover, .app-bell.open .app-bell-btn { color: var(--primary-on-white); border-color: #cbd5e1; }
.app-bell-btn:focus, .hamburger-btn:focus { outline: none; }
.app-bell-btn:focus-visible, .hamburger-btn:focus-visible {
    box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.35);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 25%, transparent);
}
.app-bell-count {
    position: absolute; top: -6px; right: -6px;
    min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px;
    background: #ef4444; color: #fff; border: 2px solid #fff;
    font-size: 10px; font-weight: 800;
    display: flex; align-items: center; justify-content: center;
}
.app-bell-menu {
    width: 350px; max-width: calc(100vw - 24px); padding: 0; margin-top: 10px;
    border-radius: 12px; border: 1px solid var(--border);
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14); overflow: hidden;
}
.app-bell-head {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 16px; border-bottom: 1px solid var(--border);
    font-weight: 800; font-size: 13px; color: var(--text-main);
}
.app-bell-head-count { background: #fee2e2; color: #b91c1c; border-radius: 10px; padding: 1px 8px; font-size: 11px; }
.app-bell-list { max-height: 420px; overflow-y: auto; }
.app-bell-section {
    padding: 10px 16px 4px; font-size: 10px; font-weight: 800; letter-spacing: 0.6px;
    text-transform: uppercase; color: var(--text-muted);
}
.app-bell-item { padding: 10px 16px 12px; border-bottom: 1px solid #f1f5f9; white-space: normal; }
.app-bell-item:last-child { border-bottom: none; }
.app-bell-title { font-weight: 700; font-size: 13px; color: var(--text-main); }
.app-bell-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.app-bell-note { font-size: 12px; color: #5b21b6; background: #f5f3ff; border-radius: 6px; padding: 6px 8px; margin-top: 6px; }
.app-bell-actions { display: flex; gap: 6px; margin-top: 8px; }
.app-bell-empty { padding: 24px 16px; text-align: center; color: var(--text-muted); font-size: 13px; }
.app-bell-empty i { color: #16a34a; margin-right: 4px; }

.app-btn-primary {
    background: var(--primary); color: var(--primary-text) !important;
    border: none; font-weight: 700; border-radius: 8px;
}
.app-btn-primary:hover, .app-btn-primary:focus { filter: brightness(0.93); }
.btn-xs.app-btn-primary { padding: 4px 10px; font-size: 11px; }
.app-modal { border-radius: var(--radius); border: none; box-shadow: var(--shadow-md); }
.app-modal .modal-title { font-weight: 800; color: var(--text-main); }
.app-modal-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* --- Menú lateral --- */
.sidenav { overflow-y: auto; padding-top: 56px; display: flex; flex-direction: column; }
.sidenav .closebtn {
    position: absolute; top: 10px; right: 12px;
    width: 36px; height: 36px; padding: 0; margin: 0;
    display: flex; align-items: center; justify-content: center;
    border: none; border-radius: 8px; background: transparent;
    color: var(--primary-text); font-size: 18px; opacity: 0.8; cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
}
.sidenav .closebtn:hover { background: rgba(255, 255, 255, 0.15); opacity: 1; transform: none; padding: 0; }
.sidenav .closebtn:focus { outline: none; }
.sidenav .closebtn:focus-visible { box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.6); }
.sidenav-links { flex: 1 0 auto; }
.sidenav-logo { padding: 20px 24px 16px; text-align: center; }
.sidenav-logo img { display: block; width: 100%; max-width: 170px; height: auto; margin: 0 auto; opacity: 0.9; filter: var(--logo-filter, none); }
.sidenav-footer { padding-bottom: 20px; }
body.sidenav-open .sidenav { box-shadow: 6px 0 24px rgba(15, 23, 42, 0.18); }
.sidenav-header { padding: 0 24px 12px; text-align: left; }
.sidenav-section {
    padding: 14px 16px 6px; font-size: 10px; font-weight: 800; letter-spacing: 0.8px;
    text-transform: uppercase; color: var(--primary-text); opacity: 0.55; white-space: nowrap;
}
.sidenav a { padding: 11px 16px; font-size: 14px; white-space: nowrap; }
.sidenav a i { font-size: 16px; }
.sidenav-backdrop { display: none; }

/* --- Tarjetas, campos y botones --- */
.card { border: 1px solid var(--border); box-shadow: var(--shadow-card); }
.form-control { border-color: #dbe2ea; box-shadow: none; }
.form-control:focus {
    border-color: var(--primary-on-white);
    box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.25);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
}
.btn { transition: filter 0.15s, transform 0.15s, box-shadow 0.15s, background 0.15s; }
.btn-primary:hover, .btn-primary:focus { filter: brightness(0.93); }
.btn-primary:active { transform: translateY(1px); }
.alert { border-radius: 10px; }
.table tbody tr:hover td { background: #fafbfd; }

/* --- Celular y tablet --- */
@media (max-width: 768px) {
    .navbar-default.app-navbar { padding: 8px 12px; min-height: 56px; }
    .app-brand-sub, .user-info-text { display: none; }
    .app-navbar-right { gap: 8px; }
    .main-pushed { margin-left: 0 !important; width: 100% !important; }
    body.sidenav-open .sidenav-backdrop {
        display: block; position: fixed; top: 0; right: 0; bottom: 0; left: 0;
        background: rgba(15, 23, 42, 0.45); z-index: 1034;
    }
    body.sidenav-open { overflow: hidden; }

    #main { padding-top: 16px; padding-bottom: 24px; }
    .card { margin-bottom: 16px; }
    .card[style*="padding: 30px"], .card[style*="padding: 24px"], .card[style*="padding:30px"] { padding: 18px !important; }
    h2 { font-size: 24px; }
    h3 { font-size: 20px; }
    .modal-dialog { width: auto !important; margin: 10px; }
    .search-box { width: 100% !important; }

    /* Las tablas con altura fija pasan a crecer con su contenido */
    .dynamic-table-container { height: auto !important; overflow: visible !important; }
    .dynamic-table-container .table-responsive { overflow-y: visible; }
    .dataTables_paginate { position: static !important; }

    /* Tablas de solicitudes: cada fila se ve como una tarjeta */
    table.rt-stack thead { display: none; }
    table.rt-stack, table.rt-stack tbody, table.rt-stack tr, table.rt-stack td { display: block; width: 100% !important; }
    table.rt-stack { border-spacing: 0; }
    table.rt-stack tr {
        border: 1px solid var(--border) !important; border-radius: 12px;
        margin: 0 0 10px; padding: 10px 14px; background: #fff;
    }
    table.rt-stack td {
        border: none !important; border-radius: 0 !important;
        padding: 4px 0 !important; text-align: left !important;
    }
    table.rt-stack td[data-label]::before {
        content: attr(data-label); display: block;
        font-size: 10px; font-weight: 800; letter-spacing: 0.5px;
        text-transform: uppercase; color: var(--text-muted);
    }
    table.rt-stack td .rt-actions { justify-content: flex-start !important; flex-wrap: wrap; }
    table.rt-stack tbody tr:hover td { background: transparent; }
    table.rt-stack td.rt-inline { display: inline-block; width: auto !important; margin-right: 18px; }

    /* Tarjeta compacta: número y estado arriba, tipo y período lado a lado */
    table.rt-stack tr { display: flex; flex-wrap: wrap; align-items: flex-start; column-gap: 12px; }
    table.rt-stack td { flex: 1 1 100%; }
    table.rt-stack td.rt-inline { flex: 0 0 auto; margin-right: 0; }
    table.rt-stack td[data-label="Solicitud"] { order: -2; flex: 1 1 60%; width: auto !important; }
    table.rt-stack td[data-label="Estado"] { order: -1; flex: 0 0 auto; width: auto !important; margin-left: auto; }
    table.rt-stack td[data-label="Solicitud"]::before, table.rt-stack td[data-label="Estado"]::before { display: none !important; }
    table.rt-stack td[data-label="Tipo"], table.rt-stack td[data-label="Período / Cantidad"] { flex: 1 1 40%; width: auto !important; }
    /* Sin número de solicitud (empleado): arriba va el tipo, al lado del estado */
    table.rt-stack.rt-noid td[data-label="Tipo"] { order: -2; flex: 1 1 60%; width: auto !important; }
    table.rt-stack.rt-noid td[data-label="Tipo"]::before { display: none !important; }
    table.rt-stack.rt-noid td[data-label="Período / Cantidad"] { flex: 1 1 100%; }

    /* Campanita: en celular el desplegable ocupa el ancho de la pantalla */
    .app-bell-menu {
        position: fixed !important; top: 58px !important; left: 10px !important; right: 10px !important;
        width: auto !important; max-width: none; margin-top: 0;
    }

    /* Ventanas (Gestionar, notas, etc.): que no se pasen del ancho de la pantalla */
    .modal-dialog-centered .modal-content { width: 100%; min-width: 0; }
    .modal-body .btn, .modal-footer .btn { white-space: normal; }
    .modal-body div[style*="display: flex"] { flex-wrap: wrap; }
    .modal-body div[style*="justify-content: flex-end"] > .btn { flex: 1 1 auto; }
    #yearlyBreakdownPopover { right: auto !important; left: 0 !important; top: calc(100% + 8px) !important; }
    #yearlyBreakdownPopover > div[style*="rotate(45deg)"] { display: none; }

    /* Filas anidadas directamente en otra fila (sin columna) sumaban 15 px de cada lado */
    .row > .row { margin-left: 0; margin-right: 0; }

    /* Departamentos: nombre, color y guardar uno debajo del otro */
    .dept-edit-form .dept-name-input { width: 100% !important; }
    table.rt-stack td.text-right .btn { margin-top: 4px; }

    /* Ficha del empleado: la tarjeta de arriba baja en varias líneas */
    .user-hero { flex-direction: column !important; align-items: stretch !important; gap: 16px; }
    .user-hero .d-flex { flex-wrap: wrap; }
    .user-hero .p-2[style*="width: 150px"] { width: calc(50% - 8px) !important; }
    .user-hero h2 { font-size: 22px; word-break: break-word; }
    .user-hero .btn { margin-left: 0 !important; }
}

/* El contenido nunca más ancho que la pantalla: #main es flex y sin esto el contenedor no se
   achica por debajo de su elemento más ancho (por ejemplo un selector de archivo en celular) */
#main > .container { min-width: 0; max-width: 100%; }
input[type="file"].form-control { max-width: 100%; min-width: 0; }

/* Contenido más ancho en pantallas grandes (Bootstrap lo dejaba fijo en 1170 px) */
@media (min-width: 1200px) {
    #main > .container {
        /* 100% y no auto: #main es flex y con márgenes automáticos el ancho se achicaba al contenido */
        width: 100%;
        max-width: 1680px;
        padding-left: 32px;
        padding-right: 32px;
    }
}

/* Menú lateral: grupos que se despliegan (Fichadas y Gestor de fichadas) */
.sidenav-group-toggle { cursor: pointer; }
.sidenav-chevron { margin-left: auto; font-size: 11px !important; width: auto !important; margin-right: 0 !important; opacity: .7; transition: transform .2s; }
.sidenav-group.open .sidenav-chevron { transform: rotate(180deg); }
.sidenav-children { display: none; padding: 2px 0 6px; }
.sidenav-group.open .sidenav-children { display: block; }
.sidenav .sidenav-children a { padding: 8px 16px 8px 52px; font-size: 13px; margin-bottom: 2px; }
.sidenav .sidenav-children a:hover { padding-left: 56px; }

/* Estado del comprobante de una licencia (verificación del gestor de fichadas) */
.doc-state { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 6px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.doc-state.doc-falta { background: #fff7ed; color: #9a3412; }
.doc-state.doc-pendiente { background: #fef9c3; color: #854d0e; }
.doc-state.doc-verificado { background: #dcfce7; color: #166534; }
.doc-state.doc-rechazado { background: #fee2e2; color: #991b1b; }
.doc-state.doc-adjunto { background: #f1f5f9; color: #475569; }
.doc-explain { font-size: 13px; color: #854d0e; background: #fefce8; border-radius: 8px; padding: 8px 12px; margin-top: 10px; }
.doc-check { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.doc-check form, .doc-actions-row form { display: flex; margin: 0; }
.doc-actions-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; justify-content: flex-end; }
@media (max-width: 767px) { .doc-actions-row { justify-content: flex-start; } }
/* Botones del comprobante: todos del mismo alto (y el de subir, igual que el selector de archivo) */
.btn.doc-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 40px; padding: 0 16px; border-radius: 8px; font-weight: 700; font-size: 13px; line-height: 1; white-space: nowrap; }
.btn.doc-btn.doc-btn-sm { height: 32px; padding: 0 12px; font-size: 12px; }
.doc-upload { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.doc-upload input[type="file"].form-control { flex: 1; min-width: 200px; height: 40px; padding: 0 8px; line-height: 38px; border-radius: 8px; }
.doc-upload input[type="file"].form-control::file-selector-button { height: 28px; margin-top: 5px; vertical-align: top; }

/* Tablas de solicitudes: filas seguidas, sin separación ni bordes redondeados (en celular siguen como tarjetas) */
@media (min-width: 768px) {
  table.req-table { border-collapse: collapse !important; border-spacing: 0 !important; }
  table.req-table > tbody > tr > td { border-top: none !important; border-left: none !important; border-right: none !important;
    border-radius: 0 !important; border-bottom: 1px solid #eef2f6 !important; padding-top: 12px; padding-bottom: 12px; }
  table.req-table > thead > tr > th { border-bottom: 1px solid #e2e8f0 !important; }
  table.req-table > tbody > tr:last-child > td { border-bottom: none !important; }
}
#dashRequestsTable_paginate { min-height: 52px; margin-top: auto; }

/* Tablas que son solo lista (sin acción por fila): sin resaltado al pasar el mouse */
.table.no-hover tbody tr:hover td { background: transparent !important; }

/* Campanita: filas con contador (fichadas) y enlace «ver todas» */
.app-bell-item.app-bell-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.app-bell-item.app-bell-row .app-bell-title { margin: 0; }
.app-bell-more { display: block; padding: 8px 16px 10px; font-size: 12px; font-weight: 700; }
