@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap');

/* ─── Page loader ──────────────────────────────────────────────────────────── */
#page-loader {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #e8eef7 0%, #edf0f8 40%, #f0edf8 70%, #f5eef5 100%);
    transition: opacity 0.45s ease, visibility 0.45s ease;
}
html.dark #page-loader {
    background: linear-gradient(145deg, #0f172a 0%, #151e30 40%, #181525 70%, #1a1528 100%);
}
#page-loader.pl-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}
.pl-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}
.pl-logo {
    width: 72px;
    height: 72px;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(99, 102, 241, 0.18);
    animation: pl-breathe 2s ease-in-out infinite;
}
.pl-ring {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 3px solid rgba(99, 102, 241, 0.18);
    border-top-color: #6366f1;
    animation: pl-spin 0.75s linear infinite;
}
@keyframes pl-breathe {
    0%, 100% { transform: scale(1);    opacity: 1; }
    50%       { transform: scale(1.06); opacity: 0.82; }
}
@keyframes pl-spin {
    to { transform: rotate(360deg); }
}

html, body {
    background: linear-gradient(145deg, #e8eef7 0%, #edf0f8 40%, #f0edf8 70%, #f5eef5 100%);
    background-attachment: fixed;
    font-family: 'Roboto', sans-serif;
    height: 100%;
    min-height: 100%;
}

/**************************************/
/* Footer "Always bottom of page"     */

.wrapper {
    min-height: 100%;
    position: relative;

    /** Footer height plus 24 px */
    padding-bottom: 90px;
}

.footer {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;

    overflow: hidden;

    /** 66 pixels as total height */
    height: 40px;
    padding: 8px 16px;
}

/**************************************/
/* Footer                             */

.footer {
    background: #303030;
    color: #FFFFFF;
}

/**************************************/
/* Navbar */

.navbar {
    border-top: solid 4px #85be64;
    border-bottom: solid 1px #85be64;
}

.navbar .navbar-brand {
    padding: 8px 16px;
}

.navbar .navbar-brand > img {
    height: 40px;
}

/**************************************/
/* Glassmorphism cards & containers   */

.app-content .container,
.app-content .container-fluid,
.app-content .card {
    background: rgba(255, 255, 255, 0.62);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.72);
    box-shadow: 0 8px 32px rgba(100, 110, 160, 0.10), 0 1.5px 4px rgba(0,0,0,0.04);
    margin-top: 0 !important;
    margin-bottom: 24px;
}

/* Inner breathing room for glass containers (cards use .card-body for this) */
.app-content .container,
.app-content .container-fluid {
    padding: 24px !important;
}

.app-content .card-body {
    padding: 24px;
}

/**************************************/
/* Colors */

.color-gray-dark {
    color: #5e5d5d;
}

.color-blue {
    color: #007bff;
}

.invoice-blue{
    color: #08498e;
}

.color-green{
    color: #40eb13;
}
.color-red{
    color: #eb1313;
}

.step-button.is-disabled {
    opacity: 0.5;
}

html.dark .step-button.is-disabled {
    opacity: 0.7;
}
.autocomplete-suggestions { border: 1px solid #999; background: #FFF; overflow: auto; }
.autocomplete-suggestion { padding: 2px 5px; white-space: nowrap; overflow: hidden; }
.autocomplete-selected { background: #F0F0F0; }
.autocomplete-suggestions strong { font-weight: normal; color: #22b3d5; }
.autocomplete-group { padding: 2px 5px; }
.autocomplete-group strong { display: block; border-bottom: 1px solid #fefefe; }

.no-print {
    background-color: #e8e8e8;
    padding: 10px;
    border: none;
}

/* Print-specific styles */
@media print {
    .no-print {
        display: none;
    }
    .page-break-added {
        page-break-after: always !important;
    }
}

.input-error {
    border-color: red;
}

.error-message {
    color: red;
    font-size: 0.9em;
    margin-top: 5px;
}

.spinner-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.container{
    position: relative !important;
}

@media (min-width: 1200px) {
    .container {
        max-width: 95% !important;
    }
}

/* Progress Circle Wrapper */
.progress-circle {
    position: relative;
    width: 50px;
    height: 50px;
    margin: auto;
}

/* The SVG itself */
.circle-svg {
    transform: rotate(-90deg); /* Rotate to make the progress start from the top */
    width: 100%;
    height: 100%;
}

/* Background Circle */
.circle-bg {
    fill: none; /* No fill for the center */
    stroke: #e6e6e6; /* Light gray track */
    stroke-width: 3.8; /* Width of the track */
}

/* Progress Circle */
.circle-progress {
    fill: none; /* No fill for the center */
    stroke: #4caf50; /* Green for progress */
    stroke-width: 3.8; /* Width of the progress stroke */
    stroke-linecap: round; /* Rounded ends for the progress stroke */
    stroke-dasharray: 0, 100; /* Default: 0% progress */
    transition: stroke-dasharray 0.3s ease; /* Smooth animation for progress changes */
}

/* Text in the Center */
.circle-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    font-weight: bold;
    color: #333; /* Text color */
    background: transparent; /* Clear background */
}

.spinner-border {
    width: 3rem;
    height: 3rem;
}

html.dark table.table.table-striped tbody tr.highlighted-row,
html.dark table.table.table-striped tbody tr.highlighted-row:nth-of-type(odd),
html.dark table.table.table-striped tbody tr.highlighted-row:nth-of-type(even),
table.table.table-striped tbody tr.highlighted-row,
.highlighted-row {
    background-color: rgba(255, 0, 0, 0.2) !important; /* Light red background */
    color: darkred !important;
}

.sort-icon {
    margin-left: 5px;
    cursor: pointer;
    color: gray;
}

.sort-icon:hover {
    color: black;
}

.fa-sort-up,
.fa-sort-down {
    color: black;
}

/* Modern Table Styles */
.table-container {
    overflow-x: auto;
    margin: 20px 0;
    border-radius: 7px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

table:not(.table-condensed) {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: #FFFFFF;
    border-radius: 7px;
    overflow: hidden;
}

/* Table Header */
table:not(.table-condensed) thead {
    font-weight: bold;
    text-transform: uppercase;
    background: #f8f9fa; /* Light gray */
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1); /* Subtle shadow */
    font-size: small !important;
}

table:not(.table-condensed) thead th {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 2px solid #dee2e6;
    position: relative;
}

table:not(.table-condensed) thead th.sortable {
    cursor: pointer;
    transition: color 0.2s;
}

table:not(.table-condensed) thead th.sortable:hover {
    color: #333;
}

/* Table Rows */
table:not(.table-condensed) tbody tr {
    transition: background 0.3s ease;
}

table:not(.table-condensed) tbody tr:nth-child(even) {
    background: #f8f9fa;
}

table:not(.table-condensed) tbody tr:hover {
    background: #d6e3ff;
}

/* Table Cells */
table:not(.table-condensed) td {
    padding: 12px 16px;
    border-bottom: 1px solid #dee2e6;
    color: #333;
}

.datepicker-dropdown {
    min-width: 17rem;
}

.datepicker table.table-condensed {
    width: 100%;
}

.datepicker table.table-condensed tbody tr:hover > td,
.datepicker table.table-condensed tbody tr:hover > th {
    background: transparent !important;
}

.datepicker table.table-condensed td.day:hover,
.datepicker table.table-condensed td.day.focused {
    background: #eeeeee !important;
}

.datepicker-dropdown {
    background: #ffffff;
    border: 1px solid #dee2e6;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

.datepicker table.table-condensed th,
.datepicker table.table-condensed td {
    color: #1f2937;
}

.datepicker table.table-condensed td.day.active,
.datepicker table.table-condensed td.day.active:hover,
.datepicker table.table-condensed td.day.today,
.datepicker table.table-condensed td.day.today:hover {
    color: #ffffff !important;
    background: #2563eb !important;
}

html.dark .datepicker-dropdown {
    background: #0f172a;
    border-color: #334155;
    box-shadow: 0 8px 24px rgba(2, 6, 23, 0.6);
}

html.dark .datepicker table.table-condensed th,
html.dark .datepicker table.table-condensed td {
    color: #e2e8f0;
}

html.dark .datepicker table.table-condensed td.day:hover,
html.dark .datepicker table.table-condensed td.day.focused {
    background: #1e293b !important;
}

html.dark .datepicker table.table-condensed td.day.active,
html.dark .datepicker table.table-condensed td.day.active:hover,
html.dark .datepicker table.table-condensed td.day.today,
html.dark .datepicker table.table-condensed td.day.today:hover {
    color: #ffffff !important;
    background: #3b82f6 !important;
}

/* Responsive Table */
@media (max-width: 768px) {
    table:not(.bdg-table):not(.table-condensed) {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    table:not(.bdg-table):not(.table-condensed) thead,
    table:not(.bdg-table):not(.table-condensed) tbody,
    table:not(.bdg-table):not(.table-condensed) th,
    table:not(.bdg-table):not(.table-condensed) td,
    table:not(.bdg-table):not(.table-condensed) tr {
        display: block;
    }

    table:not(.bdg-table):not(.table-condensed) thead {
        display: none;
    }

    table:not(.bdg-table):not(.table-condensed) tbody tr {
        margin-bottom: 15px;
        border-bottom: 2px solid #ddd;
        display: flex;
        flex-direction: column;
    }

    table:not(.bdg-table):not(.table-condensed) td {
        display: flex;
        justify-content: space-between;
        padding: 8px 12px;
    }

    table:not(.bdg-table):not(.table-condensed) td::before {
        content: attr(data-label);
        font-weight: bold;
        color: #333;
    }

    .bdg-table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .bdg-table-responsive .bdg-table {
        display: table;
        white-space: nowrap;
    }

    .bdg-table-responsive .bdg-table thead,
    .bdg-table-responsive .bdg-table tbody,
    .bdg-table-responsive .bdg-table tfoot {
        display: table-row-group;
    }

    .bdg-table-responsive .bdg-table tr {
        display: table-row;
    }

    .bdg-table-responsive .bdg-table th,
    .bdg-table-responsive .bdg-table td {
        display: table-cell;
        padding: 8px 12px;
    }

    .bdg-table-responsive .bdg-table {
        font-size: 0.85rem;
    }

    .bdg-table-responsive .bdg-table th,
    .bdg-table-responsive .bdg-table td {
        padding: 6px 8px;
    }
}

.bdg-table .review-team-header td {
    background: #dbe7ff;
    color: #0f172a;
    font-weight: 700;
    position: sticky;
    top: 0;
    z-index: 3;
    border-top: 1px solid #a5b4fc;
    border-bottom: 2px solid #6366f1;
    box-shadow: inset 0 -1px 0 rgba(15, 23, 42, 0.12);
}

.review-team-toggle {
    width: 100%;
    border: 0;
    background: linear-gradient(90deg, rgba(15, 23, 42, 0.08), transparent 60%);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    color: inherit;
    font-weight: inherit;
    text-align: left;
}

.review-team-toggle i {
    transition: transform 0.2s ease;
}

.review-team-header.is-collapsed .review-team-toggle i {
    transform: rotate(-90deg);
}

.review-team-label {
    flex: 1;
}

.review-team-count {
    font-size: 12px;
    background: rgba(15, 23, 42, 0.16);
    padding: 2px 8px;
    border-radius: 999px;
}

html.dark .bdg-table .review-team-header td {
    background: #223047;
    color: #e2e8f0;
    border-top-color: rgba(148, 163, 184, 0.45);
    border-bottom-color: #7c93ff;
    box-shadow: inset 0 -1px 0 rgba(226, 232, 240, 0.12);
}

html.dark .review-team-count {
    background: rgba(226, 232, 240, 0.25);
}

.swal2-week-picker {
    background: #ffffff !important;
    color: #0f172a !important;
}

html.dark .swal2-week-picker {
    background: #1f2937 !important;
    color: #e2e8f0 !important;
}

html.dark .swal2-week-picker .swal2-input {
    background: #111827 !important;
    color: #e2e8f0 !important;
    border-color: rgba(148, 163, 184, 0.4) !important;
}

/* Ensure dropdown-submenu appears properly on hover or trigger */
.dropdown-menu {
    min-width: 16rem;
    white-space: normal;
    word-break: break-word;
    padding: 0.5rem 0;
}

/* Fix overflow and spacing in dropdown items */
.dropdown-menu .dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    white-space: normal;
    overflow-wrap: anywhere;
}

.dropdown-submenu > .dropdown-menu {
    position: absolute;
    top: 0;
    left: 100%;
    margin-top: -1px;
    display: none;
}

.dropdown-submenu:hover > .dropdown-menu,
.dropdown-submenu:focus-within > .dropdown-menu {
    display: block;
}

.nav-item.dropdown:hover > .dropdown-menu {
    display: block;
}

/* Ensure submenu is hidden by default */
.dropdown-submenu > .dropdown-menu {
    position: absolute;
    top: 0;
    right: 100%;
    margin-top: 0;
    margin-right: 0.25rem;
    z-index: 1050;
    display: none;
    transition: opacity 0.15s ease-in-out;
    opacity: 0;
    pointer-events: none;
}

/* Show submenu on hover */
.dropdown-submenu:hover > .dropdown-menu {
    display: block;
    opacity: 1;
    pointer-events: auto;
}

/* Dark mode table striping + hover for legacy/static CSS */
html.dark table:not(.table-condensed) tbody tr:nth-child(odd) {
    background-color: #223042 !important;
}

html.dark table:not(.table-condensed) tbody tr:nth-child(even) {
    background-color: #2a3850 !important;
}

html.dark table:not(.table-condensed) tbody tr:nth-child(odd) td,
html.dark table:not(.table-condensed) tbody tr:nth-child(even) td {
    background-color: inherit !important;
}

html.dark .table-striped tbody tr:nth-of-type(odd) > *,
html.dark .table-striped tbody tr:nth-of-type(even) > * {
    background-color: inherit !important;
}

html.dark table:not(.table-condensed) tbody tr:hover,
html.dark table:not(.table-condensed) tbody tr:hover td {
    background-color: #5a7294 !important;
}

html.dark .table-hover tbody tr:hover > *,
html.dark table:not(.table-condensed) tbody tr:hover > * {
    background-color: #5a7294 !important;
}

html.dark table:not(.table-condensed) tbody td,
html.dark table:not(.table-condensed) thead th {
    color: #dbe1ea !important;
}

/* ── Dark mode: base ────────────────────────────────────────────────── */
html.dark,
html.dark body {
    background: linear-gradient(145deg, #0f172a 0%, #151e30 40%, #181525 70%, #1a1528 100%);
    background-attachment: fixed;
    color: #e2e8f0;
}

html.dark h1, html.dark h2, html.dark h3,
html.dark h4, html.dark h5, html.dark h6 {
    color: #f1f5f9;
}

html.dark .text-muted  { color: #64748b !important; }
html.dark .text-dark   { color: #e2e8f0 !important; }
html.dark .text-body   { color: #e2e8f0 !important; }
html.dark small        { color: inherit; }

/* ── Dark mode: form controls ───────────────────────────────────────── */
html.dark .form-control,
html.dark .form-control:focus,
html.dark input[type="text"],
html.dark input[type="email"],
html.dark input[type="password"],
html.dark input[type="number"],
html.dark input[type="search"],
html.dark input[type="tel"],
html.dark input[type="url"],
html.dark input[type="date"],
html.dark input[type="time"],
html.dark textarea,
html.dark select {
    background-color: #1e293b !important;
    border-color: rgba(148, 163, 184, 0.22) !important;
    color: #e2e8f0 !important;
}

html.dark .form-control::placeholder { color: #64748b; opacity: 1; }

html.dark .form-control:disabled,
html.dark .form-control[readonly] {
    background-color: #111827 !important;
    color: #64748b !important;
}

html.dark .input-group-text {
    background-color: #1a2538;
    border-color: rgba(148, 163, 184, 0.22);
    color: #94a3b8;
}

html.dark .form-check-label,
html.dark .custom-control-label,
html.dark label {
    color: #cbd5e1;
}

html.dark .custom-control-label::before {
    background-color: #1e293b;
    border-color: rgba(148, 163, 184, 0.3);
}

/* ── Dark mode: modals ──────────────────────────────────────────────── */
html.dark .modal-content {
    background-color: #1a2538;
    border-color: rgba(148, 163, 184, 0.12);
    color: #e2e8f0;
}

html.dark .modal-header {
    background-color: #131e30;
    border-bottom-color: rgba(148, 163, 184, 0.12);
    color: #f1f5f9;
}

html.dark .modal-title { color: #f1f5f9; }

html.dark .modal-footer {
    background-color: #131e30;
    border-top-color: rgba(148, 163, 184, 0.12);
}

html.dark .close       { color: #94a3b8; text-shadow: none; }
html.dark .close:hover { color: #e2e8f0; }

/* ── Dark mode: alerts ──────────────────────────────────────────────── */
html.dark .alert {
    border-color: rgba(148, 163, 184, 0.18);
}
html.dark .alert-info {
    background-color: rgba(30, 58, 95, 0.55);
    border-color: rgba(59, 130, 246, 0.28);
    color: #93c5fd;
}
html.dark .alert-warning {
    background-color: rgba(78, 52, 0, 0.5);
    border-color: rgba(234, 179, 8, 0.28);
    color: #fde68a;
}
html.dark .alert-danger {
    background-color: rgba(69, 10, 10, 0.5);
    border-color: rgba(239, 68, 68, 0.28);
    color: #fca5a5;
}
html.dark .alert-success {
    background-color: rgba(6, 46, 20, 0.5);
    border-color: rgba(34, 197, 94, 0.28);
    color: #86efac;
}
html.dark .alert-secondary {
    background-color: rgba(30, 41, 59, 0.65);
    border-color: rgba(148, 163, 184, 0.18);
    color: #cbd5e1;
}
html.dark .alert-light {
    background-color: rgba(30, 41, 59, 0.65);
    border-color: rgba(148, 163, 184, 0.18);
    color: #cbd5e1;
}

/* ── Dark mode: list groups ─────────────────────────────────────────── */
html.dark .list-group-item {
    background-color: #1a2538;
    border-color: rgba(148, 163, 184, 0.12);
    color: #e2e8f0;
}
html.dark .list-group-item:hover { background-color: #243247; }
html.dark .list-group-item.active {
    background-color: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
}

/* ── Dark mode: buttons ─────────────────────────────────────────────── */
html.dark .btn-outline-secondary {
    color: #94a3b8;
    border-color: #475569;
}
html.dark .btn-outline-secondary:hover {
    background-color: #334155;
    color: #e2e8f0;
    border-color: #64748b;
}
html.dark .btn-outline-dark {
    color: #e2e8f0;
    border-color: #475569;
}
html.dark .btn-outline-dark:hover {
    background-color: #334155;
    color: #ffffff;
}
html.dark .btn-light, html.dark .btn-outline-light {
    background-color: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}
html.dark .btn-light:hover, html.dark .btn-outline-light:hover {
    background-color: #243247;
    color: #ffffff;
}

/* ── Dark mode: badges ──────────────────────────────────────────────── */
html.dark .badge-light, html.dark .badge-secondary {
    background-color: #334155;
    color: #e2e8f0;
}

/* ── Dark mode: dividers and borders ────────────────────────────────── */
html.dark hr                 { border-color: rgba(148, 163, 184, 0.14); }
html.dark .border            { border-color: rgba(148, 163, 184, 0.18) !important; }
html.dark .border-bottom     { border-bottom-color: rgba(148, 163, 184, 0.18) !important; }
html.dark .border-top        { border-top-color: rgba(148, 163, 184, 0.18) !important; }

/* ── Dark mode: pre / code ──────────────────────────────────────────── */
html.dark pre, html.dark code {
    background-color: #111827;
    color: #a5f3fc;
    border-color: rgba(148, 163, 184, 0.14);
}

/* ── Dark mode: pagination ──────────────────────────────────────────── */
html.dark .page-link {
    background-color: #1e293b;
    border-color: rgba(148, 163, 184, 0.18);
    color: #93c5fd;
}
html.dark .page-link:hover {
    background-color: #243247;
    color: #bfdbfe;
}
html.dark .page-item.active .page-link {
    background-color: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
}
html.dark .page-item.disabled .page-link {
    background-color: #111827;
    color: #475569;
}

html.dark .app-content .container,
html.dark .app-content .container-fluid,
html.dark .app-content .card {
    background: rgba(22, 30, 50, 0.65);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.07);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.30), 0 1.5px 4px rgba(0,0,0,0.15);
}

/* Legacy dark mode overrides for nav, dropdowns, and containers */
html.dark .navbar {
    background: #1b2331;
    border-top: solid 4px #3a4e6c;
    border-bottom: solid 1px #2c3d56;
}

html.dark .navbar .nav-link,
html.dark .navbar .navbar-brand {
    color: #dbe1ea;
}

html.dark .navbar .nav-link:hover,
html.dark .navbar .nav-link:focus {
    color: #eef2f7;
}

html.dark .table-container,
html.dark table:not(.table-condensed) {
    background: #1f2a3a;
}

html.dark .card-header,
html.dark .card-footer {
    background-color: #243247;
    color: #dbe1ea;
    border-color: #3a4e6c;
}

html.dark .nav-tabs {
    border-bottom: 1px solid #2f3d52;
}

html.dark .nav-tabs .nav-link {
    color: #c7d2fe;
    background-color: #1b2331;
    border-color: #2f3d52;
}

html.dark .nav-tabs .nav-link:hover,
html.dark .nav-tabs .nav-link:focus {
    color: #eef2f7;
    background-color: #223042;
    border-color: #3a4e6c;
}

html.dark .nav-tabs .nav-link.active,
html.dark .nav-tabs .nav-item.show .nav-link {
    color: #f8fafc;
    background-color: #2f3d52;
    border-color: #4c5f79;
}

html.dark table:not(.table-condensed) thead {
    background: #233246;
}

html.dark table:not(.table-condensed) thead th {
    border-bottom: 2px solid #2f3d52;
}

html.dark table:not(.table-condensed) tbody tr {
    border-bottom: 1px solid #2f3d52;
}

html.dark .dropdown-menu {
    background-color: #1f2a3a;
    border: 1px solid #2f3d52;
}

html.dark .dropdown-menu .dropdown-item {
    color: #dbe1ea;
    -webkit-tap-highlight-color: rgba(44, 61, 86, 0.6);
}

html.dark .dropdown-menu .dropdown-item:hover,
html.dark .dropdown-menu .dropdown-item:focus,
html.dark .dropdown-menu .dropdown-item:focus-visible,
html.dark .dropdown-menu .dropdown-item:active,
html.dark .dropdown-menu .dropdown-item.active,
html.dark .dropdown-menu .dropdown-item.show,
html.dark .dropdown-menu .show > .dropdown-item,
html.dark .dropdown-menu .show > .dropdown-item:focus,
html.dark .dropdown-menu .show > .dropdown-item:active {
    background-color: #2c3d56 !important;
    color: #eef2f7 !important;
}

html.dark .autocomplete-suggestions {
    background: #1f2a3a;
    border-color: #2f3d52;
    color: #dbe1ea;
}

html.dark .autocomplete-selected {
    background: #2c3d56;
}

html.dark .autocomplete-group strong {
    border-bottom: 1px solid #2f3d52;
}

/* Final dark hover override for Bootstrap tables */
html.dark .table-hover tbody tr:hover > td,
html.dark .table-hover tbody tr:hover > th,
html.dark table.table-hover tbody tr:hover > td,
html.dark table.table-hover tbody tr:hover > th {
    background-color: #5a7294 !important;
}

/* Sidebar + topbar layout */
.app-body {
    min-height: 100vh;
}

.app-shell {
    min-height: 100vh;
    align-items: stretch;
    width: 100%;
}

.sidebar {
    width: 240px;
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-right: 1px solid rgba(255, 255, 255, 0.6);
    color: #0f172a;
    font-family: 'Roboto', sans-serif;
    position: sticky;
    top: 0;
    height: 100vh;
    transition: width 0.2s ease, transform 0.2s ease;
    z-index: 300;
    overflow-y: auto;
    overflow-x: visible;
    flex: 0 0 auto;
}

.sidebar-preload .sidebar {
    transition: none;
}

.sidebar-preload .sidebar * {
    transition: none;
}

.sidebar-collapsed .sidebar {
    width: 72px;
}

.sidebar-expanded .sidebar {
    width: 240px;
}

.sidebar.collapsed {
    width: 72px;
}

.sidebar.expanded {
    width: 240px;
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 250;
}

.sidebar-mobile-open .sidebar-overlay {
    opacity: 1;
    pointer-events: auto;
}

.sidebar-inner {
    padding: 16px 12px;
    overflow: visible;
}

.sidebar-brand {
    padding: 8px 8px 16px;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 16px;
    justify-content: center;
}

.sidebar-nav {
    overflow: visible;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #0f172a;
    text-decoration: none;
    justify-content: center;
    width: 100%;
}

.sidebar-logo img {
    height: 32px;
    max-width: 100%;
    object-fit: contain;
}

.sidebar-logo .logo-compact {
    display: none;
    height: 30px;
}

.sidebar.collapsed .sidebar-logo .logo-full {
    display: none;
}

.sidebar.collapsed .sidebar-logo .logo-compact {
    display: block;
}


.sidebar-group {
    margin-bottom: 12px;
}

.sidebar-group-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: #eef2f7;
    border: 0;
    color: #475569;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-radius: 10px;
}

.sidebar-group-toggle:hover {
    color: #0f172a;
    background: #f1f5f9;
}

.sidebar-group-label {
    flex-grow: 1;
}

.sidebar-caret {
    margin-left: auto;
    font-size: 10px;
    transition: transform 0.2s ease;
}

.sidebar-group-toggle[aria-expanded="false"] .sidebar-caret,
.sidebar-link-toggle[aria-expanded="false"] .sidebar-caret {
    transform: rotate(-90deg);
}

.sidebar-group-toggle[aria-expanded="true"] .sidebar-caret,
.sidebar-link-toggle[aria-expanded="true"] .sidebar-caret {
    transform: rotate(0deg);
}

.sidebar-menu,
.sidebar-submenu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar-link,
.sidebar-link-toggle,
.sidebar-sublink {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    border-radius: 8px;
    color: #0f172a;
    text-decoration: none;
    font-size: 14px;
    background: transparent;
    border: 0;
}

.sidebar-sublink-nested {
    padding-left: 26px;
}

.sidebar-link:hover,
.sidebar-link-toggle:hover,
.sidebar-sublink:hover {
    background: #f3f4f6;
    color: #0f172a;
    text-decoration: none;
}

.sidebar-link.active,
.sidebar-sublink.active,
.sidebar-link-toggle.active {
    background: rgba(37, 99, 235, 0.15);
    color: #1d4ed8;
}

.sidebar-submenu {
    margin-left: 18px;
    margin-top: 6px;
    margin-bottom: 6px;
}

.sidebar-subheader {
    padding: 6px 10px;
    font-size: 11px;
    text-transform: uppercase;
    color: #94a3b8;
}

.sidebar.collapsed .sidebar-group-label,
.sidebar.collapsed .sidebar-link-label,
.sidebar.collapsed .sidebar-logo-text,
.sidebar.collapsed .sidebar-caret,
.sidebar.collapsed .sidebar-subheader,
.sidebar.collapsed .sidebar-submenu {
    display: none;
}

.sidebar-collapsed .sidebar .sidebar-group-label,
.sidebar-collapsed .sidebar .sidebar-link-label,
.sidebar-collapsed .sidebar .sidebar-logo-text,
.sidebar-collapsed .sidebar .sidebar-caret,
.sidebar-collapsed .sidebar .sidebar-subheader,
.sidebar-collapsed .sidebar .sidebar-submenu {
    display: none;
}

.sidebar.collapsed .sidebar-link,
.sidebar.collapsed .sidebar-link-toggle {
    justify-content: center;
}

.sidebar-collapsed .sidebar .sidebar-link,
.sidebar-collapsed .sidebar .sidebar-link-toggle {
    justify-content: center;
}

.sidebar.collapsed .sidebar-link i,
.sidebar.collapsed .sidebar-link-toggle i {
    margin: 0;
    width: 20px;
    text-align: center;
}

.sidebar-collapsed .sidebar .sidebar-link i,
.sidebar-collapsed .sidebar .sidebar-link-toggle i {
    margin: 0;
    width: 20px;
    text-align: center;
}

.sidebar.collapsed .sidebar-group-toggle {
    justify-content: center;
    background: #e2e8f0;
}

.sidebar.collapsed .sidebar-group-toggle i {
    width: 20px;
    text-align: center;
}

.sidebar-collapsed .sidebar .sidebar-group-toggle {
    justify-content: center;
    background: #e2e8f0;
}

.sidebar-collapsed .sidebar .sidebar-group-toggle i {
    width: 20px;
    text-align: center;
}

.sidebar.collapsed .sidebar-item {
    position: relative;
}

.sidebar.collapsed .sidebar-item {
    z-index: 500;
}

.sidebar-flyout-panel {
    position: fixed;
    min-width: 220px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 8px;
    z-index: 999;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.35);
    display: none;
}

html.dark .sidebar {
    background: rgba(10, 18, 38, 0.72);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    color: #e2e8f0;
}

html.dark .sidebar-brand {
    border-bottom-color: rgba(148, 163, 184, 0.2);
}

html.dark .sidebar-logo {
    color: #e2e8f0;
}

html.dark .sidebar-group-toggle {
    color: #cbd5f5;
    background: rgba(30, 41, 59, 0.85);
}

html.dark .sidebar-group-toggle:hover {
    color: #ffffff;
    background: rgba(148, 163, 184, 0.15);
}

html.dark .sidebar.collapsed .sidebar-group-toggle {
    background: rgba(51, 65, 85, 0.9);
}

html.dark.sidebar-collapsed .sidebar .sidebar-group-toggle {
    background: rgba(51, 65, 85, 0.9);
}

html.dark .sidebar-link,
html.dark .sidebar-link-toggle,
html.dark .sidebar-sublink {
    color: #e2e8f0;
}

html.dark .sidebar-link:hover,
html.dark .sidebar-link-toggle:hover,
html.dark .sidebar-sublink:hover {
    background: rgba(148, 163, 184, 0.18);
    color: #ffffff;
}

html.dark .sidebar-link.active,
html.dark .sidebar-sublink.active,
html.dark .sidebar-link-toggle.active {
    background: rgba(37, 99, 235, 0.35);
    color: #ffffff;
}

html.dark .sidebar-subheader {
    color: rgba(203, 213, 245, 0.6);
}

html.dark .sidebar-flyout-panel {
    background: #0f172a;
    border-color: rgba(148, 163, 184, 0.25);
}

.sidebar-flyout-panel .sidebar-flyout-inner,
.sidebar-flyout-panel .sidebar-submenu {
    display: block !important;
    margin: 0;
    list-style: none;
    padding-left: 0;
}

.topbar {
    height: 48px;
    padding: 0 16px;
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.6);
    position: sticky;
    top: 0;
    z-index: 200;
    font-family: 'Roboto', sans-serif;
}

.topbar-toggle {
    color: #1f2937;
    font-size: 18px;
    padding: 6px;
}

.topbar-title h1 {
    font-size: 14px;
    font-weight: 300;
    color: #4b5563;
    letter-spacing: 0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 42vw;
}

.topbar-breadcrumbs {
    font-size: 12px;
    color: #6b7280;
}

.topbar-actions .topbar-icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 9999px;
    background: #f3f4f6;
    color: #4b5563;
}

.notification-count-badge {
    position: absolute;
    bottom: -2px;
    left: -2px;
    background: #ef4444;
    color: #ffffff;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 9999px;
    line-height: 1;
}

.app-content {
    padding: 36px 24px 72px;
    min-width: 0;
    overflow-x: auto;
}

.app-main {
    min-width: 0;
}

@media (max-width: 991.98px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        transform: translateX(-100%);
    }

    .sidebar.expanded {
        transform: translateX(0);
    }

    .sidebar.collapsed {
        transform: translateX(-100%);
    }

    .sidebar-mobile-open .sidebar {
        width: 240px;
    }

    .sidebar-mobile-open .sidebar .sidebar-inner,
    .sidebar-mobile-open .sidebar .sidebar-brand,
    .sidebar-mobile-open .sidebar .sidebar-logo {
        justify-content: flex-start;
        align-items: center;
    }

    .sidebar-mobile-open .sidebar .sidebar-logo {
        gap: 10px;
    }

    .sidebar-mobile-open .sidebar .sidebar-group-toggle,
    .sidebar-mobile-open .sidebar .sidebar-link,
    .sidebar-mobile-open .sidebar .sidebar-link-toggle,
    .sidebar-mobile-open .sidebar .sidebar-sublink {
        justify-content: flex-start;
        text-align: left;
    }

    .sidebar-mobile-open .sidebar .sidebar-group-toggle {
        background: #1b2331;
        color: #e5e7eb;
    }

    .sidebar-mobile-open .sidebar .sidebar-group-toggle:hover {
        background: #243247;
        color: #f8fafc;
    }

    .sidebar-mobile-open .sidebar .sidebar-subheader {
        color: #cbd5f5;
    }

    .sidebar-mobile-open .sidebar .sidebar-group-label,
    .sidebar-mobile-open .sidebar .sidebar-link-label,
    .sidebar-mobile-open .sidebar .sidebar-logo-text,
    .sidebar-mobile-open .sidebar .sidebar-caret,
    .sidebar-mobile-open .sidebar .sidebar-subheader,
    .sidebar-mobile-open .sidebar .sidebar-submenu {
        display: block !important;
    }

    .sidebar-mobile-open .sidebar .sidebar-logo .logo-full {
        display: block !important;
    }

    .sidebar-mobile-open .sidebar .sidebar-logo .logo-compact {
        display: none !important;
    }

    /* Search is hidden when collapsed, but must show when mobile sidebar is open */
    .sidebar-mobile-open .sidebar .sidebar-search {
        display: block;
    }
}

html.dark .topbar {
    background: rgba(10, 18, 38, 0.72);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-color: rgba(255, 255, 255, 0.06);
}

html.dark .topbar-title h1 {
    color: #94a3b8;
}

html.dark .topbar-breadcrumbs {
    color: #94a3b8;
}

html.dark .topbar-toggle {
    color: #e2e8f0;
}

html.dark .topbar-actions .topbar-icon-btn {
    background: #1f2937;
    color: #e2e8f0;
}

.auth-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-avatar-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    background: transparent;
    padding: 0;
    cursor: pointer;
}

.profile-menu-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 9999px;
    color: #374151;
    background: transparent;
    border: 0;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.profile-menu-icon:hover {
    background: #f3f4f6;
    color: #111827;
    transform: translateY(-1px);
}

.profile-menu-logout {
    color: #b91c1c;
}

.profile-menu-logout:hover {
    color: #ffffff;
    background: #dc2626;
}

html.dark .profile-menu-icon {
    color: #e5e7eb;
}

html.dark .profile-menu-icon:hover {
    background: #1f2937;
    color: #ffffff;
}

.recaptcha-wrap {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.recaptcha-scale {
    width: 304px;
    transform-origin: 0 0;
}

.topbar-toggle-placeholder {
    display: inline-block;
    width: 36px;
    height: 36px;
}
/* Global dropzone styling */
:root {
  --dz-border: #adb5bd;
  --dz-text: #495057;
  --dz-hover: #1c7ed6;
  --dz-success: #2f9e44;
  --dz-error: #e03131;
  --dz-hover-bg: rgba(28, 126, 214, 0.08);
  --dz-success-bg: rgba(47, 158, 68, 0.08);
  --dz-error-bg: rgba(224, 49, 49, 0.08);
}

html.dark {
  --dz-border: #495057;
  --dz-text: #e9ecef;
  --dz-hover: #339af0;
  --dz-success: #40c057;
  --dz-error: #ff6b6b;
  --dz-hover-bg: rgba(51, 154, 240, 0.12);
  --dz-success-bg: rgba(64, 192, 87, 0.12);
  --dz-error-bg: rgba(255, 107, 107, 0.12);
}

.dropzone,
.feedback-dropzone,
.process-logs-dropzone,
#file-dropzone,
#process-modal-dropzone,
#dz-upload {
  background: transparent !important;
  border: 2px dashed var(--dz-border) !important;
  color: var(--dz-text) !important;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.dropzone .dz-message,
.dropzone .dz-message * {
  color: inherit;
}

.dropzone.dz-drag-hover,
.dropzone.is-dragover,
.dropzone.bg-light,
.feedback-dropzone.is-dragover,
.process-logs-dropzone.is-dragover,
#file-dropzone.is-dragover,
#file-dropzone.bg-light,
#process-modal-dropzone.is-dragover,
#dz-upload.is-dragover {
  border-color: var(--dz-hover) !important;
  box-shadow: 0 0 0 3px rgba(28, 126, 214, 0.15);
  background-color: var(--dz-hover-bg) !important;
}

.dropzone.dz-has-success,
.dropzone:has(.dz-success),
.feedback-dropzone.is-success,
#file-dropzone.is-success,
#process-modal-dropzone.is-success,
#dz-upload.is-success {
  border-color: var(--dz-success) !important;
  background-color: var(--dz-success-bg) !important;
}

.dropzone.dz-has-error,
.dropzone:has(.dz-error),
.feedback-dropzone.is-error,
#file-dropzone.is-error,
#process-modal-dropzone.is-error,
#dz-upload.is-error {
  border-color: var(--dz-error) !important;
  background-color: var(--dz-error-bg) !important;
}

/* Tom Select adjustments (dark mode + full width) */
.ts-wrapper,
.ts-wrapper.single .ts-control {
  width: 100%;
}

.ts-wrapper {
  margin: 0;
  padding: 0;
  display: block;
  width: 100%;
}

.ts-wrapper .ts-control {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  width: 100%;
  min-height: calc(1.5em + .75rem + 2px);
  height: calc(1.5em + .75rem + 2px);
  padding: .375rem .75rem;
  margin: 0;
  border: 1px solid #ced4da;
  border-radius: .25rem;
  background-color: #fff;
  line-height: 1.5;
}

.ts-wrapper.single .ts-control input {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
}

.ts-wrapper.multi .ts-control {
  background-color: #fff;
}

.dark .ts-wrapper.multi .ts-control {
  background-color: #111827;
}

.ts-wrapper.single .ts-control > input {
  padding: 0;
  margin: 0;
  height: 100%;
  line-height: 1.5;
}

.dark .ts-wrapper .ts-control {
  background-color: #111827 !important;
  border-color: rgba(148, 163, 184, 0.18) !important;
  color: #dbe1ea !important;
}

.dark .ts-wrapper .ts-control,
.dark .ts-wrapper .ts-control > input,
.dark .ts-wrapper .ts-control .item {
  background-color: #111827;
}

.dark .ts-wrapper .ts-control input {
  color: #dbe1ea;
}

.dark .ts-wrapper .ts-control .item,
.dark .ts-wrapper .ts-control > input {
  background-color: transparent;
}

.dark .ts-wrapper .ts-control .item {
  color: #dbe1ea;
}

.dark .ts-wrapper .ts-control input::placeholder {
  color: #94a3b8;
  opacity: 1;
}

.dark .ts-dropdown {
  background: #111827;
  border-color: rgba(148, 163, 184, 0.18);
  color: #dbe1ea;
}

.dark .ts-dropdown .option.active,
.dark .ts-dropdown .option:hover {
  background: #1f2937;
  color: #dbe1ea;
}

.dark .ts-dropdown .option.selected,
.dark .ts-dropdown .option.selected.active {
  background: #1f2937;
  color: #dbe1ea;
}

.dark .ts-wrapper .ts-control .item {
  background: transparent !important;
  color: #dbe1ea !important;
}

.dark .ts-wrapper .ts-control .item[data-value] {
  background: transparent !important;
  color: #e5e7eb !important;
  box-shadow: none !important;
}

.swal2-week-picker .functions-report-config {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
    margin-top: 4px;
}

.swal2-week-picker .functions-report-config__label {
    font-size: 14px;
    font-weight: 600;
    margin: 0;
}

.swal2-week-picker .functions-report-config__input {
    margin: 0 auto !important;
    width: 220px !important;
    max-width: 100%;
}

.swal2-week-picker .functions-report-config__checkbox {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
    margin: 0;
}

.swal2-week-picker .functions-report-config__checkbox-input {
    width: 16px;
    height: 16px;
}

html.dark .swal2-week-picker .functions-report-config__label,
html.dark .swal2-week-picker .functions-report-config__checkbox {
    color: #e5e7eb;
}

/* ── Dark mode: SweetAlert2 ─────────────────────────────────────────────── */
html.dark .swal2-popup {
    background: #1a2538;
    color: #e2e8f0;
    border: 1px solid rgba(148, 163, 184, 0.12);
}

html.dark .swal2-title {
    color: #f1f5f9;
}

html.dark .swal2-html-container,
html.dark .swal2-content {
    color: #cbd5e1;
}

html.dark .swal2-input,
html.dark .swal2-textarea,
html.dark .swal2-select,
html.dark .swal2-file {
    background-color: #1e293b;
    border-color: rgba(148, 163, 184, 0.22);
    color: #e2e8f0;
}

html.dark .swal2-input::placeholder,
html.dark .swal2-textarea::placeholder {
    color: #64748b;
}

html.dark .swal2-input:focus,
html.dark .swal2-textarea:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

html.dark .swal2-validation-message {
    background: #374151;
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.3);
}

html.dark .swal2-footer {
    border-top-color: rgba(148, 163, 184, 0.12);
    color: #94a3b8;
}

html.dark .swal2-close {
    color: #94a3b8;
}

html.dark .swal2-close:hover {
    color: #e2e8f0;
}

/* Icons */
html.dark .swal2-icon.swal2-warning {
    border-color: #f59e0b;
    color: #f59e0b;
}

html.dark .swal2-icon.swal2-error {
    border-color: #ef4444;
    color: #ef4444;
}

html.dark .swal2-icon.swal2-error [class^="swal2-x-mark-line"] {
    background-color: #ef4444;
}

html.dark .swal2-icon.swal2-success {
    border-color: #22c55e;
    color: #22c55e;
}

html.dark .swal2-icon.swal2-success .swal2-success-ring {
    border-color: rgba(34, 197, 94, 0.3);
}

html.dark .swal2-icon.swal2-success [class^="swal2-success-line"] {
    background-color: #22c55e;
}

html.dark .swal2-icon.swal2-info {
    border-color: #3b82f6;
    color: #3b82f6;
}

html.dark .swal2-icon.swal2-question {
    border-color: #8b5cf6;
    color: #8b5cf6;
}

/* Backdrop */
html.dark .swal2-backdrop-show {
    background: rgba(0, 0, 0, 0.65);
}

/* Progress steps */
html.dark .swal2-progress-steps .swal2-progress-step {
    background: #6366f1;
    color: #ffffff;
}

html.dark .swal2-progress-steps .swal2-progress-step-line {
    background: #4338ca;
}
