/* The shul's components: buttons, fields, chips, cards, sections, tables, dialogs, notices,
   loading placeholders and icons. Every page links it after /css/tokens.css (whose tokens are the
   only values used here) and before its own stylesheet (style.css, home.css), which holds the
   page layouts and can override a component with a selector of its own.

   It applies only to a page whose <body> has one of these classes (every page has one):
   - body.app: the back office and the members portal. Inter for text (FONTS.ui), Frank Ruhl Libre
     for titles, section names and Hebrew.
   - body.auth: the login, sign-up and password pages. As body.app.
   - body.public: the public site (home, about, donate, zmanim). The components, in the serif.

   The few rules that must win over a page's own element rules (dialog, [inert], [hidden], .hint,
   .form-error, .form-done) start with body:is(...); the rest start with :where(...), so they
   weigh no more than their own class or element.

   Classes (markup in brackets):
   - Buttons: a plain <button> (or a.button) is the secondary style; .primary (the form's main
     action), .danger (destructive, filled red), .danger-outline (destructive, quieter), .quiet (no
     frame: row actions), .small, .icon-button (only an icon; give it aria-label). aria-busy="true"
     shows a spinner (lib/busy.js sets it).
   - Fields: input, select, textarea; aria-invalid="true" for an error. .field [label, control,
     .hint, .field-error], .form-error and .form-done (a check before it) under a form,
     .segmented [label > input[type=radio] + text, …].
   - .chip (.success, .warning, .danger, .neutral): a status with a dot.
   - .card: a white panel. .section: a <details class="section"> card whose <summary> holds an
     h2 (or .section-title), an optional .summary-desc (shown while open) and .summary-note (on
     the right, shown while closed); .dirty or .has-error on the <details> puts a dot after the
     title; .section-body and .section-foot (the Save button and its status) inside.
   - .table-wrap [table.data-table]: the frame, scrolling sideways on a phone; .table-wrap.tall
     also scrolls down within 70vh so the sticky header row stays in view. td.num / th.num:
     right-aligned figures; .nowrap: a cell kept on one line (dates); tr.empty: the "nothing here" row; th > button: a sortable column.
   - .skeleton (.title, .line, .block): a grey block shimmering while a page loads.
   - dialog (lib/dialog.js builds them): h2, .dialog-text, .dialog-actions (its footer), .danger
     (a red icon .dialog-icon).
   - .page-head [nav.breadcrumb > ol > li, h1, .subtitle, .page-actions].
   - .stats [.stat > .stat-label, .stat-value, .stat-meta]: figures in one framed row.
   - .notice (.success, .warning, .danger; plain is information): a banner, optional svg.icon first.
   - .visually-hidden, .hint, .muted, .num, svg.icon (lib/icons.js), .spinner.
   - .powered-by [a[href="https://schwai.com"] > "Powered by" + img[src="/schwai-logo.png"]]: the
     bar pinned to the foot of the window on every page that has it (lib/powered-by.js,
     SITE_FOOTER); hidden in print. --powered-by-height is its height, the room each page leaves
     under its content. */

/* ---------- The page ---------- */
body.app, body.auth {
  font-family: var(--font-ui);
  font-size: var(--text-ui-base);
  line-height: 1.5;
  font-feature-settings: "cv11"; /* Inter's single-storey a: softer next to the serif */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: var(--ink);
  background: var(--paper);
}
:where(body.app, body.auth) :where(h1, h2) { font-family: var(--font-serif); font-weight: var(--weight-medium); line-height: 1.2; }
:where(body.app, body.auth) h1 { font-size: var(--text-ui-title); letter-spacing: -0.012em; line-height: 1.12; }
:where(body.app, body.auth) h2 { font-size: var(--text-xl); letter-spacing: -0.005em; }
:where(body.app, body.auth) h3 { font-size: var(--text-ui-sm); font-weight: var(--weight-semibold); }
/* Hebrew reads in the serif; typed Hebrew a size up. */
:where(body.app, body.auth) :lang(he) { font-family: var(--font-serif); }
:where(body.app, body.auth) :where(input, textarea)[data-hebrew] { font-family: var(--font-serif); font-size: var(--text-md); }

/* A page or part waiting for the server is inert (lib/busy.js): no fade; the button shows it. */
body:is(.app, .auth, .public) [inert] { opacity: 1; }
body:is(.app, .auth, .public) [hidden] { display: none !important; }

/* ---------- Icons ---------- */
svg.icon {
  flex: none;
  width: var(--size-icon);
  height: var(--size-icon);
  vertical-align: -0.2em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:where(body.app, body.auth, body.public) .muted { color: var(--muted); }
:where(body.app, body.auth, body.public) .num { font-variant-numeric: tabular-nums; }

/* ---------- Buttons ---------- */
:where(body.app, body.auth, body.public) :where(button:not(.seat), a.button) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: var(--size-button);
  padding: 0 var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow-button);
  font: inherit;
  font-size: var(--text-ui-sm);
  font-weight: var(--weight-strong);
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--motion-fast) var(--motion-ease), border-color var(--motion-fast) var(--motion-ease), box-shadow var(--motion-fast) var(--motion-ease);
}
:where(body.public) :where(button:not(.seat), a.button) { font-size: var(--text-ui); }
:where(body.app, body.auth, body.public) :where(button:not(.seat, .primary, .danger, .danger-outline, .quiet), a.button:not(.primary, .danger, .danger-outline, .quiet)):hover:not(:disabled) { border-color: var(--border-strong); background: var(--paper); }
:where(body.app, body.auth, body.public) :where(button:not(.seat, .primary, .danger, .danger-outline, .quiet), a.button:not(.primary, .danger, .danger-outline, .quiet)):active:not(:disabled) { background: var(--tint-strong); }
/* :is() weighs as an element, so the ring also shows on .quiet and .danger-outline. */
:where(body.app, body.auth, body.public) :is(button, a.button):focus-visible { outline: none; border-color: var(--ink); box-shadow: var(--shadow-ring); }
:where(body.app, body.auth, body.public) :where(button:not(.seat), a.button) svg.icon { width: 15px; height: 15px; }

:where(body.app, body.auth, body.public) :where(button, a.button).primary { border-color: var(--ink); background: var(--ink); color: var(--on-ink); box-shadow: var(--shadow-button-filled); }
:where(body.app, body.auth, body.public) :where(button, a.button).primary:hover:not(:disabled) { border-color: var(--ink-hover); background: var(--ink-hover); }
:where(body.app, body.auth, body.public) :where(button, a.button).primary:focus-visible { box-shadow: var(--shadow-ring), var(--shadow-button-filled); }

:where(body.app, body.auth, body.public) :where(button, a.button).danger { border-color: var(--error); background: var(--error); color: var(--on-ink); box-shadow: var(--shadow-button-filled); }
:where(body.app, body.auth, body.public) :where(button, a.button).danger:hover:not(:disabled) { border-color: var(--danger-hover); background: var(--danger-hover); }
:where(body.app, body.auth, body.public) :where(button, a.button).danger:focus-visible { border-color: var(--danger-hover); box-shadow: var(--shadow-danger-ring); }

:where(body.app, body.auth, body.public) :where(button, a.button).danger-outline { border-color: var(--danger-line); background: var(--card); color: var(--error); }
:where(body.app, body.auth, body.public) :where(button, a.button).danger-outline:hover:not(:disabled) { border-color: var(--danger-line); background: var(--danger-soft); }

:where(body.app, body.auth, body.public) :where(button, a.button).quiet { padding: 0 var(--space-3); border-color: transparent; background: transparent; box-shadow: none; }
:where(body.app, body.auth, body.public) :where(button, a.button).quiet:hover:not(:disabled) { border-color: transparent; background: var(--tint); }
:where(body.app, body.auth, body.public) :where(button, a.button).quiet.danger { color: var(--error); background: transparent; box-shadow: none; }
:where(body.app, body.auth, body.public) :where(button, a.button).quiet.danger:hover:not(:disabled) { background: var(--danger-soft); }

:where(body.app, body.auth, body.public) :where(button, a.button).small { height: var(--size-button-sm); padding: 0 var(--space-3); font-size: var(--text-ui-sm); }
:where(body.app, body.auth, body.public) :where(button, a.button).icon-button { width: var(--size-button); padding: 0; }
:where(body.app, body.auth, body.public) :where(button, a.button).icon-button.small { width: var(--size-button-sm); }

/* Disabled: faded, and nothing changes under the pointer. */
:where(body.app, body.auth, body.public) button:disabled { opacity: 0.45; cursor: not-allowed; }

/* Working (lib/busy.js): a spinner before the working label, not faded. */
:where(body.app, body.auth, body.public) button[aria-busy="true"] { opacity: 1; cursor: progress; }
:where(body.app, body.auth, body.public) button[aria-busy="true"]::before, .spinner {
  content: "";
  flex: none;
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: ui-spin var(--motion-spin) linear infinite;
}
@keyframes ui-spin { to { transform: rotate(360deg); } }

/* ---------- Fields ---------- */
:where(body.app, body.auth, body.public) :where(input:not([type="checkbox"], [type="radio"], [type="range"], [type="file"], [type="color"], [type="hidden"], [type="submit"], [type="button"]), select, textarea) {
  max-width: 100%;
  height: var(--size-field);
  padding: 0 var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow-field);
  font: inherit;
  font-variant-numeric: tabular-nums;
  transition: border-color var(--motion-fast) var(--motion-ease), box-shadow var(--motion-fast) var(--motion-ease);
}
:where(body.app, body.auth, body.public) textarea { height: auto; min-height: 84px; padding: 10px var(--space-3); line-height: 1.5; resize: vertical; }
:where(body.app, body.auth, body.public) :where(input, select, textarea):hover:not(:disabled, :focus, [aria-invalid="true"]) { border-color: var(--border-strong); }
:where(body.app, body.auth, body.public) :where(input, select, textarea):focus { outline: none; border-color: var(--ink); box-shadow: var(--shadow-ring); }
:where(body.app, body.auth, body.public) :where(input, select, textarea)[aria-invalid="true"] { border-color: var(--error); box-shadow: var(--shadow-danger-ring); }
:where(body.app, body.auth, body.public) :where(input, select, textarea):disabled { background: var(--tint); color: var(--muted); cursor: not-allowed; }
:where(body.app, body.auth, body.public) :where(input, textarea)::placeholder { color: var(--placeholder); }
/* A select's arrow, drawn with two gradients (no image). */
:where(body.app, body.auth, body.public) select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: var(--space-7);
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 52%, calc(100% - 12px) 52%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}
:where(body.app, body.auth, body.public) :where(input[type="checkbox"], input[type="radio"]) { width: 16px; height: 16px; margin: 0; accent-color: var(--ink); vertical-align: -0.2em; }
:where(body.app, body.auth, body.public) label:has(> input[type="checkbox"], > input[type="radio"]) { display: inline-flex; align-items: center; gap: var(--space-2); cursor: pointer; }

/* A field: its label, the control, a hint and its error, one under the other. */
:where(body.app, body.auth, body.public) .field { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
:where(body.app, body.auth, body.public) :where(.field > label, .field > .label, legend) { color: var(--muted); font-size: var(--text-ui-label); font-weight: var(--weight-medium); }
body:is(.app, .auth, .public) .hint { margin: 0; color: var(--muted); font-size: var(--text-ui-xs); }
:where(body.app, body.auth, body.public) .field-error { margin: 0; color: var(--error); font-size: var(--text-ui-xs); }
:where(body.app, body.auth, body.public) .field-error:empty { display: none; }

/* A form's outcome, next to its button: errors in red, "Saved just now" in green with a check. */
body:is(.app, .auth, .public) .form-error { margin: 0; min-height: 0; color: var(--error); font-size: var(--text-ui-sm); }
body:is(.app, .auth, .public) .form-done { display: inline-flex; align-items: center; gap: 6px; margin: 0; min-height: 0; color: var(--success); font-size: var(--text-ui-sm); }
body:is(.app, .auth, .public) .form-done:not(:empty)::before {
  content: "";
  flex: none;
  width: 9px;
  height: 5px;
  margin: -3px 2px 0 1px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
}

/* Two or three choices as one control (Yearly / Monthly). */
:where(body.app, body.auth, body.public) .segmented { display: inline-flex; height: var(--size-field); padding: 3px; border: 1px solid var(--border); border-radius: var(--radius-control); background: var(--tint); }
:where(body.app, body.auth, body.public) .segmented label { position: relative; display: flex; align-items: center; padding: 0 var(--space-4); border-radius: var(--radius-md); color: var(--muted); cursor: pointer; }
:where(body.app, body.auth, body.public) .segmented input { position: absolute; opacity: 0; pointer-events: none; }
:where(body.app, body.auth, body.public) .segmented label:has(input:checked) { background: var(--card); color: var(--ink); font-weight: var(--weight-strong); box-shadow: var(--shadow-segment); }
:where(body.app, body.auth, body.public) .segmented label:has(input:focus-visible) { box-shadow: var(--shadow-ring), var(--shadow-segment); }

/* ---------- Chips ---------- */
:where(body.app, body.auth, body.public) .chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: var(--size-chip);
  padding: 0 9px 0 var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--neutral-soft);
  color: var(--muted);
  font-size: var(--text-ui-xs);
  font-weight: var(--weight-strong);
  line-height: 1;
  white-space: nowrap;
}
:where(body.app, body.auth, body.public) .chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
:where(body.app, body.auth, body.public) .chip.success { border-color: var(--success-line); background: var(--success-soft); color: var(--success); }
:where(body.app, body.auth, body.public) .chip.warning { border-color: var(--warning-line); background: var(--warning-soft); color: var(--warning); }
:where(body.app, body.auth, body.public) .chip.danger { border-color: var(--danger-line); background: var(--danger-soft); color: var(--error); }
:where(body.app, body.auth, body.public) .chip.neutral { border-color: var(--border); background: var(--neutral-soft); color: var(--muted); }

/* ---------- Cards and sections ---------- */
:where(body.app, body.auth, body.public) .card {
  padding: var(--space-6);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--card);
  box-shadow: var(--shadow-card);
}
:where(body.app, body.auth, body.public) .card > h2:first-child { margin-top: 0; }

:where(body.app, body.auth, body.public) .section {
  margin: 0 0 var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--card);
  box-shadow: var(--shadow-card);
  scroll-margin-top: 60px;
}
:where(body.app, body.auth, body.public) .section > summary {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 60px;
  padding: var(--space-2) var(--space-6) var(--space-2) var(--space-5);
  border-radius: var(--radius-card);
  list-style: none;
  cursor: pointer;
  user-select: none;
}
:where(body.app, body.auth, body.public) .section > summary::-webkit-details-marker { display: none; }
/* The chevron: points right while closed, down while open. */
:where(body.app, body.auth, body.public) .section > summary::before {
  content: "";
  flex: none;
  width: 7px;
  height: 7px;
  margin: 0 var(--space-1);
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform var(--motion-base) var(--motion-ease);
}
:where(body.app, body.auth, body.public) .section[open] > summary::before { transform: rotate(45deg); }
:where(body.app, body.auth, body.public) .section > summary:hover { background: var(--tint); }
:where(body.app, body.auth, body.public) .section[open] > summary { border-radius: var(--radius-card) var(--radius-card) 0 0; }
:where(body.app, body.auth, body.public) .section[open] > summary:hover { background: transparent; }
:where(body.app, body.auth, body.public) .section > summary:focus-visible { outline: none; box-shadow: inset 0 0 0 1px var(--ink), var(--shadow-ring); }
:where(body.app, body.auth, body.public) .section > summary > :where(h2, h3, .section-title) { margin: 0; font-family: var(--font-serif); font-size: var(--text-xl); font-weight: var(--weight-medium); letter-spacing: -0.005em; line-height: 1.2; }
:where(body.app, body.auth, body.public) .section .summary-desc { color: var(--muted); font-size: var(--text-ui-sm); }
:where(body.app, body.auth, body.public) .section:not([open]) .summary-desc { display: none; }
:where(body.app, body.auth, body.public) .section .summary-note { margin-left: auto; color: var(--muted); font-size: var(--text-ui-sm); font-variant-numeric: tabular-nums; text-align: right; }
:where(body.app, body.auth, body.public) .section[open] .summary-note { display: none; }
/* Unsaved changes (or an error) inside: a dot after the title. */
:where(body.app, body.auth, body.public) .section:is(.dirty, .has-error) > summary > :where(h2, h3, .section-title)::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-left: var(--space-2);
  border-radius: 50%;
  background: var(--warning);
  vertical-align: 0.2em;
}
:where(body.app, body.auth, body.public) .section.has-error > summary > :where(h2, h3, .section-title)::after { background: var(--error); }
:where(body.app, body.auth, body.public) .section.danger > summary > :where(h2, h3, .section-title) { color: var(--error); }
:where(body.app, body.auth, body.public) .section.danger > summary::before { border-color: var(--error); }
:where(body.app, body.auth, body.public) .section-body { padding: var(--space-1) var(--space-6) var(--space-6); }
:where(body.app, body.auth, body.public) .section-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3) var(--space-4);
  padding: var(--space-3) var(--space-6);
  border-top: 1px solid var(--border);
  border-radius: 0 0 var(--radius-card) var(--radius-card);
  background: var(--tint);
}

/* ---------- Tables ---------- */
/* position: relative: the frame holds its absolutely placed parts (a card chip's visually-hidden name), so they scroll and clip with the table instead of widening the page on a phone. */
:where(body.app, body.auth, body.public) .table-wrap { position: relative; max-width: 100%; overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-inset); background: var(--card); }
:where(body.app, body.auth, body.public) .table-wrap.tall { max-height: 70vh; overflow-y: auto; }
:where(body.app, body.auth, body.public) .data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--text-ui-base); }
:where(body.app, body.auth, body.public) .data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  height: 36px;
  padding: 0 var(--space-4);
  border-bottom: 1px solid var(--border);
  background: var(--tint);
  color: var(--muted);
  font-size: var(--text-ui-label);
  font-weight: var(--weight-medium);
  text-align: left;
  white-space: nowrap;
}
:where(body.app, body.auth, body.public) .data-table td { padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border); vertical-align: middle; overflow-wrap: break-word; }
:where(body.app, body.auth, body.public) .data-table tbody tr:last-child td { border-bottom: 0; }
:where(body.app, body.auth, body.public) .data-table tbody tr:hover td { background: var(--paper); }
:where(body.app, body.auth, body.public) .data-table :where(th, td).num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
:where(body.app, body.auth, body.public) .data-table :where(th, td).nowrap { white-space: nowrap; }
:where(body.app, body.auth, body.public) .data-table tr.empty td { padding: var(--space-7) var(--space-4); color: var(--muted); text-align: center; }
:where(body.app, body.auth, body.public) .data-table tr.empty:hover td { background: transparent; }
:where(body.app, body.auth, body.public) .data-table tfoot td { border-top: 1px solid var(--border); border-bottom: 0; background: var(--tint); font-size: var(--text-ui-sm); }
/* A sortable column's header is a button that looks like the header (aria-sort on the th). */
:where(body.app, body.auth, body.public) .data-table th > button {
  height: auto;
  margin: 0 calc(-1 * var(--space-1));
  padding: var(--space-1);
  border: 0;
  background: none;
  box-shadow: none;
  color: inherit;
  font: inherit;
}
:where(body.app, body.auth, body.public) .data-table th > button:hover:not(:disabled) { border: 0; background: none; color: var(--ink); }
:where(body.app, body.auth, body.public) .data-table th[aria-sort] > button { color: var(--ink); }

/* ---------- Loading placeholders ---------- */
:where(body.app, body.auth, body.public) .skeleton {
  display: block;
  height: 1em;
  margin: var(--space-2) 0;
  border-radius: var(--radius-md);
  background: linear-gradient(90deg, var(--skeleton) 25%, var(--skeleton-shine) 50%, var(--skeleton) 75%);
  background-size: 200% 100%;
  animation: ui-shimmer var(--motion-shimmer) ease-in-out infinite;
}
:where(body.app, body.auth, body.public) .skeleton.title { width: 40%; height: 28px; }
:where(body.app, body.auth, body.public) .skeleton.line { width: 100%; }
:where(body.app, body.auth, body.public) .skeleton.line.short { width: 60%; }
:where(body.app, body.auth, body.public) .skeleton.block { height: 120px; border-radius: var(--radius-card); }
@keyframes ui-shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* ---------- Dialogs ---------- */
/* Its width is a page's to change (a form needs more); the rest beats style.css's old dialog. */
:where(body.app, body.auth, body.public) dialog { width: 460px; max-height: calc(100vh - var(--space-7)); }
body:is(.app, .auth, .public) dialog {
  max-width: calc(100vw - var(--space-7));
  padding: var(--space-6);
  border: 1px solid var(--border);
  border-radius: var(--radius-dialog);
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow-popover);
}
body:is(.app, .auth, .public) dialog[open] { animation: ui-dialog-in var(--motion-base) var(--motion-ease); }
body:is(.app, .auth, .public) dialog::backdrop { background: var(--backdrop); animation: ui-fade-in var(--motion-base) var(--motion-ease); }
body:is(.app, .auth, .public) dialog h2 { margin: 0 0 var(--space-2); font-family: var(--font-serif); font-size: var(--text-2xl); font-weight: var(--weight-medium); line-height: 1.25; }
body:is(.app, .auth, .public) dialog .dialog-text p { margin: 0; color: var(--muted); line-height: 1.55; }
body:is(.app, .auth, .public) dialog .dialog-text p + p { margin-top: 10px; }
body:is(.app, .auth, .public) dialog .dialog-text strong { color: var(--ink); font-weight: var(--weight-strong); }
/* The footer runs to the dialog's edges. */
body:is(.app, .auth, .public) dialog > .dialog-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-2);
  margin: var(--space-5) calc(-1 * var(--space-6)) calc(-1 * var(--space-6));
  padding: 14px var(--space-6);
  border-top: 1px solid var(--border);
  border-radius: 0 0 var(--radius-dialog) var(--radius-dialog);
  background: var(--tint);
}
body:is(.app, .auth, .public) dialog .dialog-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin-bottom: var(--space-4);
  border-radius: 50%;
  background: var(--danger-soft);
  color: var(--error);
}
body:is(.app, .auth, .public) dialog .dialog-icon svg.icon { width: 18px; height: 18px; }
@keyframes ui-dialog-in { from { opacity: 0; transform: translateY(4px) scale(0.98); } }
@keyframes ui-fade-in { from { opacity: 0; } }

/* ---------- Page head ---------- */
:where(body.app, body.auth, body.public) .page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--space-4) var(--space-6); margin: 14px 0 var(--space-6); }
:where(body.app, body.auth, body.public) .page-head h1 { margin: 0; }
:where(body.app, body.auth, body.public) .breadcrumb ol { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; padding: 0; list-style: none; color: var(--muted); font-size: var(--text-ui-sm); }
:where(body.app, body.auth, body.public) .breadcrumb li + li::before { content: "/"; margin-right: 6px; color: var(--border-strong); }
:where(body.app, body.auth, body.public) .breadcrumb a { color: inherit; text-decoration: none; }
:where(body.app, body.auth, body.public) .breadcrumb a:hover { color: var(--ink); }
:where(body.app, body.auth, body.public) .breadcrumb [aria-current] { color: var(--ink); }
:where(body.app, body.auth, body.public) .subtitle { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: var(--space-2) 0 0; color: var(--muted); }
:where(body.app, body.auth, body.public) .page-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }

/* ---------- Stat tiles ---------- */
/* One framed row; the 1px gaps show the border colour between tiles, however they wrap. */
:where(body.app, body.auth, body.public) .stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--border);
  box-shadow: var(--shadow-card);
}
:where(body.app, body.auth, body.public) .stat { min-width: 0; padding: 18px var(--space-5) var(--space-5); background: var(--card); }
:where(body.app, body.auth, body.public) .stat-label { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); color: var(--muted); font-size: var(--text-ui-label); font-weight: var(--weight-medium); }
:where(body.app, body.auth, body.public) .stat-value { margin-top: var(--space-2); font-size: var(--text-ui-stat); font-weight: var(--weight-strong); letter-spacing: -0.02em; line-height: 1.2; font-variant-numeric: tabular-nums; }
:where(body.app, body.auth, body.public) .stat-meta { margin-top: 6px; color: var(--muted); font-size: var(--text-ui-sm); }

/* ---------- Notices ---------- */
:where(body.app, body.auth, body.public) .notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 var(--space-4);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-inset);
  background: var(--tint);
  color: var(--ink);
}
:where(body.app, body.auth, body.public) .notice > svg.icon { margin-top: 0.15em; vertical-align: 0; }
:where(body.app, body.auth, body.public) .notice > :where(p, div) { margin: 0; }
:where(body.app, body.auth, body.public) .notice.success { border-color: var(--success-line); background: var(--success-soft); color: var(--success); }
:where(body.app, body.auth, body.public) .notice.warning { border-color: var(--warning-line); background: var(--warning-soft); color: var(--warning); }
:where(body.app, body.auth, body.public) .notice.danger { border-color: var(--danger-line); background: var(--danger-soft); color: var(--error); }

/* ---------- Powered by SCHWAI ---------- */
/* A slim bar pinned to the foot of the window, whatever the page's length and before its content
   loads (lib/powered-by.js puts it in the back office's, portal's and login pages; SITE_FOOTER
   after the public site's footer, /zmanim/season's too). Each page family leaves
   --powered-by-height of room under its content (style.css: .shell .main, .auth-main; home.css:
   body.public; zmanim-page.js: .season-page) so its last line scrolls clear of the bar. It sits
   above the page (sticky table heads, /gabbai's Save bar) and under the phone's top bar (30), the
   drawer's backdrop (40) and the drawer (50); dialogs are above everything. In the back office at
   900px and wider it spans the main column only (style.css), not the sidebar's account. The logo is
   a black PNG, so no color is set for it. Never printed. */
:where(body.app, body.auth, body.public, body.season-page) { --powered-by-height: var(--space-8); }
:where(body.app, body.auth, body.public, body.season-page) .powered-by {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: center;
  height: var(--powered-by-height);
  margin: 0;
  padding: 0 var(--space-4);
  border-top: 1px solid var(--border);
  background: var(--paper);
  color: var(--muted);
  font-size: var(--text-ui-xs);
}
:where(body.public, body.season-page) .powered-by { font-family: var(--font-serif); font-size: var(--text-xs); }
:where(body.app, body.auth, body.public, body.season-page) .powered-by a { display: inline-flex; align-items: center; gap: var(--space-2); color: inherit; text-decoration: none; }
:where(body.app, body.auth, body.public, body.season-page) .powered-by a:hover { color: var(--ink); }
:where(body.app, body.auth, body.public, body.season-page) .powered-by img { display: block; width: auto; height: 18px; }
@media print {
  body:is(.app, .auth, .public, .season-page) .powered-by { display: none; }
}

/* ---------- Less motion ---------- */
@media (prefers-reduced-motion: reduce) {
  :where(body.app, body.auth, body.public) .skeleton { animation: none; }
  body:is(.app, .auth, .public) dialog[open], body:is(.app, .auth, .public) dialog::backdrop { animation: none; }
  :where(body.app, body.auth, body.public) * { transition: none !important; }
  /* The spinner still turns, slowly: it is the only sign the work is going on. */
  :where(body.app, body.auth, body.public) button[aria-busy="true"]::before, .spinner { animation-duration: 2s; }
}
