/* HRMS portal — RTL, light-red palette */
/* Staff Pulse palette, taken from the logo: deep blue, wave blue, sky-blue arrow, slate-navy lettering. */
:root {
    --navy: #3a4566;
    --accent: #8cc8f0;
    --accent-dark: #4f9ad8;
    --primary: #2f7bd0;
    --primary-dark: #1d4f96;
    --primary-soft: #e2eefb;
    --primary-softer: #f3f8fe;
    --ink: #2c3654;
    --muted: #6f7890;
    --line: #d9e4f2;
    --surface: #ffffff;
    --page: #f4f7fc;
    --ok: #2e8b57;
    --ok-soft: #e6f4ec;
    --warn: #b7791f;
    --warn-soft: #fdf3dc;
    --bad: #c0392b;
    --bad-soft: #fbe4e1;
    --radius: 10px;
    --input-bg: #ffffff;
    --input-border: #cfdcec;
    --row-hover: #f6f9fe;
    --chip-muted: #e9eef6;
    color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, "Noto Sans Arabic", Arial, sans-serif;
    font-size: 15px;
    color: var(--ink);
    background: var(--page);
}

a { color: var(--primary-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.45rem; margin: 0 0 1rem; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
h1:focus { outline: none; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.pre { white-space: pre-line; }

/* ---------- shell: top navigation bar with drop-down panels ---------- */
.shell { display: flex; flex-direction: column; min-height: 100vh; }

.brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; font-size: 1.05rem; padding: .25rem .5rem 1rem; }
/* The Staff Pulse logo mark (pulse wave, team, rising arrow). */
.brand-mark {
    display: inline-block; flex-shrink: 0; width: 46px; height: 38px;
    background: url("/brand/logo-mark.svg") center / contain no-repeat;
}
.brand.auth-brand { justify-content: center; padding-bottom: 1.2rem; }
.brand.auth-brand .brand-mark { width: 64px; height: 52px; }
.brand-name { display: flex; flex-direction: column; line-height: 1.2; text-align: start; }
.brand-name strong { color: var(--ink); font-size: 1.08rem; }
.brand-name small { font-size: .78rem; font-weight: 700; letter-spacing: .3px; direction: ltr; text-align: start; }

/* In English the Arabic name is translated to "Staff Pulse", so the second line would repeat it. */
html[data-lang="en"] .brand-name small { display: none; }

/* ---- language menu (flags) ---- */
.lang-menu { position: relative; }
.lang-menu > summary {
    list-style: none; cursor: pointer; display: flex; align-items: center; gap: .35rem; padding: .35rem .6rem;
    border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-weight: 700; font-size: .85rem;
}
.lang-menu > summary::-webkit-details-marker { display: none; }
.lang-menu .flag { width: 22px; height: 15px; border-radius: 3px; box-shadow: 0 0 0 1px rgba(0,0,0,.12); vertical-align: middle; flex-shrink: 0; }
.lang-current { display: none; align-items: center; gap: .35rem; }
html:not([data-lang]) .lang-current[data-lang="ar"], html[data-lang="ar"] .lang-current[data-lang="ar"],
html[data-lang="en"] .lang-current[data-lang="en"], html[data-lang="ckb"] .lang-current[data-lang="ckb"] { display: inline-flex; }
.lang-panel {
    position: absolute; inset-inline-end: 0; top: calc(100% + .4rem); z-index: 50; min-width: 220px; padding: .5rem;
    background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 30px rgba(20,40,80,.18);
}
.lang-title { font-size: .72rem; color: var(--muted); padding: .35rem .4rem .2rem; }
.lang-item {
    display: flex; width: 100%; align-items: center; gap: .55rem; padding: .45rem .55rem; border: 0; border-radius: 8px;
    background: transparent; color: var(--ink); font: inherit; cursor: pointer; text-align: start;
}
.lang-item:hover { background: var(--primary-soft); }
html[data-lang="ar"] .lang-item[data-lang="ar"], html[data-lang="en"] .lang-item[data-lang="en"], html[data-lang="ckb"] .lang-item[data-lang="ckb"] {
    background: var(--primary-soft); font-weight: 800;
}
.lang-print { display: flex; gap: .35rem; padding: .2rem .3rem .3rem; }
.lang-chip {
    display: inline-flex; align-items: center; gap: .3rem; padding: .3rem .5rem; border: 1px solid var(--line); border-radius: 999px;
    background: transparent; color: var(--ink); font: inherit; font-size: .78rem; font-weight: 700; cursor: pointer;
}
.lang-chip.active { border-color: var(--primary); background: var(--primary-soft); }
/* Public website: dark text on the white (scrolled / inner page) header, white text only over the home page hero. */
.lang-menu.on-site > summary { background: var(--primary-softer); color: var(--ink); border-color: var(--line); }
.site.is-home .site-header:not(.scrolled) .lang-menu.on-site > summary { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.35); }
.lang-menu.on-site .lang-panel { color: var(--ink); background: var(--surface); border-color: var(--line); font-size: .95rem; }
.lang-menu.on-site .lang-item:hover, html[data-lang] .lang-menu.on-site .lang-item[data-lang] { background: transparent; }
.lang-menu.on-site .lang-item:hover { background: var(--primary-softer); }
html[data-lang="ar"] .lang-menu.on-site .lang-item[data-lang="ar"], html[data-lang="en"] .lang-menu.on-site .lang-item[data-lang="en"],
html[data-lang="ckb"] .lang-menu.on-site .lang-item[data-lang="ckb"] { background: var(--primary-soft); }
@media (max-width: 1000px) {
    .site.is-home .site-header:not(.scrolled) .lang-menu.on-site > summary { background: var(--primary-softer); color: var(--ink); border-color: var(--line); }
}
.brand-name small b { color: var(--navy); font-weight: 800; }
.brand-name small i { color: var(--accent-dark); font-style: normal; font-weight: 800; }

.appbar {
    --bar-ink: #dbe6f7;
    position: sticky; top: 0; z-index: 60; color: #fff;
    background: linear-gradient(100deg, #17213d 0%, #1b2d57 55%, #1d4f96 100%);
    box-shadow: 0 6px 22px rgba(13, 27, 56, .22);
}
.appbar-row { display: flex; align-items: center; gap: .9rem; height: 64px; padding: 0 1.25rem; max-width: 1600px; margin: 0 auto; }
.appbar-brand { flex-shrink: 0; }
.appbar-brand:hover { text-decoration: none; }
.brand.on-dark { padding: 0; }
.brand.on-dark .brand-mark { width: 42px; height: 34px; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .25)); }
.brand.on-dark .brand-name strong { color: #fff; font-size: 1rem; }
.brand.on-dark .brand-name small b { color: #c9d6ee; }
.brand.on-dark .brand-name small i { color: var(--accent); }

.nav-icon { width: 19px; height: 19px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav-chev { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; opacity: .7; transition: transform .2s; }
details[open] > summary .nav-chev { transform: rotate(180deg); }

.appnav { flex: 1; min-width: 0; display: flex; align-items: center; gap: .15rem; }
.mega > summary {
    list-style: none; cursor: pointer; display: flex; align-items: center; gap: .4rem; padding: .5rem .75rem; border-radius: 10px;
    color: var(--bar-ink); font-weight: 600; font-size: .93rem; white-space: nowrap; position: relative; user-select: none;
    transition: background .15s, color .15s;
}
.mega > summary::-webkit-details-marker { display: none; }
.mega > summary:hover, .mega[open] > summary { background: rgba(255, 255, 255, .12); color: #fff; }
.mega.current > summary { color: #fff; background: rgba(255, 255, 255, .08); }
.mega.current > summary::after {
    content: ""; position: absolute; inset-inline: .75rem; bottom: -12px; height: 3px; border-radius: 3px 3px 0 0; background: var(--accent);
}
.mega > summary:focus-visible, .user-menu > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.mega-panel {
    position: absolute; top: 100%; inset-inline: 0; margin: 0 auto; width: min(1180px, calc(100% - 2rem));
    background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 18px 18px;
    box-shadow: 0 28px 60px rgba(13, 27, 56, .25); padding: 1rem 1.1rem 1.2rem; animation: mega-in .16s ease-out;
}
@keyframes mega-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.mega-head { display: flex; align-items: center; gap: .7rem; padding: .2rem .3rem .9rem; border-bottom: 1px solid var(--line); margin-bottom: .7rem; }
.mega-head-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; color: #fff; background: linear-gradient(135deg, var(--accent-dark), var(--primary-dark)); }
.mega-head strong { display: block; font-size: 1.05rem; }
.mega-head small { color: var(--muted); font-size: .8rem; }
.mega-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: .3rem; }
.mega-card { display: flex; align-items: flex-start; gap: .75rem; padding: .7rem .75rem; border-radius: 12px; color: var(--ink); transition: background .15s; }
.mega-card:hover { background: var(--primary-softer); text-decoration: none; }
.mega-card.active { background: var(--primary-soft); }
.mega-icon { display: grid; place-items: center; width: 40px; height: 40px; flex-shrink: 0; border-radius: 11px; background: var(--primary-soft); color: var(--primary); transition: background .15s, color .15s; }
.mega-card:hover .mega-icon, .mega-card.active .mega-icon { background: var(--primary); color: #fff; }
.mega-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.mega-text b { font-weight: 600; font-size: .94rem; }
.mega-card.active .mega-text b { color: var(--primary-dark); }
.mega-text small { color: var(--muted); font-size: .8rem; margin-top: .1rem; }

.appbar-actions { display: flex; align-items: center; gap: .45rem; flex-shrink: 0; }
.appbar .btn.ghost { color: #fff; border-color: rgba(255, 255, 255, .22); background: rgba(255, 255, 255, .06); }
.appbar .btn.ghost:hover { background: rgba(255, 255, 255, .14); }
.appbar .lang-menu > summary { background: rgba(255, 255, 255, .08); color: #fff; border-color: rgba(255, 255, 255, .22); }
.appbar .lang-panel { color: var(--ink); }
.appbar .theme-toggle { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .22); color: #fff; }
.appbar .theme-toggle:hover { background: rgba(255, 255, 255, .16); }

.user-menu { position: relative; }
.user-menu > summary {
    list-style: none; cursor: pointer; display: flex; align-items: center; gap: .5rem; padding: .25rem .5rem .25rem .3rem;
    border-radius: 999px; color: #fff; border: 1px solid rgba(255, 255, 255, .22); background: rgba(255, 255, 255, .06);
}
.user-menu > summary::-webkit-details-marker { display: none; }
.user-menu > summary:hover, .user-menu[open] > summary { background: rgba(255, 255, 255, .14); }
.user-avatar {
    display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; font-weight: 700;
    color: #fff; background: linear-gradient(135deg, var(--accent-dark), #5d6fb8);
}
.user-avatar.lg { width: 46px; height: 46px; font-size: 1.15rem; }
.user-name { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; font-weight: 600; }
.user-panel {
    position: absolute; inset-inline-end: 0; top: calc(100% + .55rem); width: 270px; padding: .5rem; z-index: 70;
    background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 20px 45px rgba(13, 27, 56, .25);
    animation: mega-in .16s ease-out;
}
.user-panel-head { display: flex; gap: .7rem; align-items: center; padding: .5rem .5rem .6rem; }
.user-panel-head strong { display: block; line-height: 1.3; }
.user-panel-head small { color: var(--muted); }
.user-panel-date { font-size: .8rem; color: var(--muted); padding: .45rem .6rem; margin: 0 .1rem .35rem; border-radius: 8px; background: var(--primary-softer); }
.user-panel a, .user-logout {
    display: flex; width: 100%; align-items: center; gap: .6rem; padding: .55rem .6rem; border-radius: 9px; border: 0;
    background: none; color: var(--ink); font: inherit; cursor: pointer; text-align: start;
}
.user-panel a:hover, .user-logout:hover { background: var(--primary-softer); text-decoration: none; }
.user-panel .nav-icon { color: var(--muted); }
.user-logout { color: var(--bad); border-top: 1px solid var(--line); border-radius: 0 0 9px 9px; margin-top: .3rem; }
.user-logout .nav-icon { color: var(--bad); }

.nav-toggle { position: absolute; opacity: 0; pointer-events: none; }
.nav-burger { display: none; place-items: center; width: 42px; height: 42px; border-radius: 11px; cursor: pointer; color: #fff; background: rgba(255, 255, 255, .1); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.crumbs { display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; font-size: .85rem; color: var(--muted); padding: .9rem 1.5rem 0; max-width: 1600px; width: 100%; margin: 0 auto; }
.crumbs a { display: inline-flex; color: var(--muted); }
.crumbs a:hover { color: var(--primary); }
.crumbs strong { color: var(--ink); font-weight: 600; }
.crumb-icon { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.crumb-sep { opacity: .5; }
.content { padding: 1.2rem 1.5rem 1.5rem; max-width: 1600px; width: 100%; margin: 0 auto; }

/* Dashboard shortcuts */
.quick-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .75rem; margin-bottom: 1.2rem; }
.quick-link {
    display: flex; flex-direction: column; align-items: center; gap: .5rem; padding: 1rem .6rem; text-align: center; border-radius: 14px;
    background: var(--surface); border: 1px solid var(--line); color: var(--ink); font-weight: 600; font-size: .88rem;
    transition: transform .15s, border-color .15s, box-shadow .15s;
}
.quick-link:hover { text-decoration: none; transform: translateY(-2px); border-color: var(--primary); box-shadow: 0 10px 22px rgba(29, 79, 150, .1); }
.quick-link .mega-icon { width: 46px; height: 46px; border-radius: 14px; }
.quick-link:hover .mega-icon { background: var(--primary); color: #fff; }

@media (max-width: 1500px) {
    .user-name { display: none; }
    .mega > summary > .nav-icon { display: none; }
}
@media (max-width: 1280px) {
    .appbar-row { gap: .6rem; padding: 0 .9rem; }
    .mega > summary { padding: .5rem .55rem; font-size: .88rem; }
    .appbar .bell-label { display: none; }
    .brand.on-dark .brand-name small { display: none; }
}
@media (max-width: 1060px) {
    .nav-burger { display: grid; order: 3; }
    .appbar-actions { margin-inline-start: auto; }
    .appbar .bell-label { display: none; }
    .appnav {
        position: fixed; top: 64px; inset-inline: 0; bottom: 0; flex-direction: column; align-items: stretch; gap: .2rem;
        overflow-y: auto; padding: .8rem; background: var(--page); color: var(--ink);
        transform: translateX(100%); visibility: hidden; transition: transform .25s ease, visibility .25s;
    }
    html[dir="ltr"] .appnav { transform: translateX(-100%); }
    .nav-toggle:checked ~ .appnav { transform: none; visibility: visible; }
    .mega > summary { color: var(--ink); background: var(--surface); border: 1px solid var(--line); padding: .8rem 1rem; font-size: .98rem; }
    .mega > summary > .nav-icon { display: inline; color: var(--primary); }
    .mega > summary .nav-chev { margin-inline-start: auto; }
    .mega > summary:hover, .mega[open] > summary, .mega.current > summary { background: var(--primary-softer); color: var(--ink); }
    .mega.current > summary::after { display: none; }
    .mega.current > summary { border-inline-start: 4px solid var(--primary); }
    .mega-panel { position: static; width: auto; box-shadow: none; border: 0; border-radius: 0; padding: .3rem 0 .6rem; background: transparent; animation: none; }
    .mega-head { display: none; }
    .mega-grid { grid-template-columns: 1fr; }
    .mega-card { background: var(--surface); }
}
@media (max-width: 560px) {
    .appbar-row { padding: 0 .75rem; gap: .5rem; }
    .brand.on-dark .brand-name { display: none; }
    .appbar .lang-menu .lang-code { display: none; }
    .crumbs { padding: .75rem 1rem 0; }
}

/* ---------- building blocks ---------- */
.card {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 1.1rem 1.25rem; margin-bottom: 1rem;
}
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head h1 { margin: 0; }
.toolbar { display: flex; gap: .6rem; flex-wrap: wrap; align-items: end; margin-bottom: 1rem; }
.toolbar .field { margin: 0; min-width: 170px; }
.spacer { flex: 1; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
    border: 1px solid var(--primary); background: var(--primary); color: #fff;
    padding: .5rem 1rem; border-radius: 8px; font: inherit; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--primary-dark); border-color: var(--primary-dark); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--primary-dark); border-color: var(--line); }
.btn.ghost:hover { background: var(--primary-softer); }
.btn.danger { background: transparent; color: var(--bad); border-color: var(--line); }
.btn.danger:hover { background: var(--bad-soft); }
.btn.ok { background: var(--ok); border-color: var(--ok); }
.btn.sm { padding: .25rem .6rem; font-size: .85rem; }
.btn.lg { padding: .8rem 1.6rem; font-size: 1.05rem; }

.field { display: flex; flex-direction: column; gap: .3rem; margin-bottom: .85rem; }
.field label { font-size: .85rem; color: var(--muted); }
.field label .req { color: var(--bad); }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=date], input[type=time],
input[type=search], input[type=url], input:not([type]), select, textarea {
    width: 100%; padding: .5rem .65rem; border: 1px solid var(--input-border); border-radius: 8px; font: inherit;
    background: var(--input-bg); color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }
textarea { min-height: 80px; resize: vertical; }
.check { display: flex; align-items: center; gap: .5rem; padding-top: 1.6rem; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }

.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0 1rem; }
.form-grid .wide { grid-column: 1 / -1; }
.form-actions { display: flex; gap: .6rem; margin-top: .5rem; }
.section-title {
    grid-column: 1 / -1; font-weight: 600; color: var(--primary-dark); border-bottom: 1px solid var(--line);
    padding-bottom: .4rem; margin: .75rem 0 .9rem;
}

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .6rem .7rem; text-align: start; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .82rem; color: var(--muted); font-weight: 600; background: var(--primary-softer); white-space: nowrap; }
tbody tr:hover { background: var(--row-hover); }
td.actions { white-space: nowrap; text-align: end; }
td.actions .btn { margin-inline-start: .25rem; }
.empty { text-align: center; color: var(--muted); padding: 2rem; }

.badge { display: inline-block; padding: .15rem .6rem; border-radius: 999px; font-size: .8rem; white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.muted { background: var(--chip-muted); color: var(--muted); }

.alert { padding: .7rem 1rem; border-radius: 8px; margin-bottom: 1rem; white-space: pre-line; }
.alert.error { background: var(--bad-soft); color: var(--bad); border: 1px solid var(--line); }
.alert.success { background: var(--ok-soft); color: var(--ok); border: 1px solid #c5e3d2; }
.alert.warn { background: var(--warn-soft); color: var(--warn); border: 1px solid #f0dca8; }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; border-top: 3px solid var(--primary); }
.stat .value { font-size: 1.9rem; font-weight: 700; line-height: 1.2; }
.stat .label { color: var(--muted); font-size: .88rem; }
.stat.ok { border-top-color: var(--ok); }
.stat.warn { border-top-color: var(--warn); }
.stat.bad { border-top-color: var(--bad); }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 1rem; }
.bar-row { display: flex; align-items: center; gap: .6rem; margin-bottom: .5rem; }
.bar-row .name { width: 150px; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .track { flex: 1; background: var(--primary-softer); border-radius: 6px; height: 14px; overflow: hidden; }
.bar-row .fill { background: var(--primary); height: 100%; border-radius: 6px; }
.bar-row .num { width: 34px; text-align: end; font-weight: 600; }

.tabs { display: flex; gap: .25rem; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 1rem; }
.tabs button {
    border: none; background: none; font: inherit; padding: .6rem .9rem; cursor: pointer; color: var(--muted);
    border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs button:hover { color: var(--primary-dark); }
.tabs button.active { color: var(--primary-dark); border-bottom-color: var(--primary); font-weight: 600; }

.pager { display: flex; align-items: center; gap: .6rem 1rem; justify-content: space-between; flex-wrap: wrap; margin-top: 1rem; }
.pager-pages { display: flex; align-items: center; gap: .3rem; flex-wrap: wrap; justify-content: center; }
.pager-pages .btn.sm { min-width: 2.2rem; }
.pager-gap { padding: 0 .2rem; color: var(--muted); }
.pager-size { display: flex; align-items: center; gap: .4rem; white-space: nowrap; margin: 0; }
.pager-size select { width: auto; padding: .25rem .5rem; }
.pager-info { white-space: nowrap; }

.profile-head { display: flex; gap: 1rem; align-items: center; }
.avatar {
    width: 72px; height: 72px; border-radius: 50%; object-fit: cover; background: var(--primary-soft);
    display: grid; place-items: center; color: var(--primary-dark); font-size: 1.5rem; font-weight: 700; flex-shrink: 0;
}

.modal-backdrop { position: fixed; inset: 0; background: rgba(20, 30, 60, .35); display: grid; place-items: center; z-index: 50; padding: 1rem; }
.modal { background: var(--surface); border-radius: 12px; padding: 1.25rem 1.4rem; width: min(760px, 100%); max-height: 90vh; overflow-y: auto; }

/* ---------- sign-in & public pages ---------- */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 1rem; background: linear-gradient(160deg, var(--primary-softer), var(--primary-soft)); }

/* ---------- sign-in page ---------- */
.login-page { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: var(--page); }
.login-hero {
    position: relative; overflow: hidden; color: #fff; display: flex; flex-direction: column; justify-content: center; padding: 3rem 3.5rem 2rem;
    background: radial-gradient(circle at 15% 15%, rgba(140, 200, 240, .35), transparent 45%), radial-gradient(circle at 85% 90%, rgba(79, 154, 216, .45), transparent 50%), linear-gradient(150deg, #1d4f96 0%, #2a3f6e 55%, #1a2440 100%);
}
.login-hero::before, .login-hero::after { content: ""; position: absolute; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .10); }
.login-hero::before { width: 520px; height: 520px; top: -180px; left: -160px; }
.login-hero::after { width: 380px; height: 380px; bottom: -140px; right: -120px; }
.login-hero-inner { position: relative; z-index: 1; max-width: 460px; margin-inline: auto; width: 100%; }
.login-hero-logo { width: 104px; height: 104px; border-radius: 26px; background: #fff; display: grid; place-items: center; box-shadow: 0 18px 40px rgba(0, 0, 0, .25); margin-bottom: 1.4rem; }
.login-hero-logo img { width: 78px; height: auto; }
.login-hero h1 { margin: 0; font-size: 2.4rem; font-weight: 800; line-height: 1.2; }
.login-hero-en { margin: .2rem 0 0; direction: ltr; text-align: right; font-weight: 700; letter-spacing: 1px; color: #8cc8f0; }
.login-hero-tag { margin: 1rem 0 0; font-size: 1.05rem; line-height: 1.8; color: rgba(255, 255, 255, .85); }
.login-pulse { width: 100%; height: 56px; margin: 1.4rem 0 1.2rem; }
.login-pulse path { fill: none; stroke: #8cc8f0; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 700; stroke-dashoffset: 700; animation: login-pulse 3.2s ease-in-out infinite; filter: drop-shadow(0 0 6px rgba(140, 200, 240, .7)); }
@keyframes login-pulse { 0% { stroke-dashoffset: 700; } 55% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: -700; } }
.login-features { list-style: none; margin: 0; padding: 0; display: grid; gap: .65rem; }
.login-features li { display: flex; align-items: center; gap: .75rem; padding: .7rem .9rem; border-radius: 12px; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .12); backdrop-filter: blur(4px); }
.login-features span { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: rgba(255, 255, 255, .14); flex: none; }
.login-hero-foot { position: relative; z-index: 1; margin-top: 2rem; text-align: center; color: rgba(255, 255, 255, .6); }
.login-panel { display: flex; flex-direction: column; padding: 1.25rem 1.5rem 2rem; }
.login-top { display: flex; justify-content: space-between; align-items: center; }
.login-home { color: var(--muted); text-decoration: none; font-weight: 600; }
.login-home:hover { color: var(--primary); }
.login-card { width: min(420px, 100%); margin: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 2.25rem 2rem 1.75rem; box-shadow: 0 24px 60px rgba(29, 79, 150, .12); }
.login-card .brand.login-card-brand { display: none; }
.login-card h2 { margin: 0 0 .3rem; font-size: 1.6rem; color: var(--ink); }
.login-sub { margin: 0 0 1.4rem; }
.login-card .field input { padding: .75rem .9rem; border-radius: 10px; }
.login-card .btn { width: 100%; padding: .8rem; font-size: 1.05rem; border-radius: 10px; margin-top: .4rem; background: linear-gradient(135deg, #2f7bd0, #1d4f96); border: 0; box-shadow: 0 10px 22px rgba(47, 123, 208, .3); }
.login-card .btn:hover { filter: brightness(1.07); }
.login-help { text-align: center; margin: 1.2rem 0 0; }
:root[data-theme="dark"] .login-card { box-shadow: 0 24px 60px rgba(0, 0, 0, .45); }
:root[data-theme="dark"] .login-hero { background: radial-gradient(circle at 15% 15%, rgba(140, 200, 240, .18), transparent 45%), radial-gradient(circle at 85% 90%, rgba(79, 154, 216, .25), transparent 50%), linear-gradient(150deg, #13366a 0%, #172645 55%, #0b1428 100%); }
@media (max-width: 900px) {
    .login-page { grid-template-columns: 1fr; }
    .login-hero { padding: 2rem 1.25rem 1.5rem; }
    .login-hero-logo { width: 72px; height: 72px; border-radius: 18px; margin-bottom: .8rem; }
    .login-hero-logo img { width: 54px; }
    .login-hero h1 { font-size: 1.7rem; }
    .login-features, .login-hero-foot { display: none; }
    .login-pulse { margin: .8rem 0 0; height: 40px; }
    .login-panel { padding: 1rem 1rem 2rem; }
    .login-card { margin-top: 1rem; padding: 1.6rem 1.25rem; }
}
.auth-card { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 2rem 1.75rem; box-shadow: 0 10px 30px rgba(29, 79, 150, .08); }
.auth-card .brand { justify-content: center; padding-bottom: 1.25rem; font-size: 1.2rem; }
.auth-card .btn { width: 100%; }

/* ---------- attendance & card ---------- */
.punch { text-align: center; padding: 1.5rem 1rem; }
.punch .clock { font-size: 2.2rem; font-weight: 700; margin-bottom: .25rem; }
.id-card { width: min(340px, 100%); margin: 0 auto; text-align: center; border-top: 6px solid var(--primary); }
.id-card svg { width: 220px; height: 220px; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: .4rem .75rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

#blazor-error-ui {
    display: none; position: fixed; bottom: 0; inset-inline: 0; z-index: 1000;
    background: var(--warn-soft); color: var(--warn); padding: .7rem 1.25rem; border-top: 1px solid #f0dca8;
}

@media (max-width: 860px) {
    .content { padding: 1rem; }
}

@media print {
    .appbar, .no-print { display: none !important; }
    .content { padding: 0; }
}

/* ---------- maps ---------- */
.map { height: 520px; border-radius: var(--radius); border: 1px solid var(--line); z-index: 0; }
.leaflet-container { font-family: inherit; }

/* ---------- notifications ---------- */
.bell { position: relative; }
.bell-count { background: var(--bad); color: #fff; border-radius: 999px; font-size: .72rem; padding: 0 .45rem; margin-inline-start: .3rem; }
.notification { display: flex; gap: 1rem; align-items: center; padding: .8rem .5rem; border-bottom: 1px solid var(--line); }
.notification.unread { background: var(--primary-softer); border-inline-start: 3px solid var(--primary); }

/* ---------- timeline, progress, org chart ---------- */
.timeline { list-style: none; padding: 0; margin: 0; border-inline-start: 2px solid var(--line); }
.timeline li { position: relative; padding: .35rem 0 .8rem; padding-inline-start: 1.2rem; }
.timeline li::before { content: ""; position: absolute; inset-inline-start: -7px; top: .65rem; width: 12px; height: 12px; border-radius: 50%; background: var(--primary); }
.timeline li.tl-discipline::before { background: var(--bad); }
.timeline li.tl-commendation::before, .timeline li.tl-performance::before { background: var(--ok); }
.timeline li.tl-leave::before, .timeline li.tl-request::before { background: var(--warn); }
.tl-date { color: var(--muted); font-size: .82rem; }
.progress { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; min-width: 120px; }
.progress > span { display: block; height: 100%; background: var(--primary); }
.org { list-style: none; margin: 0; padding-inline-start: 1.4rem; border-inline-start: 1px dashed var(--line); }
.org.root { padding-inline-start: 0; border: 0; }
.org li { margin: .35rem 0; }
.org-node { display: inline-flex; align-items: center; gap: .55rem; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: .35rem .7rem; }
.org-node img, .org-node .mini-avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: var(--primary-soft); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; color: var(--primary-dark); }
.org-node .count { font-size: .75rem; color: var(--muted); }
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .75rem; }
.person { display: flex; gap: .7rem; align-items: center; }
.person img, .person .mini-avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; background: var(--primary-soft); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; color: var(--primary-dark); flex-shrink: 0; }
.chip { display: inline-block; background: var(--primary-soft); color: var(--primary-dark); border-radius: 999px; padding: .05rem .5rem; font-size: .75rem; margin: .1rem; }

/* ---------- leave calendar ---------- */
table.calendar th, table.calendar td { padding: .25rem .2rem; text-align: center; min-width: 22px; }
table.calendar td:first-child, table.calendar th:first-child { text-align: start; min-width: 160px; }
table.calendar .weekend { background: var(--row-hover); }
table.calendar td.on-leave { background: var(--ok); }
table.calendar td.pending-leave { background: var(--warn); }

/* ---------- public website administration ---------- */
.site-admin-tabs a {
    padding: .6rem .9rem; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.site-admin-tabs a:hover { color: var(--primary-dark); text-decoration: none; }
.site-admin-tabs a.active { color: var(--primary-dark); border-bottom-color: var(--primary); font-weight: 600; }
a.stat { color: inherit; transition: box-shadow .2s, transform .2s; }
a.stat:hover { text-decoration: none; box-shadow: 0 8px 20px rgba(29, 79, 150, .1); transform: translateY(-2px); }
.thumb { width: 64px; height: 42px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); display: block; }
.with-thumb { display: flex; align-items: center; gap: .7rem; }
.order-cell { white-space: nowrap; }
.order-cell .btn { padding: .15rem .45rem; }
.row-muted td { opacity: .55; }
.badge-btn { border: none; cursor: pointer; font: inherit; font-size: .8rem; }
.image-pick { display: flex; gap: .6rem; align-items: center; }
.image-pick img, .image-pick-empty {
    width: 72px; height: 48px; flex-shrink: 0; object-fit: cover; border-radius: 6px; border: 1px solid var(--line);
}
.image-pick-empty { display: grid; place-items: center; font-size: .7rem; color: var(--muted); background: var(--primary-softer); }
.modal.wide-modal { width: min(980px, 100%); }
.modal-actions { position: sticky; bottom: -1.25rem; background: var(--surface); padding: .8rem 0; border-top: 1px solid var(--line); margin-top: 1rem; }
.item-editor { border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem .2rem; margin-bottom: .8rem; background: var(--primary-softer); }
.item-editor-head { display: flex; align-items: center; gap: .35rem; margin-bottom: .6rem; }
.chips-line { display: flex; flex-wrap: wrap; gap: .2rem; margin: .4rem 0; }
.chips { display: flex; flex-wrap: wrap; gap: .1rem 1rem; }
.steps-line { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1rem; }
.media-card { position: relative; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.media-card.in-gallery { border-color: var(--primary); }
.media-card img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; display: block; }
.media-flag { position: absolute; top: .5rem; inset-inline-start: .5rem; background: var(--primary); color: #fff; font-size: .72rem; padding: .1rem .5rem; border-radius: 999px; }
.media-body { padding: .7rem; display: flex; flex-direction: column; gap: .45rem; }
.media-actions { display: flex; gap: .3rem; align-items: center; }

/* ---------- dark mode: chosen with the moon / sun button (saved per browser), or the system setting by default ---------- */
:root[data-theme="dark"] {
    --navy: #c9d4ec;
    --accent: #8cc8f0;
    --accent-dark: #8cc8f0;
    --primary: #4d97e6;
    --primary-dark: #9ccff3;
    --primary-soft: #1d3157;
    --primary-softer: #17264a;
    --ink: #e4eaf6;
    --muted: #98a5c2;
    --line: #2a3a5e;
    --surface: #131e36;
    --page: #0b1428;
    --ok: #4fc283;
    --ok-soft: #12352a;
    --warn: #e2b04d;
    --warn-soft: #3a2f14;
    --bad: #f07a6e;
    --bad-soft: #3d1f1c;
    --input-bg: #0f1a31;
    --input-border: #2f4268;
    --row-hover: #18264a;
    --chip-muted: #22314f;
    color-scheme: dark;
}
:root[data-theme="dark"] .btn { color: #fff; }
:root[data-theme="dark"] .btn.ghost { color: var(--primary-dark); }
:root[data-theme="dark"] .btn.danger { color: var(--bad); }
:root[data-theme="dark"] .leaflet-tile-pane { filter: brightness(.75) contrast(1.1) saturate(.8); }
:root[data-theme="dark"] .modal-backdrop { background: rgba(0, 0, 0, .55); }

.theme-toggle {
    display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; cursor: pointer; font-size: 1.05rem;
    border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: 0;
}
.theme-toggle:hover { background: var(--primary-softer); }
.theme-toggle .sun, :root[data-theme="dark"] .theme-toggle .moon { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: inline; }

/* ---------- idle sign-out notice ---------- */
.idle-warning { position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center; padding: 1rem; background: rgba(11, 20, 40, .55); backdrop-filter: blur(3px); }
.idle-card {
    width: min(420px, 100%); background: var(--surface); color: var(--ink); border-radius: 16px; padding: 1.4rem 1.5rem;
    border-top: 5px solid var(--warn); box-shadow: 0 24px 60px rgba(0, 0, 0, .35); text-align: center;
}
.idle-card strong { font-size: 1.2rem; display: block; margin-bottom: .4rem; }
.idle-card p { color: var(--muted); margin: 0 0 1.1rem; }
.idle-card .idle-text { font-variant-numeric: tabular-nums; }
.idle-actions { display: flex; gap: .6rem; justify-content: center; flex-wrap: wrap; }

/* ---------- system settings: tabs across the top (full width for the form), one save bar for all tabs ---------- */
.settings-layout { display: flex; flex-direction: column; gap: .75rem; }
.settings-tabs {
    position: sticky; top: 64px; z-index: 15; display: flex; flex-wrap: wrap; gap: .25rem; padding: .35rem;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 4px 14px rgba(13, 27, 56, .05);
}
.settings-tab {
    display: flex; align-items: center; gap: .4rem; padding: .4rem .6rem .4rem .45rem; border: 0; border-radius: 9px;
    background: none; color: var(--muted); font: inherit; font-size: .88rem; font-weight: 600; white-space: nowrap; cursor: pointer;
    transition: background .15s, color .15s;
}
.settings-tab:hover { background: var(--primary-softer); color: var(--ink); }
.settings-tab.active { background: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(29, 79, 150, .25); }
.settings-tab .mega-icon { width: 26px; height: 26px; border-radius: 7px; background: var(--primary-soft); color: var(--primary); }
.settings-tab .mega-icon .nav-icon { width: 16px; height: 16px; }
.settings-tab.active .mega-icon { background: rgba(255, 255, 255, .2); color: #fff; }
.settings-tab-text { display: flex; min-width: 0; }
.settings-tab-text b { font-weight: inherit; }
.settings-tab-text small { display: none; }
.settings-panel { min-height: 420px; margin-bottom: 0; }
.settings-panel > h2 { font-size: 1.15rem; padding-bottom: .7rem; margin-bottom: 1rem; border-bottom: 1px solid var(--line); }
.settings-savebar {
    position: sticky; bottom: 0; z-index: 20; display: flex; align-items: center; gap: .6rem; justify-content: flex-end;
    margin-top: 1rem; padding: .75rem 1rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line);
    box-shadow: 0 -8px 24px rgba(13, 27, 56, .08);
}
.settings-savebar > span { margin-inline-end: auto; color: var(--muted); font-size: .9rem; }
.settings-savebar.dirty { border-color: var(--warn); }
.settings-savebar.dirty > span { color: var(--warn); font-weight: 600; }
@media (max-width: 900px) {
    /* One scrollable row on small screens instead of several wrapped rows. */
    .settings-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; }
    .settings-tab { flex-shrink: 0; }
}
.toolbar-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.btn .nav-icon { width: 17px; height: 17px; }
.audit-dates { padding: .8rem 1.1rem; }
.quick-range { display: flex; gap: .35rem; flex-wrap: wrap; align-items: center; padding-bottom: .1rem; }
