/* =============================================================================
   ZEC Registry — design system  ·  "Quiet heritage" (Direction A)
   A parish-register aesthetic for creation care: parchment + fir + a gilt accent,
   Spectral for headings, IBM Plex Sans for UI, IBM Plex Mono for codes.
   Layered over Bootstrap 5.3 by overriding its CSS variables + a few components.
   ---------------------------------------------------------------------------
   Theme: light by default; follows the OS setting automatically (auto); a manual
   Auto/Light/Dark toggle sets html[data-theme] to override. See zec-theme.js.
============================================================================= */
@import url('/fonts/fonts.css');

/* ---------- tokens: LIGHT (base) ---------- */
:root {
    --parchment:#F4F0E6; --paper:#FBFAF5; --ink:#24312B; --muted:#6B7169;
    --fir:#1F4E3D; --fir-2:#2E6650; --moss:#6E8B5A; --gilt:#B8863B;
    --stone:#DED8CA; --stone-2:#E9E4D7; --field:#FFFFFF; --field-bd:#D3CCBB;
    --bar:#1F4E3D; --topbar-text:#EDE7D6; --topbar-mut:#C4CEC1;

    /* certificate status (map + legend). Awarded tiers kept for when data lands. */
    --st-none:#A9A597; --st-progress:#6E8B5A; --st-certified:#B8863B;
    --pin-gold:#D4A418; --pin-silver:#8D9BB0; --pin-bronze:#B07C4A;

    --shadow:0 1px 3px rgba(40,45,38,.08), 0 8px 24px rgba(40,45,38,.05);
    --sel-lockup:url('/img/sel-lockup-light.svg');
    color-scheme: light;

    /* map the palette onto Bootstrap so its components inherit the look */
    --bs-body-bg: var(--parchment);
    --bs-body-color: var(--ink);
    --bs-body-font-family: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --bs-emphasis-color: var(--ink);
    --bs-secondary-color: var(--muted);
    --bs-tertiary-bg: var(--stone-2);
    --bs-border-color: var(--stone);
    --bs-link-color: var(--fir);
    --bs-link-hover-color: var(--fir-2);
    /* Bootstrap 5.3 colours <a> from the -rgb pair, not from --bs-link-color, so
       without these every plain link in the registry stayed Bootstrap's #0d6efd. */
    --bs-link-color-rgb: 31,78,61;
    --bs-link-hover-color-rgb: 46,102,80;
    --bs-primary: var(--fir);
    --bs-primary-rgb: 31,78,61;
}

/* ---------- tokens: DARK — applied automatically when the OS is dark and the
   user has NOT chosen a theme, OR explicitly when data-theme="dark". ---------- */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) {
        --parchment:#141E19; --paper:#1A2620; --ink:#E7E1D2; --muted:#9AA79C;
        --fir:#4E8F73; --fir-2:#5FA184; --moss:#82A46B; --gilt:#CDA054;
        --stone:#2C3A33; --stone-2:#243029; --field:#182320; --field-bd:#33443B;
        --bar:#16342A; --topbar-text:#E7E1D2; --topbar-mut:#9FB0A4;
        --st-none:#8E958A; --st-progress:#82A46B; --st-certified:#CDA054;
        --shadow:0 1px 3px rgba(0,0,0,.4), 0 10px 30px rgba(0,0,0,.35);
        --sel-lockup:url('/img/sel-lockup-dark.svg');
        color-scheme: dark;
        --bs-tertiary-bg: var(--stone-2);
        --bs-link-color-rgb: 78,143,115;
        --bs-link-hover-color-rgb: 95,161,132;
    }
}
:root[data-theme="dark"] {
    --parchment:#141E19; --paper:#1A2620; --ink:#E7E1D2; --muted:#9AA79C;
    --fir:#4E8F73; --fir-2:#5FA184; --moss:#82A46B; --gilt:#CDA054;
    --stone:#2C3A33; --stone-2:#243029; --field:#182320; --field-bd:#33443B;
    --bar:#16342A; --topbar-text:#E7E1D2; --topbar-mut:#9FB0A4;
    --st-none:#8E958A; --st-progress:#82A46B; --st-certified:#CDA054;
    --shadow:0 1px 3px rgba(0,0,0,.4), 0 10px 30px rgba(0,0,0,.35);
    --sel-lockup:url('/img/sel-lockup-dark.svg');
    color-scheme: dark;
    --bs-tertiary-bg: var(--stone-2);
    --bs-link-color-rgb: 78,143,115;
    --bs-link-hover-color-rgb: 95,161,132;
}

/* ---------- base ---------- */
body {
    background: var(--parchment);
    color: var(--ink);
    font-family: var(--bs-body-font-family);
}
h1,h2,h3,h4,h5,h6,.h1,.h2,.h3,.h4,.h5,.h6 { font-family:"Spectral", Georgia, serif; }
code, .zec-mono { font-family:"IBM Plex Mono", ui-monospace, monospace; }
a { text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--gilt); outline-offset: 2px; }

/* ---------- app shell: top bar + left menu ----------
   Pages with navigation get <header class="zec-topbar"> + <aside class="zec-sidebar">
   as direct children of <body>; this grid places them without any per-page markup.
   The login pages have no sidebar, so :has() leaves them alone. */
:root { --topbar-h:56px; --sidebar-w:236px; }
html[data-sidebar="collapsed"] { --sidebar-w:64px; }

body:has(> .zec-sidebar) {
    display:grid; min-height:100vh;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
    grid-template-rows: auto 1fr auto;
}
body:has(> .zec-sidebar) > .zec-topbar,
body:has(> .zec-sidebar) > footer { grid-column:1 / -1; }
body:has(> .zec-sidebar) > main { grid-column:2; }

/* ---------- top bar: the branded row (#95) ----------
   Diocese · software name · ZEC · account, left to right, settled with Mark Gibson on
   4 Sep 2026. The markup and the reasoning are in fragments/layout.html.

   THE PLATE is what the whole row is built around, and it answers an operational
   requirement rather than a visual one. Mark: "I don't want, every time I add a new
   diocese, that you have to modify the logo by hand." A diocese may upload a square crest
   or a sideways banner, in any colours, over transparency or over white. So the plate
   fixes the HEIGHT and lets the WIDTH follow: every diocese's plate is the same height
   whatever it holds, and the mark inside is bounded on both axes and keeps its own aspect.
   A 1:1 crest fills 32x32; a 4:1 banner runs out to 128x32; a 6:1 one meets the width cap
   and simply sits shorter. Nothing is measured per diocese and no diocese is asked for a
   second file — which is the other half of what the plate buys, since a light ground makes
   any logo legible on the fir bar in both themes.

   Hence the literal #F4F0E6 rather than var(--parchment): that token inverts to near-black
   under a dark theme, and a plate that goes dark defeats its own purpose. The plate is a
   fixed light tone in every theme, deliberately. */
.zec-topbar {
    display:flex; align-items:center; gap:1rem;
    height:var(--topbar-h); padding:0 1.25rem;
    background: var(--bar);
    border-bottom: 2px solid var(--gilt);
    position:sticky; top:0; z-index:1040;
}
.zec-plate {
    display:inline-flex; align-items:center; justify-content:center; flex:0 0 auto;
    height:40px; padding:0 .45rem; box-sizing:border-box;
    background:#F4F0E6; border-radius:3px; box-shadow:0 1px 2px rgba(0,0,0,.25);
}
.zec-plate img { display:block; width:auto; height:auto; max-height:32px; max-width:150px; }

/* the diocese: mark then name, the name carrying the identification (so the mark's alt
   is empty), and truncating rather than wrapping when the bar runs out of room */
.zec-diocese { display:flex; align-items:center; gap:.6rem; min-width:0; }
.zec-diocese-name {
    font-family:"Spectral", Georgia, serif; font-size:1rem; color:var(--topbar-text);
    white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}

/* the software's own name, set apart by a hairline because it is neither party's brand */
.zec-app-name {
    font-family:"Spectral", Georgia, serif; font-style:italic; font-weight:400;
    font-size:1.05rem; color:var(--topbar-mut); white-space:nowrap; flex:0 0 auto;
    padding-left:1rem; border-left:1px solid rgba(237,231,214,.3);
}

/* ZEC's mark, in whichever style zec.brand.header-style selects. REDUCED reverses
   it straight onto the fir in one parchment tone; PLATE gives it the same plate the
   diocese gets, so the two read as a matched pair rather than as two brands arguing. */
.zec-mark { display:inline-flex; align-items:center; gap:.55rem; flex:0 0 auto; }
.zec-mark:hover { text-decoration:none; }
.zec-mark-emblem { display:block; height:30px; }
.zec-mark-word { display:block; height:15px; }
.zec-topbar[data-header-style="plate"] .zec-mark {
    height:40px; padding:0 .65rem; box-sizing:border-box;
    background:#F4F0E6; border-radius:3px; box-shadow:0 1px 2px rgba(0,0,0,.25);
}
.zec-topbar[data-header-style="plate"] .zec-mark-word { height:16px; }

.zec-topbar-right { display:flex; align-items:center; gap:1.25rem; margin-left:auto; }

/* hamburger — mobile only; the sidebar becomes a drawer below 992px */
.zec-menu-btn {
    display:none; background:transparent; border:0; color:var(--topbar-mut);
    padding:.25rem; margin-left:-.25rem; cursor:pointer; line-height:0;
}
.zec-menu-btn:hover { color:var(--topbar-text); }
.zec-menu-btn svg { width:22px; height:22px; }

/* ---------- user menu (avatar + dropdown) ---------- */
.zec-user { position:relative; }
.zec-avatar {
    width:34px; height:34px; border-radius:50%;
    display:inline-flex; align-items:center; justify-content:center;
    background:rgba(237,231,214,.08); color:var(--topbar-text);
    border:1px solid rgba(237,231,214,.42);
    font-size:.8rem; font-weight:600; letter-spacing:.04em; line-height:1; cursor:pointer;
}
.zec-avatar:hover, .zec-user.open .zec-avatar {
    background:rgba(237,231,214,.16); border-color:rgba(237,231,214,.6);
}
/* #64: a photo fills the circle; the ring stays, so it still reads as a control. */
.zec-avatar--photo { padding:0; overflow:hidden; }
.zec-avatar img { width:100%; height:100%; object-fit:cover; border-radius:50%; display:block; }
.zec-user-menu {
    position:absolute; right:0; top:calc(100% + 10px); min-width:230px; z-index:1050;
    background:var(--paper); color:var(--ink);
    border:1px solid var(--stone); border-radius:6px; box-shadow:var(--shadow);
    padding:.4rem;
}
.zec-user-menu-head { display:flex; flex-direction:column; gap:.1rem; padding:.5rem .6rem .6rem; border-bottom:1px solid var(--stone-2); }
.zec-user-menu-name { font-weight:600; font-size:.9rem; }
.zec-user-menu-mail { color:var(--muted); font-size:.78rem; }
.zec-user-menu-theme {
    display:flex; gap:.25rem; padding:.6rem .6rem; border-bottom:1px solid var(--stone-2);
}
.zec-user-menu-theme button {
    flex:1; font-size:.78rem; padding:.28rem 0; cursor:pointer;
    background:transparent; color:var(--muted);
    border:1px solid var(--field-bd); border-radius:20px; line-height:1.2;
}
.zec-user-menu-theme button:hover { color:var(--ink); border-color:var(--muted); }
.zec-user-menu-theme button.active {
    background:var(--fir); border-color:var(--fir); color:var(--topbar-text); font-weight:500;
}
.zec-user-menu-item {
    display:flex; align-items:center; gap:.55rem; width:100%;
    background:transparent; border:0; text-align:left; cursor:pointer;
    padding:.55rem .6rem; margin-top:.15rem; border-radius:4px;
    color:var(--ink); font-size:.9rem;
}
.zec-user-menu-item:hover { background:var(--stone-2); }
.zec-user-menu-item svg { width:16px; height:16px; color:var(--muted); }
/* The menu holds both buttons and links; the global a:hover underline would make
   only one of them move. */
a.zec-user-menu-item, a.zec-user-menu-item:hover { text-decoration:none; }

/* ---------- left menu ---------- */
/* The aside stretches to its grid track (ending above the full-width footer);
   the inner wrapper is what sticks and scrolls. */
.zec-sidebar {
    background:var(--paper); border-right:1px solid var(--stone);
}
.zec-sidebar-inner {
    position:sticky; top:var(--topbar-h);
    height:calc(100vh - var(--topbar-h)); max-height:100%;
    display:flex; flex-direction:column;
    overflow-y:auto; overflow-x:hidden;
}
.zec-view-block { padding:.9rem .9rem .7rem; border-bottom:1px solid var(--stone-2); }
.zec-view-label {
    display:block; font-size:.68rem; letter-spacing:.11em; text-transform:uppercase;
    color:var(--muted); margin-bottom:.35rem;
}
.zec-view-switcher { font-size:.85rem; }
.zec-nav { display:flex; flex-direction:column; padding:.6rem 0; }
.zec-nav-link {
    display:flex; align-items:center; gap:.65rem;
    padding:.55rem .95rem; color:var(--muted); font-size:.92rem; white-space:nowrap;
}
.zec-nav-link:hover { color:var(--ink); background:var(--stone-2); text-decoration:none; }
.zec-nav-link.active {
    color:var(--fir); background:var(--stone-2); font-weight:500;
    box-shadow: inset 3px 0 0 var(--gilt);
}
.zec-nav-link svg { width:18px; height:18px; flex:0 0 auto; }
.zec-collapse {
    display:flex; align-items:center; gap:.65rem; margin-top:auto;
    padding:.6rem .95rem; background:transparent; border:0; border-top:1px solid var(--stone-2);
    color:var(--muted); font-size:.85rem; cursor:pointer; white-space:nowrap; text-align:left;
}
.zec-collapse:hover { color:var(--ink); background:var(--stone-2); }
.zec-collapse svg { width:16px; height:16px; flex:0 0 auto; transition:transform .15s ease; }
html[data-sidebar="collapsed"] .zec-collapse svg { transform:rotate(180deg); }

/* collapsed rail (desktop): icons only */
@media (min-width: 992px) {
    html[data-sidebar="collapsed"] .zec-nav-link span,
    html[data-sidebar="collapsed"] .zec-collapse span,
    html[data-sidebar="collapsed"] .zec-view-block { display:none; }
    html[data-sidebar="collapsed"] .zec-nav-link,
    html[data-sidebar="collapsed"] .zec-collapse { justify-content:center; padding-left:0; padding-right:0; }
}

/* drawer (mobile): the sidebar slides over the content */
@media (max-width: 991.98px) {
    body:has(> .zec-sidebar) { grid-template-columns: minmax(0, 1fr); }
    body:has(> .zec-sidebar) > main,
    body:has(> .zec-sidebar) > footer { grid-column:1; }
    .zec-menu-btn { display:inline-flex; }
    .zec-sidebar {
        position:fixed; top:var(--topbar-h); left:0; bottom:0; height:auto;
        width:min(280px, 84vw); z-index:1045;
        transform:translateX(-100%); transition:transform .18s ease;
        box-shadow:none;
    }
    .zec-sidebar-inner { position:static; height:100%; max-height:none; }
    .zec-sidebar.open { transform:none; box-shadow:var(--shadow); }
    .zec-backdrop {
        position:fixed; inset:var(--topbar-h) 0 0 0; z-index:1044;
        background:rgba(20,30,25,.45);
    }
    /* the collapsed rail is a desktop idea only */
    html[data-sidebar="collapsed"] .zec-sidebar { width:min(280px, 84vw); }
}
/* the bar at phone width: both marks stay, because the branding is the point of the row —
   what goes is the type around them. The diocese keeps its name (truncated, never hidden:
   the mark's alt is empty and leans on that text), ZEC keeps its emblem without the
   wordmark, and the software's name waits for a wider screen. */
@media (max-width: 575.98px) {
    .zec-topbar { gap:.6rem; padding:0 .85rem; }
    .zec-app-name { display:none; }
    .zec-mark-word { display:none; }
    .zec-topbar[data-header-style="plate"] .zec-mark { padding:0 .4rem; }
    .zec-plate img { max-width:88px; }
    .zec-topbar-right { gap:.7rem; }
}

@media (prefers-reduced-motion: reduce) {
    .zec-sidebar { transition:none; }
}

/* ---------- masthead (dashboard) ---------- */
.zec-masthead {
    display:flex; justify-content:space-between; align-items:flex-start; gap:1.25rem;
    padding-bottom:1rem; border-bottom:1px solid var(--stone); margin-bottom:1.1rem;
}
.zec-eyebrow { font-size:.72rem; letter-spacing:.13em; text-transform:uppercase; color:var(--muted); margin:0 0 .25rem; }
.zec-masthead h1 { font-size:1.55rem; font-weight:600; margin:0; display:flex; align-items:center; gap:.6rem; }
.zec-masthead .zec-sub { margin:.3rem 0 0; color:var(--muted); font-size:.9rem; }
.zec-leaf { color:var(--moss); flex:0 0 auto; }

/* ---------- mission strip ---------- */
.zec-mission {
    background:var(--paper); border:1px solid var(--stone); border-radius:4px;
    padding:.9rem 1.1rem; margin-bottom:1.25rem;
}
.zec-mission-label { font-size:.72rem; letter-spacing:.11em; text-transform:uppercase; color:var(--muted); }
.zec-mission-row { display:flex; align-items:center; gap:1.1rem; margin-top:.55rem; flex-wrap:wrap; }
.zec-bar { flex:1; min-width:180px; height:12px; border-radius:6px; background:var(--stone-2); overflow:hidden; display:flex; }
.zec-bar-fill { background:var(--st-certified); }
.zec-mission-counts { display:flex; gap:1.15rem; font-size:.85rem; white-space:nowrap; flex-wrap:wrap; }
.zec-mission-counts b { font-family:"Spectral", serif; font-weight:600; font-size:1rem; }
.zec-mission-note { font-size:.78rem; color:var(--muted); margin-top:.45rem; }

/* energy page: the year's GHG headline inside the mission strip */
.zec-ghg-figure { font-family:"Spectral", serif; font-weight:600; font-size:1.45rem; line-height:1.1; white-space:nowrap; }
.zec-ghg-unit { font-size:.9rem; color:var(--muted); font-weight:400; }

/* status dots */
.zec-dot { width:9px; height:9px; border-radius:50%; display:inline-block; margin-right:.4rem; vertical-align:middle; }
.zec-dot--none { background:var(--st-none); }
.zec-dot--progress { background:var(--st-progress); }
.zec-dot--certified { background:var(--st-certified); }

/* ---------- cards / panels ---------- */
.card {
    --bs-card-bg: var(--paper);
    --bs-card-border-color: var(--stone);
    --bs-card-border-radius: 4px;
    --bs-card-color: var(--ink);
    box-shadow: none;
}
/* Fixed-height flex column so the map / list body fills the space below its
   header. The map's slim head and the list's taller search block differ in
   height, so pinning both bodies to 68vh made the list overrun the map; letting
   the body flex keeps both panels the same height, tops and bottoms aligned. */
.zec-panel { background:var(--paper); border:1px solid var(--stone); border-radius:4px; overflow:hidden; display:flex; flex-direction:column; height:68vh; min-height:480px; }
.zec-panel-head {
    display:flex; align-items:center; justify-content:space-between; gap:.75rem;
    padding:.65rem .9rem; border-bottom:1px solid var(--stone); font-size:.78rem; color:var(--muted);
}
.zec-legend { display:flex; gap:.9rem; align-items:center; flex-wrap:wrap; }
.zec-legend span { display:flex; align-items:center; }

/* ---------- map ---------- */
.zec-map {
    position:relative; height:68vh; min-height:480px; border-radius:0; overflow:hidden; background:var(--stone-2);
}
.zec-panel .zec-map { border-radius:0; height:auto; flex:1 1 auto; min-height:0; }
/* Congregation detail: the map matches the info card beside it — its column is
   d-flex, so the map stretches to the row height the card defines (no percentage
   heights, which some browsers won't resolve against a stretched column), with
   the card's corner radius. The doubled selector outranks .zec-map's 68vh/480px. */
.zec-map.zec-map--detail { height:auto; min-height:320px; flex:1 1 auto; border-radius:4px; }

/* Expanded map (#76, ZecExpandControl in zec-map.js): the map's frame, or the whole
   panel on the dashboard so the legend comes with it, pinned over the main area. It
   sits below the top bar (z-index 1040) and below the mobile drawer and its backdrop
   (1044-1045), so both stay usable; the menu has folded to its rail, and --sidebar-w
   follows whatever the menu is.
   The page behind stops scrolling, at the root only: hiding body's overflow as well
   makes body the top bar's scroll container, and the sticky bar scrolls away with the
   page. The gutter stays, so a classic scrollbar's width does not jump the layout
   sideways. On a page shorter than the window the footer would show under the menu
   rail, so it steps out. */
html.zec-map-expanded { overflow:hidden; scrollbar-gutter:stable; }
html.zec-map-expanded body > footer { visibility:hidden; }
.zec-map-frame--expanded,
.zec-map.zec-map-frame--expanded {
    position:fixed; top:var(--topbar-h); left:var(--sidebar-w); right:0; bottom:0; z-index:1030;
    width:auto; max-width:none; height:auto; min-height:0; margin:0; padding:0;
    border:0; border-radius:0; background:var(--paper);
}
/* Edge to edge, what sits under the map needs the panel head's inset to clear the
   frame: the dashboard's legend, the congregation page's address-lookup credit. */
.zec-map-frame--expanded .zec-map { border-radius:0; }
.zec-map-frame--expanded .zec-map-legend { padding:.5rem .9rem; }
.zec-map-frame--expanded > .zec-map-credit { margin:0 !important; padding:.4rem .9rem; }
@media (max-width: 991.98px) {
    .zec-map-frame--expanded,
    .zec-map.zec-map-frame--expanded { left:0; }
}

/* ---------- congregation list ---------- */
/* Match the map's height and scroll internally, so the list doesn't run the page down. */
.zec-list { border-radius:0; flex:1 1 auto; min-height:0; overflow-y:auto; }
.zec-list-item {
    --bs-list-group-bg: var(--paper);
    --bs-list-group-color: var(--ink);
    --bs-list-group-border-color: var(--stone-2);
    --bs-list-group-action-hover-bg: var(--stone-2);
    --bs-list-group-action-hover-color: var(--ink);
    display:flex; align-items:center; gap:.7rem; padding:.7rem .9rem;
}
.zec-list-item .zec-list-name { font-family:"Spectral", serif; font-weight:500; font-size:1rem; line-height:1.2; display:block; }
.zec-list-item .fw-semibold { font-family:"Spectral", serif; font-weight:500; }

/* ---------- detail: chips + rows ---------- */
.zec-chip {
    display:inline-flex; align-items:center; font-size:.78rem; padding:.22rem .7rem;
    border-radius:20px; background:var(--stone-2); color:var(--ink); border:1px solid var(--stone);
}
.zec-chip--org { background:transparent; border-color:var(--fir); color:var(--fir); }
/* Tame Bootstrap's loud contextual badges into the parchment palette */
.badge.text-bg-success { background:transparent !important; color:var(--fir) !important; border:1px solid var(--fir); font-weight:500; }
.badge.text-bg-secondary,
.badge.text-bg-light,
.badge.text-bg-info { background:var(--stone-2) !important; color:var(--ink) !important; border:1px solid var(--stone); font-weight:500; }
.badge.text-bg-warning { background:transparent !important; color:var(--gilt) !important; border:1px solid var(--gilt); font-weight:500; }
.badge { border-radius:20px; padding:.28rem .7rem; }

dl.row dt { color:var(--muted); font-weight:400; }
dl.row dd code, code { color:var(--fir-2); background:transparent; }

.zec-status-pill {
    display:inline-flex; align-items:center; font-size:.8rem; padding:.15rem .6rem;
    border-radius:20px; background:var(--stone-2); color:var(--muted);
}

/* ---------- buttons ---------- */
.btn-success, .btn-primary {
    --bs-btn-bg: var(--fir); --bs-btn-border-color: var(--fir); --bs-btn-color: var(--topbar-text);
    --bs-btn-hover-bg: var(--fir-2); --bs-btn-hover-border-color: var(--fir-2); --bs-btn-hover-color:#fff;
    --bs-btn-active-bg: var(--fir-2); --bs-btn-active-border-color: var(--fir-2);
    --bs-btn-disabled-bg: var(--fir); --bs-btn-disabled-border-color: var(--fir);
}
.btn-outline-secondary, .btn-outline-success, .btn-outline-primary {
    --bs-btn-color: var(--fir); --bs-btn-border-color: var(--field-bd);
    --bs-btn-hover-bg: var(--stone-2); --bs-btn-hover-border-color: var(--fir); --bs-btn-hover-color: var(--fir);
    --bs-btn-active-bg: var(--stone-2); --bs-btn-active-color: var(--fir);
}

/* The reference-data section tabs. Bootstrap writes its own #0d6efd literal into
   --bs-nav-pills-link-active-bg, so --bs-primary never reached them and the live
   tab sat in Bootstrap blue on the parchment. */
.nav-pills {
    --bs-nav-pills-link-active-bg: var(--fir);
    --bs-nav-pills-link-active-color: var(--topbar-text);
    --bs-nav-link-color: var(--fir);
    --bs-nav-link-hover-color: var(--fir-2);
}

/* ---------- forms ---------- */
.form-control, .form-select {
    --bs-body-bg: var(--field);
    background-color: var(--field);
    border-color: var(--field-bd);
    color: var(--ink);
    border-radius:3px;
}
.form-control:focus, .form-select:focus {
    background-color: var(--field); color: var(--ink);
    border-color: var(--gilt); box-shadow: 0 0 0 .2rem rgba(184,134,59,.18);
}
.form-control::placeholder { color: var(--muted); opacity:.7; }
/* A field a person may read but not change (the unique code outside the National
   view, #68/#109). Bootstrap's disabled grey is a fixed near-white, so under the
   dark theme the box lit up and its ink-coloured text went unreadable on it. */
.form-control:disabled, .form-select:disabled,
.form-control[readonly], .form-select[readonly] {
    background-color: var(--stone-2); color: var(--muted);
    border-color: var(--field-bd); opacity:1;
}
.form-label { font-size:.72rem; letter-spacing:.05em; text-transform:uppercase; color:var(--muted); margin-bottom:.3rem; }
.form-check-input:checked { background-color: var(--fir); border-color: var(--fir); }

/* ---------- alerts ---------- */
.alert-success { --bs-alert-bg: var(--stone-2); --bs-alert-border-color: var(--fir); --bs-alert-color: var(--fir); }
.alert-danger  { --bs-alert-color:#8a2e2e; }

/* The refusal state (#113): a submission that has been stopped, not merely warned
   about. The notice and the checkbox that unblocks it are separated by the whole form,
   so a shared brick rule and one brick text colour tie them into a single blocked
   action rather than two unrelated notices. Opt-in, so ordinary alerts are untouched.
   Inside an alert the note takes the alert's own colour rather than --brick: the alert
   keeps Bootstrap's pale ground in every theme (nothing sets data-bs-theme), and the
   fixed brick above reads at 6.3:1 on it where the dark --brick would read at 4.0:1. */
.zec-blocked { border-left:3px solid var(--brick); }
.zec-blocked-note { color: var(--brick); font-weight:600; }
.alert .zec-blocked-note { color: inherit; }

/* The caution state (#88): a choice that contradicts the reference data but is still
   allowed. Deliberately the refusal's quieter sibling — same left rule, gilt instead of
   brick, no bold — so the two are told apart at a glance: brick has stopped something,
   gilt has not. The rule carries the signal and the text stays in ink, because gilt on
   parchment is too pale to read a sentence in. */
.zec-warn {
    border-left:3px solid var(--gilt); padding:.3rem 0 .3rem .65rem;
    font-size:.85rem; color:var(--ink);
}

/* The rank state (#28): an account the viewer may read but not change, because it sits
   at or above their own tier. Neither refused nor cautioned, so neither brick nor gilt:
   the fir rule says "someone above handles this" and the sentence names who. */
.zec-tier-panel {
    border-left:3px solid var(--fir); padding:.35rem 0 .35rem .75rem;
    font-size:.9rem; color:var(--ink); max-width:46rem;
}
.zec-tier-note {
    font-size:.78rem; color:var(--muted); margin:.3rem 0 0 auto;
    max-width:17rem; text-align:right; line-height:1.35;
}

/* The clean-grid warning applies only while the choice contradicts the reference data,
   and the select itself says which choice that is. Driven from the select rather than
   from script so the warning appears in both directions with no JavaScript at all (#88).
   Where :has() is unsupported the whole rule is dropped and the warning simply always
   shows, which is the safe way for a warning to fail. */
[data-zec-clean-grid-form]:has([data-zec-clean-grid-select] option[value="ACHIEVED"]:checked)
    [data-zec-clean-grid-warning][data-zec-clean-grid-when="READY"],
[data-zec-clean-grid-form]:has([data-zec-clean-grid-select] option[value="READY"]:checked)
    [data-zec-clean-grid-warning][data-zec-clean-grid-when="ACHIEVED"] {
    display:none;
}

/* ---------- login ---------- */
.zec-login-card {
    background: var(--paper); border:1px solid var(--stone); border-top:3px solid var(--gilt);
    border-radius:5px; box-shadow: var(--shadow);
}
.zec-login-card h1 { display:flex; align-items:center; gap:.5rem; font-weight:600; }

/* The signed-out language picker: quiet, under the card, never competing with sign-in. */
.zec-language-picker { display:inline-flex; align-items:center; gap:.4rem; color:var(--muted); }
.zec-language-picker .form-select { width:auto; min-width:11rem; }

/* ---------- map pins (ready for status colouring once certificates exist) ---------- */
.zec-pin { width:14px; height:14px; border-radius:50%; border:2px solid var(--paper);
    box-shadow:0 0 0 1px rgba(0,0,0,.25); cursor:pointer; transition:transform .1s ease; }
.zec-pin:hover { transform:scale(1.35); }
.zec-pin--none { background:var(--st-none); }
.zec-pin--progress { background:var(--st-progress); }
.zec-pin--certified { background:var(--st-certified); }
.maplibregl-popup-content { font-family:inherit; border-radius:6px; padding:12px 14px; min-width:220px;
    background:var(--paper); color:var(--ink); }
.maplibregl-popup-content strong { color:var(--fir-2); }
/* The bubble's tail in the bubble's own colour, which is paper-dark under the dark theme. */
.maplibregl-popup-anchor-bottom .maplibregl-popup-tip,
.maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip,
.maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip { border-top-color:var(--paper); }
.maplibregl-popup-anchor-top .maplibregl-popup-tip,
.maplibregl-popup-anchor-top-left .maplibregl-popup-tip,
.maplibregl-popup-anchor-top-right .maplibregl-popup-tip { border-bottom-color:var(--paper); }
.maplibregl-popup-anchor-left .maplibregl-popup-tip { border-right-color:var(--paper); }
.maplibregl-popup-anchor-right .maplibregl-popup-tip { border-left-color:var(--paper); }
/* The map service refused or did not answer (zec-map.js), or the browser cannot run the
   map at all (.zec-map-fallback, plain HTML in the page that the map module removes):
   said in the map box, over whatever had been drawn, rather than left as a grey
   rectangle. Theme tokens, so it reads in light and dark alike. */
.zec-map-unavailable, .zec-map-fallback {
    position:absolute; inset:0; z-index:10; display:flex; align-items:center; justify-content:center;
    padding:1.5rem; text-align:center; background:var(--stone-2); color:var(--muted); font-size:.875rem;
    font-family:"IBM Plex Sans", system-ui, sans-serif;
}
.zec-map-fallback { margin:0; }
/* A passing notice (a 429: the service is busy): a strip across the top that clears
   itself, leaving the map usable underneath. */
.zec-map-passing {
    position:absolute; top:.5rem; left:50%; transform:translateX(-50%); z-index:10;
    max-width:calc(100% - 7rem); padding:.35rem .75rem; border-radius:4px;
    background:var(--paper); color:var(--ink); border:1px solid var(--stone);
    box-shadow:0 1px 4px rgba(40,45,38,.25); font-family:"IBM Plex Sans", system-ui, sans-serif;
    font-size:.8rem; text-align:center; pointer-events:none;
}

/* ---------- ZE certificate badge (#35): the gilt certified colour, both themes ---------- */
.zec-cert-badge { background:var(--st-certified); color:var(--paper); font-weight:500; }
/* The certificate number (V35) beside its badge: a register reference, so its digits
   line up from one card to the next. */
.zec-cert-number { font-variant-numeric:tabular-nums lining-nums; letter-spacing:.02em; color:var(--muted); }

/* Under each certificate recipient (#89, #114): what this contact is, and which
   language the certificate will reach them in. Quieter than the name it hangs from, and
   on its own line, so the list scans as names first and detail second. */
.zec-recipient-meta { display:block; font-size:.82rem; color:var(--muted); }

/* ---------- footer (SEL branding: logo, copyright, contact) ---------- */
.zec-footer {
    display:flex; align-items:center; justify-content:space-between; gap:1rem; flex-wrap:wrap;
    border-top:1px solid var(--stone); padding:.9rem 1.5rem;
    background:var(--paper); color:var(--muted); font-size:.82rem;
}
/* On plain pages (login) the footer is inline in the card, but if ever included
   standalone it should not cling to the content above. */
body:not(:has(> .zec-sidebar)) .zec-footer { margin-top:2rem; }
.zec-footer a { color:var(--muted); }
.zec-footer a:hover { color:var(--ink); }
/* The lockup is an SVG pair (dark text / light text) swapped with the theme,
   because currentColor cannot reach into an <img>/background document. */
.zec-sel-logo {
    display:block; width:148px; aspect-ratio:324/88; flex:0 0 auto;
    background:var(--sel-lockup) center/contain no-repeat;
}

/* ---------- user-form role editor (zec-user-form.js) ---------- */
.zec-add-role { display:none; }   /* revealed by JS when a spare row is hidden */
.zec-combobox { position:relative; }
.zec-combobox-list {
    position:absolute; z-index:1050; top:100%; left:0; right:0; margin:2px 0 0; padding:.25rem 0;
    list-style:none; max-height:14rem; overflow-y:auto; background:var(--paper); color:var(--ink);
    border:1px solid var(--field-bd); border-radius:5px; box-shadow:var(--shadow);
}
.zec-combobox-list li { padding:.3rem .75rem; cursor:pointer; }
.zec-combobox-list li.selected { font-weight:600; }
.zec-combobox-list li:hover, .zec-combobox-list li.active { background:var(--fir-2); color:var(--paper); }
.zec-combobox-empty { color:var(--muted); cursor:default; }
.zec-combobox-list li.zec-combobox-empty:hover { background:none; color:var(--muted); }

/* ---------- congregations table (#54) ----------
   ag-grid's Theming API exposes every theme parameter as an --ag-* custom
   property, so the Quiet-heritage palette maps straight on and follows the
   light/dark toggle with no per-theme grid config. */
.zec-grid { flex:1 1 auto; min-height:0; }
.zec-grid {
    --ag-background-color: var(--paper);
    --ag-foreground-color: var(--ink);
    --ag-border-color: var(--stone);
    --ag-header-background-color: var(--stone-2);
    --ag-header-text-color: var(--ink);
    --ag-odd-row-background-color: var(--paper);
    --ag-row-hover-color: var(--stone-2);
    --ag-accent-color: var(--fir);
    --ag-font-family: var(--bs-body-font-family);
    --ag-font-size: .82rem;
    --ag-wrapper-border-radius: 0;
    --ag-wrapper-border: none;
}
.zec-grid .ag-row { cursor:pointer; }
/* Eight controls do not fit a phone in one line; let them wrap rather than
   push the table off the side. */
.zec-grid-toolbar { flex-wrap:wrap; row-gap:.5rem; }
.zec-grid-toolbar #gridQuickFilter { max-width:260px; }
/* Multi-column sort (#78). ag-grid numbers each active header itself; the numeral
   is the one thing on the header that is not the column's own name, so it takes the
   gilt the rest of the interface reserves for "this one is live". */
.zec-grid .ag-sort-order {
    color:var(--gilt); font-weight:600; font-size:.68rem;
    font-variant-numeric:tabular-nums;
}
/* Quiet until it is needed, then a plain word rather than another outlined button:
   clearing a sort is an undo, not an action of its own. */
.zec-grid-clear-sort {
    background:none; border:0; padding:0; font-size:.78rem;
    color:var(--muted); text-decoration:underline; text-underline-offset:2px;
}
.zec-grid-clear-sort:hover { color:var(--ink); }
.zec-grid-clear-sort:not([hidden]) + .small { margin-left:.9rem !important; }
/* Once the row wraps, the two auto margins that centre the sort/count pair on a
   wide screen start pushing whatever lands on each line to its right-hand edge,
   and the exports scatter. Below the breakpoint pack them left instead, and give
   the filter its own full line. */
@media (max-width: 48rem) {
    .zec-grid-toolbar { justify-content:flex-start; }
    .zec-grid-toolbar #gridQuickFilter { max-width:none; flex:1 1 100%; }
    .zec-grid-toolbar .ms-auto { margin-left:0 !important; }
    .zec-grid-toolbar .me-3 { margin-right:.6rem !important; }
}

/* Print: the roll as a formatted document — page chrome off, print heading on,
   the grid in its full-height print layout (set by zec-congregations.js). */
.zec-print-head { display:none; }
@media print {
    .zec-topbar, .zec-sidebar, .zec-backdrop, .zec-footer,
    .zec-masthead, .zec-grid-toolbar { display:none !important; }
    body { display:block !important; background:#fff; }
    main { padding:0 !important; }
    .zec-print-head { display:block; margin-bottom:.75rem; }
    .zec-print-head h1 { font-size:1.3rem; margin:0; }
    .zec-print-head p { color:#555; margin:0; font-size:.8rem; }
    .zec-panel { height:auto; min-height:0; border:none; }
    /* The roll's panel is a block that lets the table run on: Firefox moves a clipped
       flex panel to a fresh page whole, leaving the first page with only the heading (#69). */
    .zec-printing .zec-panel { display:block; overflow:visible; }
    /* The page's own side padding goes on paper, or the panel would clip the last column. */
    .zec-printing main.container-fluid { padding-left:0 !important; padding-right:0 !important; }
}

/* The roll prints landscape (congregations.html sets the page). For the print the
   grid is laid out 940px wide (zec-congregations.js), at its real size: that fits a
   landscape Letter page at Firefox's default half-inch margins (960px across), the
   narrowest of A4 and Letter in Chrome and Firefox (#69). Nothing is scaled, so the fit
   does not rest on CSS zoom, which older Firefox ignores. The text is set smaller
   instead, in px. These rules are not under @media print on purpose: the class is only
   on while printing, and the grid measures its row heights on screen just before the
   dialog opens, so it has to measure the print text. Wrapped cells take a text line
   height, not the row's; pills wrap rather than run out of their column. */
.zec-printing .zec-grid {
    --ag-font-size:11px; --ag-cell-horizontal-padding:5px;
    --ag-header-column-resize-handle-display:none;
}
.zec-printing .zec-grid .ag-cell-wrap-text {
    line-height:1.3; padding-top:4px; padding-bottom:4px;
    word-break:normal; overflow-wrap:break-word;
}
/* Smaller header words, so "Buildings" and "Contacts" fit their narrow columns. */
.zec-printing .zec-grid .ag-header-cell-text { word-break:normal; font-size:9px; }
.zec-printing .zec-grid .ag-header-cell { padding-left:3px; padding-right:3px; }
.zec-printing .zec-grid .zec-mono { font-size:10px; }
/* Sort arrows stay (they say how the list is ordered); the filter buttons are no use on
   paper, and leaving them out gives the header words their room. */
.zec-printing .zec-grid .ag-header-cell-filter-button,
.zec-printing .zec-grid .ag-header-cell-menu-button { display:none; }
.zec-printing .zec-grid .zec-pill {
    font-size:8.5px; line-height:1.3; padding:1px 4px; margin:0 0 2px;
    white-space:normal; border-radius:6px;
}

/* ---------- missing-data pills (#56) ----------
   Tinted, bordered chips so they still read when a printer drops the fill.
   Terracotta = no contacts (the urgent one), slate blue = no buildings
   (Mark's suggestion), gilt = imported address needs checking (#65). */
:root {
    --pill-contacts-fg:#8C3B2E; --pill-contacts-bg:#F6E3DE;
    --pill-buildings-fg:#3E5A75; --pill-buildings-bg:#E1E8F0;
    --pill-address-fg:#7A5A1F; --pill-address-bg:#F3E9D2;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) {
        --pill-contacts-fg:#E5A196; --pill-contacts-bg:#3A2420;
        --pill-buildings-fg:#A9C1D9; --pill-buildings-bg:#20303F;
        --pill-address-fg:#DBBB77; --pill-address-bg:#352B17;
    }
}
:root[data-theme="dark"] {
    --pill-contacts-fg:#E5A196; --pill-contacts-bg:#3A2420;
    --pill-buildings-fg:#A9C1D9; --pill-buildings-bg:#20303F;
    --pill-address-fg:#DBBB77; --pill-address-bg:#352B17;
}
.zec-pill {
    display:inline-block; padding:.05rem .5rem; margin:0 .25rem 0 0;
    border-radius:99px; font-size:.68rem; font-weight:600; line-height:1.5;
    border:1px solid currentColor; white-space:nowrap;
}
.zec-pill--contacts { color:var(--pill-contacts-fg); background:var(--pill-contacts-bg); }
.zec-pill--buildings { color:var(--pill-buildings-fg); background:var(--pill-buildings-bg); }
.zec-pill--address { color:var(--pill-address-fg); background:var(--pill-address-bg); }
/* Energy (#57): one violet family in two weights, so the state reads before the
   words do. None is filled solid (the gap Mark most wants seen), out of date is the
   usual tint on a dashed edge (data that has lapsed). Up-to-date energy gets no pill:
   no pills means nothing to do. Violet sits clear of the terracotta and slate pills. */
:root {
    --pill-energy-fg:#5B3A73; --pill-energy-bg:#ECE4F2; --pill-energy-solid-fg:#FBFAF5;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) {
        --pill-energy-fg:#C7AEE0; --pill-energy-bg:#2E2438; --pill-energy-solid-fg:#1A2620;
    }
}
:root[data-theme="dark"] {
    --pill-energy-fg:#C7AEE0; --pill-energy-bg:#2E2438; --pill-energy-solid-fg:#1A2620;
}
.zec-pill--energy-none {
    color:var(--pill-energy-solid-fg); background:var(--pill-energy-fg); border-color:var(--pill-energy-fg);
}
.zec-pill--energy-stale {
    color:var(--pill-energy-fg); background:var(--pill-energy-bg); border-style:dashed;
}
@media print {
    /* Printers drop the fill: keep "none" legible as an outlined pill. */
    .zec-pill--energy-none { color:#5B3A73; background:#fff; border-width:2px; }
}

/* Documents to review (#47): the one pill where somebody is waiting on the team,
   not a gap in the record, so it leads the row in a family of its own. A deep sea
   teal, clear of the fir of the brand, the slate of "No buildings" and the violet of
   energy, with a small sheet glyph so it reads as a document before the words do. */
:root {
    --pill-documents-fg:#0F5F66; --pill-documents-bg:#DCEEEE;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) {
        --pill-documents-fg:#8ED0CF; --pill-documents-bg:#15363A;
    }
}
:root[data-theme="dark"] {
    --pill-documents-fg:#8ED0CF; --pill-documents-bg:#15363A;
}
.zec-pill--documents { color:var(--pill-documents-fg); background:var(--pill-documents-bg); }
.zec-pill-icon { display:inline-block; vertical-align:-.08em; margin-right:.3em; }
@media print {
    .zec-pill--documents { color:#0F5F66; background:#fff; border-width:1.5px; }
}

/* Dashboard list (#57): the pills sit above the name so they line up whatever
   its length, but come after it in the markup, so a screen reader hears the
   congregation before its gaps. Up-to-date energy is the muted "Energy to 2025"
   beside the area, not a pill. */
.zec-list-body { display:flex; flex-direction:column; min-width:0; }
.zec-list-pills { order:-1; display:flex; flex-wrap:wrap; gap:.2rem; margin-bottom:.3rem; }
.zec-list-pills .zec-pill { margin:0; }

.zec-pill-filter { display:flex; flex-direction:column; gap:.35rem; padding:.6rem .75rem; }
.zec-pill-filter-option { margin:0; display:flex; align-items:center; gap:.45rem; cursor:pointer; }
/* Select all · Unselect all, above the boxes. */
.zec-filter-bulk { display:flex; align-items:center; gap:.4rem; padding-bottom:.35rem; margin-bottom:.1rem; border-bottom:1px solid var(--bs-border-color); font-size:.875rem; }
.zec-filter-bulk .btn-link { font-size:inherit; }

/* Dashboard missing-data notice: present but polite — dismissible for a week
   or a month (the snooze proposal from the 31 Jul call). */
.zec-missing-notice {
    display:flex; align-items:center; gap:.9rem; flex-wrap:wrap;
    background:var(--paper); border:1px solid var(--gilt); border-left:4px solid var(--gilt);
    border-radius:4px; padding:.6rem .9rem; margin-bottom:1rem; font-size:.86rem;
}
.zec-missing-notice .zec-snooze { margin-left:auto; display:flex; gap:.75rem; align-items:center;
    font-size:.78rem; color:var(--muted); white-space:nowrap; }

/* Pin rim (#149): a thin edge round the coloured shape of the map pins (rimmedMarker
   in zec-map.js), so every stage colour shows on both map styles: the near-white
   stage 0 on the light map, the near-black stage 3 on the dark one. The opposite tone
   of the map: ink on light, parchment (the paper token) on dark. It follows the theme
   by the same rule as the map style, so pins change rim as the style switches. */
:root { --zec-pin-rim:rgba(36,49,43,.85); }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) { --zec-pin-rim:rgba(251,250,245,.9); }
}
:root[data-theme="dark"] { --zec-pin-rim:rgba(251,250,245,.9); }
.zec-pin-body { stroke:var(--zec-pin-rim); stroke-width:1.5; }

/* Stage dot (#13): each stage's light/dark colour pair travels inline as custom
   properties from the lookup row, so a colour tweak in the CRUD needs no CSS.
   The ring is the theme's ink or parchment, softer than the pins' rim at this size,
   but strong enough for stage 0 on light and stage 3 on dark (#149). */
.zec-stage-dot {
    width:11px; height:11px; border-radius:50%; display:inline-block;
    margin-right:.4rem; vertical-align:middle;
    background:var(--zec-stage-light);
    border:1px solid rgba(36,49,43,.45);
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) .zec-stage-dot { background:var(--zec-stage-dark); border-color:rgba(251,250,245,.6); }
}
:root[data-theme="dark"] .zec-stage-dot { background:var(--zec-stage-dark); border-color:rgba(251,250,245,.6); }

/* The Missing column wraps its pills (#47): line-height and a little padding so a
   second line of pills sits clear of the first and of the row edges. */
.zec-grid .zec-grid-missing { line-height:1.2; padding-top:.45rem; padding-bottom:.45rem; }
.zec-grid .zec-grid-missing .zec-pill { margin-top:.12rem; margin-bottom:.12rem; }
/* Keep the grid's action button clear of the row cursor and out of print. */
.zec-grid-actions { cursor:default; }
@media print { .zec-grid-actions { display:none; } }

/* Stage and priority set in the table (3 Nov call). The picker reads as the cell's own
   text until the pointer or focus reaches it, so the grid keeps its look; only a quiet
   chevron says the value can change. The cell does not open the congregation, so it
   keeps the plain cursor. */
.zec-grid .zec-grid-editcell { cursor:default; }
.zec-grid-edit { position:relative; display:flex; align-items:center; gap:.3rem; height:100%; }
.zec-grid-select {
    appearance:none; -webkit-appearance:none; flex:1 1 auto; min-width:0; max-width:100%;
    font:inherit; color:inherit; line-height:1.35; background:transparent;
    border:1px solid transparent; border-radius:3px; padding:.12rem 1.15rem .12rem .3rem;
    margin-left:-.3rem; text-overflow:ellipsis; white-space:nowrap; cursor:pointer;
}
.zec-grid-select-wrap { position:relative; display:flex; flex:1 1 auto; min-width:0; }
.zec-grid-select-wrap::after {
    content:""; position:absolute; right:.4rem; top:50%; width:.36rem; height:.36rem;
    margin-top:-.26rem; border-right:1.5px solid var(--muted); border-bottom:1.5px solid var(--muted);
    transform:rotate(45deg); pointer-events:none;
}
.zec-grid-select:hover { border-color:var(--field-bd); background:var(--field); }
.zec-grid-select:focus-visible { outline:2px solid var(--fir); outline-offset:1px; background:var(--field); }
.zec-grid-select option { color:var(--ink); background:var(--field); }
/* What happened to the change: a pulse while it saves, a gilt tick once stored (gilt is
   "this one is live" everywhere else), a brick mark when refused. */
.zec-grid-edit-mark:not([data-state]) { display:none; }
.zec-grid-edit-mark { flex:0 0 .9rem; text-align:center; font-weight:600; font-size:.8rem; line-height:1; }
.zec-grid-edit-mark[data-state="saving"]::before {
    content:""; display:inline-block; width:.45rem; height:.45rem; border-radius:50%;
    background:var(--muted); animation:zec-grid-pulse 1s ease-in-out infinite alternate;
}
.zec-grid-edit-mark[data-state="saved"] { color:var(--gilt); transition:opacity .6s ease; }
.zec-grid-edit-mark[data-state="saved"]::before { content:"\2713"; }
.zec-grid-edit-mark[data-state="saved"].is-fading { opacity:0; }
.zec-grid-edit-mark[data-state="failed"] { color:var(--brick); }
.zec-grid-edit-mark[data-state="failed"]::before { content:"!"; }
@keyframes zec-grid-pulse { from { opacity:.25; } to { opacity:1; } }
@media (prefers-reduced-motion: reduce) {
    .zec-grid-edit-mark[data-state="saving"]::before { animation:none; }
    .zec-grid-edit-mark[data-state="saved"] { transition:none; }
}
/* The line under the toolbar that says what the last change did. Empty, it takes no room. */
.zec-grid-edit-status {
    margin:0; padding:.35rem 1rem; font-size:.8rem; color:var(--muted);
    border-bottom:1px solid var(--stone); background:var(--paper);
}
.zec-grid-edit-status:empty { display:none; }
.zec-grid-edit-status[data-tone="failed"] { color:var(--brick); }
@media print { .zec-grid-edit-status { display:none !important; } }

/* Map legend (#13): the stage journey under the dashboard map. */
.zec-map-legend { display:flex; flex-wrap:wrap; gap:.3rem 1rem; padding:.45rem .2rem 0;
    font-size:.78rem; color:var(--muted); }
.zec-map-legend-item { white-space:nowrap; }

/* ---------- geocoding (#53) ----------
   Two confidence chips join the missing-data pill family: moss for a coordinate the
   registry will pin, gilt for one it will pin and call approximate. Anything worse
   borrows the terracotta chip, because "not reliable" is the same kind of news as
   "no contacts": something a person has to go and deal with. */
:root { --pill-located-fg:#3D5A33; --pill-located-bg:#E4EBDC; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) { --pill-located-fg:#A9C48F; --pill-located-bg:#1F2C1C; }
}
:root[data-theme="dark"] { --pill-located-fg:#A9C48F; --pill-located-bg:#1F2C1C; }
.zec-pill--located  { color:var(--pill-located-fg); background:var(--pill-located-bg); }
.zec-pill--approx   { color:var(--pill-address-fg); background:var(--pill-address-bg); }
.zec-pill--attention{ color:var(--pill-contacts-fg); background:var(--pill-contacts-bg); }

/* The proposal slip: the coordinate is the object of the page, so it is set in the
   register's mono face at reading size, on the paper panel the rest of the app uses. */
.zec-proposal {
    background:var(--paper); border:1px solid var(--stone); border-radius:4px;
    border-top:3px solid var(--gilt); padding:1rem 1.1rem;
}
.zec-coordinate {
    font-family:"IBM Plex Mono", ui-monospace, monospace;
    font-size:1.35rem; line-height:1.3; letter-spacing:-.01em; word-break:break-word;
}

/* Candidates: one choosable row each, the chosen one marked by a gilt edge rather
   than a fill, so the list stays quiet while the map does the explaining. */
.zec-candidates { display:flex; flex-direction:column; gap:.4rem; }
.zec-candidate {
    display:flex; align-items:flex-start; gap:.7rem; cursor:pointer;
    background:var(--paper); border:1px solid var(--stone); border-left:3px solid transparent;
    border-radius:4px; padding:.6rem .8rem;
}
.zec-candidate:hover { border-color:var(--field-bd); border-left-color:var(--stone); }
.zec-candidate:has(input:checked) { border-left-color:var(--gilt); }
.zec-candidate:has(input:focus-visible) { outline:2px solid var(--gilt); outline-offset:2px; }
.zec-candidate input { margin-top:.2rem; flex:0 0 auto; }
.zec-candidate-name { display:block; font-size:.92rem; }
.zec-candidate-meta { display:block; font-size:.76rem; color:var(--muted); }
.zec-candidate-meta > span + span::before { content:"·"; margin:0 .35rem; }

/* "None of these is right" (#153): the way out of the list, shaped like a row of it so
   it reads as one more answer, with a dashed edge because it is not a place. */
.zec-none-right {
    display:block; width:100%; text-align:left; cursor:pointer; color:var(--ink);
    background:transparent; border:1px dashed var(--field-bd); border-radius:4px;
    padding:.6rem .8rem .6rem calc(.8rem + 3px);
}
.zec-none-right:hover { border-color:var(--gilt); background:var(--paper); }
.zec-none-right:focus-visible { outline:2px solid var(--gilt); outline-offset:2px; }
.zec-none-right-name { display:block; font-size:.92rem; }
.zec-none-right-meta { display:block; font-size:.76rem; color:var(--muted); }

/* Attribution under any map showing geocoder-sourced coordinates. Obligatory, so it
   is legible; quiet, so it never competes with the map. */
.zec-map-credit { font-size:.72rem; color:var(--muted); }
.zec-map-credit a { color:var(--muted); text-decoration:underline; }

/* ---------- numbered candidates: the list and the map say the same thing ----------
   A coordinator looking at three identical dots cannot act on any of them, so every
   candidate carries a numeral in both places: a seal beside its row, the same numeral in
   its pin. The number is the join key, not decoration, which is the only reason to number
   a list that is not a sequence.

   These colours are deliberately NOT theme tokens. Each disc carries its own ground and
   its own pale rim, so it reads on the light map style and the dark one alike, and a
   token that inverted would only change the pin, never the tiles under it. Same reasoning
   as the topbar plate. The seals in the list use the same fixed values on purpose: a
   number is only a join if the colour matches too. */
:root {
    --pin-answer:#2E6650; --pin-runner:#B8863B; --pin-doubt:#8A8170;
    --pin-face:#FBFAF5; --pin-ink:#24312B; --pin-chosen:#B8863B;
}
.zec-pin, .zec-seal {
    display:inline-flex; align-items:center; justify-content:center;
    border-radius:50%; font-family:"IBM Plex Mono", ui-monospace, monospace;
    font-weight:600; font-variant-numeric:tabular-nums; line-height:1;
}
.zec-pin--answer, .zec-seal--answer { background:var(--pin-answer); color:var(--pin-face); }
.zec-pin--runner, .zec-seal--runner { background:var(--pin-runner); color:var(--pin-ink); }
/* Hollow: the registry will not pin this on its own. Present, numbered, choosable. */
.zec-pin--doubt, .zec-seal--doubt {
    background:var(--pin-face); color:var(--pin-doubt);
    border-style:dashed; border-color:var(--pin-doubt);
}

/* The map pin. A seal rather than a teardrop, anchored on its own centre, because the
   centre is what a drag places and a tail would lie about where the point is. */
.zec-pin {
    width:30px; height:30px; font-size:.84rem; cursor:pointer;
    border:2px solid var(--pin-face); box-shadow:0 1px 4px rgba(40,45,38,.4);
    transition:width .12s ease, height .12s ease, box-shadow .12s ease;
}
.zec-pin--doubt { border-width:2px; box-shadow:0 1px 4px rgba(40,45,38,.3); }
/* The location on file: a grey square, not a numbered seal, so it can never be read
   as a candidate. It does not respond to the pointer beyond its label. */
.zec-pin--current {
    width:22px; height:22px; border-radius:5px; cursor:default;
    background:var(--muted); color:var(--pin-face);
    border:2px solid var(--pin-face); box-shadow:0 1px 4px rgba(40,45,38,.35);
}
.zec-pin--current:hover { width:22px; height:22px; }
/* The chosen pin grows rather than scales: MapLibre owns this element's transform for
   positioning, and a CSS scale on top of it would move the pin off its coordinate. The
   centre anchor's own translate is a percentage, so it re-centres on the new size. */
.zec-pin--chosen {
    width:38px; height:38px; font-size:1rem;
    box-shadow:0 0 0 3px var(--pin-chosen), 0 1px 5px rgba(40,45,38,.45);
    cursor:grab;
}
.zec-pin--chosen:active { cursor:grabbing; }
.zec-pin:focus-visible { outline:2px solid var(--pin-chosen); outline-offset:3px; }

/* The hover label. An element of the pin rather than a map popup, so it takes the
   registry's own paper, rule and type instead of a white bubble with a tail. */
.zec-pin-tip {
    position:absolute; bottom:calc(100% + 9px); left:50%; transform:translateX(-50%);
    display:flex; flex-direction:column; gap:.1rem; text-align:left;
    width:max-content; max-width:15rem;
    background:var(--pin-face); color:var(--pin-ink);
    border:1px solid #D3CCBB; border-radius:3px; padding:.3rem .5rem;
    font-family:"IBM Plex Sans", system-ui, sans-serif; font-weight:400; font-size:.72rem;
    line-height:1.35; box-shadow:0 2px 8px rgba(40,45,38,.22);
    opacity:0; pointer-events:none; transition:opacity .12s ease; z-index:2;
}
.zec-pin:hover .zec-pin-tip, .zec-pin:focus-visible .zec-pin-tip { opacity:1; }
/* Flipped under the pin where there is no room above it. The map clips its own box, so
   a label that overflowed the top edge would simply lose its first line. */
.zec-pin--tipbelow .zec-pin-tip { bottom:auto; top:calc(100% + 9px); }
.zec-pin-tip-name { font-weight:600; }
.zec-pin-tip-note { color:#6B7169; }
@media (prefers-reduced-motion: reduce) {
    .zec-pin, .zec-pin-tip { transition:none; }
}

/* MapLibre draws its own controls on a white chrome in both themes, but the buttons
   inherit the page's text colour, so the registry's recentre crosshair was white on
   white under the dark theme and simply absent. Fixed ink, for the same reason the pins
   are fixed: the chrome under these never changes. Applies to every ZEC map. */
.maplibregl-ctrl-group button { color:var(--pin-ink); }

/* The seal in the list: the same numeral, the same colour, one size smaller. */
.zec-seal { width:24px; height:24px; font-size:.76rem; flex:0 0 auto; margin-top:.05rem; }
.zec-seal--doubt { border-width:2px; }

/* A doubtful answer says so once in its chip and once in a sentence, in the colour the
   registry already uses for "someone has to deal with this". */
.zec-candidate-warning {
    display:block; margin-top:.2rem; font-size:.78rem; color:var(--pill-contacts-fg);
}

/* What a drag did, in metres, with the way back. Shown only once a pin has been moved. */
.zec-moved {
    display:flex; align-items:center; gap:.75rem; flex-wrap:wrap; font-size:.86rem;
    background:var(--paper); border:1px solid var(--stone); border-left:3px solid var(--gilt);
    border-radius:4px; padding:.5rem .75rem;
}

/* ---------- place by hand (#153) ----------
   One pin and the two numbers it stands on. On a phone the order is the task's order:
   paste, look, check the numbers, save. On a wide screen the map takes the right-hand
   side for the whole height, and the paste box sits over the numbers and the save. */
.zec-place {
    display:grid; gap:1.25rem;
    grid-template-columns:minmax(0, 1fr);
    grid-template-areas:"paste" "map" "save";
}
@media (min-width: 992px) {
    .zec-place {
        grid-template-columns:minmax(0, 5fr) minmax(0, 7fr);
        grid-template-areas:"paste map" "save map";
        grid-template-rows:auto 1fr;
        column-gap:2rem;
    }
}
.zec-place-paste { grid-area:paste; }
.zec-place-map   { grid-area:map; display:flex; flex-direction:column; }
.zec-place-save  { grid-area:save; }
.zec-map.zec-map--place { height:52vh; min-height:300px; border-radius:4px; }
@media (min-width: 992px) {
    .zec-map.zec-map--place { height:auto; min-height:460px; flex:1 1 auto; }
}

/* The paste box is the paper slip with the gilt rule, like the lookup's proposal: the
   thing on this page that came from outside the registry. */
.zec-place-paste {
    background:var(--paper); border:1px solid var(--stone); border-top:3px solid var(--gilt);
    border-radius:4px; padding:1rem 1.1rem;
}
.zec-paste-row { display:flex; gap:.5rem; }
.zec-paste-row .form-control { min-width:0; flex:1 1 auto; }
.zec-paste-row .btn { flex:0 0 auto; }
/* What the paste was, read back in a line, then why, in a sentence. */
.zec-paste-what { font-weight:600; font-size:1rem; line-height:1.3; word-break:break-word; }

.zec-place-coords { display:grid; grid-template-columns:1fr 1fr; gap:.75rem; }
.zec-place-coords .form-control { font-size:1.05rem; }
.zec-place-save fieldset { margin:0; }

/* The pin itself: the fir seal of the search's own answer, at the chosen size, with
   the gilt halo that means "this one moves". A dot rather than a numeral, because here
   there is only one. Centre-anchored, as on the candidates page, so the dot is the
   point. */
.zec-pin--place {
    width:38px; height:38px; background:var(--pin-answer);
    box-shadow:0 0 0 3px var(--pin-chosen), 0 1px 5px rgba(40,45,38,.45);
    cursor:grab;
}
.zec-pin--place:active { cursor:grabbing; }
.zec-pin--place:hover { width:38px; height:38px; }
.zec-pin-dot { width:8px; height:8px; border-radius:50%; background:var(--pin-face); }
/* The label of a pasted point stays up, so what the pin is sits beside it. */
.zec-pin-tip--shown { opacity:1; }
.zec-pin-tip[hidden] { display:none; }

/* ---------- dialog (#52) ----------
   The project popup, used by zec-dialog.js for confirms and HTML-content
   popups. A native <dialog> styled as a small registry card — paper panel with
   the gilt top rule, like the login card — so it inherits the light/dark theme
   from the tokens. Fade only; Esc, focus trapping and the backdrop are native. */
dialog.zec-dialog {
    background:var(--paper); color:var(--ink);
    border:1px solid var(--stone); border-top:3px solid var(--gilt);
    border-radius:5px; box-shadow:var(--shadow);
    padding:0; width:min(var(--zec-dialog-w, 26rem), calc(100vw - 2rem));
    opacity:0;
    transition:opacity .15s ease, display .15s allow-discrete, overlay .15s allow-discrete;
}
dialog.zec-dialog[open] { opacity:1; }
dialog.zec-dialog::backdrop {
    background:rgba(20,30,25,.45); opacity:0;
    transition:opacity .15s ease, display .15s allow-discrete, overlay .15s allow-discrete;
}
dialog.zec-dialog[open]::backdrop { opacity:1; }
@starting-style {
    dialog.zec-dialog[open] { opacity:0; }
    dialog.zec-dialog[open]::backdrop { opacity:0; }
}
@media (prefers-reduced-motion: reduce) {
    dialog.zec-dialog, dialog.zec-dialog::backdrop { transition:none; }
}
/* The padding lives on the inner wrapper so a click on the dialog element
   itself can only mean the backdrop (zec-dialog.js closes on it). */
.zec-dialog-inner { padding:1.1rem 1.25rem 1.2rem; }
.zec-dialog-title { font-size:1.15rem; font-weight:600; margin:0 0 .5rem; }
.zec-dialog-body { font-size:.92rem; }
.zec-dialog-body p { margin:0 0 .5rem; }
.zec-dialog-body p:last-child { margin-bottom:0; }
/* Primary first, then Cancel — the same order as every Save/Cancel form. */
.zec-dialog-actions { display:flex; gap:.5rem; margin-top:1.1rem; }

/* Destructive confirm button: Bootstrap's red is too loud for the parchment
   palette, so tone it to the alert-danger brick (lighter, not darker, on hover
   in dark mode — the same direction fir/fir-2 take). */
:root { --brick:#8A2E2E; --brick-2:#762727; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) { --brick:#A5544A; --brick-2:#B4655B; }
}
:root[data-theme="dark"] { --brick:#A5544A; --brick-2:#B4655B; }
.btn-danger {
    --bs-btn-bg: var(--brick); --bs-btn-border-color: var(--brick);
    --bs-btn-color:#F6EFE9;
    --bs-btn-hover-bg: var(--brick-2); --bs-btn-hover-border-color: var(--brick-2);
    --bs-btn-hover-color:#fff;
    --bs-btn-active-bg: var(--brick-2); --bs-btn-active-border-color: var(--brick-2);
    --bs-btn-disabled-bg: var(--brick); --bs-btn-disabled-border-color: var(--brick);
}

/* =============================================================================
   Building screen — the heating panel
   The panel is a description of how a building is heated, not a control board:
   the status states itself and says why, every row is its own hit area, and the
   destructive actions live inside the dialog of the thing they destroy. One
   button and one link in the resting state, and no red at all.
============================================================================= */

/* A button that reads as a link — used where the action is quiet by design. */
.zec-linkish {
    background:none; border:0; padding:0; color:var(--fir);
    font:inherit; text-align:left;
}
.zec-linkish:hover { text-decoration:underline; }
.zec-linkish--danger { color:var(--brick); }

/* ---- a block that states something and opens its editor when clicked ---- */
.zec-openable {
    display:flex; flex-wrap:wrap; align-items:center; gap:.35rem .5rem;
    padding:.5rem .55rem; margin:0 -.55rem; border-radius:4px;
}
.zec-openable--clickable { cursor:pointer; }
.zec-openable--clickable:hover { background:var(--stone-2); }
.zec-openable-change {
    background:none; border:0; padding:0; margin-left:auto;
    font-size:.82rem; color:var(--fir); white-space:nowrap;
}
.zec-openable--clickable:hover .zec-openable-change { text-decoration:underline; }

/* ---- status ---- */
.zec-status-why { flex:1 1 100%; font-size:.85rem; color:var(--muted); }

/* ---- the heating note ---- */
.zec-note { margin-top:.9rem; border-top:1px solid var(--stone); padding-top:.6rem; }
.zec-note-body { flex:1 1 12rem; font-size:.85rem; color:var(--muted); }
.zec-note-label {
    display:block; font-size:.72rem; letter-spacing:.11em;
    text-transform:uppercase; color:var(--muted);
}
/* With no note yet there is nothing to push the offer away from, so it sits left. */
.zec-note--empty .zec-openable-change { margin-left:0; }

/* ---- comments (#143): free text with its line breaks kept, read as prose ---- */
.zec-comments { max-width:44rem; }
.zec-comments-view { align-items:flex-start; }
.zec-comments-text {
    flex:1 1 20rem; margin:0; white-space:pre-line; overflow-wrap:anywhere;
    line-height:1.55;
}
/* In a side card (the building page) the text sits at the size of the card's other lines. */
.card .zec-comments-text { font-size:.9rem; }
.zec-comments-none { flex:1 1 auto; margin:0; font-size:.875rem; color:var(--muted); }
.zec-comments--empty .zec-openable-change { margin-left:0; }
.zec-comments-view .zec-openable-change { padding-top:.15rem; }
/* The same text where a card lists the record: smaller, quieter, after its facts. */
.zec-comments-inline {
    margin:.5rem 0 0; padding-top:.45rem; border-top:1px solid var(--stone);
    font-size:.82rem; color:var(--muted); overflow-wrap:anywhere;
}
.zec-comments-inline-text { white-space:pre-line; }

.zec-status-manual { margin:.4rem 0 0 1.6rem; }
.zec-status-manual .form-text { margin-top:.35rem; }
.zec-dialog-lede { font-size:.88rem; color:var(--muted); margin:0 0 .9rem; }

/* ---- parts of the building, and the heating in each ---- */
.zec-heat-groups { margin-top:.35rem; }

.zec-heat-part {
    display:flex; align-items:flex-start; justify-content:space-between; gap:.5rem;
    width:calc(100% + 1.1rem); margin:.65rem -.55rem 0; padding:.5rem .55rem .15rem;
    background:none; border:0; border-top:1px solid var(--stone);
    border-radius:0; text-align:left; color:inherit;
}
button.zec-heat-part { cursor:pointer; }
button.zec-heat-part:hover { background:var(--stone-2); }
.zec-heat-part-name { font-weight:600; font-size:.88rem; }
.zec-heat-part-notes { display:block; font-size:.82rem; color:var(--muted); }
/* The building-at-large heading is a label, not a thing you can open. */
.zec-heat-part--fixed .zec-heat-part-name {
    font-weight:500; font-size:.72rem; letter-spacing:.11em;
    text-transform:uppercase; color:var(--muted);
}

.zec-heat-list { list-style:none; margin:.15rem 0 0; padding:0; }
.zec-heat-row {
    display:flex; align-items:baseline; gap:.55rem;
    padding:.4rem .55rem; margin:0 -.55rem; border-radius:4px;
    color:var(--ink); text-decoration:none;
}
.zec-heat-row:hover { background:var(--stone-2); color:var(--ink); text-decoration:none; }
.zec-heat-role {
    flex:0 0 4rem; font-size:.72rem; letter-spacing:.09em;
    text-transform:uppercase; color:var(--muted);
}
.zec-heat-what { flex:1; font-size:.9rem; }
.zec-heat-detail { display:block; font-size:.82rem; color:var(--muted); }
.zec-heat-none {
    font-size:.85rem; color:var(--muted); padding:.3rem 0 .3rem 4.55rem;
}
.zec-heat-none.ps-0 { padding-left:0; }

.zec-chev { width:14px; height:14px; flex:0 0 auto; color:var(--muted); align-self:center; }
.zec-heat-row:hover .zec-chev, button.zec-heat-part:hover .zec-chev { color:var(--fir); }

.zec-heat-foot {
    margin:1rem 0 0; padding-top:.75rem; border-top:1px solid var(--stone);
    font-size:.85rem; color:var(--muted);
}

/* Removal sits at the far end of the dialog's action row, away from Save. */
.zec-dialog-destroy { margin-left:auto; font-size:.85rem; color:var(--muted); align-self:center; }
.zec-dialog-destroy [data-zec-remove-confirm] { display:inline-flex; align-items:center; gap:.4rem; }

/* An offer where something is missing, in the same column as the rows it joins. */
.zec-heat-add { font-size:.85rem; padding:.3rem 0 .3rem 4.55rem; }
/* With no rows above it there is no column to line up with. */
.zec-heat-add--alone { padding-left:0; }
.zec-heat-add a { color:var(--fir); }
/* The imported-fuel hint renders empty unless there is one to give. */
.form-text:empty { display:none; }

/* ---- the diocese logo dropzone (#23) ---- */
.zec-dropzone {
    border: 1px dashed var(--bs-border-color, currentColor);
    border-radius: .375rem;
    padding: .6rem .8rem;
    cursor: pointer;
    text-align: center;
    font-size: .85rem;
}
.zec-dropzone--over {
    border-style: solid;
    background: color-mix(in srgb, currentColor 8%, transparent);
}

/* =============================================================================
   Energy quick form — the month grid (#80)
   Each fuel owns two columns, units and cost, and the figures are short. So the
   inputs are capped and centred under their headings, and the space that frees up
   is spent on the gutter that opens before each fuel: the pair a person is filling
   in stays together, and the eye does not drift into the next fuel's cost.
============================================================================= */
/* The year-totals row. Bootstrap's .table-light is a fixed near-white in every
   theme, which laid a lit band right across the dark grid; point it at the tokens
   so the totals read as the register's own raised row instead. */
.zec-energy-grid .table-light {
    --bs-table-bg: var(--stone-2);
    --bs-table-color: var(--ink);
    --bs-table-border-color: var(--stone);
}
.zec-energy-grid th, .zec-energy-grid td { padding-left:.3rem; padding-right:.3rem; }
.zec-energy-grid th.border-start, .zec-energy-grid td.border-start { padding-left:1.75rem; }
.zec-energy-grid input.form-control { max-width:6.5rem; margin-inline:auto; }
/* Below the gutter's width there is nothing left to give it; the table scrolls
   inside .table-responsive from here down, so keep the columns readable instead. */
@media (max-width: 48rem) {
    .zec-energy-grid th.border-start, .zec-energy-grid td.border-start { padding-left:.9rem; }
}

/* -----------------------------------------------------------------------------
   Non-monthly billing — the record table
   The straddling-row note (#108) lives in the Period cell, and a long sentence in
   an auto-laid table takes the width from its neighbours: the figures were
   breaking between value and unit ("620 / kWh") and "Building 1" over two lines.
   Hold the short columns on one line and give the table a floor to scroll from,
   the way the month grid above it already does.
----------------------------------------------------------------------------- */
.zec-other-records { min-width:46rem; }
.zec-other-records th, .zec-other-records td { white-space:nowrap; }
/* The two that are prose, not figures, and may wrap. */
.zec-other-records td:first-child, .zec-other-records .zec-warn { white-space:normal; }
.zec-other-records td:first-child > span { white-space:nowrap; }

/* =============================================================================
   The password box (#122)
   Chosen by people who are often elderly, often not confident with computers, and
   frequently on a tablet. So: everything is stated in words as well as colour, the
   type is a step larger than the form default rather than smaller, nothing is
   hidden behind a hover, and the reveal toggle is a plain labelled button rather
   than an eye glyph nobody has to guess at.

   The meter is four countable blocks, not a sliding bar: "three of four" reads at
   a glance where a percentage does not. Its colour carries one rule and one only —
   brick while the password is refused, fir the moment it is accepted, gilt when it
   is better than it needs to be. That change of colour happens at exactly the
   moment the button unlocks, so the two teach each other.
============================================================================= */

.zec-password { margin-bottom:1rem; }

/* The box and its Show toggle. Not an .input-group: the toggle is a sibling
   control rather than an appendage, and at phone width it drops below the box
   instead of squeezing it. */
.zec-password-entry { display:flex; gap:.5rem; align-items:stretch; flex-wrap:wrap; }
.zec-password-entry .form-control { flex:1 1 14rem; font-size:1.05rem; }
.zec-password-reveal {
    flex:0 0 auto; min-width:5rem; padding:.375rem .9rem;
    background:var(--stone-2); color:var(--ink);
    border:1px solid var(--field-bd); border-radius:5px;
    font:inherit; font-size:.92rem; cursor:pointer;
}
.zec-password-reveal:hover { background:var(--stone); }
.zec-password-reveal[aria-pressed="true"] { background:var(--stone); font-weight:600; }

/* ---------- the meter ---------- */
.zec-password-readout { display:flex; align-items:baseline; gap:.75rem; margin-top:.6rem; }
.zec-meter { display:flex; gap:4px; flex:0 0 9rem; }
.zec-meter > span {
    height:9px; flex:1 1 0; border-radius:2px;
    background:var(--stone); transition:background-color .12s ease;
}
@media (prefers-reduced-motion: reduce) {
    .zec-meter > span { transition:none; }
}
/* Filled blocks. data-level counts how many, and which colour they take. */
.zec-meter[data-level="1"] > span:nth-child(-n+1),
.zec-meter[data-level="2"] > span:nth-child(-n+2) { background:var(--brick); }
.zec-meter[data-level="3"] > span:nth-child(-n+3) { background:var(--fir); }
.zec-meter[data-level="4"] > span { background:var(--gilt); }

/* Spectral, because this is the screen's verdict and not a widget label. */
.zec-meter-band {
    margin:0; font-family:"Spectral", Georgia, serif; font-size:1rem; font-weight:600;
    color:var(--muted);
}
.zec-meter[data-level="1"] ~ .zec-meter-band,
.zec-meter[data-level="2"] ~ .zec-meter-band { color:var(--brick); }
.zec-meter[data-level="3"] ~ .zec-meter-band { color:var(--fir); }
.zec-meter[data-level="4"] ~ .zec-meter-band { color:var(--gilt); }

/* ---------- the three requirements ---------- */
.zec-password-checks { list-style:none; margin:.7rem 0 0; padding:0; font-size:.92rem; }
.zec-password-checks li {
    position:relative; padding-left:1.6rem; margin-bottom:.25rem; color:var(--muted);
}
/* An open circle for "not yet" rather than a cross: nothing here has gone wrong,
   it simply has not been done. The tick is the only state that changes colour. */
.zec-password-checks li::before {
    content:"\25CB"; position:absolute; left:0; top:-.05em; font-size:1.05em; line-height:1.4;
}
.zec-password-checks li[data-met="yes"] { color:var(--fir); }
.zec-password-checks li[data-met="yes"]::before { content:"\2713"; font-weight:700; }
.zec-password-checks li[data-met="no"] { color:var(--ink); }

/* ---------- the sentence, and the standing guidance ---------- */
.zec-password-advice {
    margin:.6rem 0 0; font-size:.92rem; color:var(--ink); min-height:1.3em;
}
.zec-password-advice:empty { margin:0; min-height:0; }
/* No max-width: the card is already narrower than a comfortable measure, so capping
   it only made this one paragraph wrap early against the advice line right above it. */
.zec-password-hint { margin:.5rem 0 0; font-size:.86rem; color:var(--muted); }

.zec-password-suggest {
    margin-top:.7rem; padding:.4rem .95rem;
    background:none; color:var(--fir); border:1px solid var(--fir); border-radius:5px;
    font:inherit; font-size:.9rem; cursor:pointer;
}
.zec-password-suggest:hover { background:var(--fir); color:var(--paper); }
.zec-password-suggest:disabled { opacity:.55; cursor:default; }

/* ---------- the repeat box ---------- */
.zec-password-confirm { margin-bottom:1rem; }
.zec-password-confirm .form-control { font-size:1.05rem; }
.zec-password-match { margin:.4rem 0 0; font-size:.92rem; min-height:1.3em; color:var(--muted); }
.zec-password-match:empty { margin:0; min-height:0; }
.zec-password-match[data-met="yes"] { color:var(--fir); }
.zec-password-match[data-met="no"] { color:var(--brick); }

/* A submit button held back by the indicator still has to look reachable, not
   broken: the reason it is held is already on the screen above it. */
.zec-password ~ * button[type="submit"]:disabled,
form:has(.zec-password) button[type="submit"]:disabled { opacity:.5; cursor:not-allowed; }

/* -----------------------------------------------------------------------------
   Audit trail (#122)
   Now that the codes are words rather than SHOUTING_CODES they are long enough to
   wrap, and an auto-laid table gave the width to Detail and broke "Password reset
   asked for" across two lines in every other row. Same treatment as the
   non-monthly billing table above: hold the short columns on one line, let Detail
   wrap, and give the whole thing a floor to scroll from inside .table-responsive.
----------------------------------------------------------------------------- */
.zec-audit { min-width:52rem; }
.zec-audit th, .zec-audit td { white-space:nowrap; }
/* The one column that is prose and may run long. */
.zec-audit th:last-child, .zec-audit td:last-child { white-space:normal; }

/* =============================================================================
   My account (#64, #158)
   One person's own details. The portrait leads, framed like a plate in a parish
   register with a gilt rule; below it a ledger, one ruled row per thing that can
   change, each stating its current value before offering to change it.
============================================================================= */
.zec-account { max-width:46rem; }

.zec-account-plate {
    display:flex; align-items:center; gap:1.75rem; flex-wrap:wrap;
    padding:1.5rem 0 1.75rem; margin-bottom:.5rem;
}
/* The rings are drawn outside the circle; the margin keeps them off the column edge. */
.zec-portrait-form { margin:0 0 0 5px; flex:0 0 auto; }
.zec-portrait {
    position:relative; width:128px; height:128px; border-radius:50%;
    background:var(--fir); color:var(--topbar-text);
    /* Two rings: paper, then gilt, so the frame holds on any photo, light or dark. */
    box-shadow:0 0 0 3px var(--paper), 0 0 0 4px var(--gilt);
    display:flex; align-items:center; justify-content:center; overflow:hidden;
    transition:box-shadow .15s ease;
}
.zec-portrait img { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; display:block; }
.zec-portrait--preview .zec-portrait-initials { visibility:hidden; }
.zec-portrait-initials {
    font-family:"Spectral", Georgia, serif; font-size:2.9rem; font-weight:500;
    letter-spacing:.02em; line-height:1;
}
/* While a file is being dragged over it, and while a new photo waits to be kept. */
.zec-portrait--over { box-shadow:0 0 0 3px var(--paper), 0 0 0 6px var(--gilt); }
.zec-portrait--preview { box-shadow:0 0 0 3px var(--paper), 0 0 0 4px var(--gilt), 0 0 0 9px color-mix(in srgb, var(--gilt) 25%, transparent); }
@media (prefers-reduced-motion: reduce) { .zec-portrait { transition:none; } }

.zec-account-who { flex:1 1 16rem; min-width:0; }
.zec-account-name {
    font-family:"Spectral", Georgia, serif; font-size:1.65rem; font-weight:600;
    line-height:1.2; margin:0 0 .3rem; overflow-wrap:anywhere;
}
.zec-account-roles { list-style:none; padding:0; margin:0 0 .9rem; color:var(--muted); font-size:.92rem; }
.zec-account-roles li + li { margin-top:.1rem; }
.zec-photo-actions { display:flex; align-items:center; flex-wrap:wrap; gap:.4rem 1rem; }
.zec-photo-file { max-width:18rem; }
.zec-photo-actions .zec-linkish { font-size:.875rem; }
.zec-photo-hint { color:var(--muted); font-size:.8rem; margin:.5rem 0 0; }

/* the ledger */
.zec-ledger { border-top:1px solid var(--stone); }
.zec-ledger-row {
    display:grid; grid-template-columns:10rem 1fr; gap:.4rem 1.5rem;
    padding:1.15rem 0; border-bottom:1px solid var(--stone);
}
.zec-ledger-label {
    font-family:"Spectral", Georgia, serif; font-size:1.05rem; font-weight:600;
    margin:0; padding-top:.05rem;
}
.zec-ledger-body { min-width:0; }
.zec-ledger-value { margin:0 0 .3rem; font-size:1rem; overflow-wrap:anywhere; }
.zec-ledger-value--none { color:var(--muted); }
.zec-ledger-link { font-size:.9rem; }
.zec-ledger-note { font-size:.9rem; color:var(--muted); margin:0; }
.zec-ledger-edit > summary {
    display:inline-block; cursor:pointer; color:var(--fir); font-size:.9rem;
    list-style:none;
}
.zec-ledger-edit > summary::-webkit-details-marker { display:none; }
.zec-ledger-edit > summary:hover { text-decoration:underline; }
/* Once open, the form says what it is; the summary steps back. */
.zec-ledger-edit[open] > summary { color:var(--muted); }
.zec-ledger-form { max-width:24rem; margin-top:.7rem; }
.zec-ledger-form .form-text { margin:.35rem 0 .75rem; }

/* A change waiting on its emailed link: a note in the margin, not an alarm. */
.zec-pending {
    border-left:3px solid var(--gilt); background:var(--stone-2);
    padding:.65rem .9rem; margin:.4rem 0 .75rem; font-size:.9rem; border-radius:0 4px 4px 0;
}
.zec-pending .zec-linkish { font-size:.9rem; }

@media (max-width: 575.98px) {
    .zec-account-plate { gap:1.25rem; }
    .zec-portrait { width:96px; height:96px; }
    .zec-portrait-initials { font-size:2.2rem; }
    .zec-ledger-row { grid-template-columns:1fr; }
}

/* Users list and form: a face beside a name (#64). */
.zec-person { display:inline-flex; align-items:center; gap:.6rem; }
.zec-person-avatar {
    width:28px; height:28px; border-radius:50%; flex:0 0 auto; overflow:hidden;
    display:inline-flex; align-items:center; justify-content:center;
    background:var(--stone-2); color:var(--muted); border:1px solid var(--stone);
    font-size:.68rem; font-weight:600; letter-spacing:.03em;
}
.zec-person-avatar img { width:100%; height:100%; object-fit:cover; display:block; }
.zec-person-photo {
    width:56px; height:56px; border-radius:50%; object-fit:cover;
    box-shadow:0 0 0 2px var(--paper), 0 0 0 3px var(--gilt);
}

/* ---------- System Setup: API keys (#46) ----------
   Each key reads as an entry in a register: its name in Spectral, the recognisable
   start of the secret in mono, then a plain sentence of what it can see. A key that
   sees more than the default carries a gilt rule beside that sentence, the one thing
   on the page meant to catch the eye. */
.zec-measure { max-width:62ch; }
.zec-keys { list-style:none; padding:0; margin:0; border-top:1px solid var(--stone); }
.zec-key {
    display:flex; gap:1.25rem; align-items:flex-start; justify-content:space-between;
    padding:1.1rem 0; border-bottom:1px solid var(--stone);
}
.zec-key-main { min-width:0; flex:1 1 auto; }
.zec-key-name { font-size:1.15rem; font-weight:600; margin:0; line-height:1.25; overflow-wrap:anywhere; }
.zec-key-prefix { margin:.15rem 0 .5rem; font-size:.85rem; color:var(--muted); }
.zec-key-prefix code { color:var(--ink); font-size:.85rem; }
.zec-key-scope { margin:0 0 .6rem; font-size:.92rem; max-width:62ch; }
.zec-key-scope--wide { border-left:3px solid var(--gilt); padding-left:.6rem; }
.zec-key-facts {
    display:grid; grid-template-columns:repeat(auto-fit, minmax(10rem, 1fr)); gap:.35rem 1.5rem;
    margin:0; font-size:.85rem;
}
.zec-key-facts dt { font-weight:400; color:var(--muted); }
.zec-key-facts dd { margin:0; }
.zec-key-action { flex:0 0 auto; }
.zec-key--revoked .zec-key-name { color:var(--muted); font-weight:500; }
.zec-keys-empty {
    padding:1.5rem 1rem; border:1px dashed var(--field-bd); border-radius:4px;
    color:var(--muted); text-align:center;
}
.zec-keys-revoked { margin-top:1.5rem; }
.zec-keys-revoked > summary { cursor:pointer; color:var(--muted); font-size:.9rem; margin-bottom:.5rem; }
.zec-key-issue, .zec-secret-card {
    background:var(--paper); border:1px solid var(--stone); border-top:3px solid var(--gilt);
    border-radius:4px; padding:1.25rem 1.25rem 1.1rem;
}
.zec-key-issue legend { font-size:1rem; float:none; }
.zec-secret-card { max-width:44rem; }
.zec-secret { display:flex; gap:.5rem; }
.zec-secret .form-control { font-size:1rem; letter-spacing:.02em; }
.zec-secret-usage {
    background:var(--stone-2); border-radius:3px; padding:.6rem .8rem; font-size:.85rem;
    margin-bottom:.5rem; white-space:pre-wrap; overflow-wrap:anywhere;
}
@media (max-width:575.98px) {
    .zec-key { flex-direction:column; gap:.5rem; }
    .zec-secret { flex-direction:column; }
}
/* Read-only, but meant to be read and copied: keep it looking like a live field. */
.zec-secret .form-control[readonly] { background:var(--field); color:var(--ink); }
/* -----------------------------------------------------------------------------
   Move and merge (#30)
   A confirmation page reads as a sentence first and a ledger second. The one
   distinctive element is the slip: the two congregations side by side, joined by
   the direction of travel, on the paper panel with the gilt top rule the proposal
   slip (#53) uses. Brick appears only where something is destroyed: the side that
   will be deleted, the discarded values and the irreversible step.
----------------------------------------------------------------------------- */
.zec-restructure > * { max-width:50rem; }
.zec-restructure-lead { font-size:1.02rem; line-height:1.55; max-width:42rem; margin:.25rem 0 1.25rem; }
.zec-restructure-h {
    font-family:"Spectral", Georgia, serif; font-size:1.12rem; font-weight:600;
    margin:1.75rem 0 .6rem;
}

/* ---- the slip ---- */
.zec-slip {
    display:grid; grid-template-columns:minmax(0,1fr) auto minmax(0,1fr); align-items:stretch;
    background:var(--paper); border:1px solid var(--stone); border-top:3px solid var(--gilt);
    border-radius:4px;
}
.zec-slip-side { display:flex; flex-direction:column; gap:.15rem; padding:1rem 1.15rem; min-width:0; }
.zec-slip-role { font-size:.8rem; color:var(--muted); }
.zec-slip-name {
    font-family:"Spectral", Georgia, serif; font-size:1.35rem; font-weight:600; line-height:1.2;
    overflow-wrap:anywhere;
}
.zec-slip-meta { font-size:.8rem; color:var(--muted); }
.zec-slip-meta > span + span::before { content:"·"; margin:0 .35rem; }
.zec-slip-item {
    margin-top:.45rem; font-family:"Spectral", Georgia, serif; font-size:1rem; color:var(--ink);
}
.zec-slip-arrow { display:flex; align-items:center; color:var(--fir); padding:0 .25rem; }
.zec-slip-side--to { border-left:1px dashed var(--stone); }
.zec-slip-side--to .zec-slip-item { color:var(--fir); font-weight:600; }
/* The side that will not survive: brick rule and a quieter name, never struck
   through, so it can still be read and checked. */
.zec-slip-side--gone { box-shadow:inset 3px 0 0 var(--brick); }
.zec-slip-side--gone .zec-slip-role { color:var(--brick); font-weight:600; }
.zec-slip-side--gone .zec-slip-name { color:var(--muted); }
@media (max-width: 575.98px) {
    .zec-slip { grid-template-columns:minmax(0,1fr); }
    .zec-slip-arrow { justify-content:center; padding:0; transform:rotate(90deg); height:2rem; }
    .zec-slip-side--to { border-left:0; border-top:1px dashed var(--stone); }
}

/* ---- the manifest: count, then what it is ---- */
.zec-manifest { list-style:none; margin:0; padding:0; border-top:1px solid var(--stone-2); }
.zec-manifest > li {
    display:grid; grid-template-columns:3rem minmax(0,1fr); gap:.75rem; align-items:baseline;
    padding:.55rem 0; border-bottom:1px solid var(--stone-2);
}
.zec-manifest-n {
    font-family:"Spectral", Georgia, serif; font-size:1.2rem; font-weight:600; text-align:right;
    font-variant-numeric:tabular-nums lining-nums;
}
.zec-manifest > li.is-none { color:var(--muted); }
.zec-manifest > li.is-none .zec-manifest-n { font-weight:400; }
.zec-manifest-detail { list-style:none; margin:.35rem 0 0; padding:0; font-size:.88rem; }
.zec-manifest-detail > li { padding:.12rem 0; }

/* ---- what is discarded ---- */
.zec-discard { --bs-table-bg:transparent; font-size:.9rem; max-width:46rem; }
.zec-discard th[scope="row"] { color:var(--muted); font-weight:400; white-space:nowrap; }
.zec-discard thead th { font-weight:600; font-size:.82rem; }
.zec-discard-gone { color:var(--brick); }

/* ---- the irreversible step ---- */
.zec-irreversible {
    border-left:3px solid var(--brick); background:var(--paper);
    border-top:1px solid var(--stone); border-right:1px solid var(--stone); border-bottom:1px solid var(--stone);
    border-radius:0 4px 4px 0; padding:1rem 1.15rem; max-width:36rem;
}
.zec-irreversible-head { font-weight:600; color:var(--brick); margin:0 0 .75rem; }
.zec-confirm-word { font-size:.95em; color:var(--ink); }
.zec-confirm-input { font-family:"IBM Plex Mono", ui-monospace, monospace; max-width:22rem; }
.zec-irreversible .btn-danger:disabled { opacity:.45; cursor:not-allowed; }

/* ---- the picker ---- */
.zec-pick { max-width:36rem; }
.zec-pick-label { display:block; font-size:.88rem; margin-bottom:.3rem; }
.zec-pick-count { font-size:.8rem; color:var(--muted); margin:0 0 .5rem; }
.zec-pick-list { max-height:26rem; overflow:auto; padding-right:.25rem; }
.zec-pick-name { display:block; font-family:"Spectral", Georgia, serif; font-size:1.02rem; }
.zec-candidate[hidden] { display:none; }

/* ---- the entry points: quiet disclosures in the administer tier ---- */
.zec-admin-more { margin-top:1.5rem; padding-top:.75rem; border-top:1px solid var(--stone); font-size:.9rem; }
.zec-admin-more > summary { color:var(--muted); cursor:pointer; }
.zec-admin-more > p { margin:.5rem 0 .4rem; max-width:40rem; }

/* =============================================================================
   Units (#123, #124, #151)
   Figures are kept in the unit on the bill. The pieces below let a person say which
   unit that is, without having to know there is a data model behind it: a picker in
   the grid column's own head, a note where a figure's unit differs from its column,
   a row per fuel on the diocese page, a choice per fuel on the person's units page,
   and the report's view toggle, which borrows the theme switch's pill.
============================================================================= */

/* The grid column's unit, chosen in its own head, as narrow as the inputs beneath it. */
/* min-width: the select shows the unit's symbol, and the column's inputs would otherwise
   squeeze it below the longest ones ("cord" read as "corc", "US gal") (#51). */
.zec-energy-grid .zec-unit-pick {
    min-width:5.5rem; max-width:6.5rem; margin-inline:auto; padding-top:.15rem; padding-bottom:.15rem;
    font-size:.8rem; text-align:center; text-align-last:center;
}
/* "in GJ" under a figure entered in another unit than its column; "converted to m³". */
.zec-cell-unit {
    display:block; max-width:6.5rem; margin:.1rem auto 0; text-align:right;
    font-size:.72rem; font-weight:400; color:var(--muted); line-height:1.2;
}
.zec-unit-notice {
    margin:.25rem 0 .9rem; padding:.45rem .7rem; max-width:46rem;
    background:var(--stone-2); border-left:3px solid var(--gilt); color:var(--ink);
}

/* The record form: figure and unit read as one field. */
.zec-unit-select { flex:0 0 6.5rem; max-width:6.5rem; }

/* The diocese page: one row per fuel, what it is now on the left, the choice on the right. */
.zec-unit-row {
    display:flex; align-items:center; justify-content:space-between; gap:.75rem;
    padding:.55rem 0; border-top:1px solid var(--stone);
}
.zec-unit-row:first-of-type { border-top:0; }
.zec-unit-row-text { min-width:0; }
.zec-unit-row-fuel { display:block; font-weight:600; font-size:.9rem; margin:0; }
.zec-unit-row-now { display:block; font-size:.82rem; color:var(--muted); }
.zec-unit-row-pick { flex:0 0 15rem; max-width:15rem; }
.zec-unit-row-only { flex:0 0 auto; font-size:.82rem; color:var(--muted); }
@media (max-width: 36rem) {
    .zec-unit-row { flex-wrap:wrap; }
    .zec-unit-row-pick { flex-basis:100%; max-width:none; }
}

/* The person's units page: each fuel's units laid side by side, as the bills would
   name them. The radio stays visible: a choice should look like a choice. */
.zec-unit-fuel { margin:0; padding:1rem 0 1.1rem; border-top:1px solid var(--stone); }
.zec-unit-fuel:first-of-type { border-top:0; padding-top:.25rem; }
/* Bootstrap floats the legend so it sits inside the fieldset rather than on its border. */
.zec-unit-fuel-name {
    font-family:"Spectral", Georgia, serif; font-size:1.15rem; font-weight:600;
    margin-bottom:.5rem;
}
.zec-choices { display:flex; flex-wrap:wrap; gap:.5rem; clear:both; }
.zec-choice {
    display:flex; align-items:flex-start; gap:.55rem; cursor:pointer;
    min-width:11rem; flex:0 1 auto; padding:.55rem .8rem .55rem .7rem;
    background:var(--paper); border:1px solid var(--field-bd); border-radius:6px;
}
.zec-choice:hover { border-color:var(--muted); }
.zec-choice:has(input:checked) { border-color:var(--fir); box-shadow:inset 0 0 0 1px var(--fir); }
.zec-choice:has(input:focus-visible) { outline:2px solid var(--gilt); outline-offset:2px; }
.zec-choice .form-check-input { margin-top:.2rem; flex:0 0 auto; }
.zec-choice .form-check-input:checked { background-color:var(--fir); border-color:var(--fir); }
.zec-choice-body { display:flex; flex-direction:column; line-height:1.3; }
.zec-choice-name { font-size:.92rem; }
.zec-choice-symbol { font-size:.8rem; color:var(--muted); }
.zec-choice-note { font-size:.78rem; color:var(--gilt); }
.zec-choice--default .zec-choice-name { font-weight:600; }

/* The report's unit view: the theme switch's pill, laid flat beside the PDF button. */
.zec-seg {
    display:inline-flex; gap:.15rem; padding:.15rem;
    border:1px solid var(--field-bd); border-radius:20px; background:var(--paper);
}
.zec-seg a {
    padding:.22rem .8rem; border-radius:20px; font-size:.8rem; line-height:1.3;
    color:var(--muted); text-decoration:none; white-space:nowrap;
}
.zec-seg a:hover { color:var(--ink); text-decoration:none; background:var(--stone-2); }
.zec-seg a.active { background:var(--fir); color:var(--topbar-text); font-weight:500; }
.zec-conversions { margin-top:.75rem; padding-top:.5rem; border-top:1px solid var(--stone); }

/* -----------------------------------------------------------------------------
   Energy chart (#81)
   One SVG fragment (fragments/ghg-chart.html) drawn at two sizes: a thumbnail
   beside the GHG figures on the congregation page, and the full chart above the
   Congregational Analysis table. Its colours are SVG presentation attributes so
   the PDF, which has no stylesheet, still gets them; these rules outrank those
   attributes and re-step the same classes for the dark theme.

   Fuel colours follow the fuel, never its position. Any fuel can be missing from a
   year, so any two can touch: the set is validated on ALL pairs (the dataviz
   validator with --pairs all), light steps against the card (#FBFAF5) and the PDF
   parchment (#F4F0E6), dark steps against the dark card (#1A2620). Change one only
   by re-running that check on the whole set. "Other" is a deliberate neutral, far
   from all five by lightness.
----------------------------------------------------------------------------- */
:root {
    --zec-fuel-electricity:#0F9B89; --zec-fuel-natural-gas:#4D86D9;
    --zec-fuel-heating-oil:#C8741D; --zec-fuel-propane:#624082;
    --zec-fuel-wood:#19631E; --zec-fuel-other:#282822;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) {
        --zec-fuel-electricity:#068665; --zec-fuel-natural-gas:#688DDB;
        --zec-fuel-heating-oil:#A85A1B; --zec-fuel-propane:#C26FA4;
        --zec-fuel-wood:#8F9817; --zec-fuel-other:#E6E6E0;
    }
}
:root[data-theme="dark"] {
    --zec-fuel-electricity:#068665; --zec-fuel-natural-gas:#688DDB;
    --zec-fuel-heating-oil:#A85A1B; --zec-fuel-propane:#C26FA4;
    --zec-fuel-wood:#8F9817; --zec-fuel-other:#E6E6E0;
}
.zec-ghg-chart .zec-fuel-electricity { fill:var(--zec-fuel-electricity); }
.zec-ghg-chart .zec-fuel-natural-gas { fill:var(--zec-fuel-natural-gas); }
.zec-ghg-chart .zec-fuel-heating-oil { fill:var(--zec-fuel-heating-oil); }
.zec-ghg-chart .zec-fuel-propane { fill:var(--zec-fuel-propane); }
.zec-ghg-chart .zec-fuel-wood { fill:var(--zec-fuel-wood); }
.zec-ghg-chart .zec-fuel-other { fill:var(--zec-fuel-other); }
/* A year still running (#81): a pale fill inside an outline of the fuel's own colour.
   The outline carries the fuel in every theme and in print; the paleness says "not
   final". Its legend key is the same treatment in a neutral. */
.zec-ghg-chart .zec-provisional.zec-fuel-electricity { stroke:var(--zec-fuel-electricity); }
.zec-ghg-chart .zec-provisional.zec-fuel-natural-gas { stroke:var(--zec-fuel-natural-gas); }
.zec-ghg-chart .zec-provisional.zec-fuel-heating-oil { stroke:var(--zec-fuel-heating-oil); }
.zec-ghg-chart .zec-provisional.zec-fuel-propane { stroke:var(--zec-fuel-propane); }
.zec-ghg-chart .zec-provisional.zec-fuel-wood { stroke:var(--zec-fuel-wood); }
.zec-ghg-chart .zec-provisional.zec-fuel-other { stroke:var(--zec-fuel-other); }
.zec-ghg-chart .zec-chart-key-provisional { fill:var(--muted); stroke:var(--muted); }
.zec-ghg-chart .zec-chart-ink { fill:var(--ink); }
.zec-ghg-chart .zec-chart-muted { fill:var(--muted); }
.zec-ghg-chart .zec-chart-rule { stroke:var(--stone); }
.zec-ghg-chart .zec-chart-muted-rule,
.zec-ghg-chart .zec-chart-muted-stroke { stroke:var(--muted); }
.zec-ghg-chart { display:block; width:100%; height:auto; font-variant-numeric:tabular-nums; }

/* The full chart: hovering a year brings it forward and steps the others back; its
   own tooltip names the year's total and each fuel. */
.zec-ghg-chart-figure { margin:0; }
.zec-ghg-caption { font-family:"Spectral", Georgia, serif; font-size:1.05rem; font-weight:600;
    color:var(--ink); margin-bottom:.35rem; }
.zec-ghg-scroll { overflow-x:auto; }
.zec-ghg-scroll .zec-ghg-chart { min-width:34rem; }
.zec-ghg-chart:not(.zec-ghg-chart--compact) .zec-chart-bar { transition:opacity .15s; }
.zec-ghg-chart:not(.zec-ghg-chart--compact):hover .zec-chart-bar:not(:hover) { opacity:.45; }
@media (prefers-reduced-motion: reduce) {
    .zec-ghg-chart .zec-chart-bar { transition:none; }
}

/* The GHG strip on the congregation page. Its first column matches the dt column of
   the row-based list around it: a Bootstrap row is the card's width plus one gutter,
   so col-4 there is a third of (100% + 1.5rem). The figures take what they need, the
   thumbnail the rest, up to a size where it still reads as a glance. */
.zec-ghg-strip-wrap { container-type:inline-size; }
.zec-ghg-strip {
    display:grid; align-items:start; column-gap:1rem;
    grid-template-columns:calc((100% + 1.5rem) / 3 - 1rem) max-content minmax(0, 1fr);
}
.zec-ghg-pair { grid-column:1 / 3; display:grid; grid-template-columns:subgrid; column-gap:1rem; }
.zec-ghg-pair dt { grid-column:1; font-weight:400; }
.zec-ghg-pair dd { grid-column:2; margin-bottom:.5rem; }
/* the one link in the strip (the empty invite) must read as one beside the figures */
.zec-ghg-pair a { text-decoration:underline; text-underline-offset:2px; }
.zec-ghg-thumb {
    grid-column:3; justify-self:end; width:100%; max-width:13rem; margin-bottom:.5rem;
    display:block; padding:.4rem .5rem .35rem; border:1px solid var(--stone); border-radius:4px;
    background:var(--paper); color:var(--muted); text-decoration:none;
    transition:border-color .15s, background-color .15s;
}
.zec-ghg-thumb:hover, .zec-ghg-thumb:focus-visible {
    border-color:var(--fir); background:var(--stone-2); color:var(--fir); text-decoration:none;
}
.zec-ghg-thumb-caption { display:block; margin-top:.25rem; font-size:.75rem; line-height:1.25; }
@media (prefers-reduced-motion: reduce) {
    .zec-ghg-thumb { transition:none; }
}
/* A narrow card has no room beside the figures: the chart goes under them, in
   the figures' column. */
@container (max-width: 26rem) {
    .zec-ghg-thumb { grid-column:2 / 4; justify-self:start; }
}

/* =============================================================================
   Documents (#47), for the whole congregation or a building
   Bills and filled questionnaires sent in by a coordinator who could not key them.
   Deliberately quiet: on the building page a list the team ticks through, on the
   energy page a fallback below everything, closed until asked for. The one generous
   control is the file target, because the person using it may be holding a phone
   over a paper bill.
============================================================================= */
.zec-docs-waiting {
    display:inline-flex; align-items:center; gap:.35rem;
    font-size:.78rem; color:var(--ink); text-decoration:none;
    padding:.1rem .6rem; border:1px solid var(--gilt); border-radius:20px;
}
.zec-docs-waiting::before {
    content:""; width:.45rem; height:.45rem; border-radius:50%; background:var(--gilt);
}
a.zec-docs-waiting:hover { background:color-mix(in srgb, var(--gilt) 12%, transparent); }

.zec-doc-list { list-style:none; margin:0 0 .6rem; padding:0; }
.zec-doc {
    display:grid; grid-template-columns:.75rem minmax(0, 1fr); gap:.65rem;
    padding:.6rem 0; border-top:1px solid var(--stone-2);
}
.zec-doc:first-child { border-top:0; padding-top:.2rem; }
/* To review: an open gilt ring. Reviewed: filled moss. The words beside it say the same. */
.zec-doc-mark {
    width:.7rem; height:.7rem; margin-top:.4rem; border-radius:50%;
    border:1.5px solid var(--gilt);
}
.zec-doc--reviewed .zec-doc-mark { background:var(--moss); border-color:var(--moss); }
.zec-doc-name {
    font-family:"Spectral", Georgia, serif; font-size:1rem; line-height:1.25;
    overflow-wrap:anywhere;
}
.zec-doc--reviewed .zec-doc-name { color:var(--muted); }
.zec-doc-meta { font-size:.8rem; color:var(--muted); margin-top:.1rem; }
.zec-doc-note {
    font-size:.82rem; margin:.3rem 0 0; padding-left:.55rem;
    border-left:2px solid var(--stone); overflow-wrap:anywhere;
}
.zec-doc-actions { display:flex; flex-wrap:wrap; gap:.25rem 1.1rem; font-size:.82rem; margin-top:.3rem; }

.zec-doc-add > summary { color:var(--fir); cursor:pointer; }
.zec-doc-add > summary:hover { text-decoration:underline; }

/* ---- the shared upload fields ---- */
.zec-doc-kinds { display:flex; flex-wrap:wrap; gap:.4rem; border:0; padding:0; margin:0; }
.zec-doc-kinds legend { width:100%; float:none; }
.zec-doc-kind {
    font-size:.85rem; padding:.4rem .85rem; border-radius:20px; cursor:pointer;
    border:1px solid var(--field-bd); background:var(--field); color:var(--ink);
}
.btn-check:checked + .zec-doc-kind {
    border-color:var(--fir); color:var(--fir);
    background:color-mix(in srgb, var(--fir) 10%, var(--field));
}
.btn-check:focus-visible + .zec-doc-kind { outline:2px solid var(--gilt); outline-offset:2px; }

[data-zec-doc-picker] { position:relative; }
/* Without the script the plain file input is the control; with it, the target is. */
.zec-doc-drop { display:none; }
.zec-doc-picker--enhanced .zec-doc-drop {
    display:flex; flex-direction:column; align-items:center; justify-content:center;
    gap:.15rem; min-height:6.5rem; padding:1rem; text-align:center; cursor:pointer;
    border:1px dashed var(--field-bd); border-radius:4px; background:var(--paper);
}
.zec-doc-picker--enhanced .zec-doc-drop:hover { border-color:var(--fir); }
.zec-doc-picker--enhanced:focus-within .zec-doc-drop { outline:2px solid var(--gilt); outline-offset:2px; }
.zec-doc-picker--enhanced .zec-doc-input {
    position:absolute; width:1px; height:1px; padding:0; margin:-1px;
    overflow:hidden; clip:rect(0 0 0 0); border:0; opacity:0;
}
.zec-doc-drop-icon { color:var(--fir); }
.zec-doc-drop-text { color:var(--fir); font-weight:500; }
.zec-doc-drop-hint { font-size:.78rem; color:var(--muted); }
.zec-doc-chosen { list-style:none; margin:.5rem 0 0; padding:0; font-size:.82rem; }
.zec-doc-chosen li {
    display:flex; justify-content:space-between; gap:1rem;
    padding:.25rem 0; border-bottom:1px dotted var(--stone);
}
.zec-doc-chosen-name { overflow-wrap:anywhere; }
.zec-doc-chosen-size { color:var(--muted); white-space:nowrap; }
.zec-doc-chosen--over, .zec-doc-chosen--over .zec-doc-chosen-size { color:var(--brick); }

/* ---- the coordinator's fallback, under the energy grid ---- */
.zec-fallback {
    margin-top:2.75rem; padding-top:1.25rem; border-top:1px solid var(--stone);
    max-width:40rem;
}
.zec-fallback-title { font-family:"Spectral", Georgia, serif; font-size:1.2rem; font-weight:600; margin:0 0 .25rem; }
.zec-fallback-lede { color:var(--muted); font-size:.9rem; margin:0 0 .9rem; }
.zec-fallback-form > summary { list-style:none; }
.zec-fallback-form > summary::-webkit-details-marker { display:none; }
.zec-fallback-form[open] > summary { display:none; }
.zec-sent { margin-top:1.75rem; }
.zec-sent-title { font-family:"Spectral", Georgia, serif; font-size:1rem; font-weight:600; margin:0 0 .4rem; }

@media (max-width: 575.98px) {
    .zec-fallback-form > summary,
    .zec-fallback-form button[type=submit] { display:block; width:100%; }
    .zec-doc-picker--enhanced .zec-doc-drop { min-height:8rem; }
}

/* -----------------------------------------------------------------------------
   The address's town / province / postal-code row (congregation and diocese forms)
   The province label wrapped to two lines in a narrow column and pushed its input
   below its neighbours. Labels now hold one line, and the inputs share a bottom line
   whatever the labels do. The row answers to its own width rather than the window's,
   because the same fields sit in a wide form and in the narrow diocese card: three
   across where there is room, otherwise the town on its own line above the other two.
----------------------------------------------------------------------------- */
.zec-address-row-wrap { container-type:inline-size; }
.zec-address-row {
    display:grid; column-gap:.75rem; align-items:end;
    grid-template-columns:minmax(0, 1fr) minmax(0, 1fr);
}
.zec-address-cell { min-width:0; margin-bottom:.5rem; }
.zec-address-cell:first-child { grid-column:1 / -1; }
.zec-address-row .form-label { white-space:nowrap; }
@container (min-width: 28rem) {
    .zec-address-row { grid-template-columns:minmax(0, 1fr) 8.5rem minmax(7rem, 10rem); }
    .zec-address-cell:first-child { grid-column:auto; }
}

/* ---- the congregation page's Documents section (#47) ----
   The heading carries the total and the "n to review" mark, so the state reads with the
   list closed. The list opens by itself when something waits, and is grouped by what
   each document is for, the whole congregation first. */
.zec-docs-section { max-width:44rem; }
.zec-docs-heading { display:flex; align-items:center; flex-wrap:wrap; gap:.3rem .6rem; }
.zec-docs-heading .zec-docs-waiting { font-family:var(--bs-body-font-family); font-weight:400; }
.zec-docs-toggle {
    display:inline-flex; align-items:center; gap:.45rem; cursor:pointer; list-style:none;
    color:var(--fir); font-size:.9rem;
}
.zec-docs-toggle::-webkit-details-marker { display:none; }
.zec-docs-toggle::before {
    content:""; width:.4rem; height:.4rem; flex:none;
    border-right:1.5px solid currentColor; border-bottom:1.5px solid currentColor;
    transform:rotate(-45deg); transition:transform .15s ease;
}
.zec-docs-list[open] > .zec-docs-toggle::before { transform:rotate(45deg); }
.zec-docs-toggle:hover { text-decoration:underline; }
.zec-docs-toggle:focus-visible { outline:2px solid var(--gilt); outline-offset:3px; border-radius:2px; }
.zec-docs-list { margin-bottom:.6rem; }
.zec-doc-group { margin-top:.9rem; }
.zec-doc-group-title {
    font-family:"Spectral", Georgia, serif; font-size:.95rem; font-weight:600;
    margin:0 0 .15rem; color:var(--ink);
}
.zec-doc-form { max-width:32rem; }
@media (prefers-reduced-motion: reduce) {
    .zec-docs-toggle::before { transition:none; }
}

/* The analysis PDF: the reader's language on the button, the others in a small menu beside it. */
.zec-pdf-download { display:inline-flex; align-items:flex-start; gap:.5rem; }
.zec-pdf-langs summary { cursor:pointer; color:var(--muted); padding-top:.25rem; }
.zec-pdf-langs ul { margin-top:.25rem; }

/* The priority picker holds a number at most two digits long. */
.zec-priority-select { max-width:12rem; }

/* ---- a building's own address (#212) ----
   Folded under the building form's tick boxes until it holds something: most buildings
   stand at their congregation's address. On the congregation's card the address is one
   quiet line of text, nothing more. */
.zec-own-address > summary { color:var(--muted); cursor:pointer; font-size:.9rem; }
.zec-own-address[open] > summary { margin-bottom:.25rem; }
.zec-own-location { font-size:.85rem; color:var(--muted); margin:.5rem 0 0; }
.zec-own-location-coords { font-variant-numeric:tabular-nums; white-space:nowrap; }
