/*
 * Unity Church shared look (design system). Copyright 2026 WorkflowUnity LLC. Unity Plan.
 * Modeled on core/unity-social/web/assets/unity-social.css (same tokens and rules, prefix uc-).
 * Every page in web/ uses this file. Folders may ADD page-specific CSS in web/assets/<folder>.css; never restyle uc- classes there.
 *
 * THE RULE: "a 90-year-old or an 8-year-old can figure it out."
 *   One obvious action per screen. 18px+ text. 48px+ tap targets (main buttons 56px). Phone first.
 *   High contrast in light and dark. Success / error messages say what to do next. No hidden gestures.
 *
 * HOW TO USE
 *   <link rel="stylesheet" href="assets/unity-church.css">
 *   <body class="uc-body"> <main class="uc-page"> ... </main> </body>
 *   Brand: unity-church.js UC.applyBrand(tenant.brand) sets --uc-brand / --uc-accent (+ readable text colors) on <html>.
 *   Theme: follows the phone (prefers-color-scheme). <html data-theme="light|dark"> forces one (UC.setTheme).
 *
 * CLASSES
 *   .uc-page          centered column, max 640px, 16px side gutters (.uc-page-wide = 960px for staff tables)
 *   .uc-header        top bar: .uc-logo (img) + .uc-org (organization name)
 *   .uc-title         the one big page title;  .uc-lead  20px intro under it
 *   .uc-card          panel;  .uc-stack  children spaced 16px;  .uc-row  wraps items in a line with 12px gaps
 *   .uc-btn           big button 56px tall, brand fill. Variants: .uc-btn-secondary (outline), .uc-btn-danger,
 *                     .uc-btn-block (full width), .uc-btn-huge (88px, e.g. Record). Disabled = [disabled] or aria-disabled.
 *   .uc-field         label + control wrapper: .uc-label, .uc-hint, .uc-input / .uc-select / .uc-textarea (56px tall)
 *   .uc-check         big checkbox / radio row (whole row is the tap target, 56px)
 *   .uc-choices       grid of big choice buttons (.uc-choice, aria-pressed="true" when picked), e.g. service times
 *   .uc-banner        message box: .uc-banner-success / -error / -info (UC.showBanner fills it)
 *   .uc-inline-error  error text under one control (UC.inlineError)
 *   .uc-pill          status chip: .uc-pill-new / -work / -ok / -bad / -quiet
 *   .uc-table         simple responsive table (stacks into cards under 600px; give each td data-label="Name")
 *   .uc-stat          scoreboard number tile: <div class="uc-stat"><b>12</b><span>Invited</span></div>; .uc-stats = grid
 *   .uc-progress      <div class="uc-progress"><div class="uc-progress-bar" style="width:40%"></div></div>
 *   .uc-qr            square box for a QR SVG (UC.qr)
 *   .uc-hp            honeypot field wrapper (hidden from people and screen readers; bots fill it)
 *   .uc-muted .uc-small .uc-center .uc-hidden .uc-sr (screen reader only)
 *   .uc-print-only / .uc-no-print   print helpers (flyers)
 */
:root {
  --uc-brand: #1b4f72;
  --uc-accent: #b9470b;
  --uc-on-brand: #ffffff;
  --uc-on-accent: #ffffff;
  --uc-bg: #f6f7f9;
  --uc-card: #ffffff;
  --uc-text: #14181f;
  --uc-muted: #4a5360;
  --uc-border: #8a94a3;
  --uc-ok-bg: #e3f6e8; --uc-ok-fg: #0b4a1f; --uc-ok-bd: #1a7a38;
  --uc-err-bg: #fde8e6; --uc-err-fg: #6b1008; --uc-err-bd: #c0281a;
  --uc-info-bg: #e5effa; --uc-info-fg: #0d3560; --uc-info-bd: #2a6cb5;
  --uc-warn-bg: #fff4d6; --uc-warn-fg: #4d3500; --uc-warn-bd: #a06d00;
  --uc-focus: #0a58ca;
  --uc-radius: 14px;
  --uc-font: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --uc-bg: #0f1318; --uc-card: #1a2029; --uc-text: #f2f4f7; --uc-muted: #b6bfcc; --uc-border: #6b7686;
    --uc-ok-bg: #0f2e1a; --uc-ok-fg: #c9f2d5; --uc-ok-bd: #3fb561;
    --uc-err-bg: #3a1411; --uc-err-fg: #ffd9d4; --uc-err-bd: #ff7a6b;
    --uc-info-bg: #12263d; --uc-info-fg: #cfe2fa; --uc-info-bd: #6aa8ee;
    --uc-warn-bg: #3a2c05; --uc-warn-fg: #ffe9a8; --uc-warn-bd: #e0b03a;
    --uc-focus: #8ab8ff;
  }
}
:root[data-theme="dark"] {
  --uc-bg: #0f1318; --uc-card: #1a2029; --uc-text: #f2f4f7; --uc-muted: #b6bfcc; --uc-border: #6b7686;
  --uc-ok-bg: #0f2e1a; --uc-ok-fg: #c9f2d5; --uc-ok-bd: #3fb561;
  --uc-err-bg: #3a1411; --uc-err-fg: #ffd9d4; --uc-err-bd: #ff7a6b;
  --uc-info-bg: #12263d; --uc-info-fg: #cfe2fa; --uc-info-bd: #6aa8ee;
  --uc-warn-bg: #3a2c05; --uc-warn-fg: #ffe9a8; --uc-warn-bd: #e0b03a;
  --uc-focus: #8ab8ff;
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; font-size: 100%; }
body, .uc-body { margin: 0; background: var(--uc-bg); color: var(--uc-text); font: 1.125rem/1.5 var(--uc-font); }
img, svg, video { max-width: 100%; }
a { color: inherit; text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 3px; }
:focus-visible { outline: 3px solid var(--uc-focus); outline-offset: 3px; border-radius: 6px; }
/* Headings focused by script on page load (for screen readers) get no ring; real keyboard focus still does (church-ux UC-14). */
[tabindex="-1"]:focus, [tabindex="-1"]:focus-visible { outline: none; }
h1, h2, h3, .uc-title, .uc-org { overflow-wrap: anywhere; min-width: 0; }
/* Long links and unbroken words never push a phone page sideways (church-ux UC-15). */
p, li, td, dd, label, .uc-card, .uc-lead, .uc-hint { overflow-wrap: anywhere; }
h2 { font-size: 1.5rem; line-height: 1.25; margin: 0 0 0.75rem; }
h3 { font-size: 1.25rem; margin: 0 0 0.5rem; }
p { margin: 0 0 1rem; }
code { font-size: 0.95em; overflow-wrap: anywhere; }

.uc-page, .uc-page-wide {
  max-width: 40rem; margin: 0 auto;
  padding: 1rem max(1rem, env(safe-area-inset-right)) max(3rem, calc(1.5rem + env(safe-area-inset-bottom))) max(1rem, env(safe-area-inset-left));
}
.uc-page-wide { max-width: 60rem; }
.uc-header { display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem 0 1rem; flex-wrap: wrap; min-width: 0; }
/* Shared staff menu (UI review 10-26): one row that scrolls sideways on a phone, 48px tap targets. */
.uc-staffnav { display: flex; gap: 0.5rem; overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 0 1rem; padding-bottom: 0.25rem; }
.uc-staffnav a { flex: none; display: inline-flex; align-items: center; min-height: 48px; padding: 0 1rem; border: 2px solid var(--uc-border); border-radius: 24px; color: inherit; text-decoration: none; font-weight: 600; }
.uc-staffnav a[aria-current="page"] { background: var(--uc-brand); border-color: var(--uc-brand); color: var(--uc-on-brand); }
.uc-staffnav a[hidden] { display: none; }
/* Jim pass 10-31 (M4): back to the dashboard, first in the row. */
.uc-staffnav a.uc-staffnav-back { border-color: var(--uc-brand); font-weight: 700; }
.uc-staffnav a.uc-staffnav-back::before { content: "9"; margin-right: 0.4rem; font-size: 1.4em; line-height: 1; }
.uc-logo { max-height: 3.5rem; max-width: 10rem; border-radius: 8px; }
.uc-org { font-size: 1.25rem; font-weight: 700; }
.uc-title { font-size: 2rem; line-height: 1.2; margin: 0.5rem 0 0.75rem; font-weight: 800; }
.uc-lead { font-size: 1.25rem; margin: 0 0 1.25rem; color: var(--uc-muted); }
.uc-card { background: var(--uc-card); border: 2px solid var(--uc-border); border-radius: var(--uc-radius); padding: 1.25rem; margin: 0 0 1rem; }
.uc-stack > * + * { margin-top: 1rem; }
.uc-row { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }
.uc-muted { color: var(--uc-muted); }
.uc-small { font-size: 1rem; }
.uc-center { text-align: center; }
.uc-hidden, [hidden] { display: none !important; }
.uc-sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Buttons */
.uc-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 3.5rem; min-width: 3rem; padding: 0.75rem 1.5rem; margin: 0 0 0.75rem;
  font: 700 1.25rem/1.2 var(--uc-font); text-decoration: none; text-align: center; cursor: pointer;
  background: var(--uc-brand); color: var(--uc-on-brand); border: 3px solid var(--uc-brand); border-radius: var(--uc-radius);
  touch-action: manipulation;
}
.uc-btn:hover { filter: brightness(1.08); }
.uc-btn:active { transform: translateY(1px); }
.uc-btn-secondary { background: transparent; color: var(--uc-text); border-color: var(--uc-text); }
.uc-btn-accent { background: var(--uc-accent); color: var(--uc-on-accent); border-color: var(--uc-accent); }
/* UI review 10-26: its own fill, so dark mode keeps white text at 4.5:1 or better (white on #b3261e = 6.5:1). */
.uc-btn-danger { background: var(--uc-danger, #b3261e); color: #ffffff; border-color: var(--uc-danger, #b3261e); }
.uc-btn-block { display: flex; width: 100%; }
.uc-btn-huge { min-height: 5.5rem; font-size: 1.5rem; border-radius: 1.25rem; }
.uc-btn[disabled], .uc-btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; filter: none; transform: none; }
.uc-link-btn { background: none; border: 0; padding: 0.75rem 0.25rem; min-height: 3rem; font: 700 1.125rem var(--uc-font); color: var(--uc-text); text-decoration: underline; cursor: pointer; }

/* Forms */
.uc-field { margin: 0 0 1.25rem; }
.uc-label { display: block; font-weight: 700; margin: 0 0 0.375rem; }
.uc-hint { display: block; color: var(--uc-muted); font-size: 1rem; margin: 0 0 0.375rem; }
.uc-input, .uc-select, .uc-textarea {
  display: block; width: 100%; min-height: 3.5rem; padding: 0.75rem 1rem;
  font: 1.125rem/1.4 var(--uc-font); color: var(--uc-text); background: var(--uc-card);
  border: 2px solid var(--uc-border); border-radius: 10px;
}
.uc-textarea { min-height: 8rem; resize: vertical; }
.uc-input[aria-invalid="true"], .uc-select[aria-invalid="true"], .uc-textarea[aria-invalid="true"] { border-color: var(--uc-err-bd); border-width: 3px; }
.uc-check { display: flex; align-items: center; gap: 0.75rem; min-height: 3.5rem; padding: 0.5rem 0.75rem; border: 2px solid var(--uc-border); border-radius: 10px; margin: 0 0 0.75rem; cursor: pointer; background: var(--uc-card); }
.uc-check input { width: 1.75rem; height: 1.75rem; flex: none; accent-color: var(--uc-brand); }
.uc-choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); gap: 0.75rem; margin: 0 0 1rem; }
.uc-choice { min-height: 3.5rem; padding: 0.75rem; font: 700 1.125rem var(--uc-font); color: var(--uc-text); background: var(--uc-card); border: 2px solid var(--uc-border); border-radius: 12px; cursor: pointer; }
.uc-choice[aria-pressed="true"] { background: var(--uc-brand); color: var(--uc-on-brand); border-color: var(--uc-brand); box-shadow: 0 0 0 3px var(--uc-card), 0 0 0 6px var(--uc-brand); }
.uc-inline-error { color: var(--uc-err-fg); background: var(--uc-err-bg); border-left: 4px solid var(--uc-err-bd); padding: 0.375rem 0.75rem; margin: 0.375rem 0 0; font-weight: 700; }
/* Adversarial 10-30: a checkbox error sits right under its .uc-check row (UC.inlineError puts it after the label). */
.uc-check + .uc-inline-error { margin: -0.375rem 0 0.75rem; }
.uc-hp { position: absolute !important; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Messages */
.uc-banner { display: flex; gap: 0.75rem; align-items: flex-start; padding: 1rem; border: 2px solid; border-radius: var(--uc-radius); margin: 0 0 1rem; font-weight: 600; }
.uc-banner .uc-icon { flex: none; width: 2rem; height: 2rem; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 900; color: #fff; }
.uc-banner-success { background: var(--uc-ok-bg); color: var(--uc-ok-fg); border-color: var(--uc-ok-bd); }
.uc-banner-success .uc-icon { background: var(--uc-ok-bd); }
.uc-banner-error { background: var(--uc-err-bg); color: var(--uc-err-fg); border-color: var(--uc-err-bd); }
.uc-banner-error .uc-icon { background: var(--uc-err-bd); }
.uc-banner-info { background: var(--uc-info-bg); color: var(--uc-info-fg); border-color: var(--uc-info-bd); }
.uc-banner-info .uc-icon { background: var(--uc-info-bd); }
.uc-banner-warn { background: var(--uc-warn-bg); color: var(--uc-warn-fg); border-color: var(--uc-warn-bd); }
.uc-banner-warn .uc-icon { background: var(--uc-warn-bd); }

/* Status chips, stats, tables */
.uc-pill { display: inline-block; padding: 0.25rem 0.75rem; border-radius: 999px; font-size: 1rem; font-weight: 700; border: 2px solid; }
.uc-pill-new { background: var(--uc-info-bg); color: var(--uc-info-fg); border-color: var(--uc-info-bd); }
.uc-pill-work { background: var(--uc-warn-bg); color: var(--uc-warn-fg); border-color: var(--uc-warn-bd); }
.uc-pill-ok { background: var(--uc-ok-bg); color: var(--uc-ok-fg); border-color: var(--uc-ok-bd); }
.uc-pill-bad { background: var(--uc-err-bg); color: var(--uc-err-fg); border-color: var(--uc-err-bd); }
.uc-pill-quiet { background: transparent; color: var(--uc-muted); border-color: var(--uc-border); }
.uc-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)); gap: 0.75rem; margin: 0 0 1rem; }
.uc-stats .tm-shares { grid-column: 1 / -1; margin: 0; }
.uc-stat { background: var(--uc-card); border: 2px solid var(--uc-border); border-radius: var(--uc-radius); padding: 1rem; text-align: center; }
.uc-stat b { display: block; font-size: 2.25rem; line-height: 1.1; }
.uc-stat span { display: block; color: var(--uc-muted); font-weight: 600; }
/* Status tiles that are also the list filters (church-ux UC-15). */
.uc-stat-btn { font: inherit; color: inherit; min-height: 56px; cursor: pointer; width: 100%; }
.uc-stat-btn[aria-pressed="true"] { border-color: var(--uc-brand); box-shadow: inset 0 0 0 2px var(--uc-brand); }
.uc-table { width: 100%; border-collapse: collapse; margin: 0 0 1rem; }
.uc-table th, .uc-table td { text-align: left; padding: 0.75rem 0.5rem; border-bottom: 2px solid var(--uc-border); vertical-align: top; }
@media (max-width: 600px) {
  .uc-table thead { position: absolute; left: -10000px; }
  .uc-table tr { display: block; border: 2px solid var(--uc-border); border-radius: var(--uc-radius); margin: 0 0 0.75rem; padding: 0.5rem; background: var(--uc-card); }
  .uc-table td { display: block; border: 0; padding: 0.375rem 0.5rem; }
  .uc-table td[data-label]::before { content: attr(data-label) ": "; font-weight: 700; }
}
.uc-progress { height: 1rem; border: 2px solid var(--uc-border); border-radius: 999px; overflow: hidden; background: var(--uc-card); }
.uc-progress-bar { height: 100%; background: var(--uc-brand); transition: width 0.2s; }
.uc-qr { width: 100%; max-width: 16rem; aspect-ratio: 1; background: #ffffff; padding: 0.5rem; border-radius: 8px; }
.uc-qr svg { width: 100%; height: 100%; display: block; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
@media print {
  .uc-no-print { display: none !important; }
  body, .uc-body { background: #ffffff; color: #000000; }
}
.uc-print-only { display: none; }
@media print { .uc-print-only { display: block; } }
