/* Safe areas (notch, status bar, home indicator). Browsers: 0 unless the page uses viewport-fit=cover, which only the mobile
   app does (Views/Shared/_AppHead.cshtml). iOS fills env(); the Android app sets these variables itself (MainActivity.java). */
:root {
    --hrms-safe-top: env(safe-area-inset-top, 0px);
    --hrms-safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* Shared application styles (moved from _Layout.cshtml). Page-specific styles stay in their views. */
        .validation-message {
            font-size: 12px;
        }

        .company-name {
            color: white;
            font-size: 2.5rem;
            font-weight: 600;
        }

        .icon {
            font-size: 1.7rem !important;
        }

        /* Unified app data table styling (light + dark) */
        .app-data-table {
            margin: 0 !important;
            border-collapse: collapse !important;
        }

        .app-data-table thead th {
            border-bottom: 2px solid #dee2e6 !important;
            border-top: 1px solid #dee2e6 !important;
        }

        .app-data-table tbody tr {
            border-bottom: 1px solid #dee2e6 !important;
            transition: all 0.2s ease-in-out;
        }

        .app-data-table td,
        .app-data-table th {
            border-left: none !important;
            border-right: none !important;
            padding: 0.75rem !important;
        }

        /* Light mode header */
        [data-bs-theme="light"] .app-data-table thead th,
        [data-bs-theme="light"] table.table thead th {
            background-color: #f5f8fa !important;
            color: #181c32 !important;
            font-weight: 600 !important;
            border-color: #e4e6ea !important;
        }

        [data-bs-theme="light"] .app-data-table tbody tr td,
        [data-bs-theme="light"] table.table tbody tr td {
            color: #181c32 !important;
            border-color: #e4e6ea !important;
        }

        /* Dark mode table styling */
        [data-bs-theme="dark"] .app-data-table,
        [data-bs-theme="dark"] table.table {
            background-color: #15181D !important;
        }

        [data-bs-theme="dark"] .app-data-table thead th,
        [data-bs-theme="dark"] table.table thead th {
            background-color: #1F2937 !important;
            color: #E6E8EB !important;
            border-color: #262A31 !important;
            border-bottom: 2px solid #262A31 !important;
            font-weight: 600 !important;
        }

        [data-bs-theme="dark"] .app-data-table tbody tr,
        [data-bs-theme="dark"] table.table tbody tr {
            border-bottom: 1px solid #262A31 !important;
            background-color: #15181D !important;
            color: #E6E8EB !important;
        }

        [data-bs-theme="dark"] .app-data-table tbody tr.even,
        [data-bs-theme="dark"] table.table tbody tr.even {
            background-color: #15181D !important;
        }

        [data-bs-theme="dark"] .app-data-table tbody tr.odd,
        [data-bs-theme="dark"] table.table tbody tr.odd {
            background-color: #171A20 !important;
        }

        [data-bs-theme="dark"] .app-data-table tbody tr:hover,
        [data-bs-theme="dark"] table.table tbody tr:hover {
            background-color: #1C2026 !important;
            color: #E6E8EB !important;
        }

        [data-bs-theme="dark"] .app-data-table tbody tr td,
        [data-bs-theme="dark"] table.table tbody tr td {
            color: #E6E8EB !important;
            border-color: #262A31 !important;
        }

        body {
            font-family: 'Inter', 'Roboto', 'Segoe UI', Helvetica, sans-serif;
        }

        /* Dark mode body background */
        [data-bs-theme="dark"] body {
            background-color: #0F1115 !important;
        }

        /* ── Global Dark Mode Overrides ── */

        /* Header */
        [data-bs-theme="dark"] #kt_app_header {
            background-color: #15181D !important;
            border-bottom: 1px solid #262A31 !important;
        }
        [data-bs-theme="dark"] #kt_app_header_container {
            border-bottom: none !important;
        }

        /* Content area */
        [data-bs-theme="dark"] .app-content {
            background-color: #0F1115 !important;
        }

        /* Cards */
        [data-bs-theme="dark"] .card {
            background-color: #15181D !important;
            border: 1px solid #262A31 !important;
        }
        [data-bs-theme="dark"] .card-header {
            background-color: #1A1D23 !important;
            border-bottom: 1px solid #262A31 !important;
        }
        [data-bs-theme="dark"] .card-footer {
            background-color: #1A1D23 !important;
            border-top: 1px solid #262A31 !important;
        }

        /* Modals */
        [data-bs-theme="dark"] .modal-content {
            background-color: #15181D !important;
            border: 1px solid #262A31 !important;
        }
        [data-bs-theme="dark"] .modal-header {
            background-color: #1A1D23 !important;
            border-bottom: 1px solid #262A31 !important;
            color: #E6E8EB !important;
        }
        [data-bs-theme="dark"] .modal-header .modal-title,
        [data-bs-theme="dark"] .modal-header h5 {
            color: #E6E8EB !important;
        }
        [data-bs-theme="dark"] .modal-footer {
            border-top: 1px solid #262A31 !important;
        }
        [data-bs-theme="dark"] .modal-body label,
        [data-bs-theme="dark"] .modal-body .form-label {
            color: #9CA3AF !important;
        }

        /* Form Inputs */
        [data-bs-theme="dark"] .form-control,
        [data-bs-theme="dark"] .form-select {
            background-color: #111827 !important;
            border-color: #262A31 !important;
            color: #E6E8EB !important;
        }
        [data-bs-theme="dark"] .form-control:focus,
        [data-bs-theme="dark"] .form-select:focus {
            border-color: #3B82F6 !important;
            box-shadow: 0 0 0 0.2rem rgba(59,130,246,0.15) !important;
        }
        [data-bs-theme="dark"] .form-control::placeholder {
            color: #6B7280 !important;
        }
        [data-bs-theme="dark"] .form-control.form-control-solid,
        [data-bs-theme="dark"] .form-select.form-select-solid {
            background-color: #111827 !important;
            border-color: #262A31 !important;
        }

        /* Nav Tabs */
        [data-bs-theme="dark"] .nav-tabs {
            border-bottom-color: #262A31 !important;
        }
        [data-bs-theme="dark"] .nav-tabs .nav-link {
            color: #6B7280 !important;
        }
        [data-bs-theme="dark"] .nav-tabs .nav-link:hover {
            color: #C8CCD4 !important;
            border-color: transparent !important;
        }
        [data-bs-theme="dark"] .nav-tabs .nav-link.active {
            background-color: #3B82F6 !important;
            color: #fff !important;
            border-color: #3B82F6 !important;
        }

        /* Alerts */
        [data-bs-theme="dark"] .alert-success {
            background-color: rgba(16,185,129,0.12) !important;
            border-color: rgba(16,185,129,0.25) !important;
            color: #34D399 !important;
        }
        [data-bs-theme="dark"] .alert-danger {
            background-color: rgba(248,113,113,0.12) !important;
            border-color: rgba(248,113,113,0.25) !important;
            color: #F87171 !important;
        }
        [data-bs-theme="dark"] .alert-warning {
            background-color: rgba(251,191,36,0.12) !important;
            border-color: rgba(251,191,36,0.25) !important;
            color: #FBBF24 !important;
        }

        /* Badges */
        [data-bs-theme="dark"] .badge.badge-light-success {
            background-color: rgba(16,185,129,0.15) !important;
            color: #34D399 !important;
        }
        [data-bs-theme="dark"] .badge.badge-light-danger {
            background-color: rgba(248,113,113,0.15) !important;
            color: #F87171 !important;
        }
        [data-bs-theme="dark"] .badge.badge-light-warning {
            background-color: rgba(251,191,36,0.15) !important;
            color: #FBBF24 !important;
        }
        [data-bs-theme="dark"] .badge.badge-light-primary {
            background-color: rgba(59,130,246,0.15) !important;
            color: #60A5FA !important;
        }

        /* Buttons */
        /* Light theme: the theme's light button (#f9f9f9) nearly vanished on the #fcfcfc page; a visible light gray instead. */
        html:not([data-bs-theme="dark"]) .btn.btn-light {
            background-color: #EBEDF2;
            border-color: #EBEDF2;
            color: #252F4A;
        }
        html:not([data-bs-theme="dark"]) .btn.btn-light:hover:not(.btn-active),
        html:not([data-bs-theme="dark"]) .btn.btn-light:focus-visible:not(.btn-active),
        html:not([data-bs-theme="dark"]) .btn.btn-light:active:not(.btn-active),
        html:not([data-bs-theme="dark"]) .btn.btn-light.active,
        html:not([data-bs-theme="dark"]) .show > .btn.btn-light {
            background-color: #DEE1E8;
            border-color: #DEE1E8;
            color: #252F4A;
        }
        [data-bs-theme="dark"] .btn-light {
            background-color: #1F2937 !important;
            border-color: #262A31 !important;
            color: #C8CCD4 !important;
        }
        [data-bs-theme="dark"] .btn-light:hover {
            background-color: #2A2F38 !important;
        }
        [data-bs-theme="dark"] .btn-secondary {
            background-color: #1F2937 !important;
            border-color: #262A31 !important;
            color: #C8CCD4 !important;
        }

        /* Text utilities */
        [data-bs-theme="dark"] .text-gray-800 {
            color: #E6E8EB !important;
        }
        [data-bs-theme="dark"] .text-gray-700 {
            color: #C8CCD4 !important;
        }
        [data-bs-theme="dark"] .text-gray-600 {
            color: #9CA3AF !important;
        }
        [data-bs-theme="dark"] h1, [data-bs-theme="dark"] h2, [data-bs-theme="dark"] h3,
        [data-bs-theme="dark"] h4, [data-bs-theme="dark"] h5, [data-bs-theme="dark"] h6 {
            color: #E6E8EB !important;
        }

        /* Dropdowns */
        [data-bs-theme="dark"] .dropdown-menu {
            background-color: #1A1D23 !important;
            border: 1px solid #262A31 !important;
        }
        [data-bs-theme="dark"] .dropdown-item {
            color: #C8CCD4 !important;
        }
        [data-bs-theme="dark"] .dropdown-item:hover {
            background-color: #1F2937 !important;
            color: #E6E8EB !important;
        }

        /* Separator */
        [data-bs-theme="dark"] .separator {
            border-bottom-color: #262A31 !important;
        }

        /* Toast */
        [data-bs-theme="dark"] .toast {
            background-color: #15181D !important;
            border: 1px solid #262A31 !important;
            color: #E6E8EB !important;
        }

        /* Pagination */
        [data-bs-theme="dark"] .page-item.active .page-link {
            background-color: #3B82F6 !important;
            border-color: #3B82F6 !important;
        }
        [data-bs-theme="dark"] .page-link {
            background-color: #15181D !important;
            border-color: #262A31 !important;
            color: #C8CCD4 !important;
        }

        /* DataTables */
        [data-bs-theme="dark"] .dataTables_filter input {
            background-color: #111827 !important;
            border-color: #262A31 !important;
            color: #E6E8EB !important;
        }
        [data-bs-theme="dark"] .dataTables_length select {
            background-color: #111827 !important;
            border-color: #262A31 !important;
            color: #E6E8EB !important;
        }
        [data-bs-theme="dark"] .dataTables_paginate .paginate_button {
            color: #C8CCD4 !important;
        }
        [data-bs-theme="dark"] .dataTables_paginate .paginate_button.current {
            background: #3B82F6 !important;
            border-color: #3B82F6 !important;
            color: #fff !important;
        }
        [data-bs-theme="dark"] .dataTables_info {
            color: #6B7280 !important;
        }
        [data-bs-theme="dark"] .dt-buttons .btn {
            background-color: #1F2937 !important;
            border-color: #262A31 !important;
            color: #C8CCD4 !important;
        }

        /* Select2 */
        [data-bs-theme="dark"] .select2-container--bootstrap5 .select2-selection {
            background-color: #111827 !important;
            border-color: #262A31 !important;
            color: #E6E8EB !important;
        }
        [data-bs-theme="dark"] .select2-container--bootstrap5 .select2-selection--single .select2-selection__rendered {
            color: #E6E8EB !important;
        }
        [data-bs-theme="dark"] .select2-container--bootstrap5 .select2-dropdown {
            background-color: #1A1D23 !important;
            border-color: #262A31 !important;
        }
        [data-bs-theme="dark"] .select2-container--bootstrap5 .select2-results__option--highlighted {
            background-color: #1F2937 !important;
            color: #E6E8EB !important;
        }

        /* Scrollbar */
        [data-bs-theme="dark"] ::-webkit-scrollbar { width: 6px; height: 6px; }
        [data-bs-theme="dark"] ::-webkit-scrollbar-track { background: #0F1115; }
        [data-bs-theme="dark"] ::-webkit-scrollbar-thumb { background: #262A31; border-radius: 3px; }
        [data-bs-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: #3B82F6; }

        /* ── End Global Dark Mode ── */

        .menu-title {
            font-family: Inter, Helvetica, "sans-serif";
        }

        .company-name {
            font-family: Inter, Helvetica, "sans-serif";
            text-decoration: none;
        }

        .company-name:hover {
            color: white;
        }

        #kt_app_header_container{
            border-bottom: 1px solid #d7d9dd;
        }

        .dataTables_length div label {
        display: flex;
        gap: 0.5rem;
        align-items: center;
    }

    /* 
    Overridden the label styling for adjusting table toolbar section 
    */

    label:empty{
        display: none !important;
    }
    .dataTables_length div select {
        width: auto !important; 
        min-width: 70px !important;
        max-width: 80px !important;
    }
    
    /* User greeting styling for light and dark mode */
    .user-greeting {
        color: #181c32;
        font-weight: 600;
        font-size: 0.95rem;
        white-space: nowrap;
    }
    
    [data-bs-theme="dark"] .user-greeting {
        color: #E6E8EB !important;
    }
    
    /* Punch dropdown menu - keep dark theme in light mode */
    /* Parent menu item styling */
    .menu-item.punch-menu-item .menu-link {
        background-color: #0F1115 !important;
        color: #FFFFFF !important;
        border-radius: 0.475rem !important;
    }
    
    .menu-item.punch-menu-item .menu-link:hover {
        background-color: #2A2F38 !important;
        color: #FFFFFF !important;
    }
    
    .menu-item.punch-menu-item .menu-link.active {
        background-color: #2A2F38 !important;
        color: #FFFFFF !important;
    }
    
    /* Punch dropdown submenu styling - dark theme in light mode */
    .menu-item.punch-menu-item .menu-sub {
        background-color: #0F1115 !important;
        border: 1px solid #0F1115 !important;
        border-radius: 0.475rem !important;
        box-shadow: 0 0 20px rgba(0, 0, 0, 0.3) !important;
    }
    
    /* Submenu items styling */
    .menu-item.punch-menu-item .menu-sub .menu-item .menu-link {
        color: #E6E8EB !important;
        background-color: transparent !important;
        padding: 0.75rem 1rem !important;
    }
    
    .menu-item.punch-menu-item .menu-sub .menu-item .menu-link:hover {
        background-color: #2A2F38 !important;
        color: #FFFFFF !important;
    }
    
    /* Active submenu item */
    .menu-item.punch-menu-item .menu-sub .menu-item .menu-link.active {
        background-color: #2A2F38 !important;
        color: #FFFFFF !important;
        font-weight: 600 !important;
    }
    
    /* Submenu icons */
    .menu-item.punch-menu-item .menu-sub .menu-icon {
        color: #E6E8EB !important;
    }
    
    .menu-item.punch-menu-item .menu-sub .menu-link.active .menu-icon {
        color: #FFFFFF !important;
    }
    
    /* Submenu titles */
    .menu-item.punch-menu-item .menu-sub .menu-title {
        color: #E6E8EB !important;
    }
    
    .menu-item.punch-menu-item .menu-sub .menu-link.active .menu-title {
        color: #FFFFFF !important;
        font-weight: 600 !important;
    }
    
    /* Parent menu icon and title */
    .menu-item.punch-menu-item .menu-icon {
        color: #FFFFFF !important;
    }
    
    .menu-item.punch-menu-item .menu-title {
        color: #FFFFFF !important;
        font-weight: 600 !important;
    }
    
    .menu-item.punch-menu-item .menu-arrow {
        color: #FFFFFF !important;
    }


/* ---------------------------------------------------------------------------------------------
   Responsive layout and usability (all screens)
   --------------------------------------------------------------------------------------------- */

/* Toasts sit above the sticky header and never exceed the phone width. */
/* Success / error / warning messages inside the page or form (site.js hrms.toast). */
.hrms-inline-msg { border-radius: .65rem; }
.hrms-inline-msg .hrms-inline-msg-text { overflow-wrap: anywhere; }
.modal-body > .hrms-inline-msg:first-child, form > .hrms-inline-msg:first-child { margin-bottom: 1rem; }

/* Page headers built by the views ("title on the left, buttons on the right") wrap instead of running off screen. */
#kt_app_content .app-toolbar,
#kt_app_content #kt_app_toolbar_container,
#kt_app_content .card-header,
#kt_app_content .card-toolbar,
#kt_app_content .d-flex.flex-stack,
#kt_app_content .d-flex.justify-content-between {
    flex-wrap: wrap;
    row-gap: 0.75rem;
}
#kt_app_content .card-header { min-height: 60px; height: auto; padding-top: .75rem; padding-bottom: .75rem; }
#kt_app_content .card-toolbar { margin-top: 0; margin-bottom: 0; }
#kt_app_content .page-title { min-width: 0; }

/* Tables keep readable columns and scroll sideways on small screens instead of squeezing every cell. */
/* position: relative keeps absolutely positioned children (e.g. .visually-hidden header text) inside the scroll box. */
.table-responsive { -webkit-overflow-scrolling: touch; position: relative; }
.table-responsive > .table th { white-space: nowrap; }
.text-nowrap-cells td { white-space: nowrap; }

/* Form validation messages and required markers are consistent. */
.field-validation-error, .validation-message, .text-danger.small { font-size: 0.85rem; }
.input-validation-error { border-color: var(--bs-danger) !important; }
.validation-summary-errors ul { margin-bottom: 0; padding-left: 1.1rem; }

/* Keyboard users can see where they are. */
a:focus-visible, .btn:focus-visible, .form-check-input:focus-visible, .menu-link:focus-visible {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
}

/* Panel spacing on tablets and phones, the same on every page and form (fixed px: the theme shrinks rem on small screens).
   Tablet: 20px between the window and the panel, 24px inside the panel. Phone: 10px outside, 20px inside. */
@media (max-width: 991.98px) {
    .card, .settings-card { --hrms-card-px: 24px; }
    #kt_app_content .card > .card-body, #kt_app_content .settings-card > .settings-card-body { padding: 24px; }
    #kt_app_content .card > .card-header, #kt_app_content .card > .card-footer,
    #kt_app_content .settings-card > .settings-card-header { padding-left: 24px; padding-right: 24px; }
    #kt_app_content_container.app-container { padding-left: 20px !important; padding-right: 20px !important; }
    #kt_app_content { padding-top: 12px; }
    /* Pages that set their own padding utilities (p-5, px-5...) still get the same side spacing; forms using p-5 also get
       the same top and bottom spacing. */
    #kt_app_content .card > .card-body:not(.p-0), #kt_app_content .settings-card > .settings-card-body:not(.p-0) { padding-left: 24px !important; padding-right: 24px !important; }
    #kt_app_content .card > .card-body.p-5 { padding-top: 24px !important; padding-bottom: 24px !important; }
}
@media (max-width: 767.98px) {
    .card, .settings-card { --hrms-card-px: 20px; }
    #kt_app_content .card > .card-body, #kt_app_content .settings-card > .settings-card-body { padding: 20px; }
    #kt_app_content .card > .card-header, #kt_app_content .card > .card-footer,
    #kt_app_content .settings-card > .settings-card-header { padding-left: 20px; padding-right: 20px; }
    #kt_app_content_container.app-container { padding-left: 10px !important; padding-right: 10px !important; }
    #kt_app_content .card > .card-body:not(.p-0), #kt_app_content .settings-card > .settings-card-body:not(.p-0) { padding-left: 20px !important; padding-right: 20px !important; }
    #kt_app_content .card > .card-body.p-5 { padding-top: 20px !important; padding-bottom: 20px !important; }
}

@media (max-width: 575.98px) {
    /* Phones: page-level action buttons share the row and wrap; tap targets are at least 36px. */
    #kt_app_content .page-heading, #kt_app_content h1 { font-size: 1.35rem !important; }
    #kt_app_content .card-title { font-size: 1.1rem; }
    #kt_app_content .btn:not(.btn-icon):not(.btn-sm):not(.btn-xs) { min-height: 38px; }
    #kt_app_content .btn.btn-icon { min-width: 34px; min-height: 34px; }
    .modal-dialog { margin: .5rem; }
    .modal-body { padding: 1.25rem 1rem !important; }
    .modal-footer { flex-wrap: wrap; gap: .5rem; }
    .modal-footer .btn { min-width: 0 !important; flex: 1 1 0; } /* equal widths: Cancel and Save the same size */
    /* DataTables toolbar stacks: search full width, buttons and length below. */
    .dataTables_wrapper .dataTables_filter, .dataTables_wrapper .dt-search,
    .dataTables_wrapper .dataTables_length, .dataTables_wrapper .dt-length,
    .dataTables_wrapper .dataTables_info, .dataTables_wrapper .dt-info,
    .dataTables_wrapper .dataTables_paginate, .dataTables_wrapper .dt-paging {
        float: none !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        justify-content: center !important;
        text-align: center;
    }
    .dataTables_wrapper .dataTables_filter input, .dataTables_wrapper .dt-search input { width: 100% !important; margin-left: 0 !important; }
    .dt-buttons { margin-right: 0 !important; }
    .swal2-popup { width: calc(100vw - 2rem) !important; }
}

/* <page-header> tag helper */
.hrms-page-header .page-heading { line-height: 1.3; word-break: break-word; }
@media (max-width: 575.98px) {
    /* Phones: the buttons under the page title keep their own width (not stretched to the full row) and wrap when they don't fit. */
    .hrms-page-header .hrms-page-actions { width: 100%; flex-wrap: wrap; }
    .hrms-page-header .hrms-page-actions > .btn,
    .hrms-page-header .hrms-page-actions > a.btn,
    .hrms-page-header .hrms-page-actions > form,
    .hrms-page-header .hrms-page-actions > .dropdown { flex: 0 0 auto; width: auto; }
    .hrms-page-header .hrms-page-actions > form .btn,
    .hrms-page-header .hrms-page-actions > .dropdown > .btn { width: auto; }
}

/* ---------------------------------------------------------------------------------------------
   .table-stack: on phones each row becomes a card. Give every <td> a data-label="Column name";
   mark the cell that titles the card with .cell-title and the action cell with .cell-actions.
   --------------------------------------------------------------------------------------------- */
@media (max-width: 767.98px) {
    /* Cards never scroll sideways (DataTables wraps the table in .dt-container, hence no ">"); highlighted cards
       reach past the scroll box to the panel border. */
    .table-responsive:has(table.table-stack) { overflow: visible !important; }
    table.table-stack, table.table-stack tbody { display: block; width: 100%; }
    table.table-stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    table.table-stack tbody tr {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: .5rem 1rem;
        padding: .9rem 1rem;
        margin-bottom: .75rem;
        border: 1px solid var(--bs-gray-200);
        border-radius: .75rem;
        background: var(--bs-body-bg);
    }
    /* Metronic pads every row but the first (.table tr:first-child); cards must all start at the same edge. */
    table.table.table-stack > tbody > tr { padding-left: 0 !important; padding-right: 0 !important; }
    /* A highlighted card (row with a background, e.g. leave / manual punch) fills the panel from border to border;
       its text stays in line with the other cards. */
    .card table.table.table-stack > tbody > tr[class*="bg-"],
    .settings-card table.table-stack > tbody > tr[class*="bg-"] {
        margin-left: calc(-1 * var(--hrms-card-px)); margin-right: calc(-1 * var(--hrms-card-px));
        padding-left: var(--hrms-card-px) !important; padding-right: var(--hrms-card-px) !important;
        border-radius: 0;
    }
    /* A leave waiting for a decision is a highlighted card too: the colour and the left line go on the card, which
       fills the panel from border to border (on a wide screen they are on the cells, see tr.hrms-leave-*). */
    .card table.table.table-stack > tbody > tr:is(.hrms-leave-not-sent, .hrms-leave-unapproved) {
        margin-left: calc(-1 * var(--hrms-card-px)); margin-right: calc(-1 * var(--hrms-card-px));
        padding-left: var(--hrms-card-px) !important; padding-right: var(--hrms-card-px) !important;
        border-radius: 0; border-left: 0; border-right: 0;
    }
    table.table-stack > tbody > tr.hrms-leave-not-sent { background: #fff1e3 !important; box-shadow: inset 4px 0 0 #f97316; }
    table.table-stack > tbody > tr.hrms-leave-unapproved { background: #fff8dd !important; box-shadow: inset 4px 0 0 var(--bs-warning, #f6c000); }
    [data-bs-theme="dark"] table.table-stack > tbody > tr.hrms-leave-not-sent { background: rgba(249, 115, 22, .14) !important; }
    [data-bs-theme="dark"] table.table-stack > tbody > tr.hrms-leave-unapproved { background: rgba(246, 192, 0, .12) !important; }
    table.table-stack > tbody > tr:is(.hrms-leave-not-sent, .hrms-leave-unapproved) > td { background: transparent !important; box-shadow: none !important; }
    table.table-stack tbody tr > td { display: block; padding: 0 !important; border: 0 !important; min-width: 0; white-space: normal !important; }
    table.table-stack tbody tr > td[data-label]::before {
        content: attr(data-label);
        display: block;
        font-size: .75rem;
        font-weight: 600;
        color: var(--bs-gray-600);
        margin-bottom: .1rem;
    }
    table.table-stack tbody tr > td.cell-title,
    table.table-stack tbody tr > td.cell-wide,
    table.table-stack tbody tr > td.cell-actions,
    table.table-stack tbody tr > td[colspan] { grid-column: 1 / -1; }
    table.table-stack tbody tr > td.cell-title::before { display: none; }
    table.table-stack tbody tr > td.cell-check { position: absolute; }
    table.table-stack tbody tr { position: relative; }
    table.table-stack tbody tr:has(> td.cell-check) > td.cell-title { padding-left: 2rem !important; }
    table.table-stack tbody tr > td.cell-actions::before { display: none; }
    /* Nothing in a card may be wider than the card (e.g. a long row of team avatars): rows of chips/avatars wrap. */
    table.table-stack tbody tr > td .d-flex:not(.flex-column) { flex-wrap: wrap; }
    table.table-stack tbody tr > td { overflow-wrap: anywhere; }
    table.table-stack tbody tr > td.text-end:not(.cell-actions) { text-align: start !important; }
    table.table-stack tbody tr > td.cell-actions > *:not(.btn-icon) { justify-content: flex-start !important; }
    /* An icon button keeps its icon centred (the line above would push it to the left edge). */
    table.table-stack tbody tr > td.cell-actions .btn-icon { justify-content: center !important; width: 44px; height: 44px; }
    table.table-stack tbody tr > td.cell-actions .btn:not(.btn-icon) { min-height: 44px; flex: 1 1 auto; display: inline-flex; align-items: center; justify-content: center !important; gap: .35rem; }
}

/* Small helpers used across list pages */
.hrms-avatar { width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 700; flex-shrink: 0; }
img.hrms-avatar { object-fit: cover; }
.hrms-stat { border: 1px solid var(--bs-gray-200); border-radius: .75rem; padding: 1rem 1.15rem; background: var(--bs-body-bg); height: 100%; }
.hrms-stat .hrms-stat-label { font-size: .85rem; color: var(--bs-gray-600); font-weight: 500; }
.hrms-stat .hrms-stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1.2; color: var(--bs-gray-900); }
a.hrms-stat:hover { border-color: var(--bs-primary); }
.hrms-filter-chips { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
/* Quick filters (status tabs, with an optional note on the right) sit above the table panel, not inside it. */
.hrms-tabs-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-bottom: 1.25rem; }
.hrms-tabs { display: inline-flex; flex-wrap: wrap; gap: .25rem; background: var(--bs-gray-100); padding: .25rem; border-radius: .65rem; max-width: 100%; overflow-x: auto; }
.hrms-tabs .hrms-tab { display: inline-flex; align-items: center; gap: .4rem; padding: .45rem .8rem; border-radius: .5rem; font-weight: 600; font-size: .9rem; color: var(--bs-gray-700); white-space: nowrap; }
.hrms-tabs .hrms-tab:hover { color: var(--bs-gray-900); }
/* In-page tabs (Bootstrap tab buttons, e.g. Biometric Devices) look like the link tabs. */
.hrms-tabs button.hrms-tab { border: 0; background: transparent; line-height: inherit; }
.hrms-tabs .hrms-tab.active { background: var(--bs-body-bg); color: var(--bs-gray-900); box-shadow: 0 1px 2px rgba(16, 24, 40, .12); }
.hrms-tabs .hrms-tab .hrms-count { font-size: .75rem; padding: .05rem .45rem; border-radius: 999px; background: var(--bs-gray-200); color: var(--bs-gray-700); }
.hrms-tabs .hrms-tab.active .hrms-count { background: var(--bs-primary); color: #fff; }
.hrms-half { font-size: .75rem; font-weight: 600; color: #5B3FD1; background: #F3EFFF; padding: .1rem .5rem; border-radius: 999px; white-space: nowrap; }
[data-bs-theme="dark"] .hrms-half { background: rgba(124, 92, 255, .18); color: #B9A8FF; }
/* Leave not yet sent to the client: a red "Not Sent" label. */
.client-not-sent { background: var(--bs-danger) !important; border: 0; color: #fff !important; }
/* Leave waiting for a decision (dashboard pending rows, leave page): orange while not sent to the client, yellow once
   sent but not yet approved. */
.hrms-leave-not-sent { background: #fff1e3 !important; box-shadow: inset 4px 0 0 #f97316; }
.hrms-leave-unapproved { background: #fff8dd !important; box-shadow: inset 4px 0 0 var(--bs-warning, #f6c000); }
[data-bs-theme="dark"] .hrms-leave-not-sent { background: rgba(249, 115, 22, .14) !important; }
[data-bs-theme="dark"] .hrms-leave-unapproved { background: rgba(246, 192, 0, .12) !important; }
/* In a table the colour goes on the cells (the row's own background and inset line are not painted). */
tr.hrms-leave-not-sent, tr.hrms-leave-unapproved { box-shadow: none; }
tr.hrms-leave-not-sent > td { background: #fff1e3 !important; }
tr.hrms-leave-unapproved > td { background: #fff8dd !important; }
tr.hrms-leave-not-sent > td:first-child { box-shadow: inset 4px 0 0 #f97316; }
tr.hrms-leave-unapproved > td:first-child { box-shadow: inset 4px 0 0 var(--bs-warning, #f6c000); }
[data-bs-theme="dark"] tr.hrms-leave-not-sent > td { background: rgba(249, 115, 22, .14) !important; }
[data-bs-theme="dark"] tr.hrms-leave-unapproved > td { background: rgba(246, 192, 0, .12) !important; }
.flatpickr-input[readonly]:not([disabled]) { background-color: var(--bs-body-bg); }

/* Filter forms (form.hrms-filters): collapsed behind a "Filters" button on phones; site.js adds the button. */
.hrms-filter-toggle { display: none; }
@media (max-width: 767.98px) {
    .hrms-filter-toggle { display: inline-flex; align-items: center; gap: .4rem; margin-bottom: .75rem; }
    form.hrms-filters:not(.is-open) { display: none !important; }
    /* A line separates the Filters button (and the open filters) from the list below. */
    form.hrms-filters + * { border-top: 1px dashed var(--bs-border-color); padding-top: 1rem; }
    form.hrms-filters.mb-5 { margin-bottom: 1rem !important; }
}

/* An empty validation summary (no errors yet) renders nothing, even when styled as an alert. */
.validation-summary-valid { display: none !important; }

/* No ALL CAPS anywhere: Metronic and DataTables helpers that upper-case text are switched off. */
.text-uppercase, th, .menu-heading, .menu-section, .badge, .btn, .nav-link, .dataTables_wrapper th { text-transform: none !important; }

/* ---------------------------------------------------------------------------------------------
   Tables inside a panel run edge to edge: header background and row lines touch the panel's left and
   right borders, while the first/last cells keep the panel padding so text never touches the border.
   --------------------------------------------------------------------------------------------- */
.card { --hrms-card-px: 2.25rem; }
/* Breathing room under the last panel of every page (phones add the bottom tab bar height on top). */
#kt_app_content { padding-bottom: 2rem !important; }
.settings-card { --hrms-card-px: 1.25rem; }
/* Tablets 24px, phones 20px: the same as the panel padding (see "Panel spacing on tablets and phones"). */
@media (max-width: 991.98px) { .card, .settings-card { --hrms-card-px: 24px; } }
@media (max-width: 767.98px) { .card, .settings-card { --hrms-card-px: 20px; } }

.card > .card-body:has(> .table-responsive):not(.p-0),
.card > .card-body:has(> .tab-content > .tab-pane > .table-responsive):not(.p-0) {
    padding-left: var(--hrms-card-px) !important;
    padding-right: var(--hrms-card-px) !important;
}
.card > .card-body:not(.p-0) > .table-responsive,
.card > .card-body:not(.p-0) > .tab-content > .tab-pane > .table-responsive,
.settings-card > .settings-card-body:not(.p-0) > .table-responsive {
    margin-left: calc(-1 * var(--hrms-card-px));
    margin-right: calc(-1 * var(--hrms-card-px));
}
.card > .card-body > .table-responsive table.table > :not(caption) > tr > :first-child,
.card > .card-body > .tab-content > .tab-pane > .table-responsive table.table > :not(caption) > tr > :first-child,
.settings-card > .settings-card-body > .table-responsive table > :not(caption) > tr > :first-child { padding-left: var(--hrms-card-px) !important; }
.card > .card-body > .table-responsive table.table > :not(caption) > tr > :last-child,
.card > .card-body > .tab-content > .tab-pane > .table-responsive table.table > :not(caption) > tr > :last-child,
.settings-card > .settings-card-body > .table-responsive table > :not(caption) > tr > :last-child { padding-right: var(--hrms-card-px) !important; }
/* DataTables (one layout everywhere, set in site.js): search left / buttons right above the table; page size and
   count left / paging right below it. Inside a panel both rows keep the panel padding. */
.hrms-dt-top, .hrms-dt-bottom { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; }
.hrms-dt-top { margin-bottom: 1rem; }
.hrms-dt-bottom { margin-top: .75rem; }
/* Compact footer: DataTables/Metronic add their own padding and margins around the pager and count. */
.hrms-dt-bottom .dt-paging, .hrms-dt-bottom .dt-info, .hrms-dt-bottom .pagination { margin: 0 !important; padding: 0 !important; }
.table-responsive:has(> .dt-container) { margin-bottom: 0 !important; }
.hrms-dt-tools, .hrms-dt-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.25rem; }
.hrms-dt-tools:empty { display: none; }
/* (This DataTables build renders the search and page-size boxes in unnamed divs.) */
.hrms-dt-top > div:has(> input), .hrms-dt-top .dt-search { flex: 0 1 280px; min-width: 0; }
.hrms-dt-top > div:has(> input) > input, .hrms-dt-top .dt-search input { width: 100% !important; margin-left: 0 !important; }
.hrms-dt-meta > div:has(> select), .dt-length { display: flex; align-items: center; gap: .5rem; white-space: nowrap; }
.hrms-dt-meta > div:has(> select) > select, .dt-length select { width: auto !important; min-width: 5rem; margin: 0 !important; }
.hrms-dt-meta > div:has(> select) > label, .dt-length label, .dt-info { white-space: nowrap; margin: 0; }
.dt-paging .pagination { margin: 0; flex-wrap: wrap; }
.card > .card-body > .table-responsive > .dt-container > .hrms-dt-top,
.card > .card-body > .table-responsive > .dt-container > .hrms-dt-bottom,
.card > .card-body > .tab-content > .tab-pane > .table-responsive > .dt-container > .hrms-dt-top,
.card > .card-body > .tab-content > .tab-pane > .table-responsive > .dt-container > .hrms-dt-bottom,
.settings-card > .settings-card-body > .table-responsive > .dt-container > .hrms-dt-top,
.settings-card > .settings-card-body > .table-responsive > .dt-container > .hrms-dt-bottom { padding-left: var(--hrms-card-px); padding-right: var(--hrms-card-px); }
@media (max-width: 767.98px) {
    /* Phones: search full width; page size, count and paging centred under the cards. Rows sit inside the panel
       padding like the cards (table-stack), so no extra side padding. */
    .table-responsive:has(table.table-stack) > .dt-container > .hrms-dt-top,
    .table-responsive:has(table.table-stack) > .dt-container > .hrms-dt-bottom { padding-left: 0 !important; padding-right: 0 !important; }

    /* Top: search (with icon) fills the row; export buttons as small separate icons at its end, or right-aligned on
       their own line when the search would get too narrow. */
    .hrms-dt-top { gap: .5rem; margin-bottom: .75rem; }
    .hrms-dt-top > div:has(> input), .hrms-dt-top .dt-search { flex: 1 1 200px; }
    .hrms-dt-tools { margin-left: auto; }
    .hrms-dt-top > div:has(> input) > input, .hrms-dt-top .dt-search input {
        min-height: 40px !important; height: 40px; border-radius: .75rem; padding-left: 2.4rem;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2399a1b7' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
        background-repeat: no-repeat; background-position: .8rem center; background-size: 1.05rem;
    }
    .hrms-dt-top > div:has(> input) > label:empty { display: none; }
    .hrms-dt-tools { flex: none; flex-wrap: nowrap; gap: .35rem; }
    .hrms-dt-tools .dt-buttons { display: flex; flex-wrap: nowrap !important; gap: .35rem; }
    .hrms-dt-tools .dt-buttons > .btn { width: 40px; height: 40px; border-radius: .75rem !important; margin: 0 !important; }

    /* Bottom: paging centred, then one quiet line with the count (left) and the page size (right). */
    .hrms-dt-bottom { flex-direction: column; align-items: stretch; gap: .6rem; margin-top: .5rem; padding-top: .85rem; border-top: 1px solid #e4e6ea; }
    .hrms-dt-bottom .dt-paging { order: 1; display: flex; justify-content: center; }
    .hrms-dt-bottom .pagination { flex-wrap: wrap; justify-content: center; gap: .25rem; }
    .hrms-dt-bottom .page-link { min-width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border-radius: .6rem !important; }
    .hrms-dt-meta { order: 2; width: 100%; flex-wrap: nowrap; justify-content: space-between; gap: .5rem; font-size: 13px; color: var(--bs-gray-600); }
    .hrms-dt-meta .dt-info { order: 1; }
    .hrms-dt-meta > div:has(> select) { order: 2; gap: .35rem; }
    .hrms-dt-meta > div:has(> select) > select {
        min-height: 34px !important; height: 34px; min-width: 0; padding: 0 1.8rem 0 .7rem; border-radius: .6rem; background-position: right .55rem center;
    }
    .hrms-dt-meta > div:has(> select) > label { font-size: 13px; color: var(--bs-gray-600); }
    /* Small like the rest of the line (wins over the 16px touch-field rule; iOS focus zoom is off via the viewport). */
    .hrms-dt-meta > div:has(> select) > select { font-size: 13px !important; }
}
/* The scroll box holds the toolbars too: they stay put while a wide table scrolls. */
.table-responsive > .dt-container > .hrms-dt-top, .table-responsive > .dt-container > .hrms-dt-bottom { position: sticky; left: 0; }

@media (max-width: 767.98px) {
    /* Phone cards (table-stack) sit inside the panel padding instead. */
    .card > .card-body > .table-responsive:has(table.table-stack),
    .card > .card-body > .tab-content > .tab-pane > .table-responsive:has(table.table-stack),
    .settings-card > .settings-card-body > .table-responsive:has(table.table-stack) { margin-left: 0; margin-right: 0; }
    .table-responsive table.table-stack > tbody > tr > td:first-child,
    .table-responsive table.table-stack > tbody > tr > td:last-child,
    .card .table-responsive table.table.table-stack > tbody > tr > td:first-child,
    .card .table-responsive table.table.table-stack > tbody > tr > td:last-child,
    .settings-card .table-responsive table.table-stack > tbody > tr > td:first-child,
    .settings-card .table-responsive table.table-stack > tbody > tr > td:last-child { padding-left: 0 !important; padding-right: 0 !important; }
    /* Card actions line up at the start and buttons with text fill the row (same on every list). */
    table.table-stack > tbody > tr > td.cell-actions { display: flex !important; flex-wrap: wrap; gap: .5rem; text-align: start !important; }
}

/* ---------------------------------------------------------------------------------------------
   Phone: app-like shell — bottom tab bar, compact header, touch-sized controls, bottom-sheet dialogs.
   --------------------------------------------------------------------------------------------- */
.hrms-bottom-nav { display: none; }
@media (max-width: 767.98px) {
    .hrms-bottom-nav {
        display: flex;
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 105;
        background: var(--bs-body-bg);
        border-top: 1px solid var(--bs-gray-200);
        box-shadow: 0 -4px 16px rgba(16, 24, 40, .06);
        padding: .35rem .25rem calc(.35rem + var(--hrms-safe-bottom));
    }
    .hrms-bottom-nav-item {
        flex: 1 1 0; min-width: 0;
        display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .1rem;
        min-height: 52px; padding: .25rem 0;
        border: 0; background: transparent; border-radius: .75rem;
        color: var(--bs-gray-600); font-size: .72rem; font-weight: 600; text-decoration: none;
    }
    .hrms-bottom-nav-item i { color: inherit; }
    .hrms-bottom-nav-item.active { color: var(--bs-primary); }
    .hrms-bottom-nav-item.active i { color: var(--bs-primary); }
    .hrms-bottom-nav-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
    .hrms-bottom-nav-badge {
        position: absolute; top: -.35rem; right: -.7rem; min-width: 1.15rem; height: 1.15rem; padding: 0 .3rem;
        border-radius: 999px; background: var(--bs-danger); color: #fff; font-size: .65rem; line-height: 1.15rem; text-align: center;
    }
    /* body is fixed to the screen height (Metronic), so the room for the tab bar goes under the page content. */
    #kt_app_content { padding-bottom: calc(68px + 1.5rem + var(--hrms-safe-bottom)) !important; }
    #kt_scrolltop { display: none !important; }

    /* Compact header, page titles like an app screen */
    /* The top bar stays put while the page scrolls (body data-kt-app-header-fixed-mobile); content starts below it. */
    #kt_app_header { height: 56px; }
    body[data-kt-app-header-fixed-mobile="true"] { --bs-app-header-height: 56px; }
    [data-bs-theme="light"] #kt_app_header { box-shadow: 0 1px 0 var(--bs-border-color); }
    .hrms-page-header { padding-top: .25rem !important; padding-bottom: .75rem !important; margin-bottom: .5rem !important; }
    .hrms-page-header .page-heading { font-size: 1.4rem !important; }

    /* Touch-sized form controls; 16px text stops iOS zooming into inputs */
    #kt_app_content .form-control, #kt_app_content .form-select,
    .modal .form-control, .modal .form-select { min-height: 44px; font-size: 16px; }
    #kt_app_content .form-control-sm, #kt_app_content .form-select-sm { min-height: 44px; font-size: 16px; }
    .select2-container .select2-selection--single, .select2-container .select2-selection--multiple { min-height: 44px; }

    /* Status tabs scroll sideways in one row */
    .hrms-tabs { flex-wrap: nowrap; overflow-x: auto; width: 100%; scrollbar-width: none; }
    .hrms-tabs::-webkit-scrollbar { display: none; }

    /* Panels: rounded app cards */
    #kt_app_content .card, #kt_app_content .settings-card { border-radius: 1rem; }

    /* Dialogs open as bottom sheets */
    .modal-dialog:not(.modal-fullscreen):not(.modal-fullscreen-sm-down) {
        position: fixed; left: 0; right: 0; bottom: 0; margin: 0 !important; max-width: none; width: 100%;
        transform: translateY(100%); transition: transform .25s ease-out;
    }
    .modal.show .modal-dialog:not(.modal-fullscreen):not(.modal-fullscreen-sm-down) { transform: none; }
    /* A "centered" dialog would stretch to the full screen height (Bootstrap min-height), leaving the sheet floating
       in the middle and the area around it untappable (taps hit the dialog, not the backdrop, so it never closes).
       As a sheet it only takes the height of its content. */
    .modal-dialog.modal-dialog-centered:not(.modal-fullscreen):not(.modal-fullscreen-sm-down),
    .modal-dialog.modal-dialog-scrollable:not(.modal-fullscreen):not(.modal-fullscreen-sm-down) { display: block; min-height: 0; height: auto; max-height: 92vh; }
    .modal-dialog:not(.modal-fullscreen):not(.modal-fullscreen-sm-down) .modal-content {
        border-radius: 1.25rem 1.25rem 0 0 !important; max-height: 92vh; overflow-y: auto;
        padding-bottom: var(--hrms-safe-bottom) !important;
    }
}
/* A table that opens or closes a panel sits directly under the panel header / on its bottom edge. The same rules apply
   when the table is inside tabs (Biometric Devices) or follows a hidden form (Employees): ":first-of-type" skips forms. */
.card > .card-body:not(.p-0):has(> .table-responsive:first-of-type:first-child),
.card > .card-body:not(.p-0):has(> form.d-none:first-child + .table-responsive),
.card > .card-body:not(.p-0):has(> .tab-content:first-child > .tab-pane > .table-responsive:first-child),
.settings-card > .settings-card-body:has(> .table-responsive:first-child) { padding-top: 0 !important; }
.card > .card-body:not(.p-0):has(> .table-responsive:last-child),
.card > .card-body:not(.p-0):has(> .tab-content:last-child > .tab-pane > .table-responsive:last-child),
.settings-card > .settings-card-body:has(> .table-responsive:last-child) { padding-bottom: 0 !important; }
/* ...unless DataTables put its pager under the table: the pager keeps normal spacing from the panel edge. */
.card > .card-body:has(> .table-responsive:last-child > .dt-container > .hrms-dt-bottom),
.card > .card-body:has(> .tab-content:last-child > .tab-pane > .table-responsive:last-child > .dt-container > .hrms-dt-bottom),
.settings-card > .settings-card-body:has(> .table-responsive:last-child > .dt-container > .hrms-dt-bottom) { padding-bottom: .75rem !important; }
.card > .card-body > .table-responsive:last-child:not(:has(.hrms-dt-bottom .pagination)) table.table > tbody > tr:last-child > td,
.card > .card-body > .tab-content > .tab-pane > .table-responsive:last-child:not(:has(.hrms-dt-bottom .pagination)) table.table > tbody > tr:last-child > td,
.settings-card > .settings-card-body > .table-responsive:last-child:not(:has(.hrms-dt-bottom .pagination)) table > tbody > tr:last-child > td { border-bottom: 0 !important; }
/* ...but with a pager under it, one light line separates the last row from the pager, the same line as between rows
   (tables.css; phones draw the pager's own separator in the same style). Wherever the table sits, so every table
   looks like Employees. */
@media (min-width: 768px) {
    .dt-container:has(> .hrms-dt-bottom .pagination) table.table > tbody > tr:last-child > td,
    .dt-container:has(> .hrms-dt-bottom .pagination) table > tbody > tr:last-child > td { border-bottom: 1px solid #e4e6ea !important; }
}
/* A panel that starts with the table's search box keeps normal space above it (the search never touches the border). */
.card > .card-body:not(.p-0):has(> .table-responsive:first-of-type:first-child > .dt-container > .hrms-dt-top),
.card > .card-body:not(.p-0):has(> form.d-none:first-child + .table-responsive > .dt-container > .hrms-dt-top),
.card > .card-body:not(.p-0):has(> .tab-content:first-child > .tab-pane > .table-responsive:first-child > .dt-container > .hrms-dt-top),
.settings-card > .settings-card-body:has(> .table-responsive:first-child > .dt-container > .hrms-dt-top) { padding-top: 1.5rem !important; }
@media (min-width: 768px) and (max-width: 991.98px) {
    .card > .card-body:not(.p-0):has(> .table-responsive:first-of-type:first-child > .dt-container > .hrms-dt-top),
    .card > .card-body:not(.p-0):has(> form.d-none:first-child + .table-responsive > .dt-container > .hrms-dt-top),
    .card > .card-body:not(.p-0):has(> .tab-content:first-child > .tab-pane > .table-responsive:first-child > .dt-container > .hrms-dt-top),
    .settings-card > .settings-card-body:has(> .table-responsive:first-child > .dt-container > .hrms-dt-top) { padding-top: 24px !important; }
}
@media (max-width: 767.98px) {
    .card > .card-body:not(.p-0):has(> .table-responsive:first-of-type:first-child > .dt-container > .hrms-dt-top),
    .card > .card-body:not(.p-0):has(> form.d-none:first-child + .table-responsive > .dt-container > .hrms-dt-top),
    .card > .card-body:not(.p-0):has(> .tab-content:first-child > .tab-pane > .table-responsive:first-child > .dt-container > .hrms-dt-top),
    .settings-card > .settings-card-body:has(> .table-responsive:first-child > .dt-container > .hrms-dt-top) { padding-top: 20px !important; }
}
@media (max-width: 767.98px) {
    .card > .card-body:has(> .table-responsive:last-child > table.table-stack),
    .card > .card-body:has(> .tab-content:last-child > .tab-pane > .table-responsive:last-child table.table-stack) { padding-bottom: 1rem !important; }
    /* Phone cards straight under a panel header get a gap (on wider screens the table's own header row needs none). */
    .settings-card > .settings-card-body:has(> .table-responsive:first-child > table.table-stack) { padding-top: 1rem !important; }
    .settings-card > .settings-card-body:has(> .table-responsive:last-child > table.table-stack) { padding-bottom: .25rem !important; }
}

/* Horizontally scrolling tab rows never show a vertical scrollbar (a 1px overflow used to draw one). */
.nav.overflow-auto, .nav-line-tabs, .hrms-tabs, .s-tabs { overflow-y: hidden !important; }

/* Placeholder for an uploaded image whose file is missing (site.js). */
.hrms-img-missing { display: inline-flex; align-items: center; justify-content: center; min-width: 24px; min-height: 24px; max-width: 100%; border-radius: .5rem; background: var(--bs-gray-100); color: var(--bs-gray-500); vertical-align: middle; }

/* ---------------------------------------------------------------------------------------------
   Validation: one look for browser (site.js) and server (ModelState) errors.
   --------------------------------------------------------------------------------------------- */
.form-control.is-invalid, .form-select.is-invalid, .input-validation-error,
.select2-container .select2-selection.is-invalid, .form-check-input.is-invalid {
    border-color: var(--bs-danger) !important;
    box-shadow: none;
}
.form-control.is-invalid:focus, .form-select.is-invalid:focus { box-shadow: 0 0 0 .2rem rgba(248, 40, 90, .15) !important; }
.form-check-input.is-invalid ~ .form-check-label { color: var(--bs-danger); }
.hrms-field-error, .field-validation-error {
    display: block;
    margin-top: .35rem;
    font-size: .85rem;
    font-weight: 500;
    color: var(--bs-danger);
}
.hrms-field-error:empty, .field-validation-valid { display: none; }
/* Errors that belong to no single field (wrong password, rule across fields) — one box style everywhere. */
.validation-summary-errors, .hrms-form-errors {
    display: block;
    padding: .75rem 1rem;
    margin-bottom: 1.25rem;
    border: 1px solid rgba(248, 40, 90, .35);
    border-radius: .65rem;
    background: var(--bs-danger-light, #FFF5F8);
    color: var(--bs-danger) !important;
    font-size: .925rem;
    font-weight: 500;
}
.validation-summary-errors ul { margin: 0; padding: 0; list-style: none; }
.validation-summary-errors li + li, .hrms-form-errors > div + div { margin-top: .25rem; }

/* ---------------------------------------------------------------------------------------------
   Touch screens: 16px text in every field, so phones (iOS Safari) never zoom in when a field gets focus.
   --------------------------------------------------------------------------------------------- */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
@media (pointer: coarse) {
    input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]):not([type=submit]):not([type=button]),
    select, textarea, [contenteditable="true"], .ql-editor, .select2-search__field, .flatpickr-input {
        font-size: 16px !important;
    }
}

/* ---------------------------------------------------------------------------------------------
   Busy buttons (site.js setBusy: data-kt-indicator="on" + disabled while a form is being sent).
   Buttons with their own spinner markup keep it; the rest get one in front of the label.
   --------------------------------------------------------------------------------------------- */
.btn[data-kt-indicator="on"]:not(:has(.indicator-progress, .spinner-border, .fa-spinner))::before {
    content: ""; display: inline-block; flex: none; width: 1em; height: 1em; margin-right: .5rem; vertical-align: -.15em;
    border: .15em solid currentColor; border-right-color: transparent; border-radius: 50%;
    animation: hrms-spin .7s linear infinite;
}
.btn.btn-icon[data-kt-indicator="on"]::before { margin-right: 0; }
.btn.btn-icon[data-kt-indicator="on"] > i { display: none; }
.btn[data-kt-indicator="on"]:disabled { opacity: .8; cursor: progress; }
@keyframes hrms-spin { to { transform: rotate(360deg); } }

/* Chat bubbles: HR Desk conversation and Ask HR. "in" = the other side, "out" = the viewer's side. Theme colours follow light/dark. */
.hrms-chat { display: flex; flex-direction: column; gap: .75rem; }
.hrms-bubble { max-width: min(80%, 640px); padding: .75rem 1rem; border-radius: .85rem; background: var(--bs-gray-100); color: var(--bs-gray-900); }
.hrms-bubble.in { align-self: flex-start; border-bottom-left-radius: .25rem; }
.hrms-bubble.out { align-self: flex-end; background: var(--bs-primary-light); border-bottom-right-radius: .25rem; }
.hrms-bubble-meta { font-size: .75rem; color: var(--bs-gray-600); margin-bottom: .25rem; }
.hrms-bubble-text { white-space: pre-wrap; overflow-wrap: anywhere; }
/* Ask HR: "HR Team is typing" bubble with three bouncing dots. */
.hrms-typing { padding: .6rem 1rem; }
.hrms-typing-dots { display: inline-flex; gap: 5px; align-items: center; height: 14px; }
.hrms-typing-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--bs-gray-500); display: block; animation: hrms-typing 1.2s infinite ease-in-out; }
.hrms-typing-dots i:nth-child(2) { animation-delay: .15s; }
.hrms-typing-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes hrms-typing { 0%, 60%, 100% { transform: translateY(0); opacity: .45; } 30% { transform: translateY(-5px); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .hrms-typing-dots i { animation: none; opacity: .7; } }
/* Read status of replies to the employee (HR Desk): one grey tick = sent, two blue ticks = read. */
.hrms-tick { display: inline-flex; vertical-align: -1px; margin-left: .35rem; color: var(--bs-gray-500); }
.hrms-tick svg path { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.hrms-tick .hrms-tick-second { display: none; }
.hrms-tick.read { color: var(--bs-primary); }
.hrms-tick.read .hrms-tick-second { display: inline; }
/* Ask HR: the chat window is at most 600px wide; the Send button is as tall as the text box. */
.card.hrms-askhr { max-width: 600px; }
/* HR Desk: the draft being replaced while the assistant writes a new one. */
.hrms-draft-stale { opacity: .45; pointer-events: none; transition: opacity .2s; }
.hrms-draft-progress .progress-bar { transition: width .25s linear; }
.hrms-askhr-compose textarea { resize: none; }
.hrms-askhr-compose .btn { display: flex; align-items: center; }
.hrms-askhr-log { min-height: 260px; max-height: calc(100vh - 340px); overflow-y: auto; padding-right: .25rem; }
/* HR Desk conversation: its own scroll box that opens at the latest message. */
.hrms-desk-log { max-height: calc(100vh - 300px); min-height: 260px; overflow-y: auto; padding-right: .25rem; }
/* HR Desk reply options: the chosen one is outlined; long replies show three lines. */
.hrms-option { cursor: pointer; transition: border-color .15s, background-color .15s; }
.hrms-option:hover { border-color: var(--bs-gray-400) !important; }
.hrms-option:has(input:checked) { border-color: var(--bs-primary) !important; background-color: var(--bs-primary-light); }
.hrms-option-reply { white-space: normal; display: -webkit-box !important; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 575.98px) { .hrms-bubble { max-width: 92%; } .hrms-askhr-log { max-height: calc(100vh - 300px); } .hrms-desk-log { max-height: 70vh; } }
/* Phones: 100vh is taller than the visible screen (browser bars) and the bottom tab bar covers the bottom, so the chat is
   sized to the visible height minus that bar; otherwise its last message sits below the screen. */
@media (max-width: 767.98px) {
    .hrms-askhr-log { max-height: calc(100vh - 380px - var(--hrms-safe-bottom)); max-height: calc(100dvh - 380px - var(--hrms-safe-bottom)); min-height: 200px; }
}

/* Floating Ask HR bubble (employees): bottom-right, above the phone bottom bar; the scroll-to-top button moves above it. */
.hrms-askhr-bubble {
    position: fixed; right: 24px; bottom: 24px; z-index: 106;
    width: 56px; height: 56px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: #fff; color: #5672ff;
    border: 2px solid rgba(86, 114, 255, .25);
    box-shadow: 0 8px 24px rgba(86, 114, 255, .30);
    transition: transform .15s ease;
}
/* WeyBee mark, swaying gently (no full turn), with a soft pulse around the bubble. */
.hrms-askhr-bubble::before {
    content: ""; position: absolute; inset: -2px; border-radius: 50%;
    border: 2px solid rgba(86, 114, 255, .45);
    animation: hrms-askhr-pulse 2.4s ease-out infinite; pointer-events: none;
}
.hrms-askhr-bubble-logo { width: 58%; height: 58%; object-fit: contain; animation: hrms-askhr-sway 3.2s ease-in-out infinite; }
.hrms-askhr-bubble:hover .hrms-askhr-bubble-logo, .hrms-askhr-bubble:focus-visible .hrms-askhr-bubble-logo { animation-duration: 1.4s; }
.hrms-askhr-bubble:hover, .hrms-askhr-bubble:focus-visible { transform: scale(1.06); }
@keyframes hrms-askhr-sway { 0%, 100% { transform: rotate(-18deg); } 50% { transform: rotate(18deg); } }
@keyframes hrms-askhr-pulse { 0% { transform: scale(1); opacity: .9; } 80%, 100% { transform: scale(1.35); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .hrms-askhr-bubble-logo, .hrms-askhr-bubble::before { animation: none; } }
.hrms-askhr-bubble-count {
    position: absolute; top: -2px; right: -2px; min-width: 20px; height: 20px; padding: 0 5px;
    border-radius: 10px; background: var(--bs-danger); color: #fff; font-size: .75rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center; border: 2px solid var(--bs-body-bg);
}
/* "Ask HR" written under the bubble; the bubble sits higher to make room for it. */
.hrms-askhr-bubble { bottom: 44px; }
.hrms-askhr-bubble-label {
    position: absolute; top: calc(100% + 4px); left: 50%; transform: translateX(-50%);
    white-space: nowrap; padding: 1px 8px; border-radius: 10px;
    background: #fff; color: #5672ff; font-size: .75rem; font-weight: 600; line-height: 1.4;
    box-shadow: 0 2px 8px rgba(86, 114, 255, .25);
}
body:has(#hrms-askhr-bubble) .scrolltop { bottom: 116px; }
@media (max-width: 767.98px) {
    .hrms-askhr-bubble { right: 16px; bottom: calc(104px + var(--hrms-safe-bottom)); width: 52px; height: 52px; }
    body:has(#hrms-askhr-bubble) .scrolltop { bottom: calc(168px + var(--hrms-safe-bottom)); }
}
/* HR Desk: a conversation answered automatically, not yet read by a reviewer. The whole row is tinted (the theme's
   info-light is almost white) with a bar on the left; the first and last cells get room so text clears the bar. */
tr.hrms-row-unread { --hrms-unread-bg: color-mix(in srgb, var(--bs-primary) 9%, var(--bs-body-bg)); }
table.table > tbody > tr.hrms-row-unread > td { background-color: var(--hrms-unread-bg); box-shadow: none; }
table.table > tbody > tr.hrms-row-unread > td:first-child { box-shadow: inset 4px 0 0 var(--bs-primary); border-radius: .5rem 0 0 .5rem; }
table.table > tbody > tr.hrms-row-unread > td:last-child { border-radius: 0 .5rem .5rem 0; }
table.hrms-desk-table > * > tr > :first-child { padding-left: 1rem; }
table.hrms-desk-table > * > tr > :last-child { padding-right: 1rem; }
@media (max-width: 767.98px) {
    table.table-stack > tbody > tr.hrms-row-unread { background: var(--hrms-unread-bg); border-color: var(--bs-primary) !important; box-shadow: inset 4px 0 0 var(--bs-primary); }
    table.table.table-stack > tbody > tr.hrms-row-unread > td { background: transparent; box-shadow: none; border-radius: 0; }
    table.hrms-desk-table > tbody > tr > td:first-child, table.hrms-desk-table > tbody > tr > td:last-child { padding: 0 !important; }
    table.table.table-stack > tbody > tr.hrms-row-unread { padding-left: .75rem !important; }
}

/* To Do rows (To Do page and dashboard card). Open ones with a date: amber on the date, red after it. */
.todo-row { padding: .9rem 1rem; border: 1px solid var(--bs-gray-200); border-left: 4px solid var(--bs-gray-300); border-radius: .75rem; margin-bottom: .75rem; }
.todo-row:last-child { margin-bottom: 0; }
.todo-row.todo-tone-warning { border-left-color: var(--bs-warning); background: var(--bs-warning-light, rgba(255, 199, 0, .08)); }
.todo-row.todo-tone-danger { border-left-color: var(--bs-danger); background: var(--bs-danger-light, rgba(248, 40, 90, .06)); }
.todo-row.todo-tone-info { border-left-color: var(--bs-info); }
.todo-row.todo-tone-success { border-left-color: var(--bs-success); }
.todo-row.is-closed .todo-title { text-decoration: line-through; text-decoration-color: var(--bs-gray-400); color: var(--bs-gray-600) !important; }
.todo-text { white-space: pre-line; overflow-wrap: anywhere; }
.todo-note { background: var(--bs-gray-100); border-radius: .5rem; padding: .5rem .75rem; font-size: .9rem; color: var(--bs-gray-700); }
@media (max-width: 575.98px) {
    .todo-row > .d-flex { flex-wrap: wrap; }
    .todo-actions { width: 100%; justify-content: flex-start !important; padding-left: 2.6rem; }
}

/* An open dropdown inside a table, pinned to the window so the table's scrolling area does not clip it (site.js). */
.dropdown-menu.hrms-menu-fixed {
    position: fixed !important; top: var(--hrms-menu-top) !important; left: var(--hrms-menu-left) !important;
    right: auto !important; bottom: auto !important; inset: var(--hrms-menu-top) auto auto var(--hrms-menu-left) !important;
    transform: none !important; margin: 0 !important; z-index: 1056;
}

/* Mobile app (wwwroot/js/mobile-app.js): full-screen "No internet connection" screen. */
.hrms-offline { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--bs-body-bg, #fff); }
.hrms-offline-card { max-width: 340px; text-align: center; color: var(--bs-gray-700, #4b5675); }
.hrms-offline-card svg { color: var(--bs-primary, #5672ff); margin-bottom: 18px; }
.hrms-offline-card h2 { font-size: 1.35rem; font-weight: 700; color: var(--bs-gray-900, #071437); margin-bottom: 8px; }
.hrms-offline-card p { margin-bottom: 22px; }
.hrms-offline-card .btn { min-width: 160px; }

/* Mobile app (wwwroot/js/mobile-app.js): loader shown between a tap and the next page. Fades in after 150 ms, so pages
   that open at once never flash it; a running bar under the status bar plus a spinner in the middle. */
.hrms-page-loader { position: fixed; inset: 0; z-index: 1990; display: flex; align-items: center; justify-content: center;
    background: rgba(255, 255, 255, .45); opacity: 0; visibility: hidden; pointer-events: none;
    transition: opacity .2s ease, visibility 0s linear .2s; }
.hrms-page-loader.show { opacity: 1; visibility: visible; pointer-events: auto; transition: opacity .2s ease .15s, visibility 0s linear .15s; }
[data-bs-theme="dark"] .hrms-page-loader { background: rgba(15, 16, 21, .5); }
.hrms-page-loader-card { width: 64px; height: 64px; border-radius: 16px; display: flex; align-items: center; justify-content: center;
    background: var(--bs-body-bg, #fff); box-shadow: 0 6px 24px rgba(0, 0, 0, .12); }
.hrms-page-loader-card .spinner-border { width: 28px; height: 28px; border-width: 3px; color: var(--bs-primary, #5672ff); }
.hrms-page-loader-bar { position: absolute; top: var(--hrms-safe-top, 0px); left: 0; right: 0; height: 3px; overflow: hidden; }
.hrms-page-loader-bar::before { content: ""; position: absolute; top: 0; bottom: 0; left: -40%; width: 40%; border-radius: 3px;
    background: var(--bs-primary, #5672ff); animation: hrms-page-loader-run 1.1s ease-in-out infinite; }
@keyframes hrms-page-loader-run { to { left: 100%; } }
@media (prefers-reduced-motion: reduce) { .hrms-page-loader-bar::before { animation-duration: 2.5s; } }

/* Document preview popup (site.js hrms.previewDocument). */
.hrms-doc-preview-body { min-height: 240px; background: var(--bs-gray-100); }
.hrms-doc-preview-img { max-height: 75vh; object-fit: contain; }
.hrms-doc-preview-frame { width: 100%; height: 75vh; border: 0; border-radius: .475rem; background: #fff; }
/* A field filled from "Same as permanent address". */
.form-control.hrms-copied, .form-select.hrms-copied { background-color: var(--bs-gray-100); color: var(--bs-gray-700); }

/* Manual punch (added by the employee in a punch request): stands out from device punches wherever punch times are listed. */
.hrms-manual-punch { display: inline-flex; align-items: center; gap: 3px; padding: 0 6px; border-radius: 4px; font-weight: 600; white-space: nowrap;
    color: #7a4b00; background: #fff8dd; box-shadow: inset 0 0 0 1px var(--bs-warning, #f6c000); }
.hrms-manual-punch-mark { font-size: .8em; line-height: 1; }
[data-bs-theme="dark"] .hrms-manual-punch { color: #ffd76a; background: rgba(246, 192, 0, .14); }
/* WhatsApp log: a message whose response is an error. */
.s-table tr.hrms-log-error > td { background: rgba(241, 65, 108, .06); }
.s-table tr.hrms-log-error > td:first-child { box-shadow: inset 3px 0 0 var(--bs-danger); }
[data-bs-theme="dark"] .s-table tr.hrms-log-error > td { background: rgba(241, 65, 108, .12); }

/* Mobile app: edge to edge. The page draws behind the transparent status bar; the header, side menu, login page and
   full-screen dialogs grow by the status bar's height so nothing sits under the clock (and under the home bar below). */
html.hrms-app body#kt_body { padding-top: var(--hrms-safe-top); padding-bottom: var(--hrms-safe-bottom); }
html.hrms-app #kt_app_header { padding-top: var(--hrms-safe-top); }
html.hrms-app .app-sidebar,
html.hrms-app .drawer { padding-top: var(--hrms-safe-top); padding-bottom: var(--hrms-safe-bottom); }
html.hrms-app .modal-fullscreen .modal-content { padding-top: var(--hrms-safe-top); padding-bottom: var(--hrms-safe-bottom); }
html.hrms-app .hrms-offline { padding-top: calc(24px + var(--hrms-safe-top)); padding-bottom: calc(24px + var(--hrms-safe-bottom)); }
@media (max-width: 991.98px) {
    html.hrms-app #kt_app_header { height: calc(56px + var(--hrms-safe-top)); }
    html.hrms-app body[data-kt-app-header-fixed-mobile="true"] { --bs-app-header-height: calc(56px + var(--hrms-safe-top)); }
}
@media (min-width: 992px) {
    html.hrms-app body[data-kt-app-header-fixed="true"] { --bs-app-header-height: calc(74px + var(--hrms-safe-top)); }
}
