/* ==========================================================
   1. VARIABLES
   ========================================================== */

:root {
    /* Colores base */
    --body-bg: #f4f6f9;
    --sidebar-bg: #343a40;
    --sidebar-dark: #2f3439;
    --sidebar-text: #c2c7d0;
    --primary: #007bff;
    --primary-dark: #0069d9;
    --success: #28a745;
    --info: #17a2b8;
    --warning: #ffc107;
    --danger: #dc3545;
    --dark: #212529;
    --muted: #6c757d;
    --border: #dee2e6;
    --card-bg: #ffffff;
    --surface-bg: #ffffff;
    --input-bg: #ffffff;
    --table-header-bg: #f8f9fa;

    /* Sombras y radios */
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
    --shadow-strong: 0 8px 18px rgba(0, 123, 255, 0.28);
    --radius: 12px;
    --radius-sm: 8px;

    /* Tamaños layout */
    --sidebar-width: 270px;
    --sidebar-collapsed-width: 86px;
    --topbar-min-height: 94px;
    --content-padding-x: 34px;
    --content-padding-y: 30px;
    --content-padding-bottom: 36px;

    /* Espaciados */
    --gap-xs: 6px;
    --gap-sm: 10px;
    --gap-md: 18px;
    --gap-lg: 28px;
    --card-padding: 26px;
    --stat-padding: 26px;

    /* Z-index */
    --z-sidebar-content: 2;
    --z-tooltip: 50;
}

/* ==========================================================
   2. RESET / BASE
   ========================================================== */

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100%;
    font-family: "Segoe UI", Arial, sans-serif;
    background: var(--body-bg);
    color: var(--dark);
}

/* ==========================================================
   3. LAYOUT PRINCIPAL
   ========================================================== */

.app-shell {
    display: flex;
    min-height: 100vh;
    background: var(--body-bg);
}

.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 100vh;
    overflow: visible;
    background: var(--body-bg);
}

.content {
    padding: var(--content-padding-y) var(--content-padding-x) var(--content-padding-bottom);
    min-height: calc(100vh - var(--topbar-min-height));
    background: var(--body-bg);
}

.content > section {
    margin-bottom: var(--gap-lg);
}

.content > section:last-child {
    margin-bottom: 0;
}

/* ==========================================================
   4. SIDEBAR
   ========================================================== */

.sidebar {
    width: var(--sidebar-width);
    height: 100dvh;
    position: sticky;
    top: 0;
    flex-shrink: 0;
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--sidebar-bg);
    color: #ffffff;
    padding: 18px;
    display: flex;
    flex-direction: column;
    transition:
        width 0.22s ease,
        padding 0.22s ease;
}

.sidebar::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at top left, rgba(0, 123, 255, 0.18), transparent 35%),
        radial-gradient(circle at bottom right, rgba(23, 162, 184, 0.12), transparent 35%);
    pointer-events: none;
}

.sidebar > * {
    position: relative;
    z-index: var(--z-sidebar-content);
}

/* Brand */

.brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--gap-sm);
    padding: 10px 8px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.10);
    margin-bottom: 16px;
}

.brand-main {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.brand-icon {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    max-width: 44px;
    max-height: 44px;
    flex: 0 0 44px;
    border: 0;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: var(--primary);
    color: #ffffff;
    font-weight: 800;
    letter-spacing: 0.5px;
    cursor: default;
    box-shadow: 0 8px 18px rgba(0, 123, 255, 0.35);
    transition:
        background 0.18s ease,
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.brand-icon i {
    font-size: 22px;
    line-height: 1;
}

.brand-toggle-icon {
    cursor: default;
}

.brand-text {
    flex: 1;
    min-width: 0;
    transition:
        opacity 0.18s ease,
        width 0.18s ease,
        max-width 0.18s ease;
}

.brand h1 {
    margin: 0;
    font-size: 20px;
}

.brand p {
    margin: 3px 0 0;
    color: var(--sidebar-text);
    font-size: 13px;
}

.brand:hover .brand-icon {
    transform: translateY(-1px) scale(1.03);
    box-shadow: 0 10px 22px rgba(0, 123, 255, 0.45);
}

/* Botón sidebar */

.sidebar-toggle {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 10px;
    display: grid;
    place-items: center;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.10);
    color: #ffffff;
    transition:
        background 0.18s ease,
        transform 0.18s ease,
        box-shadow 0.18s ease;
    flex: 0 0 36px;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.16);
}

.sidebar-toggle i {
    font-size: 18px;
}

/* Menú */

.menu {
    display: flex;
    flex-direction: column;
    gap: var(--gap-xs);
    margin-top: 8px;
}

.menu-link {
    position: relative;
    min-height: 46px;
    color: var(--sidebar-text);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 12px 13px;
    border-radius: 11px;
    transition:
        background 0.18s ease,
        color 0.18s ease,
        transform 0.18s ease,
        box-shadow 0.18s ease;
}

.menu-link::before {
    content: "";
    position: absolute;
    left: -18px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 0;
    border-radius: 999px;
    background: #ffffff;
    transition: height 0.18s ease;
}

.menu-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    transform: translateX(3px);
}

.menu-link.active {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: #ffffff;
    box-shadow: var(--shadow-strong);
    transform: translateX(4px);
}

.menu-link.active::before {
    height: 26px;
}

.menu-icon {
    width: 26px;
    height: 26px;
    display: inline-grid;
    place-items: center;
    flex: 0 0 26px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    transition:
        background 0.18s ease,
        transform 0.18s ease;
}

.menu-icon i {
    font-size: 16px;
}

.menu-link:hover .menu-icon,
.menu-link.active .menu-icon {
    background: rgba(255, 255, 255, 0.18);
    transform: scale(1.05);
}

.menu-text {
    font-weight: 600;
}

/* Footer sidebar */

.sidebar-footer {
    margin-top: auto;
    padding: 14px 12px;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.06);
    color: var(--sidebar-text);
    font-size: 13px;
}

.sidebar-footer-title {
    color: #ffffff;
    font-weight: 800;
    margin-bottom: 4px;
}

.sidebar-footer-text {
    color: var(--sidebar-text);
}

/* ==========================================================
   5. SIDEBAR COLAPSABLE
   ========================================================== */

body:not(.sidebar-collapsed) .brand-toggle-icon {
    pointer-events: none;
}

body.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
    padding-left: 14px;
    padding-right: 14px;
}

body.sidebar-collapsed .brand {
    min-height: 74px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}

body.sidebar-collapsed .brand-text,
body.sidebar-collapsed .sidebar-toggle,
body.sidebar-collapsed .menu-text,
body.sidebar-collapsed .sidebar-footer {
    opacity: 0;
    width: 0;
    max-width: 0;
    flex: 0 0 0;
    overflow: hidden;
    pointer-events: none;
    margin: 0;
}

body.sidebar-collapsed .brand-toggle-icon,
body.sidebar-collapsed .brand-icon {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    max-width: 44px;
    max-height: 44px;
    flex: 0 0 44px;
    display: grid;
    place-items: center;
    margin-left: auto;
    margin-right: auto;
    align-self: center;
}

body.sidebar-collapsed .brand-toggle-icon {
    pointer-events: auto;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.10);
}

body.sidebar-collapsed .brand-toggle-icon i {
    font-size: 22px;
    line-height: 1;
}

body.sidebar-collapsed .brand-toggle-icon:hover i {
    font-size: 0;
}

body.sidebar-collapsed .brand-toggle-icon:hover i::before {
    content: "\f479";
    font-family: "bootstrap-icons";
    font-size: 22px;
    line-height: 1;
}

body.sidebar-collapsed .brand-toggle-icon:hover {
    background: var(--primary);
    transform: translateY(-1px) scale(1.06);
    box-shadow: 0 10px 22px rgba(0, 123, 255, 0.45);
}

body.sidebar-collapsed .brand-toggle-icon::after {
    content: "Ampliar menú";
    position: absolute;
    left: 68px;
    top: 50%;
    transform: translateY(-50%);
    background: #111827;
    color: #ffffff;
    padding: 7px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition:
        opacity 0.16s ease,
        transform 0.16s ease;
    z-index: var(--z-tooltip);
}

body.sidebar-collapsed .brand-toggle-icon:hover::after {
    opacity: 1;
    transform: translateY(-50%) translateX(4px);
}

body.sidebar-collapsed .menu {
    align-items: center;
}

body.sidebar-collapsed .menu-link {
    width: 54px;
    height: 48px;
    justify-content: center;
    padding: 0;
    gap: 0;
}

body.sidebar-collapsed .menu-icon {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
}

body.sidebar-collapsed .menu-link:hover,
body.sidebar-collapsed .menu-link.active {
    transform: translateX(0);
}

body.sidebar-collapsed .menu-link::before {
    left: -12px;
}

/* ==========================================================
   6. TOPBAR
   ========================================================== */

.topbar {
    min-height: var(--topbar-min-height);
    height: auto;
    background: var(--surface-bg);
    border-bottom: 1px solid var(--border);
    padding: 16px 26px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.topbar-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: var(--gap-sm);
}

.topbar h2 {
    margin: 0;
    font-size: 24px;
    color: var(--dark);
}

.topbar p {
    margin: 4px 0 0;
    color: var(--muted);
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: #e9f5ff;
    color: #005cbf;
    border: 1px solid #b8daff;
    padding: 8px 13px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
}

.status-pill i {
    color: var(--success);
}

.back-dashboard {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    width: fit-content;
    color: var(--primary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 800;
    padding: 6px 9px;
    border-radius: 999px;
    background: #e9f5ff;
    border: 1px solid #b8daff;
    transition:
        background 0.18s ease,
        color 0.18s ease,
        transform 0.18s ease,
        box-shadow 0.18s ease;
}

.back-dashboard:hover {
    background: var(--primary);
    color: #ffffff;
    transform: translateX(-2px);
    box-shadow: 0 6px 14px rgba(0, 123, 255, 0.22);
}

/* ==========================================================
   7. LAYOUT HELPERS
   ========================================================== */

.grid {
    display: grid;
    gap: 24px;
    margin-bottom: var(--gap-lg);
}

.grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.span-2 {
    grid-column: span 2;
}

.page-transition {
    animation: fadeSlideIn 0.22s ease both;
}

@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================
   8. CARDS / STATS
   ========================================================== */

.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: var(--card-padding);
}

.card h1,
.card h2,
.card h3 {
    color: var(--dark);
}

.card h3 {
    margin-top: 0;
    font-size: 20px;
}

.card p {
    color: #495057;
    line-height: 1.55;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 14px;
}

.stat-card {
    color: #ffffff;
    border-radius: var(--radius);
    padding: var(--stat-padding);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 120px;
}

.stat-card p {
    margin: 0 0 8px;
    opacity: 0.9;
}

.stat-card h3 {
    margin: 0;
    font-size: 24px;
}

.stat-icon {
    font-size: 38px;
    opacity: 0.88;
}

.stat-primary {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: #eff6ff;
}

.stat-success {
    background: linear-gradient(135deg, #28a745, #1e7e34);
    color: #ecfdf5;
}

.stat-info {
    background: linear-gradient(135deg, #17a2b8, #117a8b);
    color: #ecfeff;
}

.stat-warning {
    background: linear-gradient(135deg, #d97706, #9a3412);
    color: #fff7ed;
}

.stat-danger {
    background: linear-gradient(135deg, #dc2626, #991b1b);
    color: #fff1f2;
}

.stat-card:hover {
    color: inherit;
    transform: translateY(-2px);
    box-shadow: 0 0.35rem 0.8rem rgba(15, 23, 42, 0.22);
}

/* ==========================================================
   9. BADGES / PILLS / TAGS
   ========================================================== */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    background: #e8f5e9;
    color: #1e7e34;
    border: 1px solid #c3e6cb;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 10px;
}

.badge-blue {
    background: #e9f5ff;
    color: #005cbf;
    border-color: #b8daff;
}

.pill {
    display: inline-flex;
    align-items: center;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
}

.pill-success {
    background: #e8f5e9;
    color: #1e7e34;
    border: 1px solid #c3e6cb;
}

.pill-warning,
.pill-manual {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.pill-info {
    background: #e0f7fb;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.pill-muted {
    background: #e9ecef;
    color: #495057;
    border: 1px solid #ced4da;
}

.tag {
    display: inline-flex;
    align-items: center;
    background: #e9f5ff;
    color: #005cbf;
    border: 1px solid #b8daff;
    border-radius: 999px;
    padding: 5px 9px;
    font-size: 13px;
    font-weight: 700;
    margin: 3px;
}

/* ==========================================================
   10. BOTONES
   ========================================================== */

.actions {
    margin: 18px 0;
}

.actions-inline {
    display: flex;
    gap: var(--gap-sm);
    align-items: center;
    flex-wrap: wrap;
}

.btn {
    border: 0;
    border-radius: var(--radius-sm);
    padding: 11px 16px;
    cursor: pointer;
    font-weight: 700;
    font-family: inherit;
    transition:
        background 0.15s ease,
        color 0.15s ease,
        border-color 0.15s ease,
        transform 0.15s ease,
        box-shadow 0.15s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: var(--primary);
    color: #ffffff;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: #6c757d;
    color: #ffffff;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-light {
    background: #f8f9fa;
    color: #343a40;
    border: 1px solid var(--border);
}

.btn-light:hover {
    background: #e2e6ea;
}

.btn-info {
    background: var(--info);
    color: #ffffff;
}

.btn-info:hover {
    background: #117a8b;
}

.btn-success {
    background: var(--success);
    color: #ffffff;
}

.btn-success:hover {
    background: #218838;
}

.btn-danger {
    background: var(--danger);
    color: #ffffff;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-small {
    padding: 7px 10px;
    font-size: 13px;
}

/* ==========================================================
   11. FORMULARIOS
   ========================================================== */

.form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.form-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--gap-md);
    margin-bottom: var(--gap-md);
}

.form-row-3 {
    grid-template-columns: 2fr 2fr 1fr;
}

.form-row-4 {
    grid-template-columns: 2fr 1fr 1fr 1fr;
}

.form-row-5 {
    grid-template-columns: 0.7fr 2fr 1fr 1fr 1fr;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.form-group-button {
    justify-content: end;
}

.form-group label {
    font-weight: 700;
    color: #343a40;
}

.form-group input,
.form-group select,
.form-group textarea {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 11px 12px;
    font-family: inherit;
    font-size: 15px;
    background: var(--input-bg);
    color: var(--dark);
    outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.12);
}

/* ==========================================================
   12. TABLAS
   ========================================================== */

.table-wrapper {
    max-width: 100%;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-top: 16px;
}

.table {
    width: 100%;
    min-width: 0;
    border-collapse: collapse;
    background: var(--surface-bg);
}

.table th,
.table td {
    padding: 13px 12px;
    border-bottom: 1px solid #edf0f2;
    text-align: left;
    vertical-align: middle;
}

.table th {
    background: var(--table-header-bg);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #495057;
}

.table tr:last-child td {
    border-bottom: 0;
}

.table tbody tr:hover {
    background: #f8fbff;
}

.table.table-wide {
    min-width: 900px;
}

.text-right {
    text-align: right;
}

.text-danger {
    color: var(--danger);
}

.small-muted {
    color: var(--muted);
    font-size: 13px;
    margin-top: 3px;
}

.cell-limit {
    max-width: 430px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Tabla liquidaciones */

.table-liquidaciones {
    min-width: 0;
    table-layout: fixed;
}

.table-liquidaciones th,
.table-liquidaciones td {
    padding: 10px 7px;
    font-size: 13px;
}

.table-liquidaciones th:nth-child(1),
.table-liquidaciones td:nth-child(1) {
    width: 42px;
}

.table-liquidaciones th:nth-child(2),
.table-liquidaciones td:nth-child(2) {
    width: 28%;
    overflow-wrap: anywhere;
}

.table-liquidaciones th:nth-child(3),
.table-liquidaciones td:nth-child(3) {
    width: 70px;
}

.table-liquidaciones th:nth-child(4),
.table-liquidaciones td:nth-child(4),
.table-liquidaciones th:nth-child(5),
.table-liquidaciones td:nth-child(5),
.table-liquidaciones th:nth-child(6),
.table-liquidaciones td:nth-child(6) {
    width: 80px;
}

.table-liquidaciones th:nth-child(7),
.table-liquidaciones td:nth-child(7) {
    width: 120px;
    overflow-wrap: anywhere;
}

.table-liquidaciones th:nth-child(8),
.table-liquidaciones td:nth-child(8) {
    width: 145px;
}

#tbody-desplazamientos {
    font-size: 13px;
}

#tbody-desplazamientos,
#tbody-desplazamientos tr,
#tbody-desplazamientos td {
    min-width: 0;
}

#tbody-desplazamientos td {
    vertical-align: middle;
    overflow-wrap: anywhere;
}

/* Tabla trabajadores */

#tabla-trabajadores {
    min-width: 0;
}

#tabla-trabajadores th,
#tabla-trabajadores td {
    white-space: normal;
}

#tabla-trabajadores td {
    overflow-wrap: anywhere;
}

/* ==========================================================
   13. MENSAJES / CAJAS AUXILIARES
   ========================================================== */

.message-box {
    margin-top: 16px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    border: 1px solid transparent;
}

.message-info {
    background: #e9f5ff;
    color: #005cbf;
    border-color: #b8daff;
}

.message-success {
    background: #e8f5e9;
    color: #1e7e34;
    border-color: #c3e6cb;
}

.message-danger {
    background: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

.hidden {
    display: none;
}

.api-box {
    margin: 0;
    padding: 14px;
    background: #f8f9fa;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: #343a40;
    min-height: 70px;
    overflow: auto;
}

.paradas-box,
.totals-box,
.search-box {
    margin-top: 18px;
    margin-bottom: 18px;
}

.paradas-box {
    background: #f8f9fa;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
}

.totals-box {
    padding: 13px 15px;
    background: #f8f9fa;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-weight: 800;
    color: #343a40;
}

.advanced-panel {
    margin: 18px 0;
    padding: 20px;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    background: #f8f9fa;
}

/* ==========================================================
   14. LISTAS
   ========================================================== */

.check-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.check-list li {
    padding: 9px 0;
    border-bottom: 1px solid #edf0f2;
}

.check-list li::before {
    content: "✓";
    color: var(--success);
    font-weight: 900;
    margin-right: 8px;
}

.check-list li:last-child {
    border-bottom: 0;
}

.check-list.muted li::before {
    color: var(--info);
}

/* ==========================================================
   15. BOTÓN CAMBIO DE TEMA
   ========================================================== */

#theme-toggle-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 32px;
    cursor: pointer;
    margin-left: 8px;
    flex-shrink: 0;
}

#theme-toggle-button i {
    line-height: 1;
}

/* ==========================================================
   16. FOCUS VISIBLE / ACCESIBILIDAD
   ========================================================== */

.btn:focus-visible,
.menu-link:focus-visible,
.sidebar-toggle:focus-visible,
.brand-toggle-icon:focus-visible,
.back-dashboard:focus-visible,
#theme-toggle-button:focus-within,
.form-group input:focus-visible,
.form-group select:focus-visible,
.form-group textarea:focus-visible {
    outline: 3px solid rgba(0, 123, 255, 0.35);
    outline-offset: 2px;
}

/* ==========================================================
   17. TEMA OSCURO
   ========================================================== */

body.dark-theme {
    --body-bg: #111827;
    --sidebar-bg: #0f172a;
    --sidebar-dark: #020617;
    --sidebar-text: #cbd5e1;
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --success: #22c55e;
    --info: #06b6d4;
    --warning: #facc15;
    --danger: #ef4444;
    --dark: #f8fafc;
    --muted: #94a3b8;
    --border: #334155;
    --card-bg: #1f2937;
    --surface-bg: #1f2937;
    --input-bg: #111827;
    --table-header-bg: #111827;
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    --shadow-strong: 0 8px 18px rgba(37, 99, 235, 0.28);

    background: var(--body-bg);
    color: var(--dark);
}

body.dark-theme .app-shell,
body.dark-theme .main-area,
body.dark-theme .content {
    background: var(--body-bg);
}

body.dark-theme .sidebar {
    background: var(--sidebar-bg);
}

body.dark-theme .sidebar-footer {
    background: rgba(255, 255, 255, 0.05);
}

body.dark-theme .menu-link:hover {
    background: rgba(255, 255, 255, 0.08);
}

body.dark-theme .menu-link.active {
    background: linear-gradient(135deg, #2563eb, #1e40af);
}

body.dark-theme.sidebar-collapsed .brand-toggle-icon::after {
    background: #020617;
    color: #f8fafc;
    border: 1px solid #334155;
}

body.dark-theme .topbar {
    background: var(--surface-bg);
    border-bottom-color: var(--border);
}

body.dark-theme .topbar h2,
body.dark-theme .card h1,
body.dark-theme .card h2,
body.dark-theme .card h3 {
    color: #f8fafc;
}

body.dark-theme .topbar p,
body.dark-theme .small-muted {
    color: var(--muted);
}

body.dark-theme .status-pill {
    background: #14532d;
    color: #dcfce7;
    border-color: #22c55e;
}

body.dark-theme .back-dashboard {
    background: #1e3a8a;
    color: #dbeafe;
    border-color: #3b82f6;
}

body.dark-theme .back-dashboard:hover {
    background: #2563eb;
    color: #ffffff;
}

body.dark-theme .card {
    background: var(--card-bg);
    border-color: var(--border);
    color: var(--dark);
    box-shadow: var(--shadow);
}

body.dark-theme .card p {
    color: #cbd5e1;
}

body.dark-theme .stat-card {
    box-shadow: var(--shadow);
}

body.dark-theme .stat-primary {
    background: linear-gradient(135deg, #1d4ed8, #1e3a8a);
}

body.dark-theme .stat-success {
    background: linear-gradient(135deg, #15803d, #14532d);
}

body.dark-theme .stat-info {
    background: linear-gradient(135deg, #0e7490, #164e63);
}

body.dark-theme .stat-warning {
    background: linear-gradient(135deg, #a16207, #78350f);
    color: #fef3c7;
}

body.dark-theme .stat-danger {
    background: linear-gradient(135deg, #b91c1c, #7f1d1d);
    color: #fee2e2;
}

body.dark-theme .form-group label {
    color: #f8fafc;
}

body.dark-theme .form-group input,
body.dark-theme .form-group select,
body.dark-theme .form-group textarea {
    background: var(--input-bg);
    color: #f8fafc;
    border-color: #475569;
}

body.dark-theme .form-group input::placeholder,
body.dark-theme .form-group textarea::placeholder {
    color: #94a3b8;
}

body.dark-theme .form-group input:focus,
body.dark-theme .form-group select:focus,
body.dark-theme .form-group textarea:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.18);
}

body.dark-theme .table-wrapper {
    border-color: var(--border);
}

body.dark-theme .table {
    background: var(--surface-bg);
    color: #f8fafc;
}

body.dark-theme .table th {
    background: var(--table-header-bg);
    color: #e5e7eb;
    border-bottom-color: var(--border);
}

body.dark-theme .table td {
    border-bottom-color: #334155;
    color: #e5e7eb;
}

body.dark-theme .table tbody tr:hover {
    background: #334155;
}

body.dark-theme .api-box,
body.dark-theme .paradas-box,
body.dark-theme .totals-box,
body.dark-theme .advanced-panel {
    background: #111827;
    border-color: #334155;
    color: #f8fafc;
}

body.dark-theme .text-danger {
    color: #fca5a5;
}

body.dark-theme .badge {
    background: #14532d;
    color: #dcfce7;
    border-color: #22c55e;
}

body.dark-theme .badge-blue {
    background: #1e3a8a;
    color: #dbeafe;
    border-color: #3b82f6;
}

body.dark-theme .pill-success {
    background: #14532d;
    color: #dcfce7;
    border-color: #22c55e;
}

body.dark-theme .pill-warning,
body.dark-theme .pill-manual {
    background: #713f12;
    color: #fef3c7;
    border-color: #facc15;
}

body.dark-theme .pill-info {
    background: #164e63;
    color: #cffafe;
    border-color: #06b6d4;
}

body.dark-theme .pill-muted {
    background: #334155;
    color: #e5e7eb;
    border-color: #64748b;
}

body.dark-theme .tag {
    background: #1e3a8a;
    color: #dbeafe;
    border-color: #3b82f6;
}

body.dark-theme .message-info {
    background: #1e3a5f;
    color: #dbeafe;
    border-color: #2563eb;
}

body.dark-theme .message-success {
    background: #14532d;
    color: #dcfce7;
    border-color: #22c55e;
}

body.dark-theme .message-danger {
    background: #7f1d1d;
    color: #fee2e2;
    border-color: #ef4444;
}

body.dark-theme .btn-light {
    background: #334155;
    color: #f8fafc;
    border-color: #475569;
}

body.dark-theme .btn-light:hover {
    background: #475569;
}

body.dark-theme .btn-secondary {
    background: #475569;
    color: #ffffff;
}

body.dark-theme .btn-secondary:hover {
    background: #64748b;
}

body.dark-theme .check-list li {
    border-bottom-color: #334155;
    color: #e5e7eb;
}

body.dark-theme .btn:focus-visible,
body.dark-theme .menu-link:focus-visible,
body.dark-theme .sidebar-toggle:focus-visible,
body.dark-theme .brand-toggle-icon:focus-visible,
body.dark-theme .back-dashboard:focus-visible,
body.dark-theme #theme-toggle-button:focus-within,
body.dark-theme .form-group input:focus-visible,
body.dark-theme .form-group select:focus-visible,
body.dark-theme .form-group textarea:focus-visible {
    outline-color: rgba(96, 165, 250, 0.55);
}

body.dark-theme ::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

body.dark-theme ::-webkit-scrollbar-track {
    background: #111827;
}

body.dark-theme ::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 999px;
}

body.dark-theme ::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

/* ==========================================================
   18. RESPONSIVE
   ========================================================== */

@media (max-width: 1980px) {
    .grid.grid-2 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1200px) {
    #tbody-desplazamientos {
        font-size: 13px;
    }

    #tbody-desplazamientos td,
    #tbody-desplazamientos th {
        padding: 9px 7px;
    }
}

@media (max-width: 1100px) {
    .form-row-3,
    .form-row-4,
    .form-row-5 {
        grid-template-columns: 1fr;
    }

    .span-2 {
        grid-column: span 1;
    }
}

@media (max-width: 950px) {
    #tbody-desplazamientos {
        font-size: 12px;
    }

    #tbody-desplazamientos td {
        padding: 7px 5px;
    }

    #tbody-desplazamientos .btn-small {
        padding: 5px 7px;
        font-size: 11px;
    }

    #tbody-desplazamientos td:nth-child(2) {
        max-width: 180px;
        white-space: normal;
        word-break: break-word;
    }

    #tbody-desplazamientos td:nth-child(7) {
        max-width: 120px;
        white-space: normal;
        word-break: break-word;
    }

    .table-liquidaciones th,
    .table-liquidaciones td {
        padding: 7px 5px;
        font-size: 11.5px;
    }

    .table-liquidaciones .btn-small {
        padding: 5px 6px;
        font-size: 10.5px;
    }

    .table-liquidaciones th:nth-child(7),
    .table-liquidaciones td:nth-child(7) {
        display: none;
    }
}

@media (max-width: 900px) {
    .app-shell {
        flex-direction: column;
    }

    .sidebar {
        position: relative;
        top: auto;
        width: 100%;
        height: auto;
        overflow-y: visible;
        padding: 18px;
    }

    .sidebar-footer {
        display: none;
    }

    .brand {
        flex-direction: row;
        justify-content: space-between;
    }

    .menu {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: stretch;
    }

    .menu-link {
        transform: none !important;
    }

    .menu-link.active::before {
        display: none;
    }

    .main-area {
        min-height: auto;
    }

    .topbar {
        height: auto;
        min-height: auto;
        align-items: flex-start;
        gap: 12px;
        flex-direction: column;
    }

    .topbar-right {
        width: 100%;
        flex-wrap: wrap;
    }

    .content {
        padding: 22px 18px 28px;
        min-height: auto;
    }

    .content > section {
        margin-bottom: 22px;
    }

    .grid,
    .grid-2,
    .grid-3 {
        grid-template-columns: 1fr;
        gap: 18px;
        margin-bottom: 22px;
    }

    .card {
        padding: 20px;
    }

    body.sidebar-collapsed .sidebar {
        width: 100%;
        padding: 18px;
    }

    body.sidebar-collapsed .brand {
        flex-direction: row;
        justify-content: space-between;
    }

    body.sidebar-collapsed .brand-text,
    body.sidebar-collapsed .sidebar-toggle,
    body.sidebar-collapsed .menu-text,
    body.sidebar-collapsed .sidebar-footer {
        opacity: 1;
        width: auto;
        max-width: none;
        flex: initial;
        overflow: visible;
        pointer-events: auto;
    }

    body.sidebar-collapsed .brand-toggle-icon {
        pointer-events: none;
        cursor: default;
    }

    body.sidebar-collapsed .brand-toggle-icon i {
        font-size: 22px;
    }

    body.sidebar-collapsed .brand-toggle-icon i::before {
        content: "\f29a";
        font-family: "bootstrap-icons";
        font-size: 22px;
    }

    body.sidebar-collapsed .brand-toggle-icon::after {
        display: none;
    }

    body.sidebar-collapsed .menu {
        align-items: stretch;
    }

    body.sidebar-collapsed .menu-link {
        width: auto;
        height: auto;
        justify-content: flex-start;
        padding: 12px 13px;
        gap: 11px;
    }

    body.sidebar-collapsed .menu-icon {
        width: 26px;
        height: 26px;
        flex: 0 0 26px;
    }

    #theme-toggle-button {
        margin-left: 0;
    }
}

@media (max-width: 800px) {
    #tabla-trabajadores {
        font-size: 13px;
    }

    #tabla-trabajadores th,
    #tabla-trabajadores td {
        padding: 9px 7px;
    }

    #tabla-trabajadores .btn-small {
        padding: 5px 7px;
        font-size: 11px;
    }
}

@media (max-width: 760px) {
    .table-liquidaciones th:nth-child(4),
    .table-liquidaciones td:nth-child(4),
    .table-liquidaciones th:nth-child(5),
    .table-liquidaciones td:nth-child(5) {
        display: none;
    }

    .table-liquidaciones th:nth-child(8),
    .table-liquidaciones td:nth-child(8) {
        width: 115px;
    }
}

/* ==========================================================
   MIGRACION ADMINLTE
   ========================================================== */

.app-header .nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
}

.app-sidebar .brand-link {
    min-height: 57px;
    text-decoration: none;
}

.app-sidebar .brand-image {
    width: auto;
    max-height: 34px;
    margin-left: 0.8rem;
    margin-right: 0.5rem;
}

.sidebar-menu .nav-link p {
    margin: 0;
}

.sidebar-menu .nav-header {
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    opacity: 0.75;
}

.app-header .nav-link.btn {
    border: 0;
    background: transparent;
}

.app-header {
    overflow: visible;
}

.app-header .navbar-nav {
    min-width: 0;
}

.user-menu {
    position: relative;
}

.user-menu .user-dropdown-menu {
    right: 0;
    left: auto;
    width: min(320px, calc(100vw - 2rem));
    max-width: calc(100vw - 2rem);
    overflow: hidden;
    border-radius: 0.75rem;
}

.user-dropdown-menu .user-header {
    min-height: auto;
    padding: 1rem;
    text-align: center;
}

.user-dropdown-menu .user-avatar {
    margin-bottom: 0.5rem;
    font-size: 2.4rem;
    line-height: 1;
}

.user-dropdown-menu .user-footer {
    padding: 0.75rem;
}

html,
body,
.app-main,
.app-content {
    max-width: 100%;
    overflow-x: hidden;
}

.app-wrapper {
    max-width: 100%;
    overflow: visible;
}

.app-content {
    padding-bottom: 1.5rem;
}

.app-content .container-fluid {
    max-width: 100%;
}

.app-content-header {
    padding-top: 1rem;
    padding-bottom: 0.75rem;
}

.app-footer {
    font-size: 0.875rem;
}

.sidebar-menu .nav-link.active {
    font-weight: 600;
}

.sidebar-menu .nav-link.active .nav-icon {
    opacity: 1;
}

.app-content .container-fluid > section,
.app-content .container-fluid > .grid {
    margin-bottom: 24px;
}

.app-content .container-fluid > section:last-child,
.app-content .container-fluid > .grid:last-child {
    margin-bottom: 0;
}

.app-content .card {
    border-radius: 0.25rem;
}

.app-content .card-header {
    gap: 12px;
}

.app-content .badge {
    border-radius: 0.25rem;
}

.table-wrapper {
    border-radius: 0.25rem;
}

.table {
    margin-bottom: 0;
}

.btn {
    border-radius: 0.25rem;
}

.message-box.alert {
    margin-top: 12px;
}

body.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f4f6f9;
}

body.login-page .login-box {
    position: static;
    width: min(92vw, 380px);
    padding: 0;
    background: transparent;
    box-shadow: none;
    transform: none;
}

body.login-page .login-logo a {
    color: #495057;
    text-decoration: none;
}

body.login-page .card {
    padding: 0;
    border-radius: 0.25rem;
}

body.login-page .card-header {
    justify-content: center;
    margin-bottom: 0;
}

body.login-page .login-card-body {
    padding: 20px;
}

body.login-page .input-group .form-control {
    min-height: 42px;
}

body.login-page .btn {
    min-height: 42px;
}

[data-bs-theme="dark"] body,
body.dark-theme {
    --body-bg: #15191f;
    --card-bg: #1f2937;
    --surface-bg: #1f2937;
    --input-bg: #111827;
    --table-header-bg: #111827;
    --border: #334155;
    --dark: #f8fafc;
    --muted: #94a3b8;
}

[data-bs-theme="dark"] body.login-page {
    background: #15191f;
}

@media (max-width: 620px) {
    #tabla-trabajadores th:nth-child(2),
    #tabla-trabajadores td:nth-child(2) {
        display: none;
    }
}

@media (max-width: 520px) {
    .menu {
        grid-template-columns: 1fr;
    }

    .topbar h2 {
        font-size: 21px;
    }

    .status-pill {
        width: fit-content;
    }

    .actions-inline {
        flex-direction: column;
        align-items: stretch;
    }

    .actions-inline .btn {
        width: 100%;
    }

    #tabla-trabajadores th:nth-child(3),
    #tabla-trabajadores td:nth-child(3) {
        display: none;
    }
}

/* ==========================================================
   19. REDUCCIÓN DE MOVIMIENTO
   ========================================================== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}

/* ==========================================================
   SIDEBAR - CONFIGURACIÓN
   ========================================================== */

.sidebar-config {
    cursor: pointer;
    transition:
        background 0.18s ease,
        transform 0.18s ease,
        box-shadow 0.18s ease;
}

.sidebar-config:hover {
    background: rgba(255, 255, 255, 0.10);
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.16);
}

.sidebar-config .sidebar-footer-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-config .sidebar-footer-title i {
    font-size: 16px;
}

/* ==========================================================
   LOGIN
   ========================================================== */

.login-page {
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(circle at top left, rgba(0, 123, 255, 0.22), transparent 32%),
        radial-gradient(circle at bottom right, rgba(23, 162, 184, 0.18), transparent 34%),
        #111827;
    color: #ffffff;
}

.login-background {
    min-height: 100vh;
    position: relative;
}

.login-box {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 400px;
    max-width: calc(100vw - 32px);
    padding: 40px;
    transform: translate(-50%, -50%);
    background: rgba(24, 20, 20, 0.987);
    box-sizing: border-box;
    box-shadow: 0 15px 25px rgba(0, 0, 0, 0.6);
    border-radius: 10px;
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 34px;
}

.login-brand-icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 8px 18px rgba(0, 123, 255, 0.35);
}

.login-brand-icon i {
    font-size: 23px;
}

.login-brand h1 {
    margin: 0;
    font-size: 24px;
    color: #ffffff;
}

.login-brand p {
    margin: 3px 0 0;
    color: #bdb8b8;
    font-size: 13px;
    font-weight: 700;
}

.login-error {
    background: rgba(220, 53, 69, 0.18);
    border: 1px solid rgba(220, 53, 69, 0.65);
    color: #ffd7dc;
    padding: 11px 13px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 24px;
}

.login-box .user-box {
    position: relative;
}

.login-box .user-box input {
    width: 100%;
    padding: 10px 0;
    font-size: 16px;
    color: #ffffff;
    margin-bottom: 30px;
    border: none;
    border-bottom: 1px solid #ffffff;
    outline: none;
    background: transparent;
}

.login-box .user-box label {
    position: absolute;
    top: 0;
    left: 0;
    padding: 10px 0;
    font-size: 16px;
    color: #ffffff;
    pointer-events: none;
    transition: 0.5s;
}

.login-box .user-box input:focus ~ label,
.login-box .user-box input:valid ~ label {
    top: -20px;
    left: 0;
    color: #bdb8b8;
    font-size: 12px;
}

.login-actions {
    display: flex;
    justify-content: center;
}

.login-submit {
    position: relative;
    display: inline-block;
    padding: 10px 20px;
    color: #ffffff;
    background: transparent;
    border: 0;
    font-family: inherit;
    font-size: 16px;
    text-decoration: none;
    text-transform: uppercase;
    overflow: hidden;
    transition: 0.5s;
    margin-top: 40px;
    letter-spacing: 4px;
    cursor: pointer;
}

.login-submit:hover {
    background: #03f40f;
    color: #ffffff;
    border-radius: 5px;
    box-shadow:
        0 0 5px #03f40f,
        0 0 25px #03f40f,
        0 0 50px #03f40f,
        0 0 100px #03f40f;
}

.login-submit span {
    position: absolute;
    display: block;
}

.login-submit span:nth-child(1) {
    bottom: 2px;
    left: -100%;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, #03f40f);
    animation: btn-anim1 2s linear infinite;
}

@keyframes btn-anim1 {
    0% {
        left: -100%;
    }

    50%,
    100% {
        left: 100%;
    }
}

.login-submit:focus-visible,
.login-box .user-box input:focus-visible {
    outline: 3px solid rgba(3, 244, 15, 0.35);
    outline-offset: 4px;
}

@media (max-width: 520px) {
    .login-box {
        padding: 30px 24px;
    }

    .login-brand h1 {
        font-size: 21px;
    }

    .login-submit {
        font-size: 14px;
        letter-spacing: 3px;
    }
}

/* ==========================================================
   SIDEBAR - USUARIO / LOGOUT
   ========================================================== */

.sidebar-logout {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-top: 10px;
    color: #ffffff;
    text-decoration: none;
    font-size: 13px;
    font-weight: 800;
    opacity: 0.85;
    transition:
        opacity 0.18s ease,
        transform 0.18s ease,
        color 0.18s ease;
}

.sidebar-logout:hover {
    opacity: 1;
    color: #ffffff;
    transform: translateX(2px);
}

body.sidebar-collapsed .sidebar-logout {
    opacity: 0;
    width: 0;
    max-width: 0;
    overflow: hidden;
    pointer-events: none;
}

body.dark-theme .sidebar-logout {
    color: #f8fafc;
}

/* ==========================================================
   CONFIGURACIÓN - USUARIOS Y PERMISOS
   ========================================================== */

.permissions-box {
    margin-top: 18px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #f8f9fa;
}

.permissions-header {
    margin-bottom: 16px;
}

.permissions-header h4 {
    margin: 0 0 6px;
    color: var(--dark);
    font-size: 17px;
}

.permissions-header p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.permission-group {
    margin-bottom: 18px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #ffffff;
}

.permission-group:last-child {
    margin-bottom: 0;
}

.permission-group h4 {
    margin: 0 0 12px;
    font-size: 15px;
    color: var(--primary);
}

.permission-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.permission-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px;
    border: 1px solid #edf0f2;
    border-radius: 9px;
    background: #fbfcfd;
    cursor: pointer;
    transition:
        background 0.16s ease,
        border-color 0.16s ease,
        transform 0.16s ease,
        box-shadow 0.16s ease;
}

.permission-item:hover {
    background: #f1f7ff;
    border-color: #b8daff;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 123, 255, 0.10);
}

.permission-item input {
    margin-top: 3px;
    flex: 0 0 auto;
    cursor: pointer;
}

.permission-item span {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.permission-item strong {
    color: #343a40;
    font-size: 14px;
}

.permission-item small {
    color: var(--muted);
    line-height: 1.35;
}

.permission-item:has(input:checked) {
    background: #e9f5ff;
    border-color: #7abaff;
}

.permission-item:has(input:checked) strong {
    color: #005cbf;
}

.permissions-disabled {
    opacity: 0.72;
}

.permissions-disabled .permission-item {
    cursor: not-allowed;
}

.permissions-disabled .permission-item:hover {
    transform: none;
    box-shadow: none;
}

.permissions-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.permissions-summary-group {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #f8f9fa;
}

.permissions-summary-group h4 {
    margin: 0 0 10px;
    color: var(--primary);
    font-size: 16px;
}

.permissions-summary-group ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.permissions-summary-group li {
    padding: 8px 0;
    border-bottom: 1px solid #e9ecef;
}

.permissions-summary-group li:last-child {
    border-bottom: 0;
}

.permissions-summary-group strong {
    display: block;
    font-size: 14px;
    color: #343a40;
}

#tabla-usuarios {
    min-width: 0;
}

#tabla-usuarios th,
#tabla-usuarios td {
    white-space: normal;
}

#tabla-usuarios td {
    overflow-wrap: anywhere;
}

/* Configuración en tema oscuro */

body.dark-theme .permissions-box,
body.dark-theme .permission-group,
body.dark-theme .permissions-summary-group {
    background: #111827;
    border-color: #334155;
}

body.dark-theme .permissions-header h4,
body.dark-theme .permission-item strong,
body.dark-theme .permissions-summary-group strong {
    color: #f8fafc;
}

body.dark-theme .permissions-header p,
body.dark-theme .permission-item small {
    color: #94a3b8;
}

body.dark-theme .permission-group h4,
body.dark-theme .permissions-summary-group h4 {
    color: #60a5fa;
}

body.dark-theme .permission-item {
    background: #1f2937;
    border-color: #334155;
}

body.dark-theme .permission-item:hover {
    background: #243447;
    border-color: #3b82f6;
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.14);
}

body.dark-theme .permission-item:has(input:checked) {
    background: #1e3a8a;
    border-color: #60a5fa;
}

body.dark-theme .permission-item:has(input:checked) strong {
    color: #dbeafe;
}

body.dark-theme .permissions-summary-group li {
    border-bottom-color: #334155;
}

/* Responsive configuración */

@media (max-width: 1300px) {
    .permissions-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .permission-list {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .permissions-summary {
        grid-template-columns: 1fr;
    }

    #tabla-usuarios {
        font-size: 13px;
    }

    #tabla-usuarios th,
    #tabla-usuarios td {
        padding: 9px 7px;
    }

    #tabla-usuarios .btn-small {
        padding: 5px 7px;
        font-size: 11px;
    }
}

@media (max-width: 620px) {
    #tabla-usuarios th:nth-child(3),
    #tabla-usuarios td:nth-child(3) {
        display: none;
    }
}

/* ==========================================================
   DASHBOARD - GRÁFICOS Y RESUMEN
   ========================================================== */

.dashboard-filter-card {
    margin-bottom: 24px;
}

.dashboard-filter {
    display: flex;
    align-items: center;
    gap: 10px;
}

.dashboard-filter label {
    font-weight: 800;
    color: #343a40;
}

.dashboard-filter select {
    min-width: 120px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 9px 12px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    background: var(--input-bg);
    color: var(--dark);
    outline: none;
}

.dashboard-filter select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.12);
}

.grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.dashboard-stats {
    align-items: stretch;
}

.dashboard-stats .stat-card {
    min-height: 135px;
}

.dashboard-stats .stat-card small {
    display: block;
    margin-top: 6px;
    color: rgba(255, 255, 255, 0.82);
    font-size: 13px;
    font-weight: 700;
}

.dashboard-charts {
    align-items: stretch;
}

.chart-card {
    min-height: 390px;
    display: flex;
    flex-direction: column;
}

.chart-card .card-header {
    margin-bottom: 10px;
}

.chart-wrapper {
    position: relative;
    flex: 1;
    min-height: 280px;
    width: 100%;
}

.chart-wrapper-small {
    min-height: 300px;
}

.chart-wrapper canvas {
    width: 100% !important;
    height: 100% !important;
}

#tabla-dashboard-liquidaciones {
    min-width: 0;
}

#tabla-dashboard-liquidaciones th,
#tabla-dashboard-liquidaciones td {
    white-space: normal;
}

#tabla-dashboard-liquidaciones td {
    overflow-wrap: anywhere;
}

#tabla-dashboard-liquidaciones td:nth-child(5),
#tabla-dashboard-liquidaciones td:nth-child(6) {
    font-weight: 800;
}

#dashboard-sin-datos {
    border-style: dashed;
}

/* Dashboard en tema oscuro */

body.dark-theme .dashboard-filter label {
    color: #f8fafc;
}

[data-bs-theme="dark"] .dashboard-filter label {
    color: #f8fafc;
}

body.dark-theme .dashboard-filter select {
    background: var(--input-bg);
    color: #f8fafc;
    border-color: #475569;
}

body.dark-theme .dashboard-filter select:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.18);
}

/* Responsive Dashboard */

@media (max-width: 1500px) {
    .grid-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 1100px) {
    .dashboard-charts {
        grid-template-columns: 1fr;
    }

    .chart-card {
        min-height: 360px;
    }

    .chart-wrapper,
    .chart-wrapper-small {
        min-height: 260px;
    }
}

@media (max-width: 760px) {
    .dashboard-filter-card .card-header {
        flex-direction: column;
        gap: 14px;
    }

    .dashboard-filter {
        width: 100%;
        align-items: stretch;
        flex-direction: column;
    }

    .dashboard-filter select {
        width: 100%;
    }

    .grid-4 {
        grid-template-columns: 1fr;
    }

    .chart-card {
        min-height: 330px;
    }

    .chart-wrapper,
    .chart-wrapper-small {
        min-height: 230px;
    }

    #tabla-dashboard-liquidaciones {
        font-size: 13px;
    }

    #tabla-dashboard-liquidaciones th,
    #tabla-dashboard-liquidaciones td {
        padding: 9px 7px;
    }
}

@media (max-width: 620px) {
    #tabla-dashboard-liquidaciones th:nth-child(4),
    #tabla-dashboard-liquidaciones td:nth-child(4) {
        display: none;
    }
}

@media (max-width: 520px) {
    #tabla-dashboard-liquidaciones th:nth-child(1),
    #tabla-dashboard-liquidaciones td:nth-child(1) {
        max-width: 130px;
    }

    #tabla-dashboard-liquidaciones th:nth-child(6),
    #tabla-dashboard-liquidaciones td:nth-child(6) {
        display: none;
    }
}

/* ==========================================================
   DASHBOARD - DOS COLUMNAS A PARTIR DE 1300PX
   ========================================================== */

@media (min-width: 1301px) {
    .dashboard-charts.grid-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    #dashboard-graficos-admin.grid-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-stats.grid-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 1300px) {
    .dashboard-charts.grid-2,
    #dashboard-graficos-admin.grid-2,
    .dashboard-stats.grid-4 {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================
   PERMISOS - ELEMENTOS DESHABILITADOS
   ========================================================== */

.is-disabled-by-permission {
    opacity: 0.55;
    cursor: not-allowed !important;
    pointer-events: none;
}

.permission-hidden {
    display: none !important;
}

/* Ayuda contextual disponible en todas las pantallas. */
.mimca-context-help {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.15rem;
    height: 1.15rem;
    margin-left: 0.35rem;
    vertical-align: middle;
    color: #075985;
    background: #e0f2fe;
    border: 1px solid #38bdf8;
    border-radius: 50%;
    cursor: help;
    font-size: 0.72rem;
    line-height: 1;
    outline: none;
}

.mimca-context-help::after {
    position: absolute;
    z-index: calc(var(--z-tooltip) + 1);
    bottom: calc(100% + 8px);
    left: 50%;
    width: max-content;
    max-width: min(300px, calc(100vw - 32px));
    padding: 8px 10px;
    color: #ffffff;
    background: #0f172a;
    border-radius: 7px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.28);
    content: attr(data-help);
    font-size: 0.8rem;
    font-weight: 500;
    line-height: 1.35;
    text-align: left;
    white-space: normal;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 4px);
    transition: opacity 0.15s ease, transform 0.15s ease;
    visibility: hidden;
}

.mimca-context-help:hover::after,
.mimca-context-help:focus-visible::after,
.mimca-context-help.is-open::after {
    opacity: 1;
    transform: translate(-50%, 0);
    visibility: visible;
}

.btn .mimca-context-help,
button .mimca-context-help {
    flex: 0 0 auto;
    margin-left: 0.45rem;
    color: currentColor;
    background: rgba(255, 255, 255, 0.18);
    border-color: currentColor;
}

body.dark-theme .mimca-context-help {
    color: #bae6fd;
    background: rgba(14, 116, 144, 0.3);
    border-color: #38bdf8;
}

/* ==========================================================
   CONFIGURACIÓN - TABS, USUARIOS Y AJUSTES
   ========================================================== */

.config-hero {
    margin-bottom: 24px;
}

.config-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.config-tab {
    border: 1px solid var(--border);
    background: var(--surface-bg);
    color: var(--dark);
    border-radius: 999px;
    padding: 10px 15px;
    font-family: inherit;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition:
        background 0.18s ease,
        color 0.18s ease,
        border-color 0.18s ease,
        transform 0.18s ease,
        box-shadow 0.18s ease;
}

.config-tab:hover {
    transform: translateY(-1px);
    border-color: var(--primary);
    color: var(--primary);
}

.config-tab.active {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 8px 18px rgba(0, 123, 255, 0.22);
}

.config-panel {
    display: none;
}

.config-panel.active {
    display: block;
    animation: fadeSlideIn 0.22s ease both;
}

.config-intro .card-body {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.config-help-badge {
    flex: 0 0 auto;
    color: #075985;
    background: #e0f2fe;
    border: 1px solid #7dd3fc;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 0.85rem;
    font-weight: 700;
}

.config-inline-help {
    border: 1px solid #93c5fd;
    border-radius: 8px;
    background: #eff6ff;
    color: #1e3a5f;
    padding: 10px 12px;
}

.config-inline-help summary {
    cursor: pointer;
    font-weight: 700;
}

.config-inline-help-content {
    margin-top: 10px;
    color: inherit;
}

.config-workspace-nav {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
}

.config-workspace-tab {
    min-height: 94px;
    padding: 12px;
    text-align: left;
    color: var(--dark);
    background: var(--surface-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.config-workspace-tab:hover {
    border-color: var(--primary);
}

.config-workspace-tab.active {
    color: #ffffff;
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 8px 18px rgba(0, 123, 255, 0.2);
}

.config-workspace-tab i,
.config-workspace-tab span,
.config-workspace-tab small {
    display: block;
}

.config-workspace-tab i {
    margin-bottom: 7px;
    font-size: 1.15rem;
}

.config-workspace-tab span {
    font-weight: 800;
}

.config-workspace-tab small {
    margin-top: 2px;
    opacity: 0.78;
}

.config-adjustment-section {
    display: none;
}

.config-adjustment-section.active {
    display: block;
    animation: fadeSlideIn 0.18s ease both;
}

@media (max-width: 1100px) {
    .config-workspace-nav {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

body.dark-theme .config-help-badge {
    color: #bae6fd;
    background: rgba(14, 116, 144, 0.25);
    border-color: #0e7490;
}

body.dark-theme .config-inline-help {
    color: #dbeafe;
    background: rgba(30, 64, 175, 0.2);
    border-color: #1d4ed8;
}

body.dark-theme .config-workspace-tab {
    color: var(--bs-body-color);
    background: var(--bs-body-bg);
}

body.dark-theme .config-workspace-tab.active {
    color: #ffffff;
    background: var(--primary);
}

.config-users-grid {
    align-items: start;
}

.permissions-box {
    margin-top: 18px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #f8f9fa;
}

.permissions-header h4 {
    margin: 0 0 6px;
    color: var(--dark);
}

.permissions-header p {
    margin: 0 0 14px;
    color: var(--muted);
}

.permission-group {
    margin-bottom: 18px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-bg);
}

.permission-group:last-child {
    margin-bottom: 0;
}

.permission-group h4 {
    margin: 0 0 10px;
    color: var(--dark);
}

.permission-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.permission-item {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 11px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--card-bg);
    cursor: pointer;
    transition:
        border-color 0.18s ease,
        background 0.18s ease,
        transform 0.18s ease;
}

.permission-item:hover {
    border-color: var(--primary);
    transform: translateY(-1px);
}

.permission-item input {
    margin-top: 4px;
}

.permission-item span {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.permission-item strong {
    color: var(--dark);
    font-size: 14px;
}

.permission-item small {
    color: var(--muted);
    line-height: 1.35;
}

.permissions-disabled {
    opacity: 0.78;
}

.permissions-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.permissions-summary-group {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    background: var(--surface-bg);
}

.permissions-summary-group h4 {
    margin: 0 0 12px;
    color: var(--dark);
}

.permissions-summary-group ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.permissions-summary-group li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #edf0f2;
}

.permissions-summary-group li:last-child {
    border-bottom: 0;
}

.permissions-summary-group li div {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.permissions-summary-group li strong {
    color: var(--dark);
}

.permissions-summary-group li small {
    color: var(--muted);
}

.config-permission-code {
    align-self: flex-start;
    border-radius: 999px;
    background: #e9f5ff;
    color: #005cbf;
    border: 1px solid #b8daff;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.config-setting-card {
    min-height: 220px;
}

.config-setting-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: #e9f5ff;
    color: var(--primary);
    font-size: 24px;
    margin-bottom: 14px;
}

.config-info-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 14px;
}

.config-info-grid div {
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.config-info-grid strong {
    color: var(--dark);
}

.config-info-grid span {
    color: var(--muted);
    font-weight: 700;
}

/* Configuración en tema oscuro */

body.dark-theme .config-tab {
    background: #111827;
    color: #f8fafc;
    border-color: #334155;
}

body.dark-theme .config-tab:hover {
    border-color: #60a5fa;
    color: #dbeafe;
}

body.dark-theme .config-tab.active {
    background: #2563eb;
    color: #ffffff;
    border-color: #3b82f6;
}

body.dark-theme .permissions-box {
    background: #111827;
    border-color: #334155;
}

body.dark-theme .permission-group,
body.dark-theme .permission-item,
body.dark-theme .permissions-summary-group {
    background: #1f2937;
    border-color: #334155;
}

body.dark-theme .permission-group h4,
body.dark-theme .permission-item strong,
body.dark-theme .permissions-summary-group h4,
body.dark-theme .permissions-summary-group li strong,
body.dark-theme .config-info-grid strong {
    color: #f8fafc;
}

body.dark-theme .permissions-summary-group li {
    border-bottom-color: #334155;
}

body.dark-theme .config-permission-code {
    background: #1e3a8a;
    color: #dbeafe;
    border-color: #3b82f6;
}

body.dark-theme .config-setting-icon {
    background: #1e3a8a;
    color: #dbeafe;
}

body.dark-theme .config-info-grid div {
    background: #111827;
    border-color: #334155;
}

/* Responsive configuración */

@media (max-width: 1500px) {
    .permission-list,
    .permissions-summary {
        grid-template-columns: 1fr;
    }

    .config-info-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .config-intro .card-body {
        align-items: flex-start;
        flex-direction: column;
    }

    .config-workspace-nav {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .config-workspace-tab {
        min-height: 82px;
    }

    .config-tabs {
        flex-direction: column;
    }

    .config-tab {
        width: 100%;
        justify-content: center;
    }

    .permissions-box {
        padding: 14px;
    }

    .config-info-grid {
        grid-template-columns: 1fr;
    }

    #tabla-usuarios {
        font-size: 13px;
    }

    #tabla-usuarios th,
    #tabla-usuarios td {
        padding: 9px 7px;
    }
}

html[data-bs-theme="dark"] body,
body.dark-mode,
body.dark-theme {
    background-color: #121212;
    color: #e9ecef;
}

html[data-bs-theme="dark"] .content-wrapper,
body.dark-mode .content-wrapper,
body.dark-theme .content-wrapper,
html[data-bs-theme="dark"] .app-main,
body.dark-mode .app-main,
body.dark-theme .app-main,
html[data-bs-theme="dark"] .app-content,
body.dark-mode .app-content,
body.dark-theme .app-content {
    background-color: #121212;
    color: #e9ecef;
}

html[data-bs-theme="dark"] .card,
body.dark-mode .card,
body.dark-theme .card {
    background-color: #1f1f1f;
    color: #e9ecef;
    border-color: #343a40;
}

html[data-bs-theme="dark"] .table,
body.dark-mode .table,
body.dark-theme .table {
    color: #e9ecef;
}

html[data-bs-theme="dark"] .form-control,
html[data-bs-theme="dark"] .form-select,
body.dark-mode .form-control,
body.dark-mode .form-select,
body.dark-theme .form-control,
body.dark-theme .form-select {
    background-color: #2b2b2b;
    color: #e9ecef;
    border-color: #495057;
}

html[data-bs-theme="dark"] .form-control::placeholder,
body.dark-mode .form-control::placeholder,
body.dark-theme .form-control::placeholder {
    color: #adb5bd;
}

.chart-container {
    position: relative;
    min-height: 280px;
    width: 100%;
}

.chart-container-small {
    min-height: 300px;
}

.chart-container canvas {
    width: 100% !important;
    min-height: 260px;
}

.dashboard-chart {
    position: relative;
    height: 320px;
    width: 100%;
}

.dashboard-chart canvas {
    width: 100% !important;
    height: 100% !important;
}

.small-box .icon {
    opacity: 0.35;
}

.dashboard-stats {
    row-gap: 1rem;
}

.dashboard-kpi-row {
    display: grid !important;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-left: 0;
    margin-right: 0;
}

.dashboard-kpi-row > .col {
    display: flex;
    width: auto;
    max-width: none;
    min-width: 0;
}

.dashboard-kpi-card,
.dashboard-kpi-row > .stat-card,
.dashboard-kpi-row > .col > .stat-card {
    height: 100%;
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: 0 0.125rem 0.35rem rgba(0, 0, 0, 0.08);
}

.dashboard-kpi-row > .col > .stat-card {
    width: 100%;
    min-width: 0;
    min-height: 108px;
    padding: 0.75rem;
}

.dashboard-kpi-card .inner,
.dashboard-kpi-row > .stat-card > div:first-child,
.dashboard-kpi-row > .col > .stat-card > div:first-child {
    padding: 1.25rem 1.25rem;
}

.dashboard-kpi-row > .col > .stat-card > div:first-child {
    min-width: 0;
    padding: 0;
}

.dashboard-kpi-card h3,
.dashboard-kpi-row > .stat-card h3,
.dashboard-kpi-row > .col > .stat-card h3 {
    margin-bottom: 0.35rem;
}

.dashboard-kpi-card p,
.dashboard-kpi-row > .stat-card p,
.dashboard-kpi-row > .col > .stat-card p {
    margin-bottom: 0.65rem;
}

.dashboard-kpi-row > .col > .stat-card p {
    margin-bottom: 0.25rem;
    font-size: 0.82rem;
    line-height: 1.15;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-kpi-row > .col > .stat-card h3 {
    font-size: 1.45rem;
    line-height: 1.1;
}

.dashboard-kpi-row > .col > .stat-card small {
    margin-top: 0;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.15;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-kpi-row > .col > .stat-card .stat-icon {
    flex: 0 0 auto;
    margin-left: 0.5rem;
    font-size: 2rem;
}

.dashboard-stats > .stat-card {
    flex: 0 0 auto;
    width: 100% !important;
    margin-bottom: 0;
}

.dashboard-stats > .stat-card .stat-icon {
    opacity: 0.35;
}

.dashboard-filter {
    min-width: 190px;
}

html[data-bs-theme="dark"] .card,
body.dark-theme .card,
body.dark-mode .card {
    background-color: var(--bs-body-bg);
    color: var(--bs-body-color);
}

@media (min-width: 576px) {
    .dashboard-kpi-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-stats > .stat-card {
        width: 100% !important;
    }
}

@media (min-width: 992px) {
    .dashboard-kpi-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-stats > .stat-card {
        width: 100% !important;
    }
}

@media (min-width: 1200px) {
    .dashboard-kpi-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-stats > .stat-card {
        width: 100% !important;
    }
}

@media (max-width: 575.98px) {
    .dashboard-filter-card .card-header {
        align-items: stretch;
        flex-direction: column;
    }

    .dashboard-filter-card .card-tools,
    .dashboard-filter {
        width: 100%;
    }
}

.workers-page .form-label {
    font-weight: 600;
}

.workers-page #tabla-trabajadores th:last-child,
.workers-page #tabla-trabajadores td:last-child {
    text-align: right;
    white-space: nowrap;
}

.workers-page #tabla-trabajadores td {
    vertical-align: middle;
}

.tools-card > .card-body {
    min-height: 180px;
}

.tools-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tools-result-card .message-box {
    white-space: pre-wrap;
}

.kilometros-action-card > .card-body {
    min-height: 210px;
}

#resultado-destino {
    white-space: pre-wrap;
}

.kilometros-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.kilometros-table td {
    vertical-align: middle;
}

.kilometros-table th:last-child,
.kilometros-table td:last-child {
    text-align: right;
    white-space: nowrap;
}

.liquidaciones-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.table-liquidaciones td {
    vertical-align: middle;
}

.table-liquidaciones th:last-child,
.table-liquidaciones td:last-child {
    text-align: right;
    white-space: nowrap;
}

.liquidaciones-totales {
    margin: 0;
    text-align: right;
}

.config-tabs-card .config-tabs {
    gap: 0;
    margin-top: 0;
}

.config-tabs-card .config-tab {
    border-radius: 0.25rem 0.25rem 0 0;
    padding: 0.625rem 1rem;
    font-weight: 500;
    box-shadow: none;
    transform: none;
}

.config-tabs-card .config-tab:hover {
    transform: none;
}

.config-tabs-card .config-tab.active {
    box-shadow: none;
}

.config-section-card {
    height: 100%;
}

.config-section-card .form-label {
    font-weight: 600;
}

.config-section-card #tabla-usuarios th:last-child,
.config-section-card #tabla-usuarios td:last-child {
    text-align: right;
    white-space: nowrap;
}

body.dark-theme .config-tabs-card .config-tab {
    background: transparent;
}

body.dark-theme .config-tabs-card .config-tab.active {
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
    border-color: var(--bs-border-color) var(--bs-border-color) var(--bs-body-bg);
}

@media (max-width: 575.98px) {
    .workers-page .card-body > .text-secondary {
        font-size: 0.875rem;
    }

    .workers-page .btn {
        flex: 1 1 auto;
    }

    .config-tabs-card .config-tabs {
        flex-direction: column;
    }

    .config-tabs-card .config-tab {
        width: 100%;
        justify-content: flex-start;
        border-radius: 0.25rem;
    }
}

/* ==========================================================
   Sidebar AdminLTE no fija, con fondo lateral continuo
   ========================================================== */

html,
body {
    min-height: 100%;
    overflow-x: hidden;
}

body {
    min-height: 100vh;
}

.app-wrapper {
    position: relative;
    min-height: 100vh;
}

/* En escritorio mantenemos el fondo lateral continuo. En móvil AdminLTE
   necesita conservar su sidebar fija para que el overlay no capture los toques. */
@media (min-width: 992px) {
    .app-sidebar {
        position: relative !important;
        top: auto !important;
        bottom: auto !important;
        height: auto !important;
        min-height: 100vh;
        overflow: visible;
        z-index: 1038;
    }

    .app-sidebar .sidebar-wrapper {
        height: auto !important;
        min-height: auto !important;
        overflow: visible;
    }
}

@media (min-width: 992px) {
    .app-wrapper::before {
        content: "";
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        width: var(--lte-sidebar-width, 250px);
        background-color: #343a40;
        box-shadow: none !important;
        pointer-events: none;
        transition: width 0.3s ease-in-out;
        z-index: 0;
    }

    body.sidebar-collapse .app-wrapper::before,
    body.sidebar-mini.sidebar-collapse .app-wrapper::before,
    .sidebar-collapse .app-wrapper::before {
        width: 0;
    }

    .app-sidebar {
        background-color: #343a40;
        box-shadow: none !important;
    }

    .app-sidebar::before,
    .app-sidebar::after {
        display: none !important;
    }

    .app-main,
    .app-header,
    .app-footer,
    .app-sidebar {
        position: relative;
        z-index: 1;
    }
}

@media (max-width: 991.98px) {
    .app-wrapper::before {
        display: none;
    }
}

/* ==========================================================
   Navbar: dropdown de usuario siempre en primer plano
   ========================================================== */

.app-header {
    position: relative;
    overflow: visible;
    z-index: 3000;
}

.app-header .container-fluid,
.app-header .navbar-nav,
.app-header .nav-item,
.navbar-user-menu {
    overflow: visible;
}

.navbar-user-menu {
    position: relative;
    z-index: 3100;
}

.user-menu .user-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    left: auto;
    width: min(320px, calc(100vw - 2rem));
    max-width: calc(100vw - 2rem);
    overflow: hidden;
    border-radius: 0.75rem;
    box-shadow: 0 0.75rem 1.5rem rgba(0, 0, 0, 0.22);
    z-index: 3200 !important;
}

.dropdown-menu.show {
    z-index: 4000 !important;
}

.app-main,
.app-content,
.app-content-header,
.card,
.table-responsive {
    position: relative;
    z-index: 1;
}

.app-sidebar {
    /* Debe quedar por encima del overlay móvil de AdminLTE (1037). */
    z-index: 1038;
}

.app-sidebar,
.app-wrapper::before {
    backface-visibility: hidden;
}

.app-sidebar.shadow,
.app-sidebar .shadow {
    box-shadow: none !important;
}

/* AdminLTE crea un overlay al abrir el menú por debajo de 992 px. La sidebar
   debe conservar su posición fija y quedar por encima para que sus enlaces y
   submenús reciban los toques. */
@media (max-width: 991.98px) {
    body.sidebar-open .app-sidebar {
        position: fixed !important;
        top: 0 !important;
        bottom: 0 !important;
        z-index: 1040 !important;
        pointer-events: auto !important;
    }

    body.sidebar-open .app-sidebar .sidebar-wrapper {
        height: calc(100vh - 3.5rem - 1px) !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
    }

    body.sidebar-open .sidebar-overlay {
        z-index: 1037 !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .app-wrapper::before {
        transition: none;
    }
}

/* ==========================================================
   Sidebar MIMCA
   ========================================================== */

.app-sidebar .mimca-brand-image {
    width: 36px;
    height: 36px;
    max-height: 36px;
    margin-right: 0.25rem;
    padding: 2px;
    object-fit: cover;
    background-color: #fff;
    border-radius: 50%;
}

.sidebar-brand .brand-link {
    gap: 0.25rem;
}

.sidebar-brand .brand-text {
    letter-spacing: 0.04em;
}

.sidebar-menu .nav-treeview .nav-link {
    padding-left: 2.25rem;
}

.sidebar-menu .nav-treeview .nav-icon {
    font-size: 0.65rem;
}

.sidebar-menu .nav-item.menu-open > .nav-link .nav-arrow {
    transform: rotate(90deg);
}

.sidebar-menu .nav-arrow {
    margin-left: auto;
    transition: transform 0.2s ease-in-out;
}

@media (prefers-reduced-motion: reduce) {
    .sidebar-menu .nav-arrow {
        transition: none;
    }
}

/* ==========================================================
   Login MIMCA
   ========================================================== */

body.login-page .login-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
}

body.login-page .login-brand-image {
    width: 82px;
    height: 82px;
    margin-bottom: 0.75rem;
    padding: 4px;
    object-fit: cover;
    background-color: #fff;
    border-radius: 50%;
    box-shadow: 0 0.35rem 1rem rgba(0, 0, 0, 0.18);
}

body.login-page .login-brand-title {
    margin: 0;
    color: var(--bs-body-color);
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 0.08em;
}

body.login-page .login-brand-subtitle {
    margin: 0.25rem 0 0;
    color: var(--bs-secondary-color);
    font-size: 0.95rem;
    font-weight: 400;
}

/* ==========================================================
   Kilómetros: modal mapa de ruta
   ========================================================== */

.mapa-ruta-contenedor {
    width: 100%;
    height: 520px;
    min-height: 420px;
    overflow: hidden;
    background-color: var(--bs-secondary-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.75rem;
}

@media (max-width: 767.98px) {
    .mapa-ruta-contenedor {
        height: 420px;
        min-height: 360px;
    }
}

/* ==========================================================
   Kilómetros: modal mapa estable sobre AdminLTE
   ========================================================== */

#modal-mapa-ruta {
    z-index: 3060 !important;
}

#modal-mapa-ruta.show {
    display: block;
}

.modal-backdrop {
    z-index: 3050 !important;
}

#modal-mapa-ruta .modal-dialog,
#modal-mapa-ruta .modal-content {
    position: relative;
    z-index: 3070 !important;
}

#modal-mapa-ruta .modal-body {
    position: relative;
    z-index: 1;
}

#modal-mapa-ruta .modal-header,
#modal-mapa-ruta .modal-footer {
    position: relative;
    z-index: 20;
}

#modal-mapa-ruta .leaflet-container {
    position: relative;
    z-index: 1 !important;
}

#modal-mapa-ruta .leaflet-pane,
#modal-mapa-ruta .leaflet-map-pane,
#modal-mapa-ruta .leaflet-tile-pane,
#modal-mapa-ruta .leaflet-overlay-pane,
#modal-mapa-ruta .leaflet-marker-pane,
#modal-mapa-ruta .leaflet-shadow-pane,
#modal-mapa-ruta .leaflet-popup-pane {
    z-index: auto !important;
}

#modal-mapa-ruta .leaflet-top,
#modal-mapa-ruta .leaflet-bottom {
    z-index: 10 !important;
}

/* ==========================================================
   Permisos y Vacaciones: tarjetas de acciones
   ========================================================== */

.permisos-acciones-row > [class*="col-"] {
    display: flex;
}

.permisos-acciones-row .card {
    width: 100%;
}

.permisos-acciones-row .card-body {
    min-height: 190px;
}

.permisos-acciones-row .btn {
    min-height: 38px;
}

/* ==========================================================
   FIX MODALES BOOTSTRAP + ADMINLTE / PYWEBVIEW
   ========================================================== */

.modal-backdrop {
    --bs-backdrop-zindex: 1990 !important;
    z-index: 1990 !important;
}

.modal {
    --bs-modal-zindex: 2000 !important;
    z-index: 2000 !important;
}

.modal.show {
    display: block !important;
}

.modal-dialog {
    z-index: 2010 !important;
    position: relative;
}

body.modal-open {
    overflow: hidden;
}

.btn-accion-solicitud {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.calendario-permisos-wrapper {
    overflow-x: auto;
}

.calendario-permisos-cabecera,
.calendario-permisos-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(140px, 1fr));
    min-width: 980px;
}

.calendario-permisos-cabecera {
    border: 1px solid var(--bs-border-color);
    border-bottom: 0;
    border-radius: 0.5rem 0.5rem 0 0;
    overflow: hidden;
}

.calendario-permisos-cabecera > div {
    padding: 0.65rem;
    text-align: center;
    font-weight: 600;
    background: var(--bs-tertiary-bg);
    border-right: 1px solid var(--bs-border-color);
}

.calendario-permisos-cabecera > div:last-child {
    border-right: 0;
}

.calendario-dia {
    min-height: 135px;
    padding: 0.45rem;
    border-right: 1px solid var(--bs-border-color);
    border-bottom: 1px solid var(--bs-border-color);
    background: var(--bs-body-bg);
    position: relative;
}

.calendario-dia:nth-child(7n + 1) {
    border-left: 1px solid var(--bs-border-color);
}

.calendario-dia-fuera-mes {
    background: var(--bs-tertiary-bg);
    opacity: 0.65;
}

.calendario-dia-fin-semana {
    background-color: rgba(
        var(--bs-secondary-rgb),
        0.05
    );
}

.calendario-dia-hoy {
    box-shadow: inset 0 0 0 2px
        var(--bs-primary);
}

.calendario-dia-numero {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.35rem;
    font-weight: 600;
}

.calendario-festivo {
    display: block;
    margin-bottom: 0.35rem;
    padding: 0.15rem 0.35rem;
    border-radius: 0.25rem;
    background: rgba(
        var(--bs-danger-rgb),
        0.12
    );
    color: var(--bs-danger-text-emphasis);
    font-size: 0.72rem;
    line-height: 1.2;
}

.calendario-evento {
    width: 100%;
    display: block;
    border: 0;
    border-left: 4px solid transparent;
    border-radius: 0.3rem;
    margin-bottom: 0.3rem;
    padding: 0.3rem 0.4rem;
    text-align: left;
    font-size: 0.75rem;
    line-height: 1.2;
    cursor: pointer;
    color: var(--bs-body-color);
    background: var(--bs-secondary-bg);
}

.calendario-evento:hover {
    filter: brightness(0.96);
}

.calendario-evento-trabajador,
.calendario-evento-tipo {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.calendario-evento-trabajador {
    font-weight: 600;
}

.calendario-evento-estado {
    display: inline-block;
    margin-top: 0.2rem;
    font-size: 0.68rem;
    opacity: 0.8;
}

.calendario-mas-eventos {
    border: 0;
    background: transparent;
    padding: 0;
    font-size: 0.72rem;
    color: var(--bs-primary);
}

/* ==========================================================
   Selector de zoom
   ========================================================== */

.zoom-menu {
    position: relative;
}

.zoom-dropdown-menu {
    width: 320px;
    max-width: calc(100vw - 24px);
}

.zoom-control-button {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 34px;
}

#zoom-selector {
    min-width: 150px;
    margin: 0;
}

#zoom-porcentaje {
    min-width: 58px;
    text-align: center;
}

@media (max-width: 575.98px) {
    .zoom-dropdown-menu {
        width: 280px;
    }

    #zoom-selector {
        min-width: 110px;
    }
}

/* ==========================================================
   Calendario mensual de teletrabajo
   ========================================================== */

.teletrabajo-calendario {
    min-width: 760px;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.75rem;
    overflow: hidden;
    background: var(--bs-body-bg);
}

.teletrabajo-calendario-cabecera,
.teletrabajo-calendario-semana {
    display: grid;
    grid-template-columns: repeat(7, minmax(95px, 1fr));
}

.teletrabajo-calendario-cabecera {
    background: var(--bs-tertiary-bg);
    border-bottom: 1px solid var(--bs-border-color);
}

.teletrabajo-calendario-cabecera-dia {
    padding: 0.75rem;
    text-align: center;
    font-weight: 600;
    font-size: 0.875rem;
}

.teletrabajo-calendario-semana {
    position: relative;
    border-bottom: 1px solid var(--bs-border-color);
}

.teletrabajo-calendario-semana:last-child {
    border-bottom: 0;
}

.teletrabajo-dia {
    min-height: 108px;
    padding: 0.65rem;
    border-right: 1px solid var(--bs-border-color);
    background: var(--bs-body-bg);
    position: relative;
    cursor: pointer;
    user-select: none;
    transition:
        background-color 0.15s ease,
        box-shadow 0.15s ease,
        transform 0.15s ease;
}

.teletrabajo-dia:nth-child(7n) {
    border-right: 0;
}

.teletrabajo-dia:hover:not(
    .teletrabajo-dia-bloqueado
):not(
    .teletrabajo-dia-fuera-mes
) {
    box-shadow: inset 0 0 0 2px
        var(--bs-primary);
}

.teletrabajo-dia-disponible {
    background: var(--bs-body-bg);
}

.teletrabajo-dia-seleccionado {
    background: rgba(
        var(--bs-primary-rgb),
        0.16
    );
    box-shadow: inset 0 0 0 2px
        var(--bs-primary);
}

.teletrabajo-dia-guardado {
    background: rgba(
        var(--bs-success-rgb),
        0.14
    );
}

.teletrabajo-dia-bloqueado {
    background: var(--bs-tertiary-bg);
    cursor: not-allowed;
    opacity: 0.72;
}

.teletrabajo-dia-fuera-mes {
    background: var(--bs-secondary-bg);
    opacity: 0.65;
    cursor: default;
}

.teletrabajo-dia-numero {
    font-size: 1rem;
    font-weight: 700;
}

.teletrabajo-dia-etiqueta {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.5rem;
    padding: 0.2rem 0.45rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
}

.teletrabajo-dia-etiqueta-seleccionado {
    background: var(--bs-primary);
    color: white;
}

.teletrabajo-dia-etiqueta-guardado {
    background: var(--bs-success);
    color: white;
}

.teletrabajo-dia-motivo {
    margin-top: 0.5rem;
    font-size: 0.72rem;
    color: var(--bs-secondary-color);
}

.teletrabajo-semana-resumen {
    grid-column: 1 / -1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.45rem 0.75rem;
    background: var(--bs-tertiary-bg);
    border-top: 1px solid var(--bs-border-color);
    font-size: 0.8rem;
}

.teletrabajo-leyenda-color {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 1px solid var(--bs-border-color);
}

.teletrabajo-leyenda-disponible {
    background: var(--bs-body-bg);
}

.teletrabajo-leyenda-seleccionado {
    background: rgba(
        var(--bs-primary-rgb),
        0.25
    );
}

.teletrabajo-leyenda-guardado {
    background: rgba(
        var(--bs-success-rgb),
        0.25
    );
}

.teletrabajo-leyenda-bloqueado {
    background: var(--bs-tertiary-bg);
}

@media (max-width: 767.98px) {
    .teletrabajo-dia {
        min-height: 92px;
        padding: 0.5rem;
    }
}

/* Festivos, ausencias y conflictos de Teletrabajo */

.teletrabajo-dia-festivo {
    background: rgba(
        var(--bs-danger-rgb),
        0.10
    );
}

.teletrabajo-dia-ausencia {
    background: rgba(
        var(--bs-warning-rgb),
        0.14
    );
}

.teletrabajo-dia-conflicto {
    border-width: 2px;
    border-style: solid;
    background: rgba(
        var(--bs-danger-rgb),
        0.16
    );
}

.teletrabajo-dia-conflicto-detalle {
    width: 100%;
    margin-top: 0.5rem;
    padding: 0.5rem;
    border-radius: 0.375rem;
    background: var(--bs-danger-bg-subtle);
    color: var(--bs-danger-text-emphasis);
    font-size: 0.78rem;
}

.teletrabajo-dia-conflicto-detalle
.btn {
    white-space: normal;
}

[data-bs-theme="dark"]
.teletrabajo-dia-conflicto-detalle {
    background: rgba(220, 53, 69, 0.18);
}

.teletrabajo-dia-conflicto::after {
    content: "!";
    position: absolute;
    top: 0.4rem;
    right: 0.4rem;
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--bs-danger);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
}

.teletrabajo-dia-etiqueta-festivo {
    background: var(--bs-danger);
    color: white;
}

.teletrabajo-dia-etiqueta-ausencia {
    background: var(--bs-warning);
    color: var(--bs-dark);
}

.teletrabajo-dia-etiqueta-conflicto {
    background: var(--bs-danger);
    color: white;
}

.teletrabajo-dia-descripcion {
    margin-top: 0.35rem;
    font-size: 0.7rem;
    line-height: 1.25;
    color: var(--bs-secondary-color);
    overflow-wrap: anywhere;
}

.teletrabajo-leyenda-festivo {
    background: rgba(
        var(--bs-danger-rgb),
        0.25
    );
}

.teletrabajo-leyenda-ausencia {
    background: rgba(
        var(--bs-warning-rgb),
        0.30
    );
}

.teletrabajo-leyenda-conflicto {
    background: rgba(
        var(--bs-danger-rgb),
        0.40
    );
    border-color: var(--bs-danger);
}

.cambio-teletrabajo-opciones {
    display: grid;
    grid-template-columns:
        repeat(7, minmax(85px, 1fr));
    gap: 0.5rem;
}

.cambio-teletrabajo-opcion {
    min-height: 110px;
    padding: 0.7rem 0.45rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0.2rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.65rem;
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
    transition:
        border-color 0.15s ease,
        background-color 0.15s ease,
        box-shadow 0.15s ease;
}

.cambio-teletrabajo-opcion:not(:disabled):hover {
    border-color: var(--bs-primary);
    box-shadow:
        0 0 0 2px rgba(
            var(--bs-primary-rgb),
            0.15
        );
}

.cambio-teletrabajo-opcion.active {
    border-color: var(--bs-primary);
    background: rgba(
        var(--bs-primary-rgb),
        0.15
    );
    box-shadow:
        inset 0 0 0 1px var(--bs-primary);
}

.cambio-teletrabajo-opcion:disabled {
    opacity: 0.58;
    cursor: not-allowed;
    background: var(--bs-tertiary-bg);
}

.cambio-teletrabajo-opcion-original {
    border-color: var(--bs-info);
    background: rgba(
        var(--bs-info-rgb),
        0.12
    );
}

@media (max-width: 767.98px) {
    .cambio-teletrabajo-opciones {
        grid-template-columns:
            repeat(2, minmax(120px, 1fr));
    }
}

/* ==========================================================
   Calendario mensual
   ========================================================== */

.calendario-mensual {
    min-width: 900px;
}

.calendario-cabecera,
.calendario-semana {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
}

.calendario-cabecera {
    border-bottom: 1px solid var(--bs-border-color);
}

.calendario-cabecera-dia {
    padding: 0.75rem;
    font-weight: 600;
    text-align: center;
}

.calendario-dia {
    min-height: 135px;
    padding: 0.5rem;
    border-right: 1px solid var(--bs-border-color);
    border-bottom: 1px solid var(--bs-border-color);
    background: var(--bs-body-bg);
}

.calendario-dia:nth-child(7n) {
    border-right: 0;
}

.calendario-dia-externo {
    opacity: 0.5;
}

.calendario-dia-hoy {
    box-shadow: inset 0 0 0 2px var(--bs-primary);
}

.calendario-dia-conflicto {
    box-shadow: inset 0 0 0 3px var(--bs-danger);
}

.calendario-dia-hoy.calendario-dia-conflicto {
    outline: 2px solid var(--bs-primary);
    outline-offset: -5px;
}

.calendario-conflicto-aviso {
    display: flex;
    gap: 0.35rem;
    align-items: center;
    margin-bottom: 0.4rem;
    padding: 0.2rem 0.35rem;
    border: 1px solid var(--bs-danger);
    border-radius: 0.25rem;
    color: var(--bs-danger-text-emphasis);
    font-size: 0.75rem;
    font-weight: 600;
}

.calendario-dia-numero {
    margin-bottom: 0.4rem;
    font-weight: 600;
}

.calendario-dia-eventos {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.calendario-evento {
    width: 100%;
    padding: 0.3rem 0.45rem;
    border: 0;
    border-radius: 0.35rem;
    text-align: left;
    font-size: 0.78rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.calendario-evento-permisos,
.calendario-evento-permiso {
    background: var(--bs-info-bg-subtle);
    color: var(--bs-info-text-emphasis);
}

.calendario-evento-teletrabajo {
    background: var(--bs-success-bg-subtle);
    color: var(--bs-success-text-emphasis);
}

.calendario-evento-festivos,
.calendario-evento-festivo {
    background: var(--bs-warning-bg-subtle);
    color: var(--bs-warning-text-emphasis);
}

.calendario-evento-conflicto {
    box-shadow: inset 0 0 0 2px var(--bs-danger);
    white-space: normal;
}

.calendario-evento-pendiente {
    border: 1px dashed currentColor;
    opacity: 0.82;
}

.calendario-evento-teletrabajo_cambio {
    background: var(--bs-secondary-bg);
    color: var(--bs-secondary-color);
}

.calendario-evento small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.teletrabajo-dia-destacado {
    outline: 3px solid var(--bs-primary);
    outline-offset: -3px;
}

.calendario-leyenda-item {
    display: inline-flex;
    gap: 0.4rem;
    align-items: center;
    font-size: 0.875rem;
}

.calendario-leyenda-marca {
    width: 1rem;
    height: 1rem;
    border-radius: 0.25rem;
    display: inline-block;
}

.card-body:has(.calendario-mensual) {
    overflow-x: auto;
}

.calendario-evento-festivos,
.calendario-evento-festivo_nacional,
.calendario-evento-festivo_autonomico,
.calendario-evento-festivo_entidad,
.calendario-evento-festivo_local {
    background: var(--bs-warning-bg-subtle);
    color: var(--bs-warning-text-emphasis);
}

@media (max-width: 991.98px) {
    .calendario-dia {
        min-height: 110px;
    }
}
/* Liquidaciones: acciones sin desbordes en tamaños intermedios. */
.liquidations-action-buttons { min-width: 0; }
.liquidations-action-buttons .btn { white-space: nowrap; }
@media (min-width: 768px) and (max-width: 1330px) {
  .liquidations-action-buttons { flex-direction: column; }
  .liquidations-action-buttons .btn { width: 100%; }
}

[data-bs-theme="dark"] { --bs-body-color:#e7edf6; --bs-secondary-color:#b7c3d4; --bs-tertiary-color:#9eacc0; }
[data-bs-theme="dark"] .card, [data-bs-theme="dark"] .modal-content { color:#e7edf6; background:#1f2937; border-color:#3b4a60; }
[data-bs-theme="dark"] .table { --bs-table-color:#e7edf6; --bs-table-striped-color:#e7edf6; --bs-table-hover-color:#fff; --bs-table-bg:#1f2937; --bs-table-striped-bg:#263348; --bs-table-hover-bg:#33435b; }
[data-bs-theme="dark"] .form-control, [data-bs-theme="dark"] .form-select, [data-bs-theme="dark"] .input-group-text { color:#f4f7fb; background:#182231; border-color:#53657e; }
[data-bs-theme="dark"] .text-secondary, [data-bs-theme="dark"] .form-text { color:#c2cede !important; }
.modal { z-index: 2000; }
.modal-backdrop { z-index: 1990; }
.mapa-ruta-contenedor { min-height: 420px; border-radius: .5rem; overflow: hidden; }

/* Contraste tipográfico consistente en todos los tamaños de pantalla. */
:root,
[data-bs-theme="light"] {
    --dark: #111827;
    --muted: #4b5563;
    --bs-body-color: #1f2937;
    --bs-emphasis-color: #111827;
    --bs-secondary-color: #4b5563;
    --bs-tertiary-color: #5b6573;
}

[data-bs-theme="dark"],
body.dark-theme,
body.dark-mode {
    --dark: #f8fafc;
    --muted: #cbd5e1;
    --bs-body-color: #f1f5f9;
    --bs-emphasis-color: #ffffff;
    --bs-secondary-color: #cbd5e1;
    --bs-tertiary-color: #b6c2d1;
}

[data-bs-theme="light"] .text-secondary,
[data-bs-theme="light"] .form-text,
[data-bs-theme="light"] .text-muted {
    color: #4b5563 !important;
}

[data-bs-theme="dark"] .text-secondary,
[data-bs-theme="dark"] .form-text,
[data-bs-theme="dark"] .text-muted,
body.dark-theme .text-secondary,
body.dark-theme .form-text,
body.dark-theme .text-muted,
body.dark-mode .text-secondary,
body.dark-mode .form-text,
body.dark-mode .text-muted {
    color: #cbd5e1 !important;
}

[data-bs-theme="dark"] .form-label,
[data-bs-theme="dark"] label,
body.dark-theme .form-label,
body.dark-theme label,
body.dark-mode .form-label,
body.dark-mode label {
    color: #f1f5f9;
}

body.dark-mode,
body.dark-mode .app-main,
body.dark-mode .app-content,
body.dark-mode .app-header,
body.dark-mode .app-footer,
body.dark-mode .card,
body.dark-mode .modal-content {
    color: #f1f5f9;
}
