/* =========================================================================
   Khelsel HRMS design system
   Soft white cards on a pale blue-grey canvas, a slim icon rail, one blue
   accent. Every colour is a token here; components never hardcode one.
   ========================================================================= */

:root {
    --kh-canvas: #f4f7fb;
    --kh-surface: #ffffff;
    --kh-surface-2: #f8fafd;
    --kh-border: #e8ecf4;
    --kh-border-strong: #d9dfeb;

    --kh-primary: #0a6cff;
    --kh-primary-600: #0558d6;
    --kh-primary-soft: #eaf2ff;

    --kh-ink: #0b1e5b;
    --kh-text: #33415c;
    --kh-muted: #6b7a99;
    --kh-faint: #9aa6bf;

    --kh-cyan: #22c3ee;
    --kh-amber: #ffc53d;
    --kh-coral: #ff6b4a;
    --kh-green: #16b364;
    --kh-violet: #7a5af8;

    --kh-radius: 16px;
    --kh-radius-sm: 10px;
    --kh-shadow: 0 1px 2px rgb(16 24 40 / 4%), 0 4px 16px rgb(16 24 40 / 4%);
    --kh-shadow-lift: 0 2px 6px rgb(16 24 40 / 6%), 0 12px 28px rgb(16 24 40 / 8%);

    --kh-topbar-h: 72px;

    /* Bootstrap overrides, so its own components pick up the palette. */
    --bs-primary: var(--kh-primary);
    --bs-primary-rgb: 10, 108, 255;
    --bs-body-color: var(--kh-text);
    --bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
    --bs-border-color: var(--kh-border);
    --bs-link-color: var(--kh-primary);
    --bs-link-color-rgb: 10, 108, 255;
}

html, body {
    background: var(--kh-canvas);
}

body {
    font-family: var(--bs-body-font-family);
    font-size: 0.9rem;
    color: var(--kh-text);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
    color: var(--kh-ink);
    font-weight: 600;
    letter-spacing: -0.01em;
}

a { text-decoration: none; }

.text-muted { color: var(--kh-muted) !important; }

/* ---- Shell: top bar + content ------------------------------------------- */

.app { min-height: 100vh; }










/* ---- Top bar ------------------------------------------------------------- */

.topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    height: var(--kh-topbar-h);
    background: rgb(255 255 255 / 92%);
    backdrop-filter: saturate(160%) blur(8px);
    border-bottom: 1px solid var(--kh-border);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 28px;
}

.topbar-tabs {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: none;
}

.topbar-tabs::-webkit-scrollbar { display: none; }

.topbar-tab {
    padding: 9px 16px;
    border-radius: 10px;
    color: var(--kh-text);
    font-weight: 500;
    white-space: nowrap;
}

.topbar-tab:hover { color: var(--kh-primary); }

.topbar-tab.active {
    background: var(--kh-primary-soft);
    color: var(--kh-primary);
}

.topbar-search {
    margin-left: auto;
    position: relative;
    width: min(320px, 32vw);
}

.topbar-search input {
    width: 100%;
    height: 44px;
    border: 1px solid transparent;
    border-radius: 12px;
    background: var(--kh-surface-2);
    padding: 0 14px 0 40px;
    color: var(--kh-text);
    outline: none;
    transition: border-color 0.15s, background 0.15s;
}

.topbar-search input:focus { background: #fff; border-color: var(--kh-primary); }

.topbar-search i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--kh-faint);
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 6px 4px 4px;
    border-radius: 999px;
    color: var(--kh-ink);
    font-weight: 500;
    border: 0;
    background: transparent;
}

.topbar-user:hover { background: var(--kh-surface-2); }


/* ---- Content ------------------------------------------------------------- */

.content {
    padding: 28px 32px 48px;
    max-width: 1480px;
}

.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px 24px;
    margin-bottom: 24px;
}

.page-head h1 {
    font-size: 1.6rem;
    margin: 0;
}

.page-head .sub {
    color: var(--kh-muted);
    margin-top: 6px;
}

/* Kept so older markup still lays out. */
.page-header { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.page-header h1 { font-size: 1.45rem; margin: 0; }

.clock {
    text-align: right;
    line-height: 1.2;
}

.clock .label { color: var(--kh-muted); font-size: 0.78rem; }
.clock .time { color: var(--kh-ink); font-size: 1.7rem; font-weight: 600; letter-spacing: -0.02em; }

/* ---- Cards ------------------------------------------------------------- */

.kcard, .card {
    background: var(--kh-surface);
    border: 1px solid var(--kh-border);
    border-radius: var(--kh-radius);
    box-shadow: var(--kh-shadow);
}

.kcard { padding: 24px; }

.kcard-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.kcard-head h2 { font-size: 1.15rem; margin: 0; }
.kcard-head .sub { color: var(--kh-muted); font-size: 0.82rem; margin-top: 4px; }

.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border: 1px solid var(--kh-border-strong);
    border-radius: 999px;
    color: var(--kh-text);
    font-size: 0.8rem;
    font-weight: 500;
    background: #fff;
    white-space: nowrap;
}

a.pill:hover { border-color: var(--kh-primary); color: var(--kh-primary); }

/* ---- Stats -------------------------------------------------------------- */

.stat {
    display: flex;
    gap: 12px;
    align-items: stretch;
}

.stat .bar { width: 4px; border-radius: 4px; background: var(--kh-primary); }
.stat .label { color: var(--kh-muted); font-size: 0.82rem; }
.stat .value { color: var(--kh-ink); font-size: 1.8rem; font-weight: 600; line-height: 1.1; letter-spacing: -0.02em; }
.stat .value small { color: var(--kh-faint); font-size: 0.95rem; font-weight: 500; }

/* ---- Donut (SVG circles, stroke-dasharray) ------------------------------ */

.donut { position: relative; width: 220px; aspect-ratio: 1; flex-shrink: 0; }
.donut svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.donut circle { fill: none; stroke-width: 26; }
.donut .track { stroke: var(--kh-surface-2); }

.donut .centre {
    position: absolute;
    inset: 22%;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 0 10px rgb(10 108 255 / 5%);
    display: grid;
    place-items: center;
    text-align: center;
}

.donut .centre .n { color: var(--kh-ink); font-size: 1.6rem; font-weight: 600; line-height: 1; }
.donut .centre .t { color: var(--kh-muted); font-size: 0.72rem; margin-top: 4px; }

.legend { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 24px; }
.legend-item .swatch { width: 4px; border-radius: 4px; }

/* ---- Bars --------------------------------------------------------------- */

.bars {
    display: flex;
    align-items: flex-end;
    gap: clamp(10px, 3vw, 28px);
    height: 210px;
    padding: 0 4px;
    border-bottom: 1px dashed var(--kh-border-strong);
}

.bars .col {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
    gap: 6px;
}

.bars .fill {
    width: min(26px, 100%);
    border-radius: 8px 8px 3px 3px;
    background: linear-gradient(180deg, var(--kh-primary), #3b8bff);
    min-height: 4px;
    transition: filter 0.15s;
}

.bars .col:nth-child(even) .fill { background: linear-gradient(180deg, var(--kh-cyan), #6fdcf5); }
.bars .col:hover .fill { filter: brightness(1.08); }
.bars .n { color: var(--kh-ink); font-size: 0.8rem; font-weight: 600; }

.bar-labels {
    display: flex;
    gap: clamp(10px, 3vw, 28px);
    padding: 10px 4px 0;
}

.bar-labels span {
    flex: 1;
    min-width: 0;
    text-align: center;
    color: var(--kh-muted);
    font-size: 0.74rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---- People lists ------------------------------------------------------- */

.people { display: flex; flex-direction: column; }

.person {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-top: 1px solid var(--kh-border);
    color: inherit;
}

.person:first-child { border-top: 0; }
a.person:hover .name { color: var(--kh-primary); }
.person .name { color: var(--kh-ink); font-weight: 600; }
.person .meta { color: var(--kh-muted); font-size: 0.8rem; }
.person .when { margin-left: auto; text-align: right; white-space: nowrap; }

.chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 600;
    background: var(--kh-surface-2);
    color: var(--kh-muted);
}

.chip-blue { background: var(--kh-primary-soft); color: var(--kh-primary-600); }
.chip-green { background: #e7f8ef; color: #0d7a45; }
.chip-amber { background: #fff5d6; color: #8a6100; }
.chip-coral { background: #ffece6; color: #b3401f; }
.chip-grey { background: #eef1f6; color: #5b6784; }

/* ---- Reserved (module not yet available) -------------------------------- */

.reserved {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 10px;
    min-height: 180px;
    border: 1.5px dashed var(--kh-border-strong);
    border-radius: 14px;
    background: var(--kh-surface-2);
    color: var(--kh-muted);
    padding: 24px;
}

.reserved i { font-size: 1.8rem; color: var(--kh-faint); }
.reserved strong { color: var(--kh-ink); }

/* ---- Avatars ------------------------------------------------------------ */

.avatar {
    flex-shrink: 0;
    display: inline-grid;
    place-items: center;
    border-radius: 50%;
    overflow: hidden;
    font-weight: 600;
    letter-spacing: 0.02em;
    background: var(--kh-surface-2);
}

.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-xs { width: 28px; height: 28px; font-size: 0.68rem; }
.avatar-sm { width: 34px; height: 34px; font-size: 0.74rem; }
.avatar-md { width: 42px; height: 42px; font-size: 0.85rem; }
.avatar-lg { width: 64px; height: 64px; font-size: 1.15rem; }
.avatar-xl { width: 128px; height: 128px; font-size: 2.2rem; border-radius: 28px; }
.avatar-tile { width: 100%; height: 100%; border-radius: 0; font-size: 2rem; }

/* ---- Directory ---------------------------------------------------------- */

.directory {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.facet { padding: 18px 14px; position: sticky; top: calc(var(--kh-topbar-h) + 24px); }

.facet-title {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 8px 12px;
    color: var(--kh-ink);
    font-weight: 700;
    font-size: 0.78rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.facet a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 9px 10px;
    border-radius: 10px;
    color: var(--kh-text);
    font-weight: 500;
}

.facet a:hover { background: var(--kh-surface-2); }
.facet a.active { background: var(--kh-primary-soft); color: var(--kh-primary); }
.facet .count { color: var(--kh-faint); font-size: 0.78rem; font-weight: 600; }
.facet a.active .count { color: var(--kh-primary); }

.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
}

.toolbar .search { position: relative; flex: 1 1 260px; }
.toolbar .search i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--kh-faint); }
.toolbar .search input { padding-left: 38px; }

.segmented {
    display: inline-flex;
    padding: 3px;
    border-radius: 12px;
    background: #fff;
    border: 1px solid var(--kh-border);
}

.segmented a {
    display: grid;
    place-items: center;
    width: 38px;
    height: 34px;
    border-radius: 9px;
    color: var(--kh-muted);
    font-size: 1.05rem;
}

.segmented a.active { background: var(--kh-primary-soft); color: var(--kh-primary); }

.pager {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--kh-muted);
    font-size: 0.84rem;
    font-weight: 500;
}

.pager a, .pager span.off {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid var(--kh-border);
    background: #fff;
    color: var(--kh-ink);
}

.pager span.off { color: var(--kh-faint); background: var(--kh-surface-2); }
.pager a:hover { border-color: var(--kh-primary); color: var(--kh-primary); }

.emp-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 18px;
}

.emp-card {
    display: flex;
    min-height: 138px;
    overflow: hidden;
    padding: 0;
    color: inherit;
    transition: box-shadow 0.18s, transform 0.18s, border-color 0.18s;
}

.emp-card:hover { box-shadow: var(--kh-shadow-lift); transform: translateY(-2px); border-color: var(--kh-border-strong); }

.emp-card .photo {
    width: 112px;
    flex-shrink: 0;
    background: var(--kh-surface-2);
    display: grid;
}

.emp-card .body {
    flex: 1;
    min-width: 0;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.emp-card .name { color: var(--kh-ink); font-weight: 600; font-size: 0.98rem; }
.emp-card .role { color: var(--kh-muted); font-size: 0.82rem; }

.emp-card .contact {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    color: var(--kh-text);
    font-size: 0.78rem;
}

.emp-card .contact span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.emp-card .contact i { color: var(--kh-faint); margin-right: 6px; }

.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.dot-on { background: var(--kh-green); box-shadow: 0 0 0 3px rgb(22 179 100 / 16%); }
.dot-off { background: var(--kh-faint); }

.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Tables ------------------------------------------------------------- */

.table { --bs-table-bg: transparent; margin: 0; }
.table > :not(caption) > * > * { padding: 13px 16px; border-color: var(--kh-border); }

.table thead th {
    background: var(--kh-surface-2);
    color: var(--kh-muted);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--kh-border);
    white-space: nowrap;
}

.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover > * { background: var(--kh-surface-2); }

.card > .table-responsive:first-child { border-radius: var(--kh-radius) var(--kh-radius) 0 0; }

/* ---- Profile ------------------------------------------------------------ */

.profile-hero {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) minmax(240px, 340px);
    gap: 28px;
    align-items: start;
}

.profile-hero .who h1 { font-size: 1.9rem; margin: 0 0 4px; }
.profile-hero .who .role { color: var(--kh-text); font-size: 1.02rem; font-weight: 500; }
.profile-hero .contact { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 16px; }
.profile-hero .contact a, .profile-hero .contact span { color: var(--kh-text); }
.profile-hero .contact i { color: var(--kh-faint); margin-right: 6px; }

.facts { display: grid; gap: 12px; }
.facts .row-f { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 12px; }
.facts dt { color: var(--kh-muted); font-weight: 500; font-size: 0.84rem; }
.facts dd { margin: 0; color: var(--kh-ink); font-weight: 500; }

.kh-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--kh-border);
    margin-bottom: 22px;
    overflow-x: auto;
}

.kh-tabs .nav-link {
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    padding: 12px 16px;
    color: var(--kh-muted);
    font-weight: 500;
    white-space: nowrap;
}

.kh-tabs .nav-link.active { color: var(--kh-primary); border-bottom-color: var(--kh-primary); background: transparent; }

.section-label {
    color: var(--kh-muted);
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin: 0 0 12px;
}

.section-title {
    color: var(--kh-muted);
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin: 24px 0 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--kh-border);
}

/* ---- Forms & buttons ---------------------------------------------------- */

.form-label { color: var(--kh-ink); font-weight: 500; font-size: 0.84rem; margin-bottom: 6px; }

.form-control, .form-select {
    border-radius: var(--kh-radius-sm);
    border-color: var(--kh-border-strong);
    padding: 0.55rem 0.8rem;
    color: var(--kh-text);
}

.form-control:focus, .form-select:focus {
    border-color: var(--kh-primary);
    box-shadow: 0 0 0 4px rgb(10 108 255 / 12%);
}

.form-control[readonly] { background: var(--kh-surface-2); }

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

.btn { border-radius: var(--kh-radius-sm); font-weight: 500; padding: 0.55rem 1.05rem; }
.btn-sm { padding: 0.38rem 0.8rem; border-radius: 9px; }
.btn-primary { background: var(--kh-primary); border-color: var(--kh-primary); box-shadow: 0 4px 12px rgb(10 108 255 / 22%); }
.btn-primary:hover, .btn-primary:focus { background: var(--kh-primary-600); border-color: var(--kh-primary-600); }
.btn-light { background: #fff; border-color: var(--kh-border-strong); color: var(--kh-text); }
.btn-light:hover { border-color: var(--kh-primary); color: var(--kh-primary); background: #fff; }
.btn-outline-danger { border-color: #ffd2c6; color: #c2410c; }
.btn-outline-danger:hover { background: #fff3ef; color: #9a3412; border-color: #ffb8a5; }

.alert { border-radius: 12px; border: 0; }
.alert-success { background: #e7f8ef; color: #0d7a45; }
.alert-danger { background: #ffece6; color: #9a3412; }
.alert-warning { background: #fff5d6; color: #7a5600; }
.alert-info { background: var(--kh-primary-soft); color: var(--kh-primary-600); }

.empty-state { padding: 48px 16px; text-align: center; color: var(--kh-muted); }

.dropdown-menu {
    border: 1px solid var(--kh-border);
    border-radius: 14px;
    box-shadow: var(--kh-shadow-lift);
    padding: 6px;
}

.dropdown-item { border-radius: 9px; padding: 8px 12px; }

.photo-drop {
    display: flex;
    align-items: center;
    gap: 18px;
}

/* ---- Sign-in ------------------------------------------------------------ */

.auth {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
    background: #fff;
}

.auth-brand {
    position: relative;
    overflow: hidden;
    padding: 56px;
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background:
        radial-gradient(1200px 600px at -10% 110%, rgb(34 195 238 / 55%), transparent 60%),
        radial-gradient(900px 500px at 110% -10%, rgb(122 90 248 / 45%), transparent 60%),
        linear-gradient(145deg, #0b1e5b, #0a6cff);
}

.auth-brand h2 { color: #fff; font-size: 2.3rem; line-height: 1.15; max-width: 14ch; }
.auth-brand p { color: rgb(255 255 255 / 78%); max-width: 42ch; }

.auth-brand .glass {
    align-self: flex-start;
    display: flex;
    gap: 14px;
    align-items: center;
    padding: 14px 18px;
    border-radius: 16px;
    background: rgb(255 255 255 / 12%);
    border: 1px solid rgb(255 255 255 / 22%);
    backdrop-filter: blur(6px);
}

.auth-form { display: grid; place-items: center; padding: 40px 24px; }
.auth-form .inner { width: min(100%, 380px); }
.auth-form h1 { font-size: 1.75rem; }

/* ---- Small screens ------------------------------------------------------ */

@media (max-width: 1199.98px) {
    .profile-hero { grid-template-columns: auto minmax(0, 1fr); }
    .profile-hero .facts-col { grid-column: 1 / -1; }
}

@media (max-width: 991.98px) {
    .topbar { padding: 0 16px; gap: 10px; }
    .topbar-search { display: none; }
    .topbar .dropdown { margin-left: auto; }
    .topbar-user .name { display: none; }
    .content { padding: 20px 16px 40px; }
    .directory { grid-template-columns: 1fr; }
    .facet { position: static; }
    .auth { grid-template-columns: 1fr; }
    .auth-brand { display: none; }
}

@media (max-width: 575.98px) {
    .profile-hero { grid-template-columns: 1fr; justify-items: start; }
    .donut { width: 180px; }
    .legend { grid-template-columns: 1fr 1fr; }
    .clock { text-align: left; }
    .clock .time { font-size: 1.3rem; }
    .emp-grid { grid-template-columns: 1fr; }
}



/* The validation-summary tag helper renders its container even with no errors. */
.validation-summary-valid { display: none; }
.validation-summary-errors ul { margin: 0; padding-left: 1.1rem; }
.min-w-0 { min-width: 0; }

/* Directory list: one line per person; the card scrolls sideways on narrow screens
   rather than breaking codes and names across lines. */
.emp-table td, .emp-table th { white-space: nowrap; }

/* ---- Top bar: launcher button, brand, app name -------------------------- */

.topbar-launcher {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    border-radius: 12px;
    color: var(--kh-ink);
    font-size: 1.15rem;
    transition: background 0.15s, color 0.15s;
}

.topbar-launcher:hover { background: var(--kh-primary-soft); color: var(--kh-primary); }

.topbar-brand, .topbar-app {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    color: var(--kh-ink);
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: -0.01em;
    padding-right: 12px;
    margin-right: 4px;
    border-right: 1px solid var(--kh-border);
}

.topbar-brand .mark {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--kh-primary), var(--kh-cyan));
    color: #fff;
    font-size: 0.95rem;
    box-shadow: 0 4px 10px rgb(10 108 255 / 25%);
}

/* The launcher page has no section tabs, so the brand needs no divider. */
.topbar-brand { border-right: 0; }

/* ---- App launcher ------------------------------------------------------- */

.launcher {
    position: relative;
    max-width: 880px;
    margin: 0 auto;
    padding: 40px 0 24px;
}

/* Soft colour washes behind the grid, echoing the tile colours. */
.launcher::before {
    content: "";
    position: absolute;
    inset: -40px -120px auto;
    height: 420px;
    z-index: -1;
    background:
        radial-gradient(420px 220px at 18% 30%, rgb(10 108 255 / 10%), transparent 70%),
        radial-gradient(380px 220px at 82% 20%, rgb(34 195 238 / 12%), transparent 70%),
        radial-gradient(360px 200px at 55% 85%, rgb(122 90 248 / 8%), transparent 70%);
    pointer-events: none;
}

.launcher-head { text-align: center; margin-bottom: 40px; }
.launcher-head h1 { font-size: 1.9rem; margin-bottom: 6px; }

.app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 34px 20px;
    justify-items: center;
}

.app-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: 130px;
    padding: 10px 6px;
    border-radius: 20px;
    color: var(--kh-ink);
    text-align: center;
    transition: background 0.15s;
}

.app-tile:hover { background: rgb(255 255 255 / 70%); }

.app-icon {
    width: 84px;
    height: 84px;
    border-radius: 22px;
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 2.1rem;
    background: linear-gradient(145deg, var(--from), var(--to));
    box-shadow: 0 10px 22px -8px var(--from), inset 0 1px 0 rgb(255 255 255 / 25%);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.app-tile:hover .app-icon { transform: translateY(-4px); box-shadow: 0 16px 28px -10px var(--from), inset 0 1px 0 rgb(255 255 255 / 25%); }
.app-tile:focus-visible { outline: 3px solid var(--kh-primary); outline-offset: 2px; }
.app-name { font-weight: 600; font-size: 0.92rem; }

@media (max-width: 575.98px) {
    .launcher { padding-top: 20px; }
    .launcher-head h1 { font-size: 1.45rem; }
    .app-grid { grid-template-columns: repeat(3, 1fr); gap: 22px 8px; }
    .app-tile { width: 100%; }
    .app-icon { width: 64px; height: 64px; border-radius: 18px; font-size: 1.6rem; }
    .app-name { font-size: 0.8rem; }
    .topbar-brand { font-size: 0.95rem; }
}

/* ---- Top bar sizing ------------------------------------------------------
   Tabs give way first: they scroll sideways rather than pushing the search and
   the user menu off the bar, and fade at the edge to show there is more. */
.topbar-tabs {
    flex: 0 1 auto;
    min-width: 0;
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent);
    mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent);
    padding-right: 24px;
}

.topbar-search { width: min(280px, 22vw); flex-shrink: 1; min-width: 160px; }
.topbar-user .name { white-space: nowrap; }

/* Without a side rail, centre the page on wide screens. */
.content { margin: 0 auto; }

/* ---- Bikram Sambat dates ------------------------------------------------ */

.bs-date[title] { text-decoration: underline dotted var(--kh-faint); text-underline-offset: 3px; cursor: help; }
.bs-date-ad { display: block; color: var(--kh-muted); font-size: 0.8rem; }
.clock .label.bs { color: var(--kh-primary-600); font-weight: 600; }

/* BS date picker */
.bsdp { position: relative; }
.bsdp-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 4px; font-size: 0.8rem; }
.bsdp-ad { color: var(--kh-muted); }
.bsdp-mode { font-size: 0.8rem; white-space: nowrap; }
.bsdp-pop {
    position: absolute;
    z-index: 1060;
    top: calc(100% + 4px);
    left: 0;
    width: 300px;
    max-width: calc(100vw - 32px);
    padding: 12px;
    background: var(--kh-surface);
    border: 1px solid var(--kh-border);
    border-radius: 14px;
    box-shadow: var(--kh-shadow-lift);
}
.bsdp-head { display: grid; grid-template-columns: 32px 1fr 84px 32px; gap: 6px; align-items: center; margin-bottom: 8px; }
.bsdp-nav {
    border: 0;
    background: transparent;
    border-radius: 8px;
    height: 32px;
    color: var(--kh-muted);
}
.bsdp-nav:hover { background: var(--kh-surface-2); color: var(--kh-ink); }
.bsdp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.bsdp-wd { font-size: 0.7rem; font-weight: 600; color: var(--kh-faint); padding: 4px 0; }
.bsdp-day {
    border: 0;
    background: transparent;
    border-radius: 8px;
    height: 34px;
    font-size: 0.85rem;
    color: var(--kh-text);
}
.bsdp-day:hover { background: var(--kh-primary-soft); }
.bsdp-day:focus-visible { outline: 2px solid var(--kh-primary); outline-offset: 1px; }
.bsdp-day.today { font-weight: 700; color: var(--kh-primary); }
.bsdp-day.selected { background: var(--kh-primary); color: #fff; }
.bsdp-actions { display: flex; justify-content: space-between; margin-top: 8px; }

/* ---- Person picker ------------------------------------------------------- */

.pp { position: relative; }
.pp-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pp-chips:not(:empty) { margin-bottom: 6px; }
.pp-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    padding: 3px 4px 3px 3px;
    border-radius: 999px;
    background: var(--kh-primary-soft);
    color: var(--kh-ink);
    font-size: 0.82rem;
    font-weight: 500;
}
.pp-chip .avatar { border-radius: 50%; }
.pp-x {
    border: 0;
    background: transparent;
    color: var(--kh-muted);
    border-radius: 50%;
    width: 22px;
    height: 22px;
    line-height: 1;
    padding: 0;
}
.pp-x:hover { background: rgb(0 0 0 / 6%); color: var(--kh-ink); }
.pp-list {
    position: absolute;
    z-index: 1060;
    left: 0;
    right: 0;
    margin-top: 4px;
    max-height: 280px;
    overflow-y: auto;
    background: var(--kh-surface);
    border: 1px solid var(--kh-border);
    border-radius: 12px;
    box-shadow: var(--kh-shadow-lift);
    padding: 4px;
}
.pp-option { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 8px; cursor: pointer; }
.pp-option.active, .pp-option:hover { background: var(--kh-primary-soft); }
.pp-empty { padding: 10px; color: var(--kh-muted); font-size: 0.85rem; }

/* ---- Roles & permissions ------------------------------------------------- */

.role-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }
.role-card { display: flex; flex-direction: column; color: inherit; text-decoration: none; transition: box-shadow 0.15s, transform 0.15s; }
.role-card:hover { box-shadow: var(--kh-shadow-lift); transform: translateY(-2px); color: inherit; }
.role-card h2 { color: var(--kh-ink); }
.role-desc { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.role-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-size: 1.2rem;
    background: var(--kh-surface-2);
    color: var(--kh-muted);
    flex-shrink: 0;
}
.role-icon.system { background: var(--kh-primary-soft); color: var(--kh-primary); }

.perm-matrix { min-width: 560px; }
.perm-matrix thead th { font-size: 0.78rem; color: var(--kh-muted); font-weight: 600; border-bottom-color: var(--kh-border); white-space: nowrap; }
.perm-matrix .perm-group th {
    background: var(--kh-surface-2);
    color: var(--kh-faint);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding-top: 10px;
    padding-bottom: 6px;
}
.perm-matrix tbody th[scope=row] { color: var(--kh-ink); }
.perm-matrix .form-check-input { width: 1.15em; height: 1.15em; cursor: pointer; }
.perm-matrix .form-check-input:disabled { cursor: default; }
.perm-col-toggle {
    border: 0;
    background: transparent;
    color: var(--kh-muted);
    font-weight: 600;
    font-size: 0.78rem;
    padding: 2px 6px;
    border-radius: 6px;
}
.perm-col-toggle:hover { background: var(--kh-primary-soft); color: var(--kh-primary); }
.perm-matrix tr.is-overridden > * { background: #fffaf0; }

.reviewer-col { height: 100%; padding: 14px; border: 1px solid var(--kh-border); border-radius: 12px; }

/* ---- Work calendar ------------------------------------------------------- */

.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-wd { text-align: center; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--kh-faint); padding: 4px 0 6px; }
.cal-wd.sat { color: var(--kh-coral); }
.cal-cell {
    position: relative;
    min-height: 96px;
    padding: 8px;
    border: 1px solid var(--kh-border);
    border-radius: 12px;
    background: var(--kh-surface);
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
.cal-cell.blank { border: 0; background: transparent; }
.cal-cell.is-off { background: var(--kh-surface-2); }
.cal-cell.is-holiday { background: #fff4f0; border-color: #ffd6c9; }
.cal-cell.today { box-shadow: inset 0 0 0 2px var(--kh-primary); }
.cal-bs { font-size: 1.15rem; font-weight: 700; color: var(--kh-ink); line-height: 1; }
.cal-cell.is-holiday .cal-bs, .cal-cell.is-off .cal-bs { color: #b3401f; }
.cal-cell.is-off .cal-bs { color: var(--kh-muted); }
.cal-ad { font-size: 0.7rem; color: var(--kh-faint); white-space: nowrap; }
.cal-tag {
    font-size: 0.72rem;
    font-weight: 600;
    color: #b3401f;
    background: #ffe6dd;
    border-radius: 6px;
    padding: 2px 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cal-off { font-size: 0.7rem; color: var(--kh-faint); margin-top: auto; }
.cal-add {
    position: absolute;
    right: 6px;
    bottom: 6px;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    display: grid;
    place-items: center;
    color: var(--kh-muted);
    opacity: 0;
    transition: opacity 0.12s;
}
.cal-cell:hover .cal-add, .cal-add:focus-visible { opacity: 1; background: var(--kh-primary-soft); color: var(--kh-primary); }
.cal-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.cal-stats .n { display: block; font-size: 1.6rem; font-weight: 700; color: var(--kh-ink); }
.cal-stats .l { font-size: 0.72rem; color: var(--kh-muted); }

@media (max-width: 767.98px) {
    .cal-grid { gap: 3px; }
    .cal-cell { min-height: 64px; padding: 5px; border-radius: 8px; }
    .cal-bs { font-size: 0.95rem; }
    .cal-ad { display: none; }
    .cal-tag { font-size: 0; padding: 0; height: 6px; border-radius: 3px; background: var(--kh-coral); }
    .cal-off { display: none; }
}

/* ---- Leave ------------------------------------------------------------------ */

.balance-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.balance-card { display: flex; flex-direction: column; gap: 6px; color: inherit; text-decoration: none; border-top: 4px solid var(--tone); transition: box-shadow 0.15s, transform 0.15s; }
.balance-card:hover { color: inherit; box-shadow: var(--kh-shadow-lift); transform: translateY(-2px); }
.balance-code {
    display: inline-grid;
    place-items: center;
    min-width: 38px;
    height: 26px;
    padding: 0 8px;
    border-radius: 8px;
    font-size: 0.72rem;
    font-weight: 700;
    color: #fff;
    background: var(--tone, var(--kh-primary));
}
.balance-name { font-weight: 600; color: var(--kh-ink); }
.balance-available .n { font-size: 2rem; font-weight: 700; color: var(--kh-ink); line-height: 1; }
.balance-available .l { color: var(--kh-muted); font-size: 0.8rem; margin-left: 4px; }
.balance-bar { display: flex; height: 6px; border-radius: 3px; background: var(--kh-surface-2); overflow: hidden; }
.balance-bar .used { background: var(--tone); }
.balance-bar .pending { background: var(--tone); opacity: 0.4; }
.balance-meta { display: flex; flex-wrap: wrap; gap: 10px; font-size: 0.75rem; color: var(--kh-muted); }
.leave-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; vertical-align: 1px; }

.leave-preview { position: sticky; top: calc(var(--kh-topbar-h) + 16px); }
.preview-days { font-size: 2.4rem; font-weight: 700; color: var(--kh-ink); line-height: 1; }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 16px 20px; border-left: 2px solid var(--kh-border); margin-left: 5px; }
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--kh-surface); border: 2px solid var(--kh-primary); }

.sandwich-box { border: 1px dashed var(--kh-border-strong); border-radius: 12px; padding: 14px; background: var(--kh-surface-2); }

.review-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--kh-surface-2);
    color: var(--kh-muted);
    text-decoration: none;
}
.review-banner .n { font-size: 1.4rem; font-weight: 700; color: var(--kh-ink); }
.review-banner.has { background: #fff5d6; color: #8a6100; }
.review-banner.has .n { color: #8a6100; }

/* ---- Notification bell --------------------------------------------------------- */

.topbar-bell {
    position: relative;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--kh-muted);
    font-size: 1.15rem;
}
.topbar-bell:hover, .topbar-bell[aria-expanded="true"] { background: var(--kh-surface-2); color: var(--kh-ink); }
.bell-count {
    position: absolute;
    top: 4px;
    right: 3px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 9px;
    background: var(--kh-coral);
    color: #fff;
    font-size: 0.64rem;
    font-weight: 700;
    line-height: 17px;
    border: 2px solid var(--kh-surface);
    box-sizing: content-box;
}
.bell-menu { width: min(360px, calc(100vw - 32px)); border-radius: 14px; border-color: var(--kh-border); box-shadow: var(--kh-shadow-lift); overflow: hidden; }
.bell-item { display: block; padding: 10px 16px; border-bottom: 1px solid var(--kh-border); color: inherit; text-decoration: none; }
.bell-item:last-child { border-bottom: 0; }
.bell-item:hover { background: var(--kh-surface-2); color: inherit; }
.bell-item .title { font-weight: 600; font-size: 0.86rem; color: var(--kh-ink); }
.bell-item .body { font-size: 0.8rem; color: var(--kh-muted); }
.bell-item .when { font-size: 0.72rem; color: var(--kh-faint); margin-top: 2px; }
.bell-item.unread { background: var(--kh-primary-soft); }
.bell-item.unread .title::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--kh-primary); margin-right: 6px; vertical-align: 1px; }

/* ---- Leave year view -------------------------------------------------------- */

.leave-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; }
.view-switch .btn { width: 38px; }

.balance-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); background: var(--kh-surface); border: 1px solid var(--kh-border); border-radius: var(--kh-radius); box-shadow: var(--kh-shadow); overflow: hidden; }
.balance-tile { padding: 16px 18px; text-align: center; color: inherit; text-decoration: none; border-right: 1px solid var(--kh-border); position: relative; }
.balance-tile:last-child { border-right: 0; }
.balance-tile::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--tone); }
.balance-tile:hover { background: var(--kh-surface-2); color: inherit; }
.balance-tile .name { font-weight: 600; color: var(--kh-ink); }
.balance-tile .n { font-size: 2rem; font-weight: 700; line-height: 1.15; color: var(--tone); }
.balance-tile .l { font-size: 0.72rem; color: var(--kh-muted); text-transform: uppercase; letter-spacing: 0.04em; }

.leave-year { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 20px; align-items: start; }
.year-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 20px 24px; background: var(--kh-surface); border: 1px solid var(--kh-border); border-radius: var(--kh-radius); box-shadow: var(--kh-shadow); padding: 20px; }
.mini-title { font-size: 0.95rem; font-weight: 600; color: var(--kh-ink); text-align: center; margin: 0 0 8px; }
.mini-title span { font-weight: 400; color: var(--kh-faint); font-size: 0.75rem; margin-left: 4px; }
.mini-grid { display: grid; grid-template-columns: repeat(7, 1fr); row-gap: 3px; text-align: center; }
.mini-wd { font-size: 0.68rem; font-weight: 600; color: var(--kh-faint); padding-bottom: 4px; }
.mini-wd:last-child { color: var(--kh-coral); }

.mini-day {
    --c: var(--kh-primary);
    position: relative;
    display: grid;
    place-items: center;
    height: 30px;
    font-size: 0.8rem;
    color: var(--kh-text);
    text-decoration: none;
    border-radius: 999px;
    margin: 0 1px;
}
a.mini-day:hover { box-shadow: inset 0 0 0 1.5px var(--kh-primary); color: var(--kh-ink); }
.mini-day.off { background: #eef1f6; border-radius: 0; margin: 0; color: var(--kh-muted); }
.mini-day.hol { background: #e3e7ef; border-radius: 0; margin: 0; color: var(--kh-ink); font-weight: 600; }
/* Today is a ring drawn over the cell, so it stays round on shaded off-day columns. */
.mini-day.today { font-weight: 700; color: var(--kh-coral); }
.mini-day.today::before { content: ""; position: absolute; top: 1px; bottom: 1px; left: 50%; transform: translateX(-50%); aspect-ratio: 1; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--kh-coral); pointer-events: none; }
.mini-day.today.lv { color: #fff; }
.mini-day.today.lv::before { box-shadow: inset 0 0 0 2px #fff, 0 0 0 2px var(--kh-coral); }

/* Leave: solid when approved, striped while waiting, struck through when refused. */
.lv-approved { background: var(--c) !important; color: #fff !important; font-weight: 600; }
.lv-pending { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--c) 45%, white) 0 4px, color-mix(in srgb, var(--c) 18%, white) 4px 8px) !important; color: var(--kh-ink) !important; font-weight: 600; }
.lv-refused { background: transparent !important; color: var(--kh-faint) !important; text-decoration: line-through; text-decoration-color: var(--c); text-decoration-thickness: 2px; }
.mini-day.lv { margin: 0; }
.mini-day.lv:not(.join-l) { border-top-left-radius: 999px; border-bottom-left-radius: 999px; margin-left: 1px; }
.mini-day.lv:not(.join-r) { border-top-right-radius: 999px; border-bottom-right-radius: 999px; margin-right: 1px; }
.mini-day.lv.join-l { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.mini-day.lv.join-r { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.mini-day.lv-half.lv-approved { background: linear-gradient(135deg, var(--c) 50%, color-mix(in srgb, var(--c) 20%, white) 50%) !important; }
.mini-day.lv-hours::after { content: ""; position: absolute; bottom: 3px; width: 4px; height: 4px; border-radius: 50%; background: currentColor; }
.mini-day.lv-hidden { background: transparent !important; color: var(--kh-text) !important; font-weight: 400; text-decoration: none; }

.year-side { background: var(--kh-surface); border: 1px solid var(--kh-border); border-radius: var(--kh-radius); box-shadow: var(--kh-shadow); padding: 18px; position: sticky; top: calc(var(--kh-topbar-h) + 16px); }
.type-filter { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: 0.86rem; cursor: pointer; }
.type-filter input { width: 16px; height: 16px; accent-color: var(--c); }
.legend-row { display: flex; align-items: center; gap: 10px; font-size: 0.84rem; padding: 3px 0; }
.legend-swatch { display: inline-grid; place-items: center; width: 28px; height: 20px; border-radius: 6px; font-size: 0.7rem; }
.legend-swatch.lv-refused { background: transparent; }
.legend-swatch.lv-refused::after { content: "13"; }
.legend-swatch.off { background: #eef1f6; color: var(--kh-muted); }
.legend-swatch.hol { background: #e3e7ef; font-weight: 600; }
.legend-swatch.today { box-shadow: inset 0 0 0 2px var(--kh-coral); color: var(--kh-coral); font-weight: 700; border-radius: 999px; }
.holiday-list { list-style: none; padding: 0; margin: 0; font-size: 0.82rem; }
.holiday-list li { padding: 5px 0; border-top: 1px solid var(--kh-border); }
.holiday-list li:first-child { border-top: 0; }

@media (max-width: 1199.98px) {
    .leave-year { grid-template-columns: 1fr; }
    .year-side { position: static; }
}

@media (max-width: 575.98px) {
    .year-grid { padding: 12px; grid-template-columns: 1fr; }
    .balance-tile { border-right: 0; border-bottom: 1px solid var(--kh-border); }
}

/* =========================================================================
   Attendance
   ========================================================================= */

.checkin-wrap { max-width: 520px; margin: 8px auto 0; display: grid; gap: 16px; }

.checkin-card {
    background: var(--kh-surface);
    border: 1px solid var(--kh-border);
    border-radius: 24px;
    box-shadow: var(--kh-shadow-lift);
    padding: 32px 28px 24px;
    text-align: center;
}

.checkin-photo { display: flex; justify-content: center; margin-bottom: 14px; }
.checkin-photo .avatar-xl { width: 132px; height: 132px; border-radius: 50%; box-shadow: 0 0 0 6px var(--kh-primary-soft); }
.checkin-name { font-size: 1.6rem; margin: 0; color: var(--kh-ink); }
.checkin-greeting { color: var(--kh-muted); margin-top: 4px; }
.checkin-clock { font-size: 2.6rem; font-weight: 700; color: var(--kh-ink); letter-spacing: -0.02em; margin-top: 18px; font-variant-numeric: tabular-nums; }
.checkin-date { color: var(--kh-muted); font-size: 0.9rem; margin-bottom: 22px; }

.checkin-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    max-width: 300px;
    padding: 16px 24px;
    border: 0;
    border-radius: 14px;
    color: #fff;
    font-size: 1.2rem;
    font-weight: 600;
    transition: transform 0.08s ease, box-shadow 0.15s ease, filter 0.15s ease;
}
.checkin-button i { font-size: 1.4rem; }
.checkin-button.in { background: var(--kh-green); box-shadow: 0 8px 20px rgb(22 179 100 / 30%); }
.checkin-button.out { background: var(--kh-coral); box-shadow: 0 8px 20px rgb(255 107 74 / 30%); }
.checkin-button:hover { filter: brightness(1.05); }
.checkin-button:active { transform: scale(0.98); }
.checkin-button:disabled { opacity: 0.7; }
.checkin-location { margin-top: 10px; }

.checkin-blocked {
    display: flex;
    gap: 12px;
    text-align: left;
    align-items: flex-start;
    background: #fff4f1;
    color: #9a3412;
    border: 1px solid #ffd6cb;
    border-radius: var(--kh-radius-sm);
    padding: 12px 14px;
}
.checkin-blocked i { font-size: 1.3rem; }

.checkin-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid var(--kh-border);
}
.checkin-stats .label { display: block; color: var(--kh-muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; }
.checkin-stats strong { color: var(--kh-ink); font-size: 0.95rem; }
.checkin-stats .chip { display: inline-block; margin-top: 4px; }
.checkin-note { margin-top: 16px; font-size: 0.85rem; color: var(--kh-muted); }

.punch-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.punch-list li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.punch-list li.voided { text-decoration: line-through; opacity: 0.55; }

.att-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
.att-summary > * {
    display: flex;
    flex-direction: column;
    background: var(--kh-surface);
    border: 1px solid var(--kh-border);
    border-radius: var(--kh-radius-sm);
    padding: 10px 14px;
    color: var(--kh-muted);
    font-size: 0.8rem;
    text-decoration: none;
}
.att-summary .n { font-size: 1.35rem; font-weight: 700; color: var(--kh-ink); }
.att-summary .warn .n, .att-summary > .warn .n { color: #b7791f; }
.att-summary .bad .n, .att-summary > .bad .n { color: #d9432a; }
.att-summary a:hover { border-color: var(--kh-primary); }
.att-summary a.active { border-color: var(--kh-primary); background: var(--kh-primary-soft); }
.att-summary.compact { grid-template-columns: repeat(4, 1fr); }
.att-summary.compact > * { background: var(--kh-surface-2); }

.att-table tr.is-off td { background: var(--kh-surface-2); }
.att-table tr.is-future td { opacity: 0.55; }
.att-table tr.is-today td:first-child { box-shadow: inset 3px 0 0 var(--kh-primary); }
.att-table tr.att-punches td { background: var(--kh-surface-2); padding: 10px 16px 12px 56px; }
.att-table .chip { margin-right: 4px; }
.att-date { display: flex; align-items: center; gap: 10px; }
.att-date .dn { font-size: 1.2rem; font-weight: 700; color: var(--kh-ink); min-width: 28px; text-align: right; }
.att-date .dw { font-weight: 600; color: var(--kh-text); }

.month-nav { display: flex; align-items: center; gap: 10px; }
.month-nav strong { min-width: 130px; text-align: center; color: var(--kh-ink); }

.kcard-link { font-size: 0.85rem; font-weight: 600; text-decoration: none; white-space: nowrap; }

.att-me {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--kh-surface-2);
    border: 1px solid var(--kh-border);
    border-radius: var(--kh-radius-sm);
}

.att-bar { display: flex; height: 8px; border-radius: 99px; background: var(--kh-border); overflow: hidden; }
.att-bar .p { background: var(--kh-green); }
.att-bar .l { background: var(--kh-primary); }

@media (max-width: 575.98px) {
    .checkin-card { padding: 24px 16px 18px; border-radius: 18px; }
    .checkin-clock { font-size: 2.1rem; }
    .att-summary.compact { grid-template-columns: repeat(2, 1fr); }
}

/* =========================================================================
   Payroll
   ========================================================================= */

.pay-table td, .pay-table th { white-space: nowrap; }
.pay-table tfoot td { border-top: 2px solid var(--kh-border-strong); }

.salary-rev { border: 1px solid var(--kh-border); border-radius: var(--kh-radius-sm); padding: 12px 14px; margin-bottom: 12px; }
.salary-rev.current { border-color: var(--kh-primary); box-shadow: inset 3px 0 0 var(--kh-primary); }
.salary-rev .table td { padding: 4px 6px; }

.bank-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.bank-item { border: 1px solid var(--kh-border); border-radius: var(--kh-radius-sm); padding: 10px 12px; }

.payslip {
    max-width: 860px;
    margin: 0 auto;
    background: var(--kh-surface);
    border: 1px solid var(--kh-border);
    border-radius: var(--kh-radius);
    box-shadow: var(--kh-shadow);
    padding: 28px 32px;
}
.payslip-head { display: flex; justify-content: space-between; gap: 16px; border-bottom: 2px solid var(--kh-ink); padding-bottom: 14px; }
.payslip-company { font-size: 1.35rem; font-weight: 700; color: var(--kh-ink); }
.payslip-net-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--kh-muted); }
.payslip-net { font-size: 1.6rem; font-weight: 700; color: var(--kh-ink); font-variant-numeric: tabular-nums; }
.payslip-facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px 18px; margin: 18px 0; }
.payslip-facts dt { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--kh-muted); font-weight: 600; }
.payslip-facts dd { margin: 0; color: var(--kh-ink); }
.payslip-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.payslip-cols h2 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--kh-muted); margin-bottom: 6px; }
.payslip-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.payslip-table td { padding: 5px 0; border-bottom: 1px dashed var(--kh-border); }
.payslip-table td:last-child { text-align: right; }
.payslip-table tr.muted td { color: var(--kh-muted); }
.payslip-table tr.total td { font-weight: 700; border-bottom: 0; border-top: 1px solid var(--kh-ink); }
.payslip-netline { display: flex; justify-content: space-between; align-items: baseline; margin-top: 18px; padding: 12px 16px; background: var(--kh-primary-soft); border-radius: var(--kh-radius-sm); font-size: 1.1rem; color: var(--kh-ink); }
.payslip-tax { margin-top: 18px; }
.payslip-tax summary { cursor: pointer; font-weight: 600; color: var(--kh-ink); }
.payslip-tax pre { margin: 10px 0 0; padding: 12px; background: var(--kh-surface-2); border-radius: var(--kh-radius-sm); font-size: 0.8rem; white-space: pre-wrap; }
.payslip-foot { margin-top: 18px; }

@media (max-width: 767.98px) {
    .payslip { padding: 18px 16px; }
    .payslip-facts { grid-template-columns: repeat(2, 1fr); }
    .payslip-cols { grid-template-columns: 1fr; }
}

@media print {
    .topbar, .no-print, .alert, .toast, .flash { display: none !important; }
    body, .app, .content { background: #fff !important; padding: 0 !important; margin: 0 !important; }
    .payslip { border: 0; box-shadow: none; max-width: none; padding: 0; }
    .payslip-tax[open] pre, .payslip-tax pre { background: #fff; border: 1px solid #ddd; }
    .payslip-netline { background: #f2f2f2; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* =========================================================================
   HR actions
   ========================================================================= */

.timeline { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 2px solid var(--kh-border); }
.timeline li { position: relative; padding: 0 0 14px 14px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before {
    content: "";
    position: absolute;
    left: -21px;
    top: 6px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--kh-primary);
    box-shadow: 0 0 0 3px var(--kh-surface);
}

.clearance { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.clearance li { display: flex; align-items: center; gap: 8px; }

.doc-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.doc-list li { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }

.placeholder-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 0.82rem; }
.placeholder-list li { display: grid; grid-template-columns: 170px 1fr; gap: 8px; }
.placeholder-list code { color: var(--kh-violet); }

.rating { color: var(--kh-amber); font-size: 1.1rem; letter-spacing: 2px; }

.letter-editor { font-family: "Inter", system-ui, sans-serif; line-height: 1.7; }

.letter {
    max-width: 800px;
    margin: 0 auto;
    background: var(--kh-surface);
    border: 1px solid var(--kh-border);
    border-radius: var(--kh-radius);
    box-shadow: var(--kh-shadow);
    padding: 44px 52px;
    line-height: 1.8;
    color: var(--kh-ink);
    white-space: pre-line;
}
.letter p { margin-bottom: 1.1rem; }

@media (max-width: 575.98px) {
    .letter { padding: 22px 18px; }
    .placeholder-list li { grid-template-columns: 1fr; gap: 0; }
}

@media print {
    .letter { border: 0; box-shadow: none; max-width: none; padding: 0; }
}

/* =========================================================================
   Data: import and history
   ========================================================================= */

.import-kinds { display: grid; gap: 8px; }
.import-kind {
    display: block;
    border: 1px solid var(--kh-border);
    border-radius: var(--kh-radius-sm);
    padding: 10px 12px;
    text-decoration: none;
    color: var(--kh-text);
}
.import-kind strong { display: block; color: var(--kh-ink); }
.import-kind span { font-size: 0.8rem; color: var(--kh-muted); }
.import-kind:hover { border-color: var(--kh-primary); }
.import-kind.active { border-color: var(--kh-primary); background: var(--kh-primary-soft); }

.import-table td, .import-table th { white-space: nowrap; }
.import-table td:nth-child(3) { white-space: normal; min-width: 220px; }
.table-danger-subtle td { background: #fff6f4; }

.field-changes { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 2px; font-size: 0.82rem; }
.field-changes li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; }
.field-changes .field { color: var(--kh-muted); min-width: 130px; }
.field-changes .from { color: var(--kh-muted); text-decoration: line-through; }
.field-changes .to { color: var(--kh-ink); font-weight: 600; }
.field-changes i { color: var(--kh-faint); font-size: 0.7rem; }

@media (max-width: 575.98px) {
    .field-changes .field { min-width: 0; }
}
