/* PunaOra for Rereteewhioi - design system, forked from Punaora's brand kit
   and re-themed on the Rereteewhioi marae palette: bush-green structure,
   gold accent, cream canvas (see branding/branding-guidelines.html).
   Type: Big Shoulders Display + Inter (self-hosted; latin-ext carries macrons),
   matching the marae's public website exactly. */

@font-face {
  font-family: 'Big Shoulders Display';
  font-style: normal;
  font-weight: 700 900;
  font-display: swap;
  src: url(../fonts/bigshoulders-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+1E00-1E9F, U+2020, U+2113;
}
@font-face {
  font-family: 'Big Shoulders Display';
  font-style: normal;
  font-weight: 700 900;
  font-display: swap;
  src: url(../fonts/bigshoulders-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+2000-206F, U+2122, U+2212, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(../fonts/inter-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+1E00-1E9F, U+2020, U+2113;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(../fonts/inter-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+2000-206F, U+2122, U+2212, U+FEFF, U+FFFD;
}

:root {
  /* brand tokens mapped onto the app's existing variable names, from
     rereteewhio/branding/branding-guidelines.html's documented swatch roles:
     Bush 900 "Nav, footer, hero overlay" · Bush 700 "Primary buttons, links"
     · Bush 500 "Gradients, hover states" · Sage 200 "Tags, soft fills".
     (Bush 800 isn't an official swatch - it's the website's own extra dark
     shade, reused here for the app's second structural tone.) */
  --pounamu-950: #12241F;
  --pounamu-900: #173029;
  --pounamu-700: #1B362E;
  --pounamu-500: #2C4E42;
  --pounamu-100: #DDE3D3;
  --sage-500: #7E8F6E;     /* branding-guide Sage 500 - event markers, dashboard gradients */
  --gold: #C99A3B;         /* gold-500 - decorative only */
  --gold-act: #8C6624;     /* darkened gold-600; white text needs ~5:1, gold-600
                               itself (#B0812F) only clears ~3.5:1 on white */
  --gold-text: #8C6624;    /* text-safe gold, same reasoning */
  --paper: #F7F6F2;        /* flat, near-white canvas; cards are solid white on it */
  --card: #FFFFFF;
  --field: #F1F0EB;        /* neutral quiet fill - quiet buttons, hovers, chips */
  --input-bg: #FFFFFF;     /* inputs are white with a visible border, not filled */
  --field-border: #D6D3CA; /* visible input boundary */
  --line: #E7E4DC;         /* hairline - card edges and dividers */
  --line-strong: #6B6F6C;  /* grey-600 - meaningful boundaries */
  --ink: #14181A;
  --muted: #6B6F6C;
  --red: #A32820;
  --red-fill: #B02A22;
  --red-soft: #F6DDD9;
  --warn-text: #8A5A00;
  --warn-soft: #F3E4C2;
  --ok-text: #2F6B3C;
  --ok-soft: #E0EBDD;
  --sand: #E9D3A3;         /* gold-200 */
  --wai-light: #E9D3A3;    /* gold-200 */
  --display: 'Big Shoulders Display', sans-serif;
  --body: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 14px;
  /* shadows are barely there: the hairline border does the separating */
  --shadow-1: 0 1px 2px rgba(20, 24, 26, 0.04);
  --shadow-2: 0 1px 3px rgba(20, 24, 26, 0.06), 0 10px 28px -14px rgba(20, 24, 26, 0.16);
  --shadow-btn: 0 1px 2px rgba(20, 24, 26, 0.08);
  --shadow-bar: 0 1px 0 var(--line);
  /* card surface (the old frosted glass is now solid white + hairline) */
  --glass-bg: #FFFFFF;
  --glass-blur: none;
  --glass-edge: 1px solid var(--line);
  --sidebar-bg: #FFFFFF;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  /* size scale: normal by default, html.big = large-text mode.
     Root font-size drives every rem in the sheet, so the whole UI scales. */
  --fs-root: 15.5px;
  --fs-h1: 1.55rem;
  --fs-h2: 1.15rem;
  --fs-h3: 1.02rem;
  --fs-btn: 0.95rem;
  --fs-stat: 1.45rem;
  --control-h: 40px;
  --sidebar-w: 232px;
  --sidebar-collapsed: 68px;
}
/* no backdrop-filter (older browsers): fall back to near-opaque so text stays legible */
html.big {
  --fs-root: 17.25px;
  --fs-h1: 1.75rem;
  --fs-h2: 1.35rem;
  --fs-h3: 1.1rem;
  --fs-btn: 1.05rem;
  --fs-stat: 1.8rem;
  --control-h: 50px;
}

* { box-sizing: border-box; }
/* the hidden attribute always wins over a component's own display rule */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; font-size: var(--fs-root); }

body {
  margin: 0;
  font-family: var(--body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
}
h1, h2, h3 {
  font-family: var(--body);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0 0 0.5rem;
}
h1 { font-size: var(--fs-h1); font-weight: 650; letter-spacing: -0.015em; }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }
p { margin: 0 0 1rem; }
a { color: var(--pounamu-700); }

button, input, select { font: inherit; color: inherit; }

:focus-visible {
  outline: 3px solid var(--pounamu-700);
  outline-offset: 2px;
  border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Brand mark ---------- */
.mark { width: 34px; height: 34px; flex: none; }

/* ---------- Controls (44px+ targets) ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: var(--control-h);
  padding: 0.55rem 1.15rem;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: var(--pounamu-700);
  color: #fff;
  font-family: var(--body);
  font-weight: 600;
  font-size: var(--fs-btn);
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s var(--ease), transform 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.btn:hover { background: var(--pounamu-500); }
.btn:active { background: var(--pounamu-900); }

.btn-quiet {
  background: var(--card);
  color: var(--pounamu-900);
  border: 1px solid var(--field-border);
  box-shadow: var(--shadow-btn);
}
.btn-quiet:hover { background: var(--field); }

.btn-danger {
  background: transparent;
  border: none;
  color: var(--red);
  font-family: var(--body);
  font-weight: 500;
  min-height: calc(var(--control-h) - 4px);
  padding: 0.25rem 0.9rem;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background 0.15s var(--ease);
}
.btn-danger:hover { background: var(--red-soft); }

label {
  display: block;
  font-family: var(--body);
  font-weight: 500;
  font-size: 0.92rem;
  margin-bottom: 0.4rem;
}
input, select {
  width: 100%;
  min-height: var(--control-h);
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--field-border);
  border-radius: var(--r-sm);
  background: var(--input-bg);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
input:focus, select:focus, textarea:focus { border-color: var(--pounamu-500); box-shadow: 0 0 0 3px rgba(44, 78, 66, 0.14); outline: none; }
/* forms on grey panels: fields flip to white so they stay visible */
.inline-form input, .inline-form select, .inline-form textarea { background: var(--card); }
.inline-form input:focus, .inline-form select:focus, .inline-form textarea:focus { border-color: var(--pounamu-500); }
.field { margin-bottom: 1.1rem; }
.hint { font-size: 0.85rem; color: var(--muted); margin-top: 0.3rem; }

.error {
  background: var(--red-soft);
  color: var(--red);
  border-radius: var(--r-sm);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  font-weight: 600;
}
.error:empty { display: none; }

.card {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: var(--glass-edge);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  padding: 1.75rem;
}

/* ---------- Auth: split layout ---------- */
.auth-split {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr;
}
.auth-brand {
  position: relative;
  overflow: hidden;
  background: linear-gradient(160deg, var(--pounamu-900), var(--pounamu-950));
  color: #FAF7F1;
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.75rem;
  /* the lockup sizes from this panel's width (cqi), not the window's -
     the panel is only ~45% of the window on desktop */
  container-type: inline-size;
}
.auth-lockup { display: flex; align-items: center; gap: clamp(0.6rem, 3cqi, 1.25rem); margin-bottom: auto; }
.auth-lockup-text { display: grid; gap: 0.15rem; }
/* white-on-transparent marae logo, spanning both lines of the name */
.auth-logo { height: clamp(3.5rem, 19.5cqi, 7.5rem); width: auto; flex: none; }
.auth-brand .brand-kicker {
  font-family: var(--body);
  font-weight: 800;
  font-size: clamp(1rem, 4.5cqi, 2rem);
  line-height: 1;
  letter-spacing: -0.01em;
  color: var(--gold);
  margin: 0;
}
.auth-site-link {
  align-self: flex-start;
  margin-bottom: auto;
  display: inline-flex;
  gap: 0.45rem;
  color: var(--sand);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
}
.auth-site-link:hover { color: #FAF7F1; text-decoration: underline; }

/* Admin-set photo (Organisation → Sign-in page image), darkened for legibility. */
.auth-brand-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.6s var(--ease);
}
.auth-brand-photo.loaded { opacity: 0.45; } /* lets the green panel show through */
.auth-brand.has-photo::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(10, 24, 20, 0.55) 0%, rgba(10, 24, 20, 0.5) 45%, rgba(10, 24, 20, 0.8) 100%);
}
.auth-brand.has-photo .auth-lockup,
.auth-brand.has-photo .auth-site-link { text-shadow: 0 2px 14px rgba(0, 0, 0, 0.55); }
.auth-brand > :not(.auth-brand-photo) { position: relative; z-index: 1; }
.auth-brand .wordmark {
  /* the one place Big Shoulders Display actually works well - a large,
     short, all-caps-styled brand name. Everything else in the app uses
     Inter; the condensed display face reads as squished at UI sizes. */
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2.25rem, 15cqi, 5.75rem);
  letter-spacing: -0.03em;
  line-height: 1;
  margin: 0;
}
.auth-brand .tagline { color: var(--sand); font-size: 1.05rem; max-width: 34ch; margin: 0.5rem 0 0; }
.auth-brand ul {
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.55rem;
  color: var(--sand);
  font-size: 0.95rem;
}
.auth-brand li { display: flex; align-items: baseline; gap: 0.6rem; }
.auth-brand li::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); flex: none; transform: translateY(-1px); }
.ripple-bg {
  position: absolute;
  right: -110px;
  bottom: -110px;
  width: 380px;
  height: 380px;
  color: var(--paper);
  opacity: 0.13;
  pointer-events: none;
}

.auth-form-side {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1.5rem;
}
.auth-card { width: 100%; max-width: 420px; animation: rise 0.5s var(--ease) both; }

.auth-title { font-size: 1.15rem; margin-bottom: 0.4rem; }
.auth-lead { color: var(--muted); margin: 0 0 1.25rem; }
.auth-alt { margin-top: 1.1rem; text-align: center; font-size: 0.9rem; }
.auth-notice {
  background: var(--paper);
  border-radius: var(--r-sm);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.notice-warn {
  background: var(--warn-soft);
  color: var(--warn-text);
  border-radius: var(--r-sm);
  padding: 0.6rem 0.85rem;
  margin: 0 0 0.75rem;
}

/* Two-step sign-in setup and recovery codes */
.mfa-steps { margin: 0 0 1.25rem; padding-left: 1.2rem; display: grid; gap: 0.75rem; }
.mfa-qr {
  display: block;
  margin: 0.75rem 0 0.5rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 0.5rem;
  max-width: 100%;
  height: auto;
}
.mfa-secret, .mfa-codes { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.mfa-secret { word-break: break-all; color: var(--ink); }
.mfa-codes {
  list-style: none;
  margin: 0 0 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.35rem 1rem;
}
.mfa-code-actions { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.mfa-saved { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 1rem; }

.org-choose { display: flex; flex-direction: column; gap: 0.6rem; }
.org-choose-title { font-size: 1.15rem; margin-bottom: 0.5rem; }
.org-choose-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  text-align: left;
  cursor: pointer;
  padding: 1rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--card);
  font-family: var(--body);
  font-weight: 600;
  color: var(--ink);
  transition: border-color 0.15s var(--ease), transform 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.org-choose-item:hover { border-color: var(--pounamu-500); transform: translateY(-2px); box-shadow: var(--shadow-1); }
.org-choose-role {
  font-family: var(--body);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--paper);
  border-radius: 999px;
  padding: 0.2rem 0.7rem;
}

.tabs { display: flex; gap: 0.4rem; margin-bottom: 1.5rem; background: var(--paper); border-radius: 999px; padding: 0.3rem; }
.tab {
  flex: 1;
  min-height: var(--control-h);
  border: none;
  border-radius: 999px;
  background: transparent;
  font-family: var(--body);
  font-weight: 500;
  cursor: pointer;
  color: var(--muted);
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.tab[aria-selected="true"] { background: var(--pounamu-900); color: #fff; }

@media (min-width: 880px) {
  .auth-split { grid-template-columns: minmax(380px, 45%) 1fr; }
  .auth-brand { padding: 4rem 3.5rem; }
}

/* ---------- App shell ---------- */
.shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(250, 247, 241, 0.86);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-bar);
  padding: 0.7rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.1rem;
  flex-wrap: wrap;
}
.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--pounamu-900);
  text-decoration: none;
  font-family: var(--display); /* the topbar/sidebar version of the same brand mark */
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
}
.brand-mark span { text-transform: lowercase; }

.nav {
  display: flex;
  gap: 0.3rem;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }
.nav a {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 0.85rem;
  border-radius: 999px;
  text-decoration: none;
  color: var(--muted);
  font-family: var(--body);
  font-weight: 500;
  font-size: 0.88rem;
  white-space: nowrap;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.nav a { position: relative; }
.nav a:hover { background: transparent; color: var(--pounamu-700); box-shadow: none; }
.nav a[aria-current="page"] { color: var(--pounamu-700); font-weight: 600; }
.nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 0.85rem;
  right: 0.85rem;
  bottom: 4px;
  height: 2px;
  border-radius: 2px;
  background: var(--pounamu-700);
}
.nav a[aria-current="page"]:hover { background: transparent; box-shadow: none; }

.org-chip { display: inline-flex; align-items: center; gap: 0.55rem; min-width: 0; margin-left: auto; }
.org-avatar {
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--pounamu-700), var(--pounamu-900));
  color: #fff;
  display: grid;
  place-items: center;
  font-family: var(--body);
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.02em;
}
.org-avatar:empty { display: none; }
.org-chip .org {
  font-family: var(--body);
  font-weight: 500;
  font-size: 0.88rem;
  color: var(--pounamu-900);
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- Membership invitations banner ---------- */
.invite-banners { display: flex; flex-direction: column; gap: 0.75rem; margin-bottom: 1.5rem; }
.invite-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  background: var(--pounamu-100);
  border-left: 3px solid var(--pounamu-700);
  border-radius: var(--r-md);
  padding: 1rem 1.25rem;
}
.invite-text { font-family: var(--body); font-weight: 500; color: var(--pounamu-900); }
.invite-actions { display: flex; gap: 0.5rem; flex: none; }

/* ---------- Org switcher (multi-org members) ---------- */
.org-chip.org-switch { position: relative; }
.org-switch-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.2rem 0.5rem 0.2rem 0.2rem;
  border-radius: 999px;
  transition: background 0.15s var(--ease);
}
.org-switch-btn:hover { background: var(--pounamu-100); }
.org-chev { color: var(--muted); font-size: 0.7rem; flex: none; }
.org-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 60;
  min-width: 220px;
  padding: 0.4rem;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: var(--glass-edge);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-2);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.org-menu-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0.6rem 0.75rem;
  border-radius: var(--r-sm);
  font-family: var(--body);
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--ink);
}
.org-menu-item:hover { background: #fff; }
.org-menu-item.current { color: var(--pounamu-700); }
.org-menu-item.current::after { content: "✓"; margin-left: auto; font-weight: 700; }

/* wide screens: nav sits centred in the header, independent of brand/org widths */
@media (min-width: 1280px) {
  .nav { position: absolute; left: 50%; transform: translateX(-50%); flex: none; justify-content: center; }
}
/* below this width the nav drops to its own full-width row inside the header */
@media (max-width: 1279px) {
  .nav { order: 3; flex-basis: 100%; }
  .topbar { row-gap: 0.15rem; padding-bottom: 0.35rem; }
}
@media (max-width: 560px) {
  .org-chip .org { display: none; }
}

/* ---------- Quick-actions rail ---------- */
.rail {
  position: fixed;
  z-index: 30; /* under the sticky header */
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.rail-btn {
  width: var(--control-h);
  height: var(--control-h);
  padding: 0;
  display: grid;
  place-items: center;
  background: transparent;
  border: none;
  border-radius: 50%;
  color: var(--muted);
  font-family: var(--body);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.rail-btn svg { width: 19px; height: 19px; }
.rail-btn:hover { background: var(--pounamu-100); color: var(--pounamu-700); }
.rail-btn[aria-pressed="true"] { background: var(--pounamu-950); color: #fff; }
.rail-btn[aria-pressed="true"]:hover { background: var(--pounamu-950); color: #fff; }
/* thin divider between the quick actions and the tools cluster */
.rail-spacer { background: var(--line); flex: none; }

@media (min-width: 880px) {
  /* one glass column, vertically centred in the left gutter - header keeps full page width */
  .rail {
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.5rem;
    border-radius: 999px;
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: var(--glass-edge);
    box-shadow: var(--shadow-1);
  }
  .rail-spacer { width: 60%; height: 1px; margin: 1rem auto; }
}
@media (max-width: 879px) {
  .rail {
    left: 0;
    right: 0;
    bottom: 0;
    gap: 0.35rem;
    padding: 0.5rem 0.9rem;
    padding-bottom: calc(0.5rem + env(safe-area-inset-bottom));
    background: rgba(250, 247, 241, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 -10px 26px -22px rgba(23, 48, 41, 0.5);
  }
  .rail-spacer { flex: 1; background: transparent; }
}

main { width: 100%; max-width: 1200px; margin: 0 auto; padding: 1.75rem 2rem 4rem; }

/* ---------- App chrome: sidebar, top bar, phone drawer (js/chrome.js) ---------- */
body.has-chrome { padding-left: var(--sidebar-w); }
/* the top bar sits above .shell, so the shell no longer needs to fill the screen */
body.has-chrome .shell { min-height: 0; }
.sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: var(--sidebar-w);
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.9rem 0.75rem 0.75rem;
  background: var(--card);
  border-right: 1px solid var(--line);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  padding: 0.15rem 0.35rem 0.9rem;
  color: var(--pounamu-900);
  text-decoration: none;
}
/* the logo is white on transparent, so it sits on a small dark tile */
.brand-tile {
  width: 36px;
  height: 36px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--pounamu-900);
}
.brand-tile img { width: 28px; height: auto; }
.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.05; }
.brand-kicker { font-size: 0.62rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold-text); }
.brand-name { font-family: var(--display); font-weight: 800; font-size: 1.3rem; letter-spacing: 0.01em; }
.side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side-nav a {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.5rem 0.65rem;
  border-radius: var(--r-sm);
  color: #3E4441;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  white-space: nowrap;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.side-nav a svg { width: 18px; height: 18px; flex: none; stroke-width: 1.75; color: var(--muted); }
.side-nav a:hover { background: var(--field); color: var(--ink); }
.side-nav a[aria-current="page"] { background: var(--pounamu-100); color: var(--pounamu-900); font-weight: 600; }
.side-nav a[aria-current="page"] svg { color: var(--pounamu-700); }
.side-divider { height: 1px; background: var(--line); margin: 0.5rem 0.4rem; }
.side-collapse {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.5rem 0.65rem;
  border: none;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}
.side-collapse:hover { background: var(--field); color: var(--ink); }
.side-collapse svg { width: 18px; height: 18px; flex: none; }

.app-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  height: 56px;
  padding: 0 2rem;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.app-bar-brand { display: none; }
.app-bar-spacer { flex: 1; }

.profile-menu { position: relative; }
.profile-trigger {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.3rem 0.55rem 0.3rem 0.3rem;
  border: none;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
}
.profile-trigger:hover { background: var(--field); }
.profile-trigger > svg { width: 14px; height: 14px; flex: none; color: var(--muted); }
.user-avatar {
  width: 30px;
  height: 30px;
  flex: none;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: var(--pounamu-700);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-name { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.88rem; font-weight: 500; color: var(--ink); }
.profile-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 60;
  min-width: 210px;
  padding: 0.35rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-2);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.profile-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: none;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--ink);
  font-family: var(--body);
  font-weight: 500;
  font-size: 0.86rem;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.profile-item:hover { background: var(--field); }
.profile-item svg { width: 16px; height: 16px; flex: none; color: var(--muted); stroke-width: 1.75; }

.nav-toggle {
  display: none;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--card);
  color: var(--pounamu-900);
  cursor: pointer;
}
.nav-toggle svg { width: 20px; height: 20px; }
.nav-overlay { display: none; position: fixed; inset: 0; z-index: 49; background: rgba(18, 36, 31, 0.35); }

/* Desktop: the menu can be collapsed to an icon rail (remembered per browser) */
@media (min-width: 900px) {
  .sidebar { transition: width 0.2s var(--ease); }
  body.has-chrome { transition: padding-left 0.2s var(--ease); }
  body.has-chrome.nav-collapsed { padding-left: var(--sidebar-collapsed); }
  body.nav-collapsed .sidebar { width: var(--sidebar-collapsed); }
  body.nav-collapsed .brand-text,
  body.nav-collapsed .side-nav a span,
  body.nav-collapsed .side-collapse span { display: none; }
  body.nav-collapsed .brand,
  body.nav-collapsed .side-nav a,
  body.nav-collapsed .side-collapse { justify-content: center; padding-left: 0; padding-right: 0; }
  body.nav-collapsed .side-collapse svg { transform: scaleX(-1); }
}

/* Phones and small tablets: the sidebar becomes a slide-out drawer */
@media (max-width: 899px) {
  body.has-chrome { padding-left: 0; }
  .sidebar { transform: translateX(-100%); transition: transform 0.22s var(--ease); box-shadow: var(--shadow-2); }
  .sidebar.open { transform: none; }
  .side-collapse { display: none; }
  .nav-toggle { display: inline-flex; }
  .nav-overlay.show { display: block; }
  .app-bar { padding: 0 1rem; }
  .app-bar-brand { display: block; }
  .app-bar-brand .brand { padding: 0; gap: 0.5rem; }
  .app-bar-brand .brand-kicker { display: none; }
  .app-bar-brand .brand-tile { width: 30px; height: 30px; border-radius: 8px; }
  .app-bar-brand .brand-tile img { width: 23px; }
  .app-bar-brand .brand-name { font-size: 1.15rem; }
  .user-name { display: none; }
  main { padding: 1.25rem 1rem 4rem; }
}

/* ---------- Dashboard ---------- */
.plan-line {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--body);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--pounamu-700);
  background: var(--pounamu-100);
  border-radius: 999px;
  padding: 0.25rem 0.9rem;
  margin: 0.25rem 0 0;
}
.plan-line:empty { display: none; }

.badge {
  display: inline-block;
  font-family: var(--body);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.18rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  margin-bottom: 0.7rem;
}
.badge.live { border-color: transparent; background: var(--gold-act); color: #fff; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; padding: 0.5rem 1.75rem; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--line); }
tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.15s var(--ease); }
tbody tr:hover { background: var(--paper); }
th {
  font-family: var(--body);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
td select { min-width: 130px; width: auto; min-height: calc(var(--control-h) - 2px); }
.table-input { min-width: 140px; width: auto; min-height: calc(var(--control-h) - 2px); }
.table-select[multiple] { min-width: 150px; min-height: auto; padding: 0.3rem; }
.table-select[multiple] option { padding: 0.2rem 0.4rem; border-radius: 4px; }

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Page furniture ---------- */
.page-head { display: flex; align-items: center; gap: 0.9rem; flex-wrap: wrap; margin-bottom: 0.35rem; }
.page-head h1 { margin: 0; }
.page-head .spacer { flex: 1; }
.page-actions { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.meta-line { color: var(--muted); font-size: 0.92rem; margin: 0 0 1.5rem; }

/* .btn-sm kept as an alias so existing markup still works - same size as .btn now */
.btn-sm { min-height: calc(var(--control-h) - 4px); padding: 0.4rem 0.9rem; font-size: 0.9rem; }

textarea {
  width: 100%;
  min-height: 92px;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--field-border);
  border-radius: var(--r-sm);
  background: var(--input-bg);
  font: inherit;
  font-family: var(--body);
  color: inherit;
  resize: vertical;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}
textarea:focus { border-color: var(--pounamu-500); outline: none; }

.status-chip {
  font-family: var(--body);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 0.28rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}
.status-chip.in_progress { border-color: transparent; background: var(--warn-soft); color: var(--warn-text); }
.status-chip.closed { border-color: transparent; background: var(--pounamu-100); color: var(--pounamu-700); }
.status-chip.confirmed { border-color: transparent; background: var(--pounamu-900); color: #fff; }
.status-chip.scheduled { border-color: transparent; background: var(--warn-soft); color: var(--warn-text); }
.status-chip.live { border-color: transparent; background: var(--red-soft); color: var(--red); }
.status-chip.ended { border-color: transparent; background: var(--pounamu-100); color: var(--pounamu-700); }

.lock-note {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 3px solid var(--pounamu-500);
  color: var(--ink);
  font-family: var(--body);
  font-size: 0.92rem;
  border-radius: var(--r-sm);
  padding: 0.65rem 1rem;
  margin-bottom: 1.25rem;
}
.note-icon { width: 18px; height: 18px; flex: none; color: var(--pounamu-500); }

.two-col { display: grid; gap: 1rem; align-items: start; }
@media (min-width: 940px) { .two-col { grid-template-columns: 1.65fr 1fr; } }
.stack { display: flex; flex-direction: column; gap: 1rem; }

tbody tr.rowlink { cursor: pointer; }

/* ---------- Agenda ---------- */
/* flat underline tabs (view switching) - pills stay for toggles */
.tabbar {
  display: flex;
  gap: 0.25rem;
  box-shadow: inset 0 -2px 0 var(--line);
  margin-bottom: 1.25rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabbar::-webkit-scrollbar { display: none; }
.tabbar .tab {
  flex: none;
  border-radius: 8px 8px 0 0;
  background: transparent;
  min-height: calc(var(--control-h) + 2px);
  padding: 0 1.1rem;
  color: var(--muted);
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}
.tabbar .tab:hover { background: var(--paper); color: var(--pounamu-900); }
.tabbar .tab[aria-selected="true"] {
  background: transparent;
  color: var(--pounamu-900);
  font-weight: 600;
  border-bottom-color: var(--pounamu-700);
}

.agenda-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.agenda-list { display: flex; flex-direction: column; gap: 0.75rem; }
.agenda-item {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: var(--glass-edge);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-1);
  padding: 1.05rem 1.25rem;
}
.item-head { display: flex; align-items: center; gap: 0.65rem; }
.item-num { font-family: var(--body); font-weight: 700; color: var(--gold); min-width: 1.5rem; }
.item-num-icon { display: flex; align-items: center; }
.item-num-icon svg { width: 16px; height: 16px; }
.item-title { font-family: var(--body); font-weight: 600; font-size: 1.05rem; flex: 1; }
input.item-title {
  border: 1.5px solid transparent;
  background: transparent;
  min-height: calc(var(--control-h) - 4px);
  padding: 0.2rem 0.5rem;
  border-radius: 8px;
}
input.item-title:hover, input.item-title:focus { border-color: var(--line); background: var(--card); }
.item-tools { display: flex; gap: 0.15rem; }
.icon-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 8px;
  min-width: calc(var(--control-h) - 6px);
  min-height: calc(var(--control-h) - 6px);
  color: var(--muted);
  font-size: 1rem;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.icon-btn:hover { background: var(--paper); color: var(--pounamu-900); }
.item-notes { color: var(--muted); font-size: 0.9rem; margin: 0.35rem 0 0 2.15rem; }
.item-body { margin: 0.7rem 0 0 2.15rem; }
.item-minutes-view { white-space: pre-wrap; margin: 0.4rem 0 0; }

.motion {
  border-left: 3px solid var(--gold);
  background: rgba(201, 154, 59, 0.05);
  padding: 0.75rem 1rem;
  border-radius: 0 12px 12px 0;
  margin-top: 0.7rem;
  font-size: 0.95rem;
}
.motion .verdict { font-family: var(--body); font-weight: 700; letter-spacing: 0.05em; }
.motion .votes { color: var(--muted); font-size: 0.85rem; }

.inline-form {
  background: var(--paper);
  border-radius: 12px;
  padding: 1rem;
  margin-top: 0.7rem;
  display: grid;
  gap: 0.6rem;
}
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
@media (max-width: 560px) { .grid2 { grid-template-columns: 1fr; } }
.form-actions { display: flex; gap: 0.5rem; }

/* ---------- Attendance & tasks ---------- */
.att-row { display: flex; gap: 0.6rem; align-items: center; padding: 0.3rem 0; }
.att-row .name { flex: 1; min-width: 0; overflow-wrap: anywhere; }

/* side-panel attendance (template-less meetings): name on its own line */
#att-list .att-row { flex-wrap: wrap; row-gap: 0.15rem; padding: 0.55rem 0; border-bottom: 1px solid var(--line); }
#att-list .att-row:last-child { border-bottom: none; }
#att-list .att-row .name { flex: 1 1 100%; font-weight: 500; }
#att-list .att-row .icon-btn { margin-left: auto; }

/* attendance inside the Attendance agenda item: calm single-line rows */
.att-embed { max-width: 600px; }
.att-embed-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 0.2rem;
}
.chair-group { display: flex; align-items: center; gap: 0.6rem; }
.chair-group label { margin: 0; flex: none; }
.chair-group input { max-width: 220px; min-height: calc(var(--control-h) - 2px); }
.att-summary { display: flex; align-items: center; gap: 0.6rem; color: var(--muted); font-size: 0.9rem; }
.att-summary .quorum-pill { margin: 0; }
.att-status {
  flex: none;
  border: none;
  cursor: pointer;
  font-family: var(--body);
  font-weight: 600;
  font-size: 0.8rem;
  border-radius: 999px;
  min-height: calc(var(--control-h) - 8px);
  min-width: 92px;
  padding: 0.2rem 0.9rem;
  transition: transform 0.12s var(--ease);
}
.att-status:not(.readonly):active { transform: scale(0.96); }
.att-status.present { background: var(--ok-soft); color: var(--ok-text); }
.att-status.apology { background: var(--warn-soft); color: var(--warn-text); }
.att-status.absent { background: #E9E1D2; color: var(--muted); }
.att-status.readonly { cursor: default; }
.att-embed .att-row { padding: 0.35rem 0; }
.att-embed .att-row .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-embed .seg { flex: none; }
@media (max-width: 640px) {
  .att-embed .att-row { flex-wrap: wrap; row-gap: 0.15rem; }
  .att-embed .att-row .name { flex: 1 1 100%; white-space: normal; }
  .att-embed .att-row .icon-btn { margin-left: auto; }
}
.seg { display: inline-flex; background: var(--paper); border-radius: 999px; padding: 2px; flex: none; }
.seg button {
  border: none;
  background: transparent;
  border-radius: 999px;
  min-height: calc(var(--control-h) - 8px);
  padding: 0 0.75rem;
  font-family: var(--body);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
}
.seg button.on { background: var(--pounamu-900); color: #fff; }
.quorum-pill {
  display: inline-block;
  font-family: var(--body);
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: 999px;
  padding: 0.25rem 0.85rem;
  margin-top: 0.6rem;
}
.quorum-pill.ok { background: var(--ok-soft); color: var(--ok-text); }
.quorum-pill.short { background: var(--red-soft); color: var(--red); }
.quorum-check {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.78rem;
  color: var(--muted);
  cursor: pointer;
  flex: none;
  white-space: nowrap;
}
.quorum-check input { width: 15px; height: 15px; min-height: auto; accent-color: var(--pounamu-700); }
.quorum-excl {
  flex: none;
  font-size: 0.78rem;
  color: var(--muted);
  font-style: italic;
}

.task-row { display: flex; gap: 0.65rem; align-items: flex-start; padding: 0.55rem 0; border-bottom: 1px solid var(--line); }
.task-row:last-child { border-bottom: none; }
.task-row input[type="checkbox"] { width: 22px; height: 22px; min-height: auto; margin-top: 3px; accent-color: var(--pounamu-700); flex: none; }
.task-main { flex: 1; }
.task-meta { color: var(--muted); font-size: 0.85rem; }
.task-done .task-desc { text-decoration: line-through; color: var(--muted); }

/* ---------- Minute-writing: discussion bullets ---------- */
.bullet-list { list-style: none; margin: 0.5rem 0 0; padding: 0; }
/* Direct children only - a discussion point can itself contain a list, and
   those nested <li>s must not pick up the row flex/border of a bullet row
   (that splits bold text into its own narrow column and rules every line). */
.bullet-list > li {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--sand-100, var(--line));
}
.bullet-list > li:last-child { border-bottom: none; }
.bullet-dot { color: var(--gold); font-weight: 700; flex: none; }
.bullet-grip {
  flex: none;
  cursor: grab;
  color: var(--muted);
  user-select: none;
  line-height: 1;
  padding: 0 0.1rem;
  border-radius: 5px;
}
.bullet-grip:active { cursor: grabbing; }
.bullet-grip:hover, .bullet-grip:focus-visible { color: var(--pounamu-700); background: var(--paper); }
.bullet-list > li.dragging { opacity: 0.4; }
.bullet-list > li.drag-over { box-shadow: 0 -2px 0 var(--pounamu-500); }
.bullet-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.bullet-list .bullet-text[tabindex] { cursor: text; border-radius: 6px; padding: 0 0.25rem; }
.bullet-list .bullet-text[tabindex]:hover { background: var(--paper); }
.bullet-tools { display: flex; flex: none; }
.icon-btn-sm { min-width: 30px; min-height: 30px; font-size: 0.85rem; }
.bullet-add { margin-top: 0.6rem; }
.bullet-add textarea, textarea.bullet-edit { min-height: 52px; }
.entry-add { margin-top: 0.7rem; }
.entry-add > select { max-width: 220px; }

/* ---------- Accordion, drag, files, task groups ---------- */
.agenda-item .item-head { cursor: pointer; }
.chevron {
  border: none;
  background: transparent;
  cursor: pointer;
  min-width: calc(var(--control-h) - 6px);
  min-height: calc(var(--control-h) - 6px);
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.95rem;
  transition: transform 0.18s var(--ease);
}
.agenda-item.open .chevron { transform: rotate(180deg); }
.chevron:hover { background: var(--paper); }
.agenda-item .item-body:empty { display: none; }

.drag-handle {
  cursor: grab;
  color: var(--muted);
  flex: none;
  font-size: 0.95rem;
  padding: 0.35rem 0.3rem;
  border-radius: 6px;
  user-select: none;
}
.drag-handle:active { cursor: grabbing; }
.drag-handle:hover, .drag-handle:focus-visible { background: var(--paper); color: var(--pounamu-900); }
.agenda-item.dragging { opacity: 0.4; }
.kaimahi-row.dragging { opacity: 0.4; }
.kaimahi-row.drag-over { box-shadow: 0 -3px 0 var(--pounamu-500); }
.agenda-item.drag-over { box-shadow: 0 -3px 0 var(--pounamu-500); }

.item-counts { flex: none; color: var(--muted); font-size: 0.8rem; letter-spacing: 0.05em; white-space: nowrap; }

.context-edit { margin-bottom: 0.75rem; }
.context-edit label { font-size: 0.85rem; color: var(--muted); }
.context-edit textarea { min-height: 64px; }

.context-blocks label { display: block; margin-bottom: 0.3rem; }
.context-block-row { display: flex; align-items: flex-start; gap: 0.4rem; margin-bottom: 0.4rem; }
.context-block-row .editor-wrap { flex: 1; min-width: 0; }
.context-blocks .btn-link { font-size: 0.85rem; }

.files-wrap { display: flex; flex-wrap: wrap; gap: 0.45rem; align-items: center; margin: 0.4rem 0; }
.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.25rem 0.5rem 0.25rem 0.9rem;
  font-size: 0.85rem;
}
.file-chip a { text-decoration: none; font-weight: 500; }
.file-chip a:hover { text-decoration: underline; }
.file-chip.file-received { background: var(--ok-soft); border-color: transparent; }
.file-received-badge { flex: none; color: var(--ok-text); font-weight: 700; }
.link-chip { border-style: dashed; }
.link-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  width: 100%;
  margin-top: 0.35rem;
}
.link-form input { flex: 1 1 12rem; min-width: 0; }

.item-tasks { margin-top: 0.6rem; }
.task-group {
  font-family: var(--body);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--pounamu-700);
  margin-top: 0.9rem;
}
.task-group:first-child { margin-top: 0; }

/* Housekeeping block: Karakia / Attendance / Confirmation of previous minutes
   need a clear top-level divider so the three read as separate sections */
.hk-section { border-top: 1px solid var(--line); margin-top: 1.2rem; padding-top: 1rem; }
.hk-section:first-child { border-top: none; margin-top: 0; padding-top: 0; }
.hk-section-title {
  font-family: var(--body);
  font-size: 0.86rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--gold);
  margin-bottom: 0.6rem;
}

/* ---------- Editor toolbar & item sub-sections ---------- */
.editor-wrap { display: grid; gap: 0.3rem; flex: 1; min-width: 0; }
.editor-toolbar { display: flex; gap: 0.2rem; }
.fmt-btn {
  min-width: 30px;
  min-height: 28px;
  padding: 0 0.35rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--card);
  cursor: pointer;
  font-size: 0.8rem;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
}
.fmt-btn:hover { background: var(--pounamu-100); border-color: var(--pounamu-500); }

/* text-link styled button - looks like a hyperlink, acts like a button */
.btn-link {
  border: none;
  background: none;
  padding: 0.15rem 0;
  color: var(--pounamu-700);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}
.btn-link:hover { color: var(--pounamu-500); text-decoration: underline; }

.stream-meta-row { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.stream-chat-list { max-height: 280px; overflow-y: auto; display: flex; flex-direction: column; gap: 0.5rem; padding-top: 0.5rem; }

.sub-acc { border-top: 1px solid var(--line); margin-top: 0.8rem; }
.sub-acc-head {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: none;
  background: transparent;
  min-height: var(--control-h);
  padding: 0.25rem 0.35rem;
  cursor: pointer;
  font-family: var(--body);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--pounamu-700);
  border-radius: 8px;
}
.sub-acc-head:hover { background: var(--paper); }
.sub-acc-chev { transition: transform 0.18s var(--ease); color: var(--muted); }
.sub-acc.open .sub-acc-chev { transform: rotate(180deg); }
.sub-acc > div { padding-bottom: 0.5rem; }

.rich-editor {
  min-height: 96px;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--field-border);
  border-radius: var(--r-sm);
  background: var(--input-bg);
  font-family: var(--body);
  line-height: 1.55;
  overflow-wrap: anywhere;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}
.rich-editor.compact { min-height: 56px; }
.rich-editor:focus { border-color: var(--pounamu-500); outline: none; }
.rich-editor:empty::before { content: attr(data-placeholder); color: var(--ink-400, var(--muted)); pointer-events: none; }
.rich-editor ul, .rich-editor ol { margin: 0.2rem 0 0.3rem; padding-left: 1.5rem; }
.rich-editor blockquote { margin: 0 0 0 1.25rem; border: none; padding: 0; }
.bullet-list .editor-wrap { flex: 1; min-width: 0; }
.bullet-text .rt-p { margin: 0; }
.bullet-text .rt-p + .rt-p { margin-top: 0.15rem; }

.addr-wrap { position: relative; }
.addr-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(18, 36, 31, 0.16);
  max-height: 230px;
  overflow-y: auto;
}
.addr-menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.65rem 0.95rem;
  border: none;
  background: none;
  cursor: pointer;
  font: inherit;
}
.addr-menu button:hover { background: var(--paper); }

/* rendered rich text blocks */
.rt-p { margin: 0 0 0.3rem; }
.rt-gap { height: 0.55rem; }
.rt-list { margin: 0.2rem 0 0.45rem; padding-left: 1.4rem; }
.rt-list li { margin-bottom: 0.15rem; }
.motion-text .rt-p { margin: 0.1rem 0; }
.item-notes .rt-p { margin: 0 0 0.2rem; }
.doc-motion-lead { margin: 0 0 0.25rem; font-weight: 600; }

.presenter-input {
  display: block;
  width: 100%;
  max-width: 320px;
  min-height: calc(var(--control-h) - 8px);
  font-size: 0.85rem;
  border: 1.5px solid transparent;
  background: transparent;
  padding: 0.1rem 0.5rem;
  border-radius: 8px;
  color: var(--muted);
}
.presenter-input:hover, .presenter-input:focus { border-color: var(--line); background: var(--card); }
.presenter-line { color: var(--muted); font-size: 0.85rem; }

.tag-input {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  min-height: var(--control-h);
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--field-border);
  border-radius: var(--r-sm);
  background: var(--input-bg);
}
.tag-input:focus-within { border-color: var(--pounamu-500); }
.tag-input input {
  flex: 1 1 80px;
  min-width: 80px;
  min-height: auto;
  border: none;
  padding: 0.15rem 0;
  background: transparent;
}
.tag-input input:focus { border: none; }
.tag-chips { display: contents; }
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
  background: var(--pounamu-100, var(--ok-soft));
  color: var(--pounamu-700, var(--ok-text));
  border-radius: 999px;
  padding: 0.2rem 0.4rem 0.2rem 0.65rem;
  white-space: nowrap;
}
.tag-chip button {
  border: none;
  background: none;
  color: inherit;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  opacity: 0.7;
}
.tag-chip button:hover { opacity: 1; }

.agenda-item.deferred { opacity: 0.7; border-style: dashed; border-color: var(--line-strong); }
.agenda-item.note-block {
  background: rgba(201, 154, 59, 0.06);
  border-left: 3px solid var(--gold);
}
.defer-badge {
  flex: none;
  font-family: var(--body);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.18rem 0.7rem;
  border-radius: 999px;
  background: var(--warn-soft);
  color: var(--warn-text);
}
.received-badge {
  flex: none;
  font-family: var(--body);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.18rem 0.7rem;
  border-radius: 999px;
  background: var(--ok-soft);
  color: var(--ok-text);
}

#chair-row { gap: 0.75rem; margin-bottom: 0.5rem; }
#chair-row label { font-size: 0.92rem; }

/* ---------- Website editor ---------- */
.switch-row { display: flex; align-items: flex-start; gap: 0.75rem; margin: 0; cursor: pointer; }
.switch-row input[type="checkbox"] { width: 22px; height: 22px; min-height: auto; margin-top: 2px; accent-color: var(--pounamu-700); flex: none; }
.switch-row .hint { font-weight: 400; }
.addr-line { font-family: var(--body); font-size: 0.88rem; color: var(--pounamu-700); margin: 0.85rem 0 0; }
.check-line { display: flex; align-items: center; gap: 0.6rem; margin: 0; font-weight: 400; }
.check-line input[type="checkbox"] { width: 20px; height: 20px; min-height: auto; accent-color: var(--pounamu-700); flex: none; }
.save-note { color: var(--ok-text); font-family: var(--body); font-weight: 600; font-size: 0.9rem; align-self: center; }

.media-slot { display: flex; flex-direction: column; gap: 0.6rem; align-items: flex-start; }
.media-preview {
  max-width: 100%; width: 240px; aspect-ratio: 16 / 9; object-fit: cover;
  border-radius: var(--r-sm); background: var(--field); border: 1px solid var(--line);
}
.media-actions { display: flex; align-items: center; gap: 0.6rem; }

/* Kaimahi photo framing: drag inside the circle, zoom beside it. */
.photo-framer { display: grid; grid-template-columns: auto 1fr; gap: 0.6rem 1.25rem; align-items: center; }
.photo-framer > .hint { grid-column: 1 / -1; margin: 0; }
.framer-circle {
  position: relative;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--paper);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
  cursor: grab;
  touch-action: none;
}
.framer-circle:active { cursor: grabbing; }
.framer-circle:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.framer-circle img, .framer-mini img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  user-select: none;
}
.framer-side { display: grid; gap: 0.45rem; justify-items: start; }
.framer-side .hint { margin: 0; }
.framer-mini { width: 84px; height: 84px; border-radius: 50%; overflow: hidden; background: var(--paper); }
.framer-zoom { display: grid; gap: 0.25rem; font-size: 0.85rem; font-weight: 600; }
.framer-zoom input { width: 160px; accent-color: var(--pounamu-700); }
.img-insert { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin-top: 0.5rem; }
.img-insert .hint { margin: 0; }

.list-row { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.25rem; }
.list-main { flex: 1; min-width: 0; }
.list-title { font-family: var(--body); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-meta { display: flex; align-items: center; gap: 0.5rem; color: var(--muted); font-size: 0.85rem; margin-top: 0.15rem; }
.list-tools { display: flex; align-items: center; gap: 0.5rem; flex: none; }

.msg-card { padding: 1.1rem 1.25rem; }
.msg-card.msg-handled { opacity: 0.62; }
.msg-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.msg-email { font-size: 0.9rem; }
.msg-body { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0.5rem 0 0.85rem; }

/* ---------- Unified calendar ---------- */
.cal-toolbar { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.cal-toolbar h1 { margin: 0; text-transform: capitalize; }
.cal-nav {
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 1.3rem;
  line-height: 1;
  color: var(--pounamu-900);
}
.cal-nav:hover { background: var(--pounamu-100); border-color: var(--pounamu-500); }
.cal-legend { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; margin-bottom: 1rem; font-size: 0.85rem; color: var(--muted); }
.cal-legend > span { display: inline-flex; align-items: center; gap: 0.4rem; }
.cal-legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.dot-hui { background: var(--pounamu-700); }
.dot-event { background: var(--gold-act); }
.cal-card { padding: 1rem; }
.cal-card .cal-grid + .cal-grid { margin-top: 2px; }
.cal-chip { text-decoration: none; cursor: pointer; }
.cal-chip:hover { filter: brightness(0.95); }
.cal-hui { background: var(--pounamu-100); color: var(--pounamu-700); }
.cal-event { background: rgba(201, 154, 59, 0.16); color: var(--gold-text); }
.cal-addable { cursor: pointer; }
.cal-menu {
  position: fixed;
  z-index: 70;
  min-width: 190px;
  padding: 0.4rem;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: var(--glass-edge);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-2);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.cal-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0.6rem 0.8rem;
  border-radius: var(--r-sm);
  text-decoration: none;
  color: var(--ink);
  font-family: var(--body);
  font-weight: 500;
  font-size: 0.9rem;
}
.cal-menu-item:hover { background: #fff; color: var(--pounamu-700); }
@media (max-width: 620px) {
  .cal-cell { min-height: 58px; }
  .cal-chip { font-size: 0.68rem; }
}

/* ---------- Events ---------- */
.event-head { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.event-title { font-size: 1.15rem; margin: 0; }
.event-past { opacity: 0.62; }
.event-summary { display: flex; align-items: center; gap: 0.9rem; flex-wrap: wrap; }
.event-count { font-family: var(--body); font-weight: 600; font-size: 0.88rem; color: var(--pounamu-700); }
.event-count.strong { color: var(--gold-text); }
.event-count.muted { color: var(--muted); font-weight: 500; }
.event-responses { border-top: 1px solid var(--line); padding-top: 0.75rem; margin-top: 0.25rem; }
.status-chip.evt-wananga { border-color: transparent; background: var(--pounamu-100); color: var(--pounamu-700); }
.status-chip.evt-working_bee { border-color: transparent; background: var(--ok-soft); color: var(--ok-text); }
.status-chip.evt-hui_a_iwi { border-color: transparent; background: var(--warn-soft); color: var(--warn-text); }
.status-chip.evt-tangihanga { border-color: transparent; background: #E9E1D2; color: var(--muted); }
.status-chip.evt-celebration { border-color: transparent; background: rgba(201, 154, 59, 0.16); color: var(--gold-text); }
.status-chip.evt-general { border-color: var(--line); color: var(--muted); }

/* ---------- Member portal ---------- */
.portal-greeting { font-size: 1.4rem; font-weight: 700; margin: 1rem 0 1.75rem; }
.panui-row { padding: 0; overflow: hidden; }
.panui-head {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  background: transparent; border: none; cursor: pointer; padding: 1.1rem 1.25rem; text-align: left; font: inherit;
}
.panui-head:hover { background: var(--paper); }
.panui-body { white-space: pre-wrap; overflow-wrap: anywhere; padding: 0 1.25rem 1.25rem; color: var(--muted); }
.minute-item { padding: 0.9rem 0; border-bottom: 1px solid var(--line); }
.minute-item:last-child { border-bottom: none; }
.minute-item h3 { font-size: 1.02rem; margin-bottom: 0.35rem; }
.minute-text { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--muted); margin: 0 0 0.6rem; }
.comment {
  background: var(--field); border-radius: var(--r-sm); padding: 0.6rem 0.85rem; margin: 0.4rem 0;
}
.comment-meta { font-family: var(--body); font-size: 0.78rem; color: var(--muted); margin-bottom: 0.2rem; }
.comment .btn-link { font-size: 0.8rem; margin-top: 0.25rem; }
.comment-form { display: flex; gap: 0.5rem; align-items: flex-start; margin-top: 0.5rem; }
.comment-form textarea { min-height: 44px; }

.votes-inputs { display: flex; gap: 0.5rem; }
.vote-cell { flex: 1; margin: 0; }
.vote-cell span {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 0.2rem;
}
.vote-cell input { min-width: 0; width: 100%; }

/* ---------- Registry ---------- */
.filter-row {
  display: flex;
  gap: 0.9rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.status-chip.reg-pending { border-color: transparent; background: var(--warn-soft); color: var(--warn-text); }
.status-chip.reg-verified { border-color: transparent; background: var(--ok-soft); color: var(--ok-text); }
.status-chip.reg-declined { border-color: transparent; background: var(--red-soft); color: var(--red); }
.status-chip.reg-deceased { border-color: transparent; background: #E9E1D2; color: var(--muted); }
#link-results .att-row { border-top: 1px dashed var(--line); }
#parents-list:empty::after, #children-list:empty::after {
  content: "-";
  color: var(--muted);
  font-size: 0.9rem;
}

/* ---------- Documents ---------- */
.docs-layout { display: grid; gap: 1rem; align-items: start; }
@media (min-width: 880px) { .docs-layout { grid-template-columns: 280px 1fr; } }
.tree-row { display: flex; align-items: center; border-radius: 8px; }
.tree-row.on { background: var(--pounamu-100); }
.tree-name {
  flex: 1;
  min-width: 0;
  text-align: left;
  border: none;
  background: transparent;
  cursor: pointer;
  min-height: calc(var(--control-h) - 2px);
  padding: 0.25rem 0.5rem;
  border-radius: 8px;
  font-family: var(--body);
  font-weight: 500;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.tree-icon { width: 16px; height: 16px; flex: none; color: var(--muted); }
.tree-row.on .tree-name { color: var(--pounamu-900); }
.tree-name:hover { background: var(--paper); }
.drop-hint {
  display: none;
  border: 2px dashed var(--pounamu-500);
  border-radius: var(--r-sm);
  padding: 0.9rem;
  text-align: center;
  color: var(--pounamu-700);
  font-family: var(--body);
  font-weight: 500;
  margin-bottom: 0.75rem;
}
#doc-list-card.drop-active .drop-hint { display: block; }
#doc-list-card.drop-active { border-color: var(--pounamu-500); }
.doc-detail { padding: 0.5rem 0 1rem; }
.doc-detail .inline-form { margin-top: 0.75rem; }
.versions { margin-top: 0.75rem; }
.status-chip.acc-public { border-color: transparent; background: var(--gold-act); color: #fff; }
.status-chip.acc-members { border-color: transparent; background: var(--ok-soft); color: var(--ok-text); }
.status-chip.acc-trustees { border-color: transparent; background: var(--pounamu-100); color: var(--pounamu-500); }
.status-chip.acc-admins { border-color: transparent; background: var(--red-soft); color: var(--red); }

.status-chip.pn-draft { border-color: var(--line); }
.status-chip.pn-sending { border-color: transparent; background: var(--warn-soft); color: var(--warn-text); }
.status-chip.pn-sent { border-color: transparent; background: var(--ok-soft); color: var(--ok-text); }
.status-chip.pn-failed { border-color: transparent; background: var(--red-soft); color: var(--red); }

.export-card {
  margin-top: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  justify-content: space-between;
  border-left: 4px solid var(--gold);
}

/* ---------- Minutes document ---------- */
.minutes-page { background: var(--paper); }
.minutes-toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  max-width: 820px;
  margin: 0 auto;
  padding: 1rem 1.25rem 0;
}
.minutes-toolbar .spacer { flex: 1; }
.minutes-doc {
  max-width: 820px;
  margin: 1rem auto 4rem;
  background: var(--card);
  border: none;
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  padding: 2.5rem clamp(1.25rem, 5vw, 3rem);
}
.doc-brand { display: flex; align-items: center; gap: 0.8rem; margin-bottom: 1.5rem; }
.doc-brand .mark { color: var(--pounamu-900); width: 38px; height: 38px; }
/* org logo: bounded box, any aspect ratio, never upscaled past its own size */
.doc-logo { max-height: 56px; max-width: 180px; width: auto; height: auto; flex: none; }
.doc-org { font-family: var(--body); font-weight: 700; font-size: 1.05rem; color: var(--pounamu-900); }
.doc-kind {
  font-family: var(--body);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.minutes-doc h1 { font-size: clamp(1.6rem, 3.5vw, 2.1rem); margin-bottom: 0.35rem; }
.doc-meta { color: var(--muted); margin-bottom: 0.9rem; }
.doc-status {
  display: inline-block;
  font-family: var(--body);
  font-weight: 600;
  font-size: 0.85rem;
  border-radius: 999px;
  padding: 0.3rem 1rem;
  margin-bottom: 1.25rem;
}
.doc-status.confirmed { background: var(--ok-soft); color: var(--ok-text); }
.doc-status.draft { background: var(--warn-soft); color: var(--warn-text); }
.doc-attendance {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.25rem 1.25rem;
  margin: 0 0 0.5rem;
  padding: 1rem 0;
  border-top: 2px solid var(--pounamu-900);
  border-bottom: 1px solid var(--line);
  font-size: 0.95rem;
}
.doc-attendance dt { font-family: var(--body); font-weight: 600; color: var(--pounamu-900); }
.doc-attendance dd { margin: 0; }
.doc-item { padding: 1.4rem 0 0.4rem; border-bottom: 1px solid var(--line); }
.doc-item:last-child { border-bottom: none; }
.doc-item h2 { font-size: 1.15rem; margin-bottom: 0.3rem; }
.doc-num { color: var(--gold); margin-right: 0.15rem; }
.doc-presenter, .doc-context { color: var(--muted); font-size: 0.92rem; margin: 0 0 0.5rem; white-space: pre-wrap; }
.doc-deferred {
  background: var(--warn-soft);
  border-left: 3px solid var(--warn-text);
  padding: 0.4rem 0.9rem;
  border-radius: 0 8px 8px 0;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--warn-text);
}
.doc-received {
  background: var(--ok-soft);
  border-left: 3px solid var(--ok-text);
  padding: 0.4rem 0.9rem;
  border-radius: 0 8px 8px 0;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--ok-text);
}
.doc-bullets { margin: 0.4rem 0 0.8rem; padding-left: 1.3rem; }
.doc-bullets li { margin-bottom: 0.3rem; }
/* a discussion point is itself rich text - keep its paragraphs and nested
   lists tight inside the parent bullet rather than spaced like top-level blocks */
.doc-bullets li > .rt-p { margin: 0; }
.doc-bullets li > .rt-p + .rt-p { margin-top: 0.2rem; }
.doc-bullets li > .rt-list { margin: 0.15rem 0 0.25rem; }
.doc-note {
  background: rgba(201, 154, 59, 0.07);
  border-left: 3px solid var(--gold);
  border-radius: 0 10px 10px 0;
  padding: 0.8rem 1.1rem;
  margin: 1rem 0;
}
.doc-note p { margin: 0.3rem 0 0; white-space: pre-wrap; }
.doc-motion {
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  border-radius: 0 10px 10px 0;
  padding: 0.8rem 1.1rem;
  margin: 0.7rem 0;
  break-inside: avoid;
}
.doc-motion p { margin: 0 0 0.4rem; }
.doc-verdict-row { display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap; }
.doc-verdict {
  font-family: var(--body);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  border-radius: 999px;
  padding: 0.15rem 0.75rem;
}
.doc-verdict.v-carried { background: var(--ok-soft); color: var(--ok-text); }
.doc-verdict.v-lost { background: var(--red-soft); color: var(--red); }
.doc-verdict.v-lapsed, .doc-verdict.v-withdrawn, .doc-verdict.v-pending { background: var(--paper); color: var(--muted); }
.doc-votes { color: var(--muted); font-size: 0.85rem; }
.doc-actions-label {
  font-family: var(--body);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--pounamu-700);
  margin: 0.7rem 0 0.25rem;
}
.doc-actions { margin: 0 0 0.6rem; padding-left: 1.3rem; }
/* .doc-note p sets its own margins - match its specificity so headings win */
.doc-sub, .doc-note .doc-sub {
  font-family: var(--body);
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--pounamu-900);
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.2rem;
  margin: 0.9rem 0 0.4rem;
}
.doc-sub-nested, .doc-note .doc-sub-nested {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--pounamu-700);
  border-bottom: none;
  margin: 0.7rem 0 0.15rem;
}
.doc-note > .doc-sub:first-of-type { margin-top: 0.6rem; }

.doc-files li { margin-bottom: 0.2rem; }
.doc-link-url { color: var(--muted); font-size: 0.8rem; word-break: break-all; }
.doc-files a { color: var(--pounamu-700); text-decoration: none; font-weight: 500; }
.doc-files a:hover { text-decoration: underline; }
@media print {
  /* on paper a link is just the paper's name - the record of what was tabled */
  .doc-files a { color: inherit; font-weight: 600; }
}
.doc-chip {
  font-size: 0.78rem;
  background: var(--pounamu-100);
  color: var(--pounamu-700);
  border-radius: 999px;
  padding: 0.05rem 0.6rem;
  white-space: nowrap;
}
.doc-chip-received { background: var(--ok-soft); color: var(--ok-text); }
.doc-confirm { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 2px solid var(--pounamu-900); break-inside: avoid; }
.doc-confirm-text { font-size: 0.95rem; margin-bottom: 2.2rem; }
.sig { max-width: 340px; margin-bottom: 1.8rem; }
.sig-line { border-bottom: 1.5px solid var(--ink); height: 2rem; }
.sig-label { font-family: var(--body); font-size: 0.85rem; color: var(--muted); margin-top: 0.3rem; }

/* Pagination - deliberately NOT inside @media print. Paged.js lays the
   document out on screen to number the pages, so print-only rules never reach
   it; these properties have no effect on continuous media anyway.

   Agenda items and housekeeping blocks flow across pages: keeping a long item
   whole pushes it to a fresh page and leaves half a page blank. Only small,
   self-contained units stay unbroken. */
.doc-item, .doc-note { break-inside: auto; }
.doc-motion, .sig, .doc-confirm { break-inside: avoid; }
/* …but never strand a heading, label or single line at a page edge */
.doc-item h2, .doc-sub, .doc-actions-label { break-after: avoid; }
.doc-item, .doc-note, .doc-context, .doc-bullets li, .rt-p { orphans: 2; widows: 2; }

/* Page furniture. Browsers ignore the margin boxes (unsupported), Paged.js
   renders them - so page numbers appear via the Print button, and a direct
   Ctrl+P still produces a sane unnumbered document. */
@page {
  size: A4;
  margin: 18mm 16mm 20mm;
  @bottom-left {
    content: string(doc-hui);
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 8.5pt;
    color: #6B6F6C;
  }
  @bottom-right {
    /* counter(page) is per-page and reliable; the total comes from
       --doc-pages, which the print flow sets once pagination has finished
       (paged.js's own counter(pages) only lands at the end of its render
       loop, which is too late to depend on) */
    content: "Page " counter(page) var(--doc-pages, "");
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 8.5pt;
    color: #6B6F6C;
  }
}
/* first page carries the full header already - no running footer title */
@page :first { @bottom-left { content: ""; } }
.minutes-doc h1 { string-set: doc-hui content(text); }

@media print {
  .minutes-page { background: #fff; }
  .minutes-doc { border: none; margin: 0; max-width: none; padding: 0; }
  /* the canvas wash is screen atmosphere - minutes print on plain paper */
  body::before { display: none; }
}
/* Paged.js forces print-color-adjust: exact, which would otherwise carry the
   wash and canvas tint onto every printed page. */
html.paged-print,
html.paged-print body,
html.paged-print .pagedjs_pages,
html.paged-print .pagedjs_page,
html.paged-print .pagedjs_pagebox { background: #fff; }
html.paged-print body::before { display: none; }
/* Same, but while Paged.js is laying the document out (it measures on screen,
   so the card's padding and max-width would be baked into the pagination) */
.pagedjs_page .minutes-doc {
  border: none;
  margin: 0;
  max-width: none;
  padding: 0;
  background: none;
  box-shadow: none;
}

/* ---------- Stat tiles & condition bar ---------- */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.9rem;
  margin-bottom: 1rem;
}
.stat-tile {
  position: relative;
  border-radius: var(--r-md);
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-1);
  padding: 0.9rem 1.1rem 1rem;
  --tile-accent: var(--line-strong);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  color: var(--ink);
  text-decoration: none;
}
a.stat-tile:hover { border-color: var(--field-border); box-shadow: var(--shadow-2); }
.stat-tile.tile-pounamu { --tile-accent: var(--pounamu-700); }
.stat-tile.tile-gold { --tile-accent: var(--gold); }
.stat-tile.tile-sage { --tile-accent: var(--sage-500); }
.stat-tile .num {
  order: 2;
  font-family: var(--body);
  font-weight: 650;
  font-size: var(--fs-stat);
  letter-spacing: -0.02em;
  color: var(--ink);
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.stat-tile .num.warn { color: var(--warn-text); }
.stat-tile .lbl { order: 1; display: flex; align-items: center; gap: 0.45rem; font-size: 0.82rem; font-weight: 500; color: var(--muted); margin-bottom: 0.25rem; }
.stat-tile .lbl::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--tile-accent); flex: none; }
.stat-tile .lbl .flag {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold);
  display: inline-block;
  flex: none;
}

.cond-bar { display: flex; gap: 2px; height: 14px; margin: 0.4rem 0 0.55rem; }
.cond-bar div { border-radius: 4px; min-width: 6px; }
.cond-legend { display: flex; gap: 1rem; flex-wrap: wrap; font-size: 0.82rem; color: var(--muted); }
.cond-legend span { display: inline-flex; align-items: center; gap: 0.35rem; }
.cond-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* ---------- Calendar grid ---------- */
.cal-head { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }
.cal-head h3 { margin: 0; flex: 1; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-dow {
  font-family: var(--body);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  text-align: center;
  padding: 0.2rem 0;
}
.cal-cell {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 72px;
  padding: 0.25rem 0.3rem;
  font-size: 0.75rem;
  overflow: hidden;
}
.cal-cell.out { background: transparent; border-color: transparent; }
.cal-cell.today { border: 2px solid var(--pounamu-700); }
.cal-day { color: var(--muted); font-size: 0.7rem; }
.cal-chip {
  display: block;
  border-radius: 4px;
  padding: 0 0.3rem;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
}

/* ---------- Dashboard summary ---------- */
a.stat-tile { color: inherit; text-decoration: none; transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease); }
a.stat-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); }

/* Dashboard: greeting, stat tiles, then the day-to-day column beside a side
   column (calendar, export) - the side drops below on narrower screens */
.dash-head { margin-bottom: 1.25rem; }
.dash-head .meta-line { margin: 0.2rem 0 0; }
.dash-layout { display: grid; gap: 1rem; align-items: start; margin-bottom: 1.75rem; }
.dash-layout > * { min-width: 0; }
@media (min-width: 1080px) { .dash-layout { grid-template-columns: minmax(0, 1fr) 320px; } }
.dash-side { display: flex; flex-direction: column; gap: 1rem; }

.dash-cal { display: flex; flex-direction: column; }
.dash-cal-head { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 1rem; }
.dash-cal-head h2 {
  flex: 1;
  min-width: 0;
  text-align: center;
  font-family: var(--body);
  font-weight: 600;
  font-size: 1.05rem;
  margin: 0;
  color: var(--pounamu-900);
  text-transform: capitalize;
}
.dash-cal-head button {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--card);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--pounamu-700);
  cursor: pointer;
  flex: none;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
}
.dash-cal-head button:hover { background: var(--field); border-color: var(--line-strong); }
.dash-cal-head button svg { width: 16px; height: 16px; }
.dash-cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; flex: 1; min-width: 0; }
.dash-cal-dow {
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  text-align: center;
  padding-bottom: 0.5rem;
}
.dash-cal-day {
  position: relative;
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border-radius: 10px;
  font-size: 0.82rem;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.dash-cal-day.out { color: var(--muted); opacity: 0.4; }
.dash-cal-day.today { background: var(--pounamu-900); color: #fff; font-weight: 700; }
.dash-cal-day .dots { display: flex; gap: 3px; height: 4px; }
.dash-cal-day .dots i { width: 4px; height: 4px; border-radius: 50%; display: block; background: var(--pounamu-700); }
.dash-cal-day.today .dots i { background: #fff; }

.dash-cols { display: flex; flex-direction: column; gap: 1rem; }
.dash-mytasks { border-left: 3px solid var(--gold); }
.dash-card h2 { font-size: 1.05rem; margin-bottom: 0.5rem; }
.dash-card {
  background: var(--card);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: 1px solid var(--line);
}
.dash-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding: 0.5rem 0.3rem;
  margin: 0 -0.3rem;
  border-radius: 12px;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: var(--ink);
  transition: background 0.15s var(--ease);
}
.dash-row:last-of-type { border-bottom: none; }
.dash-row:hover { background: var(--field); }
.dash-row:hover .dash-row-title { text-decoration: underline; }
.dash-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  color: var(--pounamu-700);
  background: var(--pounamu-100);
}
.dash-avatar svg { width: 18px; height: 18px; }
.dash-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dash-row-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-when { font-family: var(--body); font-weight: 500; font-size: 0.8rem; color: var(--muted); white-space: nowrap; }
.dash-chevron { flex: none; width: 16px; height: 16px; color: var(--line-strong); opacity: 0.7; }
.dash-add {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--line);
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--pounamu-700);
  text-decoration: none;
}
.dash-add:hover { color: var(--pounamu-900); }
.dash-add-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  line-height: 1;
  flex: none;
}
.update-row { padding: 0.55rem 0; border-bottom: 1px solid var(--line); }
.update-row:last-child { border-bottom: none; }
.update-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.update-meta { font-size: 0.8rem; color: var(--muted); margin-top: 0.15rem; }

.export-card {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  margin-top: 0;
  border-left: none;
  border-radius: var(--r-lg);
  background: linear-gradient(165deg, var(--pounamu-700), var(--pounamu-950));
  color: var(--paper);
  flex-direction: column;
  align-items: flex-start;
  gap: 1.1rem;
  box-shadow: var(--shadow-2);
  align-self: start;
}
.export-card h2 { font-family: var(--body); font-weight: 600; font-size: 1.1rem; color: #fff; margin: 0 0 0.4rem; }
.export-card .hint { color: rgba(250, 247, 241, 0.78) !important; }
.export-card .btn-quiet { background: #fff; color: var(--pounamu-900); border: none; box-shadow: none; }
.export-card .btn-quiet:hover { background: var(--sand); }
.export-icon {
  position: absolute;
  z-index: -1;
  right: -24px;
  bottom: -24px;
  width: 190px;
  height: 190px;
  color: #fff;
  opacity: 0.08;
  pointer-events: none;
}

/* ---------- Previous minutes panel (confirmation block) ---------- */
.prev-minutes {
  background: var(--paper);
  border: 1px solid var(--line);
  border-left: 3px solid var(--pounamu-700);
  border-radius: 0 10px 10px 0;
  padding: 0.85rem 1rem;
  margin-bottom: 0.8rem;
}
.prev-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 0.4rem; }
.prev-head span { font-weight: 600; }
.prev-matters { margin: 0.6rem 0 0; font-style: italic; }

/* ---------- QR labels ---------- */
.qr-sheet { max-width: 480px; margin: 1rem auto 3rem; padding: 0 1rem; }
.qr-card {
  background: #fff;
  border: 2px solid var(--pounamu-900);
  border-radius: var(--r-md);
  padding: 1.75rem;
  text-align: center;
}
.qr-card .doc-brand { justify-content: center; text-align: left; }
.qr-card img { width: min(320px, 80%); image-rendering: pixelated; margin: 0.5rem 0; }
.qr-card h1 { font-size: 1.4rem; margin: 0.25rem 0 0.2rem; }
@media print {
  .qr-sheet { margin: 0 auto; }
  .qr-card { break-inside: avoid; }
}

/* ---------- Print: clean minutes document ---------- */
.print-only { display: none; }
@media print {
  .topbar, .nav, .no-print { display: none !important; }
  body { background: #fff; }
  body.has-chrome { padding-left: 0 !important; }
  main { max-width: none; padding: 0; }
  .card, .agenda-item { border: none; padding: 0.4rem 0; }
  .agenda-item { break-inside: avoid; }
  .btn, textarea, .chevron, .drag-handle { display: none; }
  .motion { background: none; break-inside: avoid; }
  .print-only { display: block; }
  #print-head { border-bottom: 2px solid var(--pounamu-900); padding-bottom: 0.75rem; margin-bottom: 1.25rem; }
  .print-org { font-family: var(--body); font-weight: 700; font-size: 1.1rem; color: var(--pounamu-900); margin-bottom: 0.4rem; }
  .print-row { font-size: 0.92rem; padding: 0.1rem 0; }
  #att-card, #chair-row { display: none; }
  .status-chip { border: 1px solid #999; }
  .bullet-list > li { border-bottom: none; padding: 0.15rem 0; }
}

/* ---------- Account settings page ---------- */
.settings-shell { max-width: 620px; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }
.settings-title { font-size: 1.5rem; margin: 1.25rem 0 1.25rem; }
.settings-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.settings-section { padding: 1.25rem 1.5rem; }
.settings-section + .settings-section { border-top: 1px solid var(--line); }
.settings-section h2 { font-size: 0.88rem; font-weight: 600; margin: 0 0 1rem; }
.settings-field { max-width: 480px; }
.settings-field + .settings-field { margin-top: 1.1rem; }
.settings-field > label { font-size: 0.82rem; font-weight: 600; margin-bottom: 0.3rem; }
.settings-field-hint { font-size: 0.76rem; color: var(--muted); margin: -0.15rem 0 0.55rem; font-weight: 400; }
.settings-field-control { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.settings-field-control input { flex: 1 1 180px; min-width: 160px; }
.settings-field-value { font-size: 0.88rem; color: var(--ink); margin: 0; }
.avatar-row { display: flex; align-items: center; gap: 1rem; }
.avatar-preview {
  width: 64px; height: 64px; border-radius: 50%; object-fit: cover;
  background: var(--field); border: 1px solid var(--line);
}
.avatar-preview-empty {
  width: 64px; height: 64px; border-radius: 50%;
  background: linear-gradient(135deg, var(--pounamu-700), var(--pounamu-900));
  color: #fff; display: grid; place-items: center;
  font-family: var(--body); font-weight: 600; font-size: 1.1rem; letter-spacing: 0.02em;
}

/* ---------- Dialogs (js/dialog.js - replaces confirm/alert/prompt) ---------- */
.app-dialog {
  width: min(440px, calc(100vw - 2rem));
  padding: 1.6rem 1.6rem 1.3rem;
  border: none;
  border-radius: var(--r-md);
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow-2);
}
.app-dialog::backdrop { background: rgba(18, 36, 31, 0.45); backdrop-filter: blur(2px); }
.app-dialog[open] { animation: app-dialog-in 0.18s var(--ease); }
@keyframes app-dialog-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
.app-dialog-title { font-size: var(--fs-h2); margin-bottom: 0.5rem; }
.app-dialog-message { margin: 0 0 1.2rem; white-space: pre-line; }
.app-dialog-input {
  width: 100%;
  min-height: var(--control-h);
  margin: -0.4rem 0 1.2rem;
  padding: 0.5rem 0.8rem;
  border: 1px solid var(--field-border);
  border-radius: var(--r-sm);
  background: var(--input-bg);
}
.app-dialog-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 0.6rem; }
.app-dialog-danger { background: var(--red-fill); }
.app-dialog-danger:hover { background: var(--red); box-shadow: 0 6px 18px rgba(163, 40, 32, 0.28); }
.app-toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  z-index: 1000;
  padding: 0.6rem 1.2rem;
  border-radius: 999px;
  background: var(--pounamu-950);
  color: #fff;
  box-shadow: var(--shadow-2);
  opacity: 0;
  transform: translate(-50%, 8px);
  pointer-events: none;
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
}
.app-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Request progress bar (js/api.js) ---------- */
.app-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1001;
  height: 3px;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--gold) 40%, var(--pounamu-500) 60%, transparent);
  background-size: 50% 100%;
  background-repeat: no-repeat;
  opacity: 0;
  transition: opacity 0.2s var(--ease);
}
.app-progress.active { opacity: 1; animation: app-progress 1.1s linear infinite; }
@keyframes app-progress { from { background-position: -50% 0; } to { background-position: 150% 0; } }

/* ---------- Website editor: body preview (js/post-body.js) ---------- */
.body-preview {
  margin-top: 0.6rem;
  padding: 1rem 1.2rem;
  border: 1px dashed var(--field-border);
  border-radius: var(--r-sm);
  background: var(--paper);
  max-width: 68ch;
}
.body-preview h3 { margin: 1rem 0 0.4rem; }
.body-preview img { max-width: 100%; height: auto; border-radius: 6px; margin: 0.4rem 0; }
.body-preview p:last-child { margin-bottom: 0; }

/* ---------- Empty states (js/empty-state.js) ---------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 2.5rem 1.5rem 2.75rem;
}
.empty-icon {
  width: 44px;
  height: 44px;
  padding: 10px;
  margin-bottom: 0.9rem;
  border-radius: 12px;
  background: var(--pounamu-100);
  color: var(--pounamu-700);
  stroke-width: 1.75;
}
.empty-title { font-size: 1.05rem; font-weight: 600; margin: 0 0 0.35rem; }
.empty-text { max-width: 44ch; margin: 0 0 1.1rem; color: var(--muted); font-size: 0.92rem; }
.empty-filtered { display: none; margin: 0; color: var(--muted); }
.empty-state.is-filtered > :not(.empty-filtered) { display: none; }
.empty-state.is-filtered > .empty-filtered { display: block; }
/* standalone lists (not in a card) get the card look */
.stack + .empty-state, .tab-panel > .empty-state, [role="tabpanel"] > .empty-state {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}
/* an empty table hides its header row while the empty state shows */
.table-wrap:has(> .empty-state:not([hidden])) > table,
.table-wrap:has(+ .empty-state:not([hidden])) { display: none; }

/* ---------- Page header "More" menu ---------- */
.more-menu { position: relative; }
.more-chev { width: 14px; height: 14px; margin-right: -0.2rem; }
.more-list {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 45;
  min-width: 220px;
  padding: 0.35rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-2);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* ---------- Phones: Registry rows as cards, filters scroll sideways ---------- */
@media (max-width: 640px) {
  .table-wrap { padding: 0.25rem 1rem; }
  .reg-table thead { display: none; }
  .reg-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 0.75rem;
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--line);
  }
  .reg-table tr:last-child { border-bottom: none; }
  .reg-table td { padding: 0; border: none; grid-column: 1; overflow-wrap: anywhere; }
  .reg-table td:nth-child(1) { font-weight: 600; }
  .reg-table td:nth-child(2), .reg-table td:nth-child(3) { color: var(--muted); font-size: 0.85rem; }
  .reg-table td:nth-child(2):empty, .reg-table td:nth-child(3):empty { display: none; }
  .reg-table td:nth-child(4) { grid-column: 2; grid-row: 1 / span 3; align-self: center; }
  .filter-row .seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .filter-row .seg::-webkit-scrollbar { display: none; }
  .seg button { flex: none; }
}
.stat-tile .sub { order: 3; margin-top: 0.2rem; font-size: 0.8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
