/* Family Site stylesheet. Tokens first; every color is checked for WCAG AA
   against the surface it sits on. Base text is 18px for older eyes. */

:root {
  --bg: #f8f4ee;
  --surface: #ffffff;
  --surface-2: #f2ece3;
  --ink: #2a2420;
  --muted: #645a51;        /* 6.3:1 on --surface, 5.8:1 on --bg */
  --line: #e2d9cc;
  --brand: #2f5d50;        /* deep evergreen: 7.4:1 with white */
  --brand-strong: #224539;
  --brand-tint: #e3eee9;
  --accent: #a24a22;       /* terracotta: 5.9:1 on white */
  --accent-tint: #f8e7dd;
  --danger: #a32a2a;
  --danger-tint: #fbe5e5;
  --success-tint: #e2f1e6;
  --success-ink: #1f5a32;
  --memorial: #4a4163;
  --memorial-tint: #ece9f3;
  --focus: #1a6fd1;
  --focus-on-brand: #ffffff; /* focus ring inside the green header */
  /* On-colour tokens (UX-25): what sits on --brand and in the header. */
  --on-brand: #ffffff;           /* text on a --brand fill (buttons, current tab) */
  --header-bg: var(--brand);
  --header-ink: #ffffff;         /* header text, icons and outlines */
  --header-chip: #ffffff;        /* white pills in the header: badges, logo disc */
  --header-chip-ink: var(--brand-strong);
  --header-current-bg: var(--header-chip);   /* the current page's nav pill */
  --header-current-ink: var(--brand-strong);
  --header-current-badge: var(--brand-strong);
  --field-border: #8a7e72;   /* form field outline, >= 3:1 on --surface */
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgb(42 36 32 / 6%), 0 4px 16px rgb(42 36 32 / 5%);
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: var(--font-body); /* sans-serif everywhere (owner decision 2026-10-26) */
  --gutter: clamp(16px, 4vw, 32px);
  --max: 1180px;
  color-scheme: light;
}

/* Dark theme. Default (no data-theme): follows the device. The Appearance
   control (app/controllers/appearance.php) prints <html data-theme="light">
   or "dark" to force one; keep these two token blocks identical. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #171513;
    --surface: #221f1c;
    --surface-2: #2b2723;
    --ink: #f1ebe4;
    --muted: #bfb3a7;
    --line: #3a352f;
    --brand: #7fc0a8;
    --brand-strong: #a3d6c3;
    --brand-tint: #20352e;
    --accent: #f0a27c;
    --accent-tint: #3a2a21;
    --danger: #f19494;
    --danger-tint: #3b2323;
    --success-tint: #1d3324;
    --success-ink: #9fdcb0;
    --memorial: #c3b9e4;
    --memorial-tint: #2b2838;
    --focus: #79b3ff;
    --focus-on-brand: #ffffff;
    --on-brand: #10211b;         /* the light --brand needs dark text */
    --header-bg: #1d2f29;
    --header-chip-ink: #10211b;
    --header-current-bg: var(--brand);
    --header-current-ink: #10211b;
    --header-current-badge: #10211b;
    --field-border: #8c8075;
    --shadow: none;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #171513;
  --surface: #221f1c;
  --surface-2: #2b2723;
  --ink: #f1ebe4;
  --muted: #bfb3a7;
  --line: #3a352f;
  --brand: #7fc0a8;
  --brand-strong: #a3d6c3;
  --brand-tint: #20352e;
  --accent: #f0a27c;
  --accent-tint: #3a2a21;
  --danger: #f19494;
  --danger-tint: #3b2323;
  --success-tint: #1d3324;
  --success-ink: #9fdcb0;
  --memorial: #c3b9e4;
  --memorial-tint: #2b2838;
  --focus: #79b3ff;
  --focus-on-brand: #ffffff;
  --on-brand: #10211b;         /* the light --brand needs dark text */
  --header-bg: #1d2f29;
  --header-chip-ink: #10211b;
  --header-current-bg: var(--brand);
  --header-current-ink: #10211b;
  --header-current-badge: #10211b;
  --field-border: #8c8075;
  --shadow: none;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1.125rem/1.6 var(--font-body);
  overflow-wrap: break-word;
}

img { max-width: 100%; height: auto; display: block; }
/* Author display rules must never re-show something marked hidden (JS-only buttons). */
[hidden] { display: none !important; }

h1, h2, h3 { font-family: var(--font-display); line-height: 1.2; font-weight: 600; margin: 0 0 .5rem; }
h1, h2 { font-weight: 700; } /* headings stand apart from the 600 labels (UX-53) */
h1 { font-size: clamp(1.9rem, 1.5rem + 1.6vw, 2.6rem); letter-spacing: -.01em; }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1rem; }

a { color: var(--brand); text-underline-offset: .18em; }
a:hover { color: var(--brand-strong); }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 1rem; top: -4rem; z-index: 100;
  background: var(--brand); color: var(--on-brand); padding: .6rem 1rem; border-radius: var(--radius-sm);
}
.skip-link:focus { top: 1rem; color: var(--on-brand); }

.container { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }

.small { font-size: .9rem; }
.muted { color: var(--muted); }
.muted-link { color: inherit; text-decoration: none; }
.muted-link:hover { text-decoration: underline; }
.optional { font-weight: 400; color: var(--muted); font-size: .9em; }
.empty { color: var(--muted); font-style: italic; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .05em; }

/* ---------- Header ---------- */
/* Brand, header tools and the Menu button always share one row (UX-06): the
   brand has a zero flex-basis, so a long family name is cut with "…" instead
   of pushing the Menu button onto a second line. */
.site-header {
  background: var(--header-bg);
  color: var(--header-ink);
}
/* Pinned only when JS is running: without JS the menu can't collapse, and a
   pinned, fully expanded menu would cover most of a phone screen. */
.js .site-header { position: sticky; top: 0; z-index: 20; }
.header-inner { display: flex; align-items: center; gap: .5rem 1rem; padding-block: .5rem; flex-wrap: wrap; }
.brand {
  display: flex; align-items: center; gap: .6rem; min-height: 44px;
  color: var(--header-ink); text-decoration: none;
  font-family: var(--font-display); font-size: 1.25rem; font-weight: 600;
  flex: 1 1 0; min-width: 2.5rem; margin-right: auto;
}
.brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.brand img { flex: none; }
.brand:hover { color: var(--header-ink); }
.site-header :focus-visible { outline-color: var(--focus-on-brand); }
.brand img { border-radius: 50%; background: var(--header-chip); }
/* The bell and Menu stay together, on the right of whichever row they're on. */
.header-tools { display: flex; align-items: center; column-gap: inherit; flex: none; order: 2; margin-left: auto; }
.header-tool { flex: none; }
.header-tool-icon { flex: none; }
/* Phones: the bell alone (the word stays for screen readers), so the family
   name keeps room next to the Menu button. */
@media (max-width: 700px) {
  .header-tool .header-tool-label {
    position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
  .header-inner .header-tool { padding-inline: .6rem; }
}

/* ---------- Main navigation ----------
   One <nav> for every screen (app/views/layout.php): three labelled groups
   ("Family life", "Our people", "Me & help") and Sign out. Under 1200px (75em)
   it sits behind the Menu button as one flat list; from 1200px it is a fixed
   sidebar on the left (see "Wide screens" below). */
.site-nav, .nav-group, .nav-list { display: flex; align-items: center; gap: .25rem; flex-wrap: wrap; }
.nav-list { list-style: none; margin: 0; padding: 0; }
/* Group names are shown in the sidebar only; elsewhere they still name each list for screen readers. */
.nav-heading {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.nav-icon { display: none; }
.site-nav a, .site-nav .link-button {
  color: var(--header-ink); text-decoration: none; padding: .5rem .75rem; border-radius: 999px;
  font: inherit; font-size: 1rem; min-height: 44px; display: inline-flex; align-items: center; gap: .4rem;
  background: none; border: 0; cursor: pointer; white-space: nowrap;
}
.site-nav a:hover, .site-nav .link-button:hover { background: rgb(255 255 255 / 14%); color: var(--header-ink); }
.site-nav a[aria-current="page"] { background: var(--header-current-bg); color: var(--header-current-ink); }
.nav-logout { margin: 0; }
.nav-toggle { display: none; }
.nav-badge {
  display: inline-grid; place-items: center; min-width: 1.6rem; height: 1.6rem; padding: 0 .4rem;
  border-radius: 999px; background: var(--header-chip); color: var(--header-chip-ink); font-size: .875rem; font-weight: 700; line-height: 1;
}
.site-nav a[aria-current="page"] .nav-badge { background: var(--header-current-badge); color: var(--header-ink); }

/* Phones and tablets (under 1200px): collapse the nav behind the Menu button
   (only once JS has loaded; without JS the links simply wrap and stay usable).
   Inside the open menu the groups are shown flat, with a divider between them. */
@media (max-width: 74.99em) {
  .js .nav-toggle {
    display: inline-flex; align-items: center; gap: .4rem; min-height: 44px; flex: none; order: 3;
    background: transparent; color: var(--header-ink); border: 2px solid rgb(255 255 255 / 60%);
    border-radius: 999px; padding: .35rem 1rem; font: inherit; font-size: 1rem; cursor: pointer;
  }
  .js .site-nav { display: none; width: 100%; order: 4; padding-bottom: .5rem; }
  .js .site-nav.open { display: block; max-height: calc(100vh - 4.5rem); max-height: calc(100dvh - 4.5rem); overflow-y: auto; }
  .js .nav-group, .js .nav-list { flex-direction: column; align-items: stretch; gap: .15rem; width: 100%; }
  .js .nav-group + .nav-group { border-top: 1px solid rgb(255 255 255 / 35%); margin-top: .25rem; padding-top: .25rem; }
  .site-nav a, .site-nav .link-button { width: 100%; border-radius: var(--radius-sm); font-size: 1.1rem; white-space: normal; }
}

/* Wide screens (1200px and up): a slim top strip with the family name and
   the bell, and a fixed sidebar with every section, always open. Main
   content and the footer start to the right of the sidebar. Works without
   JS too (nothing to open). */
@media (min-width: 75em) {
  :root { --sidebar-w: 15.5rem; --strip-h: 3.75rem; --content-max: 72rem; }
  /* The sidebar's panel and edge continue down the page (also in full-page screenshots). */
  body:has(#site-nav) {
    background-image: linear-gradient(to right, var(--surface) calc(var(--sidebar-w) - 1px), var(--line) calc(var(--sidebar-w) - 1px), var(--line) var(--sidebar-w), transparent var(--sidebar-w));
  }
  .family-body .site-header { position: sticky; top: 0; z-index: 20; height: var(--strip-h); }
  .family-body .header-inner { max-width: none; height: 100%; padding-block: 0; padding-inline: 1rem 1.25rem; flex-wrap: nowrap; }
  .site-nav {
    position: fixed; top: var(--strip-h); bottom: 0; left: 0; z-index: 15; width: var(--sidebar-w);
    display: block; overflow-y: auto; overscroll-behavior: contain;
    padding: 1.25rem .85rem 1.5rem; background: var(--surface); border-right: 1px solid var(--line); color: var(--ink);
  }
  .site-nav .nav-group, .site-nav .nav-list { display: block; }
  .site-nav .nav-list > li + li { margin-top: .15rem; }
  .nav-heading {
    position: static; width: auto; height: auto; overflow: visible; clip: auto; white-space: normal;
    margin: 1.4rem .75rem .45rem; font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
  }
  .nav-group:first-child .nav-heading { margin-top: 0; }
  .nav-icon { display: block; flex: none; width: 20px; height: 20px; color: var(--brand); }
  .site-nav a, .site-nav .link-button {
    display: flex; width: 100%; gap: .75rem; padding: .4rem .75rem; border-radius: 10px;
    color: var(--ink); font-size: 1.02rem; line-height: 1.25; white-space: normal; text-align: left;
  }
  .site-nav a:hover, .site-nav .link-button:hover { background: var(--surface-2); color: var(--ink); }
  .site-nav a[aria-current="page"] { background: var(--brand-tint); color: var(--brand-strong); font-weight: 700; box-shadow: inset 4px 0 0 var(--brand); }
  .site-nav :focus-visible { outline-color: var(--focus); outline-offset: -3px; }
  .site-nav .nav-badge, .site-nav a[aria-current="page"] .nav-badge { margin-left: auto; background: var(--accent); color: var(--surface); }
  .site-nav .avatar-initials { background: var(--brand); color: var(--on-brand); }
  .site-nav .nav-me .avatar { width: 24px; height: 24px; font-size: .625rem; margin-inline: -2px; }
  .nav-end { margin-top: 1.1rem; }
  .nav-end::before { content: ""; display: block; margin: 0 .75rem 1.1rem; border-top: 1px solid var(--line); }
  .site-nav .nav-end .link-button, .site-nav .nav-end .link-button:hover { color: var(--muted); }
  /* Family pages (layout.php) and the platform console (layout_platform.php) have the sidebar; the landing and public layouts keep their geometry. */
  .family-body .main.container { width: auto; margin-left: var(--sidebar-w); margin-right: 0; max-width: var(--content-max); padding-inline: 2.25rem; }
  /* A page that needs the room (the family tree chart): the whole width beside
     the sidebar. Its text keeps the usual readable width, left-aligned with
     the wide part; only a .main-wide-full child spans the width. */
  .family-body .main.container.main-wide { max-width: none; }
  .family-body .main-wide > :not(.main-wide-full) { max-width: calc(var(--content-max) - 4.5rem); }
  .family-body .site-footer { margin-left: var(--sidebar-w); }
  .family-body .footer-inner.container { width: auto; margin-left: 0; max-width: var(--content-max); padding-inline: 2.25rem; }
}
/* Phones and tablets: the family name is always shown (P2-04, UX-34). It
   wraps between words, never inside one (the body's overflow-wrap is undone),
   up to 3 lines. The brand is never narrower than its longest word: when the
   name, the bell and Menu don't fit on one row, the bell and Menu move to a
   second row on the right instead of squeezing the name. */
@media (max-width: 960px) {
  .brand { min-width: auto; max-width: 100%; }
  .brand span {
    white-space: normal; overflow-wrap: normal; word-break: normal; text-overflow: ellipsis;
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden;
  }
}
@media (max-width: 600px) {
  .brand { font-size: 1.05rem; line-height: 1.15; gap: .5rem; }
}
/* Narrow phones: smaller logo, and the bell's count becomes a dot (the
   number stays for screen readers), so the name keeps its room. */
@media (max-width: 400px) {
  .header-inner { column-gap: .5rem; }
  .brand img { width: 32px; height: 32px; }
  .header-inner .header-tool { padding-inline: .5rem; gap: .25rem; }
  .header-tool .notify-count { min-width: .75rem; width: .75rem; height: .75rem; padding: 0; font-size: 0; }
  .js .nav-toggle { padding-inline: .75rem; }
}
/* Very narrow (a phone at 200% zoom): the name keeps the first row; the
   waiting count is still shown on Admin inside the menu. */
@media (max-width: 360px) {
  .header-inner { gap: .25rem; }
  .brand { font-size: 1rem; }
  .nav-toggle .nav-badge { display: none; }
}
/* Short screens (a phone on its side, or large zoom): don't pin the header. */
@media (max-height: 500px) { .js .site-header { position: static; } }

/* ---------- Main ---------- */
.main { padding-block: 2rem 3rem; min-height: 60vh; }

.page-head { margin-bottom: 1.5rem; }
.page-head-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; }
.page-head-row > div { flex: 1 1 320px; }
.page-head p:last-child { margin-bottom: 0; }
.breadcrumb { margin-bottom: 1rem; font-size: 1rem; }
.breadcrumb a { display: inline-flex; align-items: center; min-height: 44px; }

.section-title { margin-top: 2rem; margin-bottom: 1rem; }
.subhead { margin-top: 1.5rem; font-size: 1.1rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(1rem, 2.5vw, 1.5rem);
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
}
.card-title { font-size: 1.2rem; margin-bottom: 1rem; }
.card-foot { margin: 1rem 0 0; font-size: 1rem; }
.form.card h2.card-title:not(:first-of-type) { margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }

.two-col { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); align-items: start; }
.two-col > .card { margin-bottom: 0; }
.two-col + * { margin-top: 1.25rem; }

/* ---------- Buttons ---------- */
.button {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 44px; padding: .55rem 1.2rem;
  background: var(--brand); color: var(--on-brand);
  border: 2px solid var(--brand); border-radius: 999px;
  font: 600 1rem/1.2 var(--font-body); text-decoration: none; cursor: pointer;
  /* Long labels wrap between words, never inside one ("accou / nt"). */
  text-align: center; overflow-wrap: normal; word-break: normal; hyphens: manual; max-width: 100%;
}
.button:hover { background: var(--brand-strong); border-color: var(--brand-strong); color: var(--on-brand); }
.button-secondary { background: transparent; color: var(--brand); }
.button-secondary:hover { background: var(--brand-tint); color: var(--brand-strong); border-color: var(--brand); }
.button-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.button-danger:hover { background: var(--danger-tint); color: var(--danger); border-color: var(--danger); }
.button-large { min-height: 52px; padding-inline: 1.6rem; font-size: 1.1rem; }
.button-small { min-height: 44px; padding: .35rem .9rem; font-size: .95rem; }
/* .button is the primary style; .button-primary is accepted as an alias. */
.button:active { transform: translateY(1px); }
.button[disabled], .button[aria-busy="true"] { opacity: .65; cursor: not-allowed; }
.submit-status { margin: 0; color: var(--muted); font-size: 1rem; }
.submit-status:empty { display: none; }
.button-block { width: 100%; }
.button-row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin: 0; }
/* Edit and Delete live in their own "Manage" row, apart from everyday actions,
   with Delete last and well spaced from Edit (UX-10). */
.manage-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.5rem;
  margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--line);
}
.manage-row p { margin: 0; }
.manage-label { color: var(--muted); font-size: 1rem; font-weight: 600; }
.stack-buttons { display: flex; gap: .75rem; flex-wrap: wrap; }
.button-row + p { margin-top: .75rem; }
.help + .button-row { margin-top: 1rem; }

@media (prefers-color-scheme: dark) {
  :where(:root:not([data-theme="light"])) :is(.button-secondary, .button-danger) { color: var(--brand); }
  :where(:root:not([data-theme="light"])) .button-danger { color: var(--danger); }
}
:where(:root[data-theme="dark"]) :is(.button-secondary, .button-danger) { color: var(--brand); }
:where(:root[data-theme="dark"]) .button-danger { color: var(--danger); }

.link-button {
  background: none; border: 0; padding: 0; font: inherit; color: var(--brand);
  text-decoration: underline; text-underline-offset: .18em; cursor: pointer; min-height: 44px;
  display: inline-flex; align-items: center;
}
.link-danger { color: var(--danger); }
.inline-form { display: inline; margin: 0; }

/* ---------- Forms ---------- */
.form { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); }
.form > .button { justify-self: start; }
.field { display: grid; gap: .35rem; min-width: 0; }
.field-row { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
label, legend { font-weight: 600; font-size: 1rem; }
.help { margin: 0; font-size: .95rem; color: var(--muted); }
.form-intro { margin: 0; }

input:not([type="checkbox"], [type="radio"], [type="file"]), select, textarea {
  width: 100%; min-height: 48px; padding: .6rem .8rem;
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1.5px solid var(--field-border); border-radius: var(--radius-sm);
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--focus); }
input, select, textarea { min-width: 0; max-width: 100%; }

/* Errors (UX-02): summary at the top of the form, message under each field. */
.error-summary {
  border: 3px solid var(--danger); border-radius: var(--radius-sm); background: var(--surface);
  padding: 1rem 1.25rem; margin: 0 0 1.25rem;
}
.error-summary:focus { outline: 3px solid var(--focus); outline-offset: 3px; }
.error-summary h2 { font-size: 1.25rem; margin-bottom: .5rem; }
.error-summary ul { margin: 0; padding-left: 1.25rem; display: grid; gap: .25rem; }
.error-summary a { color: var(--danger); font-weight: 600; }
.form > .error-summary { margin: 0; }
.field-error { margin: 0; color: var(--danger); font-weight: 600; font-size: 1rem; }
.field-has-error { border-left: 4px solid var(--danger); padding-left: .75rem; }
[aria-invalid="true"] { border-color: var(--danger) !important; border-width: 2px !important; }

/* Show password (UX-15) */
.pw-wrap { display: flex; flex-wrap: wrap; gap: .5rem; align-items: stretch; min-width: 0; }
.pw-wrap input { flex: 1 1 8rem; }
.pw-toggle {
  flex: none; min-height: 48px; min-width: 44px; padding: 0 .9rem; cursor: pointer;
  font: 600 1rem/1.2 var(--font-body); color: var(--brand); background: var(--surface);
  border: 2px solid var(--brand); border-radius: var(--radius-sm);
}
.pw-toggle:hover, .pw-toggle[aria-pressed="true"] { background: var(--brand-tint); color: var(--brand-strong); }

/* A privacy switch that sits right under the field it controls (UX-16). */
.share-check { display: flex; gap: .6rem; align-items: center; min-height: 44px; font-weight: 400; cursor: pointer; }
.form-section { display: grid; gap: 1rem; min-width: 0; }
/* The divider sits on the legend, not the fieldset: a fieldset's top border
   runs through its legend ("Emails from the site ———"). */
.form-section + .form-section { margin-top: .5rem; }
.form-section + .form-section > legend { width: 100%; border-top: 1px solid var(--line); padding-top: 1.5rem; }
/* Legends are section headings, not field labels (UX-53): a form section's on
   the h2 scale, a question group's (and an event's Starts / Ends) on the h3
   scale, both bolder than the 600 labels. */
.form-section > legend { font-size: 1.45rem; font-weight: 700; line-height: 1.2; padding: 0; margin-bottom: .5rem; }
.checks > legend, .form-section.question-group > legend { font-size: 1.2rem; font-weight: 700; line-height: 1.25; padding: 0; }
.invite-note { background: var(--success-tint); color: var(--success-ink); border-radius: var(--radius-sm); padding: .8rem 1rem; }
.invite-note p { margin: 0; }
.invite-note p + p { margin-top: .35rem; }
.invite-note a { color: var(--success-ink); }
input[type="file"] { font: inherit; font-size: 1rem; width: 100%; max-width: 100%; min-width: 0; }
input[type="file"]::file-selector-button {
  min-height: 44px; margin-right: .75rem; padding: .45rem 1.1rem; cursor: pointer;
  font: 600 1rem/1.2 var(--font-body); color: var(--brand); background: var(--surface);
  border: 2px solid var(--brand); border-radius: 999px;
}
input[type="file"]::file-selector-button:hover { background: var(--brand-tint); }
input[type="checkbox"], input[type="radio"] { width: 24px; height: 24px; margin: 0; accent-color: var(--brand); flex: none; }

fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.checks { display: grid; gap: .5rem; }
.checks legend { margin-bottom: .25rem; }
.checks label { display: flex; gap: .6rem; align-items: center; min-height: 44px; font-weight: 400; cursor: pointer; }

.segmented { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 5.5rem), 1fr)); gap: .5rem; }
.segmented legend { width: 100%; margin-bottom: .5rem; }
.segmented label {
  display: inline-flex; gap: .5rem; align-items: center; min-height: 48px;
  padding: .4rem 1rem; border: 1.5px solid var(--line); border-radius: 999px; cursor: pointer; justify-content: center;
}
.segmented label:has(input:checked) { border-color: var(--brand); background: var(--brand-tint); }

.hp { position: absolute; left: -9999px; }

.filter-bar { display: flex; gap: 1rem; align-items: flex-end; flex-wrap: wrap; margin-bottom: 1.5rem; }
.filter-bar .field { flex: 1 1 220px; }
.filter-bar .button { min-height: 48px; }

.copy-row { display: flex; gap: .5rem; margin-top: .5rem; flex-wrap: wrap; }
.copy-row input { font-size: .9rem; flex: 1 1 8rem; }
.invite > div { min-width: 0; overflow-wrap: anywhere; }
.copy-row .button { white-space: nowrap; }
/* The family share link on /invites: a long URL that must wrap on phones. */
.share-link { overflow-wrap: anywhere; font-size: .95rem; margin: .5rem 0 .75rem; }
.share-link-card > p:first-child { margin-top: 0; }
.share-link-controls { margin-top: 1rem; }

/* ---------- Flash messages ---------- */
.flashes { display: grid; gap: .5rem; margin-bottom: 1.25rem; }
.flash { margin: 0; padding: .8rem 1rem; border-radius: var(--radius-sm); border-left: 5px solid; }
.flash-success { background: var(--success-tint); border-color: var(--success-ink); color: var(--success-ink); }
.flash-error { background: var(--danger-tint); border-color: var(--danger); color: var(--danger); }
.flash-warning { background: var(--accent-tint); border-color: var(--accent); color: var(--accent); }

/* ---------- Badges, avatars, chips ---------- */
.badge {
  display: inline-block; padding: .15rem .6rem; border-radius: 999px;
  background: var(--surface-2); color: var(--ink); font-size: .875rem; font-weight: 600;
  letter-spacing: .02em; margin: 0 0 .4rem;
}
.badge-announcement, .badge-reunion { background: var(--accent-tint); color: var(--accent); }
.badge-milestone, .badge-graduation, .badge-wedding { background: var(--brand-tint); color: var(--brand-strong); }
.badge-memorial { background: var(--memorial-tint); color: var(--memorial); }
.badge-rsvp-yes { background: var(--success-tint); color: var(--success-ink); }
.badge-warn, .badge-rsvp-no { background: var(--danger-tint); color: var(--danger); }

.avatar { border-radius: 50%; object-fit: cover; flex: none; background: var(--brand-tint); }
.avatar-initials {
  display: inline-grid; place-items: center; color: var(--brand-strong);
  font-family: var(--font-display); font-weight: 600;
}
.avatar-xs { width: 32px; height: 32px; font-size: .875rem; }
.avatar-sm { width: 44px; height: 44px; font-size: 1rem; }
.avatar-md { width: 64px; height: 64px; font-size: 1.4rem; }
.avatar-lg { width: 96px; height: 96px; font-size: 2rem; }
.avatar-xl { width: 140px; height: 140px; font-size: 3rem; }
.site-nav .avatar-initials { background: var(--header-chip); color: var(--header-chip-ink); }

.date-chip, .date-block {
  display: inline-grid; place-items: center; flex: none; text-align: center;
  background: var(--accent-tint); color: var(--accent); border-radius: var(--radius-sm); line-height: 1.1;
}
.date-chip { width: 56px; height: 60px; font-size: .875rem; font-weight: 600; }
.date-chip strong { font-size: 1.35rem; font-family: var(--font-display); }
.date-block { width: 84px; padding: .6rem 0; font-size: .95rem; font-weight: 600; }
.date-block strong { font-size: 2.1rem; font-family: var(--font-display); }

/* ---------- Home ---------- */
.home-grid { display: grid; gap: 1.5rem; grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
/* Phones and tablets: the feed comes first, with a short "Coming up" strip
   above the composer; the full sidebar follows the feed (UX-01). */
@media (max-width: 960px) {
  .home-grid { grid-template-columns: minmax(0, 1fr); }
  .home-newest { display: none; }
}
@media (min-width: 961px) { .coming-up { display: none; } }
.coming-up { margin-bottom: 1.25rem; padding-block: .75rem; }
.coming-up h2 { font-size: 1.1rem; margin-bottom: .4rem; }
.coming-up ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .25rem; }
.coming-up li { overflow-wrap: anywhere; }
.home-side .card { margin-bottom: 1rem; }
.composer-row { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); align-items: start; } /* a photo preview mustn’t stretch the select beside it */

.mini-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .8rem; }
.mini-list li { display: flex; gap: .75rem; align-items: center; line-height: 1.35; }
.mini-list li > :not(.avatar, .date-chip) { min-width: 0; overflow-wrap: anywhere; }
.card-memorial { border-top: 4px solid var(--memorial); }

.thumb-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; }
.thumb-grid img { aspect-ratio: 1; object-fit: cover; border-radius: 6px; width: 100%; }

.post-head { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; margin-bottom: .75rem; }
.post-head > div { display: flex; flex-wrap: wrap; align-items: center; column-gap: .6rem; line-height: 1.3; margin-right: auto; min-width: 0; }
.post-author { font-weight: 600; text-decoration: none; color: var(--ink); display: inline-flex; align-items: center; min-height: 44px; min-width: 0; overflow-wrap: anywhere; }
.post-author:hover { text-decoration: underline; }
.post-head .muted-link { display: inline-flex; align-items: center; min-height: 44px; }
.post-title { font-size: 1.25rem; }
.post-body { overflow-wrap: anywhere; }
/* Long posts are clamped in the feed, with a link to read the rest (UX-21). */
.post-body-clamp { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 8; line-clamp: 8; overflow: hidden; }
.post-photo { margin: 1rem 0 0; }
.post-photo img { border-radius: var(--radius-sm); max-height: 640px; width: auto; }
.post-foot { display: flex; gap: 1.25rem; align-items: center; flex-wrap: wrap; margin-top: 1rem; padding-top: .75rem; border-top: 1px solid var(--line); font-size: .95rem; }
.post-foot a, .post-foot .link-button { display: inline-flex; align-items: center; min-height: 44px; }
.post-announcement { border-left: 5px solid var(--accent); }
.post-milestone { border-left: 5px solid var(--brand); }

.comment-list { list-style: none; margin: 0 0 1.5rem; padding: 0; display: grid; gap: 1.25rem; }
/* A form followed by the entries it adds to (guestbook): separate them. */
.form + .comment-list, .form + .empty { margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }
.comment { display: flex; gap: .75rem; align-items: flex-start; }
.comment > div { min-width: 0; overflow-wrap: anywhere; }
.comment p { margin-bottom: .3rem; }
.comment-meta a { font-weight: 600; }

/* ---------- Directory & profile ---------- */
.member-grid, .album-grid, .biz-grid, .memorial-grid, .event-list, .photo-grid, .invite-list, .stat-row, .plain-list, .rsvp-list, .biz-links {
  list-style: none; margin: 0; padding: 0;
}
/* Directory rows (UX-09): the whole row opens the profile (stretched link),
   Call and Email sit on top of it as their own buttons. */
.member-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 440px), 1fr)); }
.member-row { position: relative; display: flex; align-items: center; flex-wrap: wrap; gap: .5rem 1rem; margin: 0; padding: .75rem 1rem; }
.member-row:hover { border-color: var(--brand); }
.member-row .avatar { width: 56px; height: 56px; font-size: 1.25rem; }
.member-row-main { flex: 1 1 9rem; min-width: 0; }
.member-row-main p { margin: 0; }
.member-name { font-size: 1.15rem; margin: 0; font-family: var(--font-body); font-weight: 600; }
.member-name a { color: var(--brand); }
.member-name a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.member-name a:focus-visible { outline: 0; }
.member-name a:focus-visible::after { outline: 3px solid var(--focus); outline-offset: 2px; }
.member-actions { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: .5rem; }
.sort-note { margin: -.5rem 0 1rem; }

.profile-hero { display: flex; gap: 1.5rem; align-items: center; flex-wrap: wrap; }
.profile-hero p { margin-bottom: .4rem; }
.profile-hero > div { flex: 1 1 10rem; min-width: 0; overflow-wrap: anywhere; }
.details { display: grid; grid-template-columns: max-content 1fr; gap: .5rem 1rem; margin: 0 0 1rem; }
.details dt { font-weight: 600; color: var(--muted); }
.details dd { margin: 0; overflow-wrap: anywhere; }
.plain-list { display: grid; gap: .5rem; overflow-wrap: anywhere; }
.avatar-field { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }

/* ---------- Events ---------- */
.tabs { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.tabs a { padding: .4rem 1rem; border-radius: 999px; border: 1.5px solid var(--line); text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }
.tabs a[aria-current="page"] { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }

.event-list { display: grid; gap: 1rem; }
.event-card { display: flex; gap: 1rem 1.25rem; align-items: center; margin: 0; flex-wrap: wrap; }
.event-card > div { flex: 1 1 10rem; min-width: 0; }
.event-card p { margin: 0; }
.event-title { font-size: 1.3rem; margin: .1rem 0 .2rem; }
.event-title a { color: var(--ink); text-decoration: none; }
.event-title a:hover { text-decoration: underline; }
.event-hero { display: flex; gap: 1.5rem; align-items: flex-start; flex-wrap: wrap; }
.event-hero > div { flex: 1 1 300px; }
.prose { overflow-wrap: anywhere; }
.prose + p { margin-top: 1rem; }
.prose-serif { font-family: var(--font-display); font-size: 1.2rem; line-height: 1.7; }
.rsvp-totals { font-size: 1.05rem; }
.rsvp-status { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin: .5rem 0 1rem; }
.rsvp-status p { margin: 0; }
.rsvp-status .badge { margin: 0; font-size: 1rem; padding: .3rem .8rem; }
.rsvp-list { display: grid; gap: .6rem; }
.rsvp-list li { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.rsvp-list li > * { min-width: 0; overflow-wrap: anywhere; }
.rsvp-list .badge { margin: 0; }

/* ---------- Photos ---------- */
.album-grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.album-card { margin: 0; padding: .75rem; }
.album-card p { margin: .25rem .25rem 0; }
.album-link { text-decoration: none; color: var(--ink); display: grid; gap: .6rem; }
.album-cover { display: block; aspect-ratio: 4 / 3; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); }
.album-cover img { width: 100%; height: 100%; object-fit: cover; }
.album-empty { display: grid; place-items: center; height: 100%; color: var(--muted); font-size: .95rem; }
.album-title { font-family: var(--font-display); font-size: 1.2rem; font-weight: 600; padding-inline: .25rem; }
.album-link:hover .album-title { text-decoration: underline; }

.upload-form { grid-template-columns: minmax(0, 1fr) auto; align-items: end; }
@media (max-width: 600px) { .upload-form { grid-template-columns: minmax(0, 1fr); } }
.photo-grid { display: grid; gap: .5rem; grid-template-columns: repeat(auto-fill, minmax(min(46%, 180px), 1fr)); }
.photo-grid img { aspect-ratio: 1; object-fit: cover; width: 100%; border-radius: 6px; }
.photo-grid a:hover img { opacity: .9; }

.photo-view { margin: 0 0 1rem; text-align: center; }
.photo-view img { margin-inline: auto; max-height: 78vh; width: auto; border-radius: var(--radius-sm); }
.photo-view figcaption { margin-top: .75rem; }
.photo-nav { display: flex; justify-content: space-between; gap: .75rem; flex-wrap: wrap; align-items: center; }
.photo-position { margin: 0; color: var(--muted); }
.photo-actions { justify-content: center; margin-top: 1rem; }
.photo-actions .manage-row { margin-top: 0; padding-top: 0; border-top: 0; }
.album-empty-action { color: var(--brand); text-decoration: underline; }

/* ---------- Businesses ---------- */
.biz-grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
.biz-card { margin: 0; display: flex; flex-direction: column; }
/* Family > Branches (members/branches.php) */
.branch-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.branch-list .card { margin: 0; }
.branch-list .card-title { margin-bottom: .25rem; }
.biz-card > .badge { align-self: flex-start; }
.biz-card .button-row { margin-top: auto; padding-top: .75rem; }
.biz-name { font-size: 1.35rem; }
.offer { background: var(--accent-tint); padding: .6rem .8rem; border-radius: var(--radius-sm); font-size: .95rem; }
.offer strong { color: var(--accent); }
.biz-links { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; margin-bottom: .5rem; overflow-wrap: anywhere; }

/* ---------- In Memoriam ---------- */
.memoriam-head h1, .memorial-hero h1 { color: var(--memorial); }
.memorial-grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); }
.memorial-card { margin: 0; text-align: center; padding: 1rem; border-top: 4px solid var(--memorial); }
.memorial-link { text-decoration: none; color: var(--ink); display: grid; gap: .75rem; justify-items: center; }
.memorial-portrait { display: block; width: 100%; aspect-ratio: 4 / 5; border-radius: var(--radius-sm); overflow: hidden; background: var(--memorial-tint); }
.memorial-portrait img { width: 100%; height: 100%; object-fit: cover; filter: saturate(.85); }
.memorial-initials { display: grid; place-items: center; height: 100%; font: 600 3.5rem var(--font-display); color: var(--memorial); }
.memorial-name { font-family: var(--font-display); font-size: 1.2rem; font-weight: 600; }
.memorial-link:hover .memorial-name { text-decoration: underline; }
.memorial-dates { color: var(--muted); margin: .25rem 0 0; }
.memorial-age { color: var(--muted); margin: .1rem 0 0; font-size: .9rem; }

.memorial-hero {
  display: flex; gap: 2rem; align-items: center; flex-wrap: wrap;
  background: var(--memorial-tint); border-radius: var(--radius); padding: clamp(1.25rem, 4vw, 2.5rem); margin-bottom: 1.25rem;
}
.memorial-hero img { width: min(100%, 280px); border-radius: var(--radius-sm); box-shadow: var(--shadow); }
.memorial-hero > div { flex: 1 1 300px; }
.memorial-kicker { letter-spacing: .04em; font-size: 1rem; color: var(--memorial); font-weight: 600; margin-bottom: .25rem; }
.memorial-dates-lg { font-family: var(--font-display); font-size: 1.25rem; margin-bottom: .25rem; }
.memorial-age-lg { color: var(--muted); margin-top: 0; }
.checks-scroll { display: grid; gap: .25rem; max-height: 20rem; overflow-y: auto; padding: .25rem .5rem; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.memorial-keepers { margin: 1.5rem 0 .5rem; }

/* ---------- Invites & admin ---------- */
.invite-list { display: grid; gap: .75rem; grid-template-columns: minmax(0, 1fr); }
.invite { margin: 0; }
.invite p { margin: .2rem 0 0; }

.stat-row { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); margin-bottom: 1rem; }
@media (max-width: 600px) {
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
  .stat { padding: .75rem; }
  .stat strong { font-size: 1.75rem; }
}
.stat { margin: 0; display: grid; }
.stat strong { font: 600 2.2rem/1.1 var(--font-display); color: var(--brand); }
.stat span { color: var(--muted); font-size: .95rem; }

.pending-card { border-left: 5px solid var(--accent); overflow-wrap: anywhere; }
.pending-name { font-size: 1.25rem; margin-bottom: .2rem; }
.relationship { margin: 0 0 .75rem; padding: .75rem 1rem; background: var(--surface-2); border-radius: var(--radius-sm); }

.table-wrap { overflow-x: auto; padding: 0; position: relative; }
td:first-child { overflow-wrap: anywhere; min-width: 12rem; }
table { width: 100%; border-collapse: collapse; font-size: 1rem; }
th, td { text-align: left; padding: .8rem 1rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .95rem; color: var(--muted); }
tr:last-child td { border-bottom: 0; }
/* Keep the cell a real table-cell (display:flex on <td> drops its table semantics). */
td.actions { white-space: nowrap; }
td.actions .inline-form { display: inline-block; margin: 0 .4rem .4rem 0; }

/* Admin members (UX-05): a table on wide screens, cards on phones. */
.admin-member-cards { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; }
.admin-member-card { margin: 0; overflow-wrap: anywhere; }
.admin-member-card h3 { font-family: var(--font-body); font-size: 1.1rem; margin: 0 0 .25rem; }
.admin-member-card p { margin: 0 0 .25rem; }
.admin-member-card .button-row { margin-top: .75rem; }
@media (max-width: 700px) { .admin-member-table { display: none; } }
@media (min-width: 701px) { .admin-member-cards { display: none; } }

.post-foot .post-delete { margin-left: auto; }
.post-more { margin: .5rem 0 0; }
.field-label { margin: 0; font-weight: 600; font-size: 1rem; }
.field-value { margin: 0; overflow-wrap: anywhere; }
.invite-name { font-family: var(--font-body); font-size: 1.1rem; margin: 0 0 .25rem; }
.share-row { margin-top: .5rem; }
.biz-card .manage-row { margin-top: auto; }
/* Help page inside the signed-out card: no card-in-card frames. */
.public-card .card { border: 0; box-shadow: none; padding: 0; margin-bottom: 1.5rem; }
.empty-state { text-align: center; padding-block: 3rem; }
.empty-state ul { text-align: left; display: inline-grid; gap: .25rem; }

/* Help page and delete confirmations */
.admin-contacts { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; }
.admin-contact { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; }
.admin-contact > div { flex: 1 1 10rem; min-width: 0; }
.admin-contact p { margin: 0; }
.faq h3 { margin-top: 1.25rem; }
/* How-to videos on the Help page (help/index.php) */
.howto-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr)); }
.howto-item h3 { margin: 0 0 .25rem; font-size: 1.1rem; }
.howto-video { display: block; width: 100%; max-width: 270px; height: auto; margin-top: .5rem; border-radius: 12px; background: var(--line); }
/* Phone recordings on small screens, computer recordings (and one wide column) on large ones. */
.howto-desktop:not(.howto-only) { display: none; }
.howto-desktop .howto-video { max-width: 100%; border-radius: 8px; }
@media (min-width: 60rem) {
  .howto-list.has-desktop { grid-template-columns: 1fr; }
  .howto-desktop:not(.howto-only) { display: block; }
  .howto-phone:not(.howto-only) { display: none; }
}
.howto-steps { margin-top: .5rem; }
.howto-steps ol { margin: .5rem 0 0; padding-left: 1.25rem; }
/* The same video as a highlighted banner under a page's heading (partials/howto_inline.php). */
.howto-inline { margin: 0 0 1.5rem; border: 2px solid var(--brand); border-radius: var(--radius); background: var(--brand-tint); }
.howto-inline > summary { display: flex; align-items: center; gap: 1rem; padding: .75rem 1rem; min-height: 64px; cursor: pointer; list-style: none; border-radius: var(--radius); }
.howto-inline > summary::-webkit-details-marker { display: none; }
.howto-inline > summary:hover .howto-inline-title { text-decoration: underline; }
.howto-inline-thumb { position: relative; flex: none; width: 128px; aspect-ratio: 16 / 10; border-radius: 8px; overflow: hidden; background: var(--line); }
.howto-inline-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top; }
.howto-inline-play { position: absolute; inset: 0; margin: auto; width: 44px; height: 44px; border-radius: 50%; background: var(--brand); box-shadow: 0 2px 8px rgba(0, 0, 0, .3); }
.howto-inline-play::before { content: ""; position: absolute; top: 50%; left: 50%; transform: translate(-35%, -50%); border-style: solid; border-width: 9px 0 9px 15px; border-color: transparent transparent transparent var(--surface); }
.howto-inline-text { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.howto-inline-kicker { font-size: .85rem; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; color: var(--brand-strong); }
.howto-inline-title { font-size: 1.15rem; font-weight: 700; color: var(--ink); }
.howto-inline-hint { font-size: .95rem; color: var(--muted); }
.howto-inline[open] .howto-inline-hint { display: none; }
.howto-inline-closehint { display: none; font-size: .95rem; font-weight: 600; color: var(--brand-strong); }
.howto-inline[open] .howto-inline-closehint { display: inline; }
.howto-inline-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem; }
.howto-inline-actions a { display: inline-block; padding: .35rem 0; } /* a 24px+ target once it isn't inline text */
.howto-inline-body { padding: 0 1rem 1rem; }
.howto-inline-body > p { margin: 0 0 .25rem; }
.howto-inline-body > p:last-child { margin: .75rem 0 0; }
.howto-inline-close { min-height: 44px; }
.howto-inline .howto-desktop .howto-video { max-width: 720px; }
@media (max-width: 30rem) { .howto-inline-thumb { width: 88px; } .howto-inline-play { width: 36px; height: 36px; } }
.faq h3:first-of-type { margin-top: 0; }
.confirm-card { max-width: 640px; }
.confirm-card .button-row { gap: 1rem 1.5rem; }
.owner-candidates { margin-top: 1rem; }
.owner-candidate { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1.5rem; }
.owner-candidate p { margin: 0; }

/* ---------- Public (signed-out) pages ---------- */
body.public {
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 10%, rgb(47 93 80 / 18%), transparent 45%),
    radial-gradient(circle at 90% 90%, rgb(162 74 34 / 14%), transparent 40%),
    var(--bg);
}
.public-main { display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; min-height: calc(100vh - 5rem); padding: 2rem var(--gutter) 1rem; }
.public-footer { margin-top: 1rem; }
.public-card {
  width: 100%; max-width: 560px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 20px; padding: clamp(1rem, 5vw, 2.75rem); box-shadow: var(--shadow);
  overflow-wrap: break-word;
}
.public-brand { text-align: center; margin-bottom: 1.5rem; padding-bottom: 1.25rem; border-bottom: 1px solid var(--line); }
.public-brand img { margin: 0 auto .75rem; }
.public-home { display: inline-flex; flex-direction: column; align-items: center; color: inherit; text-decoration: none; border-radius: var(--radius-sm); padding: .25rem .5rem; }
.public-home img { margin-bottom: .75rem; }
.public-home:hover .public-family { text-decoration: underline; text-underline-offset: .18em; }
.public-home:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.public-family { font: 600 1.5rem/1.2 var(--font-display); margin: 0 0 .25rem; color: var(--brand); }
.public-tagline { margin: 0; color: var(--muted); font-style: italic; }
.public-card h1 { font-size: 1.8rem; }
.form-links { margin: 1.25rem 0 0; text-align: center; font-size: 1rem; }
/* "Email me a sign-in link" under the password sign-in (app/views/auth/login.php). */
.signin-alt { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.signin-alt p { margin: 0 0 .75rem; text-align: center; }
.link-actions { display: grid; gap: .75rem; margin-top: 1.5rem; }

/* ---------- Footer ---------- */
/* partials/site_footer.php: three equal columns (heading + vertical links) from
   48em (768px), stacked on phones; a full-width divider; then the bottom bar
   with the note on the left and version + credit on the right (centred and
   stacked on phones). */
.site-footer { border-top: 1px solid var(--line); background: var(--surface); }
.footer-inner { padding-block: 2.5rem 1.25rem; font-size: .95rem; color: var(--muted); }
.footer-nav { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.75rem 2rem; }
@media (min-width: 48em) { .footer-nav { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.footer-heading { margin: 0 0 .5rem; font-size: .8rem; font-weight: 700; line-height: 1.4; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.footer-links { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; align-items: flex-start; }
.footer-links a { display: inline-flex; align-items: center; min-height: 40px; font-size: 1rem; line-height: 1.3; color: var(--ink); text-decoration: none; }
.footer-links a:hover { color: var(--brand-strong); text-decoration: underline; text-underline-offset: .2em; }
.footer-links a[aria-current="page"] { color: var(--brand-strong); font-weight: 700; }
.footer-bottom {
  display: flex; flex-direction: column; align-items: center; gap: .25rem; text-align: center;
  margin-top: 2rem; padding-top: 1.25rem; border-top: 1px solid var(--line); font-size: .875rem;
}
@media (min-width: 48em) {
  .footer-bottom { flex-direction: row; align-items: center; justify-content: space-between; gap: 2rem; text-align: left; }
  .footer-bottom .site-credit { text-align: right; flex: none; max-width: 50%; }
}
.footer-inner .footer-note { margin: 0; max-width: 44rem; line-height: 1.5; }
.footer-brand { display: inline-flex; align-items: center; gap: .45rem; margin-right: .5rem; color: var(--ink); font-weight: 800; vertical-align: middle; }
.footer-brand img { border-radius: 50%; }

@media (prefers-reduced-motion: no-preference) {
  .button, .site-nav a, .tabs a { transition: background-color .15s ease, color .15s ease; }
}

@media print {
  .site-header, .site-footer, .composer, .button, form { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border: 0; }
}

/* ---------- Recipes ---------- */
.recipe-grid, .ingredient-list, .step-list { margin: 0; padding: 0; }
.recipe-grid { list-style: none; display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }
.recipe-card { margin: 0; padding: .75rem; }
.recipe-card p { margin: .25rem .25rem 0; }
.recipe-card .badge { margin-top: .5rem; }
.recipe-link { text-decoration: none; color: var(--ink); display: grid; gap: .6rem; }
.recipe-thumb { display: block; aspect-ratio: 4 / 3; border-radius: var(--radius-sm); overflow: hidden; background: var(--accent-tint); }
.recipe-thumb img { width: 100%; height: 100%; object-fit: cover; }
.recipe-thumb-empty { display: grid; place-items: center; height: 100%; font: 600 3rem var(--font-display); color: var(--accent); }
.recipe-title { font-family: var(--font-display); font-size: 1.2rem; font-weight: 600; padding-inline: .25rem; }
.recipe-link:hover .recipe-title { text-decoration: underline; }
.recipe-credit { color: var(--accent); font-weight: 600; }

.recipe-head { margin-bottom: 1.25rem; }
.recipe-credit-lg { font-family: var(--font-display); font-style: italic; font-size: 1.25rem; color: var(--accent); }
.recipe-meta { display: flex; flex-wrap: wrap; gap: .5rem 2rem; margin: 0 0 1rem; }
.recipe-meta div { display: grid; }
.recipe-meta dt { font-size: .95rem; color: var(--muted); font-weight: 600; }
.recipe-meta dd { margin: 0; font-weight: 600; }
.recipe-actions [hidden] { display: none; }

.recipe-body { display: grid; gap: 1.25rem; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); align-items: start; margin-bottom: 1.25rem; }
.recipe-body > .card { margin: 0; }
@media (max-width: 760px) { .recipe-body { grid-template-columns: minmax(0, 1fr); } }
.recipe-story { border-left: 5px solid var(--accent); }
.ingredient-list { list-style: none; display: grid; gap: .1rem; overflow-wrap: anywhere; }
.ingredient-list li { padding: .45rem 0; border-bottom: 1px solid var(--line); }
.ingredient-list li:last-child { border-bottom: 0; }
.step-list { list-style: none; counter-reset: step; display: grid; gap: 1rem; overflow-wrap: anywhere; }
.step-list li { counter-increment: step; display: grid; grid-template-columns: 2.25rem minmax(0, 1fr); gap: .75rem; align-items: baseline; }
.step-list li::before {
  content: counter(step); display: inline-grid; place-items: center; width: 2.25rem; height: 2.25rem;
  border-radius: 50%; background: var(--brand-tint); color: var(--brand-strong); font: 600 1rem var(--font-display);
}

/* Scanned recipe cards are shown whole (never cropped) so handwriting stays legible. */
.recipe-photo { margin: 0 0 1.25rem; text-align: center; }
.recipe-photo img { margin-inline: auto; width: auto; max-height: 90vh; border-radius: var(--radius-sm); }
.recipe-photo figcaption { margin-top: .75rem; }
.recipe-photo figcaption a { display: inline-flex; align-items: center; min-height: 44px; }

/* Photo caption editor on a single photo page. */
.caption-form { max-width: 720px; margin: 1.5rem auto 0; }

@media print {
  .breadcrumb, .skip-link, .recipe-actions, .recipe-added, .recipe-photo figcaption { display: none !important; }
  .main { padding: 0; }
  .recipe, .recipe .card, .recipe h1, .recipe h2, .recipe-credit-lg, .recipe-meta dt { color: #000; background: #fff; }
  .recipe .card { padding: 0; margin: 0 0 1rem; border-radius: 0; }
  .recipe-story { border-left: 0; }
  .recipe-body { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 1.5rem; }
  .ingredient-list li, .step-list li, .recipe-photo { break-inside: avoid; }
  .ingredient-list li { padding: .15rem 0; border-color: #ccc; }
  .step-list li::before { background: none; border: 1px solid #000; color: #000; }
  .recipe-photo { break-before: auto; }
  .recipe-photo img { max-height: 12cm; }
  .badge { border: 1px solid #000; background: none; color: #000; }
}

/* ---------- Notifications & editing ----------
   Header "Notifications" link with unread count, the /notifications list,
   "Edit" links beside Delete, the "Edited" marker and the edit forms. */
.header-tool {
  display: inline-flex; align-items: center; gap: .4rem; min-height: 44px; min-width: 44px;
  padding: .35rem .85rem; border-radius: 999px; color: var(--header-ink); text-decoration: none; font-size: 1rem;
}
.header-tool:hover { background: rgb(255 255 255 / 14%); color: var(--header-ink); }
.header-tool[aria-current="page"] { background: var(--header-current-bg); color: var(--header-current-ink); }
.notify-count {
  display: inline-grid; place-items: center; min-width: 1.6rem; height: 1.6rem; padding: 0 .4rem;
  border-radius: 999px; background: var(--header-chip); color: var(--header-chip-ink); font-size: .85rem; font-weight: 700; line-height: 1;
}
.header-tool[aria-current="page"] .notify-count { background: var(--header-current-badge); color: var(--header-ink); }

.notify-actions { margin: 0 0 1rem; }
.notify-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.notify-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.notify-item.is-unread { background: var(--brand-tint); border-color: var(--brand); border-left: 5px solid var(--accent); }
.notify-link {
  display: flex; align-items: flex-start; gap: .75rem; min-height: 44px; padding: .75rem 1rem;
  color: var(--ink); text-decoration: none; overflow-wrap: anywhere;
}
.notify-link:hover .notify-title { text-decoration: underline; }
.notify-text { display: grid; gap: .2rem; min-width: 0; }
.notify-title { font-weight: 600; color: var(--brand-strong); }
.notify-item.is-unread .notify-title { font-weight: 700; }
.notify-body { color: var(--ink); }

.edit-link { display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; padding-inline: .25rem; }
.comment .edit-link { margin-right: .75rem; }
.edited-marker { font-style: italic; }
.edit-photo { max-width: 240px; margin: 0; }
.edit-photo img { border-radius: var(--radius-sm); }

/* ---------- Pager (admin member list) ---------- */
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .75rem; margin-block: 1.25rem; }
.pager-status { color: var(--muted); }

/* ---------- Start a family (/start) and the setup checklist (/{slug}/welcome) ---------- */
.address-field { display: flex; align-items: stretch; min-width: 0; }
.address-prefix {
  display: inline-flex; align-items: center; padding: 0 .6rem; border: 1.5px solid var(--field-border);
  border-right: 0; border-radius: var(--radius-sm) 0 0 var(--radius-sm); background: var(--surface-2);
  color: var(--muted); font-size: .95rem; white-space: nowrap; max-width: 55%; overflow: hidden; text-overflow: ellipsis;
}
.address-field input { flex: 1 1 8rem; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.slug-status:empty { display: none; }
.slug-status.slug-ok { color: var(--success-ink); font-weight: 600; }
.slug-status.slug-taken { color: var(--danger); font-weight: 600; }
.setup-checklist { list-style: none; margin: 0 0 1.5rem; padding: 0; display: grid; gap: 1rem; }
.setup-item { display: grid; grid-template-columns: 2.5rem minmax(0, 1fr); gap: 1rem; align-items: start; }
.setup-item p { margin: .25rem 0 0; }
.setup-mark {
  display: inline-grid; place-items: center; width: 2.5rem; height: 2.5rem; border-radius: 50%;
  border: 2px solid var(--brand); color: var(--brand); font-weight: 700;
}
.setup-item.is-done .setup-mark { background: var(--brand); color: var(--surface); }
.setup-title { font-size: 1.15rem; margin: 0; }
.setup-title .badge { margin: 0 0 0 .4rem; vertical-align: middle; }
.badge-done { background: var(--success-tint); color: var(--success-ink); }

/* ---------- Photo storage banner (family admins, 80% and full) ---------- */
.storage-banner { margin-bottom: 1.25rem; padding: .8rem 1rem; border-radius: var(--radius-sm); border-left: 5px solid; }
.storage-banner p { margin: 0; }
.storage-banner p + p { margin-top: .35rem; }
.storage-banner-warn { background: var(--accent-tint); border-color: var(--accent); color: var(--ink); }
.storage-banner-full { background: var(--danger-tint); border-color: var(--danger); color: var(--ink); }

/* ---------- Platform console (/platform) ---------- */
.platform-families { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
.platform-family-name { font-size: 1.2rem; margin: 0 0 .5rem; overflow-wrap: anywhere; }
.platform-family-name .badge { margin: 0 0 0 .4rem; vertical-align: middle; }
.platform-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr)); gap: .5rem 1rem; margin: 0 0 .75rem; }
.platform-facts div { min-width: 0; }
.platform-facts dt { font-size: .85rem; color: var(--muted); }
.platform-facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.platform-action { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: end; margin: .5rem 0; }
.platform-action .field { flex: 1 1 16rem; min-width: 0; }
.audit-meta { overflow-wrap: anywhere; max-width: 28rem; }
.badge-gift { background: var(--success-tint); color: var(--success-ink); }
/* Support view (app/lib/support.php): a platform admin looking at a family's
   site, look only. First thing in <main> on every family page, so it sits
   beside the sidebar on wide screens. --ink on --accent-tint: 12.7:1 light,
   11.6:1 dark; the --accent frame (5.4:1 / 8.8:1 on --bg) marks it as "not a
   member's view". */
.support-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem;
  margin: 0 0 1.25rem; padding: .75rem 1rem; border: 3px solid var(--accent); border-radius: var(--radius-sm);
  background: var(--accent-tint); color: var(--ink);
}
.support-bar-text { flex: 1 1 20rem; min-width: 0; }
.support-bar-title { margin: 0; font-size: 1.1rem; }
.support-bar-facts { margin: .15rem 0 0; overflow-wrap: anywhere; }
.support-bar-end { margin: 0; }
.support-form-family { margin: 0 0 1rem; }

/* ---------- Family branches (spec §8 flow 4) ---------- */
.badge-shared { background: var(--brand-tint); color: var(--brand-strong); }
.shared-with { margin: 0 0 .4rem; }
.audience-choice .audience-branches { display: grid; gap: .25rem; padding-left: 1.75rem; }
.audience-branches .help { margin: 0 0 .25rem; }
/* UX-32: the branch boxes show only once "Only some branches" is picked. A
   browser without :has() drops this rule and simply always shows them. */
.audience-choice:not(:has(input[name="audience"][value="branches"]:checked)) .audience-branches { display: none; }
/* A paid extra that isn't on the family's plan (plan_feature_note(), app/lib/billing.php):
   a short note in place of a dead control. Text keeps full contrast; only the cursor says "not now". */
.plan-note { margin: .35rem 0 .5rem; padding: .6rem .9rem; border-radius: var(--radius-sm); background: var(--brand-tint); border-left: 4px solid var(--brand); color: var(--ink); }
.plan-note a { color: var(--ink); }
.audience-choice .plan-note { margin-left: 1.75rem; }
.audience-branches .plan-note { margin-left: 0; }
label.is-disabled, label.is-disabled input { cursor: not-allowed; }
/* "Which branch of the family are you part of?" on the home page (VOTU P2-05). */
.branch-prompt {
  margin: 0 0 1.25rem; padding: 1rem 1.25rem; border-radius: var(--radius-sm);
  background: var(--brand-tint); border-left: 5px solid var(--brand); color: var(--ink);
}
.branch-prompt-title { font-size: 1.2rem; margin: 0 0 .25rem; }
.branch-prompt p { margin: 0 0 .75rem; }
/* The approval card's branch boxes (VOTU P2-06). */
.relationship-label { margin: 0 0 .25rem; font-weight: 600; }
.relationship-card > p:last-child { margin-bottom: 0; }
.approve-form { margin: 1.25rem 0 .75rem; gap: .75rem; }
.branch-question .checks-or { margin: .1rem 0; color: var(--muted); }
.branch-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; }
.branch-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; }
.branch-rename { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .5rem; flex: 1 1 18rem; min-width: 0; }
.branch-rename .field { flex: 1 1 12rem; min-width: 0; margin: 0; }
.branch-row .branch-count, .branch-row .branch-name { margin: 0; }
.branch-row .button-row { margin: 0; }

/* /start?plan=family: the paid plan picked on /pricing (every family starts on Free). */
.plan-picked { background: var(--brand-tint); color: var(--ink); border-radius: var(--radius-sm); padding: .8rem 1rem; font-size: 1rem; }

/* ---------- Legal pages (/privacy, /terms, /data-deletion) ----------
   In the landing layout in path mode, inside the public card in single mode
   (app/controllers/legal.php), so the styles live here, not in landing.css. */
.landing .legal-wrap { width: 100%; max-width: var(--max); margin-inline: auto; padding: clamp(2rem, 5vw, 3.5rem) var(--gutter) clamp(3rem, 7vw, 5rem); }
.legal { max-width: 46rem; margin-inline: auto; overflow-wrap: break-word; }
.legal-head { margin-bottom: 2rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--line); }
.legal-head h1 { margin-bottom: .35rem; }
.legal-updated { margin: 0 0 1rem; color: var(--muted); font-size: 1rem; }
.legal-lede { font-size: 1.15rem; margin: 0; }
.legal-summary { background: var(--brand-tint); border-radius: var(--radius); padding: 1.25rem 1.5rem; margin-bottom: 1.5rem; }
.legal .legal-summary h2 { font-size: 1.2rem; margin: 0 0 .5rem; }
.legal-summary ul { margin: 0; }
.legal-toc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem 1.5rem; margin-bottom: 1rem; }
.legal .legal-toc h2 { font-size: 1.1rem; margin: 0 0 .5rem; }
.legal-toc ol { margin: 0; padding-left: 1.5rem; columns: 2 15rem; column-gap: 2.5rem; }
.legal-toc li { break-inside: avoid; padding-block: .15rem; }
.legal h2 { font-size: 1.5rem; margin-top: 2.5rem; }
.legal h3 { font-size: 1.15rem; margin-top: 1.5rem; }
.legal ul, .legal ol { padding-left: 1.5rem; }
.legal li + li { margin-top: .4rem; }
.legal code { font-size: .95em; background: var(--surface-2); padding: .05rem .35rem; border-radius: 4px; }
.legal .badge-soon { background: var(--accent-tint); color: var(--accent); font-size: .8rem; vertical-align: middle; white-space: nowrap; }
.legal-steps li { padding-left: .25rem; }
.legal-compare { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); margin-bottom: 1rem; }
.legal-compare > div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; }
.legal .legal-compare h3 { margin-top: 0; }
.legal-compare p:last-child { margin-bottom: 0; }
.legal-foot { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--line); color: var(--muted); font-size: 1rem; }
.public-card .legal-toc, .public-card .legal-compare > div { background: var(--bg); }
.public-card-wide { max-width: 820px; }

/* ---------- Sign-up agreement, leaving and deleting ---------- */
.agree-note { margin: 0 0 1rem; color: var(--muted); font-size: .95rem; }
.account-page { max-width: 46rem; }
.account-page .lede { font-size: 1.15rem; }
.account-page section + section { margin-top: 1.5rem; }
.account-page ul, .account-page ol { padding-left: 1.5rem; }
.account-page li + li { margin-top: .4rem; }
.account-page .help { margin-block: 1rem; }
.notice { border-left: 5px solid var(--accent); background: var(--accent-tint); color: var(--ink); border-radius: var(--radius-sm); padding: 1rem 1.25rem; margin-bottom: 1.5rem; }
.notice-title { font-size: 1.2rem; }
.notice a { color: var(--ink); }
.danger-card { border-top: 4px solid var(--danger); }
.public-card .danger-card { border-top: 2px solid var(--danger); border-radius: 0; padding-top: 1.25rem; }
.danger-zone { margin-top: 2.5rem; }
.account-actions p + p { margin-top: 1rem; }

/* ---------- Invites, the share link and joining with an account (UX review #2) ---------- */
/* Anchored headings (#share-link-title, #inv-title, #members-title) and the
   error summary's links clear the sticky header instead of hiding under it (UX-28). */
html.js { scroll-padding-top: 6.5rem; }
/* /invite/{code} when the invited address already has an account (UX-26). */
.signin-first { margin-top: 1.5rem; }
.signin-first h2 { font-size: 1.3rem; }
.signin-first .form-links { margin-top: .75rem; }
.signin-first-alt { margin: 1.5rem 0 0; padding-top: 1.25rem; border-top: 1px solid var(--line); text-align: center; font-size: 1rem; }
.signin-first-alt p { margin: 0; }
.signin-first-alt a { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; font-weight: 600; }
.field-links { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.25rem; margin: .5rem 0; font-size: 1rem; }
.field-links a:not(.button) { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; }
/* The share link's current state, above its controls (UX-27). */
.status-line { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .6rem; margin: 0 0 1rem; font-size: 1.15rem; font-weight: 600; }
.status-line .badge { margin: 0; font-size: 1rem; }
.badge-on { background: var(--success-tint); color: var(--success-ink); }
.share-link-notice { margin-bottom: 1rem; }
.share-link-manage { font-size: 1.1rem; margin: 1.5rem 0 .5rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.share-link-manage + .share-link-controls { margin-top: 0; }
.confirm-points { padding-left: 1.25rem; margin: 0 0 1.25rem; display: grid; gap: .5rem; }
/* Bulk invites: the itemised result (UX-29) and the folded invite list (UX-30). */
.result-panel { border-left: 5px solid var(--success-ink); margin-bottom: 1rem; overflow-wrap: anywhere; }
.result-panel-info { border-left-color: var(--brand); }
.result-panel h3 { font-size: 1.25rem; margin: 0 0 .5rem; }
.result-title { font-size: 1.05rem; margin: 1rem 0 .25rem; }
.result-list { margin: 0; padding-left: 1.25rem; display: grid; gap: .15rem; }
.result-panel p { margin: .25rem 0 .25rem; }
.invite-counts { font-weight: 600; margin-bottom: .75rem; }
.invite-group { margin-top: 1rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); padding: 0 1rem; }
.invite-group summary { display: flex; align-items: center; min-height: 48px; cursor: pointer; font-weight: 600; color: var(--brand); }
.invite-group[open] { padding-bottom: 1rem; }
.invite-rows { margin: 0; padding: 0; list-style: none; font-size: 1rem; }
/* "Your family is ready" for a start link that was already used (UX-33). */
.start-done .button { margin-top: .5rem; }
/* Billing (app/views/billing/index.php): the plan summary, the storage meter, the Founders card. */
/* The plan card: the plan's name large, then label/value rows divided by
   hairlines (label left, value right; stacked on phones), one tinted box for
   the notes, and the buttons last. */
.plan-hero { margin: .25rem 0 1rem; }
.plan-name { margin: 0; font-size: clamp(1.5rem, 1.3rem + .8vw, 1.9rem); font-weight: 700; line-height: 1.2; color: var(--brand-strong); overflow-wrap: anywhere; }
.plan-sub { margin: .4rem 0 0; color: var(--muted); }
.plan-sub .badge { margin: 0 .35rem 0 0; vertical-align: .1em; }
.plan-rows { margin: 0 0 1.25rem; border-top: 1px solid var(--line); }
.plan-rows > div { display: grid; grid-template-columns: minmax(9rem, 14rem) 1fr; gap: .25rem 1.5rem; padding: .75rem 0; border-bottom: 1px solid var(--line); }
.plan-rows dt { color: var(--muted); }
.plan-rows dd { margin: 0; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 600px) {
  .plan-rows > div { grid-template-columns: 1fr; }
  .plan-rows dt { font-size: .9rem; }
}
.billing-meter { display: flex; align-items: center; gap: .6rem; margin: .5rem 0 0; font-weight: 400; }
.billing-meter progress { flex: 0 1 22rem; min-width: 0; height: 14px; accent-color: var(--brand); }
.billing-meter .small { flex: none; white-space: nowrap; }
.plan-notes { margin: 0 0 1.25rem; padding: .9rem 1.1rem; border-radius: var(--radius-sm); background: var(--brand-tint); color: var(--ink); }
.plan-notes p { margin: 0; }
.plan-notes p + p { margin-top: .6rem; }
.plan-actions .help { margin: .75rem 0 0; }
.billing-portal-form { margin: 0; }
.billing-form .checks label { align-items: flex-start; }
.billing-form .checks label input { margin-top: .2rem; }
.billing-form .help { margin: 0; }
.founders-card { border-left: 5px solid var(--accent); }
.founders-line { font-size: 1.1rem; }
.billing-thanks, .billing-confirming { margin-bottom: 1.5rem; }
.billing-thanks p { margin: 0; }
.billing-summary > .section-title, .billing-upgrade > .section-title, .founders-card > .section-title { margin-top: 0; }
.billing-founders-form { margin: .25rem 0 .75rem; }

/* Last footer line: version and who made the site (app/views/partials/site_credit.php). */
.site-credit { margin: 0; font-size: .875rem; color: var(--muted); }
.site-credit a { display: inline-block; padding-block: .7rem; }

/* /changelog (app/views/changelog.php): releases, newest first. */
.legal .changelog-list { list-style: none; padding: 0; margin: 0; }
.changelog-list li { padding: 1.25rem 0; border-bottom: 1px solid var(--line); }
.changelog-list h2 { font-size: 1.2rem; margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.changelog-list p { margin: .25rem 0 0; }
.changelog-date { color: var(--muted); font-size: .95rem; }

/* Photo pickers: what was chosen, before it is uploaded (site.js). */
.photo-preview { margin-top: .75rem; }
.photo-preview-note { margin: 0 0 .5rem; font-weight: 600; }
.photo-preview-list { list-style: none; margin: 0 0 .75rem; padding: 0; }
.photo-preview-list canvas { display: block; max-width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--line); background: var(--line); }
.photo-preview:not(.photo-preview-many) canvas { max-width: min(100%, 320px); }
.photo-preview-many .photo-preview-list { display: grid; gap: .5rem; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
.photo-preview-many .photo-preview-list canvas { width: 100%; aspect-ratio: 1; object-fit: cover; }
.photo-preview-none { display: block; padding: .75rem; border: 1px dashed var(--line); border-radius: 8px; font-size: .9rem; color: var(--muted); }

/* "Online now" (app/lib/presence.php): a green dot after a name. --success-ink
   is 3:1+ against the page and card backgrounds in both themes. */
.online-dot { display: inline-block; width: .7rem; height: .7rem; margin-left: .4rem; border-radius: 50%; background: var(--success-ink); box-shadow: 0 0 0 2px var(--surface); vertical-align: middle; }

/* Family chat (app/views/chat/index.php). */
.chat-layout { display: grid; gap: 1rem; grid-template-columns: 1fr; }
.chat-rooms ul, .chat-online ul { list-style: none; margin: 0; padding: 0; }
.chat-rooms ul { display: flex; flex-wrap: wrap; gap: .5rem; }
.chat-rooms a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 1rem; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; }
.chat-rooms a[aria-current="page"] { background: var(--brand); border-color: var(--brand); color: var(--surface); font-weight: 600; }
.chat-online li { display: flex; align-items: flex-start; gap: .5rem; padding: .55rem 0; line-height: 1.35; }
.chat-online li .online-dot { margin-top: .35rem; flex: none; }
.chat-online .online-dot { margin-left: 0; }
.chat-who { margin: -.25rem 0 .75rem; }
.chat-log { list-style: none; margin: 0; padding: .25rem 0; max-height: 60vh; overflow-y: auto; display: flex; flex-direction: column; gap: .75rem; }
.chat-msg { display: flex; gap: .6rem; align-items: flex-start; }
.chat-avatar { flex: none; text-decoration: none; }
.chat-bubble { min-width: 0; max-width: 42rem; padding: .5rem .85rem; border-radius: 14px; background: var(--surface-2); }
.chat-mine .chat-bubble { background: var(--brand-tint); }
.chat-meta { margin: 0 0 .15rem; font-size: .9rem; }
.chat-meta a { font-weight: 600; }
.chat-meta time { color: var(--muted); margin-left: .35rem; }
.chat-body { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-delete { margin-top: .15rem; }
.chat-empty { margin: 1rem 0; }
.chat-form { margin-top: 1rem; display: grid; gap: .35rem; }
.chat-form label { font-weight: 600; }
.chat-form .help { margin: 0; }
.chat-form button { justify-self: start; }
@media (min-width: 60rem) {
  .chat-layout { grid-template-columns: 15rem minmax(0, 1fr) 15rem; align-items: start; }
  .chat-rooms ul { display: block; }
  .chat-rooms li + li { margin-top: .35rem; }
  .chat-rooms a { display: flex; border-radius: 12px; padding: .5rem 1rem; line-height: 1.3; }
}
/* With the left sidebar (1200px+) the page is narrower: slimmer side columns until there is room. */
@media (min-width: 75em) and (max-width: 90em) {
  .chat-layout { grid-template-columns: 12rem minmax(0, 1fr) 12rem; }
}

/* New chat messages (app/lib/chat_unread.php): the count on a room's pill,
   the dot on the phone/tablet Menu button, and the line on Home. */
.room-count {
  display: inline-grid; place-items: center; min-width: 1.5rem; height: 1.5rem; margin-left: .5rem; padding: 0 .4rem;
  border-radius: 999px; background: var(--accent); color: var(--surface); font-size: .85rem; font-weight: 700; line-height: 1;
}
.chat-rooms a[aria-current="page"] .room-count { background: var(--surface); color: var(--brand-strong); }
.nav-dot { display: inline-block; width: .7rem; height: .7rem; border-radius: 50%; background: var(--header-chip); }
.home-chat { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin: 0 0 1.25rem; padding: .75rem 1rem;
  border: 1px solid var(--line); border-left: 5px solid var(--accent); border-radius: var(--radius-sm); background: var(--surface); }
.home-chat a { font-weight: 600; display: inline-flex; align-items: center; min-height: 44px; }

/* "Report" on someone else's chat message or comment (partials/report_form.php). */
.report { margin-top: .15rem; }
.report summary { display: inline-flex; align-items: center; min-height: 44px; color: var(--muted); cursor: pointer; text-decoration: underline; text-underline-offset: .18em; }
.report summary:hover { color: var(--ink); }
.report[open] summary { color: var(--ink); }
.report-form { display: grid; gap: .35rem; max-width: 26rem; margin: .25rem 0 .5rem; }
.report-form .help { margin: 0; }
.report-form button { justify-self: start; }
.report-done { margin: .25rem 0 0; }

/* Admin: "Reported" and "Chat monitor" (app/views/admin/reported.php, chat.php). */
.mod-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
.mod-item { overflow-wrap: anywhere; }
.mod-where { margin: 0 0 .25rem; font-weight: 600; }
.mod-meta { margin: 0 0 .5rem; color: var(--muted); font-size: .95rem; }
.mod-text { margin: 0 0 .75rem; padding: .6rem .85rem; border-left: 4px solid var(--line); background: var(--surface-2); border-radius: 8px; white-space: pre-wrap; }
.mod-reports { margin: 0 0 .75rem; padding-left: 1.25rem; }
.mod-reports li + li { margin-top: .25rem; }
.mod-flag { color: var(--danger); font-weight: 600; }

/* Event form: what an empty time or a past date will do (site.js). */
.form-note { margin: .5rem 0 0; padding: .6rem .85rem; border-left: 4px solid var(--brand); border-radius: 8px; background: var(--brand-tint); color: var(--ink); }
.form-note-warn { border-left-color: var(--accent); background: var(--accent-tint); }
.chat-branch-hint { margin: .85rem 0 0; color: var(--muted); }

/* ---------- Hearts on posts and photos (app/views/partials/heart.php) ---------- */
.heart { display: inline-flex; align-items: center; flex-wrap: wrap; gap: .25rem .75rem; }
.heart-button {
  display: inline-flex; align-items: center; gap: .4rem; min-height: 44px; padding: .3rem .9rem;
  font: inherit; font-weight: 600; color: var(--ink); background: var(--surface);
  border: 1.5px solid var(--field-border); border-radius: 999px; cursor: pointer;
}
.heart-button:hover { border-color: var(--accent); }
.heart-icon::before { content: "\2661\FE0E"; font-size: 1.2em; line-height: 1; color: var(--accent); }
.heart-button[aria-pressed="true"] { background: var(--accent-tint); border-color: var(--accent); }
.heart-button[aria-pressed="true"] .heart-icon::before { content: "\2665\FE0E"; }
.heart-who summary { display: inline-flex; align-items: center; min-height: 44px; cursor: pointer; color: var(--brand); text-decoration: underline; text-underline-offset: .18em; }
.heart-who[open] summary { margin-bottom: .1rem; }
.heart-who p { margin: 0 0 .25rem; color: var(--muted); }
.heart-who:empty { display: none; }
.photo-actions .heart { margin-right: auto; }
.photo-comments { max-width: 720px; margin: 1.5rem auto 0; }
/* Cancel invite (UX-31): its own row under the share buttons; admins' list of everyone's open invites. */
.invite-cancel { display: block; margin-top: .75rem; }
.all-invite { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1.5rem; }
.all-invite p { margin: 0; }
/* "What to bring" on events (app/views/partials/bring_list.php, bring_form_rows.php). */
.bring-count { font-size: 1.05rem; }
.bring-hint { margin: .25rem 0 .75rem; }
.bring-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; }
.bring-item { border-top: 1px solid var(--line); padding-top: .75rem; }
.bring-list > .bring-item:first-child { border-top: 0; padding-top: 0; }
.bring-row-main { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; }
.bring-row-main > p { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.bring-what { flex: 1 1 14rem; }
.bring-name { font-weight: 600; }
.bring-note { color: var(--muted); }
.bring-note::before { content: "· "; }
.bring-who { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.bring-who .badge { margin: 0; }
.bring-manage { margin-top: .5rem; }
.bring-manage > summary { display: inline-flex; align-items: center; min-height: 44px; cursor: pointer; color: var(--brand); font-weight: 600; font-size: 1rem; }
.bring-manage[open] { padding: .25rem 1rem 1rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.bring-edit-form { margin-bottom: .75rem; }
.bring-add-form { margin-top: .5rem; }
.bring-row-list { list-style: none; margin: 0 0 .75rem; padding: 0; display: grid; gap: 1rem; }
.bring-form-row { display: grid; gap: .75rem 1rem; grid-template-columns: 1fr; padding-bottom: .75rem; border-bottom: 1px solid var(--line); }
.bring-form-row .field { min-width: 0; }
.bring-rows > [data-bring-more] { justify-self: start; }
@media (min-width: 48rem) {
  .bring-form-row { grid-template-columns: 2fr 1fr 1.5fr; align-items: end; }
}
/* "Install or remove the app" (app/views/pwa/app.php) and the install box on
   Help and the profile (partials/pwa_install.php, assets/js/pwa.js). */
.pwa-inner { max-width: 46rem; overflow-wrap: break-word; }
.landing .pwa-inner { margin-inline: auto; }
.pwa-install p { margin: 0 0 .75rem; }
.pwa-install .help:empty { display: none; }
.pwa-steps-title { font-size: 1.1rem; margin: 1.5rem 0 .5rem; }
.pwa-platforms { display: grid; gap: .5rem; }
.pwa-platform { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); padding: 0 1rem; }
.pwa-platform summary { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; min-height: 48px; padding: .35rem 0; cursor: pointer; font-weight: 600; color: var(--brand); }
.pwa-platform[open] { padding-bottom: .75rem; }
.pwa-platform ol { margin: 0; padding-left: 1.5rem; display: grid; gap: .35rem; }
.pwa-this-device { font-weight: 400; color: var(--muted); }
.pwa-remove { margin-top: 1rem; }
.pwa-remove .help:empty { display: none; }
.pwa-device .button-row { margin-top: .5rem; }

/* ---------- Appearance: Automatic / Light / Dark (partials/theme_switch.php) ----------
   A labelled group of three buttons; the chosen one is aria-pressed="true" and
   filled. Places: the sidebar / Menu (.theme-switch-nav), the footer of the
   landing, public and platform layouts (.theme-switch-footer) and the profile
   page (.theme-switch-card). */
.theme-switch { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .75rem; margin: 0; }
.theme-switch-label { margin: 0; font-size: .95rem; font-weight: 700; color: var(--ink); }
.theme-switch-options {
  display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 2px;
  border: 1px solid var(--field-border); border-radius: 999px; background: var(--surface);
}
.theme-switch-options button {
  min-height: 40px; min-width: 44px; padding: .3rem .9rem; border: 0; border-radius: 999px;
  background: transparent; color: var(--ink); font: inherit; font-size: .95rem; line-height: 1.2; cursor: pointer;
}
.theme-switch-options button:hover { background: var(--surface-2); }
.theme-switch-options button[aria-pressed="true"] { background: var(--brand); color: var(--on-brand); font-weight: 700; }
.theme-switch-options button:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.theme-switch-card .theme-switch-label {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.appearance-card .help { margin-bottom: .85rem; }
.footer-appearance { display: flex; justify-content: center; margin-top: 2rem; }
.footer-appearance .theme-switch { justify-content: center; }
.footer-appearance + .footer-bottom { margin-top: 1.25rem; }
@media (min-width: 48em) {
  .footer-appearance, .footer-appearance .theme-switch { justify-content: flex-start; }
}
/* In the phone/tablet Menu the switch sits on the green header. */
.theme-switch-nav { padding: .4rem .75rem; }
.theme-switch-nav .theme-switch-label { color: var(--header-ink); font-size: 1rem; }
.theme-switch-nav .theme-switch-options { background: transparent; border-color: rgb(255 255 255 / 60%); }
.theme-switch-nav .theme-switch-options button { color: var(--header-ink); }
.theme-switch-nav .theme-switch-options button:hover { background: rgb(255 255 255 / 14%); }
.theme-switch-nav .theme-switch-options button[aria-pressed="true"] { background: var(--header-current-bg); color: var(--header-current-ink); }
.theme-switch-nav .theme-switch-options button:focus-visible { outline-color: var(--focus-on-brand); }
/* The wide-screen sidebar: a small heading over a compact segmented control. */
@media (min-width: 75em) {
  .theme-switch-nav { display: block; padding: 0 .75rem .9rem; }
  .theme-switch-nav .theme-switch-label {
    margin: 0 0 .45rem; font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
  }
  .theme-switch-nav .theme-switch-options { display: flex; flex-wrap: nowrap; border-color: var(--field-border); background: var(--surface); }
  .theme-switch-nav .theme-switch-options button { flex: 1 1 auto; min-width: 0; min-height: 36px; padding: .25rem .45rem; font-size: .85rem; color: var(--ink); }
  .theme-switch-nav .theme-switch-options button:hover { background: var(--surface-2); }
  .theme-switch-nav .theme-switch-options button[aria-pressed="true"] { background: var(--brand); color: var(--on-brand); }
  .theme-switch-nav .theme-switch-options button:focus-visible { outline-color: var(--focus); }
}
.checks-inline { grid-template-columns: repeat(auto-fit, minmax(6.5rem, max-content)); column-gap: 1.5rem; }
.checks-inline > .help { grid-column: 1 / -1; margin: 0; }
