/* RGS IT Team — base stylesheet.
   Deliberately small: fewer screens, one clear job per screen, generous
   typography. No framework, no CDN — the CSP forbids external stylesheets. */

:root {
  --ink: #1b1f23;
  --muted: #5b6570;
  --brand-tint: #e6efec;
  --paper: #ffffff;
  --wash: #f4f5f7;
  --line: #dde1e6;
  /* RGS house colours. Green is the school's primary; red is reserved for
     destructive actions and access alerts; gold marks a warning that is not
     yet an error (a leaver, an unbound account). */
  --brand: #004833;
  --accent: #004833;
  --accent-ink: #ffffff;
  --danger: #be2326;
  --gold: #cfae78;
  --gold-wash: #fbf4e7;
  --alert-wash: #fdf1f1;
  font-size: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--wash);
  color: var(--ink);
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue",
    Arial, sans-serif;
  line-height: 1.55;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.5rem;
  background: var(--brand);
  color: var(--accent-ink);
}

.topbar .brand {
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
}

.topbar nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  font-size: 0.95rem;
}

.topbar a {
  color: var(--accent-ink);
  text-decoration: none;
}

.topbar a:hover,
.topbar a:focus {
  text-decoration: underline;
}

/* Area switcher: Team | Devices. Sits after the brand; the account links
   are pushed to the right. */
.topbar nav.areas {
  gap: 0.25rem;
  margin-right: auto;
  margin-left: 1rem;
}

.topbar nav.areas a {
  padding: 0.35rem 0.85rem;
  border-radius: 4px;
  color: var(--brand-tint);
}

.topbar nav.areas a:hover,
.topbar nav.areas a:focus {
  background: rgba(255, 255, 255, 0.12);
  text-decoration: none;
}

.topbar nav.areas a[aria-current="true"] {
  background: rgba(255, 255, 255, 0.18);
  color: var(--accent-ink);
  font-weight: 600;
}

.topbar .who {
  color: var(--brand-tint);
}

main {
  max-width: 58rem;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* --- left-hand section column ------------------------------------------ */
/* Signed-in pages sit beside a section nav. Below 48rem it stacks above the
   content, which keeps a narrow Teams side panel usable. */
.layout {
  display: grid;
  grid-template-columns: 14rem minmax(0, 1fr);
  align-items: start;
  max-width: 82rem;
  margin: 0 auto;
}

.layout main {
  max-width: 66rem;
  margin: 0;
  width: 100%;
}

.sidenav {
  position: sticky;
  top: 0;
  padding: 2rem 0 2rem 1.5rem;
}

.sidenav h2 {
  margin: 0 0 0.75rem;
  padding: 0 0.75rem 0.4rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
}

.navgroup + .navgroup { margin-top: 2rem; }

.sidenav h3 {
  margin: 0 0 0.5rem;
  padding: 0 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.sidenav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidenav a {
  display: block;
  padding: 0.45rem 0.75rem;
  border-left: 3px solid transparent;
  border-radius: 0 4px 4px 0;
  color: var(--ink);
  text-decoration: none;
}

.sidenav a:hover,
.sidenav a:focus {
  background: var(--brand-tint);
}

.sidenav a[aria-current="page"] {
  border-left-color: var(--brand);
  background: var(--paper);
  color: var(--brand);
  font-weight: 600;
}

@media (max-width: 48rem) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidenav {
    position: static;
    padding: 1rem 1rem 0;
  }

  .sidenav ul {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
  }

  .sidenav a {
    border-left: 0;
    border-bottom: 3px solid transparent;
    border-radius: 4px 4px 0 0;
  }

  .sidenav a[aria-current="page"] {
    border-bottom-color: var(--brand);
  }
}

h1, h2, h3 {
  line-height: 1.25;
  color: var(--ink);
}

p {
  max-width: 60ch;
}

a {
  color: var(--accent);
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  background: var(--paper);
}

caption {
  text-align: left;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

th, td {
  text-align: left;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--line);
}

th {
  font-weight: 600;
  color: var(--muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

button, .button {
  display: inline-block;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.55rem 1.1rem;
  border-radius: 4px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
}

button:hover, .button:hover {
  filter: brightness(0.92);
}

button.secondary, .button.secondary {
  background: var(--paper);
  color: var(--accent);
}

button.danger, .button.danger {
  background: var(--paper);
  color: var(--danger);
  border-color: var(--danger);
}

.denied {
  text-align: center;
  padding-top: 3rem;
}


/* --- filters ------------------------------------------------------------ */
.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin: 1.5rem 0 0.5rem;
}

.filters input[type="search"] {
  flex: 1 1 18rem;
  font: inherit;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
}

.filters select {
  font: inherit;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
}

.filters details.multi-filter { position: relative; }
.filters details.multi-filter > summary {
  margin: 0; list-style: none; color: var(--ink); padding: 0.5rem 1.8rem 0.5rem 0.6rem;
  border: 1px solid var(--line); border-radius: 4px; background: var(--paper); white-space: nowrap;
}
.filters details.multi-filter > summary::-webkit-details-marker { display: none; }
.filters details.multi-filter > summary::after { content: "\25BE"; position: absolute; right: 0.6rem; color: var(--muted); }
.filters details.multi-filter fieldset {
  position: absolute; z-index: 20; top: calc(100% + 0.25rem); left: 0; min-width: 14rem; max-height: 22rem;
  overflow-y: auto; margin: 0; padding: 0.5rem 0.75rem; display: flex; flex-direction: column; gap: 0.3rem;
  border: 1px solid var(--line); border-radius: 4px; background: var(--paper); box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}
.filters details.multi-filter legend { font-size: 0.85rem; color: var(--muted); padding: 0; margin-bottom: 0.2rem; float: left; }
.filters details.multi-filter label { color: var(--ink); white-space: nowrap; }

.filters label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

/* --- roster ------------------------------------------------------------- */
.roster td:last-child {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.roster select {
  font: inherit;
  font-size: 0.9rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
}

.roster button {
  font-size: 0.85rem;
  padding: 0.35rem 0.7rem;
}

/* A leaver who still holds access. This row is the point of the report, so it
   is tinted rather than merely tagged. */
.roster tr.alert td {
  background: var(--alert-wash);
}

.tag {
  display: inline-block;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  background: var(--gold-wash);
  border: 1px solid var(--gold);
  color: #6b5320;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  vertical-align: middle;
}

tr.alert .tag {
  background: var(--paper);
  border-color: var(--danger);
  color: var(--danger);
}

.chooser td {
  background: var(--gold-wash);
}

.chooser p {
  margin: 0 0 0.6rem;
  font-weight: 600;
}

.chooser button {
  margin: 0 0.4rem 0.4rem 0;
  background: var(--paper);
  color: var(--accent);
}

td.empty, p.empty {
  color: var(--muted);
  font-style: italic;
}

/* --- sync line ---------------------------------------------------------- */
.syncline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  color: var(--muted);
  font-size: 0.9rem;
  max-width: none;
}

.syncline button {
  font-size: 0.85rem;
  padding: 0.35rem 0.7rem;
  background: var(--paper);
  color: var(--accent);
}

/* --- sign out ----------------------------------------------------------- */
/* Sign-out posts a form so it cannot be triggered by a GET, but it should
   still read as the plain nav link it replaced. */
.topbar .signout {
  display: inline;
  margin: 0;
}

.linklike {
  font: inherit;
  font-size: 0.95rem;
  font-weight: 400;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent-ink);
  cursor: pointer;
}

.linklike:hover,
.linklike:focus {
  text-decoration: underline;
  filter: none;
}

/* --- outbound Axiom links ----------------------------------------------- */
/* Axiom opens in a new tab and is a different system; these links are
   deliberately quiet so they do not compete with the actions beside them. */
td.axiom,
.roster td.axiom:last-child {
  display: table-cell;   /* not the flex cell .roster gives action columns */
  text-align: right;
  white-space: nowrap;
  vertical-align: middle;
}

td.axiom a, a.quiet {
  color: var(--muted);
  font-size: 0.85rem;
  text-decoration: none;
  border-bottom: 1px dotted var(--line);
}

td.axiom a:hover, a.quiet:hover,
td.axiom a:focus, a.quiet:focus {
  color: var(--accent);
  border-bottom-color: currentColor;
}

/* === schedule ============================================================ */
.sidenav ul + h3 { margin-top: 1.5rem; }
.sidenav > h3:first-child { margin-top: 0; }

.flash { list-style: none; padding: 0; margin: 0 0 1.25rem; }
.flash li { padding: 0.6rem 0.9rem; border-radius: 4px; background: var(--brand-tint);
  border-left: 3px solid var(--brand); margin-bottom: 0.4rem; }
.flash li.error { background: var(--alert-wash); border-left-color: var(--danger); }

.pagehead { display: flex; flex-wrap: wrap; align-items: flex-end;
  justify-content: space-between; gap: 0.5rem 1.5rem; margin-bottom: 0.5rem; }
.pagehead h1 { margin: 0; }
.sub { color: var(--muted); margin: 0.25rem 0 1rem; max-width: none; }
.crumb { margin: 0 0 0.25rem; font-size: 0.9rem; }
.crumb a { text-decoration: none; }

.pager { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.pager a { padding: 0.4rem 0.75rem; border: 1px solid var(--line); border-radius: 4px;
  background: var(--paper); text-decoration: none; color: var(--ink); font-size: 0.9rem; }
.pager a:hover, .pager a:focus { border-color: var(--brand); color: var(--brand); }

.badge { display: inline-block; padding: 0.05rem 0.5rem; border-radius: 999px; font-size: 0.75rem;
  font-weight: 600; background: var(--wash); border: 1px solid var(--line); color: var(--muted);
  white-space: nowrap; vertical-align: middle; }
.badge.holiday { background: #f5f3ff; border-color: #c4b5fd; color: #5b21b6; }
.badge.special { background: var(--gold-wash); border-color: var(--gold); color: #6b5320; }
.badge.closed { background: var(--wash); color: var(--ink); }
.badge.warn { background: var(--alert-wash); border-color: #f3b7b8; color: var(--danger); }

.summary { color: var(--muted); max-width: none; display: flex; flex-wrap: wrap;
  align-items: center; gap: 0.35rem; }
.summary strong { color: var(--ink); }

.chip { display: inline-flex; align-items: center; justify-content: center; min-width: 2.6rem;
  padding: 0.1rem 0.4rem; border-radius: 4px; font-size: 0.75rem; font-weight: 700;
  letter-spacing: 0.03em; color: var(--team); background: var(--paper);
  border: 1.5px solid var(--team); }

.issues { background: var(--paper); border-left: 3px solid var(--danger); border-radius: 0 4px 4px 0;
  padding: 0.75rem 1rem; margin: 1rem 0 1.5rem; }
.issues h2 { margin: 0 0 0.4rem; font-size: 1rem; }
.issues ul { margin: 0; padding-left: 1.1rem; }
.issues li { margin: 0.15rem 0; }
.issues li.error { color: var(--danger); }
.issues .when { color: var(--muted); font-size: 0.85rem; margin-left: 0.35rem; }
.nowrap { white-space: nowrap; }
.ok { color: var(--brand); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 1rem; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: 0.9rem 1rem; }
.card h2 { margin: 0 0 0.6rem; font-size: 1.05rem; display: flex; justify-content: space-between; }
.card.away { background: var(--wash); }
.people { list-style: none; margin: 0; padding: 0; }
.people li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center;
  gap: 0.5rem; padding: 0.3rem 0; }
.people .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.people .time { white-space: nowrap; }
.people .time { color: var(--muted); font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.changed { font-size: 0.7rem; color: #6b5320; background: var(--gold-wash); border-radius: 3px; padding: 0 0.3rem; }
.closedday { font-size: 1.2rem; padding: 2rem; text-align: center; background: var(--paper);
  border-radius: 6px; max-width: none; color: var(--muted); }

.gridwrap { overflow-x: auto; margin: 1rem 0; }
.weekgrid { margin: 0; table-layout: fixed; min-width: 44rem; }
.weekgrid th, .weekgrid td { padding: 0.45rem 0.5rem; vertical-align: top; }
.weekgrid thead th { text-transform: none; letter-spacing: 0; font-size: 0.9rem; color: var(--ink); }
.weekgrid thead th:first-child { width: 13rem; }
.weekgrid thead th a { color: inherit; text-decoration: none; }
.weekgrid thead th.today { color: var(--brand); box-shadow: inset 0 -3px var(--brand); }
.weekgrid .dayflags { display: flex; flex-wrap: wrap; gap: 0.2rem; margin-top: 0.2rem; }
.weekgrid tbody th { text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--ink);
  font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.weekgrid .teamrow th { background: var(--wash); color: var(--team); font-weight: 700; font-size: 0.8rem;
  text-transform: uppercase; letter-spacing: 0.05em; padding-top: 0.8rem; }
.weekgrid td.slot { position: relative; font-size: 0.9rem; }
.weekgrid td.slot a { display: block; margin: -0.45rem -0.5rem; padding: 0.45rem 0.5rem;
  color: inherit; text-decoration: none; min-height: 2.6rem; }
.weekgrid td.slot a:hover, .weekgrid td.slot a:focus { background: var(--brand-tint); outline: none; }
.weekgrid .where { display: block; font-weight: 600; }
.weekgrid .time { display: block; color: var(--muted); font-size: 0.78rem; font-variant-numeric: tabular-nums; }
.weekgrid td.today { background: #fafcfb; }
.weekgrid td.remote .where { color: #1d4ed8; }
.weekgrid td.leave { background: #f5f3ff; }
.weekgrid td.leave .where { color: #5b21b6; font-weight: 400; }
.weekgrid td.off .where { color: var(--muted); font-weight: 400; }
.weekgrid td.closed, .weekgrid th.closed { background: var(--wash); color: var(--muted); }
.weekgrid .dot { position: absolute; top: 0.45rem; right: 0.45rem; width: 0.45rem; height: 0.45rem;
  border-radius: 50%; background: var(--gold); }

.stack { display: flex; flex-direction: column; gap: 0.75rem; max-width: 32rem; margin: 1rem 0; }
.stack label, .inline-form label, .row label { display: flex; flex-direction: column; gap: 0.25rem;
  font-size: 0.9rem; color: var(--muted); }
.stack label.check, .inline-form label.check { flex-direction: row; align-items: center; color: var(--ink); }
.row { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.actions { display: flex; align-items: center; gap: 0.75rem; margin-top: 0.5rem; }
.inline-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.6rem; margin: 0.6rem 0 1rem;
  padding: 0.75rem; background: var(--paper); border: 1px solid var(--line); border-radius: 6px; }
input[type="text"], input[type="number"], input[type="date"], input[type="time"], select {
  font: inherit; padding: 0.45rem 0.6rem; border: 1px solid var(--line); border-radius: 4px;
  background: var(--paper); color: var(--ink); }
input[type="number"] { width: 6rem; }
input[type="color"] { width: 3rem; height: 2.2rem; padding: 0.1rem; border: 1px solid var(--line); }
fieldset.days { border: 0; padding: 0; margin: 0; }
fieldset.days legend { font-size: 0.9rem; color: var(--muted); margin-bottom: 0.25rem; }
fieldset.days div { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; }
fieldset.days label { flex-direction: row; align-items: center; gap: 0.3rem; color: var(--ink); }
fieldset.levy-year-groups { border: 0; padding: 0; margin: 0 0 0.5rem; display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; }
fieldset.levy-year-groups legend { font-size: 0.9rem; color: var(--muted); margin-bottom: 0.25rem; width: 100%; }
fieldset.levy-year-groups label { flex-direction: row; align-items: center; gap: 0.3rem; color: var(--ink); }
ul.errorlist { list-style: none; margin: 0; padding: 0; color: var(--danger); font-size: 0.85rem; }
button.small, .button.small { font-size: 0.85rem; padding: 0.35rem 0.75rem; text-decoration: none; }
.linkbutton { background: none; border: 0; padding: 0; color: var(--muted); font-size: 0.8rem;
  font-weight: 400; text-decoration: underline; cursor: pointer; }
.linkbutton:hover { color: var(--danger); filter: none; }
.rulecell form { display: inline; }
.rulecell { white-space: nowrap; font-variant-numeric: tabular-nums; }

.patterngrid { margin: 0.5rem 0; min-width: 40rem; table-layout: fixed; }
.patterngrid td { vertical-align: top; }
.patterngrid select { width: 100%; }
.patterngrid .times { display: flex; flex-direction: column; gap: 0.3rem; margin-top: 0.3rem; }
.patterngrid input[type="time"] { width: 100%; }

.teamhead { color: var(--team); }
.teamdot { display: inline-block; width: 0.6rem; height: 0.6rem; border-radius: 50%;
  background: var(--team); margin-right: 0.45rem; }
tr.inactive td { color: var(--muted); }
.notice { background: var(--gold-wash); border-left: 3px solid var(--gold); padding: 0.6rem 0.9rem;
  border-radius: 0 4px 4px 0; max-width: none; }
.copyfield { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.9rem; color: var(--muted); }
.copyfield input { width: 100%; font-family: Consolas, "Courier New", monospace; font-size: 0.85rem; }
details summary { cursor: pointer; color: var(--accent); margin: 1rem 0; }

/* === overview =========================================================== */
.updated { color: var(--muted); font-size: 0.85rem; margin-left: 0.4rem; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.75rem; margin: 0.5rem 0 1.5rem; }
.stat { background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: 0.7rem 1rem;
  display: flex; flex-direction: column; }
.stat .n { font-size: 2rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat .l { color: var(--muted); font-size: 0.85rem; }
.stat.alert { border-color: #f3b7b8; background: var(--alert-wash); }
.stat.alert .n { color: var(--danger); }

.overview { display: grid; grid-template-columns: minmax(0, 1fr) 18rem; gap: 1.5rem; align-items: start; }
.ov-head { margin: 0 0 0.75rem; font-size: 1.1rem; }
.card h3 { margin: 0 0 0.6rem; font-size: 1.05rem; display: flex; justify-content: space-between; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: 0.9rem 1rem;
  margin-bottom: 1rem; }
.panel h2 { margin: 0 0 0.6rem; font-size: 1.05rem; }
.panel p { margin: 0; }
.events, .coming { list-style: none; margin: 0; padding: 0; }
.events li { padding: 0.5rem 0 0.5rem 0.6rem; border-left: 3px solid var(--line); margin-bottom: 0.35rem;
  display: flex; flex-direction: column; }
.events li.now { border-left-color: var(--brand); background: var(--brand-tint); }
.events li.done { opacity: 0.55; }
.events .when, .coming .when { font-size: 0.8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.events .what { font-weight: 600; }
.events .meta, .coming .meta { font-size: 0.8rem; color: var(--muted); }
.badge.live { background: var(--brand); border-color: var(--brand); color: var(--accent-ink); }
.coming li { display: flex; gap: 0.75rem; align-items: baseline; padding: 0.35rem 0;
  border-bottom: 1px solid var(--line); }
.coming li:last-child { border-bottom: 0; }
.coming .when { min-width: 5.5rem; }
.coming .what { display: flex; flex-wrap: wrap; gap: 0.25rem; align-items: center; }
.stale { color: var(--danger); font-size: 0.8rem; margin-top: 0.5rem !important; }
.error-text { color: var(--danger); }

@media (max-width: 64rem) {
  .overview { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 36rem) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.overview .cards { grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); }

/* ?display=1 — a screen on the wall: no chrome, the whole width, bigger type. */
html.display { font-size: 20px; }
html.display main { max-width: none; padding: 1.5rem 2rem; }
html.display .overview { grid-template-columns: minmax(0, 1fr) 24rem; }

/* === device management =================================================== */
.muted { color: var(--muted); }
.mono { font-family: Consolas, "Courier New", monospace; font-size: 0.88rem; }
.devicelist { list-style: none; margin: 0; padding: 0; }
.devicelist li + li { margin-top: 0.15rem; }
.roster td.devices { display: table-cell; }
.roster td.notes { font-size: 0.85rem; color: var(--muted); max-width: 26rem; }
.levy { display: inline-block; padding: 0.1rem 0.5rem; border-radius: 999px; font-size: 0.8rem;
  background: var(--brand-tint); color: var(--brand); white-space: nowrap; }
.levy-left, .levy-inactive { background: var(--line); color: var(--muted); }
.levy-opt_out, .levy-personal { background: var(--alert-wash); color: var(--danger); }
.levybox { background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: 0.25rem 1rem; margin-bottom: 1rem; }
.flash-inline { padding: 0.6rem 0.9rem; border-radius: 4px; background: var(--alert-wash);
  border-left: 3px solid var(--danger); }
.pager span { align-self: center; color: var(--muted); font-size: 0.9rem; }
.doclist { padding-left: 1.1rem; }
.doclist li { margin: 0.3rem 0; }
.actions-list { list-style: none; padding: 0; margin: 0.5rem 0; }
.actions-list li { display: flex; gap: 0.6rem; align-items: flex-start; padding: 0.55rem 0; border-bottom: 1px solid var(--line); }
.actions-list li form { margin: 0; }
.actions-list li .linkbutton { font-size: 1.15rem; line-height: 1; color: var(--brand); }
.actions-list li p { margin: 0.25rem 0 0; font-size: 0.9rem; }
.actions-list li.done { opacity: 0.6; }
.actions-list li.done strong { text-decoration: line-through; }
.due-overdue { color: var(--danger); font-weight: 600; }
.compare { max-width: 40rem; }
.roster.plain td:last-child { display: table-cell; }
.roster.plain .inline-form { margin: 0; flex-wrap: nowrap; }
.checklist { padding-left: 1.1rem; }
.checklist li { margin: 0.5rem 0; }
.checklist li.bad strong { color: var(--danger); }
.twocol { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
@media (max-width: 48rem) { .twocol { grid-template-columns: 1fr; } }
ul.compact { padding-left: 1.1rem; font-size: 0.9rem; }
ul.compact li { margin: 0.15rem 0; }
.roster tr.subtotal td { color: var(--muted); }
.billing-lines td form { display: inline-flex; margin: 0; }
.finalise { border: 1px solid var(--line); border-left: 3px solid var(--brand); background: var(--paper);
  border-radius: 6px; padding: 0.5rem 1rem 1rem; margin: 1.5rem 0 1rem; }

/* A view-only area: hide the controls that would change something. The
   server refuses such requests anyway (ModuleAccessMiddleware); this only
   saves the person from a form that cannot work. */
body.readonly main form[method="post"],
body.readonly main details:has(form[method="post"]),
body.readonly main .button[href*="/new/"] { display: none; }
.areas-form { display: inline-flex; gap: 0.5rem; }
.areas-form label { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.85rem; color: var(--muted); }
.signin-buttons { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; }

.notelist { list-style: none; padding: 0; margin: 0.5rem 0; }
.notelist li { padding: 0.5rem 0; border-bottom: 1px solid var(--line); }
.notelist li p { margin: 0 0 0.2rem; }
.notelist li .muted { font-size: 0.85rem; }
.note-form { max-width: 40rem; }
details.inline { display: inline-block; margin: 0 0 0 0.5rem; }
.shop { max-width: 42rem; }
.shop-form ul { list-style: none; padding: 0; margin: 0; }
.shop-form ul li { margin: 0.4rem 0; }
.shop-form fieldset { border: 1px solid var(--line); border-radius: 6px; padding: 0.5rem 1rem; background: var(--paper); }
.shop-signout { margin-top: 2rem; }

/* === the families' purchase form ======================================= */
body.shop-page { background: var(--paper); }
.shop-header { display: flex; justify-content: center; padding: 2rem 1rem 0.5rem; }
.shop-header img { height: 90px; width: auto; }
main.shop { max-width: 40rem; margin: 0 auto; background: var(--paper); border: 1px solid var(--line);
  border-radius: 8px; padding: 1.5rem 2rem 2rem; margin-bottom: 3rem; }
@media (max-width: 48rem) { main.shop { border-radius: 0; border-left: 0; border-right: 0; padding: 1.25rem 1rem; } }

a.stat { display: block; text-decoration: none; color: inherit; }
a.stat:hover, a.stat:focus { border-color: var(--brand); }
.threecol { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.5rem; }
@media (max-width: 60rem) { .threecol { grid-template-columns: 1fr; } }
.stats-table td:not(:first-child), .stats-table th:not(:first-child) { text-align: right; }

/* Asset inventory */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
fieldset.inline-form { border: 1px solid var(--line); border-radius: 6px; padding: 0.5rem 1rem; }
fieldset.inline-form legend { font-size: 0.9rem; color: var(--muted); padding: 0 0.25rem; }
.roster.details th { width: 11rem; text-align: left; color: var(--muted); font-weight: 400; }
.cards form.card { margin: 0; }


/* === notifications: toasts and the confirmation modal (docs/ui-guidelines.md) */
.toasts { position: fixed; top: 4.25rem; right: 1rem; z-index: 1000; display: flex; flex-direction: column;
  gap: 0.5rem; width: min(26rem, calc(100vw - 2rem)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: flex-start; gap: 0.75rem; padding: 0.7rem 0.8rem 0.7rem 1rem;
  background: var(--paper); border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: 6px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12); transition: opacity 0.2s, transform 0.2s; }
.toast p { margin: 0; flex: 1; }
.toast.success { border-left-color: var(--brand); }
.toast.warning { border-left-color: var(--gold); background: var(--gold-wash); }
.toast.error { border-left-color: var(--danger); background: var(--alert-wash); }
.toast.leaving { opacity: 0; transform: translateX(1rem); }
.toast-close { background: none; border: 0; padding: 0 0.25rem; font-size: 1.25rem; line-height: 1;
  color: var(--muted); cursor: pointer; }
.toast-close:hover, .toast-close:focus { color: var(--ink); }

dialog.modal { border: 0; border-radius: 8px; padding: 1.25rem 1.5rem; width: min(28rem, calc(100vw - 2rem));
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25); }
dialog.modal::backdrop { background: rgba(27, 31, 35, 0.45); }
dialog.modal h2 { margin: 0 0 0.5rem; font-size: 1.15rem; }
dialog.modal .modal-message { margin: 0 0 1.25rem; }
dialog.modal .actions { justify-content: flex-end; }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

/* === lists: sortable headings and the export button (docs/ui-guidelines.md) */
th a.sort { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 0.25rem; }
th a.sort:hover, th a.sort:focus { color: var(--brand); text-decoration: underline; }
th a.sort.active { color: var(--brand); }
.sort-arrow { font-size: 0.7em; }
.listtools { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 0 0 0.75rem; }

/* Digital Levy dashboard: the numbers, then Billing Issues, every issue one row shape */
.dl-stats .stats { grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); margin: 0.25rem 0 1rem; }
.dl-label { margin: 0; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--muted); }
.dl-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.75rem; margin-top: 0; }
.dl-sum { font-size: 0.9rem; font-weight: 400; color: var(--muted); }
.dl-sum strong { color: var(--danger); }
.dl-group { padding: 0; overflow: hidden; border-left-width: 3px; }
.dl-group.bad { border-left-color: var(--danger); }
.dl-group.warn { border-left-color: var(--gold); }
.dl-group h3 { margin: 0; padding: 0.6rem 1rem; font-size: 0.95rem; display: flex; justify-content: space-between;
  align-items: center; gap: 0.5rem; background: var(--wash); border-bottom: 1px solid var(--line); }
.dl-issues { list-style: none; margin: 0; padding: 0; }
.dl-issues li { display: grid; grid-template-columns: 5.5rem minmax(0, 1fr); gap: 0.75rem; align-items: start;
  padding: 0.55rem 1rem; border-top: 1px solid var(--line); }
.dl-issues li:first-child { border-top: 0; }
.dl-issues .dl-n { text-align: center; }
.dl-issues .dl-n .tag { white-space: nowrap; }
.dl-issues .dl-what { display: flex; flex-direction: column; gap: 0.1rem; }
.dl-issues li.bad .dl-what > a { font-weight: 600; color: var(--danger); }
.dl-issues li.clear { padding-top: 0.35rem; padding-bottom: 0.35rem; }
.dl-issues li.clear a { color: var(--muted); font-size: 0.9rem; }
.dl-issues .ok, .dl-group h3 .ok { color: var(--brand); font-weight: 600; }
.dl-overview { grid-template-columns: minmax(0, 1fr) 22rem; }
.dl-side .dl-label { margin-bottom: 0.15rem; }
.dl-side > p { margin: 0 0 0.6rem; }
.dl-side .dl-issues li { grid-template-columns: 3.5rem minmax(0, 1fr); padding-left: 0.75rem; padding-right: 0.75rem; }
@media (max-width: 64rem) { .dl-overview { grid-template-columns: minmax(0, 1fr); } }
.dl-recent .coming .what { flex-direction: column; align-items: flex-start; gap: 0.1rem; font-size: 0.9rem; }
.tag.bad { background: var(--alert-wash); color: var(--danger); border-color: var(--danger); }
.small { font-size: 0.85rem; }

/* A person's devices: which are enrolled in Intune under them */
tr.intune-mine td:first-child { box-shadow: inset 4px 0 0 var(--brand); }
tr.intune-other td:first-child { box-shadow: inset 4px 0 0 var(--danger); }
tr.intune-nobody td:first-child { box-shadow: inset 4px 0 0 var(--gold); }
.tag.good { background: var(--brand-tint); color: var(--brand); border-color: var(--brand); }
.tag.warn { background: var(--gold-wash); border-color: var(--gold); }

/* Never break a top-bar tab's words (the layout is static/topbar.css). */
.topbar .brand, .topbar a, .topbar .who, .topbar .signout button { white-space: nowrap; }
.topbar nav.areas { flex-wrap: wrap; flex: 1 1 auto; min-width: 0; margin-left: 0.5rem; }
.topbar nav.areas a { padding: 0.35rem 0.65rem; }
.topbar nav.account { flex: 0 0 auto; gap: 1rem; }

/* Universal search: its results page (the dialog is static/topbar.css) */
.search-group h2 { display: flex; gap: 0.5rem; align-items: baseline; }
.search-results { list-style: none; padding: 0; margin: 0 0 0.5rem; }
.search-results li { padding: 0.45rem 0; border-bottom: 1px solid var(--line); }
.suggest { position: absolute; top: calc(100% + 0.25rem); right: 0; width: max(100%, 24rem); z-index: 1100;
  list-style: none; margin: 0; padding: 0.25rem 0; background: var(--paper); color: var(--ink);
  border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  max-height: 70vh; overflow-y: auto; }
.suggest .suggest-group { padding: 0.4rem 0.75rem 0.15rem; font-size: 0.75rem; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--muted); }
.suggest [role="option"] { padding: 0.4rem 0.75rem; cursor: pointer; display: flex; flex-direction: column; }
.suggest [role="option"][aria-selected="true"], .suggest [role="option"]:hover { background: var(--brand-tint); }
.suggest .suggest-detail { font-size: 0.8rem; color: var(--muted); }
/* Person pickers: the suggestion list sits under the field it fills. */
.picker { position: relative; display: block; }
.picker input, .picker textarea { width: 100%; }
.picker .suggest { left: 0; right: auto; width: max(100%, 22rem); }
/* Several people: each is a pill with a remove button, then a box for the next. */
.picker .pills { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem; min-height: 2.35rem;
  padding: 0.25rem 0.35rem; border: 1px solid var(--line); border-radius: 4px; background: var(--paper);
  color: var(--ink); cursor: text; box-sizing: border-box; }
.picker .pills:focus-within { outline: 2px solid var(--brand); outline-offset: 1px; }
.picker .pills.invalid { border-color: var(--danger); background: var(--alert-wash); }
.picker .pill { display: inline-flex; align-items: center; gap: 0.15rem; max-width: 100%;
  padding: 0.1rem 0.15rem 0.1rem 0.6rem; border-radius: 999px; background: var(--brand-tint);
  border: 1px solid var(--brand); color: var(--ink); font-size: 0.875rem; line-height: 1.4; }
.picker .pill > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker .pill-remove { display: inline-flex; align-items: center; justify-content: center; width: 1.4rem;
  height: 1.4rem; padding: 0; margin: 0; border: 0; border-radius: 50%; background: transparent;
  color: inherit; font: inherit; font-size: 1rem; line-height: 1; cursor: pointer; }
.picker .pill-remove:hover, .picker .pill-remove:focus-visible { background: var(--brand); color: var(--paper); }
.picker .pills input.pill-entry { flex: 1 1 8rem; min-width: 6rem; width: auto; border: 0; padding: 0.2rem 0.25rem;
  background: transparent; color: inherit; font: inherit; outline: none; box-shadow: none; }

/* The handbook: Jekyll's pages shown in the app's own look */
.handbook-nav ul { list-style: none; padding: 0; margin: 0; }
.handbook-nav ul ul { padding-left: 0.85rem; margin: 0.15rem 0 0.5rem; border-left: 2px solid var(--line); }
.handbook-nav a { display: block; padding: 0.35rem 0.75rem; color: var(--ink); text-decoration: none; border-radius: 4px; }
.handbook-nav a:hover, .handbook-nav a:focus { background: var(--paper); color: var(--brand); }
.handbook-nav a[aria-current="page"] { background: var(--paper); color: var(--brand); font-weight: 600;
  box-shadow: inset 3px 0 0 var(--brand); }
.handbook { max-width: 46rem; line-height: 1.6; }
.handbook h1 { margin-top: 0; }
.handbook h2 { margin-top: 2rem; }
.handbook img { max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: 4px; }
.handbook table { border-collapse: collapse; width: 100%; margin: 1rem 0; background: var(--paper); }
.handbook th, .handbook td { border: 1px solid var(--line); padding: 0.45rem 0.6rem; text-align: left; vertical-align: top; }
.handbook code { background: var(--wash); padding: 0.1rem 0.3rem; border-radius: 3px; font-size: 0.9em; }
.handbook pre { background: var(--paper); border: 1px solid var(--line); padding: 0.75rem; overflow-x: auto; border-radius: 4px; }
.handbook pre code { background: none; padding: 0; }
.handbook blockquote { margin: 1rem 0; padding: 0.5rem 1rem; border-left: 4px solid var(--line); color: var(--muted); }
/* Just the Docs callouts ({: .tip }, {: .note }, {: .warning }) */
.handbook .tip, .handbook .note, .handbook .warning { padding: 0.75rem 1rem; border-radius: 4px; border-left: 4px solid; margin: 1rem 0; }
.handbook .tip { background: var(--brand-tint); border-color: var(--brand); }
.handbook .note { background: var(--gold-wash); border-color: var(--gold); }
.handbook .warning { background: var(--alert-wash); border-color: var(--danger); }

/* === a person's record (devices/person.html) ================================= */
main.wide { max-width: 76rem; }

.person-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1rem 2.5rem; align-items: end;
  padding-bottom: 1.25rem; border-bottom: 1px solid var(--line); }
.person-head h1 { font-size: 2.1rem; letter-spacing: -0.01em; margin: 0 0 0.2rem; }
.person-role { margin: 0; color: var(--muted); font-size: 1.05rem; display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
/* The numbers IT types into other systems: large, tabular, easy to copy. */
.ids { display: grid; grid-template-columns: repeat(3, auto); justify-content: end; gap: 0.6rem 2rem; margin: 0; }
.ids div { min-width: 0; }
.ids dt { font-size: 0.8rem; color: var(--muted); }
.ids dd { margin: 0; font-size: 1.05rem; font-variant-numeric: tabular-nums; user-select: all; overflow-wrap: anywhere; }
.ids dd a { user-select: auto; }
.ids .ids-wide { grid-column: span 2; }

/* The one loud thing: what disagrees, in sentences, before anything else. */
.checks { margin: 1.25rem 0 1.75rem; padding: 0.85rem 1.25rem; border-radius: 6px;
  background: var(--brand-tint); border-left: 5px solid var(--brand); }
.checks p { margin: 0; }
.checks.has-issues { background: var(--paper); border: 1px solid var(--line); border-left: 5px solid var(--danger); }
.checks h2 { font-size: 1.1rem; margin: 0 0 0.5rem; color: var(--danger); }
.checks ul { list-style: none; margin: 0; padding: 0; }
.checks li { padding: 0.4rem 0 0.4rem 1.4rem; position: relative; border-top: 1px solid var(--line); }
.checks li:first-child { border-top: 0; }
.checks li::before { content: ""; position: absolute; left: 0.2rem; top: 0.85rem; width: 0.55rem; height: 0.55rem;
  border-radius: 50%; background: var(--gold); }
.checks li.bad::before { background: var(--danger); }
.checks li a { white-space: nowrap; margin-left: 0.35rem; }

.record { display: grid; grid-template-columns: minmax(0, 1fr) 21rem; gap: 2.5rem; align-items: start; }
.record-main > section + section, .record-main > section + * { margin-top: 2.25rem; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.section-head h2 { margin: 0 0 0.75rem; }

/* Devices: the serial is the name of a device, as on its sticker. */
.kit { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; }
/* Device profile: who holds it and Intune, before the form */
.device-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); gap: 1rem; margin: 0.5rem 0 1.5rem; }
.device-summary .panel { margin: 0; border-left-width: 4px; }
.device-summary .panel.warn, .intune-card.intune-nobody { border-left-color: var(--gold); }
.intune-card.intune-mine { border-left-color: var(--brand); }
.intune-card.intune-other { border-left-color: var(--danger); }
.holder-name { font-size: 1.25rem; font-weight: 600; margin: 0 0 0.25rem !important; display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.device-summary .kit-facts { grid-template-columns: 7.5rem minmax(0, 1fr); }
.shop-await { border-top: 1px solid var(--line); padding-top: 0.75rem; margin-top: 0.75rem; }
.shop-await:first-of-type { border-top: 0; margin-top: 0; padding-top: 0; }
.kit-remove { margin-top: 0.5rem; }
.kit-handover { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.6rem 0 0; }
.kit-item { background: var(--paper); border: 1px solid var(--line); border-left: 5px solid var(--line);
  border-radius: 6px; padding: 0.85rem 1.1rem; scroll-margin-top: 1rem; }
.kit-item.intune-mine { border-left-color: var(--brand); }
.kit-item.intune-other { border-left-color: var(--danger); }
.kit-item.intune-nobody, .kit-item.intune-none { border-left-color: var(--gold); }
.kit-item:target { outline: 3px solid var(--gold); outline-offset: 2px; }
.kit-top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.35rem 1rem; }
.kit-serial { font-family: Consolas, "Courier New", monospace; font-size: 1.2rem; font-weight: 600;
  letter-spacing: 0.04em; color: var(--ink); text-decoration: none; }
a.kit-serial:hover, a.kit-serial:focus { color: var(--brand); text-decoration: underline; }
.kit-model { font-size: 1.05rem; }
.kit-status { margin-left: auto; color: var(--muted); font-size: 0.9rem; }
.kit-facts { display: grid; grid-template-columns: 6rem minmax(0, 1fr); gap: 0.3rem 1rem; margin: 0.65rem 0 0; }
.kit-facts div { display: contents; }
.kit-facts dt { color: var(--muted); font-size: 0.9rem; }
.kit-facts dd { margin: 0; }
.kit-missing .kit-item p { margin: 0.4rem 0 0; }
details.past, details.action { margin-top: 0.85rem; }
details.action > summary, details.past > summary { cursor: pointer; color: var(--brand); }
.plainlist { list-style: none; padding: 0; margin: 0.5rem 0 0; }
.plainlist li { padding: 0.3rem 0; border-bottom: 1px solid var(--line); }
td.num { font-variant-numeric: tabular-nums; text-align: right; }

/* Side column: quieter. Hairlines between blocks, not boxes. */
.record-side { position: sticky; top: 1rem; }
.side-block { padding: 0 0 1.25rem; margin-bottom: 1.25rem; border-bottom: 1px solid var(--line); }
.side-block:last-child { border-bottom: 0; }
.side-block h2 { font-size: 1.1rem; margin: 0 0 0.6rem; }
.contacts { list-style: none; margin: 0; padding: 0; }
.contacts li { padding: 0.55rem 0; border-top: 1px solid var(--line); }
.contacts li:first-child { border-top: 0; padding-top: 0; }
.contact-name { font-weight: 600; }
.contact-line { display: block; margin-top: 0.15rem; overflow-wrap: anywhere; }
.contacts .no-contact { background: var(--gold-wash); margin: 0 -0.6rem; padding: 0.55rem 0.6rem; border-radius: 4px; }
.do-not { font-size: 0.9rem; }
.levy-state { margin: 0 0 0.5rem; }
.side-facts { margin: 0; }
.side-facts div { padding: 0.3rem 0; }
.side-facts dt { font-size: 0.85rem; color: var(--muted); }
.side-facts dd { margin: 0; font-variant-numeric: tabular-nums; }
.missing { color: var(--danger); font-weight: 600; }
.record-side .stack label { font-size: 0.9rem; }
.record-side h2#leaving { font-size: 1.1rem; margin: 0 0 0.6rem; }

@media (max-width: 1000px) {
  .record { grid-template-columns: minmax(0, 1fr); }
  .record-side { position: static; }
  .person-head { grid-template-columns: minmax(0, 1fr); }
  .ids { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .ids { grid-template-columns: minmax(0, 1fr); }
  .ids .ids-wide { grid-column: auto; }
  .kit-facts { grid-template-columns: minmax(0, 1fr); }
  .kit-status { margin-left: 0; }
}

/* -- billing run: checks before finalising, comparison with the last run ---------- */
.billing-checks.only-warnings { border-left-color: var(--gold); }
.billing-checks.only-warnings h2 { color: var(--ink); }
.billing-checks .checks-summary { margin: 0 0 0.6rem; color: var(--muted); }
.billing-checks .checks-summary strong { color: var(--danger); }
.checks .linkbutton { font-size: 0.9rem; color: var(--brand); text-decoration: underline; margin-left: 0.35rem; white-space: nowrap; }
.checks .linkbutton:hover { color: var(--ink); }
.warn-text { color: var(--danger); }
table.compare th[scope="row"] { text-align: left; font-weight: 600; white-space: nowrap; }
table.compare td:nth-child(2) { font-variant-numeric: tabular-nums; font-weight: 600; }
table.compare td:last-child { text-align: right; }
dialog.panel h3 { margin: 1.1rem 0 0.35rem; font-size: 1rem; }
.danger-zone { margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid var(--line); }

/* -- bulk actions on tables (static/ui.js, "bulk actions") ------------------------ */
.bulk-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; margin: 0.75rem 0 0.5rem;
  padding: 0.5rem 0.75rem; border: 1px solid var(--line); border-radius: 6px; background: var(--wash); }
.bulk-bar.has-selection { border-color: var(--brand); background: var(--brand-tint); }
.bulk-bar [data-bulk-count] { font-weight: 600; min-width: 9rem; color: var(--muted); }
.bulk-bar.has-selection [data-bulk-count] { color: var(--brand); }
.bulk-bar label { display: inline-flex; align-items: center; gap: 0.35rem; margin: 0; font-weight: 400; }
.bulk-bar select, .bulk-bar input[type="text"] { width: auto; margin: 0; }
.bulk-bar button[disabled] { opacity: 0.45; cursor: not-allowed; }
table th.select, table td.select { width: 2rem; padding-right: 0; }
table td.select input, table th.select input { margin: 0; width: 1.05rem; height: 1.05rem; }
table tr.selected td { background: var(--brand-tint); }
body.readonly .bulk-bar, body.readonly th.select, body.readonly td.select { display: none; }


/* A person's devices as removable pills (anomaly pages). */
.pills { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.35rem; }
.pill { display: inline-flex; align-items: center; gap: 0.15rem; padding: 0.1rem 0.25rem 0.1rem 0.6rem;
  border: 1px solid var(--line); border-radius: 999px; background: var(--paper); font-size: 0.85rem; white-space: nowrap; }
.pill form { display: inline; margin: 0; }
.pill-tick { flex: none; margin: 0 0.3rem 0 0; min-height: 0; }
.pill-intune { flex: none; margin-right: 0.15rem; color: var(--brand); }
.pill-remove { background: none; border: 0; padding: 0 0.35rem; min-height: 0; height: auto; line-height: 1.2;
  font-size: 1.05rem; color: var(--muted); cursor: pointer; border-radius: 999px; }
.pill-remove:hover, .pill-remove:focus-visible { color: var(--danger); background: var(--alert-wash); filter: none; }

/* A Copy button sitting inside a read-only link field (partials/copy_field.html). */
.copybox { position: relative; display: block; }
.copybox input { padding-right: 6.5rem; }
.copybox .copybutton { position: absolute; top: 50%; right: 0.3rem; transform: translateY(-50%);
  min-height: 0; height: auto; padding: 0.25rem 0.7rem; font-size: 0.8rem; font-family: inherit; }

/* The Undo toast after a change (apps.accounts.undo): stays its ten seconds. */
.toast.undo { align-items: center; border-left-color: var(--brand); }
.toast.undo form { margin: 0; }
.toast.undo button[type="submit"] { white-space: nowrap; }

/* How many devices a person holds, at the start of the Devices cell. */
.device-count { display: inline-block; min-width: 1.6rem; padding: 0.05rem 0.4rem; margin-right: 0.4rem;
  border-radius: 999px; background: var(--head); border: 1px solid var(--line); text-align: center;
  font-size: 0.8rem; font-weight: 600; vertical-align: top; }
.device-count.none { color: var(--muted); font-weight: 400; }
.device-count.several { background: var(--alert-wash); border-color: var(--danger); color: var(--danger); }
td.devices .devicelist { display: inline-block; vertical-align: top; margin: 0; }

/* Admin > Manage access > a person's pages. */
.access-section { margin-top: 1.5rem; }
.access-section-head, .access-group-head { display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; }
.access-section-head h2, .access-group-head h3 { margin-bottom: 0.25rem; }
.access-group-head h3 { font-size: 1rem; }
.access-section-head label, .access-group-head label { font-size: 0.9rem; color: var(--muted); }

/* Finance > an invoice: the figures beside the PDF they were read from. */
th.num, th.num a.sort { text-align: right; }
.checks-action { margin-top: 0.6rem; }
.invoice-record { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 1.75rem; align-items: start; }
.invoice-pdf { position: sticky; top: 1rem; }
.invoice-pdf iframe { width: 100%; height: 82vh; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); }
dd.money { font-variant-numeric: tabular-nums; }
@media (max-width: 960px) {
  .invoice-record { grid-template-columns: minmax(0, 1fr); }
  .invoice-pdf { position: static; }
  .invoice-pdf iframe { height: 70vh; }
}
.page-actions form { margin: 0; }

/* Me > My days: one row per working day, a week break between the two weeks. */
.mydays tr.newweek td { border-top: 2px solid var(--line); }
.mydays tr.today td { background: var(--wash); }
.mydays .rowactions { display: flex; flex-wrap: wrap; gap: 0.4rem; justify-content: flex-end; }
.mydays .rowactions form { margin: 0; }

/* -- the billing process (devices/_billing_steps.html, _billing_process.html) ------- */
.billing-steps { list-style: none; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0.5rem;
  margin: 1rem 0 1.5rem; padding: 0; counter-reset: none; }
.billing-steps li { display: flex; gap: 0.6rem; align-items: flex-start; padding: 0.6rem 0.75rem; border-radius: 6px;
  border: 1px solid var(--line); background: var(--paper); color: var(--muted); border-top: 4px solid var(--line); }
.billing-steps .n { flex: none; width: 1.6rem; height: 1.6rem; border-radius: 50%; display: grid; place-items: center;
  font-weight: 700; font-size: 0.85rem; background: var(--line); color: var(--ink); }
.billing-steps .t { font-weight: 600; line-height: 1.25; }
.billing-steps small { display: block; font-weight: 400; font-size: 0.8rem; color: var(--muted); }
.billing-steps li.done { color: var(--ink); border-top-color: var(--brand); }
.billing-steps li.done .n { background: var(--brand); color: #fff; }
.billing-steps li.current { color: var(--ink); border-top-color: var(--gold); background: var(--gold-wash); }
.billing-steps li.current .n { background: var(--gold); }
.billing-steps li.current.bad { border-top-color: var(--danger); background: var(--alert-wash); }
.billing-steps li.current.bad .n { background: var(--danger); color: #fff; }
.billing-steps li.current.bad small { color: var(--danger); font-weight: 600; }
@media (max-width: 48rem) { .billing-steps { grid-template-columns: 1fr; } }

.process { display: grid; gap: 1rem; margin: 0 0 2rem; scroll-margin-top: 1rem; }
.process-step { background: var(--paper); border: 1px solid var(--line); border-left: 5px solid var(--line);
  border-radius: 6px; padding: 0.85rem 1.25rem 1rem; }
.process-step.bad { border-left-color: var(--danger); }
.process-step.warn { border-left-color: var(--gold); }
.process-step.done { border-left-color: var(--brand); }
.process-step.current { border-left-color: var(--gold); background: var(--gold-wash); }
.process-step h2 { font-size: 1.15rem; margin: 0 0 0.5rem; display: flex; align-items: center; gap: 0.5rem; }
.process-step h2 .n { width: 1.6rem; height: 1.6rem; border-radius: 50%; display: inline-grid; place-items: center;
  font-size: 0.85rem; background: var(--line); }
.process-step.bad h2 .n { background: var(--danger); color: #fff; }
.process-step.warn h2 .n, .process-step.current h2 .n { background: var(--gold); }
.process-step.done h2 .n { background: var(--brand); color: #fff; }
.process-step p { margin: 0.25rem 0 0.6rem; max-width: 75ch; }
.process-list { list-style: none; margin: 0.25rem 0 0.75rem; padding: 0; }
.process-list li { display: flex; gap: 1rem; align-items: flex-start; justify-content: space-between;
  padding: 0.6rem 0 0.6rem 1.4rem; border-top: 1px solid var(--line); position: relative; }
.process-list li::before { content: ""; position: absolute; left: 0.2rem; top: 1rem; width: 0.55rem; height: 0.55rem;
  border-radius: 50%; background: var(--gold); }
.process-list li.bad::before { background: var(--danger); }
.process-list li.bad strong { color: var(--danger); }
.process-list li.confirmed::before { background: var(--brand); }
.process-list li.confirmed .what > strong { color: var(--muted); font-weight: 600; }
.process-list .how { color: var(--muted); font-size: 0.92rem; }
.process-list .act { flex: none; }
.process-list .act form { margin: 0; }
.confirmed-by { color: var(--brand); font-size: 0.88rem; font-weight: 600; }
.ok-line { color: var(--brand); }
.process-recheck { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; margin: 0.5rem 0 0; }
.process-recheck .muted { font-size: 0.88rem; }
.process-overview { max-width: 75ch; padding-left: 1.3rem; }
.process-overview li { margin: 0.35rem 0; }
.process-current { background: var(--paper); border: 1px solid var(--line); border-left: 5px solid var(--gold);
  border-radius: 6px; padding: 0.85rem 1.25rem; margin: 1.25rem 0 2rem; }
.process-current h2 { margin-top: 0; }

/* -- a person's devices: Intune finds, and the flag in lists (devices/_intune_flag.html) -- */
.intune-found { background: var(--alert-wash); border: 1px solid #f3b7b8; border-radius: 6px;
  padding: 0.75rem 1rem 1rem; margin: 0 0 1.25rem; scroll-margin-top: 1rem; }
.intune-found h3 { margin: 0 0 0.2rem; color: var(--danger); font-size: 1.05rem; }
.intune-found > p { margin: 0 0 0.75rem; }
.kit-why { margin: 0.4rem 0 0; }
.kit-actions { margin-top: 0.6rem; display: flex; gap: 0.5rem; flex-wrap: wrap; }
.kit-actions form { margin: 0; }
.checks li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.4rem 1rem; }
.checks .check-action { margin: 0; }
.intune-flag { display: inline-flex; align-items: center; gap: 0.3rem; margin-top: 0.25rem; padding: 0.05rem 0.45rem;
  border-radius: 999px; font-size: 0.8rem; font-weight: 600; white-space: nowrap; text-decoration: none;
  color: var(--danger); background: var(--alert-wash); border: 1px solid #f3b7b8; }
.intune-flag:hover, .intune-flag:focus { border-color: var(--danger); }
td.devices .intune-flag { display: flex; width: max-content; }
.record-main > section + section { padding-top: 0.25rem; }

/* === Levy overview (devices/levy_overview.html): the whole width ========== */
.layout:has(main.full) { max-width: none; }
.layout main.full, main.full { max-width: none; }
/* No scrolling box round the table: a sticky header sticks to the nearest
   ancestor that scrolls, so any overflow on a wrapper would pin it there
   instead of to the window. The page itself scrolls; the headers stay put. */
main.full .table-scroll { overflow: visible; }
/* theme.css gives every table overflow: hidden (to clip its rounded corners),
   which would make the table itself the sticky box: undo it here. The
   corner header cells are rounded instead. */
table.dl-overview { overflow: visible; }
table.dl-overview thead th:first-child { border-top-left-radius: var(--radius); }
table.dl-overview thead th:last-child { border-top-right-radius: var(--radius); }
.dl-overview { width: 100%; font-size: 0.9rem; margin-top: 0.5rem; }
table.dl-overview thead th { position: sticky; top: var(--sticky-top, 0); background: var(--head); z-index: 2;
  box-shadow: inset 0 -2px 0 var(--line); }
.dl-overview td { vertical-align: top; }
.dl-overview td > .small, .dl-overview td.money > * { display: block; }
.dl-overview td.money .small { font-size: 0.8rem; }
.dl-overview tr.is-bad td { background: var(--alert-wash); }
.dl-overview tr.is-bad td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.dl-overview tr.is-warn td { background: var(--gold-wash); }
.dl-overview tr.is-warn td:first-child { box-shadow: inset 3px 0 0 var(--gold); }
.dl-overview .devicelist li.intune-other a { color: var(--danger); font-weight: 600; }
.dl-row-issues { list-style: none; margin: 0; padding: 0; font-size: 0.82rem; }
.dl-row-issues li { padding-left: 0.9rem; position: relative; }
.dl-row-issues li::before { content: ""; position: absolute; left: 0; top: 0.45em; width: 0.45rem; height: 0.45rem; border-radius: 50%; background: var(--muted); }
.dl-row-issues li.bad { color: var(--danger); font-weight: 600; }
.dl-row-issues li.bad::before { background: var(--danger); }
.dl-row-issues li.warn::before { background: var(--gold); }
.dl-row-issues li.info { color: var(--muted); }
/* "New to the levy": their year group joined the levy since the last bill.
   Blue, to set it apart from "New joiner" (green) and the problem colours. */
.tag.levy-new { background: #eff6ff; color: #1d4ed8; border-color: #1d4ed8; }

/* === page modals (static/ui.js): a page opened over the current one ======= */
dialog.page-modal { border: 0; border-radius: 8px; padding: 0; width: min(72rem, calc(100vw - 2rem));
  height: calc(100vh - 3rem); max-height: none; display: none; flex-direction: column; overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3); }
dialog.page-modal[open] { display: flex; }
dialog.page-modal::backdrop { background: rgba(27, 31, 35, 0.45); }
.page-modal-bar { display: flex; justify-content: flex-end; align-items: center; gap: 1rem;
  padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--line); background: var(--head, var(--paper)); }
.page-modal-body { position: relative; flex: 1; display: flex; }
dialog.page-modal iframe { flex: 1; width: 100%; border: 0; background: var(--wash); }
/* Shown over the frame while a page loads in it (static/ui.js). */
.page-modal-loading { position: absolute; inset: 0; z-index: 1; display: none; flex-direction: column;
  align-items: center; justify-content: center; gap: 0.75rem; background: var(--wash); color: var(--muted); }
dialog.page-modal.loading .page-modal-loading { display: flex; }
.spinner { width: 2.25rem; height: 2.25rem; border-radius: 50%; border: 3px solid var(--line);
  border-top-color: var(--brand); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }
/* Something being processed: a small spinner before a button's or a status
   line's text (add .is-busy while the request runs). */
.is-busy::before { content: ""; display: inline-block; width: 0.85em; height: 0.85em; margin-right: 0.4em;
  vertical-align: -0.1em; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent;
  animation: spin 0.8s linear infinite; }
button.is-busy, .button.is-busy { cursor: progress; }
@media (prefers-reduced-motion: reduce) { .is-busy::before { animation-duration: 2.4s; } }
/* Inside the modal's frame: no top bar, search band or tab strip (static/embed.js). */
html.in-modal .topbar, html.in-modal .searchband, html.in-modal .subnav { display: none; }
html.in-modal main { padding-top: 1.25rem; }

/* A price box holding something that is not a price (static/ui.js). */
input[aria-invalid="true"] { border-color: var(--danger); outline-color: var(--danger); background: var(--alert-wash); }

/* Levy overview: which rows to show, one click each. */
.issue-filter { display: inline-flex; flex-wrap: wrap; margin: 0.25rem 0 0.75rem; border: 1px solid var(--line);
  border-radius: var(--radius, 6px); overflow: hidden; background: var(--paper); }
.issue-filter a { padding: 0.45rem 0.9rem; color: var(--ink); text-decoration: none; font-weight: 600; font-size: 0.9rem; }
.issue-filter a + a { border-left: 1px solid var(--line); }
.issue-filter a:hover, .issue-filter a:focus-visible { background: var(--wash); }
.issue-filter a[aria-current] { background: var(--brand); color: #fff; }
.issue-filter a.bad[aria-current] { background: var(--danger); }
.issue-filter .n { font-weight: 400; opacity: 0.8; margin-left: 0.25rem; }
.person-actions { margin: 0.6rem 0 0; }

/* Person page: is each device in Intune? A badge on every device and a tally above. */
.intune-badge { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.2rem 0.65rem; border-radius: 999px;
  font-size: 0.85rem; font-weight: 700; white-space: nowrap; border: 1.5px solid; }
.intune-badge.mine { background: var(--brand-tint); color: var(--brand); border-color: var(--brand); }
.intune-badge.none { background: var(--alert-wash); color: var(--danger); border-color: var(--danger); }
.intune-badge.other { background: var(--danger); color: #fff; border-color: var(--danger); }
.intune-badge.nobody { background: var(--gold-wash); color: #6b5320; border-color: var(--gold); }
.kit-top .intune-badge { margin-left: 0.25rem; }
.kit-item.intune-none { border-left-color: var(--danger); background: linear-gradient(90deg, var(--alert-wash), var(--paper) 60%); }
.kit-item.intune-other { background: linear-gradient(90deg, var(--alert-wash), var(--paper) 60%); }
.kit-item.intune-nobody { background: linear-gradient(90deg, var(--gold-wash), var(--paper) 60%); }
.intune-tally { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin: 0 0 0.75rem; color: var(--muted); max-width: none; }

/* === Invoices (finance/invoices.html): the whole width, denser ============ */
main.invoices-page .invoices-lede { max-width: 60rem; margin-bottom: 0.75rem; }
main.invoices-page .invoice-filters { flex-wrap: wrap; gap: 0.5rem; margin: 0.75rem 0 0.5rem; }
main.invoices-page .invoice-filters input[type="search"] { flex: 2 1 14rem; }
main.invoices-page .invoice-filters select { flex: 1 1 9rem; min-width: 0; max-width: 14rem; }
table.invoices { width: 100%; font-size: 0.9rem; }
table.invoices th, table.invoices td { padding: 0.45rem 0.6rem; vertical-align: top; }
table.invoices td.date, table.invoices td.num { white-space: nowrap; }
table.invoices td.number { min-width: 7rem; }
table.invoices td.supplier { min-width: 9rem; max-width: 18rem; }
table.invoices td.what { width: 35%; min-width: 13rem; color: var(--muted); }
table.invoices td.what .what-text { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
  line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
table.invoices .what-row { display: flex; gap: 0.5rem; align-items: baseline; }
table.invoices .what-more { white-space: nowrap; font-size: 0.8rem; margin-left: auto; }
/* Below 100rem: drop the due date and VAT columns (both are on each invoice),
   so what each invoice is for has room to be read. */
@media (max-width: 100rem) {
  table.invoices thead th:nth-child(2), table.invoices tbody td:nth-child(2),
  table.invoices thead th:nth-child(8), table.invoices tbody td:nth-child(8),
  table.invoices tfoot td.vat-foot, table.invoices tfoot td.due-foot { display: none; }
}

/* === Finance overview (finance/overview.html): budget against spend ====== */
.fy-select { display: flex; align-items: center; gap: 0.5rem; margin: 0; }
.fy-select label { color: var(--muted); font-size: 0.9rem; }
.fy-select select { font: inherit; padding: 0.4rem 0.6rem; border: 1px solid var(--line);
  border-radius: 4px; background: var(--paper); }
.finance-overview .lede { max-width: 60rem; }
.fo-headline { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius, 6px);
  padding: 1rem 1.25rem; margin: 0.5rem 0 1rem; }
.fo-figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 1rem 2rem; }
.fo-fig { display: flex; flex-direction: column; gap: 0.1rem; }
.fo-fig .l { color: var(--muted); font-size: 0.85rem; }
.fo-fig .n { font-size: 2rem; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.fo-fig .s { color: var(--muted); font-size: 0.85rem; }
.fo-fig.over .n { color: var(--danger); }
.fo-meter { position: relative; height: 0.75rem; margin: 1.1rem 0 0.3rem; border-radius: 999px;
  background: var(--wash); }
.fo-meter-fill { height: 100%; border-radius: 999px; background: var(--brand); }
.fo-meter-fill.over { background: var(--danger); }
.fo-meter-now { position: absolute; top: -0.35rem; bottom: -0.35rem; width: 2px; background: var(--ink);
  transform: translateX(-1px); }
.fo-meter-now span { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
  font-size: 0.75rem; color: var(--muted); white-space: nowrap; }
.fo-meter-key { display: flex; justify-content: space-between; color: var(--muted); font-size: 0.8rem;
  font-variant-numeric: tabular-nums; }
.fo-check { margin: 0.75rem 0 0; font-size: 0.9rem; color: var(--muted); }
.fo-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(18rem, 1fr); gap: 1rem; align-items: start; }
.fo-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius, 6px);
  padding: 1rem 1.25rem; min-width: 0; }
.fo-card h2 { margin: 0 0 0.75rem; font-size: 1.05rem; }
.fo-chart { width: 100%; height: auto; display: block; overflow: visible; }
.fo-chart .grid { stroke: var(--line); stroke-width: 1; }
.fo-chart .axis { stroke: var(--muted); stroke-width: 1; }
.fo-chart .tick { font-size: 11px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.fo-chart .budget { stroke: var(--ink); stroke-width: 1.5; stroke-dasharray: 6 4; }
.fo-chart .pace { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 2 4; }
.fo-chart .today { stroke: var(--muted); stroke-width: 1; }
.fo-chart .ref-label { font-size: 11px; fill: var(--ink); font-weight: 600; }
.fo-chart .ref-label.faint { fill: var(--muted); font-weight: 400; }
.fo-chart .value-label { font-size: 12px; fill: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.fo-chart .spent-area { fill: var(--brand); opacity: 0.08; }
.fo-chart .spent-line { fill: none; stroke: var(--brand); stroke-width: 2; stroke-linejoin: round; }
.fo-chart .dot .hit, .fo-chart .bar .hit { fill: transparent; }
.fo-chart .dot .mark { fill: var(--brand); stroke: var(--paper); stroke-width: 2; }
.fo-chart .dot:hover .mark, .fo-chart .dot:focus .mark { r: 6; }
.fo-chart .bar .mark { fill: var(--brand); }
.fo-chart .bar.current .mark { opacity: 0.6; }
.fo-chart .bar:hover .hit, .fo-chart .bar:focus .hit { fill: var(--wash); }
.fo-chart g:focus { outline: none; }
.fo-suppliers, .fo-years { width: 100%; font-size: 0.9rem; border-collapse: collapse; }
.fo-suppliers td, .fo-years td, .fo-years th { padding: 0.45rem 0.6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.fo-suppliers td:first-child, .fo-years td:first-child, .fo-years th:first-child { padding-left: 0; }
.fo-suppliers td:last-child, .fo-years td:last-child, .fo-years th:last-child { padding-right: 0; }
.fo-years th { color: var(--muted); font-weight: 600; text-align: left; }
.fo-suppliers tr:last-child td, .fo-years tr:last-child td { border-bottom: 0; }
.fo-suppliers .name a { display: block; }
.fo-sbar { display: block; height: 4px; margin-top: 0.25rem; background: var(--wash); border-radius: 2px; }
.fo-sbar span { display: block; height: 100%; background: var(--brand); border-radius: 2px; }
.fo-suppliers .num, .fo-years .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.fo-years tr.chosen td { background: var(--brand-tint); }
.fo-years td.over { color: var(--danger); }
@media (max-width: 64rem) { .fo-grid { grid-template-columns: minmax(0, 1fr); } }
.fo-key { display: flex; flex-wrap: wrap; gap: 0.35rem 1.25rem; margin: 0.5rem 0 0; font-size: 0.8rem; color: var(--muted); }
.fo-key > span { display: inline-flex; align-items: center; gap: 0.4rem; }
.fo-key i { display: inline-block; width: 1.5rem; height: 0; }
.fo-key .k-spent { border-top: 2px solid var(--brand); }
.fo-key .k-budget { border-top: 1.5px dashed var(--ink); }
.fo-key .k-pace { border-top: 1px dotted var(--muted); }
.fo-leases { margin-top: 1rem; }
.fo-leases > p { margin: -0.4rem 0 0.75rem; max-width: 70rem; }
table.fo-lease-table { width: 100%; font-size: 0.9rem; }
table.fo-lease-table td { vertical-align: top; }
table.fo-lease-table td.date, table.fo-lease-table td.num { white-space: nowrap; }
table.fo-lease-table .d-block { display: block; }
.fo-ended summary { margin: 0.75rem 0 0.5rem; }

/* === Purchase orders (finance/po*.html) =================================== */
table.po-list { width: 100%; font-size: 0.9rem; }
table.po-list th, table.po-list td { padding-top: 0.4rem; padding-bottom: 0.4rem; vertical-align: top; }
table.po-list td.date, table.po-list td.num, table.po-list td.number { white-space: nowrap; }
table.po-list td.what { width: 30%; }
dialog.panel.po-wide { width: min(64rem, calc(100vw - 2rem)); }
.checks li.warn::before { background: var(--gold); }
.checks li.good::before { background: var(--brand); }
table.po-lines { width: 100%; margin: 0.5rem 0 1rem; }
table.po-lines td { vertical-align: top; }
table.po-lines td.po-desc { width: 38%; }
form[data-po-lines].stack { max-width: none; }
table.po-lines td.po-desc input { width: 100%; min-width: 16rem; }
table.po-lines td.po-code input { width: 100%; min-width: 8rem; }
table.po-lines td.po-qty input, table.po-lines td.po-vat input { width: 5rem; text-align: right; }
table.po-lines td.po-price input { width: 8rem; text-align: right; }
table.po-lines td.num { white-space: nowrap; font-variant-numeric: tabular-nums; }
table.po-lines tr[data-po-spare].po-hidden { display: none; }
input.narrow { width: 6rem; text-align: right; }

/* The printable order (finance/po_print.html). */
body.po-print { background: #fff; color: #111; max-width: 52rem; margin: 2rem auto; padding: 0 1.5rem; }
.po-print .po-print-bar { display: flex; gap: 0.75rem; justify-content: flex-end; margin-bottom: 1.5rem; }
.po-print header { display: flex; justify-content: space-between; align-items: flex-start; gap: 2rem; border-bottom: 2px solid #111; padding-bottom: 1rem; }
.po-print h1 { margin: 0; font-size: 1.6rem; }
.po-print .po-brand { display: flex; align-items: center; gap: 1.25rem; }
.po-print .po-brand p { margin: 0.2rem 0 0; }
.po-print .po-logo { height: 4rem; width: auto; }
.po-print .po-number { font-size: 1.4rem; font-weight: 700; font-family: var(--mono, monospace); }
.po-print .po-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; margin: 1.5rem 0; }
.po-print .po-parties h2 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: #555; margin: 0 0 0.35rem; }
.po-print table { width: 100%; border-collapse: collapse; margin: 1rem 0; }
.po-print th, .po-print td { border-bottom: 1px solid #ccc; padding: 0.45rem 0.4rem; text-align: left; vertical-align: top; }
.po-print .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.po-print tfoot td { border-bottom: 0; }
.po-print .po-foot { margin-top: 2rem; font-size: 0.9rem; color: #444; }
@media print {
  .po-print .po-print-bar { display: none; }
  body.po-print { margin: 0; max-width: none; }
}
.fo-pots { margin: 0 0 1rem; }
.fo-pot-table td, .fo-budget-table td { vertical-align: middle; }
.fo-pot-meter { min-width: 10rem; }
.fo-pot-meter .fo-sbar { display: inline-block; width: 7rem; margin: 0 0.5rem 0 0; vertical-align: middle; }
.fo-sbar span.over { background: var(--danger); }
.fo-pot-meter-h { width: 12rem; }
table.fo-budget-table { width: 100%; }
table.fo-budget-table td.num { white-space: nowrap; }
table.fo-budget-table .d-block { display: block; }
table.fo-budget-table td.over, .fo-pot-table td.over { color: var(--danger); }

/* --- Finance > Forecast ---------------------------------------------------- */
.finance-overview { --fc-it: #2a78d6; --fc-refresh: #eb6834; --fc-levy: #1baf7a; --fc-copier: #eda100; }
.fc-chart .seg.s-it, .fc-swatch.s-it { fill: var(--fc-it); background: var(--fc-it); }
.fc-chart .seg.s-refresh, .fc-swatch.s-refresh { fill: var(--fc-refresh); background: var(--fc-refresh); }
.fc-chart .seg.s-levy, .fc-swatch.s-levy { fill: var(--fc-levy); background: var(--fc-levy); }
.fc-chart .seg.s-copier, .fc-swatch.s-copier { fill: var(--fc-copier); background: var(--fc-copier); }


.fo-key i.fc-swatch { display: inline-block; width: 0.75rem; height: 0.75rem; border-radius: 2px; }
.fo-key i.fc-swatch.dash { height: 0; width: 1.1rem; border-top: 2px dashed var(--ink); border-radius: 0; }
.fc-chart .bar:hover .seg, .fc-chart .bar:focus .seg { opacity: 0.85; }
.fc-scroll { overflow-x: auto; }
.fc-table { font-size: 0.88rem; min-width: 72rem; }
.fc-table th, .fc-table td { white-space: nowrap; }
.fc-table td.fc-name { white-space: normal; min-width: 17rem; }
.fc-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.fc-table .fc-ly { background: var(--wash); }
.fc-table .fc-now { background: var(--brand-tint); }
.fc-table td.over { color: var(--danger); }
.fc-table td.fc-set { font-weight: 700; }
.fc-table tr.fc-refresh td { border-top: 2px solid var(--line); }
.fc-table tr.fc-wave td { font-size: 0.82rem; padding-top: 0.15rem; padding-bottom: 0.15rem; }
.fc-table tr.fc-wave td:first-child { padding-left: 1.25rem; }
.fc-table tr.fc-wave .tag { font-size: 0.72rem; padding: 0 0.35rem; }
.fc-table tfoot td { border-top: 2px solid var(--ink); }
.fc-mark { color: var(--muted); font-size: 0.75em; margin-left: 0.15rem; }
.fc-row-actions { display: flex; gap: 0.75rem; margin-top: 0.15rem; white-space: nowrap; }
button.linkish { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline;
  cursor: pointer; font: inherit; font-size: 0.8rem; }
.fc-adjust { margin: 0.25rem 0; flex-wrap: nowrap; align-items: center; }
.fc-adjust .fc-adj-year { width: 4.5rem; font-variant-numeric: tabular-nums; color: var(--ink); }
.fc-adjust input[type="number"] { width: 8rem; }
.fc-adjust input[type="text"] { width: 12rem; }
.rf-grid td.rf-cell { text-align: right; font-variant-numeric: tabular-nums; }
.rf-grid td.rf-cell a { text-decoration: none; }
.rf-grid td.rf-cell.done { color: var(--muted); text-decoration: line-through; }
.rf-grid th, .rf-grid td { white-space: nowrap; }
.rf-grid td.rf-name { white-space: normal; min-width: 11rem; }
.rf-wave { border: 1px solid var(--line); border-radius: 6px; padding: 0.75rem 1rem; margin: 0 0 1rem; background: var(--paper); }
.rf-wave h3 { margin: 0 0 0.4rem; font-size: 1rem; }
.rf-wave .facts-row { display: flex; flex-wrap: wrap; gap: 0.25rem 1.5rem; font-size: 0.9rem; margin-bottom: 0.5rem; }
.rf-rooms-pick { max-height: 22rem; overflow-y: auto; border: 1px solid var(--line); border-radius: 6px; padding: 0.5rem 0.75rem; }
.rf-rooms-pick label { display: flex; flex-direction: row; gap: 0.5rem; align-items: baseline; color: var(--ink); margin: 0.15rem 0; }
.fc-table .d-block, .rf-grid .d-block, .rf-wave .d-block, .fc-cats .d-block { display: block; }
.rf-rooms-pick input { order: -1; flex: none; }

table.fo-budget-table td.actions-cell { display: flex; gap: 0.5rem; justify-content: flex-end; flex-wrap: wrap; }
table.invoices td.pot { min-width: 6.5rem; font-size: 0.85rem; color: var(--muted); }

/* === Finance: one look across its pages (18 Nov 2026) ======================
   The figures above each list: the number, then what it counts, in tiles of
   one size on every Finance page (Invoices, Quotes, Purchase orders, Contracts). */
.stats.fin-stats { grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 0.85rem; margin: 0.25rem 0 1.25rem; }
.stats.fin-stats .stat { gap: 0.25rem; padding: 0.85rem 1.1rem; }
.stats.fin-stats .stat .n { font-size: 1.6rem; line-height: 1.15; white-space: nowrap; }
.stats.fin-stats .stat .n a { text-decoration-thickness: 1px; text-underline-offset: 0.15em; }
.stats.fin-stats .stat .l { font-size: 0.88rem; line-height: 1.35; color: var(--muted); }
.stats.fin-stats .stat .d { margin-top: 0.1rem; }
@media (max-width: 700px) {
  .stats.fin-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; }
  .stats.fin-stats .stat { padding: 0.7rem 0.85rem; }
  .stats.fin-stats .stat .n { font-size: 1.3rem; }
}
/* The Used column sits clear of the Left figures beside it. */
.fo-pot-table th.fo-pot-meter-h, .fo-pot-table td.fo-pot-meter,
table.fo-budget-table td.fo-pot-meter { padding-left: 1.5rem; }
/* A record's sections (Invoices, Assets on a purchase order): the heading and
   its button on one line, with room above and below so the button does not
   sit against the section before. */
.invoice-main .section-head { align-items: center; flex-wrap: wrap; gap: 0.5rem 1rem; margin: 2rem 0 0.75rem; }
.invoice-main .section-head h2 { margin: 0; }
.invoice-main .section-head + p.empty { margin-top: 0; }
.invoice-pdf form.stack { margin-top: 1rem; }
.invoice-pdf .actions { margin-top: 0.25rem; }
/* Status tags in a table never break over two lines. */
table td .tag { white-space: nowrap; }
/* A table that ends its card does not leave a gap under it. */
.fo-card > table:last-child, .fo-card > .table-scroll:last-child > table, .fo-card > :last-child { margin-bottom: 0; }


/* Documents: the drop zone and folder rows (templates/docs/documents.html). */
.dropzone { margin: 0 0 1rem; }
.dropzone-area { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.35rem;
  min-height: 8.5rem; padding: 1.5rem 1rem; text-align: center; cursor: pointer;
  border: 2px dashed var(--line); border-radius: 8px; background: var(--paper); color: var(--ink);
  transition: border-color 0.15s, background-color 0.15s; }
.dropzone-area:hover, .dropzone-area:focus-within { border-color: var(--accent); }
.dropzone.over .dropzone-area { border-color: var(--accent); background: var(--brand-tint); }
.dropzone.busy .dropzone-area { cursor: progress; opacity: 0.7; }
.dropzone-input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.folder-row a { font-weight: 600; }
.folder-icon { display: inline-block; width: 1.05em; height: 0.8em; margin-right: 0.45em; vertical-align: -0.05em;
  background: var(--gold); border-radius: 2px; position: relative; }
.folder-icon::before { content: ""; position: absolute; left: 0; top: -0.2em; width: 0.45em; height: 0.25em;
  background: var(--gold); border-radius: 2px 2px 0 0; }
button.linkish.copy-inline { font-size: inherit; }

/* List or Thumbnails (templates/docs/documents.html) */
.view-switch { display: inline-flex; margin-left: auto; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.view-switch a { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.3rem 0.7rem; font-size: 0.88rem;
  text-decoration: none; color: var(--ink); background: var(--paper); }
.view-switch a + a { border-left: 1px solid var(--line); }
.view-switch a[aria-current] { background: var(--brand); color: var(--accent-ink); }
.vs-icon { width: 0.9rem; height: 0.8rem; display: inline-block; background: currentColor; }
.vs-list { -webkit-mask: linear-gradient(currentColor 0 0) top / 100% 18% no-repeat, linear-gradient(currentColor 0 0) center / 100% 18% no-repeat,
  linear-gradient(currentColor 0 0) bottom / 100% 18% no-repeat;
  mask: linear-gradient(#000 0 0) top / 100% 18% no-repeat, linear-gradient(#000 0 0) center / 100% 18% no-repeat,
  linear-gradient(#000 0 0) bottom / 100% 18% no-repeat; }
.vs-grid { -webkit-mask: conic-gradient(#000 0 0) 0 0 / 42% 42% no-repeat, conic-gradient(#000 0 0) 100% 0 / 42% 42% no-repeat,
  conic-gradient(#000 0 0) 0 100% / 42% 42% no-repeat, conic-gradient(#000 0 0) 100% 100% / 42% 42% no-repeat;
  mask: conic-gradient(#000 0 0) 0 0 / 42% 42% no-repeat, conic-gradient(#000 0 0) 100% 0 / 42% 42% no-repeat,
  conic-gradient(#000 0 0) 0 100% / 42% 42% no-repeat, conic-gradient(#000 0 0) 100% 100% / 42% 42% no-repeat; }

.doc-grid { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); }
.doc-card { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; overflow: hidden;
  display: flex; flex-direction: column; min-width: 0; }
.doc-card:hover, .doc-card:focus-within { border-color: var(--brand); box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06); }
.doc-card.archived { opacity: 0.7; }
.doc-thumb { aspect-ratio: 4 / 3; display: flex; align-items: center; justify-content: center; text-decoration: none;
  background: var(--wash) repeating-conic-gradient(#eef0f3 0 25%, #f7f8fa 0 50%) 0 0 / 16px 16px;
  border-bottom: 1px solid var(--line); overflow: hidden; }
.doc-thumb img { width: 100%; height: 100%; object-fit: contain; padding: 0.5rem; }
.doc-type { font-weight: 800; font-size: 1.1rem; letter-spacing: 0.04em; color: var(--muted); background: var(--paper);
  border: 2px solid var(--line); border-radius: 6px; padding: 0.9rem 0.8rem; min-width: 4.5rem; text-align: center; }
.doc-folder .doc-thumb { background: var(--gold-wash); }
.folder-icon.big { font-size: 3.5rem; margin: 0; }
.doc-meta { padding: 0.55rem 0.7rem 0.65rem; display: flex; flex-direction: column; gap: 0.15rem; font-size: 0.82rem; min-width: 0; }
.doc-title { font-weight: 600; font-size: 0.92rem; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-where { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-links { margin-top: 0.15rem; }

/* --- Calendar (apps.teamcalendar) -------------------------------------------- */
/* Every calendar's colour comes in as --cal (its own, or the person's choice);
   the pale wash is mixed from it. */
.cal-event, .cal-timed, .cal-list-day li, .cal-cat, .cal-swatch { --cal-wash: color-mix(in srgb, var(--cal) 13%, white); }
.cal-toolbar { align-items: center; }
.cal-nav { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.cal-nav h1 { margin: 0 0 0 0.5rem; font-size: 1.5rem; }
.cal-step { font-size: 1.15rem; line-height: 1; padding: 0.3rem 0.65rem; }
.cal-views { display: inline-flex; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; background: var(--paper); }
.cal-views a { padding: 0.35rem 0.75rem; font-size: 0.88rem; color: var(--ink); text-decoration: none; white-space: nowrap; }
.cal-views a + a { border-left: 1px solid var(--line); }
.cal-views a:hover { background: var(--brand-tint); }
.cal-views a[aria-current="page"] { background: var(--brand); color: var(--accent-ink); font-weight: 600; }
/* The calendars to show (teamcalendar/_filters.html): one line of chips, each
   in its calendar's colour. On, a chip is washed in that colour with a solid
   swatch; off, it is plain with an empty swatch and muted words, so what is
   showing reads at a glance. The actions sit at the right of the same line. */
.cal-picker { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin: 0.6rem 0 0; }
.cal-picker-actions { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.75rem; margin-left: auto; font-size: 0.9rem; }
/* The fieldset adds no box: its chips sit in the picker's own row, with the actions. */
.cal-cats { display: contents; }
.cal-cats-label { display: inline-block; float: none; margin-right: 0.1rem; padding: 0; font-size: 0.88rem; font-weight: 600; color: var(--muted); }
.cal-cat { position: relative; display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.22rem 0.7rem 0.22rem 0.55rem;
  border: 1px solid var(--line); border-radius: 999px; background: var(--paper); color: var(--muted);
  font-size: 0.86rem; line-height: 1.3; white-space: nowrap; cursor: pointer; user-select: none; }
.cal-cat input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.cal-cat .cal-swatch { background: transparent; box-shadow: inset 0 0 0 2px var(--cal); }
.cal-cat:hover { border-color: var(--cal); color: var(--ink); }
.cal-cat:has(input:checked) { background: var(--cal-wash); border-color: color-mix(in srgb, var(--cal) 45%, white); color: var(--ink); }
.cal-cat:has(input:checked) .cal-swatch { background: var(--cal); box-shadow: none; }
.cal-cat:has(input:focus-visible), .cal-cat-add:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
/* Your own Outlook calendar, not yet connected: a dashed chip to add it. */
button.cal-cat-add { --cal: var(--brand); border-style: dashed; color: var(--brand); font: inherit; font-size: 0.86rem; font-weight: 500;
  background: transparent; filter: none; }
button.cal-cat-add:hover { background: var(--brand-tint); border-style: solid; }
.cal-plus { font-weight: 700; line-height: 1; }
.cal-opt-head { margin: 1rem 0 0.25rem; font-size: 0.95rem; }
.cal-opt-head:first-of-type { margin-top: 0.25rem; }
.cal-swatch { width: 0.7rem; height: 0.7rem; border-radius: 3px; background: var(--cal); display: inline-block; vertical-align: middle; flex: 0 0 auto; }
.stack label.cal-colour-row { flex-direction: row; align-items: center; gap: 0.6rem; color: var(--ink); }
.cal-colour-row input[type="color"] { width: 2.4rem; height: 1.8rem; padding: 0; border: 1px solid var(--line); border-radius: 4px; background: none; }
/* month */
.cal-month { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); overflow: hidden; margin: 0.6rem 0 0; }
.cal-month > .cal-row:not(.cal-head) { flex: 1 0 auto; }
.cal-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)) repeat(2, minmax(0, 0.7fr)); }
.cal-row + .cal-row { border-top: 1px solid var(--line); }
.cal-dow { padding: 0.4rem 0.5rem; font-size: 0.8rem; font-weight: 600; color: var(--muted); background: var(--head); text-transform: uppercase; letter-spacing: 0.03em; }
.cal-day { min-height: 7rem; padding: 0.3rem 0.35rem 0.45rem; display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; }
.cal-day + .cal-day { border-left: 1px solid var(--line); }
.cal-weekend { background: #fafbfc; }
.cal-out { background: var(--wash); }
.cal-out .cal-date { color: #9aa3ad; }
.cal-date { font-size: 0.85rem; font-weight: 600; color: var(--muted); padding: 0 0.15rem; text-decoration: none; align-self: flex-start; }
a.cal-date:hover { text-decoration: underline; }
.cal-today .cal-date { color: var(--accent-ink); background: var(--brand); border-radius: 999px; padding: 0 0.5rem; }
.cal-event { display: block; font-size: 0.8rem; line-height: 1.3; padding: 0.15rem 0.4rem; border-left: 3px solid var(--cal); background: var(--cal-wash); color: var(--ink); border-radius: 3px; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
a.cal-event:hover { background: var(--cal); color: #fff; }
.cal-event.cal-cont { opacity: 0.75; }
.cal-event.cal-deadline, .cal-timed.cal-deadline { font-weight: 600; border-left-width: 5px; }
.cal-time { font-variant-numeric: tabular-nums; color: var(--muted); }
a.cal-event:hover .cal-time, a.cal-timed:hover .cal-time { color: inherit; }
.cal-more { font-size: 0.78rem; color: var(--muted); padding: 0 0.4rem; text-decoration: none; }
.cal-more:hover { color: var(--brand); text-decoration: underline; }
/* day, work week and week: a time grid */
.cal-grid { --hour: 3rem; --gutter: 3.5rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); margin: 0.6rem 0 0; overflow: hidden; }
.cal-grid-head, .cal-grid-allday, .cal-grid-body { display: grid; grid-template-columns: var(--gutter) repeat(var(--cols), minmax(0, 1fr)); }
.cal-grid-head { background: var(--head); border-bottom: 1px solid var(--line); }
.cal-col-head { padding: 0.35rem 0.5rem; border-left: 1px solid var(--line); }
.cal-col-head a { color: var(--ink); text-decoration: none; display: inline-flex; align-items: baseline; gap: 0.35rem; }
.cal-col-head .cal-dow { padding: 0; background: none; }
.cal-dnum { font-size: 1.15rem; font-weight: 650; }
.cal-col-head.cal-today .cal-dnum { color: var(--accent-ink); background: var(--brand); border-radius: 999px; padding: 0 0.45rem; }
.cal-grid-allday { border-bottom: 2px solid var(--line); }
.cal-allday { border-left: 1px solid var(--line); padding: 0.25rem; display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; min-height: 1.9rem; }
.cal-gutter { font-size: 0.72rem; color: var(--muted); text-align: right; padding-right: 0.4rem; }
.cal-allday-label { padding-top: 0.45rem; }
.cal-grid-body { height: calc(var(--hours) * var(--hour)); }
.cal-hour { height: var(--hour); line-height: 1; padding-top: 0.15rem; font-variant-numeric: tabular-nums; }
.cal-col { position: relative; border-left: 1px solid var(--line); min-width: 0;
  background-image: repeating-linear-gradient(to bottom, var(--line) 0, var(--line) 1px, transparent 1px, transparent var(--hour)); }
.cal-col.cal-weekend { background-color: #fafbfc; }
.cal-timed { position: absolute; box-sizing: border-box; padding: 0.1rem 0.35rem; overflow: hidden; font-size: 0.78rem; line-height: 1.25;
  border-left: 3px solid var(--cal); background: var(--cal-wash); color: var(--ink); border-radius: 3px; text-decoration: none;
  box-shadow: 0 0 0 1px var(--paper); }
a.cal-timed:hover { background: var(--cal); color: #fff; z-index: 2; }
.cal-timed.cal-hidden { background: var(--head); color: var(--muted); font-weight: 600; text-align: center; border: 1px dashed var(--line); }
a.cal-timed.cal-hidden:hover { background: var(--brand-tint); color: var(--brand); }
.cal-ttl { font-weight: 600; }
.cal-loc { display: block; color: var(--muted); }
a.cal-timed:hover .cal-loc { color: inherit; }
.cal-now { position: absolute; left: 0; right: 0; border-top: 2px solid var(--danger); z-index: 3; pointer-events: none; }
.cal-now::before { content: ""; position: absolute; left: -4px; top: -5px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }
/* agenda */
.cal-list { max-width: 60rem; }
.cal-list-day h2 { font-size: 1rem; margin: 1.25rem 0 0.4rem; padding-bottom: 0.25rem; border-bottom: 1px solid var(--line); }
.cal-list-day ul { list-style: none; margin: 0; padding: 0; }
.cal-list-day li { display: grid; grid-template-columns: 7rem 12rem 1fr; gap: 0.75rem; align-items: baseline; padding: 0.35rem 0.5rem; border-left: 3px solid var(--cal); margin-bottom: 0.25rem; background: var(--paper); }
.cal-list-day li.cal-deadline .cal-what > a, .cal-list-day li.cal-deadline .cal-what { font-weight: 600; }
.cal-when { font-size: 0.88rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cal-pill { font-size: 0.78rem; color: var(--ink); background: var(--cal-wash); border: 1px solid var(--cal); border-radius: 999px; padding: 0 0.55rem; justify-self: start; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.cal-desc { display: block; font-size: 0.85rem; font-weight: 400; white-space: pre-line; }
/* Calendars (admin) */
.cal-url code { font-size: 0.78rem; word-break: break-all; }
.cal-add { max-width: 40rem; }
.cal-add input[type="color"] { width: 3rem; height: 2rem; padding: 0; }
.cal-builtin { list-style: none; padding: 0; }
.cal-builtin li { margin: 0.25rem 0; }
@media (max-width: 760px) {
  .cal-row { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .cal-day { min-height: 4.5rem; }
  .cal-event { font-size: 0.7rem; padding: 0.1rem 0.2rem; }
  .cal-month .cal-time, .cal-allday .cal-time { display: none; }
  .cal-list-day li { grid-template-columns: 1fr; gap: 0.15rem; }
  .cal-grid { --gutter: 2.6rem; }
  .cal-grid-week .cal-timed .cal-loc { display: none; }
  .cal-views a { padding: 0.35rem 0.5rem; }
}

/* Assets > Locations: the tree of sites, buildings and rooms. */
.locations-tree tr.depth-0 td:first-child { font-weight: 600; }
.locations-tree tr.depth-0 td { background: var(--wash); }
.locations-tree td.row-actions { white-space: nowrap; text-align: right; font-size: 0.85rem; }
.locations-tree td.row-actions a { margin-left: 0.75rem; }
.locations-tree td.row-actions a:first-child { margin-left: 0; }
.locations-sync { margin-top: 2rem; max-width: 48rem; }
.locations-sync p { margin: 0 0 0.6rem; }

/* --- Hardware refresh tables -------------------------------------------- */
/* A second line in a cell (department under a model, the reason under its
   heading). Scoped versions of this exist above; this is the general one. */
.d-block { display: block; }
.rf-table th, .rf-table td { vertical-align: top; }
.rf-table .rf-sub { display: block; margin-top: 0.1rem; font-size: 0.82rem; color: var(--muted); line-height: 1.35; }
.rf-table th.num, .rf-table td.num, .rf-table th.num a.sort { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rf-table td.nowrap, .rf-table th.nowrap { white-space: nowrap; }
.rf-table td.rf-model { min-width: 12rem; }
.rf-table td.rf-why { min-width: 16rem; max-width: 30rem; }
.rf-table td.rf-what { min-width: 18rem; }
.rf-table .rf-basis { font-weight: 600; font-size: 0.85rem; }
.rf-table .tag { margin-right: 0.3rem; }
/* === Manage access (templates/access.html) ===================================
   Two tabs: People, a grid with a row per person and a column per area, and
   Teams. In the grid a cell's tint is its level, so the page reads as a map
   of who can do what: none is left blank, view is a light blue wash, edit the
   brand tint. The selects drop their chevrons so a column stays narrow
   enough for all fourteen areas to fit a laptop screen. */
main.full.access-page { min-width: 0; }
.access-head { align-items: flex-end; margin-bottom: 0.25rem; }
.access-head .access-sync { margin: 0.2rem 0 0; color: var(--muted); font-size: 0.9rem; }
.access-head .access-sync .linkish { font-size: inherit; margin-left: 0.25rem; }
.access-head .page-actions { display: flex; align-items: center; gap: 0.6rem; }
.access-tabs { margin: 0.75rem 0 1.1rem; }
.access-tabs .tab-count { display: inline-block; min-width: 1.4rem; margin-left: 0.3rem; padding: 0 0.4rem;
  border-radius: 999px; background: var(--wash); color: var(--muted); font-size: 0.78rem; font-weight: 600;
  text-align: center; line-height: 1.45; }
.access-tabs [aria-current="page"] .tab-count { background: var(--brand-tint); color: var(--brand); }

/* The counts: buttons that filter the grid (static/access.js). */
.access-summary { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0 0 0.75rem; }
.access-summary button.acc-stat { background: var(--paper); color: var(--muted); border: 1px solid var(--line);
  border-radius: 999px; padding: 0.3rem 0.85rem; font-size: 0.88rem; font-weight: 400; cursor: pointer; }
.access-summary button.acc-stat strong { color: var(--ink); font-size: 1rem; margin-right: 0.15rem; }
.access-summary button.acc-stat:hover, .access-summary button.acc-stat:focus-visible { border-color: var(--brand); }
.access-summary button.acc-stat.on { border-color: var(--brand); background: var(--brand-tint); color: var(--brand); }
.access-summary button.acc-stat.on strong { color: var(--brand); }
.access-summary button.acc-stat.bad { border-color: var(--danger); background: var(--alert-wash); color: var(--danger); }
.access-summary button.acc-stat.bad strong { color: var(--danger); }

.access-filters { margin: 0 0 0.6rem; }
.access-filters input[type="search"] { flex: 2 1 16rem; }
.access-filters select { flex: 0 1 12rem; }

/* The bulk bar is one quiet line until a row is ticked; then its controls
   appear and it sticks to the top of the window while the grid scrolls. */
.access-bulk { position: sticky; top: 0.5rem; z-index: 5; margin: 0 0 0.6rem; }
.access-bulk:not(.has-selection) { border-style: dashed; background: transparent; padding-top: 0.35rem;
  padding-bottom: 0.35rem; }
.access-bulk:not(.has-selection) [data-bulk-count] { font-weight: 400; font-size: 0.88rem; }
.access-bulk:not(.has-selection) > :not([data-bulk-count]) { display: none; }
.access-bulk.has-selection { box-shadow: 0 6px 18px rgba(0, 72, 51, 0.12); }
.access-bulk .bulk-group { display: inline-flex; align-items: center; gap: 0.4rem; padding-left: 0.75rem;
  border-left: 1px solid var(--line); }
.access-bulk .bulk-remove { margin-left: auto; }

/* The key above the grid uses the cells' own tints. */
.access-key { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.5rem; margin: 0 0 0.5rem;
  font-size: 0.85rem; color: var(--muted); }
.access-key .key { display: inline-block; min-width: 3.2rem; padding: 0.05rem 0.5rem; border-radius: 4px;
  text-align: center; font-weight: 600; font-size: 0.8rem; }
.access-key .key + .key, .access-key .key-note { margin-left: 0.6rem; }
.access-key .key-none { background: var(--paper); border: 1px solid var(--line); color: #8a939c; font-weight: 400; }
.access-key .key-view { background: #e9f1fa; color: #1d4f86; }
.access-key .key-edit { background: var(--brand-tint); color: var(--brand); }
.access-key .key-note { margin-left: auto; }

/* The grid. It scrolls sideways inside its box on a narrow window, with the
   tick box and name pinned (overriding main.full .table-scroll above). */
main.full.access-page .access-scroll { overflow-x: auto; max-width: 100%; border: 1px solid var(--line);
  border-radius: 6px; background: var(--paper); }
.access-grid { --grid-head: #f6f7f9; width: 100%; margin: 0; border: 0; border-collapse: separate; border-spacing: 0; }
.access-grid thead th { background: var(--grid-head); border-bottom: 1px solid var(--line);
  font-size: 0.78rem; font-weight: 600; color: var(--muted); padding: 0.55rem 0.3rem; vertical-align: bottom; }
.access-grid th.lvl { text-align: center; white-space: normal; line-height: 1.2; width: 4rem; min-width: 4rem;
  cursor: help; }
.access-grid td { padding: 0.4rem 0.3rem; vertical-align: middle; border-bottom: 1px solid var(--line); }
.access-grid tbody tr:last-child td { border-bottom: 0; }
.access-grid th.who, .access-grid td.who { min-width: 12.5rem; max-width: 16rem; padding-left: 0.5rem; text-align: left; }
.access-grid td.who { vertical-align: top; padding-top: 0.55rem; padding-bottom: 0.55rem; }
.access-grid td.who .name { font-weight: 600; }
.access-grid .job { color: var(--muted); font-size: 0.8rem; margin-top: 0.05rem; line-height: 1.35; }
.access-grid .row-links { display: flex; flex-wrap: wrap; gap: 0.15rem 0.75rem; margin-top: 0.2rem; font-size: 0.78rem; }
.access-grid .row-links a, .access-grid .row-links button.linkish { color: var(--muted); font-size: inherit; }
.access-grid .row-links a:hover, .access-grid .row-links a:focus { color: var(--accent); }
.access-grid .row-links button.danger-link:hover, .access-grid .row-links button.danger-link:focus { color: var(--danger); }
.access-grid .row-links .count { color: var(--brand); font-weight: 600; }
.access-grid .tag { font-size: 0.68rem; margin-left: 0.25rem; vertical-align: 0.1em; }

/* A cell: the select is the whole cell, its text centred, no chevron. */
.access-grid select.lvl-select:not([multiple]) { -webkit-appearance: none; appearance: none; background-image: none;
  width: 100%; min-width: 0; margin: 0; min-height: 2rem; padding: 0.2rem 0.25rem; border: 1px solid transparent;
  border-radius: 4px; background-color: transparent; font-size: 0.8rem; text-align: center; text-align-last: center;
  cursor: pointer; }
.access-grid select.lvl-select:not([multiple]):hover { border-color: var(--line); background-color: var(--paper); }
.access-grid select.lvl-select:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.access-grid td.lvl { padding: 0.25rem 0.2rem; border-left: 1px solid #eef0f3; }
.access-grid td.lvl-none select { color: #9aa2aa; }
.access-grid td.lvl-view { background: #e9f1fa; }
.access-grid td.lvl-view select { color: #1d4f86; font-weight: 600; }
.access-grid td.lvl-edit { background: var(--brand-tint); }
.access-grid td.lvl-edit select { color: var(--brand); font-weight: 700; }
.access-grid td.role { padding-right: 0.5rem; }
.access-grid td.role select.lvl-select:not([multiple]) { min-width: 4.8rem; border-color: var(--line); background-color: var(--paper); }
.access-grid select.role-admin { color: var(--brand); font-weight: 700; }
.access-grid td.all-areas { color: var(--brand); background: var(--brand-tint); font-size: 0.85rem; text-align: center;
  border-left: 1px solid #eef0f3; }
.access-grid tr.selected td { box-shadow: inset 0 0 0 999px rgba(0, 72, 51, 0.06); }
.access-grid tr.alert td { background: var(--alert-wash); }
.access-grid tr.fresh td.who { box-shadow: inset 3px 0 0 var(--gold); }
.access-grid tr.htmx-request { opacity: 0.6; }
.access-grid tr.cap-row td, .access-grid tr.empty-row td { text-align: center; padding: 1rem; }
.access-grid th.select, .access-grid td.select { position: sticky; left: 0; z-index: 2; width: 2rem;
  padding-left: 0.6rem; }
.access-grid td.select, .access-grid td.who { background: var(--paper); }
.access-grid th.who, .access-grid td.who { position: sticky; left: 2rem; z-index: 2; box-shadow: 1px 0 0 var(--line); }
.access-grid thead th.select, .access-grid thead th.who { z-index: 3; background: var(--grid-head); }
.access-grid tr.alert td.select, .access-grid tr.alert td.who { background: var(--alert-wash); }
.access-grid tr.selected td.select, .access-grid tr.selected td.who { background: #eef4f1; box-shadow: 1px 0 0 var(--line); }

/* Give people access: a panel. */
.grant-form label { display: flex; flex-direction: column; gap: 0.3rem; font-weight: 600; }
.grant-form input[type="text"] { width: 100%; font-weight: 400; }

/* -- Teams tab (partials/access_teams.html) -- */
.access-teams .teams-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 0.75rem 2rem; margin-bottom: 1.25rem; }
.access-teams .teams-bar p { margin: 0; max-width: 34rem; font-size: 0.92rem; }
.team-add { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 0; }
.team-add input[name="name"] { width: 12rem; }
.team-add input[name="description"] { width: 16rem; }
.access-teams > .flash-inline { margin: 0 0 1rem; }
.team-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); gap: 1rem; align-items: start; }
.team-card { display: flex; flex-direction: column; gap: 0.7rem; background: var(--paper); border: 1px solid var(--line);
  border-top: 3px solid var(--brand); border-radius: 6px; padding: 0.85rem 1rem 0.75rem; }
.team-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.75rem; }
.team-card-head h2 { margin: 0; font-size: 1.08rem; }
.team-count { color: var(--muted); font-size: 0.85rem; white-space: nowrap; }
.team-desc { margin: -0.4rem 0 0; color: var(--muted); font-size: 0.88rem; }
.team-members { list-style: none; margin: 0; padding: 0; }
.team-members li { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  padding: 0.3rem 0; border-bottom: 1px solid #eef0f3; }
.team-members li:last-child { border-bottom: 0; }
.team-members .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-members .tag { font-size: 0.68rem; margin-left: 0.2rem; }
button.linkish.team-remove { text-decoration: none; color: var(--muted); font-size: 1.15rem; line-height: 1;
  padding: 0 0.3rem; }
button.linkish.team-remove:hover, button.linkish.team-remove:focus-visible { color: var(--danger); }
.team-empty { margin: 0; color: var(--muted); font-size: 0.88rem; }
.team-empty-all { color: var(--muted); padding: 2.5rem 1rem; text-align: center; border: 1px dashed var(--line);
  border-radius: 6px; background: var(--paper); }
.team-member-add { display: flex; gap: 0.5rem; margin: 0; }
.team-member-add select { flex: 1; min-width: 0; }
.team-card-foot { display: flex; justify-content: space-between; gap: 1rem; padding-top: 0.6rem;
  border-top: 1px solid #eef0f3; font-size: 0.85rem; }
.team-card-foot a, .team-card-foot .linkish { color: var(--muted); font-size: inherit; }
.team-card-foot a:hover, .team-card-foot .linkish:hover { color: var(--accent); }
.team-card-foot .linkish:only-child { margin-left: auto; }

@media (max-width: 48rem) {
  .access-key .key-note { margin-left: 0; flex-basis: 100%; }
  .access-grid th.who, .access-grid td.who { min-width: 11rem; }
}
.grant-note { margin-top: 1rem; }

/* Admin > AI prompts (templates/assistant/prompt.html): the prompt beside its test. */
.aip { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 1.5rem; align-items: start; }
@media (max-width: 900px) { .aip { grid-template-columns: 1fr; } }
.aip-text { width: 100%; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 0.85rem;
  line-height: 1.45; resize: vertical; }
.aip-dirty { color: var(--danger); font-weight: 600; }
.aip-test { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 0.75rem 1rem; }
.aip-test h2 { margin-top: 0; }
.aip-out { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 32rem; overflow: auto; font-size: 0.85rem;
  background: var(--wash); border: 1px solid var(--line); border-radius: 6px; padding: 0.6rem 0.8rem; }

/* New help desk tickets (static/helpdesk_alerts.js): slide in from the right. */
.toast.ticket-alert { border-left-color: var(--brand); align-items: center; animation: ticket-alert-in 0.35s ease-out; }
.toast.ticket-alert.leaving { opacity: 0; transform: translateX(110%); transition: opacity 0.25s, transform 0.25s; }
.ticket-alert-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.1rem;
  color: inherit; text-decoration: none; }
.ticket-alert-body:hover strong, .ticket-alert-body:focus strong { text-decoration: underline; color: var(--brand); }
.ticket-alert-kicker { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--brand); }
.ticket-alert-body strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ticket-alert-detail { font-size: 0.85rem; color: var(--muted); }
@keyframes ticket-alert-in { from { opacity: 0; transform: translateX(110%); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .toast.ticket-alert { animation: none; } }

/* A booking still waiting for IT: faded, so it reads as not yet agreed. */
.cal-pending { opacity: .6; }

/* Manage team: a person's line managers, ticked in a popover from their row. A popover sits
   in the browser's top layer, in the middle of the window, so the table never clips it. */
.lm-pop { width: min(22rem, calc(100vw - 2rem)); padding: 1rem; margin: auto; border: 1px solid var(--line);
  border-radius: 8px; background: var(--paper); color: var(--ink); box-shadow: var(--shadow); }
.lm-pop::backdrop { background: rgba(27, 31, 35, 0.25); }
.lm-panel { margin: 0; }
.lm-title { margin: 0 0 0.5rem; font-weight: 650; font-size: 1rem; }
.lm-list { max-height: 18rem; overflow-y: auto; display: flex; flex-direction: column; gap: 0.2rem; margin-bottom: 0.6rem; }
.lm-list label { display: flex; align-items: center; gap: 0.5rem; font-size: 0.92rem; font-weight: 400; }
.lm-help { margin: 0 0 0.75rem; color: var(--muted); font-size: 0.82rem; }
