/*
 * OT Life forms: the design system ("Bright workbench", round two) and the page shells.
 * Mobile first. Brand colours from the practice's logo. System fonts only: nothing is loaded from another host.
 * No inline styles anywhere (the CSP forbids them): use these classes.
 *
 * Colour has jobs: teal and ink = structure and action; coral = the one main action and "this is yours" (on a sand
 * panel); red = problems; amber = in progress; green = done. Status is always words + icon + colour. The palette is
 * OT Life's own (the logo teal, the website's ink, coral and sand). The ratios beside the tokens were measured for
 * this palette (WCAG formula, 3 Dec 2026). A ratio quoted beside a rule further down, here or in staff.css and
 * signer.css, may still be the one measured for the palette this design was first built with; the check that
 * counts is scripts/ui-shots.mjs, which measures every page as rendered (0 contrast failures on 3 Dec 2026).
 */
:root {
  /* teal and ink: structure and action */
  --sea: #1b3942;          /* the website's ink: sidebar, phone bar, current tab, primary hover. White on it 12.28, coral on it 5.93 */
  --sea-2: #106b75;        /* primary buttons, links, focus ring, step numbers. White on it 6.21; on the page 5.86, on sky tint 5.49, on sand 5.63 */
  --sky: #1b9daa;          /* logo teal: the stripe, "sent" edges. Decoration only, never text */
  --sky-soft: #7fd3dc;     /* the pale teal of the logo on the ink bar. Decoration only */
  --sky-tint: #e4f4f6;     /* info panels, chips, secondary hover. Sea on it 10.86, sea-2 5.49, muted 5.36 */
  --sky-2: #c6e7eb;
  /* coral and sand: the main action, and "this is yours" */
  --sun: #ff9a78;          /* fill. Ink on it 5.93. Never white or grey text on it */
  --coral: #fe5b2c;        /* the website's bright coral: the stripe. Decoration only, never text */
  --sun-edge: #b53a13;     /* the edge of coral buttons and tags: 5.87 on white, 5.32 on sand */
  --sun-tint: #f9f3eb;     /* sand: ink 11.14, muted 5.50 */
  --sun-2: #f0e4d2;
  --sun-hover: #ffb094;    /* ink on it 6.95 */
  /* red: problems only */
  --cherry: #d1252a;       /* problem edges (5.24 on white as an edge) */
  --red-dark: #b01c21;     /* red text: 6.92 on white, 6.28 on sand */
  --red-tint: #fdeeee;
  /* amber: in progress */
  --amber: #8a5a00;        /* white on it 5.93; on its tint 5.51 */
  --amber-tint: #fff6e0;
  /* green: done */
  --green: #1d7a46;        /* white on it 5.35 */
  --green-tint: #e8f7ee;
  /* neutrals */
  --ink: #1b3942;          /* headings, names, body text: 12.28 on white, 11.60 on the page */
  --muted: #4f666f;        /* secondary text: 6.06 on white, 5.73 on the page */
  --page: #fbf8f4;         /* page background */
  --line: #e3e9ea;         /* card and row borders (decorative) */
  --edge: #b9c9cc;         /* edge of secondary buttons and tabs: a hint (1.71); the words identify the control */
  --field-border: #6f8188; /* edge of every text box, select and option row: 4.06 on white */
  --focus: #106b75;        /* the one focus ring (6.21 on white); coral inside the ink sidebar and bars */
  /* shape */
  --r-control: 8px;        /* buttons, fields, selects, tabs, option rows, sidebar and bottom-bar items */
  --r-small: 12px;         /* small cards, panels, notices */
  --r-card: 16px;          /* cards and sections (20px on the family pages) */
  --shadow-card: 0 1px 2px rgba(27, 57, 66, 0.06), 0 6px 18px rgba(27, 57, 66, 0.07);
  --shadow-lift: 0 2px 4px rgba(27, 57, 66, 0.08), 0 10px 26px rgba(27, 57, 66, 0.1);
  --shadow-button: 0 1px 2px rgba(27, 57, 66, 0.08); /* secondary and danger buttons, tabs */
  --stripe: linear-gradient(90deg, var(--sky) 0 33.34%, var(--coral) 33.34% 66.67%, var(--sky-soft) 66.67% 100%);
  /* type */
  --font-body: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Roboto, Arial, sans-serif;
  --font-heading: ui-rounded, 'SF Pro Rounded', 'Nunito', 'Varela Round', 'Ubuntu', 'Segoe UI Variable Display', 'Segoe UI', system-ui, -apple-system, Roboto, 'Noto Sans', Arial, sans-serif;
  --gutter: 18px;
  --sidebar: 240px;
  --tabbar: 72px;          /* the room the phone and tablet bottom bar takes */

  /* Older names, kept as aliases until staff.css and signer.css are ported (round two R2 to R4). */
  --blue: var(--sky);
  --blue-dark: var(--sea-2);
  --blue-deep: var(--sea-2);
  --blue-tint: var(--sky-tint);
  --blue-tint-2: var(--sky-2);
  --yellow: var(--sun);
  --red: var(--cherry);
  --white: #ffffff;
  --black: var(--ink);
  --text: var(--ink);
  --border: var(--line);
  --radius: var(--r-control);
  --shadow: var(--shadow-card);
}
@media (min-width: 768px) {
  :root { --gutter: 28px; }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: rgba(5, 111, 146, 0.18); }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--page);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
img { max-width: 100%; height: auto; }
a { color: var(--sea-2); }
a:hover { color: var(--sea); }
/* One focus ring everywhere: 3px, deep teal (coral on the ink header, below). */
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
/* No 300ms wait for a double-tap zoom on things you tap (the signature pad keeps its own touch-action: none). */
a, button, input, select, textarea, summary, label { touch-action: manipulation; }
main:focus { outline: none; }
h1, h2, h3, h4 { font-family: var(--font-heading); line-height: 1.2; color: var(--ink); margin: 1.2em 0 0.5em; }
h1 { font-size: 1.75rem; font-weight: 800; letter-spacing: -0.01em; margin-top: 0; }
h2, h3, h4 { font-weight: 700; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.12rem; }
/* Headings without one word alone on the last line (where supported). Body text wraps as usual. */
h1, h2, h3 { text-wrap: balance; }
p, ul, ol, dl { margin: 0 0 1em; }
strong { font-weight: 700; }
::selection { background: var(--sun); color: var(--ink); }
@media (min-width: 768px) {
  h1 { font-size: 2.1rem; }
  h2 { font-size: 1.5rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ---------- Utilities ---------- */
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
/* Shown over the ink header when focused: coral with ink words (5.93), a white ring (12.28 on the sea). */
.skip-link {
  position: absolute; left: 12px; top: -100px; z-index: 200;
  padding: 10px 16px; border: 2px solid var(--ink); border-radius: var(--r-control);
  background: var(--sun); color: var(--ink); font-weight: 700; text-decoration: none;
}
.skip-link:focus { top: 12px; }
.skip-link:focus-visible { outline: 3px solid var(--white); outline-offset: 2px; }
.skip-link:hover { color: var(--ink); }
.hidden, [hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 0.9rem; }
.nowrap { white-space: nowrap; }
/* Figures of equal width so dates and numbers line up. Not nowrap on time: long dates must wrap in narrow cards. */
time, .nums { font-variant-numeric: tabular-nums; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 0.5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 2rem; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 0.5rem; } .mb-2 { margin-bottom: 1rem; }
.text-right { text-align: right; }
.stack > * + * { margin-top: 1rem; }
.row { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }
.row--between { justify-content: space-between; }
.icon { width: 1em; height: 1em; flex: 0 0 auto; vertical-align: -0.125em; }

/* ---------- Layout ---------- */
.container { width: 100%; max-width: calc(760px + var(--gutter) * 2); margin-inline: auto; padding-inline: var(--gutter); }
.container--narrow { max-width: calc(680px + var(--gutter) * 2); }
.container--wide { max-width: calc(1180px + var(--gutter) * 2); }
.main { flex: 1 0 auto; padding-top: 24px; padding-bottom: 40px; }
@media (min-width: 768px) { .main { padding-top: 36px; } }

/* The stripe: teal, coral and pale teal in thirds, 6px. Under the logo in the sidebar, under the phone bar and the
 * family header (and, from the later packages, on a child's record header and the family "Sign and send" card). */
.brand-stripe { height: 6px; background: var(--stripe); }

/* ---------- Header (every page): the logo on the ink ---------- */
.site-header { background: var(--sea); color: var(--white); }
.site-header :focus-visible { outline-color: var(--sun); }
.site-header__inner { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; padding-block: 10px; }
.site-logo { display: block; width: 120px; height: auto; }
.site-header__home { display: flex; align-items: center; gap: 12px; color: var(--white); text-decoration: none; border-radius: var(--r-control); }
/* family and plain pages: the logo centred, no navigation */
.site-header--brand .site-header__inner { justify-content: center; padding-block: 14px; }
.site-header--brand .site-logo { width: 132px; }

/* ---------- The staff shell ----------
 * One header, laid out two ways. From 1000px: a 240px ink sidebar, always there (sticky, full height).
 * Under 1000px: a slim ink bar (logo, "Send a form", Sign out, the stripe) and the five sections as a bar
 * fixed to the bottom of the screen; the page keeps room for it so it never covers the end of the page or a
 * focused control. */
.staff-nav ul { list-style: none; margin: 0; padding: 0; }
.staff-nav a { text-decoration: none; font-family: var(--font-heading); font-weight: 700; }
.staff-nav a .icon { width: 20px; height: 20px; }
.staff-nav__label--short { display: none; }
.staff-action .icon, .staff-user__out .icon { width: 18px; height: 18px; }
.staff-user { display: flex; align-items: center; gap: 10px; }
.staff-user__out { margin: 0; }
.staff-user__avatar {
  display: inline-grid; place-items: center; flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%;
  background: var(--sun); color: var(--ink); font-family: var(--font-heading); font-size: 0.86rem; font-weight: 800; letter-spacing: 0.02em;
}
.staff-user__name { color: var(--white); font-weight: 650; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* the current page's coral button: a white outline around it, as well as the words */
.staff-action[aria-current='page'] { outline: 2px solid var(--white); outline-offset: 2px; }
.staff-action[aria-current='page']:focus-visible { outline: 3px solid var(--sun); }

@media screen and (min-width: 1000px) {
  body.page--staff { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); align-items: start; }
  .site-header--staff {
    grid-column: 1; grid-row: 1; position: sticky; top: 0; height: 100vh; overflow-y: auto; scrollbar-width: thin;
  }
  .site-header--staff .site-header__inner {
    display: flex; flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 0;
    min-height: 100%; padding: 0 14px 16px;
  }
  .site-header--staff .site-header__home { padding: 22px 10px 18px; }
  .site-header--staff .site-logo { width: 124px; }
  .site-header--staff .brand-stripe { margin: 0 -14px 20px; flex: 0 0 auto; }
  .site-header--staff .staff-action { margin: 0 0 20px; min-height: 44px; font-size: 1rem; }
  .site-header--staff .staff-nav ul { display: flex; flex-direction: column; gap: 3px; }
  .site-header--staff .staff-nav a {
    position: relative; display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 9px 12px;
    border-radius: var(--r-control); color: var(--white); font-size: 1.04rem; line-height: 1.3;
  }
  .site-header--staff .staff-nav a:hover { background: rgba(255, 255, 255, 0.12); color: var(--white); } /* #364f57: white 5.16 */
  /* where am I: a white item with sea words (12.28), and a coral bar at the sidebar's edge (5.93 against the sea) */
  .site-header--staff .staff-nav a[aria-current='page'] { background: var(--white); color: var(--sea); }
  .site-header--staff .staff-nav a[aria-current='page']::before {
    content: ''; position: absolute; left: -14px; top: 7px; bottom: 7px; width: 5px; border-radius: 0 4px 4px 0; background: var(--sun);
  }
  .site-header--staff .staff-user {
    display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 10px; align-items: center;
    margin-top: auto; padding: 16px 6px 0; border-top: 1px solid rgba(255, 255, 255, 0.22); font-size: 0.98rem;
  }
  /* the sections can push the footer of the sidebar down, but never under the last link */
  .site-header--staff .staff-nav { margin-bottom: 24px; }
  .site-header--staff .staff-user__out { grid-column: 1 / -1; }
  .site-header--staff .staff-user__out .btn { width: 100%; }
  body.page--staff > .main { grid-column: 2; grid-row: 1; width: 100%; max-width: 1180px; margin: 0; padding: 30px 36px 56px; }
}
@media screen and (min-width: 1000px) and (max-width: 1199.98px) {
  body.page--staff > .main { padding: 26px 26px 48px; }
}

@media (max-width: 999.98px) {
  .site-header--staff .site-header__inner {
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; column-gap: 10px;
    padding: 8px var(--gutter) 0;
  }
  .site-header--staff .site-header__home { grid-column: 1; grid-row: 1; min-height: 44px; }
  .site-header--staff .site-logo { width: 88px; }
  .site-header--staff .staff-action { grid-column: 3; grid-row: 1; min-height: 44px; padding: 6px 13px; font-size: 0.95rem; white-space: nowrap; }
  .site-header--staff .staff-user { grid-column: 4; grid-row: 1; }
  .site-header--staff .staff-user__avatar, .site-header--staff .staff-user__name { display: none; }
  .site-header--staff .staff-user__out .btn { min-height: 44px; padding-inline: 11px; white-space: nowrap; }
  .site-header--staff .brand-stripe { grid-column: 1 / -1; grid-row: 2; margin: 8px calc(var(--gutter) * -1) 0; }
  /* the five sections: a white bar fixed to the bottom of the screen */
  .site-header--staff .staff-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: var(--white); color: var(--ink);
    border-top: 1px solid var(--line); box-shadow: 0 -4px 16px rgba(27, 57, 66, 0.1);
    padding: 4px 2px calc(4px + env(safe-area-inset-bottom, 0px));
  }
  .site-header--staff .staff-nav ul { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); width: 100%; max-width: 720px; margin: 0 auto; }
  .site-header--staff .staff-nav a {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 58px; padding: 4px 0;
    border-radius: var(--r-control); color: #3d4a53; font-size: 0.82rem; line-height: 1.2; text-align: center; letter-spacing: -0.01em;
  } /* #3d4a53 on white 9.12 */
  .site-header--staff .staff-nav a .icon { width: 24px; height: 24px; }
  .site-header--staff .staff-nav a:hover { background: var(--sky-tint); color: var(--sea); }
  /* the current section: sky tint, sea words (6.03) and a sea bar along its top */
  .site-header--staff .staff-nav a[aria-current='page'] { background: var(--sky-tint); color: var(--sea); box-shadow: inset 0 3px 0 var(--sea); }
  .site-header--staff .staff-nav a:focus-visible { outline-color: var(--focus); outline-offset: -3px; }
  .staff-nav__label--long { display: none; }
  .staff-nav__label--short { display: inline; }
  /* room for the bar at the end of the page, and when the browser scrolls a focused control into view */
  body.page--staff { padding-bottom: calc(var(--tabbar) + env(safe-area-inset-bottom, 0px)); }
  html:has(> body.page--staff) { scroll-padding-bottom: calc(var(--tabbar) + 12px + env(safe-area-inset-bottom, 0px)); }
}
@media (max-width: 640px) {
  .site-header--staff .site-logo { width: 74px; }
}
/* the smallest phones: the bar's two buttons and the logo still fit on one line */
@media (max-width: 379.98px) {
  .site-header--staff .site-header__inner { column-gap: 8px; }
  .site-header--staff .site-logo { width: 64px; }
  .site-header--staff .staff-action { padding-inline: 10px; gap: 6px; }
  .site-header--staff .staff-user__out .btn { padding-inline: 9px; gap: 6px; }
}

/* ---------- Footer (family and plain pages) ---------- */
.site-footer { flex-shrink: 0; padding: 20px 0 28px; color: var(--muted); font-size: 0.9rem; border-top: 1px solid var(--line); background: var(--white); }
.site-footer p { margin: 0; }

/* ---------- Cards and panels ---------- */
.card {
  background: var(--white); border-radius: var(--r-card); box-shadow: var(--shadow-card);
  padding: 22px 18px; margin-bottom: 20px;
}
@media (min-width: 768px) { .card { padding: 28px 32px; } }
.page--signer .card, .page--plain .card { border-radius: 20px; }
.card > :last-child { margin-bottom: 0; }
.card--plain { box-shadow: var(--shadow-card); }
/* a coloured band along the top: grey for a dead end, red for a problem, the brand stripe for a finish line */
.card--muted, .card--red, .card--stripe { position: relative; overflow: hidden; padding-top: 28px; }
.card--muted::before, .card--red::before, .card--stripe::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 6px; }
.card--muted::before { background: #b4c0c7; }
.card--red::before { background: var(--cherry); }
.card--stripe::before { background: var(--stripe); }
@media (min-width: 768px) { .card--muted, .card--red, .card--stripe { padding-top: 34px; } }
.panel { background: var(--sky-tint); border: 1px solid var(--sky-2); border-radius: var(--r-small); padding: 14px 16px; margin-bottom: 1rem; }
.signin { max-width: 560px; margin-inline: auto; }

/* ---------- Buttons ----------
 * One shape everywhere: an 8px rectangle, flat, a 1.5px edge, the body face at 650. 40px high with a mouse,
 * 44px on touch. No pills, no drop edge, no movement on press.
 *   .btn               primary: white on sea-2 (6.21); hover sea (12.28)
 *   .btn--secondary    sea-2 words on white (6.21), a quiet edge; hover sky tint, sea words (6.03)
 *   .btn--main         the one main action on a screen: ink on coral (5.93), a coral edge (5.87 on white)
 *   .btn--danger       red words (6.92) on white, a red edge; hover white on red (5.24)
 *   .btn--danger-solid white on red-dark (6.92); hover 9.21
 *   .btn--ghost        on the ink only: white words (12.28), a white-at-60% edge; hover sea on white
 *   .btn--small (34px / 44px on touch), .btn--large (48px), .btn--block (full width) */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 8px 16px; border: 1.5px solid var(--sea-2); border-radius: var(--r-control);
  background: var(--sea-2); color: var(--white); box-shadow: none;
  font-family: var(--font-body); font-size: 0.98rem; font-weight: 650; line-height: 1.2; letter-spacing: 0;
  text-align: center; text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--sea); border-color: var(--sea); color: var(--white); }
.btn .icon { width: 18px; height: 18px; }
.btn[disabled], .btn[aria-disabled='true'] { opacity: 0.6; cursor: default; }
.btn--secondary { background: var(--white); color: var(--sea-2); border-color: var(--edge); box-shadow: var(--shadow-button); }
.btn--secondary:hover { background: var(--sky-tint); color: var(--sea); border-color: var(--sea-2); }
.btn--main { background: var(--sun); color: var(--ink); border-color: var(--sun-edge); }
.btn--main:hover { background: var(--sun-hover); color: var(--ink); border-color: var(--sun-edge); }
.btn--danger { background: var(--white); color: var(--red-dark); border-color: var(--cherry); box-shadow: var(--shadow-button); }
.btn--danger:hover { background: var(--cherry); border-color: var(--cherry); color: var(--white); }
.btn--danger-solid { background: var(--red-dark); border-color: var(--red-dark); color: var(--white); }
.btn--danger-solid:hover { background: #8e161a; border-color: #8e161a; color: var(--white); }
.btn--ghost { background: transparent; border-color: rgba(255, 255, 255, 0.6); color: var(--white); }
.btn--ghost:hover { background: var(--white); border-color: var(--white); color: var(--sea); }
.btn--small { min-height: 34px; padding: 5px 12px; font-size: 0.9rem; }
.btn--small .icon { width: 17px; height: 17px; }
.btn--large { min-height: 48px; font-size: 1.05rem; }
.btn--block { width: 100%; }
/* finger-sized where a finger is used; the desk layout keeps 40px and 34px */
@media (pointer: coarse) { .btn, .btn--small { min-height: 44px; } .btn--large { min-height: 48px; } }
.link-button { background: none; border: 0; padding: 0; font: inherit; color: var(--sea-2); text-decoration: underline; cursor: pointer; }
.link-button:hover { color: var(--sea); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 1.5rem; }

/* ---------- Forms: the same 8px corner as the buttons beside them ---------- */
.field { display: grid; gap: 6px; margin-bottom: 1.1rem; scroll-margin-top: 16px; } /* a jump from the error summary leaves room above the label */
.field > label, .field__label, legend { font-weight: 700; color: var(--ink); }
.field__hint { font-size: 0.92rem; color: var(--muted); }
.field__error { font-size: 0.95rem; font-weight: 700; color: var(--red-dark); }
.field--error .input, .field--error .select, .field--error .textarea { border-color: var(--cherry); }
.input, .select, .textarea {
  width: 100%; min-height: 42px; padding: 9px 12px; border: 1.5px solid var(--field-border); border-radius: var(--r-control);
  background: var(--white); color: var(--ink); font: inherit; font-size: 16px; line-height: 1.4;
}
@media (pointer: coarse) { .input, .select { min-height: 44px; } }
/* The same focus ring as everything else, flush with the box; the border darkens with it so they read as one edge. */
.input:focus, .select:focus, .textarea:focus { border-color: var(--focus); }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 0; }
.input[readonly] { background: var(--sky-tint); }
.textarea { min-height: 110px; resize: vertical; }
fieldset { border: 0; margin: 0 0 1.1rem; padding: 0; min-width: 0; scroll-margin-top: 16px; }
.choices { display: grid; gap: 10px; }
.choice { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; line-height: 1.45; }
.choice input { width: 22px; height: 22px; margin: 1px 0 0; flex: 0 0 auto; accent-color: var(--sea-2); }
.req { color: var(--red-dark); font-weight: 700; }
.error-summary { border: 3px solid var(--cherry); border-radius: var(--r-small); background: var(--red-tint); padding: 14px 18px; margin-bottom: 1.5rem; }
.error-summary h2 { margin-top: 0; color: var(--red-dark); font-size: 1.15rem; }
.error-summary ul { margin: 0; padding-left: 1.2em; }
.error-summary a { color: var(--red-dark); font-weight: 600; } /* 6.14 on the red tint */

/* ---------- Signature pad ---------- */
.signature-pad { border: 2px dashed var(--sea-2); border-radius: var(--r-small); background: var(--white); touch-action: none; width: 100%; height: 180px; display: block; }
.signature-preview { max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: var(--r-control); background: var(--white); }

/* ---------- Messages ---------- */
.flash { border-radius: var(--r-small); padding: 12px 16px; margin-bottom: 1.25rem; font-weight: 600; }
.flash--ok { background: var(--green-tint); border: 1px solid #9fd8b5; color: #17643a; }     /* 6.50 */
.flash--error { background: var(--red-tint); border: 1px solid #f2b8ba; color: var(--red-dark); } /* 6.14 */
.notice { background: var(--amber-tint); border: 1px solid #f0d48a; border-radius: var(--r-small); padding: 12px 16px; margin-bottom: 1rem; color: var(--ink); }

/* ---------- Badges, counts and chips stay rounded: they are labels, not controls ---------- */
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-family: var(--font-heading); font-size: 0.85rem; font-weight: 700; white-space: nowrap; background: var(--sky-2); color: var(--sea); }
.badge--draft { background: #eceff1; color: #455a64; }
.badge--sent, .badge--opened { background: var(--sky-2); color: var(--sea); }
.badge--in_progress { background: var(--amber-tint); color: var(--amber); }
.badge--completed, .badge--signed { background: var(--green-tint); color: var(--green); }
.badge--declined, .badge--bounced { background: var(--red-tint); color: var(--red-dark); }
.badge--cancelled, .badge--expired, .badge--pending { background: #eceff1; color: #455a64; }

/* ---------- Tables, lists, tabs ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; background: var(--white); font-size: 0.97rem; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-family: var(--font-heading); font-size: 0.92rem; color: var(--muted); }
.table tr:hover td { background: #f6fbfb; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0 0 1rem; }
.tabs a {
  display: inline-flex; align-items: center; min-height: 40px; padding: 6px 13px; border-radius: var(--r-control);
  background: var(--white); border: 1.5px solid var(--edge); box-shadow: var(--shadow-button);
  text-decoration: none; color: #3d4a53; font-family: var(--font-heading); font-weight: 700; font-size: 0.96rem;
}
.tabs a:hover { border-color: var(--sea-2); color: var(--sea); background: var(--sky-tint); }
.tabs a[aria-current='page'] { background: var(--sea); border-color: var(--sea); color: var(--white); box-shadow: none; }
@media (pointer: coarse) { .tabs a { min-height: 44px; } }
.details { display: grid; grid-template-columns: 1fr; gap: 4px 18px; }
.details dt { color: var(--muted); font-size: 0.92rem; }
.details dd { margin: 0 0 0.6rem; overflow-wrap: anywhere; }
@media (min-width: 640px) {
  .details { grid-template-columns: minmax(140px, max-content) 1fr; }
  .details dd { margin: 0; }
}
.timeline { list-style: none; padding: 0; margin: 0; border-left: 3px solid var(--sky-2); }
.timeline li { position: relative; padding: 0 0 14px 18px; }
.timeline li::before { content: ''; position: absolute; left: -8px; top: 0.45em; width: 13px; height: 13px; border-radius: 50%; background: var(--sky); }
.timeline time { display: block; font-size: 0.85rem; color: var(--muted); }

/* ---------- The document itself (signer page) ---------- */
.doc h2 { color: var(--sea); }
.doc p, .doc li { overflow-wrap: break-word; }
.doc ul, .doc ol { padding-left: 1.3em; }
.doc .note { font-size: 0.95rem; color: var(--muted); }

@media print {
  body, body.page--staff { background: var(--white); display: block; padding-bottom: 0; }
  .site-header, .site-footer, .actions, .skip-link, .staff-nav, .brand-stripe { display: none !important; }
  .card { box-shadow: none; border: 0; padding: 0; }
  .card::before { display: none; }
}
