/* Premises Audit. Phone first (PLAN.md 5c); no inline styles (CSP). */

:root {
  --bg: #f2f4f7;
  --surface: #ffffff;
  --text: #1c2430;
  --muted: #5b6573;
  --line: #d9dee5;
  --accent: #1f5f8b;
  --accent-text: #ffffff;
  --danger: #b3261e;
  --ok: #1e7b34;
  --warn-bg: #fff4d6;
  --radius: 12px;
  --tap: 44px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161c;
    --surface: #1b2129;
    --text: #e7ebf0;
    --muted: #9aa5b3;
    --line: #2f3843;
    --accent: #5fa8dc;
    --accent-text: #0b1520;
    --danger: #ff8a80;
    --ok: #7bd88f;
    --warn-bg: #3a3214;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

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

.dev-banner {
  background: #b3261e;
  color: #fff;
  text-align: center;
  font-weight: 600;
  padding: 4px 16px;
  font-size: 13px;
}

/* The shell: a menu down the left on a desktop; on a phone a top bar, a
   menu that slides in (opened by linking to #menu, so it works without
   JavaScript) and, inside a premises, a tab bar within thumb reach. */

:root {
  --nav-bg: #17324d;
  --nav-text: #d6e2ee;
  --nav-muted: #8fa6bc;
  --nav-on: #24496c;
  --nav-w: 280px;
  --tabbar-h: 62px;
  --shadow: 0 1px 2px rgba(16, 32, 48, .06), 0 2px 8px rgba(16, 32, 48, .05);
}
@media (prefers-color-scheme: dark) {
  :root { --nav-bg: #0d1722; --nav-on: #1b2f44; --shadow: none; }
}

.icon { width: 22px; height: 22px; flex: none; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  width: var(--nav-w);
  display: flex;
  flex-direction: column;
  background: var(--nav-bg);
  color: var(--nav-text);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.sidebar a { color: inherit; text-decoration: none; }
.sidebar-top { display: flex; align-items: center; justify-content: space-between; padding: 18px 16px 10px 18px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; color: #fff !important; }
.brand small { display: block; font-weight: 400; font-size: 12px; color: var(--nav-muted); }
.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #3f8fd0;
  color: #fff;
  font-size: 14px;
  letter-spacing: .02em;
}
.menu-close { display: none; padding: 8px; border-radius: 8px; }
.nav { display: grid; gap: 2px; padding: 6px 10px 16px; }
.nav-heading { margin: 16px 10px 4px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--nav-muted); }
.nav-link { display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 8px 10px; border-radius: 8px; font-size: 15px; }
.nav-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-link:hover, .nav-sub a:hover { background: rgba(255, 255, 255, .06); }
.nav-link.on, .nav-link.here { background: var(--nav-on); color: #fff; }
.nav-link.on { box-shadow: inset 3px 0 0 #6cb4ee; }
.nav-sub { display: grid; gap: 1px; margin: 2px 0 8px 22px; padding-left: 12px; border-left: 1px solid rgba(255, 255, 255, .14); }
.nav-sub > a { padding: 7px 10px; border-radius: 6px; font-size: 14px; color: var(--nav-text); }
.nav-sub > a.on { background: var(--nav-on); color: #fff; font-weight: 600; }
.nav-sections { display: grid; gap: 1px; margin: 2px 0 6px; padding: 4px 0; }
.nav-sections a { display: grid; grid-template-columns: 34px 1fr auto; gap: 6px; align-items: center; padding: 4px 8px; border-radius: 6px; font-size: 13px; color: var(--nav-muted); }
.nav-sections a.on { background: rgba(108, 180, 238, .18); color: #fff; }
.nav-sections a.off { opacity: .55; }
.sec-id { font-weight: 700; font-variant-numeric: tabular-nums; }
.sec-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sec-state { font-size: 11px; font-variant-numeric: tabular-nums; }
.sec-state.done { color: #7bd88f; }
.sec-state.gap { min-width: 18px; padding: 0 5px; border-radius: 999px; background: #d9443a; color: #fff; text-align: center; font-weight: 700; }
.sidebar-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 16px 16px; border-top: 1px solid rgba(255, 255, 255, .1); font-size: 14px; }
.sidebar-foot .who { display: flex; align-items: center; gap: 8px; min-width: 0; }
.sidebar-foot .who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-foot button.link { color: var(--nav-muted); }
.scrim { display: none; }

.topbar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 20;
  align-items: center;
  gap: 4px;
  min-height: 56px;
  padding: 4px 12px 4px 4px;
  background: var(--nav-bg);
  color: #fff;
}
.topbar a { color: inherit; text-decoration: none; }
.menu-open { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 10px; }
.topbar-title { min-width: 0; font-weight: 700; font-size: 17px; line-height: 1.2; }
.topbar-title span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-title small { display: block; font-weight: 400; font-size: 12px; color: var(--nav-muted); }

.tabbar { display: none; }

body.has-nav { padding-left: var(--nav-w); }
.page { max-width: 1180px; margin: 0 auto; padding: 24px 32px 48px; }
.page.narrow { max-width: 940px; }

@media (max-width: 1023px) {
  body.has-nav { padding-left: 0; }
  .topbar { display: flex; }
  .page { padding: 16px 16px 32px; }
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: 4px 0 24px rgba(0, 0, 0, .3); width: min(320px, 86vw); }
  .sidebar:target { transform: none; }
  .sidebar:target ~ .scrim { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(8, 16, 24, .45); }
  .menu-close { display: grid; color: var(--nav-text); }
  .wide-only { display: none; }
  /* The top bar and tab bar say where you are. */
  p.crumbs:has(a) { display: none; }

  body.has-tabbar { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
  .tabbar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    position: fixed;
    inset: auto 0 0 0;
    z-index: 15;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--surface);
    border-top: 1px solid var(--line);
    box-shadow: 0 -2px 10px rgba(16, 32, 48, .06);
  }
  .tabbar a { display: grid; justify-items: center; align-content: center; gap: 2px; color: var(--muted); text-decoration: none; font-size: 12px; font-weight: 600; }
  .tabbar a.on { color: var(--accent); }
  .tabbar a.on .icon { stroke-width: 2.4; }
  .has-tabbar .stamp-bar { bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
}

@media print {
  .sidebar, .topbar, .tabbar, .scrim, .stamp-bar { display: none !important; }
  body.has-nav { padding: 0; }
}

h1 { font-size: 28px; line-height: 1.2; margin: 4px 0 18px; letter-spacing: -.01em; }
h2 { font-size: 19px; margin: 0 0 12px; }
@media (max-width: 600px) { h1 { font-size: 24px; } }

.title-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.title-row h1 { margin-right: auto; }

.crumbs { color: var(--muted); font-size: 14px; margin: 0; }
.lead { font-size: 18px; color: var(--muted); }
.hint { display: block; color: var(--muted); font-size: 14px; font-weight: 400; }
.error { display: block; color: var(--danger); font-weight: 600; }
.ok { color: var(--ok); font-weight: 600; }
.notice { background: var(--warn-bg); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin-bottom: 16px;
}
@media (max-width: 600px) { .panel { padding: 16px; } }

.tag {
  display: inline-block;
  font-size: 12px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--muted);
  margin-left: 4px;
}
.tag.warn { background: var(--warn-bg); }

/* Buttons and forms ---------------------------------------------------- */

button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  padding: 0 18px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-text);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
button.secondary, .button.secondary { background: transparent; color: var(--accent); }
button.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
button.link {
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font-weight: 400;
  text-decoration: underline;
}

form.inline { display: inline; }
.stack { display: grid; gap: 16px; }
.stack > label, fieldset { display: grid; gap: 4px; font-weight: 600; }
.row { display: flex; flex-wrap: wrap; gap: 8px; }
.row input, .row select { flex: 1 1 200px; }
.actions { display: flex; align-items: center; gap: 16px; }

input, select, textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 400;
}
textarea { min-height: 120px; }

fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; margin: 0; }
legend { padding: 0 4px; }

.choice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 8px 0;
  font-weight: 400;
}
.choice input { width: 22px; min-height: 22px; margin-top: 2px; flex: none; }

/* Lists ------------------------------------------------------------------ */

.cards, .people, .plain, .history { list-style: none; padding: 0; margin: 0; }

.cards { display: grid; gap: 12px; }
.card a {
  display: grid;
  gap: 2px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
}
.card a:hover { border-color: var(--accent); }
.meta { color: var(--muted); font-size: 14px; }

.people { display: grid; gap: 8px; }
.person {
  width: 100%;
  display: grid;
  justify-items: start;
  gap: 2px;
  padding: 12px 16px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  text-align: left;
}
.person span { font-weight: 400; color: var(--muted); font-size: 14px; }
.person:hover { border-color: var(--accent); }

.plain li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.plain li:last-child { border-bottom: 0; }

.history li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.history li:last-child { border-bottom: 0; }
.history .when { display: block; font-size: 13px; color: var(--muted); }
.history ul { margin: 4px 0 0; padding-left: 20px; font-size: 14px; }
.history ul li { padding: 0; border: 0; }

.details { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.details dt { color: var(--muted); }
.details dd { margin: 0; }
@media (max-width: 480px) {
  .details { grid-template-columns: 1fr; }
  .details dd { margin-bottom: 8px; }
}

table.list { width: 100%; border-collapse: collapse; background: var(--surface); }
table.list th, table.list td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); }
table.list tr.inactive td { color: var(--muted); }
@media (max-width: 600px) {
  table.list thead { display: none; }
  table.list tr { display: grid; padding: 8px 0; border-bottom: 1px solid var(--line); }
  table.list td { border: 0; padding: 2px 8px; }
}

code.hash { word-break: break-all; font-size: 13px; }

/* The audit record ------------------------------------------------------- */

h3 { font-size: 16px; margin: 16px 0 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

:root {
  --critical: #b3261e;
  --critical-bg: #fde8e6;
  --high: #9a5b00;
  --high-bg: #fff1d6;
  --standard: #3d5a73;
  --standard-bg: #e7eef4;
  --review-bg: #fff4d6;
  --done-bg: #e3f4e6;
  --na-bg: #eef0f3;
}
@media (prefers-color-scheme: dark) {
  :root {
    --critical: #ff8a80;
    --critical-bg: #3b1715;
    --high: #ffc56b;
    --high-bg: #3a2a0d;
    --standard: #a8c3da;
    --standard-bg: #1e2b36;
    --review-bg: #3a3214;
    --done-bg: #173322;
    --na-bg: #222831;
  }
}

.sev, .badge, .flag {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.sev-critical.sev { background: var(--critical-bg); color: var(--critical); }
.sev-high.sev { background: var(--high-bg); color: var(--high); }
.sev-standard.sev { background: var(--standard-bg); color: var(--standard); }
.badge { border: 1px solid var(--line); color: var(--muted); font-weight: 500; }
.flag.gap { background: var(--critical); color: #fff; }
.flag.review { background: var(--review-bg); color: var(--text); }
.flag.action { background: var(--high-bg); color: var(--high); }
.flag.done { background: var(--done-bg); color: var(--ok); }

.prompt {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 6px solid var(--standard);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 14px;
  scroll-margin-top: 16px;
}
.prompt.sev-critical { border-left-color: var(--critical); }
.prompt.sev-high { border-left-color: var(--high); }
.prompt.is-gap { box-shadow: 0 0 0 1px var(--critical) inset; }
/* A saved N/A: just the prompt, the answer and why it doesn't apply. */
.prompt.is-na { background: var(--na-bg); border-left-color: var(--line); }
.prompt.is-na .q { font-size: 15px; font-weight: 500; margin: 6px 0; }
.prompt.is-na :is(.scouts-hint, .our-note, .guidance, .na-quick, .agreed-with, .agreed, .controls-block,
  .actions-list, .add-action, .comments-wrap:not(.keep), .notes-field:not(.filled)) { display: none; }
.prompt.is-na .prompt-head .badge, .prompt.is-na .prompt-head .sev { display: none; }
.prompt-head { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pid { font-weight: 700; font-variant-numeric: tabular-nums; margin-right: 4px; }
.prompt .q { font-size: 17px; font-weight: 600; margin: 10px 0; white-space: pre-line; }
.scouts-hint { margin: -4px 0 10px; color: var(--muted); font-style: italic; white-space: pre-line; }
.guidance { margin: 0 0 12px; }
.guidance summary { cursor: pointer; color: var(--accent); }
.guidance p { margin: 8px 0; }
.laws { margin: 0; padding-left: 20px; }

.answer { display: grid; gap: 12px; }
.answer label, .add-action label { display: grid; gap: 4px; font-weight: 600; }
.ypn { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; border: 0; padding: 0; }
.ypn label { display: block; }
.ypn input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ypn span {
  display: grid;
  place-items: center;
  min-height: 56px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
}
.ypn small { font-size: 11px; font-weight: 500; color: var(--muted); }
.ypn input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }
.ypn-Y input:checked + span { background: var(--done-bg); border-color: var(--ok); color: var(--ok); }
.ypn-P input:checked + span { background: var(--high-bg); border-color: var(--high); color: var(--high); }
.ypn-N input:checked + span { background: var(--critical-bg); border-color: var(--critical); color: var(--critical); }
.ypn-NA input:checked + span { background: var(--standard-bg); border-color: var(--standard); color: var(--standard); }
.na-reason { display: none !important; }
.answer:has(input[value="NA"]:checked) .na-reason { display: grid !important; }

.save-state { margin: 0; font-size: 14px; min-height: 20px; }
.save-state span { display: none; }
article[data-state="saving"] .when-saving { display: inline; color: var(--muted); }
article[data-state="saved"] .when-saved { display: inline; color: var(--ok); }
article[data-state="unsaved"] .when-unsaved { display: inline; color: var(--danger); font-weight: 600; }
article[data-state="unsaved"] { border-color: var(--danger); }

.answer-ro { margin: 0 0 4px; display: flex; gap: 12px; flex-wrap: wrap; }
.ans { padding: 2px 10px; border-radius: 6px; }
.ans-Y { background: var(--done-bg); color: var(--ok); }
.ans-P { background: var(--high-bg); color: var(--high); }
.ans-N { background: var(--critical-bg); color: var(--critical); }
.ans-NA { background: var(--standard-bg); color: var(--standard); }
.notes { white-space: pre-line; margin: 4px 0; }
.agreed { margin: 8px 0 0; }
.confirm { margin-top: 8px; align-items: center; }
.conflict { background: var(--review-bg); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 12px; }

.actions-list { list-style: none; padding: 0; margin: 12px 0 0; }
.actions-list li { padding: 6px 0; border-top: 1px solid var(--line); }
.actions-list li.done a { text-decoration: line-through; color: var(--muted); }
.add-action { margin-top: 12px; }
.add-action summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.add-action form { margin-top: 10px; }

.card-section { margin: 20px 0 6px; font-size: 14px; color: var(--muted); font-weight: 600; }

.progress-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 8px; }
.progress-grid > div { display: grid; gap: 4px; justify-items: start; }
progress { width: 100%; height: 10px; accent-color: var(--accent); }

.filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 16px; }
.filters a {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  text-decoration: none;
  color: var(--text);
  background: var(--surface);
  font-size: 14px;
}
.filters a.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }

.sections { list-style: none; padding: 0; margin: 0; }
.sections li { border-top: 1px solid var(--line); }
.sections li:first-child { border-top: 0; }
.sections a {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 12px;
  padding: 10px 0;
  color: var(--text);
  text-decoration: none;
}
.sections li.off a { color: var(--muted); }
.counts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

.asat-banner {
  background: var(--standard-bg);
  border: 2px solid var(--standard);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 16px;
}
.pager { display: flex; justify-content: space-between; gap: 16px; margin: 24px 0; }
.section-picks { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); padding-left: 34px; }
.request { border-top: 1px solid var(--line); padding-top: 8px; }

/* Controls and files ------------------------------------------------------ */

.controls-block { margin-top: 14px; padding-top: 10px; border-top: 1px dashed var(--line); }
.controls-block h4 { margin: 0 0 6px; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.control-list, .file-list, .setup-list { list-style: none; padding: 0; margin: 0 0 8px; }
.control-list li { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; padding: 6px 0; border-top: 1px solid var(--line); }
.control-list li:first-child { border-top: 0; }
.control-list.big li { padding: 10px 0; }
.control-list li.overdue { border-left: 4px solid var(--critical); padding-left: 8px; }
.control-list li.soon { border-left: 4px solid var(--high); padding-left: 8px; }
.due { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.due-overdue { background: var(--critical); border-color: var(--critical); color: #fff; font-weight: 600; }
.due-soon { background: var(--high-bg); border-color: var(--high); color: var(--high); font-weight: 600; }
.chip {
  display: inline-block;
  padding: 6px 12px;
  margin: 2px 4px 2px 0;
  border: 1px dashed var(--accent);
  border-radius: 999px;
  color: var(--accent);
  text-decoration: none;
  font-size: 14px;
}
.add-controls { margin: 6px 0; }
button.chip { min-height: var(--tap); padding: 4px 14px; border-radius: 999px; background: transparent; color: var(--accent); font-weight: 500; text-align: left; }
.na-quick { margin: 0; }
.add-file summary, .inline-details summary { cursor: pointer; color: var(--accent); font-size: 14px; }
.add-file form { margin-top: 8px; }
.file-list li { padding: 4px 0; }
.setup-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.flag-line { margin: 0 0 6px; }
.inline-details { display: inline-block; margin-left: 8px; }
.inline-details form { margin-top: 6px; }

/* Trustee oversight ------------------------------------------------------- */

.flag.changed { background: var(--standard-bg); color: var(--standard); }
.flag.comment { background: var(--standard); color: var(--surface); }
.comments { margin-top: 12px; padding-top: 8px; border-top: 1px dashed var(--line); }
.thread { border-left: 3px solid var(--standard); padding: 2px 0 2px 10px; margin: 8px 0; }
.thread.resolved { border-left-color: var(--line); }
.comment { margin: 4px 0; }
.comment .body { display: block; white-space: pre-line; }
.comment.reply { margin-left: 16px; }
.thread-actions { align-items: center; }
.add-comment { margin-left: 0; }
.stamp-bar {
  position: sticky;
  bottom: 0;
  background: var(--surface);
  border-top: 2px solid var(--accent);
  padding: 10px 16px;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, .08);
}
.stamp-bar form { align-items: center; max-width: 860px; margin: 0 auto; }
.stamp-bar .hint { max-width: 860px; margin: 4px auto 0; }
.stamp-q { flex: 1 1 100%; }
.stamp-bar.dismissed { display: none; }
.whats {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid var(--line);
  font-size: 12px;
  text-decoration: none;
}
.table-wrap { overflow-x: auto; margin-bottom: 16px; }
.trustee-table td .flag { margin-top: 2px; }
.trustee-table progress { width: 60px; }

/* Admin editors: tables of inputs scroll sideways on a phone rather than stacking. */
.edit-table { width: 100%; min-width: 640px; border-collapse: collapse; }
.edit-table th, .edit-table td { text-align: left; padding: 4px; vertical-align: middle; font-weight: 400; }
.edit-table th { font-size: 13px; color: var(--muted); }
.edit-table input[type="checkbox"], table.list input[type="checkbox"] { width: 22px; min-height: 22px; }
pre.email { white-space: pre-wrap; word-break: break-word; font: inherit; }
/* Audit versions: a base with its one line of versions underneath. */
.tree { list-style: none; margin: 0; padding: 0; }
.tree li { position: relative; padding: 6px 0; }
.tree li.branch { margin-left: 22px; padding-left: 18px; border-left: 2px solid var(--line); }
.tree li.branch::before { content: ""; position: absolute; left: 0; top: 50%; width: 12px; border-top: 2px solid var(--line); }
.tree-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.tree-name { font-weight: 700; }
.tree li.next form { margin: 0; }
.q-cell { white-space: pre-line; }
table.compare td { vertical-align: top; width: 50%; }
table.compare td p { margin: 0 0 6px; }
/* Our note: the tool's own help, set apart from the Scouts wording. */
.our-note { margin: 0 0 12px; padding: 8px 12px; border-left: 3px solid var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); border-radius: 4px; font-size: 15px; white-space: pre-line; }

/* Moving between sections: a bar that stays at the top as you scroll, with
   the list of sections to jump to. */
.section-bar {
  position: sticky;
  top: 0;
  z-index: 12;
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  gap: 4px;
  margin: -8px 0 16px;
  padding: 6px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(6px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.sb-step { display: grid; place-items: center; height: 44px; border-radius: 10px; color: var(--accent); }
a.sb-step:hover { background: var(--bg); }
.section-jump { position: relative; min-width: 0; }
.section-jump summary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 8px;
  border-radius: 10px;
  cursor: pointer;
  list-style: none;
  font-weight: 600;
}
.section-jump summary::-webkit-details-marker { display: none; }
.section-jump summary:hover { background: var(--bg); }
.section-jump summary .icon { width: 18px; height: 18px; color: var(--muted); }
.sb-id { font-weight: 800; }
.sb-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-count { flex: none; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.jump-list {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: calc(100% + 8px);
  width: min(420px, calc(100vw - 32px));
  max-height: 60vh;
  overflow-y: auto;
  display: grid;
  gap: 1px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(16, 32, 48, .18);
}
.jump-list a { display: grid; grid-template-columns: 38px 1fr auto; gap: 8px; align-items: center; min-height: 40px; padding: 4px 10px; border-radius: 8px; color: var(--text); text-decoration: none; font-size: 15px; }
.jump-list a:hover { background: var(--bg); }
.jump-list a.on { background: var(--standard-bg); font-weight: 600; }
.jump-list a.off { color: var(--muted); }
.jump-list .sec-state { color: var(--muted); font-size: 12px; }
.jump-list .sec-state.done { color: var(--ok); }
.pager .button { gap: 6px; }
.pager .icon { width: 18px; height: 18px; }

@media (max-width: 1023px) {
  .section-bar { top: 56px; margin: -6px -6px 14px; }
  .prompt .q { font-size: 16px; }
  .our-note { font-size: 14px; }
  .prompt { padding: 14px; }
}

/* The premises list: a card each, with what needs attention. */
.premises-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
@media (max-width: 600px) { .premises-grid { grid-template-columns: 1fr; } }
.premises-card {
  display: grid;
  gap: 10px;
  height: 100%;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 4px solid var(--ok);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--text);
  text-decoration: none;
}
.premises-card.has-gaps { border-top-color: var(--critical); }
.premises-card:hover { border-color: var(--accent); }
.pc-head { display: flex; gap: 12px; align-items: flex-start; }
.pc-icon { display: grid; place-items: center; width: 42px; height: 42px; flex: none; border-radius: 10px; background: var(--standard-bg); color: var(--standard); }
.pc-title { display: grid; gap: 2px; font-size: 17px; }
.pc-progress { display: grid; gap: 2px; }
.pc-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.stat { padding: 6px 10px; border-radius: 8px; background: var(--bg); font-size: 13px; color: var(--muted); }
.stat b { display: block; font-size: 20px; line-height: 1.2; color: var(--text); }
.stat.bad { background: var(--critical-bg); color: var(--critical); }
.stat.bad b { color: var(--critical); }
.stat.warn { background: var(--high-bg); color: var(--high); }
.stat.warn b { color: var(--high); }

/* A premises' dashboard: figures to tap, what to do next, then the work
   (left) beside details and oversight (right; underneath on a phone). */
.title-block h1 { margin-bottom: 2px; }
.title-block .meta { margin: 0 0 16px; }
.tiles { display: grid; gap: 10px; grid-template-columns: repeat(5, 1fr); margin-bottom: 14px; }
@media (max-width: 1200px) { .tiles { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 600px) { .tiles { grid-template-columns: 1fr 1fr; } .tiles .tile:last-child { grid-column: span 2; } }
.tile {
  display: grid;
  gap: 2px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
}
.tile b { font-size: 28px; line-height: 1.1; color: var(--text); font-variant-numeric: tabular-nums; }
.tile:hover { border-color: var(--accent); }
.tile.bad { background: var(--critical-bg); border-color: color-mix(in srgb, var(--critical) 40%, transparent); color: var(--critical); }
.tile.bad b { color: var(--critical); }
.tile.warn { background: var(--high-bg); border-color: color-mix(in srgb, var(--high) 35%, transparent); color: var(--high); }
.tile.warn b { color: var(--high); }
.quick { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
@media (max-width: 600px) {
  .quick { display: grid; grid-template-columns: 1fr 1fr; }
  .quick .button:first-child { grid-column: span 2; min-height: 52px; font-size: 17px; }
}
.dash { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); align-items: start; }
@media (max-width: 1100px) { .dash { grid-template-columns: 1fr; } }
.gap-list { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 8px; }
.gap-list a {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border-left: 4px solid var(--critical);
  background: var(--critical-bg);
  color: var(--text);
  text-decoration: none;
}
.gap-list .hint { grid-column: 2; }
.gap-list a:hover { box-shadow: 0 0 0 1px var(--critical) inset; }
.dash-side .details { grid-template-columns: 1fr; gap: 0; }
.dash-side .details dt { font-size: 13px; margin-top: 8px; }

/* Tables on a phone: each row a card, each cell with its column name. */
@media (max-width: 600px) {
  table.list tr { gap: 2px 12px; grid-template-columns: 1fr 1fr; padding: 12px 4px; }
  table.list td:not([data-label]) { grid-column: 1 / -1; }
  table.list td[data-label]::before { content: attr(data-label); display: block; font-size: 12px; color: var(--muted); }
  .trustee-table td:first-child { font-size: 17px; }
}

progress {
  appearance: none;
  height: 8px;
  border: 0;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}
progress::-webkit-progress-bar { background: var(--line); border-radius: 999px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 999px; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 999px; }
table.list td.cell-main a { font-weight: 600; }
table.list { border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
table.list th { font-size: 13px; color: var(--muted); font-weight: 600; background: var(--bg); }

.page.signin { max-width: 560px; padding-top: 40px; }
.signin-brand { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 18px; margin: 0 0 24px; }
.signin-brand small { display: block; font-weight: 400; font-size: 13px; color: var(--muted); }
button.person { display: grid; justify-content: start; justify-items: start; min-height: 60px; box-shadow: var(--shadow); }
.pick-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0 16px; max-height: 320px; overflow-y: auto; }
.pick-list .choice { padding: 6px 0; }

/* Choosing people: name tags, and a search that lists matches to add. */
.picker { gap: 10px; }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.person-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 4px 4px 14px;
  border-radius: 999px;
  background: var(--standard-bg);
  color: var(--text);
  font-weight: 600;
}
.person-chip button {
  min-height: 32px;
  width: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
}
.person-chip button:hover { background: var(--surface); color: var(--danger); }
.picker-search { position: relative; }
.picker-results {
  position: absolute;
  z-index: 5;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  list-style: none;
  margin: 0;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(16, 32, 48, .18);
}
.picker-results li { display: grid; gap: 0; padding: 8px 10px; border-radius: 8px; font-weight: 400; }
.picker-results li[role=option] { cursor: pointer; }
.picker-results li[role=option]:hover, .picker-results li.on { background: var(--standard-bg); }
.picker .hint, .picker p { font-weight: 400; }
.picker-results { max-height: 50vh; overflow-y: auto; }
