/* ==========================================================================
   Marmelos One — design system on top of Tabler
   Indigo accent · Inter type · light default + dark via [data-bs-theme]
   ========================================================================== */

/* ---------- 1. Tokens ---------- */
:root,
html[data-bs-theme="light"] {
    --app-accent: #6366f1;
    --app-accent-hover: #4f46e5;
    --app-accent-fg: #ffffff;
    --app-accent-soft: rgba(99, 102, 241, 0.10);
    --app-accent-softer: rgba(99, 102, 241, 0.06);
    --app-accent-text: #4f46e5;

    --app-bg: #f4f5f9;
    --app-surface: #ffffff;
    --app-surface-2: #f8f9fc;
    --app-border: #e5e7ee;
    --app-border-strong: #d5d8e3;

    --app-text: #171a21;
    --app-text-muted: #697386;

    --app-sidebar-bg: #ffffff;
    --app-sidebar-border: #e9eaef;
    --app-header-bg: rgba(255, 255, 255, 0.88);

    --app-radius: 0.6rem;
    --app-radius-lg: 0.9rem;
    --app-shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
    --app-shadow: 0 1px 3px rgba(16, 24, 40, 0.07), 0 1px 2px rgba(16, 24, 40, 0.04);
    --app-shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.12);

    --app-success: #16a34a;
    --app-danger: #dc2626;
    --app-warning: #d97706;
    --app-info: #0891b2;
}

html[data-bs-theme="dark"] {
    --app-accent: #818cf8;
    --app-accent-hover: #a5b4fc;
    --app-accent-fg: #101223;
    --app-accent-soft: rgba(129, 140, 248, 0.16);
    --app-accent-softer: rgba(129, 140, 248, 0.08);
    --app-accent-text: #a5b4fc;

    --app-bg: #101318;
    --app-surface: #171a21;
    --app-surface-2: #1c2027;
    --app-border: #262b34;
    --app-border-strong: #333945;

    --app-text: #e8eaf1;
    --app-text-muted: #8d95a5;

    --app-sidebar-bg: #14171d;
    --app-sidebar-border: #232730;
    --app-header-bg: rgba(20, 23, 29, 0.88);

    --app-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
    --app-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    --app-shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.55);

    --app-success: #4ade80;
    --app-danger: #f87171;
    --app-warning: #fbbf24;
    --app-info: #22d3ee;
}

/* ---------- 2. Tabler re-theme ---------- */
:root {
    --tblr-primary: #6366f1;
    --tblr-primary-rgb: 99, 102, 241;
    --tblr-primary-fg: #ffffff;
    --tblr-primary-lt: #a5b4fc;
    --tblr-primary-lt-rgb: 165, 180, 252;
    --tblr-primary-darken: #4f46e5;
    --tblr-primary-bg-subtle: rgba(99, 102, 241, 0.12);
    --tblr-primary-border-subtle: rgba(99, 102, 241, 0.35);
    --tblr-primary-text-emphasis: #4f46e5;

    --tblr-body-bg: var(--app-bg);
    --tblr-body-color: var(--app-text);
    --tblr-border-color: var(--app-border);
    --tblr-card-bg: var(--app-surface);
    --tblr-card-cap-bg: transparent;
    --tblr-font-sans-serif: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --tblr-emphasis-color: var(--app-text);
    --tblr-muted-color: var(--app-text-muted);
}

html[data-bs-theme="dark"] {
    --tblr-primary-bg-subtle: rgba(129, 140, 248, 0.16);
    --tblr-primary-border-subtle: rgba(129, 140, 248, 0.4);
    --tblr-primary-text-emphasis: #a5b4fc;
    --tblr-card-bg: var(--app-surface);
    --tblr-body-bg: var(--app-bg);
    --tblr-body-color: var(--app-text);
    --tblr-border-color: var(--app-border);
}

body {
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-feature-settings: "cv03", "cv04", "cv11";
    letter-spacing: -0.011em;
    color: var(--app-text);
    background: var(--app-bg);
}

::selection {
    background: var(--app-accent-soft);
}

/* ---------- 3. Sidebar ---------- */
.navbar-vertical.navbar-light {
    background: var(--app-sidebar-bg);
    border-right: 1px solid var(--app-sidebar-border);
    box-shadow: none;
    color: var(--app-text);
}

.navbar-vertical .navbar-brand {
    padding: 1.1rem 1rem 0.9rem;
    gap: 0.6rem;
}

.navbar-vertical .navbar-brand .brand-mark {
    display: block;
    width: 32px;
    height: 32px;
    object-fit: contain;
    flex: none;
    border-radius: 9px;
}

.navbar-vertical .navbar-brand .brand-title {
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: -0.02em;
    color: var(--app-text);
}

.navbar-vertical .nav-link {
    border-radius: 0.55rem;
    color: var(--app-text-muted);
    font-weight: 500;
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.navbar-vertical .nav-link:hover {
    background: var(--app-surface-2);
    color: var(--app-text);
}

.navbar-vertical .nav-link.active {
    background: var(--app-accent-soft);
    color: var(--app-accent-text);
    font-weight: 600;
}

.navbar-vertical .nav-link .nav-icon {
    color: inherit;
    opacity: 0.85;
}

.navbar-vertical .nav-item.dropdown > .nav-link {
    position: relative;
}

.navbar-vertical .nav-item.dropdown > .nav-link::after {
    content: "";
    position: absolute;
    right: 0.85rem;
    top: 50%;
    width: 6px;
    height: 6px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: translateY(-70%) rotate(45deg);
    transition: transform 0.2s ease;
    opacity: 0.6;
}

.navbar-vertical .nav-item.dropdown > .nav-link[aria-expanded="true"]::after {
    transform: translateY(-30%) rotate(225deg);
}

.navbar-vertical .navbar-nav .collapse .nav-item > .nav-link {
    padding: 0.4rem 0.75rem 0.4rem 2.15rem;
    font-size: 0.845rem;
    border-radius: 0.5rem;
    margin: 0.1rem 0.5rem;
    width: auto;
    position: relative;
}

.navbar-vertical .navbar-nav .collapse .nav-item > .nav-link::before {
    content: "";
    position: absolute;
    left: 1.05rem;
    top: 50%;
    transform: translateY(-50%);
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.35;
}

.navbar-vertical .navbar-nav .collapse .nav-item > .nav-link.active::before {
    opacity: 1;
    background: var(--app-accent);
}

.navbar-vertical .navbar-nav.pt-lg-3 {
    gap: 0.15rem;
    padding-top: 0.75rem !important;
}

/* ---------- 3b. Sidebar width + density ---------- */
:root {
    --app-sidebar-width: 13rem;
}

.navbar-vertical.navbar-expand-lg {
    width: var(--app-sidebar-width);
}

@media (min-width: 992px) {
    .navbar-expand-lg.navbar-vertical~.navbar,
    .navbar-expand-lg.navbar-vertical~.page-wrapper {
        margin-left: var(--app-sidebar-width);
    }
}

/* Tabler zeroes the vertical nav container padding (.navbar-vertical.navbar-expand-lg > [class^=container]).
   Pin it to 0 so the menu inset is fully controlled by the nav-link / brand padding below. */
.navbar-vertical.navbar-expand-lg > .container-fluid {
    padding-left: 0;
    padding-right: 0;
}

.navbar-vertical.navbar-expand-lg .navbar-collapse .navbar-nav .nav-link {
    padding-left: 0.6rem;
    padding-right: 0.6rem;
}

.navbar-vertical .navbar-brand {
    padding: 0.9rem 0.6rem 0.75rem;
}

.navbar-vertical .navbar-nav .collapse .nav-item > .nav-link {
    padding-left: 1.9rem;
}

/* ---------- 4. Header ---------- */
.page-wrapper > .navbar,
.page-wrapper > header.navbar {
    background: var(--app-header-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--app-border);
    box-shadow: none;
    min-height: 3.5rem;
    padding: 0.35rem 0;
}

.header-clock {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
    color: var(--app-text-muted);
    background: var(--app-surface-2);
    border: 1px solid var(--app-border);
    border-radius: 999px;
    padding: 0.3rem 0.75rem;
    font-weight: 500;
}

#theme-toggle {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.6rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--app-text-muted);
    background: transparent;
    border: 1px solid var(--app-border);
    transition: all 0.15s ease;
}

#theme-toggle:hover {
    color: var(--app-accent-text);
    background: var(--app-accent-soft);
    border-color: transparent;
}

.avatar-initials {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--app-accent), #7c3aed);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    flex: none;
}

/* ---------- 5. Page shell ---------- */
.page-body {
    margin-top: 0;
    padding-top: 1.25rem;
    padding-bottom: 2rem;
}

.page-header {
    margin-top: 0;
    margin-bottom: 1.25rem;
}

.project-filter-form {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) repeat(3, minmax(0, 1fr)) auto;
    gap: 0.5rem;
    align-items: center;
    width: 100%;
}

.project-filter-actions {
    display: flex;
    gap: 0.5rem;
}

@media (max-width: 1199.98px) {
    .project-filter-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .project-filter-actions {
        grid-column: 1 / -1;
    }
}

@media (max-width: 575.98px) {
    .project-filter-form {
        grid-template-columns: minmax(0, 1fr);
    }
}

.page-header .page-title {
    font-weight: 700;
    font-size: 1.45rem;
    letter-spacing: -0.02em;
    color: var(--app-text);
}

.page-header .text-muted {
    font-size: 0.875rem;
    color: var(--app-text-muted);
}

.footer.footer-transparent {
    border-top: 1px solid var(--app-border);
    padding: 0.85rem 0;
    background: transparent;
}

.footer.footer-transparent .text-muted {
    font-size: 0.8rem;
    color: var(--app-text-muted);
}

/* ---------- 6. Cards ---------- */
.card {
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-lg);
    box-shadow: var(--app-shadow-sm);
}

.card .card-header {
    background: transparent;
    border-bottom: 1px solid var(--app-border);
    padding: 0.9rem 1.15rem;
}

.card .card-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--app-text);
    letter-spacing: -0.01em;
}

.card .card-body {
    padding: 1.15rem;
}

.card-link.card {
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
    text-decoration: none;
    color: inherit;
}

.card-link.card:hover {
    transform: translateY(-3px);
    box-shadow: var(--app-shadow-lg);
    border-color: var(--app-accent);
}

/* ---------- 7. Tables ---------- */
.table {
    --tblr-table-bg: transparent;
    color: var(--app-text);
    margin-bottom: 0;
}

.table > :not(caption) > * > * {
    background: transparent;
    border-bottom-color: var(--app-border);
    padding: 0.7rem 1.15rem;
    box-shadow: none;
}

.table thead th {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--app-text-muted);
    background: var(--app-surface-2);
    border-bottom: none;
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
}

.table thead th:first-child {
    border-top-left-radius: var(--app-radius);
}

.table thead th:last-child {
    border-top-right-radius: var(--app-radius);
}

.table tbody tr:hover > * {
    background: var(--app-accent-softer);
}

.table td {
    vertical-align: middle;
    font-size: 0.875rem;
}

/* ---------- 8. Buttons ---------- */
.btn {
    border-radius: 0.55rem;
    font-weight: 500;
    font-size: 0.875rem;
    letter-spacing: -0.01em;
    transition: all 0.15s ease;
}

.btn-primary {
    background: var(--app-accent);
    border-color: var(--app-accent);
    box-shadow: 0 1px 2px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover,
.btn-primary:focus {
    background: var(--app-accent-hover);
    border-color: var(--app-accent-hover);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.btn-ghost-secondary {
    color: var(--app-text-muted);
}

.btn-ghost-secondary:hover {
    color: var(--app-text);
    background: var(--app-surface-2);
}

.btn-icon {
    width: 2.1rem;
    height: 2.1rem;
    padding: 0;
}

/* ---------- 9. Forms ---------- */
.form-control,
.form-select {
    border-radius: 0.55rem;
    border-color: var(--app-border-strong);
    background-color: var(--app-surface);
    color: var(--app-text);
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--app-accent);
    box-shadow: 0 0 0 0.2rem var(--app-accent-soft);
    background-color: var(--app-surface);
    color: var(--app-text);
}

.form-control::placeholder {
    color: var(--app-text-muted);
    opacity: 0.7;
}

.form-label {
    font-weight: 500;
    font-size: 0.8rem;
    color: var(--app-text);
    margin-bottom: 0.35rem;
}

.form-control:invalid:not(:placeholder-shown):not(:focus),
.input-validation-error {
    border-color: var(--app-danger) !important;
}

.text-danger {
    color: var(--app-danger) !important;
    font-size: 0.78rem;
}

.form-check-input:checked {
    background-color: var(--app-accent);
    border-color: var(--app-accent);
}

/* Floating labels (login + future forms) */
.form-floating > .form-control:focus,
.form-floating > .form-control:not(:placeholder-shown) ~ label {
    color: var(--app-accent-text);
}

/* ---------- 10. Badges ---------- */
.badge {
    font-weight: 600;
    font-size: 0.7rem;
    letter-spacing: 0.02em;
    padding: 0.3em 0.6em;
    border-radius: 999px;
}

.badge.bg-green-lt { color: var(--app-success); }
.badge.bg-red-lt { color: var(--app-danger); }
.badge.bg-yellow-lt { color: var(--app-warning); }
.badge.bg-blue-lt { color: var(--app-accent-text); }
.badge.bg-purple-lt { color: #7c3aed; }
.badge.bg-orange-lt { color: #f76707; }
.badge.bg-pink-lt { color: #d6336c; }
.badge.bg-secondary-lt { color: var(--app-text-muted); }

html[data-bs-theme="dark"] .badge.bg-purple-lt { color: #c4b5fd; }
html[data-bs-theme="dark"] .badge.bg-orange-lt { color: #ffa94d; }
html[data-bs-theme="dark"] .badge.bg-pink-lt { color: #f783ac; }

/* ---------- 10b. Split transfer rows (employee leg + site admin leg) ---------- */
.table tbody tr.split-leg > td {
    background-color: rgba(214, 51, 108, 0.06);
}

.table tbody tr.split-leg > td:first-child {
    box-shadow: inset 3px 0 0 #d6336c;
}

.table tbody tr.split-leg-admin > td {
    background-color: rgba(214, 51, 108, 0.1);
    font-size: 0.9rem;
}

html[data-bs-theme="dark"] .table tbody tr.split-leg > td {
    background-color: rgba(247, 131, 172, 0.12);
}

html[data-bs-theme="dark"] .table tbody tr.split-leg-admin > td {
    background-color: rgba(247, 131, 172, 0.18);
}

/* ---------- 11. Alerts (TempData banners) ---------- */
.page-body .alert {
    border-radius: var(--app-radius);
    border: none;
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: var(--app-shadow);
    animation: app-alert-in 0.25s ease;
}

.page-body .alert-success {
    background: rgba(22, 163, 74, 0.12);
    color: #15803d;
    border: 1px solid rgba(22, 163, 74, 0.25);
}

.page-body .alert-danger {
    background: rgba(220, 38, 38, 0.1);
    color: #b91c1c;
    border: 1px solid rgba(220, 38, 38, 0.25);
}

html[data-bs-theme="dark"] .page-body .alert-success {
    background: rgba(74, 222, 128, 0.12);
    color: #86efac;
}

html[data-bs-theme="dark"] .page-body .alert-danger {
    background: rgba(248, 113, 113, 0.12);
    color: #fca5a5;
}

@keyframes app-alert-in {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---------- 12. Modals ---------- */
.modal-content {
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-lg);
    box-shadow: var(--app-shadow-lg);
}

.modal-header {
    border-bottom-color: var(--app-border);
    padding: 1rem 1.25rem;
}

.modal-title {
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: -0.01em;
}

.modal-body {
    padding: 1.25rem;
}

.modal-footer {
    border-top-color: var(--app-border);
    padding: 0.9rem 1.25rem;
}

.modal-backdrop.show {
    opacity: 0.35;
}

/* Modals whose body/footer are wrapped in a <form>: keep the header/footer fixed
   and let only the body scroll. Without this the form is a flex item that keeps
   min-height: auto and cannot shrink below its content. */
.modal-dialog-scrollable .modal-content {
    max-height: calc(100vh - 3.5rem);
}

.modal-dialog-scrollable .modal-content > form {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.modal-dialog-scrollable .modal-content > form > .modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}

/* ---------- 13. Empty states ---------- */
.empty .empty-icon {
    background: var(--app-accent-soft);
    color: var(--app-accent-text);
    border-radius: 50%;
    width: 3.5rem;
    height: 3.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.empty .empty-title {
    font-weight: 600;
    color: var(--app-text);
    font-size: 1.05rem;
}

/* ---------- 14. Dashboard — stat cards ---------- */
.stat-card {
    display: block;
    text-decoration: none;
    color: inherit;
    overflow: hidden;
    position: relative;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--app-shadow-lg);
    border-color: transparent;
    color: inherit;
}

.stat-card .stat-icon {
    width: 2.6rem;
    height: 2.6rem;
    border-radius: 0.7rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.1;
    color: var(--app-text);
    font-variant-numeric: tabular-nums;
}

.stat-card .stat-label {
    font-size: 0.8rem;
    color: var(--app-text-muted);
    font-weight: 500;
}

.stat-accent-indigo .stat-icon { background: rgba(99, 102, 241, 0.12); color: #6366f1; }
.stat-accent-emerald .stat-icon { background: rgba(16, 185, 129, 0.12); color: #10b981; }
.stat-accent-amber .stat-icon { background: rgba(245, 158, 11, 0.12); color: #f59e0b; }
.stat-accent-rose .stat-icon { background: rgba(244, 63, 94, 0.12); color: #f43f5e; }

.stat-accent-indigo .stat-value { color: #6366f1; }
.stat-accent-emerald .stat-value { color: #10b981; }
.stat-accent-amber .stat-value { color: #d97706; }
.stat-accent-rose .stat-value { color: #e11d48; }

html[data-bs-theme="dark"] .stat-accent-indigo .stat-value { color: #a5b4fc; }
html[data-bs-theme="dark"] .stat-accent-emerald .stat-value { color: #6ee7b7; }
html[data-bs-theme="dark"] .stat-accent-amber .stat-value { color: #fcd34d; }
html[data-bs-theme="dark"] .stat-accent-rose .stat-value { color: #fda4af; }

/* ---------- 15. Dashboard — activity timeline ---------- */
.timeline {
    list-style: none;
    margin: 0;
    padding: 0;
    position: relative;
}

.timeline::before {
    content: "";
    position: absolute;
    left: 17px;
    top: 12px;
    bottom: 12px;
    width: 2px;
    background: var(--app-border);
    border-radius: 2px;
}

.timeline-item {
    position: relative;
    display: flex;
    gap: 0.9rem;
    padding: 0.55rem 0.25rem;
    border-radius: var(--app-radius);
}

.timeline-item:hover {
    background: var(--app-accent-softer);
}

.timeline-avatar {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--app-surface);
    border: 2px solid var(--app-border);
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--app-text-muted);
    flex: none;
    letter-spacing: 0.02em;
}

.timeline-item.timeline-accent .timeline-avatar {
    border-color: var(--app-accent);
    color: var(--app-accent-text);
}

.timeline-body {
    flex: 1;
    min-width: 0;
    padding-top: 0.15rem;
}

.timeline-title {
    font-size: 0.86rem;
    font-weight: 500;
    color: var(--app-text);
    margin: 0;
}

.timeline-title strong {
    font-weight: 600;
}

.timeline-meta {
    font-size: 0.76rem;
    color: var(--app-text-muted);
    margin-top: 0.1rem;
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.action-pill {
    display: inline-block;
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.15em 0.55em;
    border-radius: 999px;
}

.action-pill.action-created { background: rgba(22, 163, 74, 0.12); color: #16a34a; }
.action-pill.action-updated { background: rgba(99, 102, 241, 0.12); color: #6366f1; }
.action-pill.action-deleted { background: rgba(220, 38, 38, 0.12); color: #dc2626; }
.action-pill.action-restored { background: rgba(13, 148, 136, 0.12); color: #0d9488; }

html[data-bs-theme="dark"] .action-pill.action-created { color: #4ade80; }
html[data-bs-theme="dark"] .action-pill.action-updated { color: #a5b4fc; }
html[data-bs-theme="dark"] .action-pill.action-deleted { color: #f87171; }
html[data-bs-theme="dark"] .action-pill.action-restored { color: #5eead4; }

/* ---------- 16. Login — split screen ---------- */
.auth-split {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 46%) minmax(0, 54%);
    background: var(--app-surface);
}

.auth-brand {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 3rem;
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 45%, #7c3aed 100%);
    color: #fff;
}

.auth-brand::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(255, 255, 255, 0.14) 1.2px, transparent 1.2px);
    background-size: 26px 26px;
    opacity: 0.5;
}

.auth-brand::after {
    content: "";
    position: absolute;
    width: 420px;
    height: 420px;
    right: -140px;
    bottom: -140px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.09);
}

.auth-brand > * {
    position: relative;
    z-index: 1;
}

.auth-brand .auth-brand-mark {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: -0.02em;
}

.auth-brand .auth-brand-mark .brand-chip {
    display: inline-block;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(6px);
    padding: 4px;
}

.auth-brand h2 {
    font-size: 2.3rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.15;
    max-width: 15ch;
}

.auth-brand p {
    font-size: 1rem;
    opacity: 0.85;
    max-width: 34ch;
    line-height: 1.6;
}

.auth-brand .auth-brand-footer {
    font-size: 0.8rem;
    opacity: 0.7;
}

.auth-form-side {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem;
    background: var(--app-surface);
}

.auth-card {
    width: 100%;
    max-width: 400px;
    container-type: inline-size;
}

.auth-wordmark {
    --auth-wordmark-ink: #071a33;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.72rem;
    width: 100%;
    margin-bottom: 1.75rem;
    font-family: "Michroma", "Orbitron", "Bank Gothic", "Eurostile", sans-serif;
    font-synthesis: none;
    text-rendering: geometricPrecision;
    text-transform: uppercase;
}

.auth-wordmark-main {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.2em;
    width: 100%;
    font-size: clamp(1.4rem, 7.8vw, 2.2rem);
    font-size: clamp(1.4rem, 8.8cqw, 2.2rem);
    font-weight: 400;
    line-height: 1;
    letter-spacing: -0.055em;
    white-space: nowrap;
}

.auth-wordmark-ink {
    color: var(--auth-wordmark-ink);
}

.auth-wordmark-accent {
    background-image: linear-gradient(90deg, #00a7ff 0%, #00d1c1 52%, #35d07f 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
}

.auth-wordmark-sub {
    color: var(--auth-wordmark-ink);
    font-size: clamp(0.58rem, 1.55vw, 0.72rem);
    line-height: 1.2;
    letter-spacing: 0.34em;
    text-indent: 0.34em;
    text-align: center;
    white-space: nowrap;
}

html[data-bs-theme="dark"] .auth-wordmark {
    --auth-wordmark-ink: #f4f7ff;
}

.auth-card .auth-logo {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    margin-bottom: 1.75rem;
    border-radius: 10px;
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.18);
}

html[data-bs-theme="dark"] .auth-card .auth-logo {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
}

.auth-card .form-control {
    padding: 0.65rem 0.85rem;
}

.auth-card .input-group-text {
    background: transparent;
    border-color: var(--app-border-strong);
    color: var(--app-text-muted);
}

.auth-card .input-group .form-control {
    border-left: none;
}

.auth-card .input-group .form-control:focus {
    box-shadow: none;
}

.auth-card .input-group:focus-within .input-group-text {
    border-color: var(--app-accent);
    color: var(--app-accent-text);
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.25rem 0;
    color: var(--app-text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--app-border);
}

.auth-theme-toggle {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 100;
}

@media (max-width: 900px) {
    .auth-split {
        grid-template-columns: 1fr;
    }

    .auth-brand {
        min-height: 220px;
        padding: 2rem 1.75rem;
    }

    .auth-brand h2 {
        font-size: 1.65rem;
        max-width: none;
    }

    .auth-brand .auth-brand-footer {
        display: none;
    }

    .auth-form-side {
        padding: 2rem 1.25rem;
    }
}

/* ---------- 17. Misc ---------- */
#ist-clock {
    font-variant-numeric: tabular-nums;
}

.link-muted {
    color: var(--app-text-muted);
}

.link-muted:hover {
    color: var(--app-accent-text);
}

.btn-list.flex-nowrap form {
    display: inline-flex;
}

.section-sep {
    border: 0;
    border-top: 1px solid var(--app-border);
    margin: 1.25rem 0;
}

/* smooth theme transition — kept subtle to avoid jank */
html.theming * {
    transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease !important;
}

/* ---------- 18. Status flag (active / inactive) ---------- */
.status-flag {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.4;
    padding: 0.25em 0.7em 0.25em 0.55em;
    border-radius: 999px;
    white-space: nowrap;
}

.status-flag::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 20%, transparent);
    flex: none;
}

.status-flag-active {
    color: #15803d;
    background: rgba(22, 163, 74, 0.14);
}

.status-flag-inactive {
    color: #64748b;
    background: rgba(100, 116, 139, 0.14);
}

html[data-bs-theme="dark"] .status-flag-active {
    color: #4ade80;
    background: rgba(74, 222, 128, 0.14);
}

html[data-bs-theme="dark"] .status-flag-inactive {
    color: #94a3b8;
    background: rgba(148, 163, 184, 0.14);
}

/* ---------- 19. Sortable tables ---------- */
.table thead th.sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.table thead th.sortable:hover {
    color: var(--app-text);
}

.table thead th .sort-icon {
    opacity: 0.3;
    margin-left: 0.35rem;
    font-size: 0.85em;
    vertical-align: -0.05em;
}

.table thead th.sortable:hover .sort-icon {
    opacity: 0.7;
}

.table thead th.sorted {
    color: var(--app-accent-text);
}

.table thead th.sorted .sort-icon {
    opacity: 1;
}

/* ---------- 20. Table export toolbar ---------- */
.card-header .table-tools {
    flex-wrap: nowrap;
}

.table-tools .btn {
    white-space: nowrap;
}

.table-tools .btn.active-filter {
    background: var(--app-accent-soft);
    color: var(--app-accent-text);
}

/* ---------- 20b. Table pagination ---------- */
.table-pagination {
    border-top: 1px solid var(--app-border);
    background: var(--app-surface);
    border-radius: 0 0 var(--app-radius) var(--app-radius);
}

.table-pagination .btn-sm {
    min-width: 2rem;
}

.table-pagination .form-select-sm {
    font-size: 0.8rem;
}

/* ---------- 21. SweetAlert2 theming ---------- */
.swal2-popup {
    font-family: inherit !important;
    border-radius: 14px !important;
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.22) !important;
    border: 1px solid var(--app-border);
    font-size: 0.95rem !important;
}

.swal2-title {
    font-weight: 700 !important;
    font-size: 1.15rem !important;
    color: var(--app-text) !important;
}

.swal2-html-container {
    font-size: 0.875rem !important;
    color: var(--app-text-muted) !important;
}

.swal2-confirm {
    border-radius: 8px !important;
    font-weight: 600 !important;
    box-shadow: none !important;
}

.swal2-cancel {
    border-radius: 8px !important;
    font-weight: 600 !important;
}

.swal2-toast {
    border-radius: 10px !important;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.18) !important;
    border: 1px solid var(--app-border);
    font-size: 0.875rem !important;
}

.swal2-toast .swal2-html-container {
    font-size: 0.85rem !important;
    color: var(--app-text) !important;
    margin: 0 !important;
}

/* ---------- 22. Print ---------- */
#print-header {
    display: none;
}

@media print {
    @page {
        margin: 14mm;
    }

    html, body {
        background: #fff !important;
    }

    .navbar,
    .page-wrapper > header,
    .footer,
    .page-header .col-auto,
    .card-header form,
    .card-actions,
    .btn,
    .modal,
    #theme-toggle,
    .swal2-container {
        display: none !important;
    }

    .page {
        display: block !important;
    }

    .page-wrapper {
        margin-left: 0 !important;
    }

    .page-body {
        padding: 0 !important;
    }

    .page-body .container-fluid {
        max-width: 100% !important;
        padding: 0 !important;
    }

    .card {
        border: none !important;
        box-shadow: none !important;
    }

    .card-header {
        display: none !important;
    }

    #print-header {
        display: block !important;
        margin-bottom: 1rem;
    }

    #print-header h2 {
        font-size: 1.25rem;
        font-weight: 700;
        margin: 0 0 0.25rem;
    }

    #print-header p {
        color: #555;
        font-size: 0.8rem;
        margin: 0;
    }

    .table thead th {
        background: #f1f2f4 !important;
        color: #333 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .table thead th .sort-icon,
    th[data-no-export],
    td[data-no-export] {
        display: none !important;
    }

    .table tbody tr {
        display: table-row !important;
    }

    .table-pagination {
        display: none !important;
    }

    .table > :not(caption) > * > * {
        padding: 0.45rem 0.6rem;
    }

    .status-flag {
        border: 1px solid #ccc;
    }
}
