/* =====================================================================
   NEC Staff Management Platform — stylesheet
   One file, no external fonts or libraries (works on an offline intranet).

   Design notes
   - Palette is taken from the Liberian flag and NEC's own marks: a deep
     commission blue for structure, flag red used sparingly for emphasis
     and danger, and cool paper whites. No cream, no gradients for decoration.
   - The one bold element is the flag-stripe rule under the top bar
     (red and white bands). Everything else stays quiet and administrative.
   - Type: Bahnschrift (Windows 10+, a DIN face — the lettering of public
     signage and official forms) for headings and figures; Segoe UI for
     reading text. Both fall back to system faces elsewhere.
   - Every class used by the Razor pages and by charts.js, tables.js,
     forms.js and the organogram partial is kept.
   ===================================================================== */

/* ---------- 1. Tokens ---------- */
:root {
    /* colour */
    --deep: #0F2341;        /* sidebar, headings */
    --navy: #1D4583;        /* primary actions, links */
    --navy-2: #2A5AA6;      /* hover on primary */
    --red: #BF0A30;         /* flag red: active marker, danger, required */
    --red-soft: #FCEBEE;
    --teal: #2E7D7A;
    --ink: #18222F;         /* body text */
    --muted: #5E6B7D;       /* secondary text (4.9:1 on white) */
    --line: #D8DFE9;
    --line-strong: #B4C0D0;
    --bg: #F2F5F9;          /* page */
    --card: #FFFFFF;
    --tint: #EDF2F8;        /* table heads, quiet fills */
    --tint-2: #F7F9FC;      /* zebra rows */
    --green: #1E6B34; --green-soft: #E6F3EA; --green-line: #A9D3B4;
    --amber: #8A5200; --amber-soft: #FFF4DE; --amber-line: #EDCB86;
    --blue-soft: #E4ECF8;
    --focus: #2A5AA6;

    /* type */
    --font-body: "Segoe UI", "Segoe UI Variable Text", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    --font-display: Bahnschrift, "DIN Alternate", "DIN 2014", "Segoe UI", "Arial Narrow", Arial, sans-serif;
    --fs-xs: 11.5px; --fs-sm: 12.5px; --fs-md: 14px; --fs-lg: 16px; --fs-xl: 19px; --fs-2xl: 24px; --fs-3xl: 30px;

    /* space, shape, depth */
    --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px;
    --r-sm: 3px;            /* inputs, buttons, badges with text */
    --r-md: 6px;            /* cards, tiles */
    --r-pill: 999px;        /* status badges, sub-navigation */
    --shadow-1: 0 1px 2px rgba(15, 35, 65, .06);
    --shadow-2: 0 6px 18px rgba(15, 35, 65, .12);
    --topbar-h: 58px;
    --sidebar-w: 240px;
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; }
body {
    font-family: var(--font-body); font-size: var(--fs-md); line-height: 1.5; color: var(--ink);
    background: var(--bg); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
img, svg { max-width: 100%; }
.viz-plot svg, .org svg { max-width: none; }
a { color: var(--navy); text-underline-offset: 2px; text-decoration-thickness: 1px; }
a:hover { color: var(--navy-2); text-decoration-thickness: 2px; }
::selection { background: #CFE0F7; color: var(--deep); }

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; color: var(--deep); line-height: 1.2; letter-spacing: -.005em; }
h1 { font-size: var(--fs-2xl); margin: 0 0 var(--s3); }
h2 { font-size: var(--fs-lg); margin: var(--s5) 0 var(--s2); color: var(--navy); }
h2:first-child { margin-top: 0; }
h3 { font-size: var(--fs-md); margin: var(--s4) 0 6px; }
p { margin: 0 0 var(--s3); max-width: 78ch; }
hr { border: 0; border-top: 1px solid var(--line); margin: var(--s4) 0; }
.muted { color: var(--muted); }
.small { font-size: var(--fs-sm); }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
code, pre { font-family: Consolas, "Cascadia Mono", "Courier New", monospace; }
code.big { font-size: 18px; padding: 2px 10px; background: #fff; border: 1px solid var(--line); border-radius: var(--r-sm); letter-spacing: .04em; }
pre { white-space: pre-wrap; word-break: break-all; max-width: 560px; background: var(--tint-2); padding: var(--s2); border: 1px solid var(--line); border-radius: var(--r-sm); font-size: 12px; }

/* keyboard focus: visible everywhere, never on mouse click */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 2px; }

/* ---------- 3. Frame: top bar, sidebar, content ---------- */
.topbar {
    display: flex; justify-content: space-between; align-items: center; gap: var(--s4);
    height: var(--topbar-h); padding: 0 var(--s5); background: #fff;
    position: sticky; top: 0; z-index: 30; box-shadow: 0 1px 0 var(--line);
}
/* the signature: a thin band of flag stripes under the bar */
.topbar::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: -6px; height: 6px; pointer-events: none;
    background: repeating-linear-gradient(to bottom, var(--red) 0 2px, #fff 2px 4px);
    border-bottom: 0;
}
.topbar::before {
    content: ""; position: absolute; left: 0; bottom: -6px; width: var(--sidebar-w); height: 6px; background: var(--deep); z-index: 1;
}
.brand { display: flex; align-items: center; gap: var(--s3); text-decoration: none; color: var(--deep); }
.brand:hover { color: var(--deep); text-decoration: none; }
.brand img { height: 36px; width: auto; }
.brand span { font-family: var(--font-display); font-size: 18px; font-weight: 600; letter-spacing: .01em; }
.topbar-right { display: flex; gap: var(--s4); align-items: center; font-size: var(--fs-sm); }
.topbar-right a, .topbar-right button.link { color: var(--muted); text-decoration: none; padding: 6px 4px; }
.topbar-right a:hover, .topbar-right button.link:hover { color: var(--navy); text-decoration: underline; }
.topbar-right .who { font-weight: 600; color: var(--ink); padding-right: var(--s4); border-right: 1px solid var(--line); }

.shell { display: flex; min-height: calc(100vh - var(--topbar-h) - 44px); }
/* keep the sidebar colour running the full height of long pages */
.shell:has(> .sidebar) { background: linear-gradient(to right, var(--deep) var(--sidebar-w), transparent var(--sidebar-w)); }
.sidebar {
    width: var(--sidebar-w); flex-shrink: 0; background: var(--deep); padding: var(--s4) 0 var(--s6);
    position: sticky; top: var(--topbar-h); align-self: flex-start;
    height: calc(100vh - var(--topbar-h)); overflow-y: auto; scrollbar-width: thin; scrollbar-color: #2B4468 transparent;
}
.sidebar a {
    display: block; color: #C9D5E6; text-decoration: none; padding: 7px var(--s5) 7px 22px; font-size: 13.5px;
    border-left: 3px solid transparent; line-height: 1.35;
}
.sidebar a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.sidebar a.active { background: rgba(255, 255, 255, .1); color: #fff; font-weight: 600; border-left-color: var(--red); }
.sidebar a:focus-visible { outline-color: #9CC0F5; outline-offset: -3px; }
.nav-title {
    color: #8EA3C1; font-family: var(--font-display); font-size: 13px; font-weight: 600;
    padding: var(--s4) var(--s5) 6px 22px; margin-top: var(--s2); border-top: 1px solid rgba(255, 255, 255, .08);
}
.content { flex: 1; min-width: 0; padding: calc(var(--s6) + 6px) var(--s8) var(--s8); max-width: 1480px; }
.footer { text-align: center; color: var(--muted); font-size: var(--fs-xs); padding: var(--s3); border-top: 1px solid var(--line); background: #fff; }

/* sign-in screen: the photo at full sharpness */
body.plain {
    min-height: 100vh; display: flex; flex-direction: column;
    background-color: var(--deep);
    background-image:
        linear-gradient(to bottom, var(--red) 0 2px, #fff 2px 4px, var(--red) 4px 6px, transparent 6px),
        linear-gradient(to bottom, rgba(15, 35, 65, .25) 0%, rgba(15, 35, 65, .05) 45%, rgba(15, 35, 65, .65) 100%),
        url("../img/nec_hq_building.jpg");
    background-size: auto, cover, cover;
    background-position: top, center, center top;
    background-repeat: no-repeat;
    background-attachment: scroll, fixed, fixed;
}
body.plain .footer { color: #E3EAF4; text-shadow: 0 1px 2px rgba(0, 0, 0, .6); background: transparent; border: 0; margin-top: auto; }
.centerwrap { display: flex; justify-content: center; padding: 10vh var(--s4) var(--s8); }
/* on the photo background, sit the sign-in card low so the building's name stays visible */
body.plain .centerwrap { flex: 1; align-items: flex-end; padding: 34vh var(--s4) 7vh; }
@media (max-height: 760px) { body.plain .centerwrap { align-items: center; padding: var(--s8) var(--s4); } }

/* ---------- 4. Page header, cards, grids, tiles ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: var(--s3); margin-bottom: var(--s4); padding-bottom: var(--s3); border-bottom: 1px solid var(--line); }
.page-head h1 { margin: 0; }
.page-head .actions, .actions { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--s5) var(--s5); margin-bottom: var(--s4); box-shadow: var(--shadow-1); }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card.narrow { max-width: 540px; }
.card.login { width: 400px; max-width: 100%; padding: var(--s8) var(--s8) var(--s6); border: 0; border-radius: var(--r-md); box-shadow: 0 18px 50px rgba(0, 0, 0, .35); }
.card.login h1 { font-size: var(--fs-xl); }
.login-logo { height: 60px; display: block; margin-bottom: var(--s3); }

.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4); }
.grid2 > .card { margin-bottom: 0; }
.grid2 + .card, .grid2 + .grid2 { margin-top: var(--s4); }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: var(--s3); margin-bottom: var(--s5); }
.tile { position: relative; background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--s3) var(--s4) var(--s3) calc(var(--s4) + 2px); box-shadow: var(--shadow-1); overflow: hidden; }
.tile::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--navy); }
.tile.accent::before { background: var(--red); }
.tile .num { font-family: var(--font-display); font-size: var(--fs-3xl); font-weight: 600; color: var(--deep); line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile .num a { color: inherit; text-decoration: none; }
.tile .num a:hover { color: var(--navy); }
.tile .lbl { color: var(--muted); font-size: var(--fs-sm); margin-top: 2px; }
.tile .sub { color: var(--muted); font-size: var(--fs-xs); margin-top: 2px; }
a.tile.link-tile { display: block; text-decoration: none; color: inherit; transition: border-color .15s, box-shadow .15s; }
a.tile.link-tile:hover { border-color: var(--navy); box-shadow: var(--shadow-2); }

/* ---------- 5. Tables ---------- */
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; background: #fff; font-variant-numeric: tabular-nums; }
.tbl th, .tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.tbl thead th, .tbl > tr:first-child > th {
    background: var(--tint); color: var(--deep); font-weight: 600; font-size: var(--fs-sm);
    border-bottom: 1px solid var(--line-strong); position: sticky; top: calc(var(--topbar-h) + 6px); z-index: 2;
}
.scroll .tbl thead th, .viz-table .tbl thead th { top: 0; }
.tbl th { background: var(--tint); color: var(--deep); font-weight: 600; font-size: var(--fs-sm); }
.tbl thead th:first-child { border-top-left-radius: var(--r-sm); }
.tbl thead th:last-child { border-top-right-radius: var(--r-sm); }
.tbl tbody tr:nth-child(even) td { background: var(--tint-2); }
.tbl tbody tr:hover td { background: #EAF1FB; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl.compact th, .tbl.compact td { padding: 6px 8px; }
.tbl td.num, .tbl th.num { text-align: right; }
.tbl tr.rowerr td, .tbl tbody tr.rowerr:nth-child(even) td { background: var(--red-soft); }
.tbl tr.rowmuted td { color: var(--muted); }
.tbl tr.group-row td, .tbl tbody tr.group-row:nth-child(even) td {
    background: #E7EDF5; color: var(--deep); font-family: var(--font-display); font-weight: 600; font-size: 13px;
    border-top: 1px solid var(--line-strong);
}
.tbl td .btn.small + .btn.small { margin-left: 4px; }
.matrix td.center { color: var(--green); font-weight: 700; }
.card > .tbl, .card > .scroll > .tbl { margin: 0; }

/* dynamic tables (wwwroot/js/tables.js) */
.dt-bar { display: flex; align-items: center; gap: var(--s3); margin: 0 0 var(--s3); flex-wrap: wrap; }
.dt-search {
    flex: 1; min-width: 220px; max-width: 420px; padding-left: 32px !important;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%235E6B7D' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='m11 11 3.5 3.5'/%3E%3C/svg%3E") no-repeat 10px center;
}
.dt-count { margin-left: auto; }
.dt-pager { display: flex; align-items: center; gap: 6px; justify-content: flex-end; flex-wrap: wrap; margin: var(--s3) 0 var(--s4); }
.dt-pager.top { margin: 0 0 var(--s2); }
.dt-pager .dt-range { margin-right: auto; font-weight: 600; color: var(--deep); font-size: var(--fs-sm); }
.dt-pager .dt-num { min-width: 30px; padding: 3px 8px; }
.dt-pager .dt-num[aria-current="page"] { background: var(--navy); border-color: var(--navy); color: #fff; }
.dt-filter { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--muted); }
.dt-filter select { min-height: 32px; }
th.dt-sort { cursor: pointer; user-select: none; white-space: nowrap; }
th.dt-sort:hover { color: var(--navy); background: #E2EAF4; }
th.dt-sort::after { content: " \2195"; color: #A6B3C4; font-size: 11px; }
th.dt-sort[aria-sort="ascending"]::after { content: " \25B2"; color: var(--navy); }
th.dt-sort[aria-sort="descending"]::after { content: " \25BC"; color: var(--navy); }
th.dt-sort:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.hidden-row { display: none; }

/* pager (server-side) */
.pager { display: flex; gap: 4px; flex-wrap: wrap; margin-top: var(--s3); }
.pager a { min-width: 32px; text-align: center; padding: 5px 9px; border: 1px solid var(--line); background: #fff; text-decoration: none; border-radius: var(--r-sm); font-variant-numeric: tabular-nums; }
.pager a:hover { border-color: var(--navy); }
.pager a.current { background: var(--navy); border-color: var(--navy); color: #fff; font-weight: 600; }

/* ---------- 6. Forms ---------- */
label { display: block; margin-bottom: var(--s3); font-weight: 600; font-size: 13px; color: var(--deep); }
label.check { display: inline-flex; align-items: center; gap: 6px; font-weight: 400; margin: 0 var(--s4) var(--s2) 0; color: var(--ink); cursor: pointer; }
input, select, textarea {
    font: inherit; font-size: var(--fs-md); color: var(--ink); padding: 8px 10px; min-height: 38px;
    border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: #fff;
    transition: border-color .12s, box-shadow .12s;
}
input:hover, select:hover, textarea:hover { border-color: #8D9DB3; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(42, 90, 166, .2); }
input[type=checkbox], input[type=radio] { min-height: 0; width: 16px; height: 16px; padding: 0; accent-color: var(--navy); margin: 0; }
input[type=checkbox]:focus, input[type=radio]:focus { box-shadow: none; }
input[type=checkbox]:focus-visible, input[type=radio]:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
input[type=file] { padding: 6px; background: var(--tint-2); border-style: dashed; cursor: pointer; }
input[type=file]::file-selector-button {
    font: inherit; font-size: var(--fs-sm); font-weight: 600; margin-right: 10px; padding: 5px 12px; cursor: pointer;
    border: 1px solid var(--navy); border-radius: var(--r-sm); background: #fff; color: var(--navy);
}
input[type=file]::file-selector-button:hover { background: var(--tint); }
select {
    appearance: none; -webkit-appearance: none; padding-right: 32px; cursor: pointer;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%231D4583' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m1 1.5 5 5 5-5'/%3E%3C/svg%3E") no-repeat right 11px center;
}
select[multiple] { background-image: none; padding-right: 10px; }
textarea { min-height: 84px; resize: vertical; line-height: 1.45; }
input::placeholder, textarea::placeholder { color: #8C98A8; }
input[readonly], textarea[readonly] { background: var(--tint); color: var(--muted); }
input:disabled, select:disabled, textarea:disabled { background: var(--tint); color: var(--muted); cursor: not-allowed; }
input[aria-invalid=true], input.input-validation-error, select.input-validation-error, textarea.input-validation-error { border-color: var(--red); background-color: #FFFAFB; }
.field-validation-error, span.text-danger { display: block; color: var(--red); font-size: var(--fs-sm); font-weight: 400; margin-top: 3px; }
label input, label select, label textarea { display: block; width: 100%; margin-top: 5px; font-weight: 400; }
label.check input { display: inline-block; width: 16px; margin: 0; }
input.short { width: 120px; }
.form { max-width: 1000px; }
.form .btn.primary[type=submit] { min-width: 140px; }
.row3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 var(--s4); }
.filters { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s3); align-items: flex-end; margin-bottom: var(--s4); }
.filters label { margin: 0; }
.filters input, .filters select { min-width: 150px; }
.filters input[type=checkbox], .filters input[type=radio] { min-width: 0; }
.filters label.check { align-self: center; margin: 0; }
.card > .filters:last-child { margin-bottom: 0; }
.inline-form { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }
form.inline { display: inline; }
fieldset { min-width: 0; }
fieldset.checks { border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--s3) var(--s4) var(--s1); margin: 0 0 var(--s4); }
fieldset.checks legend, fieldset.cred legend { font-family: var(--font-display); font-size: 13px; font-weight: 600; color: var(--deep); padding: 0 6px; }
fieldset.cred { border: 1px solid var(--line); border-left: 3px solid var(--navy); border-radius: var(--r-md); padding: var(--s2) var(--s4) var(--s3); margin: 0 0 var(--s3); background: var(--tint-2); }
ol.steps { padding-left: 1.4em; }
ol.steps li { margin-bottom: 6px; }
.req { color: var(--red); font-size: var(--fs-xs); font-weight: 600; margin-left: 6px; }
.word-count { display: block; margin-top: 3px; font-weight: 400; font-variant-numeric: tabular-nums; }
.word-count.bad { color: var(--red); }

/* ---------- 7. Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    min-height: 36px; padding: 7px 16px; border: 1px solid var(--navy); border-radius: var(--r-sm);
    background: #fff; color: var(--navy); font: inherit; font-size: 13.5px; font-weight: 600; line-height: 1.2;
    text-decoration: none; cursor: pointer; white-space: nowrap; vertical-align: middle;
    transition: background-color .12s, border-color .12s, color .12s;
}
.btn:hover { background: var(--tint); color: var(--navy); text-decoration: none; }
.btn:active { transform: translateY(1px); }
/* every button answers the mouse: it lifts slightly, gains a shadow and brightens */
.btn { transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s, transform .15s, filter .15s; }
.btn:not(:disabled):not([aria-disabled=true]):hover { transform: translateY(-1px); box-shadow: 0 4px 10px rgba(15, 35, 65, .18); filter: brightness(1.04); }
.btn:not(:disabled):not([aria-disabled=true]):active { transform: translateY(1px); box-shadow: none; }
@media (prefers-reduced-motion: reduce) { .btn, .btn:hover, .btn:active { transition: none; transform: none !important; } }
/* Reject: light red */
.btn.reject { background: #FDE2E2; border-color: #F3A6A6; color: #9B1C1C; }
.btn.reject:hover { background: #FBCACA; border-color: #E57F7F; color: #7F1414; }
details.row-edit > summary.btn { display: inline-flex; text-decoration: none; list-style: none; }
details.row-edit[open] > summary.btn { display: inline-flex; margin-bottom: var(--s2); font-weight: 600; }
.btn.primary { background: var(--navy); color: #fff; }
.btn.primary:hover { background: var(--navy-2); border-color: var(--navy-2); color: #fff; }
.btn.danger { border-color: var(--red); color: var(--red); }
.btn.danger:hover { background: var(--red); color: #fff; }
.btn.primary.danger { background: var(--red); color: #fff; }
.btn.small { min-height: 28px; padding: 3px 10px; font-size: var(--fs-sm); }
.btn.wide { width: 100%; }
.btn:disabled, .btn[aria-disabled=true] { opacity: .5; cursor: not-allowed; transform: none; }
button.link { background: none; border: none; color: var(--navy); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; padding: 0 4px; font: inherit; }
button.link:hover { color: var(--navy-2); }
button.link.small { font-size: var(--fs-sm); }
/* every link label in the work area is shown as a button (navigation, tiles, organograms and pagers keep their own look) */
:where(.content) a:where(:not(.btn, .tile, .finance-link, .tile *, .org-box *, .subnav *, .pager *, .dt-pager *, .print-brand *, .ps *)) {
    display: inline-flex; align-items: center; gap: 4px; min-height: 26px; padding: 2px 10px; margin: 1px 2px 1px 0;
    border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: #fff; color: var(--navy);
    font-size: var(--fs-sm); font-weight: 600; line-height: 1.3; text-decoration: none; vertical-align: middle;
    transition: background-color .12s, border-color .12s;
}
:where(.content) a:where(:not(.btn, .tile, .finance-link, .tile *, .org-box *, .subnav *, .pager *, .dt-pager *, .print-brand *, .ps *)):hover {
    background: var(--tint); border-color: var(--navy); color: var(--navy); text-decoration: none;
}
.content button.link { border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: #fff; text-decoration: none;
    min-height: 26px; padding: 2px 10px; font-size: var(--fs-sm); font-weight: 600; }
.content button.link:hover { background: var(--tint); border-color: var(--navy); }

/* ---------- 8. Alerts and badges ---------- */
.alert { position: relative; padding: 11px 16px 11px 18px; border-radius: var(--r-sm); margin-bottom: var(--s4); border: 1px solid; border-left-width: 4px; }
.alert.ok { background: var(--green-soft); border-color: var(--green-line); border-left-color: var(--green); color: #143F21; }
.alert.err { background: var(--red-soft); border-color: #F0B7C2; border-left-color: var(--red); color: #6B0A1D; }
.alert.warn { background: var(--amber-soft); border-color: var(--amber-line); border-left-color: #C27A00; color: #5A3600; }
.alert.info { background: var(--blue-soft); border-color: #BCCDE7; border-left-color: var(--navy); color: var(--deep); }
.alert.err:empty, .validation-summary-valid { display: none; }
.alert ul { margin: 4px 0 0; padding-left: 1.2em; }
.warnbox { border-left: 4px solid var(--red); }
.view-only-banner { font-size: var(--fs-sm); }

.badge {
    display: inline-block; padding: 2px 9px; border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 600; line-height: 1.5;
    background: var(--tint); color: var(--deep); border: 1px solid transparent; white-space: nowrap;
}
.badge.red { background: var(--red-soft); color: #9B0828; border-color: #F3C3CD; }
.badge.amber { background: var(--amber-soft); color: var(--amber); border-color: var(--amber-line); }
.badge.green { background: var(--green-soft); color: var(--green); border-color: var(--green-line); }
.badge.blue { background: var(--blue-soft); color: var(--navy); border-color: #C5D4EC; }
/* decisions on every approval page: approved green, rejected red, on hold yellow */
.badge.dec-approved { background: #DDF2E3; color: #145A2A; border-color: #8FCB9F; }
.badge.dec-rejected { background: #FBE1E6; color: #9B0828; border-color: #EBA3B1; }
.badge.dec-hold     { background: #FFF1A8; color: #5C4300; border-color: #E8C93A; }
.badge.dec-reviewed { background: var(--blue-soft); color: var(--navy); border-color: #C5D4EC; }
.badge.dec-pending  { background: var(--tint); color: var(--deep); border-color: var(--line-strong); }
tr:has(.badge.dec-hold) td:first-child { box-shadow: inset 3px 0 0 #E8C93A; }
tr:has(.badge.dec-rejected) td:first-child { box-shadow: inset 3px 0 0 #D2475F; }
tr:has(.badge.dec-approved) td:first-child { box-shadow: inset 3px 0 0 #3E9A5A; }

/* a short status line that changes with the figures (e.g. salaries on hold this month) */
.note-chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: var(--r-pill);
    font-size: var(--fs-sm); font-weight: 600; border: 1px solid; margin: 2px 0 var(--s3); }
.note-chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.note-chip.hold { background: #FFF6CC; color: #6B4E00; border-color: #EAD27A; }
.note-chip.clear { background: #E3F4E8; color: #1E6B34; border-color: #A9D3B4; }

/* ---------- 9. Staff profile ---------- */
.profile { display: flex; gap: var(--s6); align-items: flex-start; }
.profile .photo { width: 168px; flex-shrink: 0; }
.profile .photo img { width: 168px; aspect-ratio: 4 / 5; object-fit: cover; border-radius: var(--r-md); border: 1px solid var(--line); box-shadow: var(--shadow-1); display: block; }
.nophoto { width: 168px; height: 210px; display: flex; align-items: center; justify-content: center; text-align: center; background: var(--tint); color: var(--muted); border: 1px dashed var(--line-strong); border-radius: var(--r-md); font-size: var(--fs-sm); }
.upload { margin-top: var(--s2); }
.upload input[type=file] { width: 168px; font-size: 11px; padding: 3px; }
.upload input[type=file]::file-selector-button { padding: 3px 8px; font-size: 11px; margin-right: 6px; }
dl.facts { display: grid; grid-template-columns: 180px 1fr; gap: 0; margin: 0; }
dl.facts dt, dl.facts dd { padding: 6px 0; border-bottom: 1px solid #EEF1F5; }
dl.facts dt { color: var(--muted); font-size: 13px; padding-right: var(--s3); }
dl.facts dd { margin: 0; }

/* sub-navigation (tabs within a section) */
.subnav { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 var(--s4); }
.subnav a { padding: 5px 14px; border: 1px solid var(--line); border-radius: var(--r-pill); text-decoration: none; font-size: 13px; background: #fff; color: var(--ink); }
.subnav a:hover { border-color: var(--navy); color: var(--navy); }
.subnav a.active, .subnav a[aria-current] { background: var(--deep); border-color: var(--deep); color: #fff; }

/* row-level edit drawers */
details.row-edit { display: inline-block; margin-right: 6px; }
details.row-edit summary { cursor: pointer; color: var(--navy); text-decoration: underline; text-underline-offset: 2px; font-size: var(--fs-sm); display: inline; list-style: none; }
details.row-edit summary::-webkit-details-marker { display: none; }
details.row-edit[open] { display: block; background: #fff; border: 1px solid var(--line-strong); box-shadow: var(--shadow-2); padding: var(--s3); border-radius: var(--r-md); margin: var(--s2) 0; min-width: 300px; }
details.row-edit[open] summary { font-weight: 600; text-decoration: none; display: block; margin-bottom: var(--s2); }
td.nowrap { white-space: nowrap; }

/* change log before/after */
table.diff { margin-top: 6px; max-width: 560px; }
table.diff td.before { color: #8A1C1C; text-decoration: line-through; text-decoration-color: rgba(138, 28, 28, .5); }
table.diff td.after { color: #0B6B2F; font-weight: 600; }

/* ---------- 10. Charts (wwwroot/js/charts.js) ---------- */
.viz { position: relative; }
.viz-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 6px; min-height: 20px; }
.viz-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: var(--fs-sm); color: #4A5566; }
.viz-key i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.viz-tools { display: flex; gap: 10px; }
.viz-plot svg { display: block; overflow: visible; }
.viz-tick { font-size: 11px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.viz-label { font-size: 12px; fill: var(--ink); }
.viz-value { font-size: 12px; fill: #4A5566; font-variant-numeric: tabular-nums; }
.viz-mark path { transition: opacity .12s; }
.viz-mark.hover path { opacity: .78; }
.viz-hit { outline: none; }
.viz-hit.clickable { cursor: pointer; }
.viz-hit:focus-visible { stroke: var(--focus); stroke-width: 2; }
.viz-empty { padding: 26px 0; text-align: center; }
.viz-table { max-height: 320px; overflow: auto; }
.viz-tip {
    position: absolute; z-index: 20; pointer-events: none; background: #fff; border: 1px solid var(--line); border-radius: var(--r-md);
    box-shadow: var(--shadow-2); padding: 8px 10px; font-size: 12px; min-width: 140px; max-width: 260px;
}
.viz-tip-title { color: #4A5566; margin-bottom: 4px; }
.viz-tip-row { display: flex; align-items: center; gap: 6px; }
.viz-tip-row i { width: 12px; height: 2px; display: inline-block; }
.viz-tip-row b { font-size: 14px; color: var(--ink); font-variant-numeric: tabular-nums; }
.viz-tip-row.total { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 4px; }
.viz-tip-note { color: #4A5566; margin-top: 4px; }
.viz-tip-hint { color: var(--navy); margin-top: 4px; font-style: italic; }

/* reports page */
.report-root { transition: opacity .15s; }
.report-root.loading { opacity: .5; }
.insight { margin: -2px 0 var(--s2); color: #4A5566; font-size: 13px; min-height: 1em; }

/* ---------- 11. Organograms ---------- */
.org-scroll { overflow-x: auto; padding: 10px 0 20px; }
.org { display: inline-block; min-width: 100%; }
.org ul { position: relative; display: flex; justify-content: center; padding: 18px 0 0; margin: 0; }
.org li { list-style: none; position: relative; padding: 18px 5px 0; display: flex; flex-direction: column; align-items: center; }
.org > ul { padding-top: 0; }
.org > ul > li { padding-top: 0; }
.org li::before, .org li::after { content: ""; position: absolute; top: 0; width: 50%; height: 18px; border-top: 1.5px solid #9AA8B8; }
.org li::before { right: 50%; }
.org li::after { left: 50%; border-left: 1.5px solid #9AA8B8; }
.org li:only-child::before, .org li:only-child::after { display: none; }
.org li:only-child { padding-top: 18px; }
.org li:only-child > .org-box::before { content: ""; position: absolute; top: -18px; left: 50%; height: 18px; border-left: 1.5px solid #9AA8B8; }
.org li:first-child::before, .org li:last-child::after { border: 0 none; }
.org li:last-child::before { border-right: 1.5px solid #9AA8B8; border-radius: 0 4px 0 0; }
.org li:first-child::after { border-radius: 4px 0 0 0; }
.org ul ul::before { content: ""; position: absolute; top: 0; left: 50%; height: 18px; border-left: 1.5px solid #9AA8B8; }
.org > ul > li::before, .org > ul > li::after { display: none; }
.org > ul > li > .org-box::before { display: none; }
.org-box {
    position: relative; background: #fff; border: 1.5px solid var(--deep); border-top: 3px solid var(--deep); border-radius: var(--r-md);
    padding: 7px 10px; min-width: 150px; max-width: 210px; text-align: center; font-size: 12px; box-shadow: var(--shadow-1);
}
.org > ul > li > .org-box { border-top-color: var(--red); }
.org-box.vacant { border-style: dashed; border-top-style: dashed; border-color: #9AA8B8; background: #FAFBFC; }
.org-box.collapsed { background: var(--tint); }
.org-box.above { border-color: #9AA8B8; }
.org-title { font-family: var(--font-display); font-weight: 600; color: var(--deep); line-height: 1.25; }
.org-name { margin-top: 2px; }
.org-name a { color: inherit; }
.org-meta { color: var(--muted); font-size: 11px; margin-top: 2px; }
.org-note { color: var(--amber); font-size: 10.5px; margin-top: 3px; font-style: italic; }
.org ul.stack { flex-direction: column; align-items: center; padding: 10px 0 0; }
.org ul.stack::before { display: block; content: ""; position: absolute; top: 0; bottom: 20px; left: 50%; height: auto; border-left: 1.5px solid #9AA8B8; }
.org ul.stack > li { padding: 8px 0 0; }
.org ul.stack > li::before, .org ul.stack > li::after, .org ul.stack > li > .org-box::before { display: none; }
.org ul.stack > li > .org-box { z-index: 1; }
.org ul.stack > li > .org-box { width: 210px; max-width: 210px; }
/* many sub-units with their own staff (e.g. the Magisterial Offices): rows of mini-charts in one panel */
.org ul.wrap {
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px 10px; align-items: start;
    margin-top: 18px; padding: 16px 12px 12px; border: 1.5px solid #9AA8B8; border-radius: 10px; background: rgba(237, 242, 248, .45);
    width: 1080px; max-width: none;
}
.org ul.wrap::before { top: -19px !important; }
.org ul.wrap > li { padding: 0; }
.org ul.wrap > li::before, .org ul.wrap > li::after, .org ul.wrap > li > .org-box::before { display: none; }
.org ul.wrap > li > .org-box { width: 100%; min-width: 0; max-width: 200px; }
.org ul.wrap ul.stack > li > .org-box { width: 180px; min-width: 0; }

/* organogram sheets (one chart each; "all" lists every chart in print order) */
.org-sheets.all .org-sheet { background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--s4) var(--s5); margin-bottom: var(--s5); box-shadow: var(--shadow-1); }
.org-sheet-title { font-size: var(--fs-lg); color: var(--navy); margin: 0 0 var(--s2); }
.org-sheets:not(.all) .org-sheet-title { display: none; }
.org-chain { margin: 0 0 var(--s2); }

/* ---------- 11b. Organisation structure (Org/Structure) ---------- */
.struct-tools input[type=search] { min-width: 280px; }
.struct-tools label.check { align-self: center; margin-bottom: 0; }
.struct details > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.struct details > summary::-webkit-details-marker { display: none; }
.struct details > summary::before {
    content: ""; flex: 0 0 auto; width: 8px; height: 8px; margin: 0 2px 0 4px;
    border-right: 2px solid var(--navy); border-bottom: 2px solid var(--navy); transform: rotate(-45deg); transition: transform .15s;
}
.struct details[open] > summary::before { transform: rotate(45deg); }
.struct-dept { background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); margin-bottom: var(--s2); box-shadow: var(--shadow-1); }
.struct-dept > summary { padding: var(--s3) var(--s4); }
.struct-dept > summary .struct-name { font-family: var(--font-display); font-size: var(--fs-lg); font-weight: 600; color: var(--deep); }
.struct-dept[open] > summary { border-bottom: 1px solid var(--line); }
.struct-body { padding: var(--s2) var(--s4) var(--s3); }
.struct-sec { border-bottom: 1px solid #EEF1F5; }
.struct-sec:last-child { border-bottom: 0; }
.struct-sec > summary { padding: 9px 0; }
.struct-sec > summary:hover .struct-name { color: var(--navy); }
.struct-sec > summary .struct-name { font-weight: 600; }
.struct-sec[open] > summary { padding-bottom: var(--s2); }
.struct-sec > .tbl { margin: 0 0 var(--s3); }
.struct-name { flex: 1 1 240px; min-width: 0; }
.struct-meta { color: var(--muted); font-size: var(--fs-sm); min-width: 80px; }
.struct-fill { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: var(--fs-sm); min-width: 150px; font-variant-numeric: tabular-nums; }
.struct-fill .bar { width: 70px; height: 6px; border-radius: 3px; background: var(--tint); overflow: hidden; }
.struct-fill .bar i { display: block; height: 100%; background: var(--navy); border-radius: 3px; }
.struct summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--r-sm); }
/* offices inside a section (e.g. the Magisterial Offices in Field Coordination) */
.struct-offices { margin: 0 0 var(--s3) var(--s4); padding-left: var(--s3); border-left: 3px solid var(--blue-soft); }
.struct-offices > h3 { margin: var(--s2) 0 var(--s1); font-size: var(--fs-sm); color: var(--muted); font-weight: 600; }
.struct-office > summary .struct-name { font-weight: 500; }

/* live filters: results refresh in place */
.content[aria-busy="true"] > :not(form):not(.filters) { opacity: .55; transition: opacity .15s; }

/* top bar: link to the HR & Finance component (Administrator) */
.topbar-right a.finance-link {
    color: var(--navy); font-weight: 600; border: 1px solid var(--navy); border-radius: var(--r-pill); padding: 4px 14px; text-decoration: none;
}
.topbar-right a.finance-link:hover { background: var(--navy); color: #fff; text-decoration: none; }

/* ---------- 12. View-only mode ---------- */
body.view-only-page main form[method="post"], body.view-only-page main form[method="POST"] { display: none; }

/* ---------- 13. Responsive ---------- */
@media (max-width: 1200px) {
    :root { --sidebar-w: 210px; }
    .content { padding: var(--s6) var(--s5) var(--s8); }
}
@media (max-width: 1100px) {
    .grid2 { grid-template-columns: 1fr; }
    .grid2 > .card { margin-bottom: 0; }
}
@media (max-width: 900px) {
    .row3 { grid-template-columns: 1fr; }
    /* sidebar becomes a horizontal strip under the top bar */
    .shell, .shell:has(> .sidebar) { flex-direction: column; background: none; }
    .card { overflow-x: auto; }
    .topbar-right a, .topbar-right button.link { white-space: nowrap; }
    .topbar::before { display: none; }
    .sidebar {
        width: 100%; height: auto; position: sticky; top: var(--topbar-h); z-index: 20;
        display: flex; flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; padding: 6px var(--s2) 0; margin-top: 6px;
    }
    .sidebar a { flex: 0 0 auto; white-space: nowrap; border-left: 0; border-bottom: 3px solid transparent; padding: 8px 12px; }
    .sidebar a.active { border-bottom-color: var(--red); }
    .nav-title { display: none; }
    .tbl thead th, .tbl > tr:first-child > th { position: static; }
    .content { padding: var(--s5) var(--s4) var(--s6); }
}
@media (max-width: 640px) {
    :root { --topbar-h: 52px; }
    .topbar { padding: 0 var(--s3); }
    .brand span { font-size: 15px; }
    .brand img { height: 30px; }
    .topbar-right { gap: var(--s2); }
    .topbar-right .who, .topbar-right a[href*="ChangePassword"] { display: none; }
    h1 { font-size: var(--fs-xl); }
    .card { padding: var(--s4); }
    .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tile .num { font-size: var(--fs-2xl); }
    .profile { flex-direction: column; }
    dl.facts { grid-template-columns: 1fr; }
    dl.facts dt { border-bottom: 0; padding-bottom: 0; }
    .filters > *, .filters input, .filters select { width: 100%; }
    .dt-search { max-width: none; }
    .page-head { align-items: flex-start; }
    .card.login { padding: var(--s6) var(--s5); }
    body.plain { background-attachment: scroll; background-position: top, center, 40% center; }
}

/* ---------- 14. Accessibility preferences ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition-duration: 0s !important; animation-duration: 0s !important; scroll-behavior: auto !important; }
}
@media (forced-colors: active) {
    .tile::before, .topbar::after, .topbar::before { forced-color-adjust: none; }
    .btn, .badge, .alert, .org-box { border: 1px solid CanvasText; }
    .sidebar a.active { border-left-color: Highlight; }
}

/* ---------- 15. Print (reports, statistics, staff records, organograms) ---------- */
.print-only { display: none; }
.print-head { font-size: 11px; color: #555; border-bottom: 1px solid #ccc; margin-bottom: 8px; padding-bottom: 4px; }
@media print {
    .content a { border: 0 !important; padding: 0 !important; background: none !important; min-height: 0 !important; color: inherit !important; }
    @page { margin: 12mm; }
    body { background: #fff; font-size: 11.5pt; color: #000; }
    .topbar, .sidebar, .footer, .filters .btn, .page-head .actions, .viz-tools, .dt-bar, .dt-pager,
    form, .subnav, details.row-edit, button, .btn, .actions, nav, .view-only-banner { display: none !important; }
    .print-only { display: block; }
    .shell { display: block; min-height: 0; }
    .content { padding: 0; max-width: none; }
    a { color: inherit; text-decoration: none; }
    .grid2 { grid-template-columns: 1fr 1fr; }
    .card, .tile { box-shadow: none; border: 1px solid #bbb; break-inside: avoid; }
    .tbl thead th { position: static; background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .tbl tbody tr:nth-child(even) td { background: none; }
    .tbl tr { break-inside: avoid; }
    .tile::before, .badge { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .page-head { border-bottom: 1px solid #999; }
    .org-scroll { overflow: visible !important; }
    .org-box { box-shadow: none; }
    /* every organogram on its own landscape page; organogram.js scales each one to fit */
    .org-sheet { break-after: page; page-break-after: always; break-inside: avoid; }
    .org-sheet:last-child { break-after: auto; page-break-after: auto; }
    .org-sheets.all .org-sheet { border: 0; padding: 0; margin: 0; box-shadow: none; }
    .org-sheet .org-scroll { padding: 4px 0 0; }
    .org ul.wrap { grid-template-columns: repeat(7, minmax(0, 1fr)); width: 1500px; }
    .org-sheet-title { margin: 0 0 6px; font-size: 15pt; }
    .org-sheets:not(.all) .org-sheet-title { display: none; }
    /* the structure page prints the posts that are shown, opened */
    .struct details > summary .bar { display: none; }
    .struct-tools { display: none !important; }
}
@media print {
    /* every printed page is portrait by default (payslips, validation certificates, records, statistics);
       organograms set their pages to landscape (ViewData["PrintLandscape"]) */
    @page { size: A4 portrait; }
}

/* ---------- Finance printable documents (validation certificate, reconciliation) ---------- */
.print-doc { max-width: 820px; margin: 0 auto var(--s4); padding: var(--s8); font-size: 15px; line-height: 1.6; }
.print-doc h2, .print-doc h3 { margin-bottom: var(--s3); }
.print-doc p, .print-doc ol { max-width: none; }
.print-doc ol li { margin-bottom: var(--s2); }
.signatures { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--s6); margin: var(--s8) 0 var(--s4); }
@media print {
    .print-doc { border: 0 !important; padding: 0; font-size: 12pt; box-shadow: none; }
    .page-head { display: none; }
}
.card-head { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s3); }
.card-head h2 { margin: 0; }

/* ---------- Payslips (NEC monthly payslip format) ---------- */
.payslips { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: var(--s5); }
.payslip { position: relative; background: #fff; border: 1px solid #d5dce8; border-radius: 10px; max-width: 680px; color: #0f2444;
           overflow: hidden; box-shadow: 0 2px 10px rgba(0, 40, 104, .08); font-weight: 700; }
.payslip * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.ps-flag { display: flex; height: 6px; }
.ps-flag span { flex: 1; }
.ps-flag span:nth-child(1) { background: #BF0A30; }
.ps-flag span:nth-child(2) { background: #fff; }
.ps-flag span:nth-child(3) { background: #002868; }
.ps-head { display: grid; grid-template-columns: 64px 1fr auto; align-items: center; gap: 14px; padding: 16px 22px;
           background: linear-gradient(135deg, #002868 0%, #0d3d8c 100%); color: #fff; }
.ps-head img { width: 64px; height: 64px; object-fit: contain; background: #fff; border-radius: 50%; padding: 4px; }
.ps-org strong { display: block; font-size: 15px; letter-spacing: .06em; }
.ps-org span { display: block; font-size: 12px; opacity: .85; font-weight: 600; }
.ps-title { text-align: right; }
.ps-title span { display: block; font-size: 11px; letter-spacing: .18em; opacity: .85; }
.ps-title strong { display: inline-block; margin-top: 4px; padding: 3px 10px; border-radius: 20px; background: #fff; color: #002868; font-size: 13px; }
.ps-who { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; margin: 0; padding: 14px 22px; border-bottom: 1px solid #e3e8f0; }
.ps-who > div { display: grid; grid-template-columns: 124px 1fr; padding: 5px 0; border-bottom: 1px dashed #e8ecf3; }
.ps-who dt { color: #4a5d7e; font-weight: 700; }
.ps-who dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.ps-money { width: calc(100% - 44px); margin: 14px 22px 0; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.ps-money th { text-align: left; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: #4a5d7e; border-bottom: 2px solid #002868; padding: 6px 0; }
.ps-money th:last-child, .ps-money td:last-child { text-align: right; }
.ps-money td { padding: 7px 0; border-bottom: 1px solid #eef1f6; font-weight: 700; }
.ps-money tr.earn td { color: #0b6b3a; }
.ps-money tfoot td { border-top: 2px solid #d5dce8; border-bottom: 0; color: #BF0A30; }
.ps-net { margin: 16px 22px; padding: 14px 18px; border-radius: 10px; background: #f3f6fb; border: 1px solid #d5dce8; text-align: center; }
.ps-net-label { font-size: 12px; letter-spacing: .18em; text-transform: uppercase; color: #4a5d7e; }
.ps-net-total { font-size: 28px; font-weight: 800; color: #002868; font-variant-numeric: tabular-nums; margin: 2px 0 10px; }
.ps-net-split { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ps-net-split > div { background: #fff; border-radius: 8px; padding: 8px; border: 1px solid #e3e8f0; }
.ps-net-split span { display: block; font-size: 11px; color: #4a5d7e; }
.ps-net-split strong { font-size: 15px; font-variant-numeric: tabular-nums; }
.ps-stamp { margin: 10px 22px 0; padding: 6px; border: 2px solid #BF0A30; border-radius: 6px; color: #BF0A30; text-align: center; letter-spacing: .06em; }
.ps-net .ps-stamp { margin: 10px 0 0; }
.ps-foot { padding: 10px 22px 16px; text-align: center; border-top: 1px solid #e3e8f0; }
.ps-foot p { margin: 0; }
.ps-foot .ps-small { margin-top: 4px; font-size: 10.5px; color: #6b7a93; font-weight: 600; }
@media (max-width: 520px) { .ps-who { grid-template-columns: 1fr; } .ps-head { grid-template-columns: 48px 1fr; } .ps-title { grid-column: 1 / -1; text-align: left; } }
@media print {
    .payslips { display: block; }
    .payslip { break-after: page; page-break-after: always; break-inside: avoid; margin: 0 auto; max-width: 180mm; box-shadow: none; border: 1px solid #b9c3d3; font-size: 11pt; }
    .payslip:last-child { break-after: auto; page-break-after: auto; }
    .filters, .page-head .actions { display: none !important; }
}

/* ---------- read-only values taken from a file; codes ---------- */
input.readonly, input[readonly] { background: var(--paper-2, #f1f3f6); color: var(--ink-2, #33415c); cursor: default; }
.mono { font-family: Consolas, "Cascadia Mono", "Courier New", monospace; letter-spacing: .02em; }
fieldset.plain { border: 0; padding: 0; margin: 0; min-width: 0; }

/* ---------- NEC logo and name on every printed page ---------- */
.print-brand { align-items: center; gap: 14px; border-bottom: 2px solid #002868; padding-bottom: 8px; margin-bottom: 14px; }
.print-brand img { width: 64px; height: 64px; object-fit: contain; }
.print-brand strong { display: block; font-size: 16pt; letter-spacing: .04em; color: #002868; }
.print-brand span { display: block; }
.doc-brand { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 8px; }
.doc-brand img { width: 56px; height: 56px; object-fit: contain; }
@media print { .print-brand { display: flex !important; } }

/* ---------- Monthly finance report: allotment, paid, remaining ---------- */
.allot-figures { display: flex; flex-wrap: wrap; gap: var(--s6); margin: var(--s2) 0 var(--s3); }
.allot-figures > div { display: flex; flex-direction: column; }
.allot-figures .lbl { font-size: var(--fs-sm, .85rem); color: var(--muted); }
.allot-figures .num { font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--deep); }
.allot-figures .num.neg { color: var(--red, #BF0A30); }
.allot-bar { height: 10px; border-radius: 5px; background: var(--paper-2, #eef1f5); overflow: hidden; }
.allot-bar span { display: block; height: 100%; background: #002868; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
tr.rowsel td { background: var(--blue-soft, #eaf0fa); }

/* ---------- HR report: simple bars ---------- */
.hbar { display: inline-block; height: 10px; min-width: 2px; background: var(--navy); border-radius: 2px; vertical-align: middle; }

/* ===== Month at a glance (Accounts, Comptroller, Director of Budget): MFDP allotment against the staff salary */
.glance { border-top: 4px solid var(--navy); }
.glance-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s3); flex-wrap: wrap; }
.glance-head h2 { margin: 0; }
.glance-month { font-family: var(--font-display); font-size: var(--fs-sm); color: var(--muted); }
.glance-figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--s4); margin: var(--s4) 0 var(--s3); }
.glance-fig { display: flex; flex-direction: column; gap: 2px; padding: var(--s3) var(--s4); border-radius: var(--r-md); background: var(--tint-2); border: 1px solid var(--line); }
.glance-fig .lbl { font-size: var(--fs-sm); color: var(--muted); }
.glance-fig .num { font-family: var(--font-display); font-size: var(--fs-3xl); font-weight: 600; color: var(--deep); line-height: 1.15; font-variant-numeric: tabular-nums; }
.glance-fig .sub { font-size: var(--fs-xs); color: var(--muted); }
.glance-bar { height: 10px; border-radius: 5px; background: var(--line); overflow: hidden; margin-top: var(--s2); }
.glance-bar span { display: block; height: 100%; border-radius: 5px; }
.glance-fig.allot .glance-bar span { background: var(--navy); }
.glance-fig.salary .glance-bar span { background: #2E8B57; }
.glance-fig.diff.within { background: var(--green-soft); border-color: var(--green-line); }
.glance-fig.diff.within .num { color: var(--green); }
.glance-fig.diff.over { background: var(--red-soft); border-color: #F1B8C3; }
.glance-fig.diff.over .num { color: var(--red); }
.glance-warn { background: #FFF6E0; border-left: 4px solid #C98A00; padding: var(--s2) var(--s3); border-radius: 4px; font-size: var(--fs-sm); }
.glance-steps { list-style: none; display: flex; flex-wrap: wrap; gap: 0; padding: 0; margin: var(--s3) 0 0; counter-reset: none; }
.glance-steps li { flex: 1 1 120px; display: flex; flex-direction: column; align-items: center; text-align: center; position: relative; padding: 0 4px; font-size: var(--fs-xs); color: var(--muted); }
.glance-steps li::before { content: ""; position: absolute; top: 13px; left: -50%; width: 100%; height: 3px; background: var(--line); z-index: 0; }
.glance-steps li:first-child::before { display: none; }
.glance-steps li.done::before, .glance-steps li.now::before { background: var(--navy); }
.glance-steps .dot { position: relative; z-index: 1; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: #fff; border: 2px solid var(--line-strong); font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.glance-steps li.done .dot { background: var(--navy); border-color: var(--navy); color: #fff; }
.glance-steps li.now .dot { border-color: var(--navy); color: var(--navy); box-shadow: 0 0 0 4px var(--tint); }
.glance-steps li.done, .glance-steps li.now { color: var(--deep); }
.glance-steps li.now .txt { font-weight: 600; }
@media print { .glance-head .actions { display: none; } }

/* ===== Loans */
.loan-bar { height: 5px; border-radius: 3px; background: var(--line); margin-top: 3px; overflow: hidden; min-width: 60px; }
.loan-bar span { display: block; height: 100%; background: var(--green); }
.loan-sum { display: flex; flex-direction: column; gap: 4px; padding: var(--s2) var(--s3); background: var(--tint-2); border: 1px solid var(--line); border-radius: var(--r-md); }
.loan-sum strong { font-variant-numeric: tabular-nums; }

/* "Set salary" shown as a button on the salary structure */
details.row-edit.set-salary summary.btn { text-decoration: none; display: inline-flex; color: inherit; }
details.row-edit.set-salary summary.btn.primary { color: #fff; }

/* ===== Waiting for you (after sign-in) */
.work-list { display: grid; gap: var(--s3); max-width: 760px; }
.work-item { display: grid; grid-template-columns: 64px 1fr auto; gap: var(--s4); align-items: center; text-decoration: none; color: inherit; border-left: 4px solid var(--red); }
.work-item:hover { border-color: var(--navy); box-shadow: var(--shadow-2); }
.work-item strong { display: block; color: var(--deep); font-size: var(--fs-lg); }
.work-count { font-family: var(--font-display); font-size: var(--fs-3xl); font-weight: 600; color: var(--red); text-align: center; font-variant-numeric: tabular-nums; }

/* Leave balances (portal) and the acting order */
.leave-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s3); margin: var(--s2) 0 var(--s3); }
.leave-tiles div { border: 1px solid var(--line, #d8dde3); border-radius: 6px; padding: var(--s2) var(--s3); }
.leave-tiles strong { display: block; font-size: 1.6rem; line-height: 1.1; }
.leave-tiles span { font-size: .85rem; color: var(--muted, #5b6470); }
.acting-order { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
@media (max-width: 640px) { .leave-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
ul.plain { margin: 0; padding-left: 1.1em; }
ul.plain li { margin: 0 0 2px; }

/* payslips page: a small preview button above each payslip (not printed) */
.ps-tools { display: flex; justify-content: flex-end; margin: var(--s3) 0 6px; }
@media print { .ps-tools { display: none !important; } }

/* ---------- Charts (Monthly finance report, chart view) ---------- */
.seg { display: inline-flex; }
.seg .btn { border-radius: 0; margin: 0; }
.seg .btn:first-child { border-radius: 6px 0 0 6px; }
.seg .btn:last-child { border-radius: 0 6px 6px 0; margin-left: -1px; }
.charts .chart { margin: 18px 0 8px; }
.chart figcaption { font-weight: 600; color: var(--deep); margin-bottom: 6px; }
.chart-svg { display: block; width: 100%; height: auto; font-family: inherit; }
.chart-svg path, .chart-legend i { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.chart-mark:hover path { opacity: .8; }
.chart-mark:hover rect { fill: rgba(29, 69, 131, .05); }
.chart-legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: .85rem; color: var(--muted); margin-bottom: 4px; }
.chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
@media print { .seg { display: none; } .charts .chart { break-inside: avoid; } }
