/* =====================================================================
   HRM — Design system  (brand: FNM Labs)
   Colours taken from the logo: ink #0B1220, deep blue #024899,
   royal #1462E0, sky #12A4F7.  Built on top of Bootstrap 5.3.
   ===================================================================== */

/* ---------- 1. Tokens ---------- */
:root,
[data-bs-theme="light"] {
    --ink: #0B1220;
    --ink-2: #131C2F;
    --brand: #1462E0;
    --brand-600: #0F52C4;
    --brand-deep: #024899;
    --sky: #12A4F7;
    --brand-grad: linear-gradient(135deg, #1462E0 0%, #1A8CF0 100%);
    --brand-soft: rgba(20, 98, 224, .09);
    --brand-soft-2: rgba(20, 98, 224, .16);

    --bg: #F3F5FA;
    --surface: #FFFFFF;
    --surface-2: #F8FAFD;
    --border: #E3E8F0;
    --border-strong: #CFD7E3;
    --text: #0F172A;
    --text-2: #334155;
    --muted: #64748B;

    --success: #12925B;  --success-soft: rgba(18, 146, 91, .11);
    --warning: #B26A00;  --warning-soft: rgba(230, 150, 20, .14);
    --danger:  #D03A3A;  --danger-soft:  rgba(208, 58, 58, .10);
    --info:    #0B83C9;  --info-soft:    rgba(18, 164, 247, .13);
    --neutral-soft: rgba(100, 116, 139, .12);

    --radius: 14px;
    --radius-sm: 10px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
    --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 6px 20px -8px rgba(15, 23, 42, .10);
    --shadow-lg: 0 20px 48px -16px rgba(11, 18, 32, .28);
    --sidebar-w: 264px;
    --topbar-h: 64px;

    /* Bootstrap bridge */
    --bs-body-font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --bs-body-font-size: .9rem;
    --bs-body-bg: var(--bg);
    --bs-body-color: var(--text);
    --bs-emphasis-color: var(--text);
    --bs-secondary-color: var(--muted);
    --bs-tertiary-bg: var(--surface-2);
    --bs-border-color: var(--border);
    --bs-primary: #1462E0;
    --bs-primary-rgb: 20, 98, 224;
    --bs-link-color: #1462E0;
    --bs-link-color-rgb: 20, 98, 224;
    --bs-link-hover-color: #024899;
    --bs-link-hover-color-rgb: 2, 72, 153;
    --bs-border-radius: 10px;
    --bs-border-radius-lg: 14px;
    --bs-focus-ring-color: rgba(20, 98, 224, .22);
}

[data-bs-theme="dark"] {
    --brand: #3D86F5;
    --brand-600: #5A98F7;
    --brand-grad: linear-gradient(135deg, #2B74EB 0%, #1FA0F5 100%);
    --brand-soft: rgba(61, 134, 245, .14);
    --brand-soft-2: rgba(61, 134, 245, .24);

    --bg: #080D18;
    --surface: #0F1726;
    --surface-2: #131D2F;
    --border: #1E2A3F;
    --border-strong: #2A3954;
    --text: #E6ECF5;
    --text-2: #C3CDDB;
    --muted: #8C9AB0;

    --success: #3CCB8A;  --success-soft: rgba(60, 203, 138, .14);
    --warning: #F2B444;  --warning-soft: rgba(242, 180, 68, .14);
    --danger:  #F07171;  --danger-soft:  rgba(240, 113, 113, .14);
    --info:    #4CC0FA;  --info-soft:    rgba(76, 192, 250, .14);
    --neutral-soft: rgba(140, 154, 176, .16);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow: 0 1px 2px rgba(0, 0, 0, .25), 0 8px 24px -10px rgba(0, 0, 0, .5);

    --bs-body-bg: var(--bg);
    --bs-body-color: var(--text);
    --bs-emphasis-color: #fff;
    --bs-secondary-color: var(--muted);
    --bs-tertiary-bg: var(--surface-2);
    --bs-border-color: var(--border);
    --bs-primary: #3D86F5;
    --bs-primary-rgb: 61, 134, 245;
    --bs-link-color: #6AA3F8;
    --bs-link-color-rgb: 106, 163, 248;
    --bs-link-hover-color: #9CC3FB;
    --bs-link-hover-color-rgb: 156, 195, 251;
    --bs-focus-ring-color: rgba(61, 134, 245, .3);
    color-scheme: dark;
}

/* ---------- 2. Base ---------- */
html, body { background: var(--bg); }
body {
    font-family: var(--bs-body-font-family);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    letter-spacing: -.003em;
}
h1, h2, h3, h4, h5, h6 { color: var(--text); font-weight: 700; letter-spacing: -.015em; }
a { text-decoration: none; }
.text-muted { color: var(--muted) !important; }
::selection { background: var(--brand-soft-2); }
hr { border-color: var(--border); opacity: 1; }

/* ---------- 3. App shell ---------- */
.app { display: flex; min-height: 100vh; }

.app-sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 1040;
    width: var(--sidebar-w);
    display: flex; flex-direction: column;
    background:
        radial-gradient(120% 60% at 0% 0%, rgba(20, 98, 224, .28) 0%, transparent 55%),
        radial-gradient(90% 40% at 100% 100%, rgba(18, 164, 247, .12) 0%, transparent 60%),
        var(--ink);
    color: rgba(255, 255, 255, .72);
    border-right: 1px solid rgba(255, 255, 255, .04);
    transition: transform .25s ease;
}
.sidebar-brand { display: block; padding: 22px 22px 14px; }
.sidebar-logo { height: 62px; width: auto; display: block; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 6px 14px 18px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.12) transparent; }
.nav-section {
    margin: 18px 10px 8px;
    font-size: .68rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
    color: rgba(255, 255, 255, .38);
}
.sidebar-nav .nav-item {
    display: flex; align-items: center; gap: 12px; width: 100%;
    padding: 10px 12px; margin-bottom: 2px;
    border: 0; border-radius: 10px; background: transparent;
    color: rgba(255, 255, 255, .74); font-weight: 600; font-size: .875rem; text-align: left;
    transition: background .15s, color .15s;
}
.sidebar-nav .nav-item > .bi:first-child { font-size: 1.1rem; width: 20px; text-align: center; opacity: .9; }
.sidebar-nav .nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.sidebar-nav .nav-item.active {
    background: var(--brand-grad); color: #fff;
    box-shadow: 0 8px 20px -8px rgba(20, 120, 240, .7);
}
.nav-chevron { margin-left: auto; font-size: .75rem; transition: transform .2s; opacity: .6; }
.nav-toggle.is-open { color: #fff; }
.nav-toggle.is-open .nav-chevron { transform: rotate(180deg); }

.nav-sub { list-style: none; margin: 2px 0 8px 22px; padding: 0 0 0 14px; border-left: 1px solid rgba(255, 255, 255, .1); }
.nav-sub a {
    position: relative; display: block; padding: 7px 10px; border-radius: 8px;
    color: rgba(255, 255, 255, .62); font-size: .84rem; font-weight: 500;
}
.nav-sub a:hover { color: #fff; background: rgba(255, 255, 255, .05); }
.nav-sub a.active { color: #fff; font-weight: 600; background: rgba(18, 164, 247, .14); }
.nav-sub a.active::before {
    content: ""; position: absolute; left: -18px; top: 50%; width: 7px; height: 7px; margin-top: -3.5px;
    border-radius: 2px; background: var(--sky); box-shadow: 0 0 0 3px rgba(18, 164, 247, .25);
}

.sidebar-foot { padding: 14px 18px 18px; border-top: 1px solid rgba(255, 255, 255, .06); }
.sidebar-company {
    display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px;
    background: rgba(255, 255, 255, .05); color: rgba(255, 255, 255, .85); font-size: .8rem; font-weight: 600;
}
.sidebar-company .bi { color: var(--sky); }
.sidebar-powered { margin-top: 10px; text-align: center; font-size: .7rem; color: rgba(255, 255, 255, .38); }
.sidebar-powered strong { color: rgba(255, 255, 255, .6); font-weight: 600; }

.app-main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-height: 100vh; }

.app-topbar {
    position: sticky; top: 0; z-index: 1030;
    height: var(--topbar-h);
    display: flex; align-items: center; gap: 14px;
    padding: 0 32px;
    background: color-mix(in srgb, var(--surface) 82%, transparent);
    backdrop-filter: saturate(1.6) blur(12px);
    -webkit-backdrop-filter: saturate(1.6) blur(12px);
    border-bottom: 1px solid var(--border);
}
.topbar-crumbs { display: flex; align-items: center; gap: 8px; font-size: .875rem; min-width: 0; }
.crumb-muted { color: var(--muted); font-weight: 500; }
.crumb-sep { font-size: .7rem; color: var(--muted); }
.crumb-current { font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.topbar-date {
    align-items: center; gap: 8px; padding: 7px 12px; border-radius: 999px;
    background: var(--surface-2); border: 1px solid var(--border);
    font-size: .78rem; font-weight: 600; color: var(--text-2);
}
.topbar-date .bi { color: var(--brand); }

.icon-btn {
    display: inline-grid; place-items: center; width: 40px; height: 40px;
    border-radius: 10px; border: 1px solid var(--border); background: var(--surface);
    color: var(--text-2); font-size: 1.1rem; transition: all .15s;
}
.icon-btn:hover { color: var(--brand); border-color: var(--brand-soft-2); background: var(--brand-soft); }
.theme-icon-dark { display: none; }
[data-bs-theme="dark"] .theme-icon-light { display: none; }
[data-bs-theme="dark"] .theme-icon-dark { display: inline; }

.user-chip {
    display: flex; align-items: center; gap: 10px; padding: 4px 10px 4px 4px;
    border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text);
}
.user-chip:hover { border-color: var(--border-strong); }
.user-chip-text { flex-direction: column; line-height: 1.15; text-align: left; }
.user-chip-text strong { font-size: .8rem; }
.user-chip-text small { font-size: .7rem; color: var(--muted); }
.user-chip > .bi { font-size: .7rem; color: var(--muted); }

.app-content { flex: 1; padding: 28px 32px 32px; width: 100%; }

.app-footer {
    display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;
    padding: 16px 32px; border-top: 1px solid var(--border);
    font-size: .78rem; color: var(--muted);
}
.app-footer-brand { display: inline-flex; align-items: center; gap: 8px; }
.app-footer-brand img { border-radius: 5px; }

.app-backdrop { display: none; }

@media (max-width: 991.98px) {
    .app-sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
    .sidebar-open .app-sidebar { transform: none; }
    .sidebar-open .app-backdrop {
        display: block; position: fixed; inset: 0; z-index: 1035;
        background: rgba(8, 13, 24, .55); backdrop-filter: blur(2px);
    }
    .app-main { margin-left: 0; }
    .app-topbar { padding: 0 16px; }
    .app-content { padding: 20px 16px 24px; }
    .app-footer { padding: 14px 16px; }
}

/* ---------- 4. Page header ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 16px; margin-bottom: 24px; }
.page-title { font-size: 1.6rem; font-weight: 800; margin: 0; letter-spacing: -.025em; }
.page-subtitle { margin: 4px 0 0; color: var(--muted); font-size: .9rem; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }
/* old-style "<h4>Title</h4><hr>" pages */
.app-content > h4:first-child + hr { display: none; }

/* ---------- 5. Cards ---------- */
.card {
    --bs-card-bg: var(--surface);
    --bs-card-border-color: var(--border);
    --bs-card-border-radius: var(--radius);
    --bs-card-inner-border-radius: calc(var(--radius) - 1px);
    --bs-card-cap-bg: transparent;
    --bs-card-cap-padding-y: 1rem;
    --bs-card-cap-padding-x: 1.25rem;
    --bs-card-spacer-y: 1.25rem;
    --bs-card-spacer-x: 1.25rem;
    box-shadow: var(--shadow) !important;
    border: 1px solid var(--border) !important;
}
.card-header {
    font-weight: 700; font-size: .95rem; color: var(--text);
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    border-bottom: 1px solid var(--border);
}
.card-header .bi { color: var(--brand); }
.card-title { font-weight: 700; }
a .card { transition: transform .15s, box-shadow .15s, border-color .15s; }
a:hover .card { transform: translateY(-2px); border-color: var(--brand-soft-2) !important; }

.section-title { font-size: .72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }

/* ---------- 6. Tables ---------- */
.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--text);
    --bs-table-border-color: var(--border);
    --bs-table-striped-bg: var(--surface-2);
    --bs-table-hover-bg: var(--brand-soft);
    --bs-table-hover-color: var(--text);
    margin-bottom: 0;
    font-size: .875rem;
}
.table > :not(caption) > * > * { padding: .8rem .9rem; vertical-align: middle; border-bottom-color: var(--border); }
.table-bordered > :not(caption) > * > * { border-left-width: 0; border-right-width: 0; }
.table-bordered > :not(caption) > * { border-width: 0; }
.table > thead > tr > th,
.table > thead.table-light > tr > th,
.table > thead.table-dark > tr > th {
    background: var(--surface-2) !important; color: var(--muted) !important;
    font-size: .7rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
    border-bottom: 1px solid var(--border) !important; white-space: nowrap;
}
.table > thead > tr > th:first-child { border-top-left-radius: 10px; }
.table > thead > tr > th:last-child { border-top-right-radius: 10px; }
.table > tbody > tr:last-child > * { border-bottom: 0; }
.table-striped > tbody > tr:nth-of-type(odd) > * { --bs-table-bg-type: var(--surface-2); }
table th { user-select: none; }
th[onclick] { cursor: pointer; }
th[onclick]:hover { color: var(--brand) !important; }
.table-responsive { border-radius: 10px; }
.card-body > .table, .card-body > .table-responsive { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.card-body.table-responsive > .table { border: 1px solid var(--border); border-radius: 12px; }
.table-card .card-body { padding: 0; }
.table-card .card-body > .table, .table-card .table-responsive { border: 0; border-radius: 0; }
.table-card .table > thead > tr > th:first-child, .table-card .table > thead > tr > th:last-child { border-radius: 0; }
.table-card .table > :not(caption) > * > *:first-child { padding-left: 1.25rem; }
.table-card .table > :not(caption) > * > *:last-child { padding-right: 1.25rem; }

.empty-row td, .empty-state { text-align: center; color: var(--muted); padding: 40px 16px !important; }
.empty-state .bi { display: block; font-size: 2rem; opacity: .4; margin-bottom: 8px; }

/* ---------- 7. Forms ---------- */
.form-label, .card-body label:not(.form-check-label) {
    font-size: .8rem; font-weight: 600; color: var(--text-2); margin-bottom: 6px; display: inline-block;
}
.form-control, .form-select {
    min-height: 42px; border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong); background-color: var(--surface);
    color: var(--text); font-size: .875rem; transition: border-color .15s, box-shadow .15s;
}
textarea.form-control { min-height: auto; }
.form-control-sm, .form-select-sm { min-height: 34px; font-size: .8rem; border-radius: 8px; }
.form-control::placeholder { color: var(--muted); opacity: .7; }
.form-control:hover, .form-select:hover { border-color: color-mix(in srgb, var(--brand) 35%, var(--border-strong)); }
.form-control:focus, .form-select:focus {
    border-color: var(--brand); box-shadow: 0 0 0 4px var(--bs-focus-ring-color); background-color: var(--surface);
}
.form-check-input { width: 1.1em; height: 1.1em; border-color: var(--border-strong); }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.form-check-label { font-size: .875rem; }
.input-icon { position: relative; }
.input-icon > .bi { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon > .form-control { padding-left: 40px; }
.form-section { padding-bottom: 8px; margin-bottom: 20px; border-bottom: 1px dashed var(--border); }
.form-section:last-child { border-bottom: 0; }
.form-section-title { font-weight: 700; font-size: .95rem; margin-bottom: 14px; display: flex; align-items: center; gap: 10px; }
.form-section-title .bi { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); font-size: .95rem; }

/* ---------- 8. Buttons ---------- */
.btn {
    --bs-btn-font-weight: 600;
    --bs-btn-font-size: .875rem;
    --bs-btn-padding-y: .55rem;
    --bs-btn-padding-x: 1rem;
    --bs-btn-border-radius: var(--radius-sm);
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    transition: all .15s;
}
.btn-sm { --bs-btn-padding-y: .32rem; --bs-btn-padding-x: .7rem; --bs-btn-font-size: .78rem; --bs-btn-border-radius: 8px; }
.btn-lg { --bs-btn-padding-y: .75rem; --bs-btn-font-size: .95rem; --bs-btn-border-radius: 12px; }
.btn-primary {
    --bs-btn-color: #fff; --bs-btn-bg: var(--brand); --bs-btn-border-color: transparent;
    --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--brand-600); --bs-btn-hover-border-color: transparent;
    --bs-btn-active-bg: var(--brand-deep); --bs-btn-active-border-color: transparent;
    --bs-btn-disabled-bg: var(--brand); --bs-btn-disabled-border-color: transparent;
    background-image: var(--brand-grad);
    box-shadow: 0 6px 16px -8px rgba(20, 98, 224, .8);
}
.btn-primary:hover { background-image: none; transform: translateY(-1px); }
.btn-outline-primary {
    --bs-btn-color: var(--brand); --bs-btn-border-color: var(--brand-soft-2);
    --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--brand); --bs-btn-hover-border-color: var(--brand);
    --bs-btn-active-bg: var(--brand-600); --bs-btn-active-border-color: var(--brand-600);
}
.btn-light, .btn-secondary, .btn-outline-secondary {
    --bs-btn-color: var(--text-2); --bs-btn-bg: var(--surface); --bs-btn-border-color: var(--border-strong);
    --bs-btn-hover-color: var(--text); --bs-btn-hover-bg: var(--surface-2); --bs-btn-hover-border-color: var(--border-strong);
    --bs-btn-active-color: var(--text); --bs-btn-active-bg: var(--surface-2); --bs-btn-active-border-color: var(--border-strong);
}
/* Soft action buttons (used for Edit / Toggle in tables) */
.btn-warning, .btn-outline-warning {
    --bs-btn-color: var(--warning); --bs-btn-bg: var(--warning-soft); --bs-btn-border-color: transparent;
    --bs-btn-hover-color: #fff; --bs-btn-hover-bg: #E09612; --bs-btn-hover-border-color: transparent;
    --bs-btn-active-color: #fff; --bs-btn-active-bg: #C98208;
}
.btn-info, .btn-outline-info {
    --bs-btn-color: var(--info); --bs-btn-bg: var(--info-soft); --bs-btn-border-color: transparent;
    --bs-btn-hover-color: #fff; --bs-btn-hover-bg: #0B95E0; --bs-btn-hover-border-color: transparent;
    --bs-btn-active-color: #fff; --bs-btn-active-bg: #087FC0;
}
.btn-success, .btn-outline-success {
    --bs-btn-color: var(--success); --bs-btn-bg: var(--success-soft); --bs-btn-border-color: transparent;
    --bs-btn-hover-color: #fff; --bs-btn-hover-bg: #12925B; --bs-btn-hover-border-color: transparent;
    --bs-btn-active-color: #fff; --bs-btn-active-bg: #0E7A4B;
}
.btn-outline-danger, .btn-danger-soft {
    --bs-btn-color: var(--danger); --bs-btn-bg: var(--danger-soft); --bs-btn-border-color: transparent;
    --bs-btn-hover-color: #fff; --bs-btn-hover-bg: #D03A3A; --bs-btn-hover-border-color: transparent;
    --bs-btn-active-color: #fff; --bs-btn-active-bg: #B32E2E;
}
.btn-ghost { --bs-btn-color: var(--muted); --bs-btn-hover-color: var(--brand); --bs-btn-hover-bg: var(--brand-soft); --bs-btn-border-color: transparent; }
.btn-icon { width: 34px; height: 34px; padding: 0; }
td .btn + .btn, td .btn + a.btn, td a.btn + .btn, td a.btn + a.btn { margin-left: 4px; }

/* ---------- 9. Badges & alerts ---------- */
.badge { font-weight: 600; padding: .4em .7em; border-radius: 999px; letter-spacing: .01em; }
.badge.bg-success   { background: var(--success-soft) !important; color: var(--success) !important; }
.badge.bg-secondary { background: var(--neutral-soft) !important; color: var(--muted) !important; }
.badge.bg-danger    { background: var(--danger-soft) !important;  color: var(--danger) !important; }
.badge.bg-warning   { background: var(--warning-soft) !important; color: var(--warning) !important; }
.badge.bg-info      { background: var(--info-soft) !important;    color: var(--info) !important; }
.badge.bg-primary   { background: var(--brand-soft) !important;   color: var(--brand) !important; }

.badge-soft {
    display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
    font-size: .75rem; font-weight: 600; white-space: nowrap;
}
.badge-soft .bi-circle-fill { font-size: .4rem; }
.badge-soft-success { background: var(--success-soft); color: var(--success); }
.badge-soft-muted   { background: var(--neutral-soft); color: var(--muted); }
.badge-soft-brand   { background: var(--brand-soft);   color: var(--brand); }
.badge-soft-warning { background: var(--warning-soft); color: var(--warning); }
.badge-soft-danger  { background: var(--danger-soft);  color: var(--danger); }
.badge-soft-info    { background: var(--info-soft);    color: var(--info); }

.alert {
    --bs-alert-border-radius: 12px;
    border: 1px solid transparent; border-left-width: 4px; font-weight: 500; font-size: .875rem;
}
.alert-success { background: var(--success-soft); color: var(--success); border-color: var(--success); }
.alert-danger  { background: var(--danger-soft);  color: var(--danger);  border-color: var(--danger); }
.alert-warning { background: var(--warning-soft); color: var(--warning); border-color: #E09612; }
.alert-info    { background: var(--info-soft);    color: var(--info);    border-color: var(--sky); }
.app-content > .alert { margin-bottom: 20px; }

/* ---------- 10. Dropdowns & modals ---------- */
.dropdown-menu {
    --bs-dropdown-bg: var(--surface); --bs-dropdown-border-color: var(--border);
    --bs-dropdown-link-color: var(--text); --bs-dropdown-link-hover-bg: var(--brand-soft);
    --bs-dropdown-link-active-bg: var(--brand); --bs-dropdown-header-color: var(--muted);
    border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; font-size: .875rem; min-width: 220px;
}
.dropdown-item { border-radius: 8px; padding: 8px 10px; }
.dropdown-header { font-size: .78rem; }
.modal-content { border: 1px solid var(--border); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow-lg); }
.modal-header { border-bottom-color: var(--border); padding: 18px 22px; }
.modal-title { font-weight: 700; }
.modal-body { padding: 22px; }
.modal-footer { border-top-color: var(--border); padding: 14px 22px; }
.modal-backdrop.show { opacity: .55; }

/* ---------- 11. Avatars ---------- */
.avatar {
    display: inline-grid; place-items: center; flex-shrink: 0;
    border-radius: 50%; object-fit: cover; font-weight: 700; color: #fff; letter-spacing: .02em;
    background: var(--brand-grad);
}
.avatar-sm { width: 32px; height: 32px; font-size: .72rem; }
.avatar-md { width: 40px; height: 40px; font-size: .82rem; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.05rem; }
.avatar-xl { width: 112px; height: 112px; font-size: 2.2rem; border: 4px solid var(--surface); box-shadow: var(--shadow); }
.avatar-tone-0 { background: linear-gradient(135deg, #1462E0, #1A8CF0); }
.avatar-tone-1 { background: linear-gradient(135deg, #024899, #1462E0); }
.avatar-tone-2 { background: linear-gradient(135deg, #0B83C9, #12A4F7); }
.avatar-tone-3 { background: linear-gradient(135deg, #0B1220, #2A3954); }
.avatar-unknown { background: var(--neutral-soft) !important; color: var(--muted); font-size: 1rem; }
.avatar-tone-4 { background: linear-gradient(135deg, #3B5BDB, #5C7CFA); }

.person { display: flex; align-items: center; gap: 12px; min-width: 0; }
.person-name { font-weight: 700; color: var(--text); display: block; line-height: 1.2; }
a.person:hover .person-name { color: var(--brand); }
.person-meta { font-size: .78rem; color: var(--muted); }
.code-chip {
    display: inline-block; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .76rem; color: var(--text-2);
}

/* ---------- 12. Toolbar (search + filters above tables) ---------- */
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.toolbar .input-icon { flex: 1; min-width: 220px; max-width: 380px; }
.toolbar-meta { margin-left: auto; color: var(--muted); font-size: .8rem; }

/* ---------- 13. Dashboard ---------- */
.hero {
    position: relative; overflow: hidden; border-radius: 18px; padding: 28px 30px; margin-bottom: 24px; color: #fff;
    background:
        radial-gradient(70% 120% at 100% 0%, rgba(18, 164, 247, .45) 0%, transparent 60%),
        radial-gradient(60% 120% at 0% 100%, rgba(20, 98, 224, .5) 0%, transparent 60%),
        var(--ink);
    box-shadow: var(--shadow-lg);
}
.hero h1 { color: #fff; font-size: 1.65rem; font-weight: 800; margin: 0 0 6px; letter-spacing: -.025em; }
.hero p { margin: 0; color: rgba(255, 255, 255, .72); max-width: 560px; }
.hero-swoosh { position: absolute; right: -40px; top: -10px; width: 520px; height: 220px; opacity: .9; pointer-events: none; }
.hero-actions { position: relative; display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.hero .btn-hero {
    --bs-btn-color: #fff; --bs-btn-bg: rgba(255, 255, 255, .1); --bs-btn-border-color: rgba(255, 255, 255, .18);
    --bs-btn-hover-color: var(--ink); --bs-btn-hover-bg: #fff; --bs-btn-hover-border-color: #fff;
    backdrop-filter: blur(6px);
}

.stat-card { position: relative; padding: 20px; height: 100%; }
.stat-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.stat-label { font-size: .8rem; font-weight: 600; color: var(--muted); }
.stat-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 1.15rem; }
.stat-icon.tone-brand   { background: var(--brand-soft); color: var(--brand); }
.stat-icon.tone-success { background: var(--success-soft); color: var(--success); }
.stat-icon.tone-info    { background: var(--info-soft); color: var(--info); }
.stat-icon.tone-warning { background: var(--warning-soft); color: var(--warning); }
.stat-value { font-size: 2rem; font-weight: 800; letter-spacing: -.03em; line-height: 1; color: var(--text); }
.stat-value small { font-size: .95rem; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.stat-foot { margin-top: 10px; font-size: .78rem; color: var(--muted); }
.meter { height: 6px; border-radius: 99px; background: var(--neutral-soft); overflow: hidden; margin-top: 12px; }
.meter > span { display: block; height: 100%; border-radius: 99px; background: var(--brand-grad); }

/* horizontal bar list (one series, one hue) */
.bar-list { list-style: none; margin: 0; padding: 0; }
.bar-list li { display: grid; grid-template-columns: minmax(110px, 38%) 1fr 34px; align-items: center; gap: 12px; padding: 7px 0; }
.bar-list .bar-name { font-size: .84rem; font-weight: 600; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-list .bar-track { height: 10px; border-radius: 0 4px 4px 0; position: relative; }
.bar-list .bar-fill { display: block; height: 100%; min-width: 2px; border-radius: 0 4px 4px 0; background: var(--brand); transition: filter .15s; }
.bar-list li:hover .bar-fill { filter: brightness(1.15); }
.bar-list .bar-val { font-size: .84rem; font-weight: 700; text-align: right; color: var(--text); }

/* vertical column chart (last 7 days) */
.col-chart { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; align-items: end; height: 170px; padding-top: 10px; border-bottom: 1px solid var(--border); }
.col-chart .col { position: relative; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; cursor: default; }
.col-chart .col-bar { width: 100%; max-width: 38px; margin: 0 auto; min-height: 2px; border-radius: 4px 4px 0 0; background: var(--brand); transition: filter .15s; }
.col-chart .col.is-today .col-bar { background: var(--sky); }
.col-chart .col:hover .col-bar { filter: brightness(1.15); }
.col-chart .col-tip {
    position: absolute; bottom: calc(100% - 4px); left: 50%; transform: translate(-50%, 4px);
    background: var(--ink); color: #fff; font-size: .72rem; font-weight: 600; padding: 5px 8px; border-radius: 6px;
    white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .12s, transform .12s; z-index: 2;
}
.col-chart .col:hover .col-tip { opacity: 1; transform: translate(-50%, 0); }
.col-chart-wrap { position: relative; }
.col-chart-empty { position: absolute; inset: 0 0 30px; display: grid; place-items: center; color: var(--muted); font-size: .85rem; }
.col-chart-empty span { background: var(--surface); padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); }
.col-labels { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; margin-top: 8px; text-align: center; font-size: .72rem; color: var(--muted); font-weight: 600; }
.col-labels .is-today { color: var(--text); }

.punch-list { list-style: none; margin: 0; padding: 0; }
.punch-list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.punch-list li:last-child { border-bottom: 0; }
.punch-time { margin-left: auto; text-align: right; font-weight: 700; font-size: .84rem; white-space: nowrap; }
.punch-time small { display: block; font-weight: 500; color: var(--muted); font-size: .72rem; }

.quick-link { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); transition: all .15s; height: 100%; }
.quick-link:hover { border-color: var(--brand-soft-2); background: var(--brand-soft); color: var(--text); transform: translateY(-1px); }
.quick-link .stat-icon { flex-shrink: 0; }
.quick-link strong { display: block; font-size: .88rem; }
.quick-link small { color: var(--muted); font-size: .76rem; }

/* ---------- 14. Profile ---------- */
.profile-hero { overflow: hidden; }
.profile-cover {
    height: 120px;
    background:
        radial-gradient(60% 140% at 100% 0%, rgba(18, 164, 247, .55) 0%, transparent 60%),
        radial-gradient(50% 140% at 10% 100%, rgba(20, 98, 224, .6) 0%, transparent 60%),
        var(--ink);
}
.profile-body { display: flex; gap: 22px; align-items: flex-end; flex-wrap: wrap; padding: 0 24px 22px; margin-top: -48px; }
.profile-id { flex: 1; min-width: 220px; padding-bottom: 4px; }
.profile-id h2 { font-size: 1.45rem; font-weight: 800; margin: 0 0 6px; }
.profile-tags { display: flex; gap: 8px; flex-wrap: wrap; }
.profile-actions { display: flex; gap: 8px; flex-wrap: wrap; padding-bottom: 4px; }

.info-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 18px 24px; margin: 0; }
.info-grid dt { font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.info-grid dd { margin: 0; font-weight: 600; color: var(--text); word-break: break-word; }
.info-block { padding: 16px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); height: 100%; }
.info-block h6 { font-size: .8rem; font-weight: 700; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.info-block h6 .bi { color: var(--brand); }

.nav-pills-brand { gap: 6px; padding: 6px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); display: inline-flex; flex-wrap: wrap; box-shadow: var(--shadow-sm); }
.nav-pills-brand .nav-link { border-radius: 9px; color: var(--muted); font-weight: 600; font-size: .85rem; padding: 8px 14px; display: inline-flex; gap: 8px; align-items: center; }
.nav-pills-brand .nav-link:hover { color: var(--text); background: var(--surface-2); }
.nav-pills-brand .nav-link.active { background: var(--brand-grad); color: #fff; box-shadow: 0 6px 14px -8px rgba(20, 98, 224, .8); }

.timeline-toggle { margin-top: 16px; }

/* ---------- 15. Login ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: var(--surface); }
.auth-brand {
    position: relative; overflow: hidden; color: #fff; padding: 48px 56px;
    display: flex; flex-direction: column; justify-content: space-between;
    background:
        radial-gradient(70% 60% at 100% 0%, rgba(18, 164, 247, .35) 0%, transparent 60%),
        radial-gradient(80% 70% at 0% 100%, rgba(20, 98, 224, .45) 0%, transparent 60%),
        var(--ink);
}
.auth-logo { width: 300px; max-width: 80%; height: auto; position: relative; z-index: 1; }
.auth-pitch { position: relative; z-index: 1; max-width: 460px; }
.auth-pitch h2 { color: #fff; font-size: 2.2rem; font-weight: 800; line-height: 1.15; letter-spacing: -.03em; margin-bottom: 14px; }
.auth-pitch h2 span { background: linear-gradient(90deg, #4FA8FF, #12A4F7); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-pitch p { color: rgba(255, 255, 255, .7); font-size: .95rem; margin-bottom: 26px; }
.auth-points { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.auth-points li { display: flex; gap: 12px; align-items: center; color: rgba(255, 255, 255, .85); font-size: .9rem; font-weight: 500; }
.auth-points .bi { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: rgba(255, 255, 255, .08); color: #6CC4FF; flex-shrink: 0; }
.auth-foot { position: relative; z-index: 1; font-size: .78rem; color: rgba(255, 255, 255, .45); }
.auth-swoosh { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.auth-squares { position: absolute; right: 48px; top: 48px; opacity: .9; }

.auth-form-wrap { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-form { width: 100%; max-width: 400px; }
.auth-form .auth-mobile-logo { display: none; height: 54px; margin-bottom: 28px; }
.auth-form h1 { font-size: 1.75rem; font-weight: 800; letter-spacing: -.03em; margin-bottom: 6px; }
.auth-form .lead-sm { color: var(--muted); margin-bottom: 28px; }
.auth-company { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); font-size: .78rem; font-weight: 700; margin-bottom: 18px; }
.auth-form .form-control { min-height: 48px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--muted); width: 38px; height: 38px; border-radius: 8px; }
.pw-toggle:hover { color: var(--brand); background: var(--brand-soft); }
.auth-help { margin-top: 22px; font-size: .82rem; color: var(--muted); text-align: center; }
.auth-theme { position: absolute; top: 20px; right: 20px; }

@media (max-width: 991.98px) {
    .auth { grid-template-columns: 1fr; }
    .auth-brand { display: none; }
    .auth-form .auth-mobile-logo { display: block; }
}

/* ---------- 16. Utilities ---------- */
.fw-800 { font-weight: 800; }
.gap-row { row-gap: 24px; }
.text-brand { color: var(--brand) !important; }
.bg-surface { background: var(--surface) !important; }
.min-w-0 { min-width: 0; }

@media print {
    .app-sidebar, .app-topbar, .app-footer, .page-actions, .btn { display: none !important; }
    .app-main { margin: 0; }
    .card { box-shadow: none !important; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; }
}

/* <select class="form-control"> used on older pages: give it the select arrow */
select.form-control {
    appearance: none; -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2364748B' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat; background-position: right .75rem center; background-size: 16px 12px;
    padding-right: 2.25rem;
}
.img-thumbnail { border-radius: 12px; border-color: var(--border); background: var(--surface); }
.card-footer { border-top: 1px solid var(--border); }

/* =====================================================================
   WHITE THEME  — light mode uses a white sidebar, white topbar and
   soft-blue accents. Dark mode keeps the ink sidebar defined above.
   ===================================================================== */
.logo-dark { display: none !important; }
[data-bs-theme="dark"] .logo-light { display: none !important; }
[data-bs-theme="dark"] .logo-dark:not(.auth-mobile-logo) { display: block !important; }
@media (max-width: 991.98px) { [data-bs-theme="dark"] .auth-mobile-logo.logo-dark { display: block !important; } }

[data-bs-theme="light"] {
    --bg: #F6F8FC;
}

/* ---- Sidebar ---- */
[data-bs-theme="light"] .app-sidebar {
    background: #FFFFFF;
    color: #475569;
    border-right: 1px solid var(--border);
    box-shadow: 1px 0 0 rgba(15, 23, 42, .02);
}
[data-bs-theme="light"] .sidebar-nav { scrollbar-color: #D5DCE7 transparent; }
[data-bs-theme="light"] .nav-section { color: #94A3B8; }
[data-bs-theme="light"] .sidebar-nav .nav-item { color: #475569; }
[data-bs-theme="light"] .sidebar-nav .nav-item > .bi:first-child { color: #64748B; opacity: 1; }
[data-bs-theme="light"] .sidebar-nav .nav-item:hover { background: #F1F5FB; color: var(--ink); }
[data-bs-theme="light"] .sidebar-nav .nav-item:hover > .bi:first-child { color: var(--brand); }
[data-bs-theme="light"] .sidebar-nav .nav-item.active { background: var(--brand-grad); color: #fff; }
[data-bs-theme="light"] .sidebar-nav .nav-item.active > .bi:first-child { color: #fff; }
[data-bs-theme="light"] .nav-toggle.is-open { color: var(--ink); }
[data-bs-theme="light"] .nav-toggle.is-open > .bi:first-child { color: var(--brand); }
[data-bs-theme="light"] .nav-sub { border-left-color: var(--border); }
[data-bs-theme="light"] .nav-sub a { color: #64748B; }
[data-bs-theme="light"] .nav-sub a:hover { color: var(--ink); background: #F1F5FB; }
[data-bs-theme="light"] .nav-sub a.active { color: var(--brand); background: var(--brand-soft); }
[data-bs-theme="light"] .nav-sub a.active::before { background: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft-2); }
[data-bs-theme="light"] .sidebar-foot { border-top-color: var(--border); }
[data-bs-theme="light"] .sidebar-company { background: var(--surface-2); border: 1px solid var(--border); color: var(--text); }
[data-bs-theme="light"] .sidebar-company .bi { color: var(--brand); }
[data-bs-theme="light"] .sidebar-powered { color: #94A3B8; }
[data-bs-theme="light"] .sidebar-powered strong { color: #475569; }

/* ---- Topbar ---- */
[data-bs-theme="light"] .app-topbar { background: rgba(255, 255, 255, .88); }

/* ---- Dashboard hero ---- */
[data-bs-theme="light"] .hero {
    color: var(--text);
    background:
        radial-gradient(60% 140% at 100% 0%, rgba(18, 164, 247, .18) 0%, transparent 60%),
        radial-gradient(50% 120% at 0% 100%, rgba(20, 98, 224, .10) 0%, transparent 60%),
        linear-gradient(135deg, #FFFFFF 0%, #F3F8FF 100%);
    border: 1px solid #E1EAF7;
    box-shadow: var(--shadow);
}
[data-bs-theme="light"] .hero h1 { color: var(--ink); }
[data-bs-theme="light"] .hero p { color: var(--muted); }
[data-bs-theme="light"] .hero .btn-hero {
    --bs-btn-color: var(--brand); --bs-btn-bg: #fff; --bs-btn-border-color: #D6E3F7;
    --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--brand); --bs-btn-hover-border-color: var(--brand);
    box-shadow: var(--shadow-sm);
}
[data-bs-theme="light"] .hero .btn-hero:first-child {
    --bs-btn-color: #fff; --bs-btn-bg: var(--brand); --bs-btn-border-color: transparent;
    --bs-btn-hover-bg: var(--brand-600);
    background-image: var(--brand-grad);
}

/* ---- Profile cover ---- */
[data-bs-theme="light"] .profile-cover {
    background:
        radial-gradient(50% 160% at 100% 0%, rgba(18, 164, 247, .30) 0%, transparent 60%),
        radial-gradient(45% 160% at 10% 100%, rgba(20, 98, 224, .22) 0%, transparent 60%),
        linear-gradient(120deg, #E8F0FE 0%, #F2F8FF 100%);
}

/* ---- Login brand panel ---- */
[data-bs-theme="light"] .auth { background: #FFFFFF; }
[data-bs-theme="light"] .auth-brand {
    color: var(--text);
    background:
        radial-gradient(70% 60% at 100% 0%, rgba(18, 164, 247, .16) 0%, transparent 60%),
        radial-gradient(80% 70% at 0% 100%, rgba(20, 98, 224, .12) 0%, transparent 60%),
        linear-gradient(160deg, #F7FAFF 0%, #EEF4FD 100%);
    border-right: 1px solid var(--border);
}
[data-bs-theme="light"] .auth-pitch h2 { color: var(--ink); }
[data-bs-theme="light"] .auth-pitch h2 span { background-image: linear-gradient(90deg, #1462E0, #12A4F7); }
[data-bs-theme="light"] .auth-pitch p { color: var(--muted); }
[data-bs-theme="light"] .auth-points li { color: var(--text-2); }
[data-bs-theme="light"] .auth-points .bi { background: #fff; color: var(--brand); border: 1px solid #DCE6F5; box-shadow: var(--shadow-sm); }
[data-bs-theme="light"] .auth-foot { color: #94A3B8; }

/* =====================================================================
   ADMINISTRATION — roles matrix, user access, activity log
   ===================================================================== */
.role-list .role-item {
    padding: 14px 18px; border-color: var(--border); background: transparent; color: var(--text);
    border-left: 3px solid transparent;
}
.role-list .role-item:hover { background: var(--surface-2); }
.role-list .role-item.active { background: var(--brand-soft); color: var(--text); border-left-color: var(--brand); border-color: var(--border); }
.role-list .role-item .bi-chevron-right { color: var(--muted); font-size: .75rem; }
.role-desc { font-size: .8rem; color: var(--muted); margin-top: 4px; }
.role-meta { display: flex; gap: 14px; margin-top: 8px; font-size: .75rem; color: var(--muted); font-weight: 600; }
.role-meta .bi { margin-right: 4px; }

.perm-groups { display: grid; gap: 18px; }
.perm-group { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.perm-group-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.perm-group-head .stat-icon { width: 32px; height: 32px; border-radius: 9px; font-size: .95rem; }
.card-body label.perm-row,
.perm-row { display: flex; width: 100%; font-size: inherit; font-weight: inherit; color: inherit; align-items: center; gap: 14px; padding: 12px 16px; border-bottom: 1px solid var(--border); cursor: pointer; margin: 0; }
.perm-row:last-child { border-bottom: 0; }
.perm-row:hover { background: var(--brand-soft); }
.perm-row .form-switch .form-check-input { width: 2.4em; height: 1.3em; cursor: pointer; margin: 0; }
.perm-text { display: flex; flex-direction: column; min-width: 0; }
.perm-text strong { font-size: .875rem; }
.perm-text small { color: var(--muted); font-size: .78rem; }
.perm-code { margin-left: auto; font-size: .72rem; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); padding: 2px 8px; border-radius: 6px; white-space: nowrap; }
@media (max-width: 575.98px) { .perm-code { display: none; } }

/* Segmented Role / Allow / Deny control */
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); gap: 2px; }
.seg-input { position: absolute; opacity: 0; pointer-events: none; }
.seg-btn { padding: 5px 12px; border-radius: 7px; font-size: .78rem; font-weight: 600; color: var(--muted); cursor: pointer; user-select: none; transition: all .12s; }
.seg-btn:hover { color: var(--text); }
.seg-input:focus-visible + .seg-btn { box-shadow: 0 0 0 3px var(--bs-focus-ring-color); }
.seg-input:checked + .seg-inherit { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.seg-input:checked + .seg-allow   { background: var(--success); color: #fff; }
.seg-input:checked + .seg-deny    { background: var(--danger); color: #fff; }
.seg-input:disabled + .seg-btn    { opacity: .35; cursor: not-allowed; }

.access-table .group-row th {
    background: var(--surface) !important; color: var(--brand) !important; text-transform: uppercase;
    font-size: .7rem; letter-spacing: .08em; padding-top: 18px !important; border-bottom: 1px solid var(--border);
}
.access-table .bi-check-circle-fill, .access-table .bi-dash-circle { font-size: 1.1rem; }
.legend-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.dot-on { background: var(--success); }
.dot-off { background: var(--border-strong); }

/* Activity log */
.audit-table td { vertical-align: top !important; }
.change-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: .8rem; }
.change-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.change-field { font-weight: 700; color: var(--text-2); min-width: 90px; }
.change-old { color: var(--danger); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--danger) 50%, transparent); }
.change-new { color: var(--success); font-weight: 600; }
.change-list .bi-arrow-right { color: var(--muted); font-size: .7rem; }

/* =====================================================================
   ACCOUNTS — password rules, reset confirmation, temp password panel
   ===================================================================== */
.pw-rules { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .78rem; color: var(--muted); }
.pw-rules li::before { content: "\F28A"; font-family: "bootstrap-icons"; margin-right: 6px; font-size: .7rem; }
.pw-rules li.ok { color: var(--success); }
.pw-rules li.ok::before { content: "\F26E"; }
.auth-done { text-align: center; }
.auth-done .stat-icon { width: 64px; height: 64px; border-radius: 18px; font-size: 1.8rem; margin: 0 auto 18px; }
.temp-pw {
    display: flex; flex-wrap: wrap; align-items: center; gap: 16px; padding: 18px 20px; margin-bottom: 24px;
    border-radius: 14px; border: 1px dashed var(--brand); background: var(--brand-soft);
}
.temp-pw-value { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 1.35rem; font-weight: 700; letter-spacing: .04em; color: var(--text); }
.temp-pw small { display: block; color: var(--muted); }
.locked-badge { color: var(--danger); }

/* =====================================================================
   SCHEDULES & ATTENDANCE
   ===================================================================== */
.bg-surface-2 { background: var(--surface-2) !important; }
.shift-chip {
    --chip: var(--brand);
    display: inline-grid; place-items: center; min-width: 34px; height: 34px; padding: 0 6px; border-radius: 9px;
    background: color-mix(in srgb, var(--chip) 14%, transparent); color: var(--chip);
    border: 1px solid color-mix(in srgb, var(--chip) 35%, transparent);
    font-weight: 800; font-size: .8rem; letter-spacing: .02em;
}
.shift-chip.sm { min-width: 26px; height: 24px; border-radius: 7px; font-size: .7rem; }
[data-bs-theme="dark"] .shift-chip { color: color-mix(in srgb, var(--chip) 70%, #fff); }

.dst-banner {
    display: flex; gap: 14px; align-items: center; padding: 14px 18px; border-radius: 14px;
    background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.summer-box { padding: 12px; margin: 0; border-radius: 12px; background: var(--warning-soft); }

/* pattern list + editor */
.mini-week { display: flex; gap: 3px; align-items: center; }
.mini-day {
    --chip: var(--border-strong);
    width: 24px; height: 22px; border-radius: 6px; display: grid; place-items: center;
    font-size: .65rem; font-weight: 800; color: var(--chip);
    background: color-mix(in srgb, var(--chip) 14%, transparent);
}
.role-item.active .mini-day { background: color-mix(in srgb, var(--chip) 20%, var(--surface)); }
.pattern-grid { table-layout: fixed; min-width: 640px; }
.pattern-grid th, .pattern-grid td { padding: .45rem .25rem !important; }
.pattern-grid .day-select {
    --chip: transparent; width: 100%; min-width: 0; font-weight: 700; font-size: .72rem; padding-left: .45rem; padding-right: 1.4rem; background-position: right .35rem center; text-overflow: ellipsis;
    border-left: 4px solid var(--chip);
    background-color: color-mix(in srgb, var(--chip) 9%, var(--surface));
}
.pattern-grid .day-select.is-off { color: var(--muted); font-weight: 500; border-left-color: var(--border-strong); }

/* 2-week strip (employee schedule preview) */
.week-strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.week-day { border: 1px solid var(--border); border-radius: 12px; padding: 8px; text-align: center; background: var(--surface); min-width: 0; }
.week-day.is-today { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.wd-head { font-size: .72rem; font-weight: 700; color: var(--text-2); margin-bottom: 6px; }
.wd-head span { display: block; font-weight: 500; color: var(--muted); }
.wd-shift { --chip: var(--brand); border-radius: 9px; padding: 6px 4px; background: color-mix(in srgb, var(--chip) 14%, transparent); color: var(--chip); }
.wd-shift strong { display: block; font-size: .9rem; }
.wd-shift small { font-size: .66rem; color: var(--text-2); }
.wd-off { border-radius: 9px; padding: 9px 4px; background: var(--surface-2); color: var(--muted); font-size: .72rem; }
.wd-off.holiday { background: var(--brand-soft); color: var(--brand); }
.wd-off.none { color: var(--danger); }
.wd-src { font-size: .62rem; color: var(--muted); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 767.98px) { .week-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* weekly roster */
.roster-table th, .roster-table td { padding: .5rem .4rem !important; }
.roster-table .roster-emp { min-width: 210px; position: sticky; left: 0; background: var(--surface); z-index: 1; }
.roster-table thead .roster-emp { background: var(--surface-2) !important; }
.roster-table th.is-today { color: var(--brand) !important; }
.roster-table th.is-holiday { background: var(--brand-soft) !important; }
.holiday-tag { font-size: .62rem; text-transform: none; letter-spacing: 0; color: var(--brand); font-weight: 600; }
.roster-cell { min-width: 108px; text-align: center; }
.roster-cell.is-today { background: color-mix(in srgb, var(--brand) 5%, transparent); }
.cell-view {
    --chip: transparent; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
    min-height: 46px; border-radius: 10px; padding: 4px;
    background: color-mix(in srgb, var(--chip) 13%, transparent);
    border: 1px solid color-mix(in srgb, var(--chip) 30%, transparent);
}
.cell-code { font-weight: 800; font-size: .85rem; color: var(--chip); line-height: 1.1; }
[data-bs-theme="dark"] .cell-code { color: color-mix(in srgb, var(--chip) 70%, #fff); }
.cell-time { font-size: .68rem; color: var(--text-2); }
.cell-off { font-size: .75rem; color: var(--muted); }
.cell-src { position: absolute; top: 3px; right: 5px; font-size: .55rem; color: var(--muted); }
.cell-edit { display: none; }
#rosterForm.editing .cell-view { display: none; }
#rosterForm.editing .cell-edit { display: block; font-size: .75rem; min-width: 100px; }
.roster-cell.is-changed .cell-edit { border-color: var(--warning); box-shadow: 0 0 0 3px var(--warning-soft); }
.coverage-row td, .coverage-row th { background: var(--surface-2); }
.cov { display: inline-block; margin: 1px 2px; padding: 1px 6px; border-radius: 6px; background: var(--surface); border: 1px solid var(--border); font-weight: 700; font-size: .7rem; }

/* attendance summary chips */
.att-summary { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 12px; }
.att-chip {
    display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px;
    background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); color: var(--text);
    transition: all .15s;
}
.att-chip:hover { border-color: var(--brand-soft-2); color: var(--text); transform: translateY(-1px); }
.att-chip.active { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.att-chip strong { display: block; font-size: 1.3rem; font-weight: 800; line-height: 1; }
.att-chip small { color: var(--muted); font-size: .75rem; font-weight: 600; }
.stat-icon.tone-danger { background: var(--danger-soft); color: var(--danger); }
@media (max-width: 1399.98px) { .att-summary { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 575.98px)  { .att-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* =====================================================================
   LEAVE & NOTIFICATIONS (step 6)
===================================================================== */
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

/* sidebar counters */
.nav-sub a { display: flex; align-items: center; gap: 8px; }
.nav-badge {
    margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px;
    display: inline-grid; place-items: center; font-size: .68rem; font-weight: 800; line-height: 1;
    background: var(--danger); color: #fff;
}
.nav-toggle .nav-badge { margin-right: 4px; }
.nav-toggle .nav-badge + .nav-chevron { margin-left: 0; }

/* bell */
.notif-btn { position: relative; }
.notif-count {
    position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px;
    background: var(--danger); color: #fff; font-size: .62rem; font-weight: 800; display: grid; place-items: center;
    border: 2px solid var(--surface);
}
.notif-menu { width: 360px; max-width: calc(100vw - 24px); overflow: hidden; }
.notif-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.notif-list { list-style: none; margin: 0; padding: 0; max-height: 380px; overflow-y: auto; }
.notif-list li + li { border-top: 1px solid var(--border); }
.notif-list a { display: flex; gap: 12px; padding: 12px 16px; color: var(--text); align-items: flex-start; }
.notif-list a:hover { background: var(--surface-2); }
.notif-list li.is-unread a { background: var(--brand-soft); }
.notif-list li.is-unread a:hover { background: var(--brand-soft-2); }
.notif-icon { flex: 0 0 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--brand); border: 1px solid var(--border); }
.notif-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.notif-text strong { font-size: .84rem; font-weight: 700; }
.notif-text span { font-size: .78rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.notif-menu .notif-text span { white-space: nowrap; }
.notif-time { font-size: .7rem; color: var(--muted); white-space: nowrap; }
.notif-empty { padding: 28px 16px; text-align: center; color: var(--muted); }
.notif-empty .bi { display: block; font-size: 1.6rem; opacity: .4; margin-bottom: 6px; }
.notif-all { display: block; text-align: center; padding: 10px; font-weight: 700; font-size: .8rem; border-top: 1px solid var(--border); }
.notif-list-page { max-height: none; }
.notif-list-page a { padding: 16px 20px; }

/* balance cards */
.leave-card { --chip: var(--brand); padding: 18px 18px 16px; position: relative; overflow: hidden; }
.leave-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--chip); }
.leave-card-top { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.leave-card-name { font-weight: 700; font-size: .88rem; }
.leave-left { display: flex; align-items: baseline; gap: 8px; }
.leave-left strong { font-size: 2rem; font-weight: 800; line-height: 1; letter-spacing: -.02em; }
.leave-left span { color: var(--muted); font-size: .82rem; font-weight: 600; }
.leave-meter > span { background: var(--chip); }
.leave-meta { margin-top: 10px; font-size: .76rem; color: var(--muted); line-height: 1.5; }
.leave-note { margin-top: 10px; font-size: .74rem; color: var(--warning); display: flex; gap: 6px; }

/* day-by-day list */
.day-list { list-style: none; margin: 0 0 14px; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); max-height: 340px; overflow-y: auto; }
.day-list li { display: grid; grid-template-columns: 92px 1fr auto; gap: 10px; padding: 9px 12px; align-items: center; font-size: .82rem; }
.day-list li + li { border-top: 1px solid var(--border); }
.dl-date { font-weight: 700; }
.dl-label { color: var(--text-2); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-amt { font-weight: 800; text-align: right; }
.day-list li.kind-off, .day-list li.kind-holiday { background: var(--surface-2); }
.day-list li.kind-off .dl-amt, .day-list li.kind-holiday .dl-amt { color: var(--muted); font-weight: 600; font-size: .74rem; }
.day-list li.kind-holiday .dl-label { color: var(--brand); }
.day-list li.kind-none .dl-label { color: var(--warning); }
.day-list-flush { border: 0; border-radius: 0; margin: 0; max-height: none; }
.day-list-flush li { padding: 10px 20px; }
.pv-row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; font-size: .84rem; flex-wrap: wrap; }
.pv-row > span { color: var(--muted); font-weight: 600; }
.pv-row + .pv-row { border-top: 1px dashed var(--border); }
#pv_balance { display: grid; grid-template-columns: auto 1fr; }
#pv_balance strong { text-align: right; }
.leave-preview { position: sticky; top: calc(var(--topbar-h) + 16px); }

/* approval steps */
.steps { list-style: none; margin: 0; padding: 0; position: relative; }
.steps .step { display: flex; gap: 12px; position: relative; padding-bottom: 18px; }
.steps .step:last-child { padding-bottom: 0; }
.steps .step:not(:last-child)::after { content: ""; position: absolute; left: 13px; top: 30px; bottom: 2px; width: 2px; background: var(--border); }
.step-dot { flex: 0 0 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: .8rem; background: var(--neutral-soft); color: var(--muted); }
.step-done .step-dot { background: var(--success-soft); color: var(--success); }
.step-rejected .step-dot { background: var(--danger-soft); color: var(--danger); }
.step-waiting .step-dot { background: var(--warning-soft); color: var(--warning); }
.step-cancelled .step-dot { background: var(--neutral-soft); color: var(--muted); }
.step-skipped { opacity: .65; }
.step-comment { margin-top: 6px; padding: 8px 10px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); font-size: .8rem; }
.decide-card { border-color: var(--brand-soft-2); box-shadow: 0 10px 30px -18px rgba(20, 98, 224, .6); }

/* requests list */
.count-pill { margin-left: 6px; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; display: inline-grid; place-items: center; font-size: .7rem; font-weight: 800; background: var(--danger); color: #fff; }
.nav-pills-brand .nav-link.active .count-pill { background: #fff; color: var(--brand); }
.filter-bar { align-items: flex-end; }
.filter-bar .form-control, .filter-bar .form-select { min-width: 130px; }

/* balances table */
.balance-table td, .balance-table th { white-space: nowrap; }
.bal-num { display: block; font-weight: 800; font-size: 1.05rem; line-height: 1.1; }
.bal-num.muted { color: var(--muted); }
.bal-sub { display: block; color: var(--muted); font-size: .7rem; }

/* profile & home */
.leave-mini { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.leave-mini-item { --chip: var(--brand); border: 1px solid var(--border); border-left: 4px solid var(--chip); border-radius: 10px; padding: 10px 12px; }
.leave-mini-item strong { font-size: 1.25rem; font-weight: 800; display: block; line-height: 1.1; }
.leave-mini-item small { color: var(--muted); font-size: .72rem; }
.decide-card .btn-success { --bs-btn-color: #fff; --bs-btn-bg: var(--success); --bs-btn-hover-bg: #0E7A4B; }
/* seven summary chips: keep labels on one line */
.att-chip { padding: 12px; gap: 10px; min-width: 0; }
.att-chip .stat-icon { width: 34px; height: 34px; font-size: 1rem; flex: 0 0 34px; }
.att-chip > span:last-child { min-width: 0; }
.att-chip small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* =====================================================================
   SHIFT SWAPS (step 7)
===================================================================== */
.pick-day { font: inherit; color: inherit; cursor: pointer; transition: border-color .12s, transform .12s; }
.pick-day:hover { border-color: var(--brand); transform: translateY(-1px); }
.strip-label { font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.swap-people { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.swap-arrow { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.swap-table td { vertical-align: middle; }
.swap-table tbody tr:nth-child(odd) td { border-bottom-style: dashed; }
.swap-mini { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.swap-mini + .swap-mini { margin-top: 4px; }

/* =====================================================================
   MY PROFILE & CHANGE REQUESTS (step 8)
===================================================================== */
.profile-meta-mini { display: flex; gap: 22px; flex-wrap: wrap; padding-bottom: 4px; }
.profile-meta-mini > div { display: flex; flex-direction: column; }
.profile-meta-mini span { font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.profile-meta-mini strong { font-size: .9rem; }
.ch-field { position: relative; }
.ch-field.is-changed .form-control, .ch-field.is-changed .form-select { border-color: var(--warning); background-color: color-mix(in srgb, var(--warning) 6%, var(--surface)); }
.ch-field.is-changed .form-label::after { content: "changed"; margin-left: 8px; font-size: .65rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--warning); }
.ch-was { margin-top: 4px; }
.diff-table th[scope=row] { width: 30%; color: var(--text-2); }
.diff-old { color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--danger) 60%, transparent); }
.diff-new { font-weight: 700; color: var(--success); }
.diff-old .small { text-decoration: none; display: block; }

/* ---- Company logo in the left menu, link to FNM Labs in the footer ---- */
.sidebar-company.sidebar-company-logo,
[data-bs-theme="light"] .sidebar-company.sidebar-company-logo { justify-content: center; padding: 12px 14px; background: #FFFFFF; border: 1px solid var(--border, #E3E8F0); }
.sidebar-company-logo img { display: block; max-width: 100%; height: auto; max-height: 48px; object-fit: contain; }
.app-footer-brand a { color: inherit; font-weight: 600; text-decoration: none; }
.app-footer-brand a:hover { color: var(--brand, #1462E0); text-decoration: underline; }

/* =====================================================================
   SIGN-IN PAGES — company-led (logo, name, colour from the logo);
   FNM Labs only as the small "Designed & managed by" credit
   ===================================================================== */
.auth-form-wrap { flex-direction: column; }
.auth-brand {
    background:
        radial-gradient(70% 60% at 100% 0%, color-mix(in srgb, var(--auth-accent, #1462E0) 30%, transparent) 0%, transparent 60%),
        radial-gradient(80% 70% at 0% 100%, color-mix(in srgb, var(--auth-accent, #1462E0) 38%, transparent) 0%, transparent 60%),
        var(--ink);
}
[data-bs-theme="light"] .auth-brand {
    background:
        radial-gradient(70% 60% at 100% 0%, color-mix(in srgb, var(--auth-accent, #1462E0) 13%, transparent) 0%, transparent 60%),
        radial-gradient(80% 70% at 0% 100%, color-mix(in srgb, var(--auth-accent, #1462E0) 10%, transparent) 0%, transparent 60%),
        linear-gradient(160deg, #F9FAFD 0%, #EEF1F7 100%);
}
.auth-company-card {
    position: relative; z-index: 1; align-self: flex-start;
    background: #fff; border: 1px solid rgba(15, 23, 42, .08); border-radius: 18px;
    padding: 18px 26px; box-shadow: 0 14px 34px -18px rgba(0, 0, 0, .45);
}
.auth-company-logo { display: block; width: min(300px, 100%); max-height: 64px; height: auto; object-fit: contain; }
.auth-company-wordmark { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.25rem; letter-spacing: -.02em; color: var(--brand); }
.auth-eyebrow { display: inline-flex; align-items: center; gap: 10px; font-size: .74rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: color-mix(in srgb, var(--auth-accent, #1462E0) 55%, #fff); margin-bottom: 16px; }
.auth-eyebrow span { width: 26px; height: 3px; border-radius: 3px; background: var(--auth-accent, #1462E0); }
[data-bs-theme="light"] .auth-eyebrow { color: var(--brand); }
.auth .auth-pitch h2 span,
[data-bs-theme="light"] .auth .auth-pitch h2 span {
    display: block; margin-top: 2px;
    background-image: linear-gradient(90deg, color-mix(in srgb, var(--auth-accent, #1462E0) 78%, #fff), var(--auth-accent, #1462E0));
}
[data-bs-theme="light"] .auth .auth-pitch h2 span { background-image: linear-gradient(90deg, var(--brand-600), var(--brand)); }
.auth-points .bi { color: color-mix(in srgb, var(--auth-accent, #1462E0) 55%, #fff); }
.auth-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px 18px; }
.auth-credit { display: inline-flex; align-items: center; gap: 7px; color: inherit; text-decoration: none; font-size: .78rem; }
.auth-credit img { border-radius: 4px; opacity: .9; }
.auth-credit strong { font-weight: 700; color: rgba(255, 255, 255, .72); }
.auth-credit:hover strong { color: #fff; text-decoration: underline; }
[data-bs-theme="light"] .auth-credit strong { color: #475569; }
[data-bs-theme="light"] .auth-credit:hover strong { color: var(--brand); }
.auth-mobile-brand { display: none; margin-bottom: 26px; }
.auth-mobile-logo { display: block; width: auto; max-width: min(240px, 100%); max-height: 54px; height: auto; object-fit: contain; }
.auth-credit-mobile { display: none; margin-top: 30px; flex-direction: column; align-items: center; gap: 4px; font-size: .76rem; color: var(--muted); }
.auth-credit-mobile .auth-credit strong { color: var(--text-2, #475569); }
@media (max-width: 991.98px) {
    .auth-mobile-brand { display: inline-block; background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 12px 18px; box-shadow: var(--shadow-sm); }
    .auth-form .auth-mobile-logo { display: block; height: auto; margin: 0; }
    .auth-credit-mobile { display: flex; }
}

.auth-company-logo { width: 300px; max-width: 100%; }
.auth a:not(.btn):not(.auth-credit) { color: var(--brand); }
.auth a:not(.btn):not(.auth-credit):hover { color: var(--brand-600); }
.auth .form-control:focus { border-color: var(--brand); box-shadow: 0 0 0 .25rem var(--brand-soft-2); }
.auth .form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
