/* CKA Community Relations Hub
   ---------------------------------------------------------------------------
   One stylesheet, no build step, no web fonts. The visual language is meant to
   read the way a constituency office should: calm, legible, unmistakably a
   public-service record system rather than a consumer dashboard.

   Three rules hold it together:
     1. Everything is spaced on a 4px grid (--sp-*), so density is consistent.
     2. Type comes from a fixed scale (--fs-*); no ad-hoc rem values.
     3. Colour is referenced only through semantic tokens, never literals, so
        light and dark stay in step and contrast is checked in one place.
   =========================================================================== */

:root {
  color-scheme: light dark;

  /* --- Spacing (4px grid) ------------------------------------------------ */
  --sp-1: .25rem;   --sp-2: .5rem;    --sp-3: .75rem;   --sp-4: 1rem;
  --sp-5: 1.5rem;   --sp-6: 2rem;     --sp-7: 3rem;     --sp-8: 4rem;

  /* --- Type scale -------------------------------------------------------- */
  --fs-xs: .75rem;      /* micro-labels, table headers */
  --fs-sm: .875rem;     /* helper text, meta */
  --fs-base: .9375rem;  /* dense data: tables, forms */
  --fs-body: 1rem;      /* prose */
  --fs-md: 1.125rem;    /* section headings */
  --fs-lg: 1.75rem;     /* page titles */
  --fs-xl: 2.125rem;    /* stat figures */

  --lh-tight: 1.25;
  --lh-base: 1.5;
  --lh-prose: 1.6;

  /* --- Neutrals ----------------------------------------------------------
     Warm, near-white canvas and crisp surfaces: inspired by Attio's quiet
     workspace treatment, with stronger contrast for all-day office use. */
  --bg:            #f4f5f3;
  --surface:       #ffffff;
  --surface-alt:   #f7f8f6;
  --surface-sunk:  #ebeeec;
  --border:        #e1e4e1;
  --border-strong: #c4cac6;
  /* The visible boundary of a form control is a UI component under WCAG 1.4.11
     and needs 3:1, which --border-strong does not reach (1.6:1). Decorative
     hairlines keep using --border-strong; inputs use this. */
  --border-input:  #747c78;

  --text:          #18211f;
  --text-muted:    #4f5d58;
  /* Darkened from #8593a4, which read at 3.1:1 on white and 2.7:1 on the sunk
     surface — below the 4.5:1 WCAG AA needs for body text. This token carries
     timestamps, breadcrumbs, and detail labels: real text people read. */
  --text-faint:    #59655f;

  /* --- Brand / semantic --------------------------------------------------
     A deep institutional blue. Deliberately not a party colour: this belongs
     to the office, and it outlasts whoever holds the seat. */
  --accent:        #205a77;
  --accent-hover:  #17465e;
  --accent-soft:   #e4f0f4;
  --accent-border: #adccd7;
  --accent-text:   #ffffff;

  --ok:        #1c6b45;  --ok-soft:     #e4f2ea;  --ok-border:     #b3ddc6;
  --warn:      #8a5108;  --warn-soft:   #fdf0dd;  --warn-border:   #f0cf9d;
  --danger:    #9c2620;  --danger-soft: #fbeae9;  --danger-border: #eebbb7;

  /* --- Elevation --------------------------------------------------------- */
  --shadow-sm: 0 1px 2px rgba(20, 32, 28, .04), 0 1px 4px rgba(20, 32, 28, .03);
  --shadow-md: 0 2px 4px rgba(20, 32, 28, .05), 0 10px 24px rgba(20, 32, 28, .06);
  --shadow-lg: 0 18px 50px rgba(20, 32, 28, .15);

  --r-sm: 5px;  --r-md: 9px;  --r-lg: 14px;  --r-pill: 999px;

  --sidenav-width: 260px;
  --topbar-height: 68px;

  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas,
          "Liberation Mono", monospace;

  --select-chevron: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%235a6879' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='M4 6.5 8 10.5 12 6.5'/%3E%3C/svg%3E");
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:            #111614;
    --surface:       #19201e;
    --surface-alt:   #202824;
    --surface-sunk:  #131a17;
    --border:        #2b3531;
    --border-strong: #405049;
    --border-input:  #6d7973;

    --text:          #edf2ef;
    --text-muted:    #a7b3ad;
    --text-faint:    #929f99;

    --accent:        #82bed5;
    --accent-hover:  #a2d2e2;
    --accent-soft:   #183039;
    --accent-border: #335764;
    --accent-text:   #0e1719;

    --ok:        #74c99b;  --ok-soft:     #14291f;  --ok-border:     #24503a;
    --warn:      #e0ac63;  --warn-soft:   #2c2113;  --warn-border:   #55401f;
    --danger:    #ef8b84;  --danger-soft: #2e1a19;  --danger-border: #5c2f2c;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-md: 0 1px 3px rgba(0, 0, 0, .45), 0 4px 12px rgba(0, 0, 0, .3);
    --shadow-lg: 0 8px 28px rgba(0, 0, 0, .55);

    --select-chevron: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%239dabbb' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='M4 6.5 8 10.5 12 6.5'/%3E%3C/svg%3E");
  }
}

/* ===========================================================================
   Base
   =========================================================================== */

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI Variable Text", "Segoe UI", -apple-system,
               BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: var(--fs-body);
  line-height: var(--lh-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Proportional figures read better in prose; tables opt into tabular below. */
  font-variant-numeric: proportional-nums;
}

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

h1, h2, h3 { font-weight: 700; letter-spacing: -.022em; }
h1 { font-size: var(--fs-lg); line-height: var(--lh-tight); margin: 0 0 var(--sp-1); }
h2 { font-size: var(--fs-md); line-height: var(--lh-tight); margin: 0 0 var(--sp-2); }
h3 { font-size: var(--fs-body); margin: var(--sp-5) 0 var(--sp-2); }

p { margin: 0 0 var(--sp-3); }

code { font-family: var(--mono); font-size: .92em; }

.ui-icon {
  display: block; width: 1.1rem; height: 1.1rem;
  flex: 0 0 auto;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--accent); color: var(--accent-text);
  padding: var(--sp-2) var(--sp-4); border-radius: 0 0 var(--r-md) 0;
  font-weight: 600;
}
.skip-link:focus { left: 0; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

::selection { background: var(--accent-soft); color: var(--text); }

/* ===========================================================================
   Top bar
   =========================================================================== */

.topbar {
  display: flex; align-items: center; gap: var(--sp-3);
  min-height: var(--topbar-height);
  padding: var(--sp-2) var(--sp-5) var(--sp-2) var(--sp-4);
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 30;
}

.topbar-brand {
  flex: 0 0 calc(var(--sidenav-width) - var(--sp-4));
  min-width: 0;
  margin-left: calc(var(--sp-4) * -1);
  padding-left: var(--sp-4);
}

.brand { display: flex; align-items: center; gap: var(--sp-3); color: inherit; }
.brand:hover { text-decoration: none; }

.brand-mark {
  display: grid; place-items: center;
  width: 38px; height: 38px; border-radius: 11px;
  background: var(--accent); color: var(--accent-text);
  font-weight: 750; font-size: var(--fs-xs); letter-spacing: .08em;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12), var(--shadow-sm);
}

.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong {
  font-size: var(--fs-sm); font-weight: 700; letter-spacing: -.015em;
  white-space: nowrap;
}
.brand-text small { color: var(--text-muted); font-size: var(--fs-xs); white-space: nowrap; }

.topbar-search {
  display: flex; align-items: center; flex: 1; max-width: 43rem;
  min-width: 0; position: relative; gap: var(--sp-2);
}
.topbar-search input[type="search"] {
  flex: 1; min-width: 0; min-height: 2.625rem;
  padding-left: 2.65rem; padding-right: 2.75rem;
  background: var(--surface-alt); border-color: var(--border);
}
.topbar-search input[type="search"]:hover { border-color: var(--border-input); }
.topbar-search-icon {
  position: absolute; z-index: 1; left: .85rem;
  color: var(--text-muted); pointer-events: none;
}
.topbar-search-icon .ui-icon { width: 1rem; height: 1rem; }
.search-shortcut {
  position: absolute; right: 5.85rem;
  display: grid; place-items: center; width: 1.45rem; height: 1.45rem;
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text-muted);
  font: 600 var(--fs-xs)/1 var(--mono); box-shadow: var(--shadow-sm);
}
.topbar-search button { min-height: 2.625rem; padding-inline: var(--sp-4); box-shadow: none; }

.topbar-account { display: flex; align-items: center; gap: var(--sp-3); margin-left: auto; }

.account-link {
  display: flex; align-items: center; gap: var(--sp-2);
  color: inherit; padding: var(--sp-1) var(--sp-2); border-radius: var(--r-md);
}
.account-link:hover { background: var(--surface-alt); text-decoration: none; }

.avatar {
  display: grid; place-items: center;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  border: 1px solid var(--accent-border);
  font-weight: 700; font-size: var(--fs-sm);
}

.account-name { font-size: var(--fs-base); font-weight: 600; }

.nav-toggle { display: none; width: 2.625rem; padding: 0; }

/* ===========================================================================
   Layout and side navigation
   =========================================================================== */

.layout { display: flex; align-items: stretch; min-height: calc(100vh - var(--topbar-height)); }

.sidenav {
  width: var(--sidenav-width); flex: 0 0 var(--sidenav-width);
  padding: var(--sp-4) var(--sp-3) var(--sp-5);
  background: var(--surface);
  border-right: 1px solid var(--border);
  position: sticky; top: var(--topbar-height);
  align-self: flex-start;
  max-height: calc(100vh - var(--topbar-height));
  overflow-y: auto;
}

.navheading {
  margin: var(--sp-5) var(--sp-3) var(--sp-2);
  font-size: var(--fs-xs); font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em; color: var(--text-faint);
}
.navheading:first-child { margin-top: var(--sp-1); }

.navlink {
  display: flex; align-items: center; gap: var(--sp-3);
  min-height: 2.625rem; padding: var(--sp-2) var(--sp-3); margin-bottom: 2px;
  border: 1px solid transparent; border-radius: var(--r-md);
  color: var(--text-muted); font-size: var(--fs-base); font-weight: 550;
  transition: background-color .12s ease, color .12s ease, border-color .12s ease;
}
.navlink:hover { background: var(--surface-alt); color: var(--text); text-decoration: none; }
.navlink.is-active {
  background: var(--accent-soft); color: var(--accent);
  font-weight: 700; border-color: var(--accent-border);
}
.navicon {
  display: grid; place-items: center; width: 1.25rem; height: 1.25rem;
  color: currentColor; opacity: .82;
}
.navicon .ui-icon { width: 1.05rem; height: 1.05rem; }
.navlink.is-active .navicon { opacity: 1; }

.nav-context {
  display: flex; align-items: flex-start; gap: var(--sp-2);
  margin: var(--sp-6) var(--sp-2) 0; padding: var(--sp-3) 0 0;
  border-top: 1px solid var(--border); color: var(--text-muted);
}
.nav-context-dot {
  width: .5rem; height: .5rem; margin-top: .35rem; border-radius: 50%;
  background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft);
}
.nav-context span:last-child { display: flex; flex-direction: column; min-width: 0; }
.nav-context strong { color: var(--text); font-size: var(--fs-sm); font-weight: 650; }
.nav-context small { font-size: var(--fs-xs); }

.content {
  flex: 1; min-width: 0;
  padding: var(--sp-6) clamp(var(--sp-4), 3vw, var(--sp-7)) var(--sp-8);
  max-width: 96rem;
}

.footer {
  display: flex; justify-content: space-between; align-items: center;
  gap: var(--sp-4); flex-wrap: wrap;
  padding: var(--sp-3) var(--sp-6);
  border-top: 1px solid var(--border);
  color: var(--text-muted); font-size: var(--fs-sm);
  background: var(--surface);
}
.footer-links { display: flex; align-items: center; gap: var(--sp-4); }
.inline-form { display: inline; }

/* ===========================================================================
   Page furniture
   =========================================================================== */

.page-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: var(--sp-4); flex-wrap: wrap;
  margin-bottom: var(--sp-5);
}
.page-sub { margin: var(--sp-1) 0 0; color: var(--text-muted); font-size: var(--fs-base); }
.page-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; }

.eyebrow, .card-kicker {
  margin: 0 0 var(--sp-1); color: var(--text-faint);
  font-size: var(--fs-xs); font-weight: 750;
  letter-spacing: .1em; text-transform: uppercase;
}

.breadcrumb {
  display: flex; gap: var(--sp-2); align-items: center; flex-wrap: wrap;
  font-size: var(--fs-sm); color: var(--text-faint); margin-bottom: var(--sp-3);
}
.breadcrumb a { color: var(--text-muted); }

.record-meta { color: var(--text-muted); font-size: var(--fs-sm); margin-top: var(--sp-6); }

.section { margin: var(--sp-6) 0; }
.section-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: var(--sp-4); flex-wrap: wrap; margin-bottom: var(--sp-3);
}
.section-head h2 { margin: 0; display: flex; align-items: center; gap: var(--sp-2); }
.section-more { margin: var(--sp-3) 0 0; font-size: var(--fs-sm); color: var(--text-muted); }

.subhead {
  color: var(--text-faint); text-transform: uppercase;
  font-size: var(--fs-xs); font-weight: 700; letter-spacing: .07em;
}
.subhead-warn { color: var(--warn); }

.count {
  display: inline-grid; place-items: center;
  min-width: 1.5rem; height: 1.35rem; padding: 0 var(--sp-2);
  border-radius: var(--r-pill);
  background: var(--surface-sunk); color: var(--text-muted);
  border: 1px solid var(--border);
  font-size: var(--fs-xs); font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.count-warn { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-border); }

.muted { color: var(--text-muted); }
.nowrap { white-space: nowrap; }

/* ===========================================================================
   Controls
   =========================================================================== */

input, select, textarea, button { font: inherit; color: var(--text); }

input[type="text"], input[type="search"], input[type="email"], input[type="tel"],
input[type="url"], input[type="number"], input[type="date"], input[type="password"],
select, textarea {
  width: 100%;
  padding: .625rem var(--sp-3);
  min-height: 2.625rem;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-input); border-radius: var(--r-md);
  font-size: var(--fs-base);
  transition: border-color .12s ease, box-shadow .12s ease;
}
input:hover:not(:disabled), select:hover:not(:disabled), textarea:hover:not(:disabled) {
  border-color: var(--text-faint);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { resize: vertical; min-height: 6rem; line-height: var(--lh-prose); }
input::placeholder, textarea::placeholder { color: var(--text-faint); }

select {
  appearance: none;
  /* Inline chevron: a data: URI keeps the strict CSP intact (no remote asset)
     while still replacing the inconsistent native arrow. The stroke colour is
     baked into the URI, so dark mode needs its own copy below. */
  background-image: var(--select-chevron);
  background-repeat: no-repeat;
  background-position: right var(--sp-2) center;
  background-size: 1rem;
  padding-right: var(--sp-6);
}

.button, button {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: 2.625rem; padding: .625rem var(--sp-4);
  cursor: pointer;
  background: var(--accent); color: var(--accent-text);
  border: 1px solid var(--accent); border-radius: var(--r-md);
  font-size: var(--fs-base); font-weight: 600; text-align: center;
  box-shadow: var(--shadow-sm);
  transition: background-color .12s ease, border-color .12s ease, transform .05s ease;
}
.button:hover, button:hover {
  background: var(--accent-hover); border-color: var(--accent-hover);
  text-decoration: none; color: var(--accent-text);
}
.button:active, button:active { transform: translateY(1px); }

.button-quiet {
  background: var(--surface); color: var(--text); border-color: var(--border-input);
}
.button-quiet:hover {
  background: var(--surface-alt); color: var(--text); border-color: var(--text-faint);
}

.button-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.button-danger:hover { background: var(--danger); border-color: var(--danger); filter: brightness(1.1); color: #fff; }

.button-block { width: 100%; }

.linkbutton {
  background: none; border: 0; padding: 0; min-height: 0; cursor: pointer;
  color: var(--accent); font: inherit; font-weight: 500;
  text-decoration: underline; text-underline-offset: 2px;
  box-shadow: none;
}
.linkbutton:hover { background: none; color: var(--accent-hover); }
.linkbutton-danger { color: var(--danger); }
.linkbutton-danger:hover { background: none; color: var(--danger); }

/* ===========================================================================
   Filters and chips
   =========================================================================== */

.filters, .filter-bar {
  display: flex; gap: var(--sp-3); align-items: flex-end; flex-wrap: wrap;
  padding: var(--sp-4); margin-bottom: var(--sp-4);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
}
.filter-field { display: flex; flex-direction: column; gap: var(--sp-1); min-width: 9.5rem; }
.filter-field label, .filter-bar .field label {
  font-size: var(--fs-xs); font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .05em;
}
.filter-bar .field { margin-bottom: 0; min-width: 11rem; }
.filter-search { flex: 1 1 17rem; }
.filter-actions { display: flex; gap: var(--sp-2); }

.result-count { color: var(--text-muted); font-size: var(--fs-base); margin: 0 0 var(--sp-3); }

.chips { display: flex; gap: var(--sp-2); flex-wrap: wrap; margin-bottom: var(--sp-4); }
.chip {
  padding: var(--sp-1) var(--sp-3); border-radius: var(--r-pill);
  font-size: var(--fs-base); font-weight: 500;
  background: var(--surface); border: 1px solid var(--border-input); color: var(--text);
}
.chip:hover { text-decoration: none; background: var(--surface-alt); }
.chip.is-active {
  background: var(--accent); border-color: var(--accent); color: var(--accent-text);
}

/* ===========================================================================
   Tables — the core of a records system, so they get the most attention
   =========================================================================== */

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--border); border-radius: var(--r-lg);
  background: var(--surface); box-shadow: var(--shadow-sm);
  scrollbar-color: var(--border-strong) transparent;
}

.table {
  width: 100%; border-collapse: separate; border-spacing: 0;
  font-size: var(--fs-base);
  font-variant-numeric: tabular-nums;
  /* Narrow viewports scroll the wrapper rather than squeezing columns down to
     a word — or a syllable — apiece. */
  min-width: 38rem;
}

.table th, .table td {
  text-align: left; padding: .8rem var(--sp-4);
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.table thead th {
  position: sticky; top: 0; z-index: 1;
  background: var(--surface-alt);
  font-size: var(--fs-xs); font-weight: 750;
  text-transform: uppercase; letter-spacing: .075em;
  color: var(--text-muted); white-space: nowrap;
  border-bottom: 1px solid var(--border-strong);
}
.table thead th a { color: inherit; }
.table thead th a:hover { color: var(--accent); }

.table tbody tr { transition: background-color .1s ease; }
.table tbody tr:hover { background: var(--accent-soft); }
.table tbody tr:last-child td { border-bottom: 0; }

.cell-id {
  font-family: var(--mono); font-size: var(--fs-sm);
  white-space: nowrap; color: var(--text-muted);
}
.cell-id a { color: var(--accent); }
.cell-title { font-weight: 600; }
.cell-text { max-width: 26rem; overflow-wrap: break-word; }
.cell-date, .cell-money, .cell-integer { white-space: nowrap; }
.cell-money, .cell-integer { text-align: right; }
.th-money, .th-integer { text-align: right; }
.cell-actions { text-align: right; white-space: nowrap; }

.pagination {
  display: flex; align-items: center; gap: var(--sp-4);
  margin-top: var(--sp-4); flex-wrap: wrap;
}
.pagination-status, .page-indicator {
  color: var(--text-muted); font-size: var(--fs-base);
  font-variant-numeric: tabular-nums;
}

/* ===========================================================================
   Cards, panels, notices
   =========================================================================== */

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: var(--sp-5);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--sp-4);
}
.card p:last-child { margin-bottom: 0; }
.card h2 { margin-bottom: var(--sp-3); }

.empty {
  color: var(--text-muted); font-size: var(--fs-base);
  padding: var(--sp-5) var(--sp-4); text-align: center;
  background: var(--surface-alt);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-lg); margin: 0;
}

.empty-positive {
  display: flex; align-items: center; justify-content: center; gap: var(--sp-3);
  text-align: left; border-style: solid;
  background: var(--ok-soft); border-color: var(--ok-border);
}
.empty-positive > span:last-child { display: flex; flex-direction: column; }
.empty-positive strong { color: var(--ok); font-size: var(--fs-base); }
.empty-icon {
  display: grid; place-items: center; width: 2.25rem; height: 2.25rem;
  flex: 0 0 auto; border-radius: 50%; background: var(--surface);
  color: var(--ok); border: 1px solid var(--ok-border);
}

.flash {
  padding: var(--sp-3) var(--sp-4); border-radius: var(--r-lg);
  margin-bottom: var(--sp-4);
  border: 1px solid; border-left-width: 4px;
  font-size: var(--fs-base);
}
.flash p:last-child { margin-bottom: 0; }
.flash-success, .flash-info {
  background: var(--ok-soft); border-color: var(--ok-border);
  border-left-color: var(--ok); color: var(--text);
}
.flash-warning {
  background: var(--warn-soft); border-color: var(--warn-border);
  border-left-color: var(--warn); color: var(--text);
}
.flash-error {
  background: var(--danger-soft); border-color: var(--danger-border);
  border-left-color: var(--danger); color: var(--text);
}
.flash strong { font-weight: 650; }

.code-block {
  margin: 0 0 var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface-sunk);
  border: 1px solid var(--border); border-radius: var(--r-md);
  overflow-x: auto; font-size: var(--fs-sm); line-height: var(--lh-base);
}

.blocker-list { margin: var(--sp-2) 0 0; padding-left: var(--sp-5); }
.blocker-list li { margin: var(--sp-1) 0; }

/* ===========================================================================
   Dashboard
   =========================================================================== */

.page-head-dashboard { align-items: flex-end; }

.metric-strip {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0 0 var(--sp-5); overflow: hidden;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
}

.metric {
  display: grid; grid-template-columns: auto 1fr; align-items: center;
  gap: var(--sp-1) var(--sp-3); min-width: 0;
  padding: var(--sp-4) var(--sp-5); color: inherit;
  border-right: 1px solid var(--border);
  transition: background-color .12s ease;
}
.metric:last-child { border-right: 0; }
.metric:hover { background: var(--surface-alt); text-decoration: none; }
.metric-icon {
  display: grid; place-items: center; grid-row: 1 / span 2;
  width: 2.5rem; height: 2.5rem; border-radius: var(--r-md);
  color: var(--accent); background: var(--accent-soft);
  border: 1px solid var(--accent-border);
}
.metric-icon .ui-icon { width: 1.2rem; height: 1.2rem; }
.metric-copy { display: flex; align-items: baseline; gap: var(--sp-2); min-width: 0; }
.metric-value {
  font-size: 1.65rem; font-weight: 750; line-height: 1;
  letter-spacing: -.035em; font-variant-numeric: tabular-nums;
}
.metric-label { color: var(--text); font-size: var(--fs-sm); font-weight: 650; }
.metric-note {
  grid-column: 2; color: var(--text-muted); font-size: var(--fs-xs);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.metric-warn .metric-icon {
  color: var(--warn); background: var(--warn-soft); border-color: var(--warn-border);
}
.metric-warn .metric-value { color: var(--warn); }

.stat-row {
  display: grid; gap: var(--sp-3); margin-bottom: var(--sp-5);
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
}

.stat {
  display: flex; flex-direction: column; gap: var(--sp-1);
  padding: var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.stat-link { color: inherit; transition: border-color .12s ease, box-shadow .12s ease; }
.stat-link:hover {
  text-decoration: none; border-color: var(--accent-border);
  box-shadow: var(--shadow-md);
}
.stat-value {
  font-size: var(--fs-xl); font-weight: 700; line-height: 1.05;
  font-variant-numeric: tabular-nums; letter-spacing: -.02em;
}
.stat-label {
  font-size: var(--fs-xs); color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .06em; font-weight: 600;
}
/* Anything needing attention is tinted; the rest stay neutral so the tinted
   one actually draws the eye. */
.stat-warn { background: var(--warn-soft); border-color: var(--warn-border); }
.stat-warn .stat-value { color: var(--warn); }
.stat-warn .stat-label { color: var(--warn); }

.dash-grid {
  display: grid; gap: var(--sp-4);
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.dash-grid .card { margin-bottom: 0; }
.card-span { grid-column: 1 / -1; }

.priority-card { border-top: 3px solid var(--accent); }
.section-head-top { align-items: flex-start; }
.section-head-top h2 { margin-top: 0; }
.card-link {
  flex: 0 0 auto; font-size: var(--fs-sm); font-weight: 650;
  padding: var(--sp-1) 0;
}
.card-intro { margin: calc(var(--sp-2) * -1) 0 var(--sp-3); color: var(--text-muted); font-size: var(--fs-sm); }
.compact-list li { padding-block: .65rem; }

.record-links {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-2);
}
.record-link {
  display: flex; align-items: center; gap: var(--sp-3); min-width: 0;
  padding: .7rem var(--sp-3); border: 1px solid var(--border);
  border-radius: var(--r-md); color: inherit; background: var(--surface-alt);
  transition: border-color .12s ease, background-color .12s ease, transform .12s ease;
}
.record-link:hover {
  background: var(--accent-soft); border-color: var(--accent-border);
  text-decoration: none; transform: translateY(-1px);
}
.record-link-icon {
  display: grid; place-items: center; width: 2rem; height: 2rem;
  flex: 0 0 auto; border-radius: var(--r-md);
  color: var(--accent); background: var(--surface);
  border: 1px solid var(--border);
}
.record-link-copy { display: flex; flex-direction: column; min-width: 0; }
.record-link-copy strong {
  overflow: hidden; color: var(--text); font-size: var(--fs-sm);
  font-weight: 650; text-overflow: ellipsis; white-space: nowrap;
}
.record-link-copy small { color: var(--text-muted); font-size: var(--fs-xs); }
.record-link-arrow { margin-left: auto; color: var(--text-faint); }

.profile-grid {
  display: grid; gap: var(--sp-4);
  grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr));
}
.profile-grid .card { margin-bottom: 0; }

.task-list { list-style: none; margin: 0; padding: 0; }
.task-list li {
  padding: var(--sp-3) 0; border-bottom: 1px solid var(--border);
}
.task-list li:first-child { padding-top: 0; }
.task-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.task-list-roomy li { padding: var(--sp-3) 0; }
.task-title { display: block; font-weight: 600; }
.task-meta { display: block; font-size: var(--fs-sm); color: var(--text-muted); margin-top: 2px; }
.overdue { color: var(--danger); font-weight: 650; }

.bar-list { list-style: none; margin: 0; padding: 0; }
.bar-list li {
  display: grid; grid-template-columns: minmax(6rem, 1fr) 2.4fr auto;
  gap: var(--sp-3); align-items: center; padding: var(--sp-2) 0;
}
.bar-label { font-size: var(--fs-base); }
.bar-track {
  height: 8px; background: var(--surface-sunk);
  border-radius: var(--r-pill); overflow: hidden;
}
.bar-fill {
  display: block; height: 100%;
  background: var(--accent); border-radius: var(--r-pill);
}
.bar-value {
  font-size: var(--fs-sm); color: var(--text-muted);
  font-variant-numeric: tabular-nums; min-width: 1.5rem; text-align: right;
}

.activity-list { list-style: none; margin: 0; padding: 0; font-size: var(--fs-base); }
.activity-list li {
  /* Wraps rather than overflowing: the row holds a fixed-width kind label, a
     record title of unknown length, and a timestamp that must stay intact. */
  display: flex; align-items: baseline; gap: var(--sp-1) var(--sp-3);
  flex-wrap: wrap;
  padding: .7rem 0; border-bottom: 1px solid var(--border);
}
.activity-list li:last-child { border-bottom: 0; }
.activity-list li > a { min-width: 0; overflow-wrap: break-word; }
.activity-kind {
  flex: 0 0 6.5rem;
  font-size: var(--fs-xs); text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-faint); font-weight: 600;
}
.activity-time {
  margin-left: auto; color: var(--text-faint);
  font-size: var(--fs-sm); white-space: nowrap;
}

/* ===========================================================================
   Search results
   =========================================================================== */

.results { list-style: none; margin: 0; padding: 0; }
.result {
  padding: var(--sp-3) var(--sp-4); margin-bottom: var(--sp-2);
  background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-lg);
}
.result:hover { border-color: var(--accent-border); }
.result-head { display: flex; align-items: baseline; gap: var(--sp-1) var(--sp-3); flex-wrap: wrap; }
.result-head > a, .result-title { min-width: 0; overflow-wrap: break-word; }
.result-kind {
  flex: 0 0 6.5rem;
  font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-faint); font-weight: 600;
}
.result-title { font-weight: 600; }
.result-snippet {
  margin: var(--sp-1) 0 var(--sp-1) 7.5rem;
  font-size: var(--fs-base); color: var(--text-muted);
}
.result-snippet mark {
  background: var(--warn-soft); color: var(--text);
  padding: 0 .15em; border-radius: var(--r-sm); font-weight: 600;
}
.result-meta { margin: 0 0 0 7.5rem; font-size: var(--fs-sm); color: var(--text-faint); }

/* ===========================================================================
   Forms
   =========================================================================== */

.record-form {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: var(--sp-5);
  box-shadow: var(--shadow-sm);
}
.field-grid {
  display: grid; gap: var(--sp-4);
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
}
.field { display: flex; flex-direction: column; gap: var(--sp-1); margin-bottom: var(--sp-4); }
.field-grid .field { margin-bottom: 0; }
.field-wide { grid-column: 1 / -1; }
.field label { font-size: var(--fs-base); font-weight: 600; }
.req { color: var(--danger); text-decoration: none; margin-left: 2px; }
.field-help { margin: 0; font-size: var(--fs-sm); color: var(--text-muted); line-height: var(--lh-base); }
.field-message { margin: 0; font-size: var(--fs-sm); color: var(--danger); font-weight: 600; }
.field-error input, .field-error select, .field-error textarea { border-color: var(--danger); }
.field-error input:focus, .field-error select:focus, .field-error textarea:focus {
  box-shadow: 0 0 0 3px var(--danger-soft);
}

.form-actions {
  display: flex; gap: var(--sp-3); align-items: center; flex-wrap: wrap;
  margin-top: var(--sp-5); padding-top: var(--sp-4);
  border-top: 1px solid var(--border);
}

.stack-form { display: grid; gap: var(--sp-4); }
.stack-form.narrow { max-width: 26rem; }
.stack-form .field { margin-bottom: 0; }

.inline-create {
  display: flex; align-items: flex-end; gap: var(--sp-3); flex-wrap: wrap;
  margin-top: var(--sp-4);
}
.inline-create .field { margin: 0; min-width: 16rem; flex: 1 1 16rem; }

.danger-zone {
  display: flex; justify-content: space-between; align-items: center;
  gap: var(--sp-4); flex-wrap: wrap;
  margin-top: var(--sp-6); padding: var(--sp-4) var(--sp-5);
  background: var(--danger-soft);
  border: 1px solid var(--danger-border); border-left: 4px solid var(--danger);
  border-radius: var(--r-lg);
}
.danger-zone h2 { margin: 0 0 var(--sp-1); color: var(--danger); font-size: var(--fs-body); }
.danger-zone .page-sub { margin: 0; }

/* ===========================================================================
   Detail pages, history, conflicts
   =========================================================================== */

.detail-list {
  display: grid; gap: var(--sp-4) var(--sp-5);
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  margin: 0;
}
.detail-row-wide { grid-column: 1 / -1; }
.detail-list dt {
  font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-faint); font-weight: 700; margin-bottom: var(--sp-1);
}
.detail-list dd { margin: 0; line-height: var(--lh-prose); }
.detail-list dd p { margin: 0 0 var(--sp-2); }
.detail-list dd p:last-child { margin-bottom: 0; }

.history { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-2); }
.history li {
  display: flex; align-items: baseline; gap: var(--sp-3); flex-wrap: wrap;
  padding: var(--sp-2) var(--sp-3);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); font-size: var(--fs-base);
}
.history-when { color: var(--text-faint); white-space: nowrap; font-size: var(--fs-sm); }
.history-who { font-weight: 600; }
.history-what { color: var(--text-muted); }

.conflict p { margin: var(--sp-2) 0 var(--sp-3); }
.conflict-table { margin-top: var(--sp-2); background: var(--surface); }
.conflict-table th[scope="row"] { white-space: nowrap; font-weight: 650; }
.conflict-table td { vertical-align: top; }

/* ===========================================================================
   Status pills
   =========================================================================== */

.pill {
  display: inline-block; padding: 1px var(--sp-2);
  border-radius: var(--r-pill);
  font-size: var(--fs-xs); font-weight: 700; white-space: nowrap;
  letter-spacing: .01em;
  background: var(--surface-sunk); border: 1px solid var(--border-strong);
  color: var(--text-muted);
}

/* Active / in flight */
.pill-open, .pill-submitted, .pill-in-progress, .pill-under-review,
.pill-incoming, .pill-login, .pill-create, .pill-setup, .pill-get {
  background: var(--accent-soft); border-color: var(--accent-border); color: var(--accent);
}
/* Settled well */
.pill-resolved, .pill-complete, .pill-approved, .pill-funded {
  background: var(--ok-soft); border-color: var(--ok-border); color: var(--ok);
}
/* Needs a decision */
.pill-monitoring, .pill-not-started, .pill-draft, .pill-conflict {
  background: var(--warn-soft); border-color: var(--warn-border); color: var(--warn);
}
/* Stopped or refused */
.pill-blocked, .pill-declined, .pill-delete, .pill-login-failed,
.pill-password-reset, .pill-post, .pill-put, .pill-patch {
  background: var(--danger-soft); border-color: var(--danger-border); color: var(--danger);
}
/* Neutral / closed */
.pill-closed, .pill-cancelled, .pill-withdrawn, .pill-outgoing,
.pill-viewer, .pill-logout, .pill-update, .pill-export, .pill-reindex {
  background: var(--surface-sunk); border-color: var(--border-strong); color: var(--text-muted);
}

/* ===========================================================================
   Accounts and sign-in
   =========================================================================== */

.auth-body {
  display: flex; min-height: 100vh; align-items: center; justify-content: center;
  padding: var(--sp-5);
  background:
    radial-gradient(1100px 500px at 50% -10%, var(--accent-soft), transparent 70%),
    var(--bg);
}
.auth-shell { width: 100%; max-width: 25rem; }

.auth-brand {
  display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-4);
}
.auth-brand strong { display: block; font-size: var(--fs-md); font-weight: 650; }
.auth-brand small { color: var(--text-muted); font-size: var(--fs-sm); }

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--sp-5) var(--sp-5) var(--sp-6);
}
.auth-card h1 { margin-top: 0; margin-bottom: var(--sp-2); }
.auth-card .page-sub { margin-bottom: var(--sp-5); }

.auth-footer {
  margin: var(--sp-4) 0 0; text-align: center;
  color: var(--text-faint); font-size: var(--fs-sm);
}
.auth-help { margin: var(--sp-4) 0 0; color: var(--text-muted); font-size: var(--fs-sm); }

.token-value {
  display: block; margin-top: var(--sp-2);
  padding: var(--sp-3); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--r-md);
  font-family: var(--mono); font-size: var(--fs-sm);
  word-break: break-all; user-select: all;
}

.row-muted td { opacity: .55; }
.reset-row td { background: var(--surface-alt); }
.reset-row summary {
  cursor: pointer; color: var(--accent);
  font-size: var(--fs-base); font-weight: 500; padding: var(--sp-1) 0;
}
.reset-row summary:hover { text-decoration: underline; }
.reset-row .inline-create { margin-top: var(--sp-2); }

/* ===========================================================================
   Error page
   =========================================================================== */

.error-page { max-width: 30rem; margin: var(--sp-8) auto; text-align: center; }
.error-code {
  font-size: 4rem; font-weight: 700; color: var(--text-faint);
  margin: 0 0 var(--sp-2); line-height: 1; letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
}

/* ===========================================================================
   Responsive
   =========================================================================== */

@media (max-width: 1180px) {
  .metric-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric:nth-child(2) { border-right: 0; }
  .metric:nth-child(-n + 2) { border-bottom: 1px solid var(--border); }
}

@media (max-width: 1000px) {
  .content { padding: var(--sp-4) var(--sp-4) var(--sp-7); }
  .footer { padding: var(--sp-3) var(--sp-4); }
  .dash-grid { grid-template-columns: minmax(0, 1fr); }
  .card-span { grid-column: auto; }
}

@media (max-width: 860px) {
  .topbar { flex-wrap: wrap; padding: var(--sp-2) var(--sp-4); }
  .topbar-brand { flex: 0 1 auto; margin-left: 0; padding-left: 0; }
  .topbar-search { order: 3; flex-basis: 100%; max-width: none; }
  .account-name { display: none; }
  .topbar-account { gap: var(--sp-2); margin-left: auto; }

  .nav-toggle { display: inline-flex; flex: 0 0 auto; }

  .layout { display: block; }
  .sidenav {
    display: none; width: auto; position: static; max-height: none;
    padding: var(--sp-3) var(--sp-4) var(--sp-4);
    border-right: 0; border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-md);
  }
  .sidenav.is-open { display: block; }
  .nav-context { display: none; }

  .result-snippet, .result-meta { margin-left: 0; }
  .activity-kind, .result-kind { flex-basis: 100%; }
  .activity-time { margin-left: 0; }
}

@media (max-width: 620px) {
  .brand-text small, .search-shortcut { display: none; }
  .topbar-search input[type="search"] { padding-right: var(--sp-3); }
  .content { padding-inline: var(--sp-3); }
  .page-head { align-items: stretch; }
  .page-actions { width: 100%; }
  .page-actions .button { flex: 1 1 auto; }
  .metric { padding: var(--sp-4); }
  .record-links { grid-template-columns: minmax(0, 1fr); }
  .card { padding: var(--sp-4); }
  .bar-list li { grid-template-columns: minmax(7rem, 1.25fr) 1fr auto; }
}

@media (max-width: 460px) {
  .brand-text { display: none; }
  .topbar-account .pill { display: none; }
  .topbar-search button { padding-inline: var(--sp-3); }
  .metric-strip { grid-template-columns: minmax(0, 1fr); }
  .metric { border-right: 0; border-bottom: 1px solid var(--border); }
  .metric:nth-child(2) { border-right: 0; }
  .metric:nth-child(-n + 2) { border-bottom: 1px solid var(--border); }
  .metric:last-child { border-bottom: 0; }
  .section-head-top { align-items: flex-start; }
  .card-link { width: 100%; }
}

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

/* ===========================================================================
   Print
   ---------------------------------------------------------------------------
   Constituency staff print a community profile before a visit or a call. The
   screen chrome is noise on paper, so it goes; what is left is the record.
   =========================================================================== */

@media print {
  :root {
    --bg: #fff; --surface: #fff; --surface-alt: #fff; --surface-sunk: #fff;
    --text: #000; --text-muted: #333; --text-faint: #555;
    --border: #bbb; --border-strong: #999;
    --shadow-sm: none; --shadow-md: none; --shadow-lg: none;
  }

  .topbar, .sidenav, .footer, .skip-link,
  .page-actions, .form-actions, .filters, .filter-bar, .chips,
  .pagination, .danger-zone, .section-more, .nav-toggle {
    display: none !important;
  }

  body { background: #fff; font-size: 10.5pt; }
  .layout { display: block; }
  .content { max-width: none; padding: 0; }

  a { color: #000; text-decoration: none; }

  .card, .table-scroll, .record-form {
    border: 1px solid #bbb; box-shadow: none;
    break-inside: avoid; page-break-inside: avoid;
  }

  /* Repeat table headers across page breaks. */
  .table thead { display: table-header-group; }
  .table thead th { position: static; background: #f2f2f2; color: #000; }
  .table tbody tr { break-inside: avoid; page-break-inside: avoid; }
  .table-scroll { overflow: visible; }

  .section { break-inside: avoid-page; }
  h1, h2, h3 { break-after: avoid-page; }

  .pill { border: 1px solid #999; background: #fff !important; color: #000 !important; }
  .cell-actions, .table th:last-child { display: none; }
}

.error-page h1 { margin-bottom: var(--sp-2); }
.error-reference {
  margin: var(--sp-4) 0;
  font-size: var(--fs-base);
}
.error-reference code {
  padding: 2px var(--sp-2);
  background: var(--surface-sunk);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-weight: 600;
  user-select: all;
}

/* ===========================================================================
   Briefing note
   ---------------------------------------------------------------------------
   Read on screen in the two minutes before a call, then usually printed and
   carried into the room. Denser than the profile page, and the print rules at
   the end of this file strip everything that is not the note itself.
   =========================================================================== */

.briefing-meta {
  margin: 0 0 var(--sp-4);
  padding: var(--sp-2) var(--sp-3);
  background: var(--surface-alt);
  border-left: 3px solid var(--border-strong);
  border-radius: var(--r-sm);
  font-size: var(--fs-sm); color: var(--text-muted);
}

.briefing-stats {
  display: grid; gap: var(--sp-3);
  grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr));
  margin-bottom: var(--sp-5);
}
.briefing-stats > div {
  padding: var(--sp-3);
  background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-md);
}
.briefing-stats strong {
  display: block; font-size: var(--fs-lg); font-weight: 700;
  line-height: 1.1; font-variant-numeric: tabular-nums;
}
.briefing-stats span {
  font-size: var(--fs-xs); color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .06em; font-weight: 600;
}
.briefing-stats .is-warn { background: var(--warn-soft); border-color: var(--warn-border); }
.briefing-stats .is-warn strong, .briefing-stats .is-warn span { color: var(--warn); }

.briefing-section { margin-bottom: var(--sp-5); }
.briefing-section h2 {
  padding-bottom: var(--sp-2);
  border-bottom: 2px solid var(--border-strong);
  margin-bottom: var(--sp-3);
}

.briefing-prose { color: var(--text); }
.briefing-prose p { margin: 0 0 var(--sp-2); }

.briefing-list { list-style: none; margin: 0; padding: 0; }
.briefing-list li {
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--border);
}
.briefing-list li:last-child { border-bottom: 0; }
.briefing-line { display: block; font-weight: 600; }
.briefing-note {
  display: block; margin-top: 2px;
  font-size: var(--fs-sm); color: var(--text-muted);
}
.briefing-detail {
  display: block; margin-top: var(--sp-1);
  font-size: var(--fs-base); color: var(--text-muted);
}

.briefing-table {
  font-size: var(--fs-base);
  /* Overrides the 38rem minimum that keeps wide list views scrollable: this
     table has four short columns and is meant to fit a printed page. */
  min-width: 0;
}
.briefing-table td, .briefing-table th { padding: var(--sp-2) var(--sp-3); }
.briefing-footer {
  margin-top: var(--sp-6); padding-top: var(--sp-3);
  border-top: 1px solid var(--border);
  font-size: var(--fs-sm); color: var(--text-faint);
}

@media print {
  /* The note is the page; everything else is screen furniture. */
  .briefing-head .page-actions, .breadcrumb { display: none !important; }
  .briefing-meta { background: none; border-left: 0; padding-left: 0; }
  .briefing-stats { grid-template-columns: repeat(4, 1fr); gap: var(--sp-2); }
  .briefing-stats > div { border: 1px solid #bbb; }
  .briefing-section { break-inside: avoid-page; }
  .briefing-list li { break-inside: avoid; }
  .briefing-footer { color: #444; }
}

/* ------------------------------------------------------------ data health */

.health-check {
  margin-bottom: var(--sp-4); padding: var(--sp-4) var(--sp-5);
  background: var(--surface);
  border: 1px solid var(--border); border-left: 4px solid var(--border-strong);
  border-radius: var(--r-lg);
}
.health-warn { border-left-color: var(--warn); }
.health-info { border-left-color: var(--accent); }

.health-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: var(--sp-4); flex-wrap: wrap;
}
.health-head h2 { margin: 0; display: flex; align-items: center; gap: var(--sp-2); }
.health-why { margin: var(--sp-1) 0 var(--sp-3); color: var(--text-muted); font-size: var(--fs-base); }

.health-samples { list-style: none; margin: 0; padding: 0; }
.health-samples li {
  display: flex; align-items: baseline; gap: var(--sp-3); flex-wrap: wrap;
  padding: var(--sp-2) 0; border-bottom: 1px solid var(--border);
  font-size: var(--fs-base);
}
.health-samples li:last-child { border-bottom: 0; }
.health-samples li > a {
  flex: 0 0 5.5rem; font-family: var(--mono); font-size: var(--fs-sm);
}
.health-sample-label { font-weight: 500; min-width: 0; overflow-wrap: break-word; }
.health-sample-meta { color: var(--text-muted); font-size: var(--fs-sm); }
.health-more { margin: var(--sp-2) 0 0; color: var(--text-faint); font-size: var(--fs-sm); }

.health-passing { list-style: none; margin: 0; padding: 0; columns: 2; }
.health-passing li {
  padding: var(--sp-1) 0; color: var(--text-muted); font-size: var(--fs-base);
  break-inside: avoid;
}
.health-passing li::before { content: "✓ "; color: var(--ok); font-weight: 700; }

@media (max-width: 700px) { .health-passing { columns: 1; } }

/* --------------------------------------------------------- bulk actions */

.bulk-bar {
  display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap;
  margin-top: var(--sp-3); padding: var(--sp-3) var(--sp-4);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
}
.bulk-bar label { font-size: var(--fs-base); font-weight: 500; }
.bulk-bar select { width: auto; min-width: 12rem; }
.bulk-count { font-size: var(--fs-sm); color: var(--text-muted); }

.cell-select { width: 2.5rem; text-align: center; }
.cell-select input { width: auto; min-height: 0; margin: 0; cursor: pointer; }
th.cell-select { padding-top: var(--sp-3); }

@media print { .bulk-bar, .cell-select { display: none !important; } }

/* A contact's phone field often holds several numbers; each is linked
   separately, and a fax is shown without a link so nobody dials it. */
.phone-parts { overflow-wrap: break-word; }
.phone-parts a { white-space: nowrap; }

@media print {
  /* On paper the number itself is what matters, not that it was a link. */
  .phone-parts a { color: #000; text-decoration: none; }
}
