/* =============================================================================
   CARE Platform design system — V1 (white)
   One stylesheet for the staff console, My CARE, participant and public pages.

   Built from the official CARE design-guide palette: basic CARE blue, RA1–RA5,
   and the CARE yellow/plum accents as the colours of the platform's areas (each module carries one as its
   accent so you always know where you are). Calm concrete-white surfaces,
   crisp hairlines, generous spacing that tightens on small screens.

   Type: Bricolage Grotesque (headings, figures) + Geist (interface text),
   Geist Mono (codes), IBM Plex Serif (agreement texts). All self-hosted.
   Themes: light and dark share every token; components never use raw colours.
   ========================================================================== */

:root {
  /* Brand (constant) */
  --brand-navy: #242F4F; /* CARE palette swatch 1 */
  --brand-navy-deep: #1A233A;
  --brand-blue: #2A7A9E; /* CARE palette swatch 2 */
  --brand-teal: #489B9D; /* CARE palette swatch 4 */
  --brand-moss: #2A9372; /* CARE palette swatch 3 */
  --brand-lime: #8BBC51; /* CARE palette swatch 5 */
  --lime: #8BBC51;
  --care-text-blue: #005793;
  --care-ra1: #242F4F;
  --care-ra2: #2A7A9E;
  --care-ra3: #2A9372;
  --care-ra4: #489B9D;
  --care-ra5: #8BBC51;
  --care-yellow: #E5CD1F;
  --care-plum: #930070;
  --care-ra1-light: #93A9C0;
  --care-ra2-light: #78A4BE;
  --care-ra3-light: #7CB99F;
  --care-ra4-light: #90BFBF;
  /* Contrast-safe text ("ink") variants of the CARE teal and green: the brand
     swatches stay for surfaces, lines and icons; text uses these. */
  --care-ra4-ink: #2F7476;
  --care-ra3-ink: #1F7A5B;
  --care-ra5-light: #B9D68B;
  --care-yellow-light: #FFEEA6;
  --care-plum-light: #C980B7;
  --care-grey: #EDEDED;
  --rwth-blue-dark: #00008C;
  --rwth-blue: #00549F;
  --rwth-blue-light: #8EBAE5;

  /* Ink */
  --navy: #005793; /* CARE basic blue text */          /* headings, strong text */
  --navy-deep: #203050;
  --navy-ink: #203050;
  --text: #1A2833;
  --text-2: #4D5C66;
  --text-3: #62707A; /* secondary text; 4.5:1 on white and pale surfaces */

  /* Accents (text-safe on white) */
  --blue: #277396; /* text blue; the #2A7A9E swatch stays as --care-ra2 */
  --blue-strong: #005793;
  --blue-wash: #EDF3F7;
  --teal: #2F7476;
  --teal-wash: #EEF6F6;
  --moss: #1F7A5B;
  --moss-strong: #00664F;
  --moss-wash: #ECF5F0;
  --lime-ink: #5E7F2D;
  --lime-wash: #F3F7EA;

  /* Surfaces: white canvas, cool neutral fills */
  --frame: #FFFFFF;
  --ground: #FFFFFF;
  --ground-2: #F1F4F7;
  --surface: #FFFFFF;
  --surface-2: #F8FAFB;
  --surface-3: #F2F5F8;
  --line: #E5E9EE;
  --line-soft: #EEF1F4;
  --line-strong: #D2D9E0;

  /* Status */
  --amber: #665900;
  --amber-fill: #E5CD1F;
  --amber-wash: #FFF8D5;
  --amber-line: #E5CD1F;
  --brick: #B23E2B;
  --brick-strong: #94301F;
  --brick-wash: #FCEDEA;
  --brick-line: #F1C6BE;
  --violet: #930070;
  --indigo: #00549F;
  --indigo-wash: #EAF1F8;
  --violet-wash: #F7ECF4;
  --violet-line: #C980B7;
  --ok-text: #00775C;
  --ok-line: #7CB99F;
  --info-line: #78A4BE;

  /* Actions */
  --primary: #242F4F;
  --primary-hover: #005793;
  --on-primary: #FFFFFF;

  /* Module accent (overridden per section on <body data-section>) */
  --accent: var(--brand-navy);
  --accent-ink: #005793;
  --accent-wash: #EDF2F6;

  /* Type */
  --font: "Geist", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --font-display: "Bricolage Grotesque", "Geist", "Segoe UI", system-ui, sans-serif;
  --font-cond: var(--font-display);
  --font-serif: "IBM Plex Serif", Georgia, "Times New Roman", serif;
  --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --fs-xs: 11.5px;
  --fs-sm: 12.5px;
  --fs-base: 14px;
  --fs-md: 15.5px;
  --fs-lg: 18px;
  --fs-xl: 22px;
  --fs-2xl: clamp(26px, 2.2vw + 12px, 36px);

  /* Shape & depth */
  --r-xs: 6px;
  --r-sm: 8px;
  --r: 10px;
  --r-lg: 14px;
  --r-xl: 20px;
  --shadow-1: 0 1px 2px rgba(0, 87, 147, .06);
  --shadow-card: 0 1px 2px rgba(0, 87, 147, .04);
  --shadow-lift: 0 2px 4px rgba(0, 87, 147, .04), 0 10px 24px -10px rgba(0, 87, 147, .16);
  --shadow-2: 0 14px 34px -10px rgba(0, 87, 147, .22), 0 2px 6px rgba(0, 87, 147, .06);
  --shadow-3: 0 30px 80px -16px rgba(8, 22, 38, .38);
  --focus-ring: rgba(0, 123, 159, .35);
  --focus: 0 0 0 3px var(--focus-ring);
  --scrim: rgba(9, 22, 35, .45);
  --ease: cubic-bezier(.2, .8, .2, 1);

  /* Layout */
  --sidebar-w: 264px;
  --rail-w: 76px;
  --topbar-h: 64px;
  --page-max: 1360px;
  --gutter: 36px;
  --bottom-nav-h: 0px;
  color-scheme: light;
}

/* Wide screens get more room, phones get tighter gutters */
@media (min-width: 1680px) { :root { --page-max: 1560px; --gutter: 48px; } }
@media (min-width: 2200px) { :root { --page-max: 1760px; --fs-base: 15px; } }
@media (max-width: 1080px) { :root { --gutter: 24px; } }
@media (max-width: 760px)  { :root { --gutter: 16px; --topbar-h: 56px; } }

/* ---------- Dark theme (device preference, or chosen under Appearance) ---------- */
:root[data-theme="dark"] {
  --navy: #EEF3F7; --navy-deep: #08131D; --navy-ink: #050D15;
  --text: #DCE5EB; --text-2: #A6B5C1; --text-3: #8796A4; --care-ra4-ink: var(--care-ra4-light); --care-ra3-ink: var(--care-ra3-light);
  --blue: #78A4BE; --blue-strong: #8EBAE5; --blue-wash: rgba(120, 164, 190, .15);
  --teal: #90BFBF; --teal-wash: rgba(144, 191, 191, .15);
  --moss: #7CB99F; --moss-strong: #9BC9B5; --moss-wash: rgba(124, 185, 159, .15);
  --lime-ink: #B9D68B; --lime-wash: rgba(185, 214, 139, .15);
  --frame: #070F17; --ground: #0B1620; --ground-2: #172636;
  --surface: #101D29; --surface-2: #142331; --surface-3: #192A3A;
  --line: #213444; --line-soft: #1A2B3B; --line-strong: #2E4458;
  --amber: #FFEEA6; --amber-fill: #E5CD1F; --amber-wash: rgba(255, 238, 166, .13); --amber-line: rgba(229, 205, 31, .38);
  --brick: #F38C78; --brick-strong: #F7A797; --brick-wash: rgba(243, 140, 120, .12); --brick-line: rgba(243, 140, 120, .32);
  --violet: #C980B7; --violet-wash: rgba(201, 128, 183, .15); --violet-line: rgba(201, 128, 183, .34);
  --indigo: #8EBAE5; --indigo-wash: rgba(142, 186, 229, .15);
  --ok-text: #7CB99F; --ok-line: rgba(124, 185, 159, .34); --info-line: rgba(120, 164, 190, .38);
  --primary: #8EBAE5; --primary-hover: #FFFFFF; --on-primary: #203050;
  --accent-ink: #8EBAE5; --accent-wash: rgba(142, 186, 229, .13);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, .25);
  --shadow-lift: 0 12px 28px -10px rgba(0, 0, 0, .6);
  --shadow-2: 0 14px 34px -8px rgba(0, 0, 0, .6);
  --shadow-3: 0 30px 80px -14px rgba(0, 0, 0, .75);
  --focus-ring: rgba(120, 164, 190, .48);
  --scrim: rgba(2, 7, 12, .66);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --navy: #EEF3F7; --navy-deep: #08131D; --navy-ink: #050D15;
    --text: #DCE5EB; --text-2: #A6B5C1; --text-3: #8796A4; --care-ra4-ink: var(--care-ra4-light); --care-ra3-ink: var(--care-ra3-light);
    --blue: #78A4BE; --blue-strong: #8EBAE5; --blue-wash: rgba(120, 164, 190, .15);
    --teal: #90BFBF; --teal-wash: rgba(144, 191, 191, .15);
    --moss: #7CB99F; --moss-strong: #9BC9B5; --moss-wash: rgba(124, 185, 159, .15);
    --lime-ink: #B9D68B; --lime-wash: rgba(185, 214, 139, .15);
    --frame: #070F17; --ground: #0B1620; --ground-2: #172636;
    --surface: #101D29; --surface-2: #142331; --surface-3: #192A3A;
    --line: #213444; --line-soft: #1A2B3B; --line-strong: #2E4458;
    --amber: #FFEEA6; --amber-fill: #E5CD1F; --amber-wash: rgba(255, 238, 166, .13); --amber-line: rgba(229, 205, 31, .38);
    --brick: #F38C78; --brick-strong: #F7A797; --brick-wash: rgba(243, 140, 120, .12); --brick-line: rgba(243, 140, 120, .32);
    --violet: #C980B7; --violet-wash: rgba(201, 128, 183, .15); --violet-line: rgba(201, 128, 183, .34);
    --indigo: #8EBAE5; --indigo-wash: rgba(142, 186, 229, .15);
    --ok-text: #7CB99F; --ok-line: rgba(124, 185, 159, .34); --info-line: rgba(120, 164, 190, .38);
    --primary: #8EBAE5; --primary-hover: #FFFFFF; --on-primary: #203050;
    --accent-ink: #8EBAE5; --accent-wash: rgba(142, 186, 229, .13);
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-card: 0 1px 2px rgba(0, 0, 0, .25);
    --shadow-lift: 0 12px 28px -10px rgba(0, 0, 0, .6);
    --shadow-2: 0 14px 34px -8px rgba(0, 0, 0, .6);
    --shadow-3: 0 30px 80px -14px rgba(0, 0, 0, .75);
    --focus-ring: rgba(120, 164, 190, .48);
    --scrim: rgba(2, 7, 12, .66);
    color-scheme: dark;
  }
}

/* ---------- Module accents: the CARE logo range, one per area ---------- */
body[data-section="members"]    { --accent: var(--care-ra2); --accent-ink: var(--blue); --accent-wash: var(--blue-wash); }
body[data-section="onboarding"] { --accent: var(--care-ra2); --accent-ink: var(--blue); --accent-wash: var(--blue-wash); }
body[data-section="agreements"] { --accent-solid: #1F7A5B; --accent: var(--care-ra3); --accent-ink: var(--moss); --accent-wash: var(--moss-wash); }
body[data-section="events"]     { --accent-solid: #2F7476; --accent: var(--care-ra4); --accent-ink: var(--teal); --accent-wash: var(--teal-wash); }
body[data-section="feedback"]   { --accent-solid: #4E7A1E; --accent: var(--care-ra5); --accent-ink: var(--lime-ink); --accent-wash: var(--lime-wash); }
body[data-section="reports"]  { --accent: var(--rwth-blue); --accent-ink: var(--indigo); --accent-wash: var(--indigo-wash); }
body[data-section="audit"]      { --accent: var(--care-plum); --accent-ink: var(--violet); --accent-wash: var(--violet-wash); }
body[data-section="admin"],
body[data-section="account"]    { --accent: var(--care-ra1); --accent-ink: var(--navy); --accent-wash: #EDF2F6; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 80px; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: 1.55;
  color: var(--text);
  background: var(--ground);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv11";
}
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
a { color: var(--blue); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--blue-strong); }
h1, h2, h3, h4 { margin: 0; color: var(--navy); line-height: 1.22; }
h1, h2 { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.02em; }
h1 { letter-spacing: -0.028em; }
h3, h4 { font-weight: 600; letter-spacing: -0.008em; }
p { margin: 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
code, .mono, kbd { font-family: var(--font-mono); font-size: .88em; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 6px; }
::selection { background: rgba(136, 188, 77, .35); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }
.display { font-family: var(--font-display); letter-spacing: -0.02em; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--accent-ink); margin-bottom: 6px; }
.eyebrow::before { content: ""; width: 14px; height: 3px; border-radius: 3px; background: var(--accent); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* ---------- Icons ---------- */
.i { width: 16px; height: 16px; flex: 0 0 auto; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; display: inline-block; vertical-align: middle; }
.i-sm { width: 14px; height: 14px; }
.i-lg { width: 20px; height: 20px; }
.icon-tile { width: 40px; height: 40px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 12px; background: var(--accent-wash); color: var(--accent-ink); }
.icon-tile .i { width: 20px; height: 20px; }

/* ---------- Buttons ---------- */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 8px 16px;
  border: 1px solid var(--line-strong); border-radius: 12px;
  background: var(--surface); color: var(--navy);
  box-shadow: 0 1px 2px rgba(0, 87, 147, .06);
  font-weight: 560; font-size: 14px; line-height: 1.2; letter-spacing: -0.005em; text-decoration: none; white-space: nowrap;
  cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent;
  transition: background .15s, border-color .15s, color .15s, box-shadow .2s, transform .12s var(--ease);
}
.btn:hover { background: var(--surface-2); border-color: #B9C3CD; color: var(--navy); box-shadow: 0 2px 6px -2px rgba(0, 87, 147, .14); }
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn .i { opacity: .9; }
.btn-primary { background: var(--care-ra1); border-color: var(--care-ra1); color: #fff; box-shadow: none; }
.btn-primary:hover { background: var(--care-ra1); border-color: var(--care-ra2); color: #fff; box-shadow: none; }
:root[data-theme="dark"] .btn-primary { background: var(--care-ra2-light); border-color: var(--care-ra2-light); color: var(--care-ra1); box-shadow: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-primary { background: var(--care-ra2-light); border-color: var(--care-ra2-light); color: var(--care-ra1); box-shadow: none; } }
.btn-success { background: #1F7A5B; border-color: #1F7A5B; color: #fff; box-shadow: none; } /* CARE green, darkened for white text */
.btn-success:hover { background: #196A4E; border-color: var(--care-ra1); color: #fff; box-shadow: none; }
.btn-danger { background: var(--surface); border-color: var(--brick-line); color: var(--brick); }
.btn-danger:hover { background: var(--brick-wash); border-color: var(--brick); color: var(--brick); }
.btn-danger-solid { background: #B23E2B; border-color: #B23E2B; color: #fff; box-shadow: none; }
.btn-danger-solid:hover { background: #B23E2B; border-color: #94301F; color: #fff; box-shadow: none; }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); border-color: transparent; color: var(--navy); box-shadow: none; }
.btn-soft { background: var(--accent-wash); border-color: transparent; box-shadow: none; color: var(--accent-ink); }
.btn-soft:hover { background: color-mix(in srgb, var(--accent) 16%, var(--surface)); color: var(--accent-ink); border-color: transparent; }
.btn-sm { min-height: 32px; padding: 5px 12px; font-size: 13px; border-radius: 10px; gap: 6px; }
.btn-lg { min-height: 50px; padding: 12px 24px; font-size: 15px; border-radius: 14px; }
.btn-icon { width: 40px; min-height: 40px; padding: 0; }
.btn-icon.btn-sm { width: 32px; min-height: 32px; }
.btn-block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn-row.end { justify-content: flex-end; }
.btn-row.between { justify-content: space-between; }
/* A card left alone on the last row of a grid spans the row (see markOrphans). */
[data-orphan] { grid-column: 1 / -1; }
/* Actions of a narrow card share its width (see markWraps). */
.btn-row[data-fill] { flex-wrap: wrap; }
.btn-row[data-fill] > .btn { flex: 1 1 auto; justify-content: center; }
/* Phones: a long button label wraps inside the button instead of leaving the screen. */
@media (max-width: 480px) { .btn:not(.btn-icon) { white-space: normal; text-align: center; height: auto; } }
/* A wrapped row of chips or buttons fills every line (see markWraps in core.js). */
[data-wrapped] > :is(.btn, .agr-chip, .onb-chip, .chip-filter, .public-chip, .my-chip, .rx-chip, .ext-chip) { flex: 1 1 auto; justify-content: center; }
.rte-toolbar[data-wrapped] > button { flex: 1 1 auto; }
.btn .spinner { width: 14px; height: 14px; }

.linkish { background: none; border: 0; padding: 0; color: var(--blue); font-weight: 600; cursor: pointer; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.linkish:hover { color: var(--blue-strong); }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field > label, .field-label { font-size: 13px; font-weight: 560; color: var(--text); }
.field .req { color: var(--brick); margin-left: 2px; }
.field .hint { font-size: 12.5px; color: var(--text-3); line-height: 1.45; }
.field-invalid .hint { font-size: 12.5px; color: var(--brick); }
.input, .select, .textarea {
  width: 100%; min-height: 42px; padding: 10px 13px;
  border: 1px solid var(--line-strong); border-radius: 12px;
  background: var(--surface); color: var(--text); font-size: 14px; line-height: 1.4;
  box-shadow: 0 1px 2px rgba(0, 87, 147, .04);
  transition: border-color .15s, box-shadow .2s, background .15s;
}
.input::placeholder, .textarea::placeholder { color: #9AA6B0; }
.textarea { min-height: 104px; resize: vertical; line-height: 1.55; }
.textarea.code { font-family: var(--font-mono); font-size: 12.5px; }
.input:hover, .select:hover, .textarea:hover { border-color: #B4BEC9; }
.input:focus, .select:focus, .textarea:focus, .select.is-open { outline: none; border-color: var(--brand-blue); box-shadow: 0 0 0 4px rgba(0, 123, 159, .14); }
:root[data-theme="dark"] .input:focus, :root[data-theme="dark"] .select:focus, :root[data-theme="dark"] .textarea:focus { box-shadow: 0 0 0 4px rgba(120, 164, 190, .22); }
.input[readonly], .textarea[readonly] { background: var(--surface-2); color: var(--text-2); }
.input:disabled, .select:disabled, .textarea:disabled { background: var(--surface-2); color: var(--text-3); cursor: not-allowed; box-shadow: none; }
.input.invalid, .select.invalid, .textarea.invalid, .field-invalid .input, .field-invalid .select, .field-invalid .textarea { border-color: var(--brick); box-shadow: 0 0 0 4px var(--brick-wash); }
.select { appearance: none; padding-right: 40px; cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236B7B88' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 13px center; }
.input-group { display: flex; gap: 6px; align-items: stretch; }
.input-group > .input { flex: 1; }
.search-input { position: relative; }
.search-input .i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.search-input .input { padding-left: 40px; border-radius: 999px; background: var(--surface-2); }
.search-input .input:focus { background: var(--surface); }
input[type="search"]::-webkit-search-cancel-button { cursor: pointer; }

/* Checkboxes and radios */
input[type=checkbox]:not(.native), input[type=radio]:not(.native) { appearance: none; -webkit-appearance: none; width: 18px; height: 18px; margin: 0; flex: 0 0 auto; border: 1.5px solid #B4BEC9; background: var(--surface); display: inline-grid; place-content: center; cursor: pointer; transition: background .15s, border-color .15s, box-shadow .15s; vertical-align: middle; }
input[type=checkbox]:not(.native) { border-radius: 6px; }
input[type=radio]:not(.native) { border-radius: 50%; }
input[type=checkbox]:not(.native)::before { content: ""; width: 10px; height: 10px; background: #fff; clip-path: polygon(14% 52%, 0 66%, 38% 100%, 100% 22%, 86% 8%, 38% 72%); transform: scale(0); transition: transform .15s var(--ease); }
input[type=radio]:not(.native)::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #fff; transform: scale(0); transition: transform .15s var(--ease); }
input[type=checkbox]:not(.native):checked, input[type=radio]:not(.native):checked { background: var(--brand-navy); border-color: var(--brand-navy); }
input[type=checkbox]:not(.native):checked::before, input[type=radio]:not(.native):checked::before { transform: scale(1); }
input[type=checkbox]:not(.native):indeterminate { background: var(--brand-navy); border-color: var(--brand-navy); }
input[type=checkbox]:not(.native):indeterminate::before { clip-path: inset(40% 10%); transform: scale(1); }
input[type=checkbox]:not(.native):hover, input[type=radio]:not(.native):hover { border-color: var(--brand-blue); }
input[type=checkbox]:not(.native):focus-visible, input[type=radio]:not(.native):focus-visible { outline: none; box-shadow: 0 0 0 4px rgba(0, 123, 159, .20); }
input[type=checkbox]:not(.native):disabled, input[type=radio]:not(.native):disabled { opacity: .5; cursor: not-allowed; }
:root[data-theme="dark"] input[type=checkbox]:not(.native):checked, :root[data-theme="dark"] input[type=radio]:not(.native):checked { background: #78A4BE; border-color: #78A4BE; }
:root[data-theme="dark"] input[type=checkbox]:not(.native)::before, :root[data-theme="dark"] input[type=radio]:not(.native)::before { background: #0B1B2B; }
.check { display: flex; align-items: flex-start; gap: 11px; font-size: 14px; color: var(--text); cursor: pointer; line-height: 1.45; }
.check input { margin-top: 1px; }
.check small { display: block; color: var(--text-3); font-size: 12.5px; }
.check-group, .choice-stack { display: flex; flex-direction: column; gap: 8px; }

/* Toggle switch: a pill with a check that slides in */
.switch { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; font-size: 14px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 46px; height: 28px; border-radius: 99px; background: #D5DCE3; position: relative; transition: background .25s var(--ease), box-shadow .2s; flex: 0 0 auto; box-shadow: inset 0 1px 2px rgba(0, 87, 147, .12); }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff no-repeat center / 12px 12px; box-shadow: 0 2px 5px rgba(0, 87, 147, .25); transition: transform .3s cubic-bezier(.3, 1.4, .5, 1), background-image .2s; }
.switch input:checked + .track { background: var(--brand-moss); }
.switch input:checked + .track::after { transform: translateX(18px); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23009472' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E"); }
.switch:hover .track { box-shadow: inset 0 1px 2px rgba(0, 87, 147, .12), 0 0 0 4px rgba(0, 87, 147, .05); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 4px rgba(0, 123, 159, .22); }
.switch input:disabled + .track { opacity: .5; }
:root[data-theme="dark"] .switch .track { background: #2E4458; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 20px; }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
/* Fields side by side line up: labels, inputs and hints share rows, so a label
   that wraps to two lines does not push its input below its neighbour's. */
@supports (grid-template-rows: subgrid) {
  .form-grid > :not(.full):not(.span-2):not(.form-heading) { grid-row: span 3; }
  .form-grid > .field:not(.full):not(.span-2):not(:has(> :nth-child(4))) { display: grid; grid-template-rows: subgrid; row-gap: 7px; align-content: start; }
  .form-grid > .field:not(.full):not(.span-2):not(:has(> :nth-child(4))) > label:first-child { align-self: end; }
  /* A lone checkbox or switch sits on the input row of its neighbours. */
  .form-grid > .field:not(.full):not(.span-2):not(:has(> :nth-child(4))) > :is(label.check, label.switch):first-child { grid-row: 2; align-self: center; }
}

.form-section { padding: 24px 0; border-top: 1px solid var(--line); }
.form-section:first-child { border-top: 0; padding-top: 0; }
.form-section > h3 { font-size: var(--fs-md); margin-bottom: 4px; }
.form-section > p.muted { margin-bottom: 14px; }

.tag-input-box { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 42px; padding: 6px 8px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); }
.tag-input-box:focus-within { border-color: var(--brand-blue); box-shadow: 0 0 0 4px rgba(0, 123, 159, .14); }
.tag-input-box input { flex: 1; min-width: 120px; border: 0; outline: 0; background: none; padding: 4px; }

/* ---------- Custom dropdown (enhances native <select class="select"> on desktop) ---------- */
.cal-pop:focus, .cal-pop:focus-visible, .cal-grid:focus, .cal-grid:focus-visible { outline: none; }

/* ---------- Date picker (dd/mm/yyyy) ---------- */
.date-field { position: relative; display: flex; align-items: center; }
.date-field > .input { padding-right: 44px; font-variant-numeric: tabular-nums; }
.date-field .df-native { position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; border: 0; padding: 0; }
.date-field .df-btn { position: absolute; right: 5px; top: 50%; transform: translateY(-50%); width: 34px; height: 32px; border: 0; border-radius: 9px; background: none; color: var(--text-3); display: grid; place-items: center; cursor: pointer; }
.date-field .df-btn:hover { background: var(--surface-3); color: var(--navy); }
.cal-pop { position: fixed; z-index: 1150; width: 312px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 24px 60px -16px rgba(0, 87, 147, .32), 0 2px 6px rgba(0, 87, 147, .06); padding: 14px; animation: dd-in .18s var(--ease); font-variant-numeric: tabular-nums; }
.cal-head { display: flex; align-items: center; gap: 4px; margin-bottom: 10px; }
.cal-title { flex: 1; font-family: var(--font-display); font-weight: 600; font-size: 16px; color: var(--navy); letter-spacing: -0.01em; padding-left: 4px; }
.cal-title select { border: 0; background: none; font: inherit; color: inherit; cursor: pointer; padding: 2px; border-radius: 6px; appearance: none; }
.cal-title select:hover { background: var(--surface-3); }
.cal-nav { width: 32px; height: 32px; border: 0; border-radius: 10px; background: none; color: var(--text-2); display: grid; place-items: center; cursor: pointer; }
.cal-nav:hover { background: var(--surface-3); color: var(--navy); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-dow { text-align: center; font-size: 11.5px; font-weight: 600; color: var(--text-3); padding: 4px 0 6px; }
.cal-day { height: 38px; border: 0; border-radius: 11px; background: none; color: var(--text); font-size: 13.5px; cursor: pointer; position: relative; transition: background .12s, color .12s; }
.cal-day:hover { background: var(--surface-3); }
.cal-day.is-out { color: var(--text-3); opacity: .55; }
.cal-day.is-today { font-weight: 700; color: var(--brand-blue); }
.cal-day.is-today::after { content: ""; position: absolute; left: 50%; bottom: 5px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--brand-blue); }
.cal-day.is-selected { background: var(--brand-navy); color: #fff; font-weight: 650; }
.cal-day.is-selected::after { background: #fff; }
.cal-day.is-focus { box-shadow: inset 0 0 0 2px var(--brand-blue); }
.cal-day:disabled { opacity: .3; cursor: not-allowed; }
.cal-time { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line-soft); font-size: 13px; color: var(--text-2); }
.cal-time input { width: 56px; height: 36px; text-align: center; border: 1px solid var(--line-strong); border-radius: 10px; font: inherit; font-size: 15px; color: var(--text); background: var(--surface); font-variant-numeric: tabular-nums; }
.cal-time input:focus { outline: none; border-color: var(--brand-blue); box-shadow: 0 0 0 3px rgba(0, 123, 159, .14); }
.cal-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 12px; }
.cal-foot .btn { min-height: 34px; padding: 6px 12px; font-size: 13px; }
:root[data-theme="dark"] .cal-day.is-selected { background: #78A4BE; color: #0B1B2B; }
@media (max-width: 640px) {
  .cal-pop { left: 0 !important; right: 0; top: auto !important; bottom: 0; width: 100%; max-width: none; border-radius: 22px 22px 0 0; padding-bottom: max(16px, env(safe-area-inset-bottom)); animation-name: sheet-in; }
  .cal-day { height: 44px; }
}

/* ---------- Text helpers ---------- */
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: var(--fs-sm); }
.xsmall { font-size: var(--fs-xs); }
.strong { font-weight: 600; color: var(--navy); }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wrap-any { overflow-wrap: anywhere; }
.num { font-variant-numeric: tabular-nums; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-sm { display: flex; flex-direction: column; gap: 6px; }
.stack-lg { display: flex; flex-direction: column; gap: 20px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.top { align-items: flex-start; }
.grow { flex: 1 1 auto; min-width: 0; }
.gap-2 { gap: 12px; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 20px; }
.mb-1 { margin-bottom: 6px; } .mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 20px; }

/* ---------- Badges / status ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 9px 2px 8px; min-height: 22px; border-radius: 99px;
  font-size: 12px; font-weight: 550; line-height: 1.3; white-space: nowrap;
  background: var(--ground-2); color: var(--text-2); border: 1px solid transparent;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.badge.ok { background: var(--moss-wash); color: var(--ok-text); }
.badge.info { background: var(--blue-wash); color: var(--blue-strong); }
.badge.warn { background: var(--amber-wash); color: var(--amber); }
.badge.danger { background: var(--brick-wash); color: var(--brick); }
.badge.draft { background: var(--violet-wash); color: var(--violet); }
.badge.muted { background: transparent; color: var(--text-3); border-color: var(--line); }
.badge.navy { background: var(--brand-navy); color: #fff; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; min-height: 22px; border-radius: 6px; font-size: 12px; font-weight: 500; background: var(--ground-2); color: var(--text-2); border: 1px solid transparent; white-space: nowrap; }
.tag.yes { background: var(--moss-wash); color: var(--ok-text); }
.tag.off { background: transparent; color: var(--text-3); border-color: var(--line-soft); }
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.count-pill { display: inline-flex; min-width: 20px; height: 20px; padding: 0 6px; align-items: center; justify-content: center; border-radius: 99px; background: var(--amber-fill); color: #fff; font-size: 11px; font-weight: 650; font-variant-numeric: tabular-nums; }

.avatar { width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--brand-navy); color: #fff; font-size: 12px; font-weight: 600; letter-spacing: .02em; flex: 0 0 auto; }
.avatar.lg { width: 48px; height: 48px; font-size: 16px; }

/* ---------- Cards & panels ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-card); }
.card-pad { padding: 22px 24px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 24px 0; flex-wrap: wrap; }
/* The title block shrinks first, so a card's action stays beside it instead of wrapping alone (2026-11-11). */
.card-head > div:first-child:not(:only-child) { flex: 1 1 260px; min-width: 0; }
.card-head h2, .card-head h3 { font-family: var(--font); font-size: 15.5px; font-weight: 600; letter-spacing: -0.01em; }
.card-head p { color: var(--text-2); font-size: var(--fs-sm); margin-top: 3px; max-width: 70ch; }
.card-body { padding: 16px 24px 22px; }
.card-foot { padding: 14px 24px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.card.flush .card-body { padding: 0; }
.card.flush .card-body .table-wrap { border: 0; border-radius: 0 0 var(--r-lg) var(--r-lg); box-shadow: none; }
a.card, .card.clickable { text-decoration: none; color: inherit; transition: border-color .15s, box-shadow .2s var(--ease), transform .2s var(--ease); }
a.card:hover, .card.clickable:hover { border-color: var(--line-strong); box-shadow: var(--shadow-lift); }
.section-title { font-family: var(--font-display); font-size: 19px; font-weight: 600; letter-spacing: -0.015em; margin: 32px 0 12px; }
.section-title:first-child { margin-top: 0; }

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 760px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } .form-grid, .form-grid.cols-3 { grid-template-columns: minmax(0, 1fr); } .grid { gap: 14px; } .table-toolbar > .field { grid-column: 1 / -1; } }

/* Metrics: separate scorecards that reflow from 4 → 2 columns */
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.metric { position: relative; padding: 18px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-card); display: flex; flex-direction: column; gap: 2px; min-width: 0; text-decoration: none; color: inherit; overflow: hidden; }
a.metric { transition: border-color .15s, box-shadow .2s var(--ease); }
a.metric:hover { border-color: var(--line-strong); box-shadow: var(--shadow-lift); color: inherit; }
a.metric::after { content: ""; position: absolute; right: 16px; top: 18px; width: 7px; height: 7px; border-top: 1.6px solid var(--text-3); border-right: 1.6px solid var(--text-3); transform: rotate(45deg); opacity: .6; transition: transform .2s var(--ease), opacity .2s; }
a.metric:hover::after { transform: translateX(2px) rotate(45deg); opacity: 1; }
.metric .m-label { font-size: 13px; color: var(--text-2); font-weight: 500; padding-right: 16px; }
.metric .m-value { font-family: var(--font-display); font-size: 34px; line-height: 1.1; font-weight: 600; color: var(--navy); font-variant-numeric: tabular-nums; letter-spacing: -0.025em; margin-top: 8px; }
.metric .m-sub { font-size: 12.5px; color: var(--text-3); }
.metric.warn { background: linear-gradient(180deg, var(--amber-wash), var(--surface) 70%); border-color: var(--amber-line); }
.metric.warn .m-value { color: var(--amber); }
.metric.ok .m-value { color: var(--moss); }
@media (max-width: 560px) { .metrics { grid-template-columns: 1fr 1fr; gap: 10px; } .metric { padding: 14px 15px; } .metric .m-value { font-size: 27px; margin-top: 4px; } .metric .m-label { font-size: 12.5px; } }

/* Progress */
.meter { height: 6px; border-radius: 99px; background: var(--ground-2); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 99px; background: var(--brand-moss); transition: width .6s var(--ease); }
.meter.blue > span { background: var(--brand-blue); }
.meter.amber > span { background: var(--amber-fill); }

/* ---------- Tables ---------- */
.table-wrap { position: relative; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-card); -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.table th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); text-align: left; font-weight: 550; font-size: 12.5px; color: var(--text-3); padding: 11px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table th .sort { opacity: .7; margin-left: 4px; }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover td { background: var(--surface-3); }
.table tbody tr.is-muted td { color: var(--text-3); }
.table tbody tr.is-selected td { background: var(--blue-wash); }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table .cell-title { font-weight: 600; color: var(--navy); }
.table .cell-sub { font-size: 12.5px; color: var(--text-3); margin-top: 1px; }
.table input[type=checkbox] { width: 17px; height: 17px; }
.table-toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin-bottom: 16px; }
.table-toolbar .field { min-width: 150px; flex: 0 1 190px; }
.table-toolbar .search-input { flex: 1 1 280px; }
.table-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 2px 0; font-size: 12.5px; color: var(--text-2); }
@media (max-width: 720px) {
  .table-toolbar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; align-items: end; }
  .table-toolbar > * { min-width: 0 !important; }
  .table-toolbar > .search-input, .table-toolbar > .btn-row, .table-toolbar > .segmented, .table-toolbar > .check, .table-toolbar > .grow, .table-toolbar > .row { grid-column: 1 / -1; }
  .table-toolbar > .btn { width: 100%; justify-content: center; }
  .table-toolbar > .btn:last-child:nth-child(odd), .table-toolbar > .search-input + .btn:last-child { grid-column: 1 / -1; }
}

/* Phones: every data table becomes a list of cards; core.js labels each cell. */
@media (max-width: 720px) {
  .table-wrap:not(.keep-table) { overflow: visible; border: 0; background: none; box-shadow: none; border-radius: 0; }
  .table-wrap:not(.keep-table) .table { display: block; font-size: 14px; }
  .table-wrap:not(.keep-table) .table thead { display: none; }
  .table-wrap:not(.keep-table) .table tbody { display: flex; flex-direction: column; gap: 10px; }
  .table-wrap:not(.keep-table) .table tr { position: relative; display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 13px 15px; box-shadow: var(--shadow-card); }
  .table-wrap:not(.keep-table) .table tr.has-check { padding-left: 48px; }
  .table-wrap:not(.keep-table) .table td { display: grid; grid-template-columns: minmax(96px, 34%) minmax(0, 1fr); gap: 12px; align-items: start; padding: 5px 0; border: 0; background: none !important; text-align: left; }
  .table-wrap:not(.keep-table) .table td > .cv { min-width: 0; }
  .table-wrap:not(.keep-table) .table td::before { content: attr(data-label); font-size: 12.5px; font-weight: 500; color: var(--text-3); padding-top: 1px; }
  .table-wrap:not(.keep-table) .table td.cell-lead { display: block; padding: 0 0 6px; font-size: 15px; }
  .table-wrap:not(.keep-table) .table td.cell-lead::before, .table-wrap:not(.keep-table) .table td.no-label::before { display: none; }
  .table-wrap:not(.keep-table) .table td.no-label { display: block; }
  .table-wrap:not(.keep-table) .table td.cell-check { position: absolute; left: 15px; top: 15px; padding: 0; display: block; }
  .table-wrap:not(.keep-table) .table td.cell-check::before { display: none; }
  .table-wrap:not(.keep-table) .table td.cell-empty { display: none; }
  .table-wrap:not(.keep-table) .table td.cell-actions { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 10px; margin-top: 4px; border-top: 1px solid var(--line-soft); }
  .table-wrap:not(.keep-table) .table td.cell-actions::before { display: none; }
  .table-wrap:not(.keep-table) .table td.cell-actions > .btn, .table-wrap:not(.keep-table) .table td.cell-actions > :is(.btn-row, .actions, .row-actions, .cv) > .btn:not(.btn-icon) { flex: 1 1 auto; justify-content: center; }
  .table-wrap:not(.keep-table) .table td.cell-actions > :is(.btn-row, .actions, .row-actions, .cv) { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; justify-content: stretch; }
  /* Cards that start with a person's avatar: details line up with the name. */
  .table-wrap:not(.keep-table) .table tr:has(> td.cell-lead .avatar) > td:not(.cell-lead):not(.cell-check):not(.cell-actions) { margin-left: 43px; }
  .table-wrap:not(.keep-table) .table tbody th { display: block; padding: 0 0 6px; border: 0; background: none !important; box-shadow: none !important; position: static; font-size: 15px; white-space: normal; text-align: left; }
  .table-wrap:not(.keep-table) .table tr.clickable:active { background: var(--surface-3); }
  .table-wrap:not(.keep-table) .table tbody tr.is-selected { background: var(--blue-wash); border-color: var(--info-line); }
}

/* Row list */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; gap: 14px; align-items: center; padding: 15px 20px; border-bottom: 1px solid var(--line-soft); text-decoration: none; color: inherit; transition: background .12s; }
.list-item:last-child { border-bottom: 0; }
a.list-item:hover, button.list-item:hover { background: var(--surface-3); color: inherit; }
button.list-item { width: 100%; background: none; border: 0; border-bottom: 1px solid var(--line-soft); text-align: left; cursor: pointer; font: inherit; }
.list-item .li-main { flex: 1 1 0; min-width: 0; }
.list-item .li-title { font-weight: 600; color: var(--navy); }
.list-item .li-sub { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.list-item .li-side { flex: 0 0 auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 560px) { .list-item { flex-wrap: wrap; padding: 14px 16px; } .list-item .li-side { width: 100%; justify-content: flex-start; } }

/* ---------- Tabs: pill bar with an accent marker ---------- */
.tabs { display: flex; gap: 4px; margin-bottom: 24px; padding-bottom: 12px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
/* Phones: tabs wrap and share each line, so every tab stays visible. */
@media (max-width: 760px) { .tabs { flex-wrap: wrap; overflow: visible; } .tabs > .tab { flex: 1 0 auto; justify-content: center; } }
.tab { position: relative; display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border: 0; background: none; color: var(--text-2); font-weight: 560; font-size: 14px; text-decoration: none; white-space: nowrap; cursor: pointer; border-radius: 11px; transition: color .15s, background .15s; }
.tab .i { opacity: .75; }
.tab:hover { color: var(--navy); background: var(--surface-3); }
.tab.active { color: var(--navy); background: var(--accent-wash); font-weight: 620; }
.tab.active .i { opacity: 1; color: var(--accent-ink); }
.tab.active::after { content: ""; position: absolute; left: 50%; bottom: -13px; width: 22px; height: 3px; margin-left: -11px; border-radius: 3px 3px 0 0; background: var(--accent); }
.tab .count-pill { background: var(--ground-2); color: var(--text-2); }
.tab.active .count-pill { background: var(--surface); color: var(--accent-ink); }
.segmented { display: inline-flex; padding: 4px; gap: 2px; background: var(--ground-2); border: 1px solid var(--line-soft); border-radius: 14px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.segmented::-webkit-scrollbar { display: none; }
.segmented button { border: 0; background: none; padding: 7px 14px; border-radius: 10px; font-weight: 560; font-size: 13.5px; color: var(--text-2); cursor: pointer; white-space: nowrap; transition: background .15s, color .15s, box-shadow .2s; }
.segmented button:hover { color: var(--navy); }
.segmented button.active { background: var(--surface); color: var(--navy); box-shadow: 0 1px 2px rgba(0, 87, 147, .1), 0 3px 8px -3px rgba(0, 87, 147, .14); }

/* ---------- Callouts & empty states ---------- */
.callout { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--info-line); background: var(--blue-wash); color: var(--text); font-size: 13.5px; line-height: 1.55; }
.callout .i { margin-top: 2px; color: var(--blue); }
.callout > :is(div, span):last-child { flex: 1 1 auto; min-width: 0; }
.callout.warn { background: var(--amber-wash); border-color: var(--amber-line); }
.callout.warn .i { color: var(--amber); }
.callout.ok { background: var(--moss-wash); border-color: var(--ok-line); }
.callout.ok .i { color: var(--moss); }
.callout.danger { background: var(--brick-wash); border-color: var(--brick-line); }
.callout.danger .i { color: var(--brick); }
.callout.neutral { background: var(--surface-2); border-color: var(--line); color: var(--text-2); }
.callout.neutral .i { color: var(--text-3); }
.callout strong { color: var(--navy); }
.empty { padding: 48px 20px; text-align: center; color: var(--text-2); }
.empty > .i { width: 52px; height: 52px; padding: 14px; margin: 0 auto 14px; color: var(--accent-ink); stroke-width: 1.6; background: var(--accent-wash); border-radius: 16px; }
.empty h3 { font-family: var(--font-display); font-size: 18px; letter-spacing: -0.015em; margin-bottom: 4px; }
.empty p { max-width: 440px; margin: 0 auto; font-size: 13.5px; }
.empty .btn-row { justify-content: center; margin-top: 18px; }

/* ---------- Accordion ---------- */
.disclosure { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-card); }
.disclosure + .disclosure { margin-top: 10px; }
.disclosure > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px; padding: 15px 20px; font-weight: 600; color: var(--navy); border-radius: var(--r-lg); }
.disclosure > summary:hover { background: var(--surface-2); }
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary .chev { margin-left: auto; transition: transform .2s var(--ease); color: var(--text-3); }
.disclosure[open] > summary .chev { transform: rotate(180deg); }
.disclosure[open] > summary { border-bottom: 1px solid var(--line); border-radius: var(--r-lg) var(--r-lg) 0 0; }
.disclosure > .disclosure-body { padding: 20px; }
.disclosure .sum-sub { font-weight: 400; color: var(--text-2); font-size: 12.5px; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; right: 22px; bottom: calc(22px + var(--bottom-nav-h)); z-index: 1200; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 13px 15px; border-radius: 12px; background: #12273C; color: #fff; box-shadow: var(--shadow-2); font-size: 13.5px; animation: toast-in .28s var(--ease); border: 1px solid rgba(255,255,255,.07); }
.toast .i { margin-top: 2px; }
.toast.ok .i { color: #9FD6B5; }
.toast.error { background: #6F2216; }
.toast.warn .i { color: #F2C77B; }
.toast .toast-close { margin-left: auto; background: none; border: 0; color: rgba(255,255,255,.7); cursor: pointer; padding: 0 0 0 6px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
@media (max-width: 760px) { .toasts { left: 16px; right: 16px; max-width: none; } }

/* ---------- Overlays: dialog, drawer ---------- */
.overlay { position: fixed; inset: 0; z-index: 900; background: var(--scrim); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; padding: 24px; animation: fade-in .18s ease-out; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.dialog { width: min(540px, 100%); max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px); display: flex; flex-direction: column; background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow-3); overflow: hidden; animation: dialog-in .24s var(--ease); border: 1px solid var(--line); }
@keyframes dialog-in { from { opacity: 0; transform: translateY(12px) scale(.985); } to { opacity: 1; transform: none; } }
.dialog.wide { width: min(800px, 100%); }
.dialog-head { padding: 24px 26px 6px; }
.dialog-head h2 { font-size: 21px; }
.dialog-head p { margin-top: 6px; color: var(--text-2); font-size: 13.5px; }
.dialog-body { padding: 14px 26px 22px; overflow-y: auto; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 26px; border-top: 1px solid var(--line); background: var(--surface-2); }

.drawer-overlay { justify-content: flex-end; align-items: stretch; padding: 0; }
.drawer { width: min(var(--drawer-w, 780px), 100vw); height: 100%; background: var(--ground); display: flex; flex-direction: column; box-shadow: var(--shadow-3); border-radius: var(--r-xl) 0 0 var(--r-xl); overflow: hidden; animation: drawer-in .3s var(--ease); }
@media (min-width: 1680px) { .drawer { width: min(var(--drawer-w, 880px), 100vw); } }
@keyframes drawer-in { from { transform: translateX(56px); opacity: .3; } to { transform: none; opacity: 1; } }
.drawer-head { flex: 0 0 auto; background: var(--surface); border-bottom: 1px solid var(--line); padding: 20px 24px 0; }
.drawer-head .row { align-items: flex-start; }
.drawer-title { font-family: var(--font-display); font-size: 22px; font-weight: 600; color: var(--navy); line-height: 1.25; letter-spacing: -0.02em; }
.drawer-sub { font-size: 13px; color: var(--text-2); margin-top: 3px; }
.drawer-head .tabs { margin: 14px -6px 0; border-bottom: 0; }
.drawer-head.no-tabs { padding-bottom: 20px; }
.drawer-body { flex: 1 1 auto; overflow-y: auto; padding: 24px; overscroll-behavior: contain; }
.drawer-foot { flex: 0 0 auto; display: flex; gap: 8px; justify-content: flex-end; align-items: center; flex-wrap: wrap; padding: 13px 24px; background: var(--surface); border-top: 1px solid var(--line); }
.drawer-foot .left { margin-right: auto; }
@media (max-width: 760px) {
  .drawer { width: 100vw; border-radius: 0; animation-name: sheet-in; }
  .drawer-head { padding: 14px 16px 0; padding-top: max(14px, env(safe-area-inset-top)); }
  .drawer-title { font-size: 20px; }
  .drawer-head.no-tabs { padding-bottom: 14px; }
  .drawer-body { padding: 16px; }
  .drawer-foot { padding: 10px 16px; padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  .drawer-foot .btn { flex: 1 1 auto; }
  .overlay:not(.drawer-overlay) { align-items: flex-end; padding: 0; }
  .overlay:not(.drawer-overlay) > .dialog { width: 100%; border-radius: var(--r-xl) var(--r-xl) 0 0; max-height: 92vh; max-height: 92dvh; animation-name: sheet-in; border-bottom: 0; }
  .overlay:not(.drawer-overlay) > .dialog::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 4px; background: var(--line-strong); margin: 8px auto 0; flex: 0 0 auto; }
  .dialog-head { padding: 14px 18px 4px; }
  .dialog-body { padding: 10px 18px 16px; }
  .dialog-foot { padding: 12px 18px; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .dialog-foot .btn { flex: 1 1 0; }
}
@keyframes sheet-in { from { transform: translateY(28px); opacity: .4; } to { transform: none; opacity: 1; } }

/* Menu (popover) */
.menu { position: fixed; z-index: 1000; min-width: 240px; max-width: calc(100vw - 16px); background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 24px 60px -16px rgba(0, 87, 147, .3), 0 2px 6px rgba(0, 87, 147, .06); padding: 7px; animation: dd-in .16s var(--ease); transform-origin: top right; }
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.menu button, .menu a { display: flex; width: 100%; align-items: center; gap: 11px; padding: 10px 12px; border: 0; background: none; border-radius: 11px; font-size: 14px; color: var(--text); text-decoration: none; cursor: pointer; text-align: left; transition: background .12s; }
.menu button .i, .menu a .i { color: var(--text-3); }
.menu button:hover, .menu a:hover, .menu button:focus-visible, .menu a:focus-visible { background: var(--surface-3); color: var(--navy); outline: none; }
.menu button:hover .i, .menu a:hover .i { color: var(--navy); }
.menu .danger, .menu .danger .i { color: var(--brick); }
.menu .menu-sep { height: 1px; background: var(--line); margin: 6px 0; }
.menu .menu-label { padding: 8px 11px 5px; font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 300px; }
.menu .is-current { color: var(--navy); font-weight: 600; }
.menu .menu-desc { display: block; font-size: 12px; color: var(--text-3); margin-top: 1px; }

/* Spinner & skeleton */
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--brand-blue); animation: spin .7s linear infinite; }
.btn-primary .spinner, .btn-success .spinner { border-color: rgba(255,255,255,.35); border-top-color: currentColor; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 64px 20px; color: var(--text-2); }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Key/value lists */
.kv { display: grid; grid-template-columns: minmax(120px, 34%) 1fr; gap: 11px 18px; font-size: 13.5px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; color: var(--text); overflow-wrap: anywhere; }
.kv.compact { grid-template-columns: 1fr auto; gap: 10px 16px; }
.kv.compact dt { color: var(--text-2); }
.kv.compact dd { text-align: right; font-weight: 600; color: var(--navy); font-variant-numeric: tabular-nums; }
@media (max-width: 480px) { .kv:not(.compact) { grid-template-columns: 1fr; gap: 2px; } .kv:not(.compact) dd { margin-bottom: 10px; } }

/* Stages (horizontal steps) */
.stages { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 10px; }
.stage { position: relative; padding: 15px 16px 13px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); min-width: 0; }
.stage::before { content: ""; position: absolute; left: 16px; right: 16px; top: 0; height: 3px; border-radius: 0 0 3px 3px; background: var(--line-strong); }
.stage.done { background: var(--moss-wash); border-color: var(--ok-line); }
.stage.done::before { background: var(--brand-moss); }
.stage.current { background: var(--amber-wash); border-color: var(--amber-line); }
.stage.current::before { background: var(--amber-fill); }
@media (max-width: 760px) { .stages { grid-auto-flow: row; } }

/* Agreement text */
.doc { font-family: var(--font-serif); font-size: 16px; line-height: 1.78; color: var(--text); }
.doc h3 { font-family: var(--font); font-size: 15px; margin: 26px 0 6px; color: var(--navy); }
.doc p { margin: 0 0 12px; }
@media (max-width: 560px) { .doc { font-size: 15.5px; } }
.serif { font-family: var(--font-serif); }

/* Chips */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 11px; border-radius: 99px; background: var(--blue-wash); color: var(--blue-strong); border: 1px solid var(--info-line); font-size: 12.5px; font-weight: 550; }
.chip button { border: 0; background: none; color: inherit; cursor: pointer; padding: 0 2px; line-height: 1; opacity: .7; }
.chip button:hover { opacity: 1; }

/* Multi-select dropdown */
.mselect { position: relative; }
.mselect > .btn { width: 100%; justify-content: space-between; font-weight: 500; color: var(--text); min-height: 40px; }
.mselect-panel { position: absolute; z-index: 50; top: calc(100% + 6px); left: 0; min-width: 240px; max-width: min(360px, calc(100vw - 32px)); max-height: 320px; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-2); padding: 6px; }
.mselect-panel .check { padding: 7px 8px; border-radius: 8px; }
.mselect-panel .check:hover { background: var(--surface-3); }

/* Mini bar chart */
.bars { display: flex; flex-direction: column; gap: 9px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 38%) 1fr 44px; gap: 12px; align-items: center; font-size: 13px; }
.bar-row .bar-label { overflow-wrap: break-word; line-height: 1.3; color: var(--text); }
.bar-track { display: block; height: 8px; background: var(--ground-2); border-radius: 99px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.bar-row .num { text-align: right; color: var(--text-2); }
@media (max-width: 420px) { .bar-row { grid-template-columns: minmax(0, 1fr) 40px; row-gap: 4px; } .bar-row .bar-label { grid-column: 1 / -1; } }

/* Date tile */
.datebox { width: 60px; flex: 0 0 auto; text-align: center; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); padding: 7px 0 6px; }
.datebox .mon { font-size: 12px; font-weight: 600; color: var(--care-ra4-ink); line-height: 1.1; }
.datebox .day { font-family: var(--font-display); font-size: 25px; font-weight: 600; color: var(--navy); line-height: 1.1; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.datebox .yr { font-size: 11px; color: var(--text-3); line-height: 1.2; }
.datebox.tbd .mon { color: var(--text-3); }
.datebox.tbd .day { font-family: var(--font); font-size: 14px; padding: 5px 0 4px; color: var(--text-3); }
:root[data-theme="dark"] .datebox .mon { color: var(--care-ra4-light); }
@media (max-width: 640px) { .datebox { width: 52px; padding: 6px 0 5px; } .datebox .day { font-size: 21px; } }

/* Appearance switch inside menus */
.theme-row { display: flex; gap: 4px; padding: 4px; margin: 2px 4px 4px; background: var(--ground-2); border-radius: 10px; }
.menu .theme-row button { flex: 1; justify-content: center; padding: 6px 8px; font-size: 12.5px; font-weight: 550; color: var(--text-2); border-radius: 7px; gap: 6px; }
.menu .theme-row button.on { background: var(--surface); color: var(--navy); box-shadow: 0 1px 3px rgba(0, 87, 147, .14); }

/* Rating scale (feedback forms) */
.rating { display: flex; gap: 8px; max-width: 400px; }
.rating label { flex: 1; cursor: pointer; }
.rating span { display: flex; align-items: center; justify-content: center; height: 48px; border: 1px solid var(--line-strong); border-radius: 12px; font-weight: 600; font-size: 16px; font-family: var(--font-display); background: var(--surface); color: var(--text-2); transition: background .15s, border-color .15s, color .15s, transform .1s; }
.rating label:hover span { border-color: var(--brand-blue); color: var(--navy); }
.rating input:checked + span { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.rating input:focus-visible + span { box-shadow: var(--focus); }
.rating label:active span { transform: scale(.96); }
.fb-progress { position: sticky; top: calc(var(--gbar-h, 64px) + 10px); z-index: 5; -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); background: color-mix(in srgb, var(--surface) 88%, transparent); }

/* Bottom navigation for phones (console and My CARE) */
.bottom-nav { display: none; }
@media (max-width: 760px) {
  body.has-bottom-nav { --bottom-nav-h: calc(80px + env(safe-area-inset-bottom)); padding-bottom: var(--bottom-nav-h); }
  .bottom-nav { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); position: fixed; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 400; height: 62px; padding: 6px; border-radius: 22px; background: color-mix(in srgb, var(--surface) 86%, transparent); -webkit-backdrop-filter: saturate(1.6) blur(18px); backdrop-filter: saturate(1.6) blur(18px); border: 1px solid var(--line); box-shadow: 0 18px 40px -18px rgba(0, 87, 147, .35), 0 2px 8px rgba(0, 87, 147, .06); }
  .bottom-nav a, .bottom-nav button { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 0; border: 0; background: none; color: var(--text-3); text-decoration: none; font-size: 11px; font-weight: 550; border-radius: 16px; cursor: pointer; -webkit-tap-highlight-color: transparent; transition: color .2s, background .25s var(--ease); }
  .bottom-nav a:active, .bottom-nav button:active { transform: scale(.96); }
  .bottom-nav .i { width: 21px; height: 21px; stroke-width: 1.7; transition: transform .25s var(--ease); }
  .bottom-nav span.lbl { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0; font-size: clamp(9.5px, 2.75vw, 11px); letter-spacing: -0.01em; }
/* Full mobile navigation labels where they fit; short Onboarding label on tiny phones. */
.bottom-nav .nav-label-short { display: none; }
@media (max-width: 390px) {
  .bottom-nav .nav-label-full { display: none; }
  .bottom-nav .nav-label-short { display: inline; }
}

  .bottom-nav a.active, .bottom-nav button.active { color: var(--navy); background: var(--accent-wash, var(--surface-3)); font-weight: 650; }
  .bottom-nav a.active .i { transform: translateY(-1px); color: var(--accent, var(--navy)); }
  .bottom-nav .dot { position: absolute; top: 2px; left: calc(50% + 6px); min-width: 17px; height: 17px; padding: 0 4px; border-radius: 99px; background: var(--amber-fill); color: #fff; font-size: 10px; line-height: 17px; text-align: center; font-weight: 650; }
}

/* Touch devices: comfortable targets, no iOS zoom on focus */
@media (pointer: coarse) {
  .btn { min-height: 44px; }
  .btn-sm { min-height: 38px; }
  .btn-icon { width: 44px; }
  .btn-icon.btn-sm { width: 38px; min-height: 38px; }
  .input, .select, .textarea { min-height: 46px; font-size: 16px; }
  .menu button, .menu a { padding: 12px 12px; }
  .check input { width: 20px; height: 20px; margin-top: 0; }
  .tab { padding-top: 13px; padding-bottom: 14px; }
}

/* Print */
@media print {
  body { background: #fff; }
  .no-print, .sidebar, .topbar, .tabs, .toasts, .bottom-nav { display: none !important; }
  .app-main { margin: 0 !important; padding: 0 !important; }
  .card, .metric { box-shadow: none; break-inside: avoid; }
}
@media (max-width: 640px) { .hide-sm { display: none !important; } }
.btn[aria-expanded="true"]:not(.btn-primary) { background: var(--accent-wash); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); color: var(--accent-ink); }
.metric.text .m-value { font-size: 22px; margin-top: 12px; }

/* Sticky save bars used by builders */
.savebar { position: sticky; bottom: calc(12px + var(--bottom-nav-h)); z-index: 20; display: flex; align-items: center; gap: 12px; justify-content: space-between; padding: 12px 14px 12px 18px; margin-top: 18px; border: 1px solid var(--line); border-radius: 14px; background: color-mix(in srgb, var(--surface) 92%, transparent); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); box-shadow: var(--shadow-2); }
@media (max-width: 560px) { .savebar { flex-wrap: wrap; } .savebar .btn { flex: 1 1 auto; } }
@media (max-width: 720px) { .table-wrap:not(.keep-table) .table td, .table-wrap:not(.keep-table) .table td code { white-space: normal; overflow-wrap: anywhere; } .table-wrap:not(.keep-table) .table td[style*="max-width"] { max-width: none !important; } }

/* First paint while an app boots: nothing, then a quiet spinner only if it takes long. */
.boot-wait { min-height: 40vh; display: grid; place-items: center; opacity: 0; animation: boot-wait-in .2s ease-out .6s forwards; }
@keyframes boot-wait-in { to { opacity: 1; } }
@keyframes dd-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
.drawer-body:focus { outline: none; } .drawer-body:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }

/* ---- Audience picker (messages, surveys, restricted documents) ---- */
.aud { display: grid; gap: 14px; }
.aud-mode { align-items: center; }
.aud-mode .agr-chip { padding: 8px 15px; font-size: 14px; }
.aud-mode .agr-chip .i { width: 15px; height: 15px; }
.aud-hint { margin: 0; }
.aud-dims { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.aud-dim { position: relative; }
.aud-dim > summary { list-style: none; display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; column-gap: 8px; align-items: center; padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); cursor: pointer; min-height: 52px; }
.aud-dim > summary::-webkit-details-marker { display: none; }
.aud-dim > summary:hover { border-color: var(--navy); }
.aud-dim > summary:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.aud-dim-label { grid-column: 1; font-size: 12.5px; color: var(--text-3); font-weight: 560; }
.aud-dim-value { grid-column: 1; font-size: 14px; color: var(--text); font-weight: 560; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.aud-dim > summary .i { grid-column: 2; grid-row: 1 / span 2; color: var(--text-3); }
.aud-dim.is-set > summary { border-color: #005793; background: color-mix(in srgb, #005793 6%, var(--surface)); }
.aud-dim.is-set .aud-dim-value { color: var(--navy); }
.aud-pop { position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; min-width: 100%; width: max-content; max-width: min(380px, 86vw); max-height: 340px; overflow: auto; padding: 10px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); box-shadow: 0 14px 34px rgba(0, 30, 60, .18); display: grid; gap: 6px; }
.aud-pop fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: 2px; min-width: 0; }
.aud-pop .search-input { margin-bottom: 4px; }
.aud-opt { padding: 6px 8px; border-radius: 8px; margin: 0; }
.aud-opt:hover { background: var(--surface-2); }
.aud-opt span { display: flex; justify-content: space-between; gap: 14px; width: 100%; }
.aud-opt small { color: var(--text-3); font-variant-numeric: tabular-nums; }
.aud-opt[hidden] { display: none; }
.aud-attended { margin: 0; }
.aud-people { display: grid; gap: 8px; }
.aud-add { position: relative; max-width: 440px; }
.aud-found { position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; right: 0; padding: 6px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); box-shadow: 0 14px 34px rgba(0, 30, 60, .18); display: grid; gap: 2px; }
.aud-found[hidden] { display: none; }
.aud-found-item { display: grid; gap: 1px; text-align: left; padding: 8px 10px; border: 0; border-radius: 8px; background: none; font: inherit; color: var(--text); cursor: pointer; }
.aud-found-item:hover, .aud-found-item:focus-visible { background: var(--surface-2); }
.aud-found-item span { font-size: 12.5px; color: var(--text-3); }
.aud-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.aud-tag { display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; }
.aud-tag.is-out { text-decoration: line-through; color: var(--text-3); }
.aud-tag button { display: grid; place-items: center; width: 22px; height: 22px; border: 0; border-radius: 50%; background: none; color: var(--text-3); cursor: pointer; }
.aud-tag button:hover { background: var(--line); color: var(--text); }
.aud-options { display: flex; flex-wrap: wrap; gap: 6px 22px; }
.aud-options .check { margin: 0; font-size: 13.5px; }
.aud-summary { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.aud-count { display: grid; gap: 2px; min-width: 0; }
.aud-count strong { font-size: 18px; color: var(--navy); font-family: var(--font-display, inherit); }
.aud-count span { font-size: 13.5px; color: var(--text-2); }
.aud-count.is-empty strong { color: var(--text-3); }
.aud-warn { display: inline-flex; align-items: center; gap: 5px; color: var(--amber) !important; font-weight: 560; }
.aud.is-locked .aud-dim > summary { cursor: default; }

/* Chips inside the audience picker (also used in My CARE). */
.aud .agr-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.aud .agr-chip { display: inline-flex; align-items: center; gap: 7px; padding: 6px 13px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font: inherit; font-size: 13.5px; font-weight: 560; cursor: pointer; }
.aud .agr-chip:hover { border-color: var(--navy); }
.aud .agr-chip[aria-pressed="true"] { background: #005793; border-color: #005793; color: #fff; }
.aud .agr-chip:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.aud .agr-chip:disabled { cursor: default; opacity: .85; }
@media (max-width: 720px) {
  .aud-dims { grid-template-columns: 1fr; }
  .aud-pop { position: static; max-width: none; width: auto; box-shadow: none; margin-top: 6px; }
}

/* CARE V1 · Present QR codes (Events page, event cards, Admin console) */
.dialog.qr-present { width: min(94vw, 560px); max-width: none; padding: 22px 24px 24px; }
.dialog.qr-present.is-multi { width: min(94vw, 980px); }
.qr-present-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px 18px; flex-wrap: wrap; margin-bottom: 18px; }
.qr-present-head h2 { margin: 0; font-size: clamp(22px, 2.2vw, 30px); color: var(--navy); }
.qr-present-head p { margin: 6px 0 0; color: var(--text-2); max-width: 60ch; }
.qr-present-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 22px; }
.qr-present-item { margin: 0; display: grid; gap: 12px; justify-items: center; text-align: center; }
.qr-present-card { width: min(100%, 360px); aspect-ratio: 1; background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 14px; box-shadow: var(--shadow-1); }
.qr-present-card svg { width: 100%; height: 100%; display: block; }
.qr-present-item figcaption { display: grid; gap: 3px; }
.qr-present-item figcaption strong { font-size: 19px; color: var(--navy); }
.qr-present-item figcaption span { font-size: 13.5px; color: var(--text-2); }
.qr-present-item figcaption a { font-size: 13px; color: var(--accent-ink, var(--blue)); overflow-wrap: anywhere; }
.qr-present-actions { justify-content: center; }
.overlay.is-fullscreen { background: var(--surface); }
.overlay.is-fullscreen .dialog.qr-present { width: 100vw; height: 100vh; max-height: none; border-radius: 0; border: 0; box-shadow: none; display: flex; flex-direction: column; justify-content: center; padding: 4vh 5vw; }
.overlay.is-fullscreen .qr-present-head { justify-content: center; text-align: center; }
.overlay.is-fullscreen .qr-present-head h2 { font-size: clamp(30px, 4vw, 56px); }
.overlay.is-fullscreen .qr-present-head p { font-size: clamp(16px, 1.6vw, 22px); margin-inline: auto; }
.overlay.is-fullscreen .qr-present-head .btn-row { position: absolute; top: 18px; right: 22px; }
.overlay.is-fullscreen .qr-present-card { width: min(62vh, 42vw, 620px); }
.overlay.is-fullscreen .dialog.qr-present:not(.is-multi) .qr-present-card { width: min(66vh, 80vw, 680px); }
.overlay.is-fullscreen .qr-present-item figcaption strong { font-size: clamp(20px, 2vw, 30px); }
.overlay.is-fullscreen .qr-present-item figcaption a { font-size: clamp(14px, 1.3vw, 19px); }
.overlay.is-fullscreen .qr-present-actions { display: none; }
.home-hero-actions { margin-top: 18px; display: flex; gap: 10px; flex-wrap: wrap; }
.dialog.qr-present { overflow: auto; position: relative; display: block; }
.overlay.is-fullscreen { padding: 0; }
/* Section headings inside dialogs (formDialog type "heading"). */
.form-grid > .form-heading { margin-top: 6px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.form-grid > .form-heading:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.form-grid > .form-heading .strong { color: var(--navy); font-size: 14px; font-weight: 650; }

/* ---- Phones and small tablets: one set of layout rules everywhere ---- */
@media (max-width: 760px) {
  /* Every tab and view switch stays visible: they wrap and share each line. */
  .rx-nav, .rx-subtabs, .segmented { flex-wrap: wrap; overflow: visible; }
  .segmented { display: flex; width: 100%; }
  .rx-nav > a, .rx-subtabs > :is(a, button), .segmented > :is(a, button) { flex: 1 0 auto; justify-content: center; text-align: center; }
  /* Filter chips fill each line they use. */
  :is(.agr-chips, .onb-chips, .public-chips, .my-chips, .rx-chips, .ext-chips, .rx-filters, .chip-row, .pubd-evfilter, .rx-tabintro-who) { flex-wrap: wrap; }
  :is(.agr-chips, .onb-chips, .my-chips, .rx-chips, .ext-chips, .rx-filters, .chip-row) { display: flex; width: 100%; }
  :is(.agr-chips, .onb-chips, .public-chips, .my-chips, .rx-chips, .ext-chips, .rx-filters, .chip-row, .pubd-evfilter) > :is(button, a, .chip-filter) { flex: 1 1 auto; justify-content: center; }
  /* Quiet buttons in an action row look like buttons, so a row reads as one set. */
  :is(.btn-row, .cell-actions, .card-actions, .ev-actions, .my-res-actions, .rx-actions) > .btn-ghost:not(.btn-icon):not(.btn-danger-text) { background: var(--surface); border-color: var(--line-strong); }
  :is(.btn-row, .cell-actions, .card-actions, .ev-actions, .my-res-actions, .rx-actions) > .btn-ghost.btn-danger-text:not(.btn-icon) { border-color: var(--brick-line, #E8B4A8); }
  /* A button alone on its line spans the line (see markLone in core.js). */
  .btn[data-lone] { width: 100%; justify-content: center; align-self: stretch; }
}
@media (max-width: 760px) {
  /* Tabs on phones: a tidy two-column grid; a last tab on its own spans the row. */
  .tabs, nav.rx-nav, nav.rx-subtabs, div.rx-nav, div.rx-subtabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  :is(.tabs, .rx-nav, .rx-subtabs) > :last-child:nth-child(odd) { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  /* Card headers: the title on top, its actions below sharing the full width. */
  .card-head { flex-wrap: wrap; }
  .card-head > :is(.btn-row, .actions, .head-actions) { width: 100%; }
  .card-head > :is(.btn-row, .actions, .head-actions) > .btn:not(.btn-icon), .card-head > .btn:not(.btn-icon) { flex: 1 1 auto; justify-content: center; }
}
@media (max-width: 760px) {
  :is(.tabs, .rx-nav, .rx-subtabs, .rx-areas) > :is(.tab, a, button) { white-space: normal; text-align: center; min-width: 0; }
  /* Action rows at the bottom of a card share its width. */
  :is(.my-res-actions, .card-actions, .rx-actions, .ev-step-action) > .btn:not(.btn-icon) { flex: 1 1 auto; justify-content: center; }
}
@media (max-width: 760px) {
  /* View switches: the same two-column grid as tabs. */
  nav.segmented, div.segmented { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  :is(nav.segmented, div.segmented) > :last-child:nth-child(odd) { grid-column: 1 / -1; }
  /* Table cards never get wider than the screen. */
  .table-wrap:not(.keep-table) .table :is(td, th) { min-width: 0 !important; overflow-wrap: anywhere; }
  .table-wrap:not(.keep-table) .table .badge { white-space: normal; text-align: left; }
  /* A heading with a button: the button takes the rest of the line, or the whole next line. */
  .row.between { flex-wrap: wrap; }
  .row.between > .btn:not(.btn-icon) { flex: 1 1 auto; justify-content: center; }
  .rx-qnav > .btn:not(.btn-icon) { flex: 1 1 auto; justify-content: center; }
}
@media (max-width: 1024px) {
  nav.rx-subtabs { flex-wrap: wrap; overflow: visible; }
  nav.rx-subtabs > * { flex: 1 0 auto; justify-content: center; }
}
@media (max-width: 760px) {
  /* Every row of buttons spans the width it sits in; icon buttons keep their size. */
  .btn-row:not(.keep-inline) > .btn:not(.btn-icon) { flex: 1 1 auto; justify-content: center; }
  .context-head .tabs { width: 100%; }
}
@media (max-width: 720px) {
  /* Row markers become the card's left edge instead of a stripe over the text. */
  .table-wrap:not(.keep-table) .table td, .table-wrap:not(.keep-table) .table th { box-shadow: none !important; }
  .table-wrap:not(.keep-table) .table tr:is(.is-draft, .needs-review, .member-needs-attention, .mb-row-action) { border-left: 3px solid var(--care-yellow, #E5CD1F); }
}
@media (max-width: 760px) {
  /* A quiet button standing alone still looks like a button. */
  .btn-ghost[data-lone]:not(.btn-danger-text) { background: var(--surface); border-color: var(--line-strong); }
}
@media (max-width: 720px) {
  /* Numbers in table cards line up with the other values (left). */
  .table-wrap:not(.keep-table) .table td.num, .table-wrap:not(.keep-table) .table td.num .cv, .table-wrap:not(.keep-table) .table td.num .cv * { text-align: left; justify-items: start; align-items: flex-start; justify-content: flex-start; }
}
@media (max-width: 760px) {
  /* Separators between tab groups are not shown in the phone tab grid. */
  .tabs > :not(.tab):not(a):not(button) { display: none; }
}
@media (max-width: 760px) { .tabs > .pubc-tab-settings:last-child { grid-column: auto; } }
@media (max-width: 720px) {
  /* A card whose only action is the "more" menu shows it in its top-right
     corner instead of an empty-looking row at the bottom. */
  .table-wrap:not(.keep-table) .table td.cell-actions.cell-actions-icon { position: absolute; top: 8px; right: 8px; margin: 0; padding: 0; border: 0; width: auto; }
}
@media (max-width: 720px) { .table-wrap:not(.keep-table) .table tr.has-corner-action > td.cell-lead { padding-right: 40px; } }

/* Printed documents (print-doc.js): only the document is printed, as plain A4 */
.print-doc { display: none; }
@media print {
  body.pd-printing { background: #fff; color: #111; }
  body.pd-printing > :not(.print-doc):not(#pd-keep) { display: none; } /* :not(#…) outranks rules on #app */
  body.pd-printing .print-doc { display: block; font: 10.5pt/1.5 var(--font); color: #111; }
  .pd-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12pt; padding-bottom: 8pt; border-bottom: 1.5pt solid #00549f; font-size: 8.5pt; color: #4d5c66; text-align: right; }
  .pd-title { margin: 16pt 0 2pt; font-size: 17pt; line-height: 1.25; color: #00549f; }
  .pd-sub { margin: 0 0 10pt; color: #4d5c66; }
  .pd-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6pt 14pt; margin: 0 0 6pt; padding: 8pt 10pt; border: .6pt solid #c9d3dc; border-radius: 4pt; }
  .pd-facts dt { font-size: 7.5pt; text-transform: uppercase; letter-spacing: .04em; color: #64758a; }
  .pd-facts dd { margin: 0; font-weight: 600; }
  .pd-sec { margin-top: 14pt; }
  .pd-sec h2 { margin: 0 0 5pt; padding-bottom: 3pt; font-size: 12pt; color: #00549f; border-bottom: .6pt solid #c9d3dc; break-after: avoid; }
  .pd-sec h3 { margin: 10pt 0 3pt; font-size: 10.5pt; break-after: avoid; }
  .pd-sec p { margin: 0 0 6pt; orphans: 3; widows: 3; }
  .pd-table { width: 100%; border-collapse: collapse; font-size: 9pt; }
  .pd-table th, .pd-table td { padding: 4pt 5pt; border-bottom: .5pt solid #d6dde4; text-align: left; vertical-align: top; }
  .pd-table thead th { font-size: 7.5pt; text-transform: uppercase; letter-spacing: .03em; color: #64758a; border-bottom-color: #8a99a8; }
  .pd-table tr { break-inside: avoid; }
  .pd-table small { display: block; color: #64758a; font-size: 8pt; }
  .pd-num td:nth-child(n+3), .pd-num th:nth-child(n+3) { text-align: right; white-space: nowrap; }
  .pd-num tfoot th { border-top: .8pt solid #8a99a8; }
  .pd-review td:nth-child(2), .pd-review td:nth-child(3) { white-space: nowrap; text-align: center; }
  .pd-list { margin: 0; padding-left: 14pt; }
  .pd-empty { color: #8a99a8; font-style: italic; }
  .pd-head img { display: block; width: 52mm; height: auto; }
  .print-doc > .pd-sec:last-child { margin-bottom: 0; }
}
