/* Report binder: the shared look of every dr.ccnt.ca screen.
   Navy shell over a grey desk; each step is a white sheet joined to a coloured divider tab.
   Tab colours do wayfinding only and always sit beside a number and a name; state is ink plus words.
   Light only, on purpose: writers work in office daylight and outdoors in sun. */

@font-face {
  font-family: "Atkinson Hyperlegible Next";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("../fonts/atkinson-hyperlegible-next-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("../fonts/atkinson-hyperlegible-next-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: light;
  --shell: #1f3a5f;
  --shell-ink: #ffffff;
  --shell-soft: #d6e0ec;
  --desk: #dfe3e7;
  --sheet: #fdfdfb;
  --ink: #1a1f26;
  --ink-soft: #3b434d;      /* 10:1 on the sheet: secondary text is still dark */
  --rule: #8a939d;          /* 3.2:1 on the sheet: borders that stay visible in sunlight */
  --rule-soft: #c4cad1;
  --tint: #f1f3f5;
  --focus: #1f3a5f;

  --tab-report: #2d4f7f;
  --tab-checks: #c98a00;
  --tab-components: #2f7a4f;
  --tab-funding: #5b4a8b;
  --tab-final: #1d6670;
  --tab-export: #a8432f;

  --ok: #1d6b40;    --ok-bg: #e7f3ec;
  --bad: #9a2c1c;   --bad-bg: #fbeee9;
  --ask: #7a5300;   --ask-bg: #fdf3dc;
  --info: #1f3a5f;  --info-bg: #e8eef6;

  --font: "Atkinson Hyperlegible Next", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --step-0: 1.1875rem;  /* 19px body */
  --step--1: 1.125rem;  /* 18px: the smallest text anywhere (PRODUCT.md floor) */
  --step-1: 1.4375rem;  /* 23px */
  --step-2: 1.75rem;    /* 28px */
  --step-3: 2.125rem;   /* 34px */
  --figure: 2.75rem;    /* 44px: the one number a sheet is about */
  --radius: 0.625rem;
  --gap: 1.25rem;
  --target: 3rem;       /* 48px minimum for anything you can press */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--desk);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--step-0);
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}
::selection { background: #c9d8ec; color: var(--ink); }
input, textarea, select, button { font: inherit; color: inherit; caret-color: var(--shell); }
img, svg { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
[tabindex="-1"]:focus { outline: none; } /* headings that receive focus only so screen readers announce the new screen */
a { color: var(--shell); text-decoration-thickness: 2px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 3px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.6em; text-wrap: balance; }
h1 { font-size: var(--step-3); font-weight: 800; }
h2 { font-size: var(--step-1); font-weight: 800; margin-top: 1.6em; }
h3 { font-size: var(--step-0); font-weight: 800; margin-top: 1.4em; }
p { margin: 0 0 1em; max-width: 68ch; }
.lede { font-size: var(--step-1); line-height: 1.4; max-width: 46ch; }
.small { font-size: var(--step--1); color: var(--ink-soft); }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

/* ---------- shell ---------- */
.shell {
  background: var(--shell);
  color: var(--shell-ink);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.75rem;
  padding: calc(0.75rem + env(safe-area-inset-top, 0px)) max(1.25rem, env(safe-area-inset-right, 0px)) 0.75rem max(1.25rem, env(safe-area-inset-left, 0px));
  min-height: 4.5rem;
}
.shell-name { margin: 0; font-size: var(--step-1); }
.shell-name a { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 0.6rem; min-height: var(--target); }
.brand-mark { width: 2.25rem; height: 2.25rem; flex: none; }
.brand-word { font-weight: 400; letter-spacing: -0.01em; }
.brand-word b { font-weight: 800; }
.brand-hero { display: block; width: 4rem; height: 4rem; margin-bottom: 1rem; }
.shell-context { margin: 0; color: var(--shell-soft); }
.shell-case { display: grid; gap: 0.1rem; min-width: 0; }
/* Whether the company's copy is up to date: icon plus words, never colour alone. */
.shell-save { margin: 0; display: inline-flex; align-items: center; gap: 0.45rem; color: var(--shell-soft); font-size: var(--step--1); }
.shell-save.failed, .shell-save.conflict { color: #ffe2b8; font-weight: 600; }
.shell-account { margin: 0 0 0 auto; color: var(--shell-soft); display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.shell-account b { color: var(--shell-ink); font-weight: 600; }
.shell-who { display: inline-flex; align-items: center; gap: 0.5rem; margin-right: 0.5rem; }
.shell-button { display: inline-flex; align-items: center; gap: 0.45rem; min-height: var(--target); padding: 0.35rem 0.9rem; border: 1px solid rgb(255 255 255 / 0.35); border-radius: 0.5rem; background: transparent; color: var(--shell-ink); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; transition: background-color 150ms var(--ease); }
.shell-button:hover { background: rgb(255 255 255 / 0.12); }
.shell a { color: var(--shell-ink); }
.shell :focus-visible { outline-color: var(--shell-ink); }
.shell--pinned { position: sticky; top: 0; z-index: 10; column-gap: 0.7rem; }
.shell--pinned .shell-account { gap: 0.25rem; }
html:has(.shell--pinned) { scroll-padding-top: 6rem; }
.shell-help { display: inline-flex; align-items: center; min-height: var(--target); padding-inline: 0.55rem; font-size: var(--step--1); }

/* ---------- desk, tabs and sheets ---------- */
.desk { padding: 1.5rem max(1.25rem, env(safe-area-inset-right, 0px)) 6rem max(1.25rem, env(safe-area-inset-left, 0px)); max-width: 92rem; margin: 0 auto; }
/* No overflow here: the open tab reaches 2px down over the sheet's border, and any overflow value would clip it. */
.tabs { display: flex; gap: 0.375rem; padding-inline-start: 1.5rem; align-items: flex-end; margin: 0; list-style: none; padding-block: 0; }
/* Tabs that are not open sit back: darker card, softer ink, thin colour strip. */
.tab {
  display: flex; flex-direction: column; justify-content: center;
  min-width: 12rem; min-height: 3.9rem; padding: 0.4rem 1rem 0.5rem;
  background: #e3e7eb; color: var(--ink-soft); text-decoration: none;
  border: 2px solid var(--rule-soft); border-bottom: 0; border-top-width: 0.35rem;
  border-radius: var(--radius) var(--radius) 0 0;
  transition: background-color 150ms var(--ease), color 150ms var(--ease);
}
.tab .tab-number { font-size: var(--step--1); font-weight: 800; letter-spacing: 0.02em; }
.tab .tab-name { font-weight: 600; font-size: var(--step-0); }
.tab .tab-line { display: flex; align-items: center; gap: 0.4rem; }
.tab .tab-line .icon { color: var(--tab-color, var(--ink-soft)); width: 1.15em; height: 1.15em; }
.tab .tab-count { font-weight: 400; color: var(--ink-soft); }
.tab .tab-count:not(:empty)::before { content: "\00a0· "; }
/* Each divider keeps its own colour, also when it is the open one. */
.tab[data-tab="report"] { --tab-color: var(--tab-report); }
.tab[data-tab="checks"] { --tab-color: var(--tab-checks); }
.tab[data-tab="components"] { --tab-color: var(--tab-components); }
.tab[data-tab="funding"] { --tab-color: var(--tab-funding); }
.tab[data-tab="final"] { --tab-color: var(--tab-final); }
.tab[data-tab="export"] { --tab-color: var(--tab-export); }
.tab[data-tab] { border-top-color: var(--tab-color, var(--rule)); }
.tab:hover { background: #eef1f4; color: var(--ink); }
/* The open tab is the same paper as the sheet and joins it: taller, ink frame, full colour strip. */
.tab[aria-current="page"], .tab[aria-selected="true"], .tab.is-current {
  position: relative; z-index: 1; min-height: 4.75rem; border-top-width: 0.6rem;
  background: var(--sheet); color: var(--ink); border-color: var(--ink); border-top-color: var(--tab-color, var(--ink));
  margin-bottom: -2px; padding-bottom: calc(0.5rem + 2px);
}
.tab[aria-current="page"] .tab-name, .tab.is-current .tab-name { font-weight: 800; }
/* Six dividers: narrower below 80rem; below 66rem they stack in two tiers of three (phones: two). */
@media (width < 80rem) { .tab { min-width: 10rem; } }
@media (48rem <= width < 66rem) {
  .tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 0.25rem; padding-inline-start: 0; align-items: stretch; }
  .tabs > li { display: flex; }
  .tabs > li > .tab { flex: 1; min-width: 0; margin-bottom: 0; }
  .tab[aria-current="page"], .tab.is-current { min-height: 3.9rem; border-bottom: 0; }
  .tabs + .sheet, nav + .sheet { border-top-left-radius: 0; border-top-right-radius: 0; }
}
.tab[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
.sheet {
  background: var(--sheet);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  padding: clamp(1.25rem, 3vw, 2.5rem);
  box-shadow: 0 1px 2px rgb(26 31 38 / 0.06), 0 14px 36px -12px rgb(26 31 38 / 0.22); /* paper lifted off the desk */
}
.tabs + .sheet { border-top-left-radius: 0; }
.sheet-narrow { max-width: 42rem; margin: 2.5rem auto 0; }
.sheet + .sheet { margin-top: var(--gap); }
.sheet-grid { display: grid; grid-template-columns: minmax(0, 1fr) 20rem; gap: 2.5rem; }
.sheet-grid > aside { border-left: 2px solid var(--rule-soft); padding-left: 2rem; }
@media (width < 62rem) {
  .sheet-grid { grid-template-columns: 1fr; }
  .sheet-grid > aside { border-left: 0; padding-left: 0; border-top: 2px solid var(--rule-soft); padding-top: 1.5rem; }
}
.section { border: 2px solid var(--rule-soft); border-radius: var(--radius); margin: 0 0 var(--gap); }
.section > h2, .section > .section-head { margin: 0; padding: 0.75rem 1.125rem; background: var(--tint); border-bottom: 2px solid var(--rule-soft); border-radius: calc(var(--radius) - 2px) calc(var(--radius) - 2px) 0 0; font-size: var(--step-1); }
.section-body { padding: 1rem 1.125rem; }
.figure { font-size: var(--figure); font-weight: 800; line-height: 1; }
.title-row { display: flex; flex-wrap: wrap; gap: 1rem 2rem; align-items: center; justify-content: space-between; margin-bottom: 0.6em; }
.title-row h1 { margin: 0; }

/* ---------- buttons ---------- */
.button, button.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.6rem;
  min-height: var(--target); padding: 0.5rem 1.25rem;
  border: 2px solid var(--shell); border-radius: 0.5rem;
  background: #fff; color: var(--shell);
  font-weight: 600; font-size: var(--step-0); line-height: 1.2; text-decoration: none; text-align: center;
  cursor: pointer;
  transition: background-color 150ms var(--ease), color 150ms var(--ease);
}
.button:hover { background: var(--info-bg); }
.button.primary { background: var(--shell); color: #fff; }
.button.primary:hover { background: #162b47; }
.button.go { background: var(--tab-components); border-color: var(--tab-components); color: #fff; }
.button.go:hover { background: #24603d; }
.button.danger { border-color: var(--bad); color: var(--bad); }
.button.danger:hover { background: var(--bad-bg); }
.button.wide { width: 100%; }
.button.big { min-height: 3.75rem; font-size: var(--step-1); font-weight: 800; padding-inline: 1.75rem; }
.button[aria-disabled="true"], .button:disabled { opacity: 0.6; cursor: progress; }
.icon { width: 1.25em; height: 1.25em; flex: none; vertical-align: -0.2em; }
.button svg, .button .icon { flex: none; width: 1.35em; height: 1.35em; }
.button.ghost { border-color: transparent; background: transparent; padding-inline: 0.75rem; }
.button.ghost:hover { background: var(--info-bg); }
.button.ghost.danger:hover { background: var(--bad-bg); }
/* Drawn arrows (2px stroke, same as every icon), never text glyphs. */
.go-on::after, .go-back::before { content: ""; flex: none; width: 1.35em; height: 1.35em; background: currentColor; mask: url("icons/arrow-right.svg") no-repeat center / contain; }
.go-back::before { mask-image: url("icons/arrow-left.svg"); }
.button-sub { font-weight: 600; opacity: 0.9; }
.link-button { background: none; border: 0; padding: 0.25rem 0; min-height: var(--target); color: var(--shell); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.18em; cursor: pointer; font-weight: 600; }
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem 1rem; align-items: center; margin-top: 1.25rem; }
.actions.apart { justify-content: space-between; }
/* A button that cannot be undone stands alone, never next to the main action. */
.alone { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 2px solid var(--rule-soft); }
/* The next step: a bar across the bottom on every width, so it never floats over content. */
.next-bar {
  position: fixed; z-index: 5; inset-inline: 0; inset-block-end: 0; margin: 0; max-width: none;
  display: flex; justify-content: flex-end;
  padding: 0.6rem max(1.25rem, env(safe-area-inset-right, 0px), calc((100vw - 92rem) / 2 + 1.25rem)) calc(0.6rem + env(safe-area-inset-bottom, 0px)) max(1.25rem, env(safe-area-inset-left, 0px));
  background: var(--sheet); border-top: 2px solid var(--ink);
}
.next-bar[hidden] { display: none; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.4rem 1.5rem; margin: 0 0 var(--gap); }
.facts dt { color: var(--ink-soft); }
.facts dd { margin: 0; font-weight: 600; }

/* ---------- forms ---------- */
/* align-content: start: in a row of fields, one with a longer hint makes the row taller; without it the
   others' label, box and hint spread apart, so their boxes come out taller and lower than its own. */
.field { display: grid; gap: 0.35rem; margin: 0 0 1.25rem; max-width: 34rem; align-content: start; }
.field label, .field .label { font-weight: 600; }
.field .hint { color: var(--ink-soft); font-size: var(--step--1); margin: 0; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"], input[type="search"], select, textarea {
  min-height: var(--target); width: 100%;
  padding: 0.5rem 0.75rem;
  border: 2px solid var(--rule); border-radius: 0.5rem;
  background: #fff; font-size: 1.25rem;
}
textarea { min-height: 8rem; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; border-color: var(--focus); }
[aria-invalid="true"] { border-color: var(--bad) !important; background: #fffafa; }
.field-error { display: flex; gap: 0.5rem; align-items: flex-start; color: var(--bad); font-weight: 600; margin: 0; }
.field-error::before { content: ""; flex: none; width: 1.25rem; height: 1.25rem; margin-top: 0.15rem; background: url("icons/alert.svg") no-repeat center / contain; }
.check { display: flex; align-items: center; gap: 0.75rem; min-height: var(--target); cursor: pointer; font-weight: 600; }
.check input { width: 1.5rem; height: 1.5rem; accent-color: var(--shell); flex: none; margin: 0; }

/* ---------- notices (full border, never a side bar) ---------- */
.notice { display: grid; grid-template-columns: 1.75rem 1fr; gap: 0.75rem; align-items: start; padding: 1rem 1.125rem; border: 2px solid; border-radius: var(--radius); margin: 0 0 var(--gap); }
.notice > svg { width: 1.75rem; height: 1.75rem; }
.notice p { margin: 0 0 0.5rem; }
.notice p:last-child { margin: 0; }
.notice.info { border-color: var(--info); background: var(--info-bg); color: var(--info); }
.notice.ok { border-color: var(--ok); background: var(--ok-bg); color: var(--ok); }
.notice.bad { border-color: var(--bad); background: var(--bad-bg); color: var(--bad); }
.notice.ask { border-color: var(--ask); background: var(--ask-bg); color: var(--ask); }
.notice strong { color: inherit; }
.notice-mark { width: 1.75rem; height: 1.75rem; background: currentColor; mask: url("icons/info.svg") no-repeat center / contain; }
.notice.ok .notice-mark { mask-image: url("icons/check.svg"); }
.notice.bad .notice-mark, .notice.ask .notice-mark { mask-image: url("icons/alert.svg"); }

/* ---------- or-divider between sign-in ways ---------- */
.or { display: flex; align-items: center; gap: 1rem; color: var(--ink-soft); font-weight: 600; margin: 1.75rem 0; }
.or::before, .or::after { content: ""; flex: 1; border-top: 2px solid var(--rule-soft); }

/* ---------- lists and tables ---------- */
.rows { list-style: none; margin: 0; padding: 0; }
.rows > li { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; align-items: center; justify-content: space-between; padding: 0.9rem 0; border-bottom: 1px solid var(--rule-soft); }
.rows > li:last-child { border-bottom: 0; }
.rows .row-main { display: grid; gap: 0.1rem; }
.rows .row-actions { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; }
.table-wrap { overflow-x: auto; border: 2px solid var(--rule-soft); border-radius: var(--radius); }
table.data { border-collapse: collapse; width: 100%; font-size: var(--step--1); }
table.data th, table.data td { padding: 0.75rem 0.9rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--rule-soft); }
table.data thead th { background: var(--tint); font-weight: 800; position: sticky; top: 0; }
table.data td.num, table.data th.num { text-align: right; white-space: nowrap; }
.tag { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.1rem 0.6rem; border: 2px solid currentColor; border-radius: 0.4rem; font-weight: 600; font-size: var(--step--1); white-space: nowrap; }
.tag.ok { color: var(--ok); } .tag.bad { color: var(--bad); } .tag.ask { color: var(--ask); } .tag.off { color: var(--ink-soft); } .tag.info { color: var(--info); }

/* ---------- footer: the standing reminder and the legal pages ---------- */
.site-footer { max-width: 92rem; margin: 1.5rem auto 0; color: var(--ink-soft); font-size: var(--step--1); }
.site-footer p { margin: 0 0 0.5rem; max-width: none; }
.site-footer .footer-links { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: center; }
.site-footer .button { font-size: var(--step--1); }
.sheet-footer { padding-block-start: 0.25rem; border-block-start: 1px solid var(--rule-soft); }
.sheet-footer .footer-links { row-gap: 0; }
.sheet-footer a { display: inline-flex; align-items: center; min-height: var(--target); }

/* ---------- dialog ---------- */
dialog { border: 2px solid var(--ink); border-radius: var(--radius); background: var(--sheet); color: var(--ink); padding: 1.75rem; max-width: min(34rem, calc(100vw - 2rem)); }
dialog::backdrop { background: rgb(26 31 38 / 0.55); }
dialog h2 { margin-top: 0; }

/* ---------- phone ---------- */
@media (width < 48rem) {
  /* Tabs: two tiers of dividers sitting on the sheet, names whole, never scrolled sideways. */
  .tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 0 0.25rem; padding-inline-start: 0; overflow: visible; align-items: stretch; }
  .tabs > li { display: flex; }
  .tabs > li > .tab { flex: 1; }
  .tab, .tab[aria-current="page"], .tab.is-current { min-width: 0; min-height: 4.25rem; margin-bottom: 0; padding: 0.35rem 0.75rem 0.45rem; justify-content: flex-start; }
  .tab[aria-current="page"], .tab.is-current { border-bottom: 0; }
  .tab .tab-number, .tab .tab-name, .tab .tab-count { font-size: var(--step--1); }
  .shell-account .shell-who > span { display: none; } /* the name is on the account page; keep the header to buttons */
  .shell-button { padding-inline: 0.7rem; }
  .tab .tab-line { flex-wrap: wrap; }
  .tab .tab-count { display: block; flex-basis: 100%; white-space: nowrap; } /* "1 open" on its own line, never split */
  .tab .tab-count:not(:empty)::before { content: none; }
  .tabs + .sheet, nav + .sheet { border-top-left-radius: 0; border-top-right-radius: 0; }
  /* The next step is a full-width bar at the bottom, like the inspection pager. */
  .next-bar .button { width: 100%; box-shadow: none; min-height: 3.25rem; font-size: var(--step-0); }
  .next-bar .button-sub { display: none; }
  /* Wide tables become one card per row; each cell names its column. */
  table.stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack tr { padding: 0.75rem 0.9rem; border-bottom: 2px solid var(--rule-soft); }
  table.stack td { border: 0; padding: 0.2rem 0; min-width: 0 !important; text-align: left !important; }
  table.stack td[data-label]::before { content: attr(data-label) ": "; font-weight: 800; }
  .table-wrap:has(table.stack) { border-width: 2px; }
}

/* A newly shown tab panel or screen eases in (entry only; the old one goes at once). */
.sheet > section, .start-panel, #view > * {
  opacity: 1; translate: 0;
  transition: opacity 220ms var(--ease), translate 220ms var(--ease);
}
@starting-style {
  .sheet > section, .start-panel, #view > * { opacity: 0; translate: 0 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .sheet > section, .start-panel, #view > * { translate: none; }
  *, *::before, *::after { transition-duration: 0ms !important; animation-duration: 0ms !important; }
}
