/*
 * Fraternet design tokens — canonical CSS source.
 *
 * Consumed by:
 *   - Keycloak login theme (infra/keycloak/themes/fraternet/login)
 *   - Core SSR Thymeleaf templates (services/core)
 *   - Admin SSR Thymeleaf templates (services/admin)
 *   - Public website (apps/website, mounted by Hugo — ADR-101)
 *
 * The `:root` block below is GENERATED from `tokens/` and spliced in by
 * `tokens/build.mjs` (ADR-062) — change a colour there, not here. Everything
 * else in this file is hand-written.
 *
 * These three surfaces are dark-only. The light palette exists solely in
 * `colors.generated.ts`, for the mobile app.
 */

/* ───── Self-hosted web fonts (ADR-060) ──────────────────────────────────────
   Served from this stylesheet's own origin — nothing is fetched from a third
   party at page load. The `url()`s are RELATIVE to this file, which is what
   lets one stylesheet serve all three surfaces despite their different mount
   points (/app/design for Core, /design for Admin, the theme's resources/css
   for Keycloak). Files, licences and provenance: fonts/README.md.

   Three roles:
     Cinzel           display — headings, page titles, the wordmark. Roman
                      inscriptional CAPITALS: it has no true lowercase, so it
                      must never be used for user-entered content.
     Playfair Display content serif — titles that are data (document names,
                      lodge names). Needs real lowercase.
     DM Sans          body — everything else.

   All three are variable fonts: one file covers the whole weight range. */

@font-face {
  font-family: 'Cinzel';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('fonts/cinzel-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Cinzel';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('fonts/cinzel-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Playfair Display';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('fonts/playfair-display-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Playfair Display';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('fonts/playfair-display-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 300 600;
  font-display: swap;
  src: url('fonts/dm-sans-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 300 600;
  font-display: swap;
  src: url('fonts/dm-sans-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* @generated-tokens:start — from tokens/, see ADR-062. Do not edit by hand. */
:root {
  --fr-bg:         #09090e;
  --fr-surface:    #13131d;
  --fr-surface-2:  #1a1a27;
  --fr-surface-3:  #222233;
  --fr-tab-bar:    #0d0d16;
  --fr-border:     rgba(201,168,76,0.24);
  --fr-border-hov: rgba(201,168,76,0.45);
  /* Boundary of a control a member types into or picks from: at least 3:1 against every surface (WCAG 1.4.11). Cards keep the quieter `border`. */
  --fr-border-strong: rgba(201,168,76,0.6);
  --fr-accent:     #c9a84c;
  --fr-accent-dim: rgba(201,168,76,0.14);
  --fr-accent-glow: 0 0 30px rgba(201,168,76,0.15);
  /* Secondary accent: unselected icons/controls, where gold marks the selected one. */
  --fr-silver:     #8e8e9e;
  --fr-text:       #ede5d4;
  --fr-text-muted: #a89d84;
  --fr-text-faint: #7a705c;
  --fr-on-accent:  #1a1200;
  --fr-gradient:   linear-gradient(135deg,#c9a84c,#e8cf80,#b8922a);
  --fr-online:     #4caf7a;
  --fr-danger:     #e07070;
  /* Presence dot for a member who is not online. Neutral by design, so it does not read as a third status next to `online` and `danger`. */
  --fr-offline:    #444444;
}
/* @generated-tokens:end */

/* ───── Icons (ADR-059) ───────────────────────────────────────────────────────
   Phosphor symbols from the generated `icons.svg` sprite, referenced through
   each service's `fragments/icon :: icon('<symbol-id>')`. Sized in `em` so the
   surrounding rule's `font-size` drives the icon, and filled with
   `currentColor` so it inherits the surrounding `color`. */

.fr-icon {
  width: 1em;
  height: 1em;
  flex: none;
  vertical-align: -0.125em;
}
/* Secondary accent: an icon that is available but not the selected/active one. */
.fr-icon--silver { color: var(--fr-silver); }

/* Leading-icon + text banner (warnings, history notes). The icon keeps its
   baseline nudge when the text wraps to several lines. */
.fr-note { display: flex; align-items: flex-start; gap: 8px; }
.fr-note > .fr-icon { margin-top: 0.15em; }
.fr-note--inline { display: inline-flex; align-items: center; gap: 4px; }

/* ───── Base reset & typography ───────────────────────────────────────────── */

/* Type scale for the SSR surfaces (ADR-062 amendment 2026-11-07). Nothing that
   is text goes below --fr-text-xs; glyphs (carets, sort arrows) may. Caps
   labels share one tracking value — wide-tracked capitals read worse small. */
:root {
  --fr-text-xs:   12px;
  --fr-text-sm:   13px;
  --fr-text-md:   14px;
  --fr-text-base: 16px;
  --fr-caps-tracking: 0.08em;
}

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

html, body {
  height: 100%;
  /* The SSR surfaces are dark-only. Without this the browser renders every
     native widget it owns — the date and time picker popups above all — in its
     light palette, so a black calendar glyph lands on a near-black field. */
  color-scheme: dark;
  background: var(--fr-bg);
  color: var(--fr-text);
  font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
  font-size: var(--fr-text-base);
  line-height: 1.5;
}

/* One visible focus ring for everything a keyboard can reach (WCAG 2.4.7).
   :focus-visible keeps it off mouse clicks on buttons and links. */
:focus-visible {
  outline: 2px solid var(--fr-accent);
  outline-offset: 2px;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--fr-border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--fr-border-hov); }

a { color: var(--fr-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 {
  font-family: 'Cinzel', Georgia, serif;
  font-weight: 500;
  color: var(--fr-text);
  letter-spacing: 0.01em;
}

/* A case-sensitive identifier (org slug, stack id, correlation id) shown inside
   a heading. Cinzel is capitals-only, which would render `lodge-alpha` as
   `LODGE-ALPHA` and misrepresent the actual value — so identifiers opt out. */
.fr-ident {
  font-family: 'DM Sans', system-ui, sans-serif;
  font-weight: 400;
  letter-spacing: 0;
}

/* ───── Reusable component classes ────────────────────────────────────────── */

.fr-page {
  min-height: 100vh;
  background: var(--fr-bg);
  background-image: radial-gradient(ellipse at 50% 0%, var(--fr-accent-dim) 0%, transparent 60%);
}

.fr-top-rule {
  height: 2px;
  background: var(--fr-gradient);
}

.fr-card {
  background: var(--fr-surface);
  border: 1px solid var(--fr-border);
  border-radius: 12px;
  padding: 20px;
}

.fr-section-label {
  font-size: var(--fr-text-xs);
  letter-spacing: var(--fr-caps-tracking);
  color: var(--fr-text-muted);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.fr-input {
  width: 100%;
  padding: 14px 16px;
  background: var(--fr-surface-2);
  border: 1px solid var(--fr-border-strong);
  border-radius: 10px;
  color: var(--fr-text);
  font-size: var(--fr-text-base);
  font-family: inherit;
  transition: border-color .15s;
}
.fr-input:focus, .fr-select:focus { border-color: var(--fr-accent); box-shadow: var(--fr-accent-glow); }
.fr-input::placeholder { color: var(--fr-text-muted); }

/* Date and time fields. A click anywhere in the field opens the native popup
   (see the showPicker handler on the pages that use these), so the whole box
   is the affordance and the indicator glyph is only the signpost. */
.fr-input--picker { cursor: pointer; }
.fr-input--picker::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.55;
  transition: opacity .15s;
}
.fr-input--picker:hover::-webkit-calendar-picker-indicator,
.fr-input--picker:focus::-webkit-calendar-picker-indicator { opacity: 1; }

.fr-select {
  appearance: none;
  width: 100%;
  padding: 11px 14px;
  background: var(--fr-surface-2);
  border: 1px solid var(--fr-border-strong);
  border-radius: 8px;
  color: var(--fr-text);
  font-family: inherit;
  font-size: var(--fr-text-base);
}

.fr-btn-primary {
  display: inline-block;
  padding: 14px 22px;
  background: var(--fr-gradient);
  border: none;
  border-radius: 10px;
  color: var(--fr-on-accent);
  font-size: var(--fr-text-md);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  font-family: inherit;
  transition: filter .15s;
}
.fr-btn-primary:hover { filter: brightness(1.08); }
.fr-btn-primary:disabled { background: var(--fr-accent-dim); color: var(--fr-accent); cursor: wait; }

.fr-btn-secondary {
  display: inline-block;
  padding: 12px 18px;
  background: transparent;
  border: 1px solid var(--fr-border-hov);
  border-radius: 10px;
  color: var(--fr-text);
  font-size: var(--fr-text-md);
  font-family: inherit;
  cursor: pointer;
  transition: all .15s;
}
.fr-btn-secondary:hover { border-color: var(--fr-accent); }

.fr-btn-danger {
  background: transparent;
  border: 1px solid color-mix(in srgb, var(--fr-danger) 30%, transparent);
  color: var(--fr-danger);
  padding: 8px 14px;
  border-radius: 8px;
  font-family: inherit;
  font-size: var(--fr-text-md);
  cursor: pointer;
}
.fr-btn-danger:hover { background: color-mix(in srgb, var(--fr-danger) 8%, transparent); }

.fr-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 14px;
  background: var(--fr-accent-dim);
  border: 1px solid var(--fr-border-hov);
  color: var(--fr-accent);
  font-size: var(--fr-text-xs);
  letter-spacing: 0.06em;
}

.fr-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--fr-surface);
  border: 1px solid var(--fr-border);
  border-radius: 12px;
  overflow: hidden;
}
.fr-table th, .fr-table td {
  padding: 12px 16px;
  text-align: left;
  font-size: var(--fr-text-md);
  border-bottom: 1px solid var(--fr-border);
}
.fr-table thead th {
  background: var(--fr-surface-2);
  font-size: var(--fr-text-xs);
  letter-spacing: var(--fr-caps-tracking);
  text-transform: uppercase;
  color: var(--fr-text-muted);
  font-weight: 500;
}
.fr-table tbody tr:last-child td { border-bottom: none; }
.fr-table tbody tr:hover { background: var(--fr-surface-2); }

/* Sortable header (fragments/table.html). The arrow is drawn from aria-sort,
   so what assistive tech announces and what the eye sees cannot disagree. */
.fr-th-sort {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.fr-th-sort:hover, .fr-th-sort:focus-visible { color: var(--fr-text); }
.fr-th-sort::after { content: "↕"; opacity: 0.35; font-size: 11px; letter-spacing: 0; }
.fr-table th[aria-sort="ascending"] .fr-th-sort,
.fr-table th[aria-sort="descending"] .fr-th-sort { color: var(--fr-accent); }
.fr-table th[aria-sort="ascending"] .fr-th-sort::after { content: "▲"; opacity: 1; }
.fr-table th[aria-sort="descending"] .fr-th-sort::after { content: "▼"; opacity: 1; }

.fr-nav {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 28px;
  background: var(--fr-surface);
  border-bottom: 1px solid var(--fr-border);
  position: relative;
}
.fr-nav::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: var(--fr-gradient);
}
.fr-nav__brand {
  font-family: 'Cinzel', serif;
  font-size: var(--fr-text-base);
  font-weight: 600;
  letter-spacing: var(--fr-caps-tracking);
  color: var(--fr-accent);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

/* Shield mark next to a wordmark (ADR-058). Asset: design/themes/brand. */
.fr-brand-mark {
  width: 26px;
  height: 26px;
  display: block;
  flex: none;
}
.fr-nav__link {
  color: var(--fr-text-muted);
  font-size: var(--fr-text-md);
  letter-spacing: 0.04em;
}
.fr-nav__link:hover, .fr-nav__link.is-active {
  color: var(--fr-accent);
  text-decoration: none;
}
.fr-nav__spacer { flex: 1; }
.fr-nav__user {
  font-size: var(--fr-text-sm);
  color: var(--fr-text-muted);
}
.fr-nav__user strong { color: var(--fr-text); font-weight: 500; }

.fr-main {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 28px 60px;
}

/* ───── Admin panel shell: sidebar + content ─────────────────────────────── */

.fr-shell {
  display: flex;
  align-items: stretch;
  min-height: 100vh;
}

.fr-sidebar {
  width: 240px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--fr-surface);
  border-right: 1px solid var(--fr-border);
  padding: 24px 0 20px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.fr-sidebar__brand {
  font-family: 'Cinzel', serif;
  font-size: var(--fr-text-xs);
  font-weight: 600;
  letter-spacing: var(--fr-caps-tracking);
  color: var(--fr-accent);
  padding: 0 24px 4px;
  display: flex;
  align-items: center;
  gap: 9px;
}
.fr-sidebar__org {
  font-family: 'Cinzel', serif;
  font-size: 17px;
  font-weight: 500;
  color: var(--fr-text);
  padding: 0 24px 18px;
}
.fr-sidebar__menu {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 12px;
}
.fr-sidebar__link {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--fr-text-muted);
  font-size: var(--fr-text-md);
  letter-spacing: 0.04em;
  transition: color .15s, background .15s;
}
.fr-sidebar__link:hover {
  color: var(--fr-text);
  background: var(--fr-surface-2);
  text-decoration: none;
}
.fr-sidebar__link.is-active {
  color: var(--fr-accent);
  background: var(--fr-accent-dim);
}
.fr-sidebar__group-summary {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  list-style: none;
  user-select: none;
}
.fr-sidebar__group-summary::-webkit-details-marker { display: none; }
.fr-sidebar__group-summary::after {
  content: '›';
  font-size: var(--fr-text-md);
  color: var(--fr-text-muted);
  transition: transform .15s;
}
.fr-sidebar__group[open] > .fr-sidebar__group-summary::after {
  transform: rotate(90deg);
}
.fr-sidebar__sublink {
  padding-left: 28px;
}
.fr-sidebar__footer {
  margin-top: 16px;
  padding: 16px 24px 0;
  border-top: 1px solid var(--fr-border);
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: var(--fr-text-sm);
  color: var(--fr-text-muted);
}
.fr-sidebar__footer strong { color: var(--fr-text); font-weight: 500; }
.fr-sidebar__locale-btn {
  background: transparent;
  border: 1px solid var(--fr-border);
  border-radius: 6px;
  color: var(--fr-text-muted);
  font-family: inherit;
  font-size: var(--fr-text-xs);
  padding: 3px 8px;
  cursor: pointer;
}
.fr-sidebar__locale-btn:hover { border-color: var(--fr-border-hov); color: var(--fr-text); }

/* Language switcher (ADR-098): a disclosure, so it holds any number of languages.
   Scoped to the sidebar: the Keycloak login theme loads this file too and has
   its own .fr-locale, styled in login.css. */
.fr-sidebar__footer .fr-locale { align-self: flex-start; }
.fr-sidebar__footer .fr-locale > summary { list-style: none; display: inline-flex; align-items: center; gap: 6px; }
.fr-sidebar__footer .fr-locale > summary::-webkit-details-marker { display: none; }
.fr-sidebar__footer .fr-locale > summary::after { content: "\25BE"; font-size: 10px; }
.fr-sidebar__footer .fr-locale[open] > summary { border-color: var(--fr-border-hov); color: var(--fr-text); }
.fr-sidebar__footer .fr-locale__list { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
.fr-sidebar__footer .fr-locale__option {
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--fr-text-muted);
  font-family: inherit;
  font-size: var(--fr-text-xs);
  padding: 4px 8px;
  text-align: left;
  cursor: pointer;
  width: 100%;
}
.fr-sidebar__footer .fr-locale__option:hover { color: var(--fr-text); background: var(--fr-accent-dim); }
.fr-sidebar__footer .fr-locale__option.is-current { color: var(--fr-accent); }

.fr-content {
  flex: 1;
  min-width: 0;
  max-width: 1100px;
  padding: 36px 44px 60px;
}

.fr-h1 {
  font-family: 'Cinzel', serif;
  font-size: 28px;
  font-weight: 500;
  margin-bottom: 6px;
}
/* A page title that is data (a lodge's name): Cinzel is caps-only and must
   never carry user data (fonts/README.md), so the content serif takes it. */
.fr-h1--data { font-family: 'Playfair Display', serif; }
.fr-subtitle {
  font-size: var(--fr-text-md);
  color: var(--fr-text-muted);
  margin-bottom: 24px;
}

.fr-form-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.fr-form-row label { font-size: var(--fr-text-xs); letter-spacing: var(--fr-caps-tracking); color: var(--fr-text-muted); text-transform: uppercase; }

/* ───── Documents workspace (ADR-079): tree + permissions panel ──────────── */

.fr-content--wide { max-width: 1500px; }

.fr-threepane {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) 400px;
  gap: 28px;
  align-items: start;
}
@media (max-width: 1100px) { .fr-threepane { grid-template-columns: 1fr; } }

.fr-pane {
  background: var(--fr-surface);
  border: 1px solid var(--fr-border);
  border-radius: 12px;
  padding: 20px;
}

.fr-tree { list-style: none; margin: 0; padding: 0; font-size: var(--fr-text-md); }
.fr-tree ul { list-style: none; margin: 0 0 0 9px; padding-left: 14px; border-left: 1px solid var(--fr-border); }
.fr-tree__row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 6px;
}
.fr-tree__row:hover { background: var(--fr-surface-2); }
.fr-tree__row.is-selected { background: var(--fr-accent-dim); }
.fr-tree__row.is-selected .fr-tree__link { color: var(--fr-accent); }
.fr-tree__link { color: var(--fr-text); text-decoration: none; cursor: pointer; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fr-tree__link:hover { color: var(--fr-accent); }
.fr-tree__glyph { color: var(--fr-silver); font-size: var(--fr-text-xs); flex: none; display: inline-flex; }
.fr-tree__doc .fr-tree__link { color: var(--fr-text-muted); font-size: var(--fr-text-md); }
.fr-tree__docdelete, .fr-tree__docrename, .fr-tree__docmove {
  background: none; border: none; color: var(--fr-text-muted);
  font-size: var(--fr-text-md); cursor: pointer; padding: 0 4px; flex: none;
}
.fr-tree__docmove { display: inline-flex; align-items: center; font-size: var(--fr-text-sm); }
.fr-tree__docdelete:hover { color: var(--fr-danger); }
.fr-tree__docrename:hover, .fr-tree__docmove:hover { color: var(--fr-accent); }

/* Move dialog destination list (ADR-079 amendment 2026-11-10): the archive
   tree as radio rows, refused rows greyed with their reason. */
.fr-movepick {
  border: 1px solid var(--fr-border);
  border-radius: 8px;
  padding: 6px;
  margin: 8px 0 14px;
  max-height: 320px;
  overflow-y: auto;
  min-width: 0;
}
.fr-movepick__row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: var(--fr-text-md);
}
.fr-movepick__row:hover { background: var(--fr-surface-2); }
.fr-movepick__row:has(input:checked) { background: var(--fr-accent-dim); color: var(--fr-accent); }
.fr-movepick__row.is-off { cursor: default; color: var(--fr-text-faint); }
.fr-movepick__row.is-off:hover { background: none; }
.fr-movepick__row.is-heading { cursor: default; color: var(--fr-text-muted); font-size: var(--fr-text-sm); }
.fr-movepick__row.is-heading:hover { background: none; }
.fr-movepick__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fr-movepick__why { margin-left: auto; flex: none; font-size: var(--fr-text-sm); color: var(--fr-text-muted); }

/* Inline rename form swapped in place of a document row. */
.fr-tree__renameform { display: flex; align-items: center; gap: 6px; padding: 3px 8px; }
.fr-tree__renameform .fr-input { flex: 1; min-width: 0; padding: 4px 8px; font-size: var(--fr-text-md); }

.fr-chipset { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 18px; }
.fr-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: 15px;
  background: transparent;
  border: 1px solid var(--fr-border);
  color: var(--fr-text-muted);
  font-size: var(--fr-text-sm);
  letter-spacing: 0.05em;
  cursor: pointer;
  font-family: inherit;
}
.fr-chip:hover { border-color: var(--fr-border-hov); color: var(--fr-text); }
.fr-chip--on {
  background: var(--fr-accent-dim);
  border-color: var(--fr-border-hov);
  color: var(--fr-accent);
}
/* Chips that wrap a hidden radio/checkbox (the calendar editor, ADR-080)
   light up from the input's own checked state — no JS, and the visual state
   is correct the instant the officer clicks rather than after the round trip. */
.fr-chip:has(input:checked) {
  background: var(--fr-accent-dim);
  border-color: var(--fr-accent);
  color: var(--fr-accent);
}
.fr-chip--inherited { opacity: 0.55; cursor: not-allowed; }
.fr-chip--inherited:hover { border-color: var(--fr-border); color: var(--fr-text-muted); }

/* Collapsible tree nodes (details/summary; caret rotates when open). */
.fr-tree details > summary { list-style: none; cursor: pointer; }
.fr-tree details > summary::-webkit-details-marker { display: none; }
.fr-tree__caret {
  color: var(--fr-silver);
  font-size: 10px;
  flex: none;
  width: 12px;
  display: inline-flex;
  justify-content: center;
  transition: transform 0.15s ease;
}
.fr-tree details[open] > summary .fr-tree__caret { transform: rotate(90deg); }
.fr-tree__caret--leaf { visibility: hidden; }
.fr-tree__count {
  flex: none;
  font-size: var(--fr-text-xs);
  color: var(--fr-text-muted);
  background: var(--fr-surface-2);
  border: 1px solid var(--fr-border);
  border-radius: 8px;
  padding: 0 6px;
}

/* Flash region for failed htmx mutations (HX-Retarget target). */
.fr-flash {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  margin: 0 0 18px;
  border: 1px solid var(--fr-border);
  border-radius: 8px;
  background: var(--fr-surface);
}
.fr-flash--error { border-left: 3px solid var(--fr-danger); }
/* A write that went through but left the operator somewhere they should know
   about — e.g. a lodge whose console nobody can now open (ADR-073). */
.fr-flash--warn { border-left: 3px solid var(--fr-accent); }
.fr-flash__body { display: flex; flex-direction: column; gap: 2px; font-size: var(--fr-text-md); }
.fr-flash--error .fr-flash__body strong { color: var(--fr-danger); }
.fr-flash__close {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--fr-text-muted);
  font-size: var(--fr-text-md);
  cursor: pointer;
  padding: 0 4px;
}
.fr-flash__close:hover { color: var(--fr-text); }

/* In-flight feedback: htmx toggles .htmx-request on the requesting element
   (or the hx-indicator target); spinners inside it fade in. */
.fr-spinner {
  width: 14px;
  height: 14px;
  flex: none;
  display: inline-block;
  vertical-align: middle;
  border: 2px solid var(--fr-border);
  border-top-color: var(--fr-accent);
  border-radius: 50%;
  animation: fr-spin 0.7s linear infinite;
}
@keyframes fr-spin { to { transform: rotate(360deg); } }
.htmx-indicator { opacity: 0; transition: opacity 150ms ease-in; }
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator { opacity: 1; }
.fr-btn-secondary:disabled, .fr-btn-danger:disabled { opacity: 0.55; cursor: wait; }

/* Effective-access summary ("who can see this folder right now"). */
.fr-effective {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  margin: 8px 0 18px;
  font-size: var(--fr-text-sm);
  border: 1px solid var(--fr-border);
  border-radius: 8px;
  background: var(--fr-surface-2);
}

.fr-checkrow {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--fr-border);
  border-radius: 6px;
  margin: 6px 0;
  cursor: pointer;
  font-size: var(--fr-text-md);
}
.fr-checkrow:hover { border-color: var(--fr-border-hov); }
.fr-checkrow__meta { color: var(--fr-text-muted); font-size: var(--fr-text-sm); margin-left: auto; }

/* ───── Section-based edit pages (member profile) ─────────────────────────── */

/* Vertical rhythm for stacked section cards; replaces per-card margins. */
.fr-stack { display: flex; flex-direction: column; gap: 24px; }

/* Responsive field grid. Variants set the wide-viewport template; below
   860px everything collapses to two columns, below 560px to one. */
.fr-form-grid { display: grid; gap: 12px; align-items: end; grid-template-columns: repeat(3, 1fr); }
.fr-form-grid--2       { grid-template-columns: repeat(2, 1fr); }
.fr-form-grid--4       { grid-template-columns: repeat(4, 1fr); }
.fr-form-grid--address { grid-template-columns: 2fr 1fr 1fr; }
.fr-form-grid--status  { grid-template-columns: 1fr 1fr 2fr; }
.fr-form-grid--identity { grid-template-columns: 1fr 3fr 2fr; }
.fr-form-grid--seat    { grid-template-columns: 2fr 1fr 1fr 1fr; }
.fr-form-grid .fr-span-2 { grid-column: span 2; }
.fr-form-grid .fr-form-row { margin-bottom: 0; }
.fr-form-grid__actions {
  grid-column: 1 / -1;
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 10px;
}
@media (max-width: 860px) {
  .fr-form-grid, .fr-form-grid--2, .fr-form-grid--4,
  .fr-form-grid--address, .fr-form-grid--status,
  .fr-form-grid--identity, .fr-form-grid--seat { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .fr-form-grid, .fr-form-grid--2, .fr-form-grid--4,
  .fr-form-grid--address, .fr-form-grid--status,
  .fr-form-grid--identity, .fr-form-grid--seat { grid-template-columns: 1fr; }
  .fr-form-grid .fr-span-2 { grid-column: auto; }
}

.fr-hint { color: var(--fr-text-muted); font-size: var(--fr-text-sm); margin: 8px 0 0; }

/* One form, one save: field groups inside a single card (the lodge page).
   A fieldset/legend pair rather than a card per group, so the grouping is
   announced to assistive tech and there is exactly one submit to find. */
.fr-fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.fr-fieldset > legend { padding: 0; margin-bottom: 10px; }
.fr-fieldset + .fr-fieldset {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--fr-border);
}
.fr-fieldset textarea.fr-input { resize: vertical; min-height: 120px; }
/* The single save stays reachable however far down the form the officer is. */
.fr-form-footer {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  margin: 20px -20px -20px;
  padding: 12px 20px;
  background: var(--fr-surface);
  border-top: 1px solid var(--fr-border);
  border-radius: 0 0 12px 12px;
}
.fr-error-text { color: var(--fr-danger); font-size: var(--fr-text-sm); margin: 8px 0 0; }

/* Transient post-save confirmation; rendered by mutation fragments and
   faded out by CSS alone (no JS). role="status" announces it to AT. */
.fr-saved {
  color: var(--fr-online);
  font-size: var(--fr-text-sm);
  letter-spacing: 0.04em;
  text-transform: none;
  animation: fr-saved-fade 3.5s ease forwards;
}
@keyframes fr-saved-fade { 0%, 70% { opacity: 1; } 100% { opacity: 0; } }

/* Required-field marker inside .fr-form-row labels. */
.fr-req { color: var(--fr-accent); }

/* Compact button for table rows (matches fr-btn-danger's footprint). */
.fr-btn-sm { padding: 8px 14px; font-size: var(--fr-text-sm); border-radius: 8px; }

.fr-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--fr-accent);
  background: var(--fr-surface-2);
  flex: none;
}
.fr-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fr-avatar--empty {
  border: 2px dashed var(--fr-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fr-text-muted);
  font-family: 'Playfair Display', serif;
}
.fr-avatar--sm { width: 48px; height: 48px; }
.fr-avatar--xs { width: 32px; height: 32px; border-width: 1px; }
/* A placeholder (on top of --empty) holding the member's initials. */
.fr-avatar--initials {
  border: none;
  background: var(--fr-accent-dim);
  color: var(--fr-accent);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
}
/* A member's name beside his avatar, as every roster tab lists it. */
.fr-roster-name { display: flex; align-items: center; gap: 10px; }
/* A lodge logo (ADR-085) is an emblem, not a face: drawn whole inside a
   rounded square rather than cropped to a circle — the same shape the app's
   home header gives it. */
.fr-avatar--logo { border-radius: 12px; }
.fr-avatar--logo img { object-fit: contain; }

.fr-input--file { padding: 10px 12px; }
.fr-input--file::file-selector-button {
  background: transparent;
  border: 1px solid var(--fr-border);
  border-radius: 8px;
  color: var(--fr-text-muted);
  font-family: inherit;
  font-size: var(--fr-text-sm);
  padding: 6px 12px;
  margin-right: 12px;
  cursor: pointer;
}
.fr-input--file::file-selector-button:hover { border-color: var(--fr-border-hov); color: var(--fr-text); }

/* Page header for the profile edit page: avatar + identity + state pills. */
.fr-profile-header { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.fr-profile-header__id { flex: 1; min-width: 0; }
.fr-profile-header__id .fr-h1 { margin-bottom: 2px; }
.fr-profile-header__meta {
  font-family: 'Playfair Display', serif;
  color: var(--fr-text-muted);
  font-size: 15px;
}
.fr-profile-header__pills { display: flex; gap: 8px; flex-wrap: wrap; }

/* In-page anchor nav (jump links to section cards). */
.fr-anchor-nav { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 20px; }
.fr-anchor-nav__link {
  padding: 5px 14px;
  border-radius: 15px;
  border: 1px solid var(--fr-border);
  color: var(--fr-text-muted);
  font-size: var(--fr-text-sm);
  letter-spacing: 0.05em;
}
.fr-anchor-nav__link:hover {
  border-color: var(--fr-border-hov);
  color: var(--fr-accent);
  text-decoration: none;
}
/* Hairline between groups of links in the anchor nav. */
.fr-anchor-nav__sep { width: 1px; align-self: stretch; margin: 3px 4px; background: var(--fr-border); }
.fr-content section[id] { scroll-margin-top: 24px; }

/* Group divider between runs of section cards: tells apart the record edited
   in place, the state as it stands today, and the history of what already
   happened. Deliberately quiet — an overline on a rule — so the card titles
   under it stay the headings the eye lands on. */
.fr-group-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; margin: 16px 0 -8px; padding-top: 14px; border-top: 1px solid var(--fr-border); }
.fr-stack > .fr-group-head:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.fr-group-head__title {
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: var(--fr-text-xs);
  font-weight: 600;
  letter-spacing: var(--fr-caps-tracking);
  text-transform: uppercase;
  color: var(--fr-silver);
}
.fr-group-head__hint { font-size: var(--fr-text-sm); color: var(--fr-text-muted); }

/* A section card's own title: the highlighted heading of the card. */
.fr-card__title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  letter-spacing: var(--fr-caps-tracking);
  color: var(--fr-accent);
  margin-bottom: 14px;
}

/* The one card that holds a present-tense state rather than a record. */
.fr-card--now { border-color: var(--fr-border-hov); box-shadow: var(--fr-accent-glow); }
.fr-status-now { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 14px; margin: -4px 0 2px; }
.fr-status-now__value { font-family: 'Playfair Display', serif; font-size: 26px; font-weight: 500; color: var(--fr-text); }
.fr-status-now__meta { font-size: var(--fr-text-md); color: var(--fr-text-muted); }
/* "Final status" / "managed by another officer" sit under the state, not
   ahead of a form — so not the card-intro margin .fr-card > .fr-hint gives. */
.fr-card.fr-card--now > .fr-hint { margin: 10px 0 0; }
/* The action that writes a new state: a second part of the same card, set off
   by a rule rather than a box — a card inside a card reads as clutter. */
.fr-status-change { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--fr-border); }
.fr-status-change__title {
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: var(--fr-text-sm);
  font-weight: 600;
  letter-spacing: var(--fr-caps-tracking);
  text-transform: uppercase;
  color: var(--fr-text);
}
.fr-status-change > .fr-hint { margin: 4px 0 14px; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

/* Server-rendered confirmation modal (status transition, …). */
.fr-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}
/* A refused confirm leaves the modal up and retargets its error to the page's
   #flash — in the flow, under the overlay. It sat there unseen and Apply looked
   like it did nothing (the status risveglio bug). While a server-rendered modal
   is open, lift the flash above it; the page's flow is untouched otherwise.
   (A native <dialog> is in the top layer, which no z-index reaches — those
   close on every answer instead.) */
body:has(.fr-modal-overlay) #flash:not(:empty) {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  width: min(520px, calc(100% - 32px));
  z-index: 101;
}
body:has(.fr-modal-overlay) #flash .fr-flash { margin: 0; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35); }
.fr-modal { max-width: 520px; width: 100%; background: var(--fr-surface); }
.fr-modal__warn {
  border: 1px solid var(--fr-accent);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 18px;
  font-size: var(--fr-text-md);
}

/* Client-opened dialog: a native <dialog> raised by an invoker button
   (commandfor + command="show-modal"), so no script opens it and the browser
   owns the backdrop, Esc, the focus trap and focus return. The same card as
   .fr-modal, for forms a click asks for rather than ones the server raises. */
.fr-dialog {
  width: calc(100% - 32px);
  max-width: 520px;
  margin: auto;
  padding: 24px;
  background: var(--fr-surface);
  color: var(--fr-text);
  border: 1px solid var(--fr-border);
  border-radius: 12px;
}
.fr-dialog::backdrop { background: rgba(0, 0, 0, 0.45); }
.fr-dialog__actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }

/* ───── Calendar console (ADR-080) ────────────────────────────────────────────
   Month grid + editor. No colour literals here: an INTERNAL event bar takes
   the silver secondary accent and a PUBLIC one takes gold, which is the
   established selected/unselected pairing of ADR-059. (The mockup drew the
   lodge bar navy; there is no navy token, and minting one is a tokens/ change
   under ADR-062 rather than a stylesheet edit.) */
.fr-cal-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.fr-cal-toolbar__month {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
  min-width: 190px;
}
.fr-cal-toolbar__spacer { flex: 1; }

.fr-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  background: var(--fr-border);
  border: 1px solid var(--fr-border);
  border-radius: 10px;
  overflow: hidden;
}
.fr-cal-grid__head {
  background: var(--fr-surface-2);
  padding: 8px 10px;
  font-size: var(--fr-text-xs);
  letter-spacing: var(--fr-caps-tracking);
  text-transform: uppercase;
  color: var(--fr-text-muted);
}
.fr-cal-day {
  background: var(--fr-surface);
  min-height: 96px;
  padding: 6px 7px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
}
.fr-cal-day:hover { background: var(--fr-surface-2); }
.fr-cal-day--outside { opacity: 0.42; }
.fr-cal-day--today { outline: 1px solid var(--fr-accent); outline-offset: -1px; }
/* The day number doubles as the "new event on this date" control. */
.fr-cal-day__num {
  color: var(--fr-text-muted);
  background: none;
  border: none;
  padding: 0;
  align-self: flex-start;
  cursor: pointer;
  font: inherit;
  font-size: var(--fr-text-sm);
}
.fr-cal-day__num:hover { color: var(--fr-accent); }
.fr-cal-day--weekend .fr-cal-day__num { color: var(--fr-silver); }
.fr-cal-day--today .fr-cal-day__num { color: var(--fr-accent); }

.fr-cal-bar {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  border-left: 3px solid var(--fr-silver);
  background: var(--fr-surface-3);
  color: var(--fr-text);
  border-radius: 3px;
  padding: 3px 6px;
  font-size: var(--fr-text-xs);
  line-height: 1.3;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fr-cal-bar--public { border-left-color: var(--fr-accent); }
.fr-cal-bar--selected { box-shadow: inset 0 0 0 1px var(--fr-border-hov); }
.fr-cal-bar:hover { background: var(--fr-surface-2); }
/* DB-sourced string: content face, never the caps display face (ADR-061). */
.fr-cal-bar__title { font-family: 'Playfair Display', serif; }

/* The reader's own time beside an event's (ADR-080 §7). The browser fills it,
   and only when the two clocks differ — so it is empty for nearly every reader
   and must take no space at all in that state. */
.fr-viewer-time { color: var(--fr-text-muted); }
.fr-viewer-time:empty { display: none; }

.fr-cal-legend {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  font-size: var(--fr-text-sm);
  color: var(--fr-text-muted);
}
.fr-cal-legend__swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 6px;
  background: var(--fr-silver);
}
.fr-cal-legend__swatch--public { background: var(--fr-accent); }

/* "From <date and time> to <time>" on one row. The end is the narrower of the
   two because it carries a clock only; below the console's desktop width the
   pair stacks rather than shrinking both fields past their content. */
.fr-cal-when {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 12px;
  /* Top, not end: the end field carries a hint underneath, and bottom
     alignment pushed the start's label and field down beside it. */
  align-items: start;
}
@media (max-width: 720px) {
  .fr-cal-when { grid-template-columns: 1fr; }
}
/* The multi-day escape hatch. Quiet by design: it belongs to the row above and
   the ordinary event never needs it. */
.fr-cal-when__span {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -4px 0 16px;
  font-size: var(--fr-text-sm);
  color: var(--fr-text-muted);
  cursor: pointer;
}
.fr-cal-when__span input { accent-color: var(--fr-accent); cursor: pointer; }

/* A date beside a 24-hour clock. The clock is two plain selects rather than a
   native time field, whose 12/24-hour format follows the OS, not the page. */
.fr-datetime {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.fr-datetime > .fr-input { flex: 1 1 150px; min-width: 0; }
.fr-clock {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
}
.fr-clock__part {
  width: auto;
  padding-left: 10px;
  padding-right: 6px;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.fr-clock__sep { color: var(--fr-text-muted); font-weight: 700; }

.fr-cal-field { margin-bottom: 14px; }
.fr-cal-field > label,
.fr-cal-field__label {
  display: block;
  font-size: var(--fr-text-xs);
  letter-spacing: var(--fr-caps-tracking);
  text-transform: uppercase;
  color: var(--fr-text-muted);
  margin-bottom: 6px;
}
/* The editor: the form on the left, closed by its one sticky Save; on an
   existing event, an aside on the right whose controls act on the click
   (attachments, attendance, delete). The Save ends the form instead of sitting
   between it and those controls. A new event has no aside, so its form keeps
   a readable measure instead of stretching across the wide console. */
.fr-cal-editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 28px;
  align-items: start;
}
.fr-cal-editor--new { grid-template-columns: minmax(0, 760px); }
.fr-cal-editor__footer {
  position: sticky;
  bottom: 0;
  z-index: 1;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
  padding: 12px 0;
  background: var(--fr-surface);
  border-top: 1px solid var(--fr-border);
}
.fr-cal-editor__aside {
  border-left: 1px solid var(--fr-border);
  padding-left: 24px;
}
.fr-cal-editor__aside > section + section {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--fr-border);
}
@media (max-width: 1100px) {
  .fr-cal-editor { grid-template-columns: minmax(0, 1fr); }
  .fr-cal-editor__aside {
    border-left: 0;
    padding-left: 0;
    border-top: 1px solid var(--fr-border);
    padding-top: 16px;
  }
}
.fr-cal-attachment {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--fr-border);
  border-radius: 8px;
  margin-bottom: 8px;
  font-size: var(--fr-text-md);
}
.fr-cal-attachment__name { flex: 1; font-family: 'Playfair Display', serif; }

/* ───── Attendance (ADR-080) ─────────────────────────────────────────────────
   Tally pills are the summary, the roster below is the detail. The pills carry
   the tone of their answer — four identical gold chips made the officer read
   four numbers to learn one thing. The tints are mixed from --fr-online and
   --fr-danger, so they follow the tokens. */

.fr-pill b { font-weight: 600; font-size: var(--fr-text-sm); letter-spacing: 0; }
.fr-pill--yes {
  color: var(--fr-online);
  background: color-mix(in srgb, var(--fr-online) 10%, transparent);
  border-color: color-mix(in srgb, var(--fr-online) 30%, transparent);
}
.fr-pill--no {
  color: var(--fr-danger);
  background: color-mix(in srgb, var(--fr-danger) 10%, transparent);
  border-color: color-mix(in srgb, var(--fr-danger) 30%, transparent);
}
.fr-pill--maybe {
  color: var(--fr-silver);
  background: transparent;
  border-color: var(--fr-border);
}
.fr-pill--pending {
  color: var(--fr-text-muted);
  background: transparent;
  border-color: var(--fr-border);
}

/* Lazy disclosure: the caret states which way the next click goes, which the
   old one-way "Show the roster" button could not. */
.fr-disclosure > summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: var(--fr-text-sm);
  color: var(--fr-text-muted);
}
.fr-disclosure > summary::-webkit-details-marker { display: none; }
.fr-disclosure > summary:hover { color: var(--fr-text); }
.fr-disclosure__caret {
  color: var(--fr-silver);
  font-size: 10px;
  display: inline-flex;
  transition: transform 0.15s ease;
}
.fr-disclosure[open] > summary .fr-disclosure__caret { transform: rotate(90deg); }

.fr-roster { display: flex; flex-direction: column; gap: 16px; margin: 10px 0 4px; }
.fr-roster__group { border-left: 2px solid var(--fr-border); padding-left: 14px; }
.fr-roster__group--yes { border-left-color: color-mix(in srgb, var(--fr-online) 55%, transparent); }
.fr-roster__group--no { border-left-color: color-mix(in srgb, var(--fr-danger) 55%, transparent); }
.fr-roster__group--maybe { border-left-color: var(--fr-silver); }
.fr-roster__head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  font-size: var(--fr-text-xs);
  font-weight: 500;
  letter-spacing: var(--fr-caps-tracking);
  text-transform: uppercase;
  color: var(--fr-text-muted);
}
.fr-roster__count {
  font-size: var(--fr-text-xs);
  letter-spacing: 0;
  color: var(--fr-text-muted);
  background: var(--fr-surface-2);
  border: 1px solid var(--fr-border);
  border-radius: 8px;
  padding: 0 6px;
}
.fr-roster__list { list-style: none; margin: 0; padding: 0; }
.fr-roster__row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  padding: 3px 0;
  font-size: var(--fr-text-md);
}
/* Names are user data: the content serif, never Cinzel (fonts/README.md). */
.fr-roster__name { font-family: 'Playfair Display', serif; }
.fr-roster__note { font-size: var(--fr-text-sm); font-style: italic; color: var(--fr-text-muted); }

/* ───── Status badges ─────────────────────────────────────────────────────────
   A compact state marker inside a table cell — "active", "pending invite",
   "Keycloak only". Distinct from `.fr-pill`, which is a larger standalone
   marker for a page header; a badge has to sit inline in a dense row without
   changing its height. Neutral by default so the coloured variants carry the
   meaning on their own. */

.fr-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 11px;
  background: var(--fr-surface-2);
  border: 1px solid var(--fr-border);
  color: var(--fr-text-muted);
  font-size: var(--fr-text-xs);
  letter-spacing: 0.05em;
  white-space: nowrap;
}
/* A settled, healthy state (an active member). */
.fr-badge--ok {
  border-color: color-mix(in srgb, var(--fr-online) 34%, transparent);
  background: color-mix(in srgb, var(--fr-online) 10%, transparent);
  color: var(--fr-online);
}
/* An in-between state that a human still has to resolve — an unaccepted
   invite, or an ADR-072 realm role with no tenure behind it. Gold rather than
   red: it is not an error, it is unfinished. */
/* --accent: the same gold, for a state that is simply the good one rather than
   unfinished (an active member). */
.fr-badge--pending,
.fr-badge--accent {
  border-color: var(--fr-border-hov);
  background: var(--fr-accent-dim);
  color: var(--fr-accent);
}
/* A state that has already gone wrong and will not fix itself — an outbox row
   that exhausted its attempts. */
.fr-badge--danger {
  border-color: color-mix(in srgb, var(--fr-danger) 34%, transparent);
  background: color-mix(in srgb, var(--fr-danger) 10%, transparent);
  color: var(--fr-danger);
}

/* ───── Secondary text ────────────────────────────────────────────────────────
   Supporting prose that must not compete with the content it explains: page
   subtitles, empty-table rows, the note beside a control. Also the "vacant"
   marker in an office roster, where the absence of a holder is the value. */

.fr-muted { color: var(--fr-text-muted); }

/* ───── Just added ────────────────────────────────────────────────────────────
   The thing a create just made, in the list it landed in (a calendar bar, a
   document in the tree, an invite row), beside the success flash naming it.
   A gold outline that fades: the eye finds it, then the list reads as usual. */

.fr-just-added { animation: fr-just-added 2.4s ease-out; }
@keyframes fr-just-added {
  0%, 40% {
    box-shadow: inset 0 0 0 1px var(--fr-accent), 0 0 0 3px color-mix(in srgb, var(--fr-accent) 35%, transparent);
    /* The tint is what a table row shows: box-shadow on a <tr> is unreliable. */
    background-color: color-mix(in srgb, var(--fr-accent) 12%, transparent);
  }
}
@media (prefers-reduced-motion: reduce) {
  .fr-just-added { animation: none; box-shadow: inset 0 0 0 1px var(--fr-accent); }
}

/* ───── Success flash ─────────────────────────────────────────────────────────
   The third flash variant alongside `--error` and `--warn`: a write that went
   through cleanly. Green, so it reads as an outcome rather than as something
   demanding attention. */

/* Centred: an ok flash may carry a follow-up button (the calendar's Edit),
   and a one-line message beside it should not ride above its middle. */
.fr-flash--ok { border-left: 3px solid var(--fr-online); align-items: center; }
.fr-flash--ok .fr-flash__body strong { color: var(--fr-online); }

/* ───── Inline form ───────────────────────────────────────────────────────────
   A form that has to sit on one line inside a table cell or beside a sentence
   — an office hand-over picker, a reset button with its explanation. Without
   this a `<form>` is a block element and breaks the row it lives in. */

.fr-inline-form {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  vertical-align: middle;
}
.fr-inline-form + .fr-inline-form { margin-left: 8px; }

/* ───── Breadcrumb ────────────────────────────────────────────────────────────
   The admin console is the one surface with a genuinely nested subject —
   stack → organization → section — and the sidebar alone cannot show which
   org the current page belongs to. Separators are generated, so the markup
   carries only the links. */

.fr-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  font-size: var(--fr-text-sm);
  letter-spacing: 0.04em;
  color: var(--fr-text-muted);
}
.fr-breadcrumb a { color: var(--fr-text-muted); }
.fr-breadcrumb a:hover { color: var(--fr-accent); text-decoration: none; }
.fr-breadcrumb > * + *::before {
  content: '/';
  margin-right: 8px;
  color: var(--fr-text-faint);
}
/* The page's own subject — the end of the trail, not a link. */
.fr-breadcrumb__here { color: var(--fr-text); }

/* ───── Sidebar section divider ───────────────────────────────────────────────
   Groups the context-dependent links (this stack's, this org's) under a label,
   so an operator can tell at a glance which subject the lower half of the
   sidebar is currently scoped to. */

.fr-sidebar__section {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 18px 12px 6px;
  margin-top: 6px;
  border-top: 1px solid var(--fr-border);
  font-size: var(--fr-text-xs);
  font-weight: 500;
  letter-spacing: var(--fr-caps-tracking);
  text-transform: uppercase;
  color: var(--fr-text-muted);
}
/* The subject itself (a stack id, an org slug) — case-sensitive, so it opts
   out of the caps treatment the label carries. */
.fr-sidebar__section-id {
  font-size: var(--fr-text-xs);
  letter-spacing: 0;
  text-transform: none;
  color: var(--fr-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ───── Toolbar ───────────────────────────────────────────────────────────────
   A horizontal filter bar above a results table. `.fr-form-row` children keep
   their stacked label-over-field shape but share one baseline, and the submit
   button aligns with the fields rather than the labels. */

.fr-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  margin-bottom: 20px;
}
.fr-toolbar .fr-form-row { margin-bottom: 0; flex: 1 1 160px; min-width: 0; }
.fr-toolbar__actions { display: flex; gap: 8px; margin-left: auto; }

/* ───── Page header ───────────────────────────────────────────────────────────
   Title + subtitle on the left, page-level actions on the right. */

.fr-page-head {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.fr-page-head__id { flex: 1; min-width: 0; }
.fr-page-head__id .fr-subtitle { margin-bottom: 0; }
.fr-page-head__actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ───── Matrix table ──────────────────────────────────────────────────────────
   The console-access grid (ADR-073): offices down the side, features across
   the top. Cells are checkboxes and carry no text, so they centre and the
   whole cell is a click target for its box. */

.fr-matrix th { text-align: center; }
.fr-matrix th:first-child, .fr-matrix td:first-child { text-align: left; }
.fr-matrix td { text-align: center; }
.fr-matrix tbody td:not(:first-child) { padding: 0; }
.fr-matrix__cell {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 0;
  cursor: pointer;
}
.fr-matrix__cell:hover { background: var(--fr-accent-dim); }
.fr-matrix input[type=checkbox] {
  width: 16px;
  height: 16px;
  accent-color: var(--fr-accent);
  cursor: pointer;
}
/* Column header abbreviations (DOC, ROL, …) carry the full name in a title. */
.fr-matrix__code {
  font-size: var(--fr-text-xs);
  letter-spacing: var(--fr-caps-tracking);
  cursor: help;
  border-bottom: 1px dotted var(--fr-border-hov);
}

/* ───── Empty state ───────────────────────────────────────────────────────────
   Replaces a table that has no rows to show. A bare "No entries." line in a
   table body reads as a rendering failure; this reads as an answer. */

.fr-empty {
  padding: 36px 24px;
  text-align: center;
  color: var(--fr-text-muted);
  font-size: var(--fr-text-md);
  border: 1px dashed var(--fr-border);
  border-radius: 12px;
  background: var(--fr-surface);
}
.fr-empty strong { display: block; color: var(--fr-text); font-weight: 500; margin-bottom: 4px; }

/* Intro line between a card's section label and its form. `.fr-hint`'s default
   top margin is meant for the line *under* a field; leading a card it needs the
   space below it instead. */
.fr-card > .fr-hint:first-of-type { margin: 0 0 16px; }

/* Horizontal escape hatch for a table wider than its column — the console
   access matrix on a narrow viewport. Scrolls the table alone, so the page
   body never scrolls sideways. */
.fr-table-scroll { overflow-x: auto; }

/* ───── Standalone page ───────────────────────────────────────────────────────
   A page shown without the shell, because the shell's navigation would be a
   dead end: the operator is signed in but not authorized, so every link in a
   sidebar would answer 403. Centred, narrow, and offering only the one action
   that actually helps. */

.fr-standalone {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
  padding: 60px 24px;
  max-width: 560px;
  margin: 0 auto;
}
.fr-standalone .fr-subtitle { margin-bottom: 0; }

/* ───── Lodge statistics (ADR-086) ──────────────────────────────────────────
   Headline tiles, then two server-rendered SVG charts. The two series colours
   are scoped here rather than added to the generated :root block: they are a
   chart palette for one SSR page, not theme tokens the mobile app should grow.
   Both were validated against --fr-surface for lightness, chroma and
   colour-vision separation (ΔE ≥ 21 under every CVD simulation); the brand
   accent itself is too light for a mark on this surface, so the arrivals series
   is a step darker than it. Text never wears either colour. */

.fr-stats-period { margin-bottom: 20px; }
.fr-stats-period .fr-chipset { margin-top: 0; }
.fr-stats-period .fr-form-grid { max-width: 640px; }
.fr-stats-period .fr-form-row button { padding: 13px 20px; }
.fr-stats-section { margin-bottom: 20px; }
.fr-stats-lead { margin: 4px 0 12px; }
.fr-stats-pair {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (max-width: 900px) { .fr-stats-pair { grid-template-columns: minmax(0, 1fr); } }
.fr-stats-pair .fr-stats-section { margin-bottom: 20px; }
.fr-stats-table { margin-top: 12px; }
.fr-stats-table .fr-table-scroll { margin-top: 10px; }
.fr-stats-counts { margin: 8px 0 14px; }

.fr-kpis {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 20px;
}
@media (max-width: 1100px) { .fr-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px)  { .fr-kpis { grid-template-columns: minmax(0, 1fr); } }
.fr-kpi {
  background: var(--fr-surface);
  border: 1px solid var(--fr-border);
  border-radius: 12px;
  padding: 18px 20px;
}
.fr-kpi__label {
  font-size: var(--fr-text-xs);
  letter-spacing: var(--fr-caps-tracking);
  text-transform: uppercase;
  color: var(--fr-text-muted);
}
/* A count is data: Playfair, never Cinzel (fonts/README.md). */
.fr-kpi__value {
  font-family: 'Playfair Display', serif;
  font-size: 36px;
  line-height: 1.1;
  margin: 8px 0 6px;
  font-variant-numeric: lining-nums tabular-nums;
}
.fr-kpi__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  font-size: var(--fr-text-sm);
  color: var(--fr-text-muted);
}
.fr-kpi__delta { color: var(--fr-text); font-weight: 500; }
.fr-kpi__delta.is-up::before   { content: '▲ '; font-size: 9px; color: var(--fr-online); }
.fr-kpi__delta.is-down::before { content: '▼ '; font-size: 9px; color: var(--fr-danger); }

.fr-num { text-align: right !important; font-variant-numeric: tabular-nums; }
.fr-nowrap { white-space: nowrap; }

.fr-chart, .fr-legend {
  --fr-chart-in:  #a8892a;
  --fr-chart-out: #6f8fcf;
}
.fr-chart {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
.fr-chart__grid line { stroke: var(--fr-surface-3); stroke-width: 1; shape-rendering: crispEdges; }
.fr-chart__grid line.is-zero { stroke: var(--fr-border-hov); }
.fr-chart__axis text {
  fill: var(--fr-text-muted);
  font-size: var(--fr-text-xs);
  font-variant-numeric: tabular-nums;
}
.fr-chart__line {
  fill: none;
  stroke: var(--fr-chart-in);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.fr-chart__area { fill: var(--fr-chart-in); fill-opacity: 0.10; stroke: none; }
.fr-chart__dot { fill: var(--fr-chart-in); stroke: var(--fr-surface); stroke-width: 2; }
.fr-chart__bar--in  { fill: var(--fr-chart-in); }
.fr-chart__bar--out { fill: var(--fr-chart-out); }
/* Hit targets are the whole band, far larger than the mark; the band lights up
   and the native tooltip carries the values. */
.fr-chart__hit { fill: transparent; }
.fr-chart__point:hover .fr-chart__hit { fill: var(--fr-accent-dim); fill-opacity: 0.5; }
.fr-chart__point:hover .fr-chart__dot { r: 5; }

.fr-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin: 0 0 10px;
  font-size: var(--fr-text-sm);
  color: var(--fr-text);
}
.fr-legend__item { display: inline-flex; align-items: center; gap: 8px; }
.fr-legend__swatch { width: 10px; height: 10px; border-radius: 2px; }
.fr-legend__swatch--in  { background: var(--fr-chart-in); }
.fr-legend__swatch--out { background: var(--fr-chart-out); }
