/* HR Desk. One stylesheet, no build step. Tokens first, then layout, then components. */
:root {
  --ink: #18233b;         /* side menu, headings */
  --ink-2: #24324f;
  --paper: #f3f5f8;       /* page */
  --surface: #ffffff;
  --line: #dce1e8;
  --line-2: #eef1f5;
  --text: #1b2430;
  --muted: #5b6676;
  --blue: #1e4fa3;        /* the action colour: fountain-pen blue */
  --blue-d: #173d80;
  --blue-t: #e9f0fb;
  --tab: #e9a824;         /* file-tab amber: marks "you are here" */
  --good: #1a7f4b; --good-t: #e4f4ea;
  --wait: #1e4fa3; --wait-t: #e9f0fb;
  --warn: #8f5a00; --warn-t: #fdf1d7;
  --bad: #b42318;  --bad-t: #fde8e5;
  --radius: 6px;
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 var(--font); color: var(--text); background: var(--paper); }
h1, h2, h3 { color: var(--ink); line-height: 1.25; margin: 0 0 .5rem; font-weight: 650; }
h1 { font-size: 1.5rem; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; }
h3 { font-size: .95rem; }
p { margin: 0 0 .75rem; }
a { color: var(--blue); }
a:hover { color: var(--blue-d); }
code { font-family: ui-monospace, Consolas, monospace; font-size: .92em; background: var(--line-2); padding: .1em .35em; border-radius: 3px; }
small, .fine { font-size: .82rem; color: var(--muted); }
.lead { color: var(--muted); max-width: 70ch; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
:focus-visible { outline: 3px solid var(--tab); outline-offset: 2px; border-radius: 3px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--surface); padding: .5rem 1rem; z-index: 50; }
.skip:focus { left: .5rem; top: .5rem; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--ink); color: #c9d1e0; padding: 1rem 0 2rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: .6rem; color: #fff; font-weight: 650; font-size: 1.05rem; padding: .25rem 1.25rem 1rem; }
.brand.dark { color: var(--ink); padding: 0 0 1rem; }
.brand-mark { width: 22px; height: 26px; border-radius: 2px 7px 2px 2px; background: linear-gradient(135deg, transparent 0 22%, var(--tab) 22%); flex: none; }
.nav-group { font-size: .74rem; color: #8894ab; margin: 1.1rem 1.25rem .3rem; font-weight: 600; }
.side ul { list-style: none; margin: 0; padding: 0; }
.side a { display: flex; align-items: center; gap: .65rem; padding: .48rem 1.25rem; color: inherit; text-decoration: none; border-left: 3px solid transparent; }
.side a:hover { background: var(--ink-2); color: #fff; }
.side a.on { background: var(--ink-2); color: #fff; border-left-color: var(--tab); font-weight: 600; }
.side .count { margin-left: auto; background: var(--tab); color: var(--ink); border-radius: 10px; font-size: .74rem; padding: 0 .45rem; font-weight: 700; }
.ico { flex: none; }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 1rem; background: var(--surface); border-bottom: 1px solid var(--line); padding: .6rem 1.5rem; position: sticky; top: 0; z-index: 5; }
.top-title { font-weight: 600; color: var(--muted); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-title a { color: inherit; }
.who { display: flex; align-items: center; gap: .6rem; }
.who div { text-align: right; line-height: 1.2; }
.who small { display: block; }
.menu-btn { display: none; background: none; border: 1px solid var(--line); border-radius: var(--radius); padding: .35rem .45rem; color: var(--ink); cursor: pointer; }
main { padding: 1.5rem; max-width: 1240px; width: 100%; }
main:focus { outline: none; }

/* ---------- Building blocks ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1.25rem; }
.card.narrow { max-width: 520px; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > .card-head { padding: 1rem 1.25rem .75rem; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: .75rem; }
.card-head h2, .card-head h1 { margin: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-head h1 { margin: 0; }
.page-head p { margin: .25rem 0 0; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.grid { display: grid; gap: 1.25rem; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.side-r { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
.stack > * + * { margin-top: .9rem; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: .9rem 1rem; }
.row + .row, .row + .field, .field + .row { margin-top: .9rem; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; font: inherit; font-weight: 600; padding: .5rem .95rem; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none; line-height: 1.3; }
.btn:hover { border-color: #b9c2d0; color: var(--ink); }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-d); border-color: var(--blue-d); color: #fff; }
.btn.good { background: var(--good); border-color: var(--good); color: #fff; }
.btn.danger { color: var(--bad); border-color: #e9b6b0; }
.btn.danger:hover { background: var(--bad-t); }
.btn.ghost { background: transparent; }
.btn.small { padding: .25rem .6rem; font-size: .85rem; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
form.inline { display: inline; }

.field label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: .25rem; }
.req { color: var(--bad); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=month], input[type=search], input[type=tel], input[type=file], select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--surface); border: 1px solid #b9c2d0; border-radius: var(--radius); padding: .48rem .6rem; min-height: 38px; }
input[type=file] { padding: .3rem; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); outline: 3px solid var(--blue-t); outline-offset: 0; }
input[readonly], input:disabled, select:disabled { background: var(--line-2); color: var(--muted); }
.has-error input, .has-error select, .has-error textarea { border-color: var(--bad); }
.help { font-size: .82rem; color: var(--muted); margin: .25rem 0 0; }
.err { font-size: .85rem; color: var(--bad); margin: .25rem 0 0; font-weight: 600; }
.check { display: flex; gap: .55rem; align-items: flex-start; }
.check input { margin-top: .25rem; width: 16px; height: 16px; flex: none; }
.check label { font-weight: 500; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 650; color: var(--ink); padding: 0; margin-bottom: .6rem; }
.form-foot { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--line-2); }
.filters { display: flex; gap: .6rem; flex-wrap: wrap; align-items: end; margin-bottom: 1rem; }
.filters .field { min-width: 160px; flex: 1; max-width: 260px; }

.flash { border: 1px solid; border-left-width: 4px; border-radius: var(--radius); padding: .7rem 1rem; margin-bottom: 1rem; background: var(--surface); }
.flash ul { margin: .35rem 0 0 1.1rem; padding: 0; }
.flash.ok { border-color: var(--good); background: var(--good-t); }
.flash.bad { border-color: var(--bad); background: var(--bad-t); }
.flash.info { border-color: var(--blue); background: var(--blue-t); }
.flash.cred { border-color: var(--tab); background: #fff8e5; }
.flash.cred dl { display: grid; grid-template-columns: max-content 1fr; gap: .25rem 1rem; margin: .5rem 0; }
.flash.cred dd { margin: 0; }
.flash.cred code { font-size: 1.05rem; background: #fff; border: 1px solid var(--line); }
.flash p:last-child { margin: 0; }
.note { background: var(--blue-t); border-radius: var(--radius); padding: .7rem 1rem; margin-bottom: 1rem; }
.note.warn { background: var(--warn-t); }
.note.bad { background: var(--bad-t); }
.note p:last-child, .note ul:last-child { margin-bottom: 0; }
.note ul { margin: .3rem 0 0 1.1rem; padding: 0; }

.badge { display: inline-block; font-size: .78rem; font-weight: 650; padding: .12rem .55rem; border-radius: 3px; white-space: nowrap; border: 1px solid transparent; }
.badge.good { background: var(--good-t); color: var(--good); }
.badge.done { background: #e6f3f1; color: #0b6b62; }
.badge.wait { background: var(--wait-t); color: var(--wait); }
.badge.warn { background: var(--warn-t); color: var(--warn); }
.badge.bad { background: var(--bad-t); color: var(--bad); }
.badge.mute { background: var(--line-2); color: var(--muted); }
.verified { color: var(--good); font-weight: 650; display: inline-flex; align-items: center; gap: .25rem; }
.unverified { color: var(--warn); font-weight: 650; }

.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; }
table.list th { text-align: left; font-size: .8rem; color: var(--muted); font-weight: 650; padding: .55rem .9rem; border-bottom: 1px solid var(--line); background: #fafbfc; white-space: nowrap; }
table.list td { padding: .6rem .9rem; border-bottom: 1px solid var(--line-2); vertical-align: top; }
table.list tr:last-child td { border-bottom: 0; }
table.list tbody tr:hover { background: #fafbfd; }
table.list th.num { text-align: right; }
table.list td.tight, table.list th.tight { width: 1%; white-space: nowrap; }
table.list tfoot td { font-weight: 700; border-top: 2px solid var(--line); background: #fafbfc; }
table.list input[type=number], table.list input[type=text] { min-width: 90px; min-height: 32px; padding: .25rem .4rem; }
.primary-cell { min-width: 150px; }
.primary-cell a { font-weight: 650; text-decoration: none; }
.primary-cell small { display: block; }
.empty { text-align: center; color: var(--muted); padding: 2.25rem 1rem; }
.empty strong { display: block; color: var(--ink); margin-bottom: .25rem; }

dl.facts { display: grid; grid-template-columns: minmax(130px, max-content) 1fr; gap: .45rem 1.25rem; margin: 0; }
dl.facts dt { color: var(--muted); font-size: .88rem; }
dl.facts dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }

.tabs { display: flex; gap: .15rem; border-bottom: 1px solid var(--line); margin-bottom: 1.25rem; overflow-x: auto; }
.tabs a { padding: .55rem .95rem; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; white-space: nowrap; margin-bottom: -1px; }
.tabs a:hover { color: var(--ink); }
.tabs a.on { color: var(--ink); border-bottom-color: var(--tab); }

/* The document trail: where a record stands, drawn as a row of file tabs. */
.trail { display: flex; list-style: none; margin: 0 0 1.25rem; padding: 0; gap: 3px; overflow-x: auto; }
.trail li { flex: 1; min-width: 118px; background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--line); border-radius: 2px 10px 0 0; padding: .5rem .7rem .55rem; font-size: .84rem; color: var(--muted); }
.trail li b { display: block; color: inherit; font-weight: 650; }
.trail li small { font-size: .76rem; }
.trail li.done { border-top-color: var(--good); color: var(--text); }
.trail li.done b::before { content: "\2713\00a0"; color: var(--good); }
.trail li.now { border-top-color: var(--tab); background: #fffaf0; color: var(--ink); }
.trail li.stop { border-top-color: var(--bad); color: var(--bad); }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; margin-bottom: 1.25rem; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; text-decoration: none; color: inherit; display: block; }
a.kpi:hover { border-color: var(--blue); }
.kpi b { display: block; font-size: 1.6rem; color: var(--ink); line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi span { font-size: .84rem; color: var(--muted); }
.kpi.attn { border-left: 4px solid var(--tab); }

.steps { display: flex; list-style: none; padding: 0; margin: 0 0 1.25rem; gap: .35rem; flex-wrap: wrap; counter-reset: step; }
.steps a { display: flex; align-items: center; gap: .5rem; padding: .45rem .8rem; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); text-decoration: none; color: var(--muted); font-weight: 600; font-size: .9rem; }
.steps a::before { counter-increment: step; content: counter(step); width: 22px; height: 22px; border-radius: 50%; background: var(--line-2); color: var(--muted); display: grid; place-items: center; font-size: .78rem; }
.steps a.on { border-color: var(--ink); color: var(--ink); }
.steps a.on::before { background: var(--ink); color: #fff; }
.steps a.complete::before { content: "\2713"; background: var(--good); color: #fff; }

.upload { border: 1px dashed #b9c2d0; border-radius: var(--radius); padding: .75rem .9rem; background: #fafbfc; }
.upload + .upload { margin-top: .75rem; }
.upload h3 { margin-bottom: .2rem; }
.upload .files { list-style: none; padding: 0; margin: .4rem 0; }
.upload .files li { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; padding: .2rem 0; }
.upload form.pick { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-top: .35rem; }
.upload form.pick input[type=file] { max-width: 320px; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: .55rem 0 .55rem 1.1rem; border-left: 2px solid var(--line); position: relative; margin-left: .3rem; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: .95rem; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--blue); }
.timeline time { color: var(--muted); font-size: .8rem; }
.timeline .who-did { font-size: .82rem; color: var(--muted); }
.changes { margin: .25rem 0 0; font-size: .84rem; border-collapse: collapse; }
.changes td { padding: .05rem .6rem .05rem 0; vertical-align: top; }
.changes .old { color: var(--muted); text-decoration: line-through; }

.sal { width: 100%; border-collapse: collapse; }
.sal th, .sal td { padding: .4rem .7rem; border-bottom: 1px solid var(--line-2); text-align: left; }
.sal th { font-size: .8rem; color: var(--muted); }
.sal .group td { background: #fafbfc; font-weight: 650; color: var(--ink); font-size: .85rem; }
.sal .total td { font-weight: 700; border-top: 2px solid var(--line); }
.sal .net td { font-weight: 750; font-size: 1.05rem; background: var(--good-t); }

.editor-bar { display: flex; gap: .3rem; flex-wrap: wrap; padding: .4rem; border: 1px solid #b9c2d0; border-bottom: 0; border-radius: var(--radius) var(--radius) 0 0; background: #fafbfc; }
.editor { border: 1px solid #b9c2d0; border-radius: 0 0 var(--radius) var(--radius); min-height: 420px; padding: 1.25rem 1.5rem; background: #fff; overflow: auto; max-height: 70vh; }
.editor:focus { outline: 3px solid var(--blue-t); border-color: var(--blue); }
.editor h2 { font-size: 1.15rem; }
.editor table { border-collapse: collapse; }
.editor td { border: 1px solid var(--line); padding: .2rem .5rem; }
.field-list { max-height: 70vh; overflow: auto; }
.field-list h3 { margin-top: .9rem; }
.field-list button { display: block; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line-2); padding: .3rem 0; cursor: pointer; font: inherit; color: var(--text); }
.field-list button:hover code { background: var(--blue-t); }
.field-list small { display: block; }

.months { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; }
.month { border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem .8rem; background: var(--surface); }
.month b { display: block; }
.month.off { background: var(--line-2); color: var(--muted); }
.month.ready { border-color: var(--good); }

.lwd { display: flex; gap: 1.5rem; flex-wrap: wrap; align-items: baseline; padding: 1rem 1.25rem; background: #fffaf0; border: 1px solid #f0d9a4; border-radius: var(--radius); margin-bottom: 1rem; }
.lwd div b { display: block; font-size: 1.35rem; color: var(--ink); }
.lwd div span { font-size: .84rem; color: var(--muted); }
.pager { display: flex; gap: .5rem; justify-content: space-between; align-items: center; padding: .75rem 1rem; border-top: 1px solid var(--line-2); font-size: .9rem; color: var(--muted); }
details.more { border-top: 1px solid var(--line-2); padding: .75rem 0 0; margin-top: .9rem; }
details.more > summary { cursor: pointer; font-weight: 650; color: var(--blue); }
details.more[open] > summary { margin-bottom: .75rem; }

/* ---------- Sign-in ---------- */
body.auth { display: grid; place-items: center; min-height: 100vh; padding: 1rem; background: var(--ink); }
.auth-card { background: var(--surface); border-radius: 2px 22px 8px 8px; border-top: 6px solid var(--tab); padding: 2rem; width: 100%; max-width: 400px; }
.auth-card h1 { margin-bottom: .2rem; }
.auth-card .fine { margin-top: 1rem; }

/* ---------- Small screens ---------- */
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 20; transform: translateX(-100%); transition: transform .18s ease; }
  .side.open { transform: none; box-shadow: 0 0 0 100vmax rgba(24, 35, 59, .45); }
  .menu-btn { display: inline-flex; }
  .who div { display: none; }
  main { padding: 1rem; }
  .grid.two, .grid.three, .grid.side-r { grid-template-columns: minmax(0, 1fr); }
  .top { padding: .5rem 1rem; }
}
@media (prefers-reduced-motion: reduce) { .side { transition: none; } }
@media print { .side, .top, .actions, .btn { display: none !important; } .shell { display: block; } }
