:root {
  /* CareCertify brand — pulled from the CC mark */
  --navy: #2d3a4a;          /* logo badge / app bar */
  --navy-2: #35455a;        /* subtle app-bar gradient stop */
  --teal: #2a8fa3;          /* logo ring */
  --teal-bright: #8fd7e4;   /* the same teal lifted to read on the navy drawer */
  --orange: #e8693a;        /* logo "C" accent */
  --orange-soft: #fdeadf;
  --cream: #f5f0e8;

  --brand: #1c7c8f;         /* interactive teal (links, buttons, focus) */
  --brand-soft: #e4f1f3;
  --brand-ink: #ffffff;
  --bg: #f3f6f8;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #e4e8ee;
  --card: #ffffff;
  --ok: #2e7d32;
  --ok-soft: #e7f4e8;
  --warn: #b7791f;
  --warn-soft: #fdf3e1;
  --bad: #b91c1c;
  --bad-soft: #fbe9e9;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.5;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* App bar */
header.appbar {
  background: linear-gradient(180deg, var(--navy-2), var(--navy));
  color: var(--brand-ink); border-bottom: 3px solid var(--teal);
  padding: 0 20px; height: 58px; display: flex; align-items: center; gap: 14px;
}
/* iOS standalone (launched from a home-screen icon): the app declares
   apple-mobile-web-app-status-bar-style = black-translucent, so the page begins
   at y=0 UNDERNEATH the status bar and the bar hides the top of this header --
   invisible in Chrome, broken on an iPad. The inset is ADDED to the height
   because box-sizing is border-box globally, so padding alone would squash the
   58px of content instead of moving it down. Requires viewport-fit=cover on the
   viewport meta (base.html) or iOS reports every inset as 0px. The left/right
   insets matter in landscape, where the notch eats into the side. */
header.appbar {
  padding-top: env(safe-area-inset-top, 0px);
  padding-left: calc(20px + env(safe-area-inset-left, 0px));
  padding-right: calc(20px + env(safe-area-inset-right, 0px));
  height: calc(58px + env(safe-area-inset-top, 0px));
}
header.appbar .logo {
  width: 36px; height: 36px; border-radius: 8px; background: #fff; color: var(--navy);
  font-weight: 800; display: flex; align-items: center; justify-content: center; font-size: 14px;
}
/* CC system mark — transparent PNG sits right on the navy bar */
header.appbar .brandmark { height: 40px; width: 40px; object-fit: contain; display: block; }
header.appbar .logo-img { height: 34px; max-width: 150px; border-radius: 6px; background: #fff; padding: 3px 6px; object-fit: contain; }
header.appbar .brand-name { font-weight: 700; letter-spacing: .01em; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* wrapper holding nav + user info; row on desktop, dropdown panel on mobile */
header.appbar .primarynav { display: flex; align-items: center; gap: 4px; min-width: 0; margin-left: 12px; }
header.appbar .navtoggle { display: inline-flex; align-items: center; gap: 7px; background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.30); color: #fff; font: inherit; font-weight: 600; font-size: 13px;
  line-height: 1; padding: 8px 12px; border-radius: 8px; cursor: pointer; margin-left: 6px; flex: none; }
header.appbar .navtoggle:hover { background: rgba(255,255,255,.16); }
header.appbar .navtoggle .bars { font-size: 15px; }
header.appbar nav.primarynav a { white-space: nowrap; }
header.appbar nav a {
  color: var(--brand-ink); opacity: .82; padding: 8px 12px; border-radius: 7px; font-weight: 500;
  border-bottom: 2px solid transparent;
}
header.appbar nav a:hover { opacity: 1; text-decoration: none; background: rgba(255,255,255,.10); }
header.appbar nav a.active { opacity: 1; background: rgba(255,255,255,.12); border-bottom-color: var(--orange); border-radius: 7px 7px 0 0; }
header.appbar .spacer { margin-left: auto; }
header.appbar .who { font-size: 12.5px; opacity: .9; text-align: right; line-height: 1.25; }
header.appbar .who .role { opacity: .7; text-transform: capitalize; }
header.appbar .who a { color: var(--brand-ink); opacity: .8; }

/* Mobile: the drawer is the only nav; the top bar keeps just brand + menu + user. */
@media (max-width: 860px) {
  header.appbar { padding: 0 14px; gap: 10px; }
  header.appbar .primarynav { display: none; }
  header.appbar .navtoggle .lbl { display: none; }
  header.appbar .navtoggle { padding: 8px 11px; margin-left: auto; }
  /* The user block and the acting-as indicator would overflow a phone-width
     bar, so they move into the drawer footer instead of being squeezed. */
  header.appbar .who { display: none; }
}

/* ---------------------------------------------------------------------
   Slide-out menu (2026-08-03). The top bar had reached sixteen items and
   was wrapping; the full map now lives here, grouped by task. The drawer
   repeats the primary items on purpose so "open the menu" always answers
   "where is X".
   --------------------------------------------------------------------- */
.navscrim { position: fixed; inset: 0; background: rgba(16,24,32,.42); opacity: 0;
  pointer-events: none; transition: opacity .16s ease; z-index: 80; }
.navscrim.on { opacity: 1; pointer-events: auto; }
body.nav-locked { overflow: hidden; }

.navdrawer {
  position: fixed; top: 0; left: 0; bottom: 0; width: 292px; max-width: 86vw;
  background: linear-gradient(180deg, var(--navy-2), var(--navy));
  border-right: 3px solid var(--teal); color: #fff; z-index: 90;
  transform: translateX(-100%); transition: transform .18s ease;
  display: flex; flex-direction: column; box-shadow: 0 0 40px rgba(0,0,0,.35);
}
.navdrawer.open { transform: translateX(0); }
/* Same story as header.appbar: the drawer is pinned to top:0, so its own header
   sits under the iOS status bar in standalone mode. */
.navdrawer .nd-head { display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid rgba(255,255,255,.14); flex: none;
  padding-top: calc(14px + env(safe-area-inset-top, 0px)); }
.navdrawer .nd-title { font-weight: 700; font-size: 14px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.navdrawer .nd-close { background: none; border: 0; color: #fff; opacity: .75;
  font-size: 24px; line-height: 1; cursor: pointer; padding: 0 4px; }
.navdrawer .nd-close:hover { opacity: 1; }

.navdrawer .nd-body { flex: 1; overflow-y: auto; padding: 10px 10px 16px; }
.navdrawer .nd-group { margin-bottom: 14px; }
/* Section headings carry the logo teal instead of faint white, and every group
   after the first gets a hairline above it. Colour on its own reads as
   decoration; colour plus a rule reads as a boundary. Teal rather than the
   orange accent, so a heading is never mistaken for the active page marker. */
.navdrawer .nd-group + .nd-group { border-top: 1px solid rgba(255,255,255,.11);
  padding-top: 8px; }
.navdrawer .nd-group h4 { margin: 10px 8px 6px; font-size: 10.5px; font-weight: 700;
  letter-spacing: .11em; text-transform: uppercase; color: var(--teal-bright); }
.navdrawer .nd-body a { display: block; color: #fff; opacity: .88; padding: 9px 12px;
  border-radius: 8px; font-size: 14.5px; text-decoration: none; }
.navdrawer .nd-body a:hover { opacity: 1; background: rgba(255,255,255,.10); text-decoration: none; }
.navdrawer .nd-body a.on { opacity: 1; background: rgba(255,255,255,.14);
  box-shadow: inset 3px 0 0 var(--orange); font-weight: 600; }
.navdrawer .nd-body a:focus { outline: none; }
.navdrawer .nd-body a:focus-visible { outline: 2px solid var(--orange); outline-offset: -2px; }
.navdrawer .nd-close:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }

.navdrawer .nd-foot { flex: none; padding: 12px 18px 16px;
  border-top: 1px solid rgba(255,255,255,.14); font-size: 12.5px; opacity: .9; }
.navdrawer .nd-foot .acting { opacity: .8; margin-bottom: 6px; padding-bottom: 6px; border-bottom: 1px solid rgba(255,255,255,.12); }
.navdrawer .nd-foot .role { opacity: .68; text-transform: capitalize; margin-top: 2px; }
.navdrawer .nd-foot a { color: #fff; opacity: .85; }

@media print { .navdrawer, .navscrim, .navtoggle { display: none !important; } }

/* ---- Install prompt -------------------------------------------------- */
/* A class setting `display:flex` outranks the browser's own
   `[hidden] { display:none }`, so without this rule the hidden attribute does
   nothing at all: the bar showed for everyone on page load and the close
   button looked dead because it was setting a property with no effect. */
.installbar[hidden] { display: none; }
/* Fixed rather than sticky: sticky only pins within its own scroll container,
   so the bar drifted to wherever the element happened to sit in the flow. */
.installbar { position: fixed; bottom: 14px; left: 50%; transform: translateX(-50%);
  z-index: 60; display: flex; gap: 13px;
  align-items: center; max-width: 940px; width: calc(100% - 28px);
  background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--teal);
  border-radius: 12px; padding: 12px 14px; box-shadow: 0 6px 24px rgba(20,32,52,.13); }
.installbar .ib-icon { width: 38px; height: 38px; border-radius: 9px; flex: none;
  border: 1px solid var(--line); }
.installbar .ib-text { flex: 1; min-width: 0; font-size: 13px; color: var(--muted);
  line-height: 1.42; }
.installbar .ib-text strong { display: block; color: var(--ink); font-size: 14px;
  margin-bottom: 1px; }
.installbar .ib-x { background: none; border: 0; color: var(--muted); font-size: 22px;
  line-height: 1; cursor: pointer; padding: 0 4px; flex: none; width: auto; }
.installbar .ib-x:hover { color: var(--ink); }
.installbar .btn { flex: none; }
/* The iOS share glyph, drawn rather than fetched so it works offline and needs
   no icon font. */
.installbar .ib-share { display: inline-block; width: 9px; height: 11px; margin: 0 1px -1px;
  border: 1.4px solid var(--brand); border-top: 0; border-radius: 0 0 2px 2px;
  position: relative; }
.installbar .ib-share::before { content: ''; position: absolute; left: 2.4px; bottom: 3px;
  width: 1.4px; height: 8px; background: var(--brand); }
.installbar .ib-share::after { content: ''; position: absolute; left: .6px; bottom: 8.4px;
  width: 4px; height: 4px; border-left: 1.4px solid var(--brand);
  border-top: 1.4px solid var(--brand); transform: rotate(45deg); }
@media (max-width: 620px) {
  .installbar { gap: 10px; padding: 10px 12px; }
  .installbar .ib-icon { width: 32px; height: 32px; }
  .installbar .ib-text { font-size: 12.5px; }
}
@media print { .installbar { display: none !important; } }


.wrap { max-width: 1080px; margin: 22px auto; padding: 0 18px; }
.page-head { display: flex; align-items: baseline; gap: 12px; margin: 4px 0 18px; }
.page-head h1 { font-size: 22px; margin: 0; }
.page-head .sub { color: var(--muted); font-size: 13px; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 18px 20px; margin-bottom: 18px;
}
.card h2 { margin: 0 0 4px; font-size: 16px; }
.card .hint { color: var(--muted); font-size: 12.5px; margin: 0 0 14px; }

/* Stat tiles */
.tiles { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.tile {
  flex: 1; min-width: 150px; background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 16px 18px;
}
.tile .n { font-size: 28px; font-weight: 700; line-height: 1; }
.tile .l { color: var(--muted); font-size: 12.5px; margin-top: 6px; text-transform: uppercase; letter-spacing: .03em; }
.tile.bad .n { color: var(--bad); }
.tile.warn .n { color: var(--warn); }
.tile.ok .n { color: var(--ok); }

/* Tables */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: none; }
td .client { font-weight: 600; }
/* A name in a table is a link to that person's record. Underline only on
   hover, so a dense list stays readable but the target is obvious. */
td a .client { color: var(--brand); }
td a:hover .client { text-decoration: underline; }
td .statute { color: var(--muted); font-size: 12px; }
.empty { color: var(--muted); padding: 22px; text-align: center; }

/* Badges / pills */
.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 20px; white-space: nowrap; }
.badge.overdue { background: var(--bad-soft); color: var(--bad); }
.badge.due { background: var(--warn-soft); color: var(--warn); }
.badge.upcoming { background: var(--brand-soft); color: var(--brand); }
.badge.completed { background: var(--ok-soft); color: var(--ok); }
.badge.program { background: #eef1f6; color: #445; font-weight: 600; }
.badge.ended { background: #eef1f6; color: #889; font-weight: 600; }
.badge.role { background: #eef1f6; color: #445; font-weight: 600; text-transform: capitalize; }

/* Forms */
label { display: block; font-size: 12px; color: #555; margin: 12px 0 4px; font-weight: 600; }
input, select { width: 100%; padding: 9px 10px; border: 1px solid #cdd4df; border-radius: 8px; font-size: 14px; background: #fff; }
input:focus, select:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
.row { display: flex; gap: 14px; flex-wrap: wrap; }
.row > div { flex: 1; min-width: 160px; }
.btn { background: var(--brand); color: #fff; border: none; padding: 10px 18px; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; }
.btn:hover { filter: brightness(1.06); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.secondary { background: #fff; color: var(--brand); border: 1px solid var(--brand); }
.btn.small { padding: 6px 12px; font-size: 12.5px; }
.btn.rec { background: var(--bad); color: #fff; }
.linkbtn { background: none; border: none; color: var(--bad); cursor: pointer; padding: 0; font: inherit; }
.linkbtn:hover { text-decoration: underline; }
/* .linkbtn is red because its first use was Delete. Archiving is routine
   tidying, not destruction, so it should not read like a warning. */
.linkbtn.plain { color: var(--brand); }
/* Subfolders on a record, shown above its file list. */
.foldrow { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.foldrow .fold { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px;
  background: #f2f6fb; border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 12px; text-decoration: none; color: var(--ink); }
.foldrow .fold:hover { background: #e7f0ff; text-decoration: none; }

.notice { padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; }
.notice.err { background: var(--bad-soft); color: var(--bad); }
.notice.ok { background: var(--ok-soft); color: var(--ok); }
.notice.info { background: var(--brand-soft); color: var(--brand); }

/* Login */
.login-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: radial-gradient(1200px 500px at 50% -10%, rgba(42,143,163,.10), transparent 60%), var(--bg); }
.login-card { width: 100%; max-width: 384px; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 32px 30px; box-shadow: 0 18px 48px rgba(45,58,74,.14); text-align: center; }
.login-card form, .login-card .mfa { text-align: left; }
.login-card .logo { width: 46px; height: 46px; border-radius: 10px; background: var(--navy); color: #fff; font-weight: 800; display: flex; align-items: center; justify-content: center; font-size: 17px; margin: 0 auto 14px; }
.login-card .brandmark { width: 76px; height: 76px; object-fit: contain; display: block; margin: 2px auto 14px; }
.login-card h1 { font-size: 20px; margin: 0 0 2px; }
.login-card .sub { color: var(--muted); font-size: 13px; margin-bottom: 18px; }
.login-card .btn { width: 100%; margin-top: 18px; }
.login-card .foot { margin-top: 16px; font-size: 12px; color: var(--muted); text-align: center; }
.mfa { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }

/* --- checkbox/radio sizing fix -------------------------------------------
   `input, select { width:100% }` in app.css was also matching checkboxes and
   radios, stretching each one to the full width of its row. The 13px box then
   painted at the centre of that invisible full-width control, and the label --
   a sibling, not a child -- wrapped onto the next line underneath it. Every
   bare checkbox list in the app rendered a row out of step with its label.
   Most visible on /admin/auditors/new, where it reads as though the wrong
   client is ticked.
   ------------------------------------------------------------------------ */
input[type="checkbox"],
input[type="radio"] {
  width: auto;
  padding: 0;
  border-radius: 3px;
  vertical-align: middle;
  flex: none;
}

/* .formrow had no rule at all, so it fell back to display:block. Make it put
   the box and its label on one line. */
.formrow {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: 3px 0;
}

.formrow > label {
  margin: 0;
  cursor: pointer;
}
