:root {
  --maroon: #500000;
  --maroon-deep: #3a0000;
  --maroon-soft: #7a2a2a;
  --wash: #f7efef;
  --ink: #1f1b1b;
  --muted: #6b6262;
  --line: #e4dcdc;
  --paper: #ffffff;
  --bg: #faf8f8;
  --ok: #2f6b3f;
  --ok-wash: #eaf3ec;
  --warn: #8a5a00;
  --warn-wash: #fbf3e2;
  --danger: #9b1c1c;
  --serif: "Iowan Old Style", "Charter", "Palatino Linotype", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --radius: 6px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 15px/1.55 var(--sans);
  color: var(--ink);
  background: var(--bg);
  display: grid;
  grid-template-columns: 15.5rem 1fr;
  min-height: 100vh;
}
a { color: var(--maroon); }
a:hover { color: var(--maroon-deep); }
:focus-visible { outline: 3px solid #d9a441; outline-offset: 2px; }

/* ---------- Sidebar ---------- */
.side {
  background: var(--maroon);
  color: #f3e6e6;
  padding: 1.5rem 0 1rem;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.brand { padding: 0 1.25rem 1.25rem; border-bottom: 1px solid rgba(255,255,255,.14); }
.brand strong { display: block; font: 600 1.15rem/1.2 var(--serif); color: #fff; }
.brand span { font-size: .8rem; color: #d7bcbc; }
.nav-group { padding: .9rem 0 .2rem; }
.nav-group h2 { font: 600 .78rem/1 var(--sans); color: #c9a5a5; margin: 0 1.25rem .4rem; letter-spacing: .01em; }
.side nav a {
  display: block; padding: .38rem 1.25rem; color: #f6ecec; text-decoration: none; border-left: 3px solid transparent;
}
.side nav a:hover { background: rgba(255,255,255,.07); }
.side nav a[aria-current="page"] { background: var(--maroon-deep); border-left-color: #e8c9c9; color: #fff; }
.who { margin-top: auto; padding: 1rem 1.25rem 0; border-top: 1px solid rgba(255,255,255,.14); font-size: .85rem; }
.who b { display: block; color: #fff; font-weight: 600; }
.who span { color: #d7bcbc; }
.who form { margin-top: .6rem; }
.who button { background: none; border: 1px solid rgba(255,255,255,.35); color: #fff; padding: .3rem .7rem; border-radius: var(--radius); cursor: pointer; font: inherit; }

/* ---------- Main ---------- */
main { padding: 2rem 2.5rem 4rem; max-width: 64rem; width: 100%; }
h1 { font: 600 1.9rem/1.2 var(--serif); margin: 0 0 .35rem; color: var(--ink); }
h2 { font: 600 1.25rem/1.3 var(--serif); margin: 2rem 0 .75rem; }
h3 { font-size: 1rem; margin: 1.25rem 0 .5rem; }
.lede { color: var(--muted); margin: 0 0 1.75rem; max-width: 44rem; }
.back { display: inline-block; font-size: .9rem; margin-bottom: .75rem; text-decoration: none; }
p, li { max-width: 46rem; }

.flash { background: var(--ok-wash); border: 1px solid #c7dfcc; color: var(--ok); padding: .7rem 1rem; border-radius: var(--radius); margin-bottom: 1.5rem; }
.notice { background: var(--warn-wash); border: 1px solid #ecd9ae; color: #5c3d00; padding: .8rem 1rem; border-radius: var(--radius); margin: 1rem 0; }
.private { background: var(--wash); border-left: 4px solid var(--maroon); padding: .8rem 1rem; margin: 1rem 0 1.5rem; border-radius: 0 var(--radius) var(--radius) 0; }

.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem 1.5rem; margin-bottom: 1.25rem; }
.panel > h2:first-child, .panel > h3:first-child { margin-top: 0; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(12.5rem, 1fr)); gap: 1.25rem; }

/* Onboarding checklist — a real sequence, so it is numbered */
.steps { list-style: none; padding: 0; margin: 0; counter-reset: s; }
.steps li { counter-increment: s; display: flex; gap: .9rem; align-items: baseline; padding: .7rem 0; border-bottom: 1px solid var(--line); }
.steps li:last-child { border-bottom: 0; }
.steps li::before { content: counter(s); font: 600 1rem var(--serif); color: var(--maroon); width: 1.2rem; }
.steps li.done::before { content: "✓"; color: var(--ok); }
.steps li.done a { color: var(--muted); }
.steps .opt { color: var(--muted); font-size: .85rem; }

.stat { display: block; text-decoration: none; color: var(--ink); }
.stat b { display: block; font: 600 2rem/1.1 var(--serif); color: var(--maroon); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th, td { text-align: left; padding: .6rem .85rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; color: var(--muted); background: #fcfafa; font-size: .85rem; }
tr:last-child td { border-bottom: 0; }
td.num { font-variant-numeric: tabular-nums; }
.empty { padding: 1.5rem; color: var(--muted); }

.pill { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 600; background: #eee8e8; color: var(--ink); white-space: nowrap; }
.pill.Submitted, .pill.InReview, .pill.Onboarding { background: var(--warn-wash); color: var(--warn); }
.pill.Approved, .pill.Completed, .pill.Active, .pill.Verified { background: var(--ok-wash); color: var(--ok); }
.pill.Rejected, .pill.Denied, .pill.Separated { background: #f8e6e6; color: var(--danger); }
.pill.ChangesRequested { background: #e9eef8; color: #2c4a7a; }

dl.facts { display: grid; grid-template-columns: 11rem 1fr; gap: .45rem 1rem; margin: 0; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .03em; }
.policy-body { white-space: pre-wrap; font: 1rem/1.7 var(--serif); max-height: 60vh; overflow-y: auto; padding: 1.5rem; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }

/* ---------- Forms ---------- */
form.stack { max-width: 40rem; }
fieldset { border: 0; padding: 0; margin: 0 0 1.5rem; }
legend { font: 600 1.15rem var(--serif); margin-bottom: .75rem; padding: 0; }
.field { margin-bottom: 1rem; }
.field label, .field .label { display: block; font-weight: 600; margin-bottom: .3rem; }
.field .hint { color: var(--muted); font-size: .87rem; margin: -.15rem 0 .35rem; }
.req { color: var(--maroon); }
input[type=text], input[type=password], input:not([type]), input[type=time], input[type=email], input[type=date], input[type=number], input[type=tel], input[type=file], select, textarea {
  width: 100%; font: inherit; padding: .5rem .65rem; border: 1px solid #cfc4c4; border-radius: var(--radius); background: #fff; color: var(--ink);
}
textarea { min-height: 7rem; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--maroon); outline: 2px solid rgba(80,0,0,.18); outline-offset: 0; }
.field.error input, .field.error select, .field.error textarea { border-color: var(--danger); }
.err { color: var(--danger); font-size: .87rem; margin-top: .3rem; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.row3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 1rem; }
.choices label { display: flex; gap: .55rem; align-items: baseline; font-weight: 400; margin-bottom: .45rem; }
.choices input { margin: 0; }

.btn, button.btn {
  display: inline-block; font: 600 .95rem var(--sans); padding: .55rem 1.1rem; border-radius: var(--radius);
  border: 1px solid var(--maroon); background: var(--maroon); color: #fff; text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--maroon-deep); color: #fff; }
.btn.secondary { background: #fff; color: var(--maroon); }
.btn.secondary:hover { background: var(--wash); color: var(--maroon-deep); }
.btn.danger { background: #fff; color: var(--danger); border-color: #d9a3a3; }
.actions { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin-top: 1.25rem; }
.toolbar { display: flex; justify-content: space-between; align-items: end; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.toolbar form { display: flex; gap: .5rem; align-items: end; }
.toolbar input, .toolbar select { width: auto; }
.inline { display: inline; }

/* ---------- Electronic signature: the one distinctive element ---------- */
.signature {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.25rem 1.5rem 1rem; margin: 1.5rem 0 0;
}
.signature .certify { display: flex; gap: .6rem; align-items: baseline; font-weight: 400; margin-bottom: 1.1rem; }
.signature .line { position: relative; padding-top: .25rem; }
.signature .line input {
  border: 0; border-bottom: 1.5px solid var(--ink); border-radius: 0; background: transparent;
  font: italic 1.55rem/1.3 var(--serif); padding: .2rem .25rem .15rem; color: var(--maroon-deep);
}
.signature .line input:focus { outline: none; border-bottom-color: var(--maroon); box-shadow: 0 2px 0 var(--maroon); }
.signature .line input::placeholder { color: #c9bcbc; font-size: 1.2rem; }
.signature .under { display: flex; justify-content: space-between; font-size: .8rem; color: var(--muted); margin-top: .35rem; }
.signed { font: italic 1.35rem var(--serif); color: var(--maroon-deep); border-bottom: 1.5px solid var(--ink); display: inline-block; padding: 0 .5rem .1rem; }

/* ---------- Standalone pages ---------- */
body.bare { display: block; background: var(--maroon); }
.bare main { max-width: 30rem; margin: 12vh auto; background: #fff; border-radius: 10px; padding: 2.25rem; }
.bare .brandline { font: 600 1rem var(--serif); color: var(--maroon); margin-bottom: 1rem; }

@media (max-width: 800px) {
  body { grid-template-columns: 1fr; }
  .side { position: static; height: auto; }
  main { padding: 1.5rem 1.1rem 3rem; }
  .row2, .row3 { grid-template-columns: 1fr; }
  dl.facts { grid-template-columns: 1fr; }
  dl.facts dd { margin-bottom: .5rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Optional, collapsed-by-default fields on the new-hire submittal */
details.optional { margin-top: .75rem; border-top: 1px dashed var(--line, #d8d2cc); padding-top: .75rem; }
details.optional > summary { cursor: pointer; font-weight: 600; color: var(--maroon, #500000); margin-bottom: .5rem; }
details.optional[open] > summary { margin-bottom: .9rem; }
.field.checkbox label { display: flex; gap: .55rem; align-items: baseline; font-weight: 400; }
.field.checkbox input { margin: 0; }
.static { margin: .35rem 0 0; padding: .55rem 0; font-weight: 600; }
fieldset > .hint { color: var(--muted); font-size: .88rem; margin: -.25rem 0 .9rem; }

/* Employment history timeline */
.timeline { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.timeline li { position: relative; display: grid; grid-template-columns: 7.5rem 1fr; gap: 1rem; padding: .55rem 0 .55rem 1.1rem; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: .95rem; width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.timeline li.t-PayChange::before { background: #3d6b3d; }
.timeline li.t-TitleChange::before { background: var(--maroon); }
.timeline li.t-Award::before { background: #b8860b; }
.timeline li.t-Hired::before { background: var(--maroon-soft); }
.timeline .when { color: var(--muted); font-variant-numeric: tabular-nums; }
.timeline .muted { color: var(--muted); font-size: .88rem; }
@media (max-width: 640px) { .timeline li { grid-template-columns: 1fr; gap: .1rem; } }
.muted { color: var(--muted); }
.avatar { width: 128px; height: 128px; object-fit: cover; border-radius: 50%; border: 3px solid var(--line); }
.intro-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.intro h2 { margin: .6rem 0 .1rem; font-size: 1.15rem; }
.avatar.placeholder { display: grid; place-items: center; background: var(--maroon); color: #fff; font: 700 2.4rem var(--serif, serif); }

/* Sign-in pages */
.auth-card { max-width: 30rem; }
.auth-card h1 { margin-top: 0; }
.code-input { font-size: 1.6rem; letter-spacing: .4em; max-width: 11rem; font-variant-numeric: tabular-nums; }
.inline-edit { display: inline-block; margin-left: .4rem; font-size: .85rem; }
.inline-edit summary { cursor: pointer; color: var(--maroon); }
.inline-edit form { margin-top: .3rem; }
.who-link { display: block; color: #e8c9c9; font-size: .85rem; margin: .3rem 0 .5rem; }

/* Read from paperwork */
.import-table td { vertical-align: top; }
.import-table input[type=text], .import-table input[type=password] { min-width: 16rem; }
.import-table .group-row td { background: var(--bg, #faf7f7); font-weight: 700; color: var(--maroon); padding-top: .9rem; }
.import-table tr.same td { opacity: .65; }
