/* Identidad visual compartida de Fichadas LM. Solo se activa con body.ui-modern. */
body.ui-modern {
    --ui-primary: #c67c1f;
    --ui-primary-hover: #d98a29;
    --ui-primary-active: #a96317;
    --ui-primary-soft: rgba(198, 124, 31, 0.11);
    --ui-bg: #f4f5f7;
    --ui-surface: #ffffff;
    --ui-surface-raised: #ffffff;
    --ui-surface-muted: #f8f8f9;
    --ui-border: #e1e3e7;
    --ui-border-strong: #d1d4da;
    --ui-text: #202124;
    --ui-muted: #6c727f;
    --ui-danger: #d83b4e;
    --ui-danger-soft: rgba(216, 59, 78, 0.09);
    --ui-success: #238260;
    --ui-success-soft: rgba(35, 130, 96, 0.09);
    --ui-warning: #9a641b;
    --ui-warning-soft: rgba(198, 124, 31, 0.12);
    min-height: 100vh;
    background: var(--ui-bg);
    color: var(--ui-text);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html.dark-theme body.ui-modern {
    --ui-bg: #121315;
    --ui-surface: #1a1c1f;
    --ui-surface-raised: #202226;
    --ui-surface-muted: #17191c;
    --ui-border: #303339;
    --ui-border-strong: #3a3e45;
    --ui-text: #f3f4f6;
    --ui-muted: #a4a9b2;
    --ui-danger: #f05263;
    --ui-danger-soft: rgba(240, 82, 99, 0.12);
    --ui-success: #45b58a;
    --ui-success-soft: rgba(69, 181, 138, 0.11);
    --ui-warning: #ffb557;
    --ui-warning-soft: rgba(255, 181, 87, 0.11);
    background: var(--ui-bg) !important;
    color: var(--ui-text);
}

body.ui-modern > .navbar,
body.ui-modern > nav.navbar {
    min-height: 58px;
    background: #17181b !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
}

body.ui-modern > .navbar .container,
body.ui-modern > nav.navbar .container {
    gap: 1rem;
}

body.ui-modern .navbar-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 750;
    letter-spacing: -0.025em;
}

body.ui-modern .navbar-brand .brand-tag {
    color: #ffffff !important;
}

body.ui-modern .navbar .nav-link {
    border-radius: 7px;
    transition: background-color 140ms ease, color 140ms ease;
}

body.ui-modern .navbar .nav-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff !important;
}

body.ui-modern h1,
body.ui-modern h2,
body.ui-modern h3,
body.ui-modern h4,
body.ui-modern h5,
body.ui-modern h6 {
    color: var(--ui-text);
    letter-spacing: -0.022em;
}

body.ui-modern h2 {
    font-size: clamp(1.45rem, 2vw, 1.85rem);
    font-weight: 730;
    letter-spacing: -0.035em;
}

body.ui-modern .text-muted,
body.ui-modern .form-text {
    color: var(--ui-muted) !important;
}

body.ui-modern .card {
    overflow: hidden;
    background: var(--ui-surface);
    border: 1px solid var(--ui-border);
    border-radius: 14px;
    color: var(--ui-text);
    box-shadow: 0 8px 26px rgba(20, 22, 26, 0.055);
}

html.dark-theme body.ui-modern .card {
    background: var(--ui-surface);
    border-color: var(--ui-border);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
}

body.ui-modern .card-header,
html.dark-theme body.ui-modern .card-header {
    min-height: 48px;
    padding: 0.78rem 1rem;
    background: var(--ui-surface-raised) !important;
    border-bottom: 1px solid var(--ui-border);
    color: var(--ui-text);
}

body.ui-modern .card-header h4,
body.ui-modern .card-header h5,
body.ui-modern .card-header h6,
body.ui-modern .card-header .card-title {
    margin-bottom: 0;
    font-weight: 690;
}

body.ui-modern .card-body,
html.dark-theme body.ui-modern .card-body {
    background: var(--ui-surface);
    color: var(--ui-text);
}

body.ui-modern .card.border-warning {
    border-color: rgba(198, 124, 31, 0.42) !important;
}

body.ui-modern .border,
body.ui-modern hr {
    border-color: var(--ui-border) !important;
}

body.ui-modern .btn {
    border-radius: 8px;
    font-weight: 620;
    letter-spacing: -0.01em;
    box-shadow: none !important;
    transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease, transform 140ms ease;
}

body.ui-modern .btn:hover:not(:disabled) {
    transform: translateY(-1px);
}

body.ui-modern .btn:focus-visible {
    outline: 3px solid rgba(198, 124, 31, 0.25);
    outline-offset: 2px;
}

/* Cerrar sesión: botón de salida visible, compacto y con efecto rojo. */
body.ui-modern .button2,
body.ui-modern a[href="logout.php"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    position: relative;
    overflow: hidden;
    z-index: 1;
    padding: 0.42rem 0.78rem;
    color: #ffffff !important;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.2;
    border: 1px solid var(--ui-danger) !important;
    border-radius: 0.5rem;
    background: var(--ui-danger) !important;
    box-shadow: 4px 4px 10px rgba(216, 59, 78, 0.2), -3px -3px 8px rgba(255, 255, 255, 0.08);
    transition: all 0.2s ease-in;
}

body.ui-modern .button2::before,
body.ui-modern a[href="logout.php"]::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 100%;
    display: block;
    width: 140%;
    height: 180%;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.08);
    transform: translateX(-50%) scaleY(1) scaleX(1.25);
    transition: all 0.5s 0.1s cubic-bezier(0.55, 0, 0.1, 1);
    z-index: -1;
}

body.ui-modern .button2::after,
body.ui-modern a[href="logout.php"]::after {
    content: "";
    position: absolute;
    left: 55%;
    top: 180%;
    display: block;
    width: 160%;
    height: 190%;
    border-radius: 50%;
    background-color: #b52c40;
    transform: translateX(-50%) scaleY(1) scaleX(1.45);
    transition: all 0.5s 0.1s cubic-bezier(0.55, 0, 0.1, 1);
    z-index: -1;
}

body.ui-modern .button2:hover,
body.ui-modern a[href="logout.php"]:hover {
    color: #ffffff !important;
    border-color: #b52c40 !important;
    background: var(--ui-danger) !important;
    transform: translateY(-1px);
}

body.ui-modern .button2:hover::before,
body.ui-modern a[href="logout.php"]:hover::before {
    top: -35%;
    background-color: #b52c40;
    transform: translateX(-50%) scaleY(1.3) scaleX(0.8);
}

body.ui-modern .button2:hover::after,
body.ui-modern a[href="logout.php"]:hover::after {
    top: -45%;
    background-color: #b52c40;
    transform: translateX(-50%) scaleY(1.3) scaleX(0.8);
}

body.ui-modern .button2:active,
body.ui-modern a[href="logout.php"]:active {
    color: #ffffff !important;
    box-shadow: inset 3px 3px 9px rgba(120, 20, 35, 0.38), inset -3px -3px 9px rgba(255, 255, 255, 0.08);
}

body.ui-modern .btn-primary,
body.ui-modern .btn-outline-primary:hover {
    background: var(--ui-primary) !important;
    border-color: var(--ui-primary) !important;
    color: #fff !important;
}

body.ui-modern .btn-primary:hover {
    background: var(--ui-primary-hover) !important;
    border-color: var(--ui-primary-hover) !important;
}

body.ui-modern .btn-outline-primary {
    background: var(--ui-primary-soft);
    border-color: rgba(198, 124, 31, 0.42) !important;
    color: var(--ui-primary) !important;
}

body.ui-modern .btn-outline-secondary,
body.ui-modern .btn-outline-dark {
    background: transparent;
    border-color: var(--ui-border-strong);
    color: var(--ui-text);
}

body.ui-modern .btn-outline-secondary:hover,
body.ui-modern .btn-outline-dark:hover {
    background: var(--ui-surface-muted);
    border-color: var(--ui-muted);
    color: var(--ui-text);
}

body.ui-modern .btn-link {
    color: var(--ui-primary);
    text-decoration: none;
}

body.ui-modern .btn-success,
body.ui-modern .btn-outline-success:hover {
    background: var(--ui-success);
    border-color: var(--ui-success);
    color: #fff;
}

body.ui-modern .btn-outline-success {
    background: var(--ui-success-soft);
    border-color: rgba(35, 130, 96, 0.34);
    color: var(--ui-success);
}

body.ui-modern .btn-danger,
body.ui-modern .btn-outline-danger:hover {
    background: var(--ui-danger);
    border-color: var(--ui-danger);
    color: #fff;
}

body.ui-modern .btn-outline-danger {
    background: var(--ui-danger-soft);
    border-color: rgba(216, 59, 78, 0.38);
    color: var(--ui-danger);
}

body.ui-modern .badge {
    border-radius: 999px;
    padding: 0.38em 0.68em;
    font-weight: 700;
    letter-spacing: 0;
}

body.ui-modern .form-control,
body.ui-modern .form-select {
    min-height: 40px;
    background: var(--ui-surface-muted);
    border-color: var(--ui-border);
    border-radius: 9px;
    color: var(--ui-text);
}

body.ui-modern .form-control:focus,
body.ui-modern .form-select:focus {
    background: var(--ui-surface);
    border-color: var(--ui-primary);
    color: var(--ui-text);
    box-shadow: 0 0 0 3px rgba(198, 124, 31, 0.14);
}

body.ui-modern .form-control:disabled,
body.ui-modern .form-select:disabled {
    background: var(--ui-surface-muted);
    color: var(--ui-muted);
    opacity: 0.72;
}

body.ui-modern .form-check-input {
    border-color: var(--ui-border-strong);
}

body.ui-modern .form-check-input:checked {
    background-color: var(--ui-primary);
    border-color: var(--ui-primary);
}

body.ui-modern .input-group-text {
    background: var(--ui-surface-raised);
    border-color: var(--ui-border);
    color: var(--ui-muted);
}

body.ui-modern .table-responsive {
    scrollbar-color: var(--ui-border-strong) transparent;
}

body.ui-modern .table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--ui-text);
    --bs-table-striped-bg: var(--ui-surface-muted);
    --bs-table-striped-color: var(--ui-text);
    --bs-table-hover-bg: var(--ui-primary-soft);
    --bs-table-hover-color: var(--ui-text);
    margin-bottom: 0;
    color: var(--ui-text);
    border-color: var(--ui-border);
}

body.ui-modern .table > :not(caption) > * > * {
    border-bottom-color: var(--ui-border);
    color: inherit;
}

body.ui-modern .table thead th,
body.ui-modern .table .table-light th,
body.ui-modern .table thead.table-light th {
    padding-top: 0.72rem;
    padding-bottom: 0.72rem;
    background: var(--ui-surface-raised) !important;
    border-color: var(--ui-border) !important;
    color: var(--ui-muted) !important;
    font-size: 0.79rem;
    font-weight: 750;
    letter-spacing: 0.025em;
    vertical-align: middle;
}

body.ui-modern .table tbody td {
    padding-top: 0.68rem;
    padding-bottom: 0.68rem;
    vertical-align: middle;
}

body.ui-modern .table-bordered,
body.ui-modern .table-bordered th,
body.ui-modern .table-bordered td {
    border-color: var(--ui-border) !important;
}

body.ui-modern .table-dark,
body.ui-modern .table-dark > th,
body.ui-modern .table-dark > td {
    --bs-table-bg: #2b2e33;
    --bs-table-color: #fff;
}

body.ui-modern .list-group {
    overflow: hidden;
    border: 1px solid var(--ui-border);
    border-radius: 13px;
    box-shadow: 0 8px 24px rgba(20, 22, 26, 0.045);
}

body.ui-modern .list-group-item {
    padding: 0.72rem 0.9rem;
    background: var(--ui-surface);
    border-color: var(--ui-border);
    color: var(--ui-text);
    font-weight: 560;
}

body.ui-modern .list-group-item i {
    width: 1.2rem;
    color: var(--ui-muted);
    text-align: center;
}

body.ui-modern .list-group-item:hover {
    background: var(--ui-surface-muted);
    color: var(--ui-text);
}

body.ui-modern .list-group-item.active {
    background: var(--ui-primary) !important;
    border-color: var(--ui-primary) !important;
    color: #fff !important;
}

body.ui-modern .list-group-item.active i {
    color: #fff;
}

body.ui-modern .nav-tabs {
    gap: 0.25rem;
    border-bottom-color: var(--ui-border);
}

body.ui-modern .nav-tabs .nav-link {
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 7px 7px 0 0;
    color: var(--ui-muted);
    font-weight: 620;
}

body.ui-modern .nav-tabs .nav-link:hover {
    background: var(--ui-primary-soft);
    color: var(--ui-primary);
}

body.ui-modern .nav-tabs .nav-link.active {
    background: transparent !important;
    border-color: var(--ui-primary) !important;
    color: var(--ui-primary) !important;
}

body.ui-modern .dropdown-menu {
    padding: 0.4rem;
    background: var(--ui-surface-raised);
    border: 1px solid var(--ui-border);
    border-radius: 10px;
    color: var(--ui-text);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.16);
}

body.ui-modern .dropdown-item {
    border-radius: 7px;
    color: var(--ui-text);
}

body.ui-modern .dropdown-item:hover,
body.ui-modern .dropdown-item:focus {
    background: var(--ui-surface-muted);
    color: var(--ui-text);
}

body.ui-modern .dropdown-item.active {
    background: var(--ui-primary);
    color: #fff;
}

body.ui-modern .alert {
    border: 0;
    border-radius: 10px;
}

body.ui-modern .modal-content {
    overflow: hidden;
    background: var(--ui-surface);
    border: 1px solid var(--ui-border);
    border-radius: 16px;
    color: var(--ui-text);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.3);
}

body.ui-modern .modal-header,
body.ui-modern .modal-footer {
    border-color: var(--ui-border);
}

body.ui-modern .pagination .page-link {
    background: var(--ui-surface);
    border-color: var(--ui-border);
    color: var(--ui-primary);
}

body.ui-modern .pagination .page-item.active .page-link {
    background: var(--ui-primary);
    border-color: var(--ui-primary);
    color: #fff;
}

body.ui-modern footer.bg-light {
    background: var(--ui-surface-raised) !important;
    border-top: 1px solid var(--ui-border);
    color: var(--ui-muted) !important;
}

body.ui-modern > .container.flex-grow-1 {
    padding-bottom: 2.5rem;
}

/* Dashboard */
body.ui-modern #card-empleados-activos .card,
body.ui-modern #card-fichadas-hoy .card,
body.ui-modern #card-jornadas-incompletas .card,
body.ui-modern #card-ultima-procesamiento-txt .card {
    height: 100%;
    transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

body.ui-modern #card-empleados-activos .card:hover,
body.ui-modern #card-fichadas-hoy .card:hover,
body.ui-modern #card-jornadas-incompletas .card:hover {
    transform: translateY(-2px);
    border-color: rgba(198, 124, 31, 0.38);
    box-shadow: 0 12px 30px rgba(20, 22, 26, 0.09);
}

body.ui-modern #card-empleados-activos .card-text,
body.ui-modern #card-fichadas-hoy .card-text,
body.ui-modern #card-jornadas-incompletas .card-text,
body.ui-modern #card-ultima-procesamiento-txt .card-text {
    margin-bottom: 0;
    color: var(--ui-primary);
    font-size: 1.35rem;
    font-weight: 750;
    font-variant-numeric: tabular-nums;
}

/* Reportes: el filtro se lee como un bloque de trabajo único. */
body.ui-modern #reportes_filters {
    padding: 1rem;
    background: var(--ui-surface);
    border: 1px solid var(--ui-border);
    border-radius: 14px;
    box-shadow: 0 8px 26px rgba(20, 22, 26, 0.045);
}

body.ui-modern .reporte-empleado-selector,
body.ui-modern .employee-checklist {
    background: var(--ui-surface-muted) !important;
    border-color: var(--ui-border) !important;
}

body.ui-modern .employee-option {
    border-bottom-color: var(--ui-border) !important;
}

/* Programador: moderniza el marco sin alterar la grilla tipo Excel. */
body.ui-modern .planner-toolbar {
    background: var(--ui-surface) !important;
    border-color: var(--ui-border) !important;
    border-radius: 14px;
    color: var(--ui-text);
    box-shadow: 0 8px 26px rgba(20, 22, 26, 0.045);
}

body.ui-modern .config-nav {
    padding: 0.35rem;
    width: fit-content;
    background: var(--ui-surface);
    border: 1px solid var(--ui-border);
    border-radius: 11px;
}

@media (max-width: 991.98px) {
    body.ui-modern .navbar-nav {
        align-items: flex-start !important;
        padding-block: 0.65rem;
    }

    body.ui-modern > .container-fluid,
    body.ui-modern main.container-fluid {
        padding-inline: 1rem !important;
    }

    body.ui-modern .list-group {
        margin-bottom: 1.5rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    body.ui-modern *,
    body.ui-modern *::before,
    body.ui-modern *::after {
        scroll-behavior: auto !important;
        transition: none !important;
    }
}
