:root {
  --bg: #f5f6f4;
  --surface: #ffffff;
  --ink: #1d2321;
  --muted: #5d6763;
  --line: #dde1de;
  --brand: #841617;        /* OU crimson */
  --brand-ink: #ffffff;
  --brand-soft: #f6e9e9;
  --accent: #1f5f8b;
  --ok: #1e6b3a;   --ok-soft: #e3f2e8;
  --warn: #8a5a00; --warn-soft: #fdf3dc;
  --bad: #a3221b;  --bad-soft: #fbe6e4;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 2px 8px rgba(0,0,0,.04);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 16px; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); line-height: 1.5; }
a { color: var(--accent); }
a:hover { text-decoration-thickness: 2px; }
h1 { font-size: 1.6rem; margin: 0 0 .5rem; line-height: 1.25; }
h2 { font-size: 1.2rem; margin: 1.25rem 0 .6rem; }
.card > h2:first-child, .card > .page-head:first-child h2 { margin-top: 0; }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; }
code { background: #eef0ee; padding: .1em .35em; border-radius: 4px; }
.skip { position: absolute; left: -999px; top: 0; background: #fff; padding: .5rem 1rem; z-index: 10; }
.skip:focus { left: .5rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid #f2b705; outline-offset: 2px; }

/* Top bar ---------------------------------------------------------------- */
.topbar { background: var(--brand); color: var(--brand-ink); }
.topbar-inner { max-width: 1280px; margin: 0 auto; padding: .6rem 1rem; display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.brand { color: #fff; font-weight: 700; text-decoration: none; font-size: 1.1rem; margin-right: auto; }
.mainnav { display: flex; align-items: center; gap: .25rem; flex-wrap: wrap; }
.mainnav a { color: #fff; text-decoration: none; padding: .4rem .65rem; border-radius: 6px; }
.mainnav a:hover, .mainnav a[aria-current="page"] { background: rgba(255,255,255,.16); }
.who { display: flex; align-items: center; gap: .25rem; margin-left: .75rem; padding-left: .75rem; border-left: 1px solid rgba(255,255,255,.3); }
.role-tag { font-size: .75rem; background: rgba(255,255,255,.18); padding: .1rem .45rem; border-radius: 99px; }
.nav-toggle { display: none; background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.5); border-radius: 6px; padding: .35rem .7rem; font: inherit; }

/* Layout ----------------------------------------------------------------- */
.container { max-width: 1280px; margin: 0 auto; padding: 1.25rem 1rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.15rem 1.25rem; margin-bottom: 1rem; box-shadow: var(--shadow); }
.narrow { max-width: 480px; margin: 2rem auto; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: .75rem; }
.page-head h1, .page-head h2 { margin: 0; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 1rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.grid-2.top-cards { gap: 1rem; }
.layout-side { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1rem; align-items: start; }
.footer { display: flex; justify-content: space-between; color: var(--muted); font-size: .85rem; padding-top: 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.25rem 0; }

/* Forms ------------------------------------------------------------------ */
label { display: block; font-weight: 600; margin: .85rem 0 .3rem; }
label.check, .radios label, label.tag, label.rate { font-weight: 400; }
label.check { display: flex; gap: .5rem; align-items: center; margin: .75rem 0; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=datetime-local], input:not([type]), select, textarea {
  width: 100%; font: inherit; color: inherit; padding: .55rem .65rem; border: 1px solid #b9c0bc; border-radius: 8px; background: #fff;
}
textarea { resize: vertical; }
input[type=radio], input[type=checkbox] { width: 1.15rem; height: 1.15rem; accent-color: var(--brand); }
.req { color: var(--bad); }
.help { color: var(--muted); font-size: .9rem; margin: .25rem 0 .75rem; }
.error-text { color: var(--bad); }
fieldset { border: 0; padding: 0; margin: 1rem 0; min-width: 0; }
legend { font-weight: 600; padding: 0; margin-bottom: .35rem; }
.radio-group .radios { display: flex; flex-wrap: wrap; gap: .5rem; }
.radio-group .radios label { display: flex; align-items: center; gap: .4rem; margin: 0; padding: .45rem .8rem; border: 1px solid var(--line); border-radius: 8px; background: #fafbfa; cursor: pointer; }
.radio-group .radios label:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.tag-list { display: flex; flex-wrap: wrap; gap: .4rem; }
label.tag { display: inline-flex; gap: .35rem; align-items: center; margin: 0; padding: .25rem .6rem; border: 1px solid var(--line); border-radius: 99px; font-size: .9rem; cursor: pointer; background: #fafbfa; }
label.tag:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.checklist label.check { margin: .35rem 0; }
.form-actions { display: flex; gap: .5rem; margin-top: 1.25rem; flex-wrap: wrap; }
.filters { display: flex; flex-wrap: wrap; align-items: end; gap: .5rem .75rem; margin: .5rem 0 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem 1rem; }
.filters label { margin: 0; font-size: .85rem; }
.filters input, .filters select { width: auto; min-width: 140px; }
.filters label.check { margin: 0; align-self: center; }
.filters.inline { border: 0; background: none; padding: 0; margin: 0; align-items: center; }
.hidden { display: none !important; }

/* Buttons ---------------------------------------------------------------- */
.btn { display: inline-block; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; padding: .55rem 1rem; border-radius: 8px; border: 1px solid #b9c0bc; background: #fff; color: var(--ink); line-height: 1.2; }
.btn:hover { background: #f0f2f0; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: #6d1213; }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-small { padding: .3rem .65rem; font-size: .85rem; }
.btn-block { width: 100%; margin-top: 1.25rem; }

/* Alerts & pills --------------------------------------------------------- */
.alert { padding: .7rem 1rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid; }
.alert ul { margin: .35rem 0 0 1.1rem; padding: 0; }
.alert-success { background: var(--ok-soft); border-color: #b6dcc3; color: var(--ok); }
.alert-warning { background: var(--warn-soft); border-color: #f0d79a; color: var(--warn); }
.alert-error { background: var(--bad-soft); border-color: #efbab5; color: var(--bad); }
.temp-pw { font-size: 1.1rem; user-select: all; }
.pill { display: inline-block; font-size: .75rem; font-weight: 600; padding: .1rem .55rem; border-radius: 99px; background: #eceeec; color: var(--muted); vertical-align: middle; }
.pill-completed, .pill-active { background: var(--ok-soft); color: var(--ok); }
.pill-due, .pill-alert { background: var(--bad); color: #fff; }
.pill-upcoming { background: #eceeec; color: var(--muted); }
.pill-withdrawn { background: var(--warn-soft); color: var(--warn); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.big { font-size: 1.8rem; font-weight: 700; margin: .2rem 0; }
.nowrap { white-space: nowrap; }
.empty { text-align: center; color: var(--muted); padding: 1.5rem !important; }

/* Tables ----------------------------------------------------------------- */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 1rem; }
.card .table-wrap { border-radius: 8px; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { padding: .55rem .7rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { background: #f3f4f2; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
tbody tr:last-child td, tbody tr:last-child th { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.c { text-align: center; }
.th-sub { display: block; text-transform: none; letter-spacing: 0; font-weight: 400; font-size: .72rem; }
.row-concern { background: #fff8f7; }
.row-error { background: var(--bad-soft); }
.total-row td { background: #f7f8f6; }
td.actions a { margin-right: .5rem; }
.att { font-size: .82rem; padding: .1rem .45rem; border-radius: 4px; background: #eef0ee; white-space: nowrap; }
.att-on_time { background: var(--ok-soft); color: var(--ok); }
.att-late, .att-left_early { background: var(--warn-soft); color: var(--warn); }
.att-absent_notice { background: #eceeec; }
.att-no_call_no_show { background: var(--bad-soft); color: var(--bad); }

/* Ratings ---------------------------------------------------------------- */
.rating-table th[scope=row] { font-weight: 400; min-width: 280px; }
.rating-table td.c { width: 84px; }
.rating-table label.rate { margin: 0; display: flex; justify-content: center; padding: .4rem; cursor: pointer; }
.rating-table input[type=radio] { width: 1.35rem; height: 1.35rem; }
.skill-id { font-weight: 700; color: var(--brand); }
.skill-area { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.score { text-align: center; font-weight: 700; }
.score-4 { background: #d7eedd; color: #14532d; }
.score-3 { background: #eaf5ec; color: var(--ok); }
.score-2 { background: var(--warn-soft); color: var(--warn); }
.score-1 { background: var(--bad-soft); color: var(--bad); }
.score-na { color: var(--muted); font-weight: 400; }
.growth-cell { font-weight: 700; }
.growth-cell.up { color: var(--ok); }
.growth-cell.down { color: var(--bad); }
.growth-cell.flat { color: var(--muted); }

/* Progress --------------------------------------------------------------- */
.progress { position: relative; height: 8px; background: #e6e9e7; border-radius: 99px; overflow: visible; min-width: 110px; }
.progress > span { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.progress-lg { height: 14px; margin: .5rem 0 .75rem; }
.progress .tick { position: absolute; top: -3px; bottom: -3px; width: 2px; background: #6b7470; }

/* Stats ------------------------------------------------------------------ */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-bottom: .75rem; }
.stats-cards .card { margin: 0; }
.stat { display: block; font-size: 1.7rem; font-weight: 700; line-height: 1.1; }
.stat-label { color: var(--muted); font-size: .85rem; }
.stat-alert { border-color: var(--bad); }
.stat-alert .stat { color: var(--bad); }
.stats-cards { margin-bottom: 1rem; }

/* Checkpoints ------------------------------------------------------------ */
.cp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .75rem; }
.cp-card { border: 1px solid var(--line); border-radius: 8px; padding: .75rem .9rem; background: #fafbfa; }
.cp-card.cp-due { border-color: var(--bad); background: #fff8f7; }
.cp-card.cp-completed { border-color: #b6dcc3; background: #f6fbf7; }
.cp-head { margin-bottom: .3rem; }
.cp-list { list-style: none; padding: 0; margin: .75rem 0 0; }
.cp-list li { padding: .25rem 0; border-bottom: 1px dashed var(--line); display: flex; justify-content: space-between; gap: .5rem; }

/* Misc ------------------------------------------------------------------- */
ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { padding: .4rem 0; border-bottom: 1px solid var(--line); }
ul.plain li:last-child { border-bottom: 0; }
.due-item { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.due-item .btn { margin-left: auto; }
dl.meta { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: 0; }
dl.meta dt { color: var(--muted); }
dl.meta dd { margin: 0; }
dl.qa dt { font-weight: 600; margin-top: .6rem; }
dl.qa dd { margin: .15rem 0 0; }
.comment-block { border-top: 1px solid var(--line); padding-top: .25rem; }
.comment-block:first-of-type { border-top: 0; }
.summary .stats { margin: .5rem 0 1rem; }
details summary { cursor: pointer; font-weight: 600; margin: .5rem 0; }
.loc-box { padding: .6rem .85rem; border-radius: 8px; background: #f0f2f0; margin-bottom: .5rem; }
.loc-ok { background: var(--ok-soft); color: var(--ok); }
.loc-warn { background: var(--warn-soft); color: var(--warn); }
.danger-zone { border-color: #efbab5; }
.concern.acked { opacity: .75; }
.concern-head { display: flex; justify-content: space-between; gap: 1rem; align-items: start; }
.concern-note { background: #fff8f7; border-left: 3px solid var(--bad); padding: .5rem .75rem; margin: .75rem 0; }
.ack-form { display: flex; gap: .5rem; align-items: end; flex-wrap: wrap; }
.ack-form label { width: 100%; margin: 0; }
.ack-form input { flex: 1; min-width: 200px; }
.alert-card { border-color: var(--bad); }
.mini h3 { margin-top: 0; font-size: .9rem; }
.print-only { display: none; }

/* Responsive ------------------------------------------------------------- */
@media (max-width: 900px) {
  .layout-side { grid-template-columns: 1fr; }
  .stats, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .nav-toggle { display: inline-block; }
  .mainnav { display: none; width: 100%; flex-direction: column; align-items: stretch; }
  .mainnav.open { display: flex; }
  .who { margin: .5rem 0 0; padding: .5rem 0 0; border-left: 0; border-top: 1px solid rgba(255,255,255,.3); flex-wrap: wrap; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .filters input, .filters select { width: 100%; }
  .filters > * { flex: 1 1 100%; }
  .rating-table .th-sub { display: none; }
  .rating-table th[scope=row] { min-width: 180px; }
  .rating-table td.c { width: auto; }
}

/* Print ------------------------------------------------------------------ */
@media print {
  body { background: #fff; font-size: 11pt; }
  .topbar, .footer, .no-print, .filters, .skip, .alert { display: none !important; }
  .print-only { display: block; }
  .container { max-width: none; padding: 0; }
  .card, .table-wrap { box-shadow: none; border-color: #ccc; break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
  .score-4, .score-3, .score-2, .score-1 { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
