/* Hallmark · genre: modern-minimal · macrostructure: Workbench · design-system: design.md · designed-as-app
 * nav: fixed sidebar (collapsible rail) · footer: none (app) · enrichment: none
 * pre-emit critique: P4 H5 E4 S4 R5 V4
 * Every colour, font and size comes from tokens.css. */

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { overflow-x: clip; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--color-paper); color: var(--color-ink);
  font-family: var(--font-body); font-size: var(--text-base); line-height: var(--leading);
  font-feature-settings: "ss01", "cv11"; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3 { font-family: var(--font-display); letter-spacing: var(--tracking-display); line-height: 1.2; margin: 0; overflow-wrap: anywhere; min-width: 0; }
h1 { font-size: var(--text-2xl); font-weight: 650; }
h2 { font-size: var(--text-lg); font-weight: 600; margin: var(--space-xl) 0 var(--space-sm); }
h3 { font-size: var(--text-md); font-weight: 600; }
p { margin: 0 0 var(--space-sm); }
a { color: var(--color-accent-text); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--color-accent-hover); }
code, pre, kbd { font-family: var(--font-mono); font-size: 0.92em; }
code { background: var(--color-paper-2); border: var(--rule); border-radius: var(--radius-sm); padding: 0 var(--space-2xs); }
pre { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--color-paper-2); border: var(--rule); padding: var(--space-sm); border-radius: var(--radius); }
hr { border: 0; border-top: var(--rule); margin: var(--space-lg) 0; }
.icon { flex: none; display: inline-block; vertical-align: middle; }
:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.skip { position: absolute; left: var(--space-sm); top: -3rem; z-index: 100; background: var(--color-ink); color: var(--color-paper); padding: var(--space-xs) var(--space-sm); border-radius: var(--radius); }
.skip:focus { top: var(--space-sm); }
/* [hidden] must win over component display rules (.row is flex, etc.). */
[hidden] { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- app shell: fixed sidebar, content scrolls on its own ---------- */
body.app { height: 100dvh; overflow: hidden; }
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); height: 100dvh; }
body[data-sidebar="collapsed"] .shell { grid-template-columns: var(--sidebar-w-collapsed) minmax(0, 1fr); }

.sidebar {
  display: flex; flex-direction: column; gap: var(--space-xs); min-width: 0;
  height: 100dvh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--color-paper-2); border-right: var(--rule); padding: var(--space-sm) var(--space-xs);
}
/* Sections keep their size; a sidebar taller than the window scrolls instead of squashing. */
.sidebar > * { flex-shrink: 0; }
.sb-top { display: flex; align-items: center; gap: var(--space-xs); padding: var(--space-2xs) var(--space-2xs) var(--space-xs); min-height: var(--control-h); }
.brand { display: flex; align-items: center; gap: var(--space-xs); min-width: 0; flex: 1; color: var(--color-ink); text-decoration: none; font-weight: 600; }
.brand:hover { color: var(--color-ink); }
.brand-mark {
  flex: none; width: 1.75rem; height: 1.75rem; border-radius: var(--radius); display: grid; place-items: center;
  background: var(--color-accent); color: var(--color-accent-ink); font-size: var(--text-sm); font-weight: 700; letter-spacing: 0;
}
.brand-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-switch { padding: 0 var(--space-2xs); }
.sb-switch select { width: 100%; }
.sb-nav { display: flex; flex-direction: column; gap: var(--space-3xs); }
.sb-head { font-size: var(--text-xs); font-weight: 600; color: var(--color-ink-3); padding: var(--space-md) var(--space-xs) var(--space-2xs); white-space: nowrap; }
.sb-item {
  display: flex; align-items: center; gap: var(--space-sm); min-height: 2.125rem; padding: 0 var(--space-xs);
  border-radius: var(--radius); color: var(--color-ink-2); text-decoration: none; font-weight: 500; white-space: nowrap;
  transition: background-color var(--dur-short) var(--ease-out), color var(--dur-short) var(--ease-out);
}
.sb-item:hover { background: var(--color-paper-3); color: var(--color-ink); }
.sb-item[aria-current="page"] { background: var(--color-surface); color: var(--color-ink); box-shadow: var(--shadow-1), inset 0 0 0 1px var(--color-rule); }
.sb-item[aria-current="page"] .icon { color: var(--color-accent); }
.sb-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.sb-count { font-size: var(--text-xs); font-weight: 600; font-variant-numeric: tabular-nums; min-width: 1.25rem; text-align: center; padding: 0 var(--space-2xs); border-radius: var(--radius-sm); background: var(--color-accent-soft); color: var(--color-accent); }
.sb-foot { margin-top: auto; border-top: var(--rule); padding-top: var(--space-xs); display: flex; flex-direction: column; gap: var(--space-3xs); }
.avatar { flex: none; width: 1.75rem; height: 1.75rem; border-radius: 50%; display: grid; place-items: center; background: var(--color-paper-3); color: var(--color-ink-2); font-size: var(--text-xs); font-weight: 600; }
.sb-user { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.sb-user small { color: var(--color-ink-3); font-size: var(--text-xs); overflow: hidden; text-overflow: ellipsis; }

body:not([data-sidebar="collapsed"]) .when-collapsed, body[data-sidebar="collapsed"] .when-open { display: none; }
.when-open, .when-collapsed { display: inline-flex; }

/* Collapsed rail: icons only; names stay available to screen readers and as tooltips. */
body[data-sidebar="collapsed"] .sidebar { padding-inline: var(--space-2xs); align-items: center; }
body[data-sidebar="collapsed"] :is(.sb-nav, .sb-foot, .sb-top) { width: 100%; align-items: center; }
body[data-sidebar="collapsed"] .sb-top { flex-direction: column; padding-inline: 0; }
body[data-sidebar="collapsed"] .brand { flex: none; }
body[data-sidebar="collapsed"] :is(.brand-name, .sb-label, .sb-user, .sb-switch) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
body[data-sidebar="collapsed"] .sb-head { visibility: hidden; height: var(--space-sm); padding: 0; }
body[data-sidebar="collapsed"] :is(.sb-item, .sb-foot) { justify-content: center; width: 2.5rem; padding: 0; }
body[data-sidebar="collapsed"] .sb-count { position: absolute; transform: translate(0.75rem, -0.65rem); min-width: 1rem; font-size: 0.625rem; }
body[data-sidebar="collapsed"] .sb-item { position: relative; }

.main-col { display: flex; flex-direction: column; min-width: 0; height: 100dvh; }
.topbar { display: none; }
.main { flex: 1; overflow-y: auto; overscroll-behavior: contain; scroll-padding-top: var(--space-lg); }
.main:focus { outline: none; }
.page { max-width: var(--page-max); margin: 0 auto; padding: var(--space-xl) var(--space-xl) var(--space-3xl); }
.page > h1:first-child, .page > .spread:first-child { margin-top: 0; }

/* Phones and small tablets: the sidebar becomes a drawer. */
@media (max-width: 56rem) {
  .shell, body[data-sidebar="collapsed"] .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 40; width: min(18rem, 85vw);
    transform: translateX(-100%); transition: transform var(--dur) var(--ease-out); box-shadow: var(--shadow-pop);
  }
  body[data-nav-open] .sidebar { transform: none; }
  body[data-nav-open] .scrim { opacity: 1; pointer-events: auto; }
  body[data-sidebar="collapsed"] .sidebar { padding-inline: var(--space-xs); align-items: stretch; }
  body[data-sidebar="collapsed"] :is(.sb-nav, .sb-foot, .sb-top) { align-items: stretch; }
  body[data-sidebar="collapsed"] :is(.brand-name, .sb-label, .sb-user, .sb-switch) { position: static; width: auto; height: auto; clip: auto; }
  body[data-sidebar="collapsed"] :is(.sb-item, .sb-foot) { width: auto; justify-content: flex-start; padding: 0 var(--space-xs); }
  body[data-sidebar="collapsed"] .sb-count { position: static; transform: none; }
  body[data-sidebar="collapsed"] .sb-top { flex-direction: row; }
  body[data-sidebar="collapsed"] .sb-head { visibility: visible; height: auto; padding: var(--space-md) var(--space-xs) var(--space-2xs); }
  .sb-toggle { display: none; }
  .topbar {
    display: flex; align-items: center; gap: var(--space-sm); padding: var(--space-xs) var(--space-md);
    border-bottom: var(--rule); background: var(--color-paper); min-height: 3.25rem; flex: none;
  }
  .topbar .brand-name { font-weight: 600; }
  .page { padding: var(--space-lg) var(--space-md) var(--space-2xl); }
}
.scrim { position: fixed; inset: 0; z-index: 30; background: var(--color-scrim); opacity: 0; pointer-events: none; transition: opacity var(--dur) var(--ease-out); }

/* ---------- single-card pages: sign in, sign up, verify ---------- */
body.solo { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; padding: var(--space-2xl) var(--space-md); background: var(--color-paper-2); }
.solo-brand { display: flex; align-items: center; gap: var(--space-xs); margin-bottom: var(--space-lg); font-weight: 600; color: var(--color-ink); text-decoration: none; }
.solo-card { width: 100%; max-width: 26rem; background: var(--color-surface); border: var(--rule); border-radius: var(--radius-lg); padding: var(--space-xl); box-shadow: var(--shadow-1); }
.solo-card h1 { font-size: var(--text-xl); margin-bottom: var(--space-xs); }
.solo-card > p.muted:first-of-type { margin-bottom: var(--space-lg); }
.solo-foot { margin-top: var(--space-lg); font-size: var(--text-sm); color: var(--color-ink-3); text-align: center; }
.prose-page { max-width: 46rem; margin-inline: auto; }
.prose-page h2 { margin-top: var(--space-lg); }

/* ---------- page header ---------- */
.spread { display: flex; justify-content: space-between; align-items: center; gap: var(--space-sm) var(--space-md); flex-wrap: wrap; margin-bottom: var(--space-lg); }
.spread h1 { margin: 0; }
.spread > .row { gap: var(--space-xs); }
.page > h1 { margin-bottom: var(--space-lg); }
.page > h1 + p.muted, .spread + p.muted { margin-top: calc(var(--space-sm) * -1); margin-bottom: var(--space-lg); max-width: 68ch; }

/* ---------- surfaces ---------- */
.card { background: var(--color-surface); border: var(--rule); border-radius: var(--radius-lg); padding: var(--space-lg); margin-bottom: var(--space-md); box-shadow: var(--shadow-1); min-width: 0; }
.card > h2:first-child { margin-top: 0; }
details.card > summary { cursor: pointer; list-style: none; display: flex; gap: var(--space-xs); align-items: baseline; flex-wrap: wrap; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::before { content: "›"; color: var(--color-ink-3); transition: transform var(--dur-short) var(--ease-out); display: inline-block; }
details.card[open] > summary::before { transform: rotate(90deg); }
details.card[open] > summary { margin-bottom: var(--space-md); }
.grid { display: grid; gap: var(--space-md); grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr)); margin-bottom: var(--space-md); }
.cols { display: grid; gap: var(--space-lg); grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
.cols.wide { grid-template-columns: minmax(0, 2fr) minmax(18rem, 1fr); }
@media (max-width: 64rem) { .cols, .cols.wide { grid-template-columns: minmax(0, 1fr); } }

/* Stat tiles */
.stats { display: grid; gap: var(--space-sm); grid-template-columns: repeat(auto-fill, minmax(min(100%, 9rem), 1fr)); margin-bottom: var(--space-xl); }
.stat { background: var(--color-surface); border: var(--rule); border-radius: var(--radius-lg); padding: var(--space-md); display: flex; flex-direction: column; gap: var(--space-2xs); box-shadow: var(--shadow-1); }
.stat b { font-size: var(--text-2xl); font-weight: 650; letter-spacing: var(--tracking-display); font-variant-numeric: tabular-nums; line-height: 1.1; order: 2; }
.stat span { color: var(--color-ink-2); font-size: var(--text-sm); order: 1; }
.stat a { color: inherit; }
.stat.attention b { color: var(--color-bad); }

/* ---------- tables ---------- */
/* position: relative keeps absolutely placed bits (a visually-hidden header) inside the scroll, not widening the page. */
.tablewrap { position: relative; overflow-x: auto; border: var(--rule); border-radius: var(--radius-lg); background: var(--color-surface); box-shadow: var(--shadow-1); margin-bottom: var(--space-md); }
.tablewrap > table { border: 0; border-radius: 0; box-shadow: none; margin: 0; }
table { width: 100%; border-collapse: collapse; background: var(--color-surface); border: var(--rule); border-radius: var(--radius-lg); font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: var(--space-sm) var(--space-md); border-bottom: var(--rule); vertical-align: middle; }
th { background: var(--color-paper-2); font-weight: 500; color: var(--color-ink-2); font-size: var(--text-sm); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr, table tr:not(:first-child) { transition: background-color var(--dur-short) var(--ease-out); }
table tr:not(:first-child):hover td { background: var(--color-paper-2); }
td a { font-weight: 500; text-decoration: none; }
td a:hover { text-decoration: underline; }
td.muted, td .muted { color: var(--color-ink-3); }

/* ---------- forms ---------- */
label { display: block; margin: 0 0 var(--space-md); font-weight: 500; font-size: var(--text-sm); color: var(--color-ink); overflow-wrap: anywhere; }
label > :is(input, select, textarea) { display: block; width: 100%; margin-top: var(--space-2xs); }
label > .small { display: block; font-weight: 400; margin-top: var(--space-2xs); }
input, select, textarea, button { font: inherit; color: inherit; }
:is(input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], input[type=search], input[type=tel], input[type=date], select, textarea) {
  min-height: var(--control-h); padding: 0 var(--space-sm); background: var(--color-surface); color: var(--color-ink);
  border: 1px solid var(--color-rule-strong); border-radius: var(--radius); box-shadow: var(--shadow-1);
  outline: 2px solid transparent; outline-offset: 1px;
}
textarea { padding: var(--space-xs) var(--space-sm); min-height: 6rem; font-family: var(--font-mono); font-size: var(--text-sm); line-height: 1.6; resize: vertical; }
textarea.prose, .thread + form textarea { font-family: var(--font-body); font-size: var(--text-base); }
select:not([multiple]) { padding-right: var(--space-xl); appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--color-ink-3) 50%), linear-gradient(135deg, var(--color-ink-3) 50%, transparent 50%);
  background-position: calc(100% - 15px) 55%, calc(100% - 10px) 55%; background-size: 5px 5px; background-repeat: no-repeat; }
select[multiple] { background-image: none; padding: var(--space-2xs); }
::placeholder { color: var(--color-ink-3); opacity: 1; }
:is(input, select, textarea):hover:not(:disabled) { border-color: var(--color-ink-3); }
:is(input, select, textarea):focus-visible { outline: 2px solid var(--color-focus); outline-offset: 1px; border-color: var(--color-focus); }
:is(input, select, textarea):disabled { background: var(--color-paper-2); color: var(--color-ink-3); cursor: not-allowed; }
:is(input, select, textarea):user-invalid { border-color: var(--color-bad); }
label.check { display: flex; align-items: center; gap: var(--space-xs); font-weight: 400; font-size: var(--text-base); margin-bottom: var(--space-sm); cursor: pointer; }
input[type=checkbox], input[type=radio] { width: 1rem; height: 1rem; margin: 0; accent-color: var(--color-accent); flex: none; cursor: pointer; }
label.check > input { display: inline-block; width: 1rem; margin: 0; }
fieldset { border: var(--rule); border-radius: var(--radius); padding: var(--space-sm) var(--space-md); margin: 0 0 var(--space-sm); }
legend { font-weight: 600; font-size: var(--text-sm); padding: 0 var(--space-2xs); }
.fieldgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 14rem), 1fr)); gap: 0 var(--space-md); }
.fieldgrid .span2 { grid-column: 1 / -1; }

/* ---------- buttons ---------- */
button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-xs); white-space: nowrap;
  min-height: var(--control-h); padding: 0 var(--space-md); border-radius: var(--radius); border: 1px solid transparent;
  background: var(--color-accent); color: var(--color-accent-ink); font-weight: 500; text-decoration: none; cursor: pointer;
  transition: background-color var(--dur-short) var(--ease-out), border-color var(--dur-short) var(--ease-out), color var(--dur-short) var(--ease-out), transform var(--dur-short) var(--ease-out);
}
button:hover, .btn:hover { background: var(--color-accent-hover); color: var(--color-accent-ink); }
button:active, .btn:active { transform: translateY(1px); }
button:disabled, button[aria-busy="true"] { opacity: 0.55; cursor: not-allowed; transform: none; }
button[aria-busy="true"]::after { content: ""; width: 0.8em; height: 0.8em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 700ms linear infinite; }
@keyframes spin { to { transform: rotate(1turn); } }
:is(button, .btn).secondary { background: var(--color-surface); color: var(--color-ink); border-color: var(--color-rule-strong); box-shadow: var(--shadow-1); }
:is(button, .btn).secondary:hover { background: var(--color-paper-2); border-color: var(--color-ink-3); color: var(--color-ink); }
button.danger { background: var(--color-surface); color: var(--color-bad); border-color: color-mix(in oklch, var(--color-bad) 35%, var(--color-rule)); }
button.danger:hover { background: var(--color-bad-soft); color: var(--color-bad); }
button.link, button.danger-link { background: none; border: 0; min-height: 0; padding: 0; color: var(--color-accent); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
button.link:hover { background: none; color: var(--color-accent-hover); }
.danger-link, button.link.danger-link { color: var(--color-bad) !important; }
button.icon, .icon-btn { min-height: 2rem; width: 2rem; padding: 0; background: transparent; color: var(--color-ink-2); border: 1px solid transparent; }
button.icon:hover, .icon-btn:hover { background: var(--color-paper-3); color: var(--color-ink); }
.wide { width: 100%; }

/* ---------- layout helpers ---------- */
.row { display: flex; gap: var(--space-sm); align-items: flex-end; flex-wrap: wrap; }
.row > label { margin: 0; flex: 1 1 10rem; min-width: 0; }
.row > label.check { flex: 0 1 auto; margin: 0; align-self: center; }
.row > :is(button, .btn, a) { flex: none; }
form.row, .card.row { align-items: flex-end; }
.inline { display: inline; }
.muted { color: var(--color-ink-2); }
.small { font-size: var(--text-sm); }
.rowitem { margin-bottom: var(--space-xs); align-items: center; }
.rowitem > :is(input, select) { flex: 1 1 8rem; min-width: 0; }

/* ---------- feedback ---------- */
.flash, .banner {
  display: flex; gap: var(--space-xs); align-items: flex-start; padding: var(--space-sm) var(--space-md); margin-bottom: var(--space-lg);
  border-radius: var(--radius); border: 1px solid color-mix(in oklch, var(--color-ok) 30%, transparent);
  background: var(--color-ok-soft); color: var(--color-ink); overflow-wrap: anywhere;
}
.flash::before, .banner::before { content: ""; flex: none; width: 0.5rem; height: 0.5rem; border-radius: 50%; margin-top: 0.45rem; background: var(--color-ok); }
.flash.warn, .banner.warn { background: var(--color-warn-soft); border-color: color-mix(in oklch, var(--color-warn) 35%, transparent); }
.flash.warn::before, .banner.warn::before { background: var(--color-warn); }
.flash.error { background: var(--color-bad-soft); border-color: color-mix(in oklch, var(--color-bad) 35%, transparent); }
.flash.error::before { background: var(--color-bad); }
.flash.small { margin: var(--space-xs) 0 0; padding: var(--space-xs) var(--space-sm); }
.empty { text-align: center; padding: var(--space-2xl) var(--space-md) !important; color: var(--color-ink-2); }

/* Status badges: a dot and a word, never colour alone. */
.badge {
  display: inline-flex; align-items: center; gap: var(--space-2xs); padding: var(--space-3xs) var(--space-xs); border-radius: var(--radius-sm);
  font-size: var(--text-xs); font-weight: 500; white-space: nowrap; line-height: 1.5;
  background: var(--color-paper-3); color: var(--color-ink-2); text-decoration: none;
}
.badge::before { content: ""; width: 0.4rem; height: 0.4rem; border-radius: 50%; background: currentColor; opacity: 0.8; }
.s-delivered, .s-ok, .s-received, .s-closed, .s-completed, .s-on { background: var(--color-ok-soft); color: var(--color-ok); }
.s-failed, .s-dead, .s-error, .s-urgent { background: var(--color-bad-soft); color: var(--color-bad); }
.s-blocked, .s-pending, .s-high, .s-unparsed, .s-exited { background: var(--color-warn-soft); color: var(--color-warn); }
.s-sent, .s-open, .s-active, .s-normal { background: var(--color-info-soft); color: var(--color-info); }
a.badge:hover { filter: brightness(0.97); }
.tag { display: inline-block; background: var(--color-accent-soft); color: var(--color-accent); border-radius: var(--radius-sm); padding: 0 var(--space-2xs); font-size: var(--text-xs); font-weight: 500; margin: 1px 2px 1px 0; }

/* ---------- specific components ---------- */
.perms { columns: 2 22rem; column-gap: var(--space-md); }
.perms fieldset { break-inside: avoid; }
.perms .small { color: var(--color-ink-3); font-family: var(--font-mono); font-size: var(--text-xs); }
.chips { display: flex; flex-wrap: wrap; gap: var(--space-2xs); }
.chips button { min-height: 1.75rem; padding: 0 var(--space-xs); font-family: var(--font-mono); font-size: var(--text-xs); font-weight: 400; background: var(--color-accent-soft); color: var(--color-accent); border: 0; }
.chips button:hover { background: var(--color-accent); color: var(--color-accent-ink); }
.preview { width: 100%; min-height: 32rem; border: var(--rule); border-radius: var(--radius-lg); background: var(--color-canvas-email); }
.bubble { background: var(--color-ok-soft); border-radius: var(--radius-lg) var(--radius-lg) var(--radius-lg) var(--radius-sm); padding: var(--space-sm) var(--space-md); max-width: 26rem; white-space: pre-wrap; }
.thread { display: flex; flex-direction: column; gap: var(--space-xs); margin-bottom: var(--space-lg); }
.msg { max-width: min(70%, 36rem); padding: var(--space-xs) var(--space-sm); border-radius: var(--radius-lg); overflow-wrap: anywhere; }
.msg.in { background: var(--color-surface); border: var(--rule); align-self: flex-start; border-bottom-left-radius: var(--radius-sm); }
.msg.out { background: var(--color-accent-soft); align-self: flex-end; border-bottom-right-radius: var(--radius-sm); }
.msg .meta { display: block; font-size: var(--text-xs); color: var(--color-ink-3); margin-top: var(--space-2xs); }
.msg-body { white-space: pre-wrap; }
#gjs { height: 70vh; border: var(--rule); border-radius: var(--radius-lg); overflow: hidden; }
.pager { margin-top: var(--space-md); gap: var(--space-md); align-items: center; }
.colrow { display: grid; grid-template-columns: 2fr 1.4fr 1fr 1.4fr 0.5fr 0.6fr auto; gap: var(--space-sm); align-items: center; padding: var(--space-sm) var(--space-md); }
.colrow input[type=text] { width: 100%; }
.coldelete { padding: 0 var(--space-md) var(--space-sm); }
@media (max-width: 64rem) { .colrow { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }

/* Workflow steps */
.steps { list-style: none; padding: 0; margin: 0 0 var(--space-md); display: flex; flex-direction: column; gap: 0; }
.step { position: relative; background: var(--color-surface); border: var(--rule); border-radius: var(--radius-lg); padding: var(--space-sm) var(--space-md) var(--space-md); box-shadow: var(--shadow-1); }
.step + .step { margin-top: var(--space-lg); }
.step + .step::before { content: ""; position: absolute; left: calc(var(--space-md) + 0.8rem); top: calc(var(--space-lg) * -1); height: var(--space-lg); border-left: 2px dashed var(--color-rule-strong); }
.step-head { display: flex; align-items: center; gap: var(--space-sm); margin-bottom: var(--space-sm); flex-wrap: wrap; }
.step-head select { width: auto; font-weight: 600; }
.step-num { width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--color-accent); color: var(--color-accent-ink); display: grid; place-items: center; font-weight: 600; font-size: var(--text-xs); flex: none; }
.step-tools { margin-left: auto; display: flex; gap: var(--space-3xs); }
.step-body .row > label { flex: 1 1 12rem; }
.runlog { margin: var(--space-xs) 0 0; padding-left: var(--space-lg); }
.runlog li { margin-bottom: var(--space-3xs); }
details > summary { cursor: pointer; }

/* Onboarding wizard */
.wizard { list-style: none; display: flex; gap: var(--space-xs); padding: 0; margin: 0 0 var(--space-xl); flex-wrap: wrap; }
.wizard li { flex: 1 1 10rem; }
.wizard a { display: flex; align-items: center; gap: var(--space-xs); padding: var(--space-xs) var(--space-sm); border-radius: var(--radius); border: var(--rule); color: var(--color-ink-2); text-decoration: none; font-weight: 500; background: var(--color-surface); }
.wizard a span { width: 1.5rem; height: 1.5rem; border-radius: 50%; display: grid; place-items: center; background: var(--color-paper-3); font-size: var(--text-xs); flex: none; }
.wizard li.on a { border-color: var(--color-accent); color: var(--color-ink); box-shadow: 0 0 0 1px var(--color-accent); }
.wizard li.on a span, .wizard li.done a span { background: var(--color-accent); color: var(--color-accent-ink); }

/* Dashboard */
.dash-head { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--space-md); flex-wrap: wrap; margin-bottom: var(--space-lg); }
.dash-head p { margin: var(--space-2xs) 0 0; color: var(--color-ink-2); }
.bar { height: 0.375rem; border-radius: var(--radius-pill); background: var(--color-paper-3); overflow: hidden; min-width: 4rem; }
.bar > i { display: block; height: 100%; background: var(--color-accent); border-radius: inherit; }

/* ---------- motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0ms !important; animation-duration: 0ms !important; }
  .sidebar, .scrim { transition: opacity 120ms linear !important; }
}


/* Count beside a page title */
.spread h1 .small, .count { display: inline-block; vertical-align: middle; margin-left: var(--space-xs); padding: 0 var(--space-xs); border-radius: var(--radius-sm); background: var(--color-paper-3); color: var(--color-ink-2); font-size: var(--text-sm); font-weight: 500; letter-spacing: 0; }

/* Filters: search takes the room */
.filters { display: flex; gap: var(--space-xs); flex-wrap: wrap; margin-bottom: var(--space-md); }
.filters input[type=search] { flex: 1 1 16rem; min-width: 0; }
.filters :is(select, input[type=text]) { flex: 0 1 11rem; min-width: 0; }

/* Bulk bar: appears once rows are ticked */
.bulkbar { display: flex; align-items: center; gap: var(--space-xs); flex-wrap: wrap; padding: var(--space-xs) var(--space-sm); margin-bottom: var(--space-sm);
  border: 1px solid var(--color-accent); background: var(--color-accent-soft); border-radius: var(--radius-lg); }
.bulkbar b { margin-right: var(--space-xs); font-weight: 600; }
.bulkbar :is(select, input) { width: auto; min-width: 9rem; }

/* Rows whose fields are naturally short (a number and a unit) keep their size. */
.row.compact > label { flex: 0 0 auto; }

/* Theme toggle: offer the other mode. Follows data-theme, else the device setting. */
.theme-toggle { margin: 0; display: inline; }
.theme-toggle .to-light { display: none; }
:root[data-theme="dark"] .theme-toggle .to-dark { display: none; }
:root[data-theme="dark"] .theme-toggle .to-light { display: contents; }
@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] .theme-toggle .to-dark { display: none; }
  :root[data-theme="system"] .theme-toggle .to-light { display: contents; }
}
.solo-foot .theme-toggle .sb-label { margin-left: var(--space-2xs); }
.solo-foot .theme-toggle .icon { width: 14px; height: 14px; }
.theme-options { display: flex; gap: var(--space-xs); flex-wrap: wrap; }
.theme-options label { display: flex; align-items: center; gap: var(--space-xs); margin: 0; padding: var(--space-xs) var(--space-md); border: var(--rule); border-radius: var(--radius); background: var(--color-surface); cursor: pointer; font-weight: 500; }
.theme-options label:has(input:checked) { border-color: var(--color-accent); box-shadow: 0 0 0 1px var(--color-accent); }

/* Settings / integration cards */
.settings-stack { display: flex; flex-direction: column; gap: var(--space-md); }
.setting { margin: 0; }
.setting > header { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-md); margin-bottom: var(--space-md); }
.setting > header h2 { margin: 0; font-size: var(--text-md); }
.setting > header p { margin: var(--space-3xs) 0 0; }
.provider { display: flex; gap: var(--space-sm); align-items: flex-start; min-width: 0; }
.logo { flex: none; width: 2.5rem; height: 2.5rem; border-radius: var(--radius); display: grid; place-items: center; background: var(--color-accent-soft); color: var(--color-accent); }
.how { margin: 0 0 var(--space-md); padding-left: var(--space-lg); color: var(--color-ink-2); }
.how li { margin-bottom: var(--space-xs); }
.copyfield { display: flex; gap: var(--space-xs); align-items: center; margin-top: var(--space-2xs); max-width: 100%; }
.copyfield code { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; padding: var(--space-2xs) var(--space-xs); }
.copyfield button { min-height: 2rem; padding: 0 var(--space-sm); }
.savebar { position: sticky; bottom: 0; padding: var(--space-sm) 0; background: linear-gradient(transparent, var(--color-paper) 40%); }
label > .check { display: flex; gap: var(--space-xs); align-items: center; margin-top: var(--space-xs); font-weight: 400; }
label > .check input { width: 1rem; margin: 0; }

/* Connections */
.conn-list { display: flex; flex-direction: column; border: var(--rule); border-radius: var(--radius-lg); background: var(--color-surface); box-shadow: var(--shadow-1); margin-bottom: var(--space-xl); }
.conn { display: flex; align-items: center; gap: var(--space-md); padding: var(--space-md) var(--space-lg); border-bottom: var(--rule); flex-wrap: wrap; }
.conn:last-child { border-bottom: 0; }
.conn-main { flex: 1 1 16rem; min-width: 0; }
.conn-main b { display: block; }
.conn-main span { color: var(--color-ink-2); font-size: var(--text-sm); }
.conn-actions { display: flex; gap: var(--space-xs); align-items: center; flex-wrap: wrap; }
.conn-actions form { margin: 0; }
.conn-group { font-size: var(--text-sm); font-weight: 600; color: var(--color-ink-2); margin: var(--space-lg) 0 var(--space-xs); }
.conn .unavailable { font-size: var(--text-sm); color: var(--color-ink-3); text-align: right; max-width: 18rem; }

/* Sidebar: the nav scrolls inside the sidebar; the footer stays pinned at the bottom. */
.sidebar { overflow: hidden; }
.sidebar > .sb-nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; margin-inline: calc(var(--space-xs) * -1); padding-inline: var(--space-xs); }
.sb-foot { margin-top: 0; flex-direction: row; align-items: center; gap: var(--space-2xs); }
.sb-me { flex: 1; min-width: 0; display: flex; align-items: center; gap: var(--space-xs); padding: var(--space-2xs) var(--space-xs); border-radius: var(--radius); color: var(--color-ink); text-decoration: none; font-weight: 500; }
.sb-me:hover, .sb-me[aria-current="page"] { background: var(--color-paper-3); color: var(--color-ink); }
.sb-tools { display: flex; gap: var(--space-3xs); }
.sb-tools form { margin: 0; }
.sb-tools .theme-toggle .sb-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
body[data-sidebar="collapsed"] .sb-foot { flex-direction: column; width: 100%; }
@media (min-width: 56.01rem) { body[data-sidebar="collapsed"] .sb-me { flex: none; padding: var(--space-2xs); } }
body[data-sidebar="collapsed"] .sb-tools { flex-direction: column; }
@media (max-width: 56rem) { .sidebar { overflow: hidden; } }

/* No initial badge: the rail shows only the expand button at the top. */
body[data-sidebar="collapsed"] .brand { display: none; }
.brand { padding-left: var(--space-xs); }

/* Optional-field hint stays on the label's line. */
.opt { color: var(--color-ink-3); font-weight: 400; font-size: var(--text-sm); margin-left: var(--space-2xs); }
.hint { display: block; color: var(--color-ink-3); font-weight: 400; font-size: var(--text-sm); margin-top: var(--space-2xs); }

/* Inline validation */
.field-error { display: flex; gap: var(--space-2xs); align-items: center; margin-top: var(--space-2xs); color: var(--color-bad); font-size: var(--text-sm); font-weight: 500; }
.field-error::before { content: "!"; flex: none; width: 1rem; height: 1rem; border-radius: 50%; display: grid; place-items: center; background: var(--color-bad); color: var(--color-surface); font-size: 0.6875rem; font-weight: 700; }
[aria-invalid="true"] { border-color: var(--color-bad) !important; }
[aria-invalid="true"]:focus-visible { outline-color: var(--color-bad); }
.form-actions { display: flex; gap: var(--space-sm); align-items: center; flex-wrap: wrap; margin-top: var(--space-sm); }

/* Column picker (lists) */
.colpick { margin: var(--space-sm) 0; padding: var(--space-sm) var(--space-md); }
.colpick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 12rem), 1fr)); gap: 0 var(--space-md); margin: var(--space-xs) 0; }
.colpick-grid label.check { margin-bottom: var(--space-xs); }

/* Rows of labelled fields line up by their tops, so an error under one field never moves the
 * others; buttons and checkboxes sit level with the inputs (one label line + its gap down). */
.row:has(> label:not(.check)) { align-items: flex-start; }
.row:has(> label:not(.check)) > :is(button, .btn, label.check) { margin-top: calc(var(--text-sm) * var(--leading) + var(--space-2xs)); }
.row:has(> label:not(.check)) > label.check { min-height: var(--control-h); }
dl { display: grid; grid-template-columns: max-content 1fr; gap: var(--space-2xs) var(--space-md); margin: var(--space-md) 0 0; }
dt { font-weight: 500; } dd { margin: 0; }

/* Tables: sortable headers, pager, filter bar */
.th-sort { display: inline-flex; align-items: center; gap: var(--space-2xs); color: inherit; text-decoration: none; }
.th-sort:hover, .th-sort.on { color: var(--color-ink); }
.th-arrow { display: inline-flex; opacity: 0.45; }
.th-sort.on .th-arrow, .th-sort:hover .th-arrow { opacity: 1; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: var(--space-md); flex-wrap: wrap; margin: var(--space-sm) 0 var(--space-lg); }
.pager-links { display: flex; gap: var(--space-3xs); align-items: center; flex-wrap: wrap; }
.pg { min-width: 2.25rem; height: 2.25rem; padding: 0 var(--space-xs); display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius); color: var(--color-ink-2); text-decoration: none; font-variant-numeric: tabular-nums; border: 1px solid transparent; }
a.pg:hover { background: var(--color-paper-3); color: var(--color-ink); }
.pg.on { background: var(--color-surface); border-color: var(--color-rule-strong); color: var(--color-ink); font-weight: 600; box-shadow: var(--shadow-1); }
.pg.disabled { opacity: 0.35; }
.pg.gap { min-width: 1.25rem; padding: 0; }
.filterbar { margin-bottom: var(--space-md); }
.filter-top { display: flex; gap: var(--space-xs); flex-wrap: wrap; align-items: center; }
.filter-top input[type=search] { flex: 1 1 18rem; min-width: 0; }
.filter-rows { display: flex; flex-direction: column; gap: var(--space-2xs); margin-top: var(--space-xs); }
.filter-rows:empty { display: none; }
.filter-row { display: flex; gap: var(--space-xs); align-items: center; margin: 0; flex-wrap: wrap; padding: var(--space-2xs) var(--space-xs); background: var(--color-paper-2); border-radius: var(--radius); }
.filter-row select, .filter-row input { flex: 0 1 12rem; min-width: 0; }
.filter-row input { flex: 1 1 12rem; }
td.check, th.check { width: 2.5rem; }
.segmented { display: inline-flex; gap: var(--space-3xs); padding: var(--space-3xs); background: var(--color-paper-2); border: var(--rule); border-radius: var(--radius); margin-bottom: var(--space-md); flex-wrap: wrap; }
.segmented a { padding: var(--space-2xs) var(--space-sm); border-radius: var(--radius-sm); color: var(--color-ink-2); text-decoration: none; font-weight: 500; white-space: nowrap; }
.segmented a:hover { color: var(--color-ink); background: var(--color-paper-3); }
.segmented a[aria-current="page"] { background: light-dark(var(--color-surface), var(--color-paper-3)); color: var(--color-ink); box-shadow: var(--shadow-1); }

/* Inbox */
.convo-list { display: flex; flex-direction: column; border: var(--rule); border-radius: var(--radius-lg); background: var(--color-surface); box-shadow: var(--shadow-1); overflow: hidden; margin-bottom: var(--space-md); }
.convo-list > .empty.card { margin: 0; border: 0; box-shadow: none; }
.convo { display: flex; gap: var(--space-sm); align-items: center; padding: var(--space-sm) var(--space-md); border-bottom: var(--rule); color: inherit; text-decoration: none; }
.convo:last-child { border-bottom: 0; }
a.convo:hover { background: var(--color-paper-2); }
.convo.waiting .convo-top b::before { content: ""; display: inline-block; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--color-accent); margin-right: var(--space-xs); vertical-align: middle; }
.convo-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--space-3xs); }
.convo-top { display: flex; justify-content: space-between; gap: var(--space-sm); }
.convo-last { color: var(--color-ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: var(--text-sm); }
.msg.email { max-width: min(80%, 44rem); }
.msg-subject { display: flex; gap: var(--space-2xs); align-items: center; margin-bottom: var(--space-3xs); }
.composer .segmented { margin-bottom: var(--space-md); }
.btn.disabled { opacity: 0.4; pointer-events: none; }

/* ---------- Core screens (claude.ai/design "Core Screens"): dashboard, contacts, contact, import, lists ---------- */
/* Message states: an icon says which, so the dot goes. Queued is neutral, read is the accent, dry run is dashed. */
.badge.has-icon::before { display: none; }
.badge .icon { width: 12px; height: 12px; }
.s-queued, .s-sending { background: var(--color-paper-2); color: var(--color-ink-2); box-shadow: inset 0 0 0 1px var(--color-rule); }
.s-read { background: var(--color-accent-soft); color: var(--color-accent-text); }
.s-dry_run { background: transparent; color: var(--color-ink-2); outline: 1px dashed var(--color-rule-strong); outline-offset: -1px; }

/* Page header: breadcrumb or date above the title, a meta line under it, actions on the right. */
.page-head { display: flex; flex-wrap: wrap; gap: var(--space-sm); align-items: flex-end; justify-content: space-between; margin-bottom: var(--space-lg); }
.page-head h1 { line-height: 2rem; font-weight: 600; }
.page-head .row { gap: var(--space-xs); align-items: center; }
.eyebrow, .sub { font-size: var(--text-sm); color: var(--color-ink-3); margin: 0; }
.eyebrow a { color: var(--color-ink-3); }
.panel { background: var(--color-surface); border: var(--rule); border-radius: var(--radius-lg); min-width: 0; margin-bottom: var(--space-md); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-xs); padding: var(--space-sm) var(--space-md); border-bottom: var(--rule); }
.panel-head h2 { margin: 0; font-size: var(--text-md); }
.panel-head a { font-size: var(--text-sm); font-weight: 500; }
.panel-body { padding: var(--space-md); }
.panel h2 { margin-top: 0; font-size: var(--text-md); }
.panel-body > h2 { margin-bottom: var(--space-sm); }
.split { display: flex; flex-wrap: wrap; gap: 1.25rem; align-items: flex-start; }
.split > .main-part { flex: 999 1 32rem; min-width: 0; }
.split > .side-part { flex: 1 1 20rem; min-width: 0; }

/* Dashboard */
.checklist { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr)); gap: var(--space-2xs) 1.25rem; }
.checklist a { display: flex; align-items: center; gap: 0.625rem; min-height: var(--control-h); color: var(--color-accent-text); text-decoration: none; }
.checklist a:hover { text-decoration: underline; }
.checklist .tick { width: 18px; height: 18px; flex: none; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid var(--color-rule-strong); color: var(--color-accent-ink); }
.checklist .done a { color: var(--color-ink-3); text-decoration: line-through; }
.checklist .done .tick { border-color: var(--color-accent); background: var(--color-accent); }
.setup-head { display: flex; flex-wrap: wrap; gap: var(--space-xs) var(--space-md); align-items: center; margin-bottom: var(--space-sm); }
.setup-head h2 { margin: 0; font-size: var(--text-md); }
.setup-head .bar { flex: 1 1 7.5rem; max-width: 12.5rem; }
.setup-head form { margin: 0 0 0 auto; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 10.5rem), 1fr)); gap: var(--space-sm); margin-bottom: 1.25rem; }
.tile { display: flex; flex-direction: column; gap: 2px; padding: 0.875rem var(--space-md); background: var(--color-surface); border: var(--rule); border-radius: var(--radius-lg); color: var(--color-ink); text-decoration: none; }
a.tile:hover { border-color: var(--color-rule-strong); color: var(--color-ink); }
.tile span { font-size: var(--text-sm); color: var(--color-ink-2); }
.tile b { font-size: 1.5rem; line-height: 2rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.tile small { font-size: var(--text-xs); color: var(--color-ink-3); }
.tile.bad b { color: var(--color-bad); }
.feed-row { display: flex; align-items: center; gap: var(--space-sm); min-height: 2.5rem; padding: var(--space-xs) var(--space-md); border-top: var(--rule); color: var(--color-ink); text-decoration: none; }
.panel-head + .feed-row { border-top: 0; }
a.feed-row:hover { background: var(--color-paper-2); color: var(--color-ink); }
.feed-row > .icon { color: var(--color-ink-3); }
.feed-main { flex: 1; min-width: 0; }
.feed-main b, .feed-main small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed-main b { font-weight: 500; }
.feed-main small, .feed-time { font-size: var(--text-xs); color: var(--color-ink-3); }
.feed-time { width: 3.5rem; text-align: right; flex: none; }
.pipe { display: grid; grid-template-columns: 7rem minmax(0, 1fr) 3rem; gap: 0.625rem; align-items: center; min-height: var(--control-h); color: var(--color-ink); text-decoration: none; font-size: var(--text-sm); border-radius: var(--radius-sm); }
.pipe:hover { background: var(--color-paper-2); color: var(--color-ink); }
.pipe .bar { height: 8px; }
.pipe b { font-weight: 400; text-align: right; font-variant-numeric: tabular-nums; color: var(--color-ink-2); }

/* A status is a small square swatch and its name. The swatch colour follows the status's place in Settings. */
.st { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.st::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--sw, var(--color-ink-3)); }
.sw0 { --sw: var(--color-info); } .sw1 { --sw: var(--color-ink-3); } .sw2 { --sw: var(--color-accent); } .sw3 { --sw: var(--color-warn); } .sw4 { --sw: var(--color-ok); }
.none { color: var(--color-ink-3); }
.cell-sub { display: block; font-size: var(--text-xs); color: var(--color-ink-3); font-weight: 400; }
tr:has(.pick:checked) td { background: var(--color-accent-soft); }
.search-box { position: relative; flex: 1 1 16rem; max-width: 22.5rem; display: flex; }
.search-box .icon { position: absolute; left: 10px; top: 50%; translate: 0 -50%; color: var(--color-ink-3); pointer-events: none; }
.search-box input { width: 100%; padding-left: 2rem !important; }
.filter-top .push { margin-left: auto; }

/* Empty and error states */
.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--space-xs); padding: var(--space-2xl) 1.25rem; }
.empty-state .ring { width: 44px; height: 44px; border-radius: 50%; background: var(--color-paper-2); display: grid; place-items: center; color: var(--color-ink-2); }
.empty-state b { font-size: var(--text-md); }
.empty-state p { color: var(--color-ink-2); max-width: 22.5rem; margin: 0; }
.empty-state .row { justify-content: center; margin-top: 6px; align-items: center; }

/* Contact page */
.notice { display: flex; flex-wrap: wrap; align-items: center; gap: 0.625rem; padding: 0.625rem 0.875rem; border-radius: var(--radius-lg); margin-bottom: var(--space-md); }
.notice > div { flex: 1 1 15rem; }
.notice.warn { background: var(--color-warn-soft); color: var(--color-warn); }
.notice.bad { background: var(--color-bad-soft); color: var(--color-bad); font-size: var(--text-sm); }
.notice form { margin: 0; }
.notice button { min-height: 1.75rem; padding: 0 0.625rem; background: transparent; color: inherit; border: 1px solid currentColor; }
.notice button:hover { background: transparent; color: inherit; }
.checks { display: flex; flex-direction: column; gap: var(--space-2xs); font-size: var(--text-sm); margin: 0; padding: 0; list-style: none; }
.checks li { display: flex; gap: var(--space-xs); align-items: center; }
.checks .warn { color: var(--color-warn); } .checks .ok { color: var(--color-ok); }
.send-row { display: flex; flex-wrap: wrap; gap: var(--space-xs); }
.send-row select { flex: 1 1 15rem; width: auto; }
.timeline { list-style: none; margin: 0; padding: var(--space-xs) var(--space-md) var(--space-md); }
.timeline > li { display: flex; gap: var(--space-sm); padding: 0.625rem 0; border-bottom: var(--rule); }
.timeline > li:last-child { border-bottom: 0; }
.tl-dot { width: 28px; height: 28px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--color-paper-2); color: var(--color-ink-2); }
.tl-dot.out { background: var(--color-accent-soft); color: var(--color-accent-text); }
.tl-dot.bad { background: var(--color-bad-soft); color: var(--color-bad); }
.tl-dot.warn { background: var(--color-warn-soft); color: var(--color-warn); }
.tl-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--space-2xs); }
.tl-top { display: flex; flex-wrap: wrap; gap: 6px 0.625rem; align-items: center; }
.tl-top > b { font-weight: 500; }
.tl-top > time { margin-left: auto; font-size: var(--text-xs); color: var(--color-ink-3); }
.tl-body { font-size: var(--text-sm); color: var(--color-ink-2); overflow-wrap: anywhere; }
.tl-actions { display: flex; gap: var(--space-xs); align-items: center; font-size: var(--text-sm); }
.tl-actions form { margin: 0; }
.tl-actions button { min-height: 1.75rem; padding: 0 0.625rem; font-size: var(--text-sm); }
.side-part .fieldgrid { grid-template-columns: minmax(0, 1fr); }
.side-part label { font-size: var(--text-xs); color: var(--color-ink-2); }
.side-part label.check { font-size: var(--text-base); color: var(--color-ink); min-height: var(--control-h); margin: 0; }
.side-part fieldset { border: 0; border-top: var(--rule); border-radius: 0; padding: 0.625rem 0 0; margin: 0 0 var(--space-sm); }
.side-part legend { font-size: var(--text-xs); font-weight: 500; color: var(--color-ink-2); padding: 0; margin-bottom: var(--space-2xs); }
.side-part h2 { font-size: var(--text-base); margin: 0; }
.chip { display: inline-flex; align-items: center; min-height: 26px; padding: 0 0.625rem; border-radius: var(--radius-pill); background: var(--color-paper-2); border: var(--rule); font-size: var(--text-sm); color: var(--color-ink); text-decoration: none; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: var(--space-xs) 0; }
.chip-row form { margin: 0; display: inline-flex; }
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 4px); z-index: 10; min-width: 11rem; padding: var(--space-2xs); background: var(--color-surface); border: var(--rule); border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); display: flex; flex-direction: column; }
.menu-pop form { margin: 0; }
.menu-pop :is(a, button) { width: 100%; justify-content: flex-start; min-height: var(--control-h); padding: 0 var(--space-xs); background: transparent; color: var(--color-ink); border: 0; font-weight: 400; text-decoration: none; display: flex; align-items: center; border-radius: var(--radius-sm); }
.menu-pop :is(a, button):hover { background: var(--color-paper-2); color: var(--color-ink); }
.menu-pop button.danger { color: var(--color-bad); }

/* Import */
.steps-bar { list-style: none; margin: 0 0 var(--space-md); padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-xs) 1.25rem; font-size: var(--text-sm); color: var(--color-ink-3); }
.steps-bar li { display: flex; gap: 6px; align-items: center; }
.steps-bar [aria-current] { font-weight: 600; color: var(--color-ink); }
.match td { vertical-align: top; }
.match select { width: 100%; }
.field-note { margin-top: var(--space-2xs); font-size: var(--text-xs); color: var(--color-ink-3); display: flex; gap: 6px; align-items: center; }
.field-note.bad { color: var(--color-bad); }
.two-up { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 17.5rem), 1fr)); gap: var(--space-md); margin-bottom: var(--space-md); }
.two-up > * { margin: 0; }
.two-up fieldset { background: var(--color-surface); border: var(--rule); border-radius: var(--radius-lg); padding: 0.875rem var(--space-md); }
.two-up legend { float: left; width: 100%; font-size: var(--text-base); margin-bottom: var(--space-2xs); padding: 0; }
.two-up fieldset .hint { clear: both; margin: 0 0 var(--space-2xs); }
.two-up label.check { min-height: var(--control-h); margin: 0; }
.foot-row { display: flex; flex-wrap: wrap; gap: var(--space-xs); justify-content: space-between; align-items: center; }

/* Lists */
.list-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-xs) var(--space-md); min-height: 2.5rem; padding: 0.625rem var(--space-md); border-top: var(--rule); }
.list-row:first-child { border-top: 0; }
.list-row > div { flex: 1 1 15rem; min-width: 0; }
.list-row > div a { font-weight: 500; color: var(--color-ink); }
.list-row .n { width: 7rem; font-variant-numeric: tabular-nums; color: var(--color-ink-2); }
.list-row .when { width: 9rem; font-size: var(--text-sm); color: var(--color-ink-3); }
.reach { border: var(--rule); border-radius: var(--radius-lg); padding: var(--space-sm) 0.875rem; background: var(--color-paper-2); display: flex; flex-direction: column; gap: 6px; margin: var(--space-md) 0; }
.reach > b { font-weight: 600; }
.reach-why { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: var(--text-sm); }
.reach-why a { color: var(--color-warn); display: flex; gap: 6px; align-items: center; }

/* Dense record tables: one line a row (40px), the table scrolls sideways inside its card instead. */
.stack-sm td, .stack-sm th { white-space: nowrap; padding: 6px var(--space-sm); }
.stack-sm td:has(> .cell-sub) { padding-block: 4px; }
.stack-sm tr:not(:first-child) { height: 2.5rem; }

/* Phones: a wide table becomes stacked rows. The tick sits in its own 44px column; the main cell
   and every other cell line up beside it, one per line, each led by its column name. */
@media (max-width: 56rem) {
  .stack-sm table, .stack-sm tbody { display: block; }
  .stack-sm tr:first-child:has(th) { display: none; }
  .stack-sm tr { display: grid; grid-template-columns: minmax(0, 1fr); row-gap: 2px; align-items: start; padding: 0.75rem var(--space-sm); border-bottom: var(--rule); }
  .stack-sm tr:has(> td.check) { grid-template-columns: 2.25rem minmax(0, 1fr); column-gap: var(--space-xs); }
  .stack-sm tr:last-child { border-bottom: 0; }
  .stack-sm tr:not(:first-child) { height: auto; }
  .stack-sm table tr:not(:first-child):hover > td { background: transparent; }
  .stack-sm table tr:not(:first-child):hover { background: color-mix(in oklch, var(--color-paper-2) 55%, var(--color-surface)); }
  .stack-sm tr > td:has(> .badge) { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2xs); }
  .stack-sm tr > td { grid-column: -2; border: 0; padding: 0; white-space: normal; overflow-wrap: anywhere; text-align: start; line-height: 1.45; }
  .stack-sm td.num { text-align: start; }
  .stack-sm td.check { grid-column: 1; grid-row: 1; width: 2.25rem; height: 2.75rem; margin: -0.6rem 0 0; display: grid; place-items: center start; }
  .stack-sm td:empty { display: none; }
  .stack-sm td.empty, .stack-sm td[colspan] { grid-column: 1 / -1; text-align: center; padding: var(--space-md) 0; }
  /* The first real cell is the row's name. */
  .stack-sm td:not(.check):first-child, .stack-sm td.check + td { font-weight: 600; color: var(--color-ink); margin-bottom: 2px; }
  .stack-sm td:not(.check):not(:first-child):not(.check + td) { font-size: var(--text-sm); color: var(--color-ink-2); }
  .stack-sm td .cell-sub { display: inline; margin-left: var(--space-2xs); }
  .stack-sm td .cell-sub::before { content: "· "; }
  .stack-sm td.act { margin-top: var(--space-2xs); display: flex; flex-wrap: wrap; gap: var(--space-xs); align-items: center; justify-content: flex-start; }
  /* A figure says what it counts once its column header is gone. */
  .stack-sm td[data-label]:not(:first-child):not(.check + td)::before { content: attr(data-label) ": "; color: var(--color-ink-3); }
}

/* ---------- Sidebar and site banners (claude.ai/design "Sidebar") ---------- */
.sidebar { background: var(--color-surface); padding: 0; gap: 0; }
.sb-top { height: 56px; min-height: 56px; padding: 0 var(--space-sm); gap: 10px; border-bottom: var(--rule); }
.org-mark { width: 30px; height: 30px; flex: none; border-radius: var(--radius); background: var(--color-accent); color: var(--color-accent-ink); display: grid; place-items: center; font-weight: 600; font-size: var(--text-xs); letter-spacing: .02em; }
.sb-org { flex: 1; min-width: 0; color: var(--color-ink); text-decoration: none; }
.sb-org > summary { display: flex; align-items: center; gap: var(--space-2xs); cursor: pointer; color: var(--color-ink-3); }
.sb-org-name { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.2; }
.sb-org-name b { font-size: var(--text-base); font-weight: 600; color: var(--color-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-org-name small { font-size: var(--text-xs); color: var(--color-ink-3); }
.sb-org .menu-pop { left: 0; right: auto; min-width: 14rem; }
.sb-org .menu-pop button[aria-current] { font-weight: 600; color: var(--color-accent-text); }
.sb-top .sb-toggle { width: 32px; min-height: 32px; color: var(--color-ink-3); }
.sidebar > .sb-nav { padding: var(--space-2xs) var(--space-xs) var(--space-sm); margin: 0; gap: 1px; }
.sb-head { padding: 14px 10px 4px; font-weight: 500; }
.sb-item { min-height: 32px; gap: 10px; padding: 0 10px; border-radius: var(--radius); font-weight: 400; color: var(--color-ink-2); }
.sb-item:hover { background: var(--color-paper-3); }
.sb-item[aria-current="page"] { background: var(--color-accent-soft); color: var(--color-accent-text); font-weight: 600; box-shadow: none; }
.sb-item[aria-current="page"] .icon { color: inherit; }
.sb-count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--radius-pill); background: var(--color-paper-3); color: var(--color-ink-2); display: grid; place-items: center; }
.sb-item[aria-current="page"] .sb-count { background: var(--color-accent); color: var(--color-accent-ink); }
.sb-foot { flex-direction: column; align-items: stretch; gap: var(--space-2xs); padding: 10px var(--space-xs); border-top: var(--rule); }
.sb-me { padding: 6px; }
.sb-me .avatar { width: 28px; height: 28px; font-size: 11px; }
.sb-user { font-size: var(--text-sm); }
.sb-tools { gap: var(--space-2xs); }
.sb-tools > form { flex: 1; display: flex; }
.sb-tools .sb-tool { flex: 1; min-height: 32px; padding: 0 var(--space-xs); gap: var(--space-xs); color: var(--color-ink-2); font-size: var(--text-sm); font-weight: 400; box-shadow: none; border-color: var(--color-rule); }
.sb-tools .theme-toggle .sb-label { position: static; width: auto; height: auto; clip: auto; overflow: visible; }
body[data-sidebar="collapsed"] .org-mark { display: none; }
body[data-sidebar="collapsed"] :is(.sb-org, .sb-tools .sb-label) { display: none; }
body[data-sidebar="collapsed"] .sb-top { flex-direction: row; justify-content: center; }
body[data-sidebar="collapsed"] .sb-tools { flex-direction: column; width: 100%; }
body[data-sidebar="collapsed"] .sb-foot { padding-inline: var(--space-2xs); }
body[data-sidebar="collapsed"] .sb-count { position: absolute; top: 2px; right: 2px; transform: none; min-width: 16px; height: 16px; padding: 0 4px; font-size: 10px; background: var(--color-accent); color: var(--color-accent-ink); }
@media (max-width: 56rem) { .sb-item, .sb-tools .sb-tool { min-height: 44px; } }

/* Full-width notices above the page: platform admin, paused, dry run. */
.site-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: var(--space-xs) var(--space-xl); border-bottom: var(--rule); font-size: var(--text-sm); }
.site-banner > div { flex: 1 1 14rem; }
.site-banner b { font-weight: 600; }
.site-banner form { margin: 0; }
.site-banner button { min-height: 28px; padding: 0 10px; background: transparent; color: inherit; border: 1px solid currentColor; }
.site-banner button:hover { background: transparent; color: inherit; }
.site-banner a { color: inherit; font-weight: 500; text-decoration: underline; }
.site-banner.warn { background: var(--color-warn-soft); color: var(--color-warn); }
.site-banner.info { background: var(--color-info-soft); color: var(--color-info); }
.site-banner.quiet { background: var(--color-paper-2); color: var(--color-ink-2); font-size: var(--text-xs); padding-block: 6px; }
@media (max-width: 56rem) { .site-banner { padding-inline: var(--space-md); } }

/* Tabs: links under a hairline (?status=open), the current one underlined in the accent. */
.tabs { display: flex; gap: var(--space-2xs); border-bottom: var(--rule); overflow-x: auto; margin-bottom: var(--space-md); }
.tabs a { display: flex; align-items: center; gap: 6px; height: var(--control-h); padding: 0 10px; margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--color-ink-2); text-decoration: none; white-space: nowrap; }
.tabs a:hover { color: var(--color-ink); }
.tabs a[aria-current] { border-bottom-color: var(--color-accent); color: var(--color-ink); font-weight: 600; }
.tabs a span { font-size: var(--text-xs); color: var(--color-ink-3); font-weight: 400; }
/* Pill filters (inbox: Waiting / Mine / All). */
.pills { display: flex; gap: var(--space-2xs); flex-wrap: wrap; }
.pills a { height: 28px; display: flex; align-items: center; padding: 0 10px; border-radius: var(--radius-pill); color: var(--color-ink-2); font-size: var(--text-sm); text-decoration: none; }
.pills a:hover { background: var(--color-paper-3); color: var(--color-ink); }
.pills a[aria-current] { background: var(--color-accent-soft); color: var(--color-accent-text); font-weight: 600; }
/* Row list: a card of flex rows (messages, tickets, members, columns, orgs). */
.rows { background: var(--color-surface); border: var(--rule); border-radius: var(--radius-lg); overflow: hidden; margin-bottom: var(--space-md); }
.rows > .r { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; min-height: 2.5rem; padding: var(--space-xs) var(--space-md); border-top: var(--rule); color: var(--color-ink); text-decoration: none; }
.rows > .r:first-child { border-top: 0; }
a.r:hover, .rows > .r.hover:hover { background: var(--color-paper-2); color: var(--color-ink); }
.rows > .r form { margin: 0; }
.rows .grow { flex: 1 1 14rem; min-width: 0; }
.mono { font-family: var(--font-mono); font-size: var(--text-xs); }
.btn.sm, button.sm { min-height: 28px; padding: 0 10px; font-size: var(--text-sm); }
.round { width: 32px; height: 32px; flex: none; border-radius: 50%; background: var(--color-paper-3); display: grid; place-items: center; font-size: var(--text-xs); font-weight: 600; color: var(--color-ink-2); }
.tile-icon { width: 32px; height: 32px; flex: none; border-radius: var(--radius); background: var(--color-paper-2); border: var(--rule); display: grid; place-items: center; color: var(--color-ink-2); }

/* ---------- Rich text: a formatting toolbar over free-text boxes (client/rich-text.ts) ---------- */
.rt { margin-top: var(--space-2xs); border: 1px solid var(--color-rule-strong); border-radius: var(--radius); background: var(--color-surface); box-shadow: var(--shadow-1); min-width: 0; flex: 1; font-weight: 400; }
.rt:focus-within { outline: 2px solid var(--color-focus); outline-offset: 1px; border-color: var(--color-focus); }
.rt-source { position: absolute !important; width: 1px !important; height: 1px !important; min-height: 0 !important; padding: 0 !important; border: 0 !important; overflow: hidden; clip: rect(0 0 0 0); opacity: 0; }
label:has(> .rt-source[aria-invalid="true"]) .rt, .rt-source[aria-invalid="true"] + .rt { border-color: var(--color-bad); }
.rt-bar { display: flex; flex-wrap: wrap; gap: 2px; padding: 3px; border-bottom: var(--rule); background: var(--color-paper-2); border-radius: var(--radius) var(--radius) 0 0; }
.rt-btn { min-height: 26px; min-width: 28px; padding: 0 6px; background: transparent; color: var(--color-ink-2); border: 1px solid transparent; font-size: var(--text-sm); font-weight: 400; line-height: 1; box-shadow: none; }
.rt-btn:hover { background: var(--color-paper-3); color: var(--color-ink); }
.rt-btn[aria-pressed="true"] { background: var(--color-accent-soft); color: var(--color-accent-text); border-color: color-mix(in oklch, var(--color-accent) 30%, transparent); }
.rt-btn code { font-size: var(--text-xs); background: none; border: 0; padding: 0; }
.rt-area { padding: var(--space-xs) var(--space-sm); outline: none; font-size: var(--text-base); line-height: var(--leading); color: var(--color-ink); overflow-wrap: anywhere; max-height: 24rem; overflow-y: auto; }
.rt-area > * { margin: 0 0 var(--space-xs); }
.rt-area > :last-child { margin-bottom: 0; }
.rt-area ul, .rt-area ol, .rich-out ul, .rich-out ol { padding-left: 1.4em; }
.rt-area blockquote, .rich-out blockquote { margin-left: 0; padding-left: var(--space-sm); border-left: 3px solid var(--color-rule-strong); color: var(--color-ink-2); }
.rt.is-empty .rt-area[data-placeholder] > p:first-child::before { content: var(--ph); color: var(--color-ink-3); float: left; height: 0; pointer-events: none; }
.rich-out > * { margin: 0 0 var(--space-xs); }
.rich-out > :last-child { margin-bottom: 0; }
@media (max-width: 56rem) { .rt-btn { min-height: 36px; min-width: 36px; } }
.site-banner.visiting { background: var(--color-accent-soft); color: var(--color-accent-text); }

/* ---------- One shape for marks: pills ----------
 * Badges, counts, chips, filter pills and tags are pills. Circles mean people (avatars), the
 * switch knob, the spinner, status dots and progress bars. Step numbers are circles too. */
:root { --radius-mark: var(--radius-pill); }
.badge::before, .flash::before, .banner::before, .convo.waiting .convo-top b::before,
.hist li::before, .dot, .st::before { border-radius: 50%; }
.sb-count, body[data-sidebar="collapsed"] .sb-count, .chip, .pills a, .ib-sys, .tag,
.field-error::before { border-radius: var(--radius-mark); }
.step-num, .step-n, .tl-dot, .checklist .tick, .wizard a span, .auth-icon { border-radius: 50%; }
.empty-state .ring { border-radius: var(--radius-lg); }

/* =====================================================================================
 * Adaab design system v2 (design.md): light canvas, white cards, one confident blue,
 * sunflower for delight, Bricolage Grotesque titles over Figtree. Overrides the rules
 * above where the shape or weight changed; colours already come from tokens.css.
 * ===================================================================================== */

/* Type */
body { font-feature-settings: normal; }
h1 { font-weight: 700; }
h2 { font-weight: 700; }
h3 { font-weight: 650; }
.page-head h1, .spread h1, .page > h1 { font-size: var(--text-2xl); line-height: 2.25rem; font-weight: 700; }
.panel-head h2, .panel h2, .card > h2:first-child, .setting > header h2 { font-family: var(--font-body); letter-spacing: 0; font-size: var(--text-md); font-weight: 700; }
.eyebrow, .sub { color: var(--color-ink-2); font-size: var(--text-base); }
a { text-decoration: none; }
a:hover { text-decoration: underline; }
:is(.btn, .sb-item, .sb-me, .tile, .feed-row, .convo, .r, .pg, .tabs a, .pills a, .segmented a, .wizard a, .checklist a, .menu-pop a, .chip, .site-banner a, .badge, .solo-brand, .site a):hover { text-decoration: none; }

/* Buttons: verb first, 600 weight, a small lift on hover */
button, .btn { font-weight: 600; border-radius: var(--radius); }
button:not(.link):not(.danger-link):not(.icon):not(.icon-btn):not(.rt-btn):not(.secondary):not(.danger):not(.sb-pop-link):not(.sb-pop-row):hover,
.btn:not(.secondary):hover { box-shadow: 0 6px 16px -8px color-mix(in oklch, var(--color-accent) 70%, transparent); }
:is(button, .btn).secondary { box-shadow: none; }
.btn.dark, button.dark { background: var(--color-ink); color: var(--color-surface); }
.btn.dark:hover, button.dark:hover { background: color-mix(in oklch, var(--color-ink) 85%, var(--color-accent)); color: var(--color-surface); }
.btn.sm, button.sm { min-height: 32px; padding: 0 12px; }

/* Inputs: one height with buttons, a soft blue ring on focus */
:is(input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], input[type=search], input[type=tel], input[type=date], select, textarea) {
  box-shadow: none; border-radius: var(--radius);
}
:is(input, select, textarea):focus-visible, .rt:focus-within {
  outline: none; border-color: var(--color-accent); box-shadow: 0 0 0 4px var(--color-accent-soft);
}
input[type=checkbox], input[type=radio] { width: 1.0625rem; height: 1.0625rem; }

/* Surfaces: white cards on the canvas, borders not shadows; floating things get the shadow */
.card, .panel, .stat, .tile, .tablewrap, .rows, .conn-list, .convo-list, .step, .two-up fieldset { border-radius: var(--radius-lg); box-shadow: none; }
.tile, .stat { padding: 1.125rem; gap: var(--space-2xs); transition: transform var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out), border-color var(--dur-short); }
a.tile:hover, .stat:has(a):hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); border-color: var(--color-rule); }
.tile span, .stat span { font-size: var(--text-base); font-weight: 500; color: var(--color-ink-2); }
.tile b, .stat b { font-family: var(--font-display); font-size: 1.875rem; line-height: 2.25rem; font-weight: 700; letter-spacing: var(--tracking-display); }
.tile small { font-size: var(--text-sm); font-weight: 600; color: var(--color-ink-3); }
.tile.good small { color: var(--color-ok); }
.tile.bad small { color: var(--color-bad); }
.tile.bad b { color: var(--color-ink); }
.tiles { grid-template-columns: repeat(auto-fill, minmax(min(100%, 12.5rem), 1fr)); gap: var(--space-md); }
.panel-head { padding: var(--space-md) 1.25rem; border-bottom: 0; }
.panel-body { padding: 1.25rem; }
.feed-row { border-top: 0; border-radius: var(--radius); margin: 0 var(--space-xs); padding: var(--space-xs) var(--space-sm); min-height: 3rem; }
.panel-head + .feed-row { margin-top: 0; }
.panel > .feed-row:last-child { margin-bottom: var(--space-xs); }

/* Tables: a quiet head, roomy rows */
th { background: color-mix(in oklch, var(--color-paper-2) 50%, var(--color-surface)); font-weight: 600; color: var(--color-ink-2); }
table tr:not(:first-child):hover td { background: color-mix(in oklch, var(--color-paper-2) 55%, var(--color-surface)); }
tr:has(.pick:checked) td { background: var(--color-accent-soft); }

/* Marks */
.badge { padding: 0.1875rem 0.625rem; font-weight: 600; }
.tag { padding: 0.125rem 0.5rem; font-weight: 600; background: var(--color-info-soft); color: var(--color-info); }
.count, .spread h1 .small { border-radius: var(--radius-pill); background: transparent; color: var(--color-ink-3); font-family: var(--font-body); font-size: var(--text-md); padding: 0; }
.pills a { height: 32px; padding: 0 14px; font-weight: 600; border: 1px solid var(--color-rule-strong); background: var(--color-surface); color: var(--color-ink-2); }
.pills a:hover { background: var(--color-paper-2); }
.pills a[aria-current] { background: var(--color-ink); border-color: var(--color-ink); color: var(--color-surface); }
.segmented { border: 0; border-radius: var(--radius); padding: 3px; }
.segmented a { border-radius: 8px; font-weight: 600; }
.tabs a { font-weight: 600; height: 2.75rem; padding: 0 14px; }
.tabs a[aria-current] { color: var(--color-accent-text); }
.bulkbar { background: var(--color-ink); color: var(--color-surface); border: 0; border-radius: var(--radius-lg); padding: var(--space-xs) var(--space-xs) var(--space-xs) var(--space-md); box-shadow: var(--shadow-pop); }
.bulkbar :is(select, input) { background-color: var(--color-surface); color: var(--color-ink); }
.flash, .banner { border-radius: var(--radius-lg); }
.flash.warn, .banner.warn { background: var(--color-sun-soft); border-color: var(--color-sun-rule); }
.flash.warn::before, .banner.warn::before { background: var(--color-sun); }

/* Sidebar: white, an initial square for the charity, blue for where you are */
.sidebar { background: var(--color-surface); }
.sb-top { height: 64px; min-height: 64px; border-bottom: 0; padding: var(--space-sm) var(--space-sm) var(--space-2xs); }
.org-mark { width: 32px; height: 32px; border-radius: 9px; background: var(--color-sun); color: #1b1d2a; font-weight: 700; font-size: var(--text-xs); }
.sb-org, .sb-org > summary { display: flex; align-items: center; gap: 10px; }
a.sb-org, .sb-org > summary { padding: 6px; margin: -6px; border-radius: var(--radius); }
a.sb-org:hover, .sb-org > summary:hover { background: var(--color-paper-2); }
.sb-org > summary { flex: 1; min-width: 0; }
.sb-org-name b { font-weight: 700; }
.sidebar > .sb-nav { padding: var(--space-xs) var(--space-sm) var(--space-sm); gap: 2px; }
.sb-head { padding: 16px 12px 6px; font-weight: 600; color: var(--color-ink-3); }
.sb-item { min-height: 40px; padding: 0 12px; gap: 12px; border-radius: var(--radius); font-weight: 500; color: var(--color-ink-2); }
.sb-item:hover { background: var(--color-paper-2); color: var(--color-ink); }
.sb-item[aria-current="page"] { background: var(--color-accent-soft); color: var(--color-accent-text); font-weight: 600; }
.sb-count { min-width: 22px; height: 20px; padding: 0 7px; background: var(--color-accent); color: var(--color-accent-ink); font-weight: 700; }
.sb-item[aria-current="page"] .sb-count { background: var(--color-accent); color: var(--color-accent-ink); }
.sb-foot { padding: var(--space-sm); gap: var(--space-xs); }
.sb-me .avatar { width: 32px; height: 32px; background: var(--color-accent-soft); color: var(--color-accent-text); font-weight: 700; }
.sb-me:hover, .sb-me[aria-current="page"] { background: var(--color-paper-2); }
.sb-tools .sb-tool { min-height: 36px; border-radius: var(--radius); }
.avatar, .round { background: var(--color-accent-soft); color: var(--color-accent-text); font-weight: 700; }

/* Pages */
.page { padding: 1.75rem var(--space-xl) var(--space-3xl); }
.page-head { margin-bottom: 1.375rem; }
.main { background: var(--color-paper); }
.topbar { background: var(--color-surface); }

/* Home (dashboard) */
.hello-banner { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-md); padding: var(--space-md) 1.125rem; margin-bottom: 1.375rem; border-radius: var(--radius-lg); background: var(--color-sun-soft); border: 1px solid var(--color-sun-rule); }
.hello-banner .ring-count { flex: none; width: 2.75rem; height: 2.75rem; border-radius: 50%; display: grid; place-items: center; background: var(--color-sun); color: #1b1d2a; font-weight: 700; font-size: var(--text-sm); }
.hello-banner > div { flex: 1 1 18rem; display: flex; flex-direction: column; gap: 2px; }
.hello-banner b { font-size: var(--text-md); }
.hello-banner span { color: var(--color-sun-ink); }
.hello-banner form { margin: 0; }
.hello-banner .checklist { grid-column: 1 / -1; flex-basis: 100%; }
.attn { display: flex; align-items: center; gap: var(--space-sm); padding: 10px var(--space-sm); margin: 0 var(--space-xs); border-radius: var(--radius); color: var(--color-ink); }
.attn:hover { background: var(--color-paper-2); color: var(--color-ink); }
.attn .ic { flex: none; width: 2.25rem; height: 2.25rem; border-radius: var(--radius); display: grid; place-items: center; }
.attn .ic.blue { background: var(--color-info-soft); color: var(--color-info); }
.attn .ic.sun { background: var(--color-warn-soft); color: var(--color-warn); }
.attn .ic.bad { background: var(--color-bad-soft); color: var(--color-bad); }
.attn .ic.ok { background: var(--color-ok-soft); color: var(--color-ok); }
.attn > span:not(.ic):not(.badge) { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.attn small { color: var(--color-ink-3); font-size: var(--text-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attn-empty { display: flex; align-items: center; gap: var(--space-sm); padding: var(--space-md) 1.25rem 1.25rem; color: var(--color-ink-2); }
.attn-empty .ic { width: 2.25rem; height: 2.25rem; border-radius: 50%; display: grid; place-items: center; background: var(--color-ok-soft); color: var(--color-ok); flex: none; }

/* Single-card pages get the Adaab mark */
.solo-brand { font-family: var(--font-display); font-size: 1.3125rem; font-weight: 700; letter-spacing: -0.02em; }
.solo-brand .mark, .brand-logo .mark { flex: none; }
.brand-img { height: 32px; width: auto; max-width: 180px; object-fit: contain; }
.brand-logo { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; font-size: 1.3125rem; letter-spacing: -0.02em; color: var(--color-ink); }

@media (max-width: 56rem) {
  .page { padding: var(--space-lg) var(--space-md) var(--space-2xl); }
  .sb-item { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  a.tile:hover, .stat:has(a):hover { transform: none; }
}
/* Money and counts use Figtree: Bricolage's pound sign reads too much like an ampersand. */
.tile b, .stat b { font-family: var(--font-body); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.site-banner.sun { background: var(--color-sun-soft); color: var(--color-sun-ink); }

/* ---------- Sidebar v3: matches the "Shared sidebar" board on the design canvas ---------- */
.sb-top { padding: 0 0 var(--space-xs); }
.sb-org:not(details), .sb-org > summary { display: flex; align-items: center; gap: 10px; padding: 8px; border: 0; border-radius: var(--radius-md); background: transparent; color: var(--color-ink); text-decoration: none; }
.sb-org:not(details):hover, .sb-org > summary:hover { background: var(--color-paper-2); }
.sb-org .org-logo { width: 32px; height: 32px; flex: none; border-radius: 8px; object-fit: contain; background: var(--color-surface); }
.sb-org .mark, .sb-org .brand-img { flex: none; }
.sb-org .brand-img { height: 28px; max-width: 64px; }
.sb-head { padding: var(--space-md) 12px var(--space-2xs); }
.sb-foot { margin-top: auto; flex-direction: column; align-items: stretch; gap: 10px; border-top: 0; padding-top: var(--space-sm); }
.sb-setup { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border-radius: var(--radius-md); background: var(--color-sun-soft); border: 1px solid var(--color-sun-rule); color: var(--color-ink); text-decoration: none; font-size: var(--text-sm); }
.sb-setup:hover { color: var(--color-ink); border-color: var(--color-sun); }
.sb-setup-top { display: flex; justify-content: space-between; gap: 8px; }
.sb-setup-top span { color: var(--color-sun-ink); font-weight: 600; }
.sb-setup-bar { height: 6px; border-radius: 3px; background: var(--color-sun-rule); overflow: hidden; }
.sb-setup-bar i { display: block; height: 100%; border-radius: 3px; background: #e0a800; }
/* Light / Dark / Auto: one white pill that slides to the chosen option (--i is its place). */
.sb-theme { position: relative; isolation: isolate; display: flex; gap: 2px; padding: 3px; margin: 0; border-radius: var(--radius-md); background: var(--color-paper-2); }
.sb-theme::before { content: ""; position: absolute; z-index: -1; top: 3px; bottom: 3px; left: 3px; width: calc((100% - 10px) / 3); border-radius: 8px;
  background: light-dark(var(--color-surface), var(--color-paper-3)); box-shadow: 0 1px 2px rgb(0 0 0 / .14), 0 0 0 1px rgb(0 0 0 / .03);
  transform: translateX(calc(var(--i, 0) * (100% + 2px))); transition: transform 320ms cubic-bezier(.34, 1.36, .5, 1); }
.sb-theme button, .sb-theme button:hover, .sb-theme button:active { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 32px; padding: 0 8px; border: 0; border-radius: 8px;
  background: transparent; color: var(--color-ink-3); box-shadow: none; transform: none; font: inherit; font-size: var(--text-sm); font-weight: 600; cursor: pointer; transition: color 200ms var(--ease-out); }
.sb-theme button:hover { color: var(--color-ink); }
.sb-theme button[aria-checked="true"] { color: var(--color-ink); }
.sb-theme button::after { content: none !important; }
.sb-theme button:focus-visible { outline: 2px solid var(--color-focus); outline-offset: -2px; }
@media (prefers-reduced-motion: reduce) { .sb-theme::before { transition: none; } }
.sb-me-row { display: flex; align-items: center; gap: 2px; padding-top: 10px; border-top: var(--rule); }
.sb-me-row form { margin: 0; }
.sb-me-row .sb-tool { width: 34px; min-height: 34px; padding: 0; display: grid; place-items: center; }
/* Collapsed rail only (on phones the sidebar is a full drawer, whatever the saved choice). */
@media (min-width: 56.01rem) {
  body[data-sidebar="collapsed"] .sb-setup, body[data-sidebar="collapsed"] .sb-theme .sb-label { display: none; }
  /* Collapsed: a fixed-size vertical track (40px wide, three 32px stops), so the pill can never outgrow it. */
  body[data-sidebar="collapsed"] .sb-theme { flex-direction: column; width: 2.5rem; flex: none; align-self: center; overflow: hidden; }
  body[data-sidebar="collapsed"] .sb-theme button { flex: none; width: 100%; min-width: 0; height: 2rem; min-height: 2rem; padding: 0; }
  body[data-sidebar="collapsed"] .sb-theme::before { top: 3px; left: 3px; right: auto; bottom: auto; width: calc(100% - 6px); height: 2rem; transform: translateY(calc(var(--i, 0) * (2rem + 2px))); }
  body[data-sidebar="collapsed"] .sb-me-row { flex-direction: column; }
  body[data-sidebar="collapsed"] .sb-org-name { display: none; }
}
.sb-top { padding: 12px 12px 4px; gap: 6px; }
.sb-org { margin: 0; }
.sb-foot { padding: var(--space-sm) 12px 12px; }
.sidebar .sb-top .sb-org { margin: 0; }

/* ---------- Home (dashboard): matches the "AppHome" board ---------- */
.dash { display: flex; flex-direction: column; gap: 1.375rem; }
.dash > .page-head, .dash > .hello-banner, .dash > .tiles, .dash .panel { margin-bottom: 0; }
.dash .tiles { grid-template-columns: repeat(auto-fit, minmax(min(100%, 12.5rem), 1fr)); gap: 14px; }
.dash .tile small:empty { display: none; }
.dash .hello-banner .ring-count { width: 2.5rem; height: 2.5rem; }
.dash .hello-banner b { font-size: 0.9375rem; }
.dash .hello-banner .btn.dark { background: var(--color-ink); color: var(--color-surface); }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 26.25rem), 1fr)); gap: var(--space-md); align-items: stretch; }
.dash-card { padding: 1.25rem; display: flex; flex-direction: column; gap: 10px; }
.dash-card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 2px; }
.dash-card-head > div { display: flex; flex-direction: column; gap: 2px; }
.dash-card-head h2 { margin: 0; font-size: var(--text-md); }
.dash-card-head a { font-weight: 600; }
.dash-card .sub { color: var(--color-ink-3); }
.dash-card .attn { margin: 0; padding: 10px; }
.dash-card .attn > span:not(.ic):not(.dash-tag) { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dash-card .attn-empty { padding: 10px; }
.dash-empty { margin: 0; padding: 10px 0; }
.dash .attn > span.dash-tag { flex: none; display: inline-block; font-size: var(--text-xs); font-weight: 600; padding: 3px 9px; border-radius: var(--radius-pill); background: var(--color-info-soft); color: var(--color-info); }
.dash .attn > .dash-tag.ok { background: var(--color-ok-soft); color: var(--color-ok); }
.dash .attn > .dash-tag.sun { background: var(--color-warn-soft); color: var(--color-warn); }
.dash .attn > .dash-tag.bad { background: var(--color-bad-soft); color: var(--color-bad); }
/* Supporters by stage, drawn as the board's column chart. */
.dash-bars { overflow-x: auto; display: flex; align-items: stretch; gap: 10px; min-height: 15rem; padding: 8px 4px 0; border-bottom: 1px solid var(--color-paper-2); }
.dash-bar { flex: 1; min-width: 3.5rem; display: grid; grid-template-rows: 1fr auto auto minmax(2.5rem, auto); justify-items: center; align-items: end; gap: 6px; color: var(--color-ink-3); text-decoration: none; border-radius: var(--radius-sm); }
.dash-bar:hover { color: var(--color-ink); text-decoration: none; }
.dash-bar .v { grid-row: 2; font-size: 11px; font-variant-numeric: tabular-nums; }
.dash-bar i { grid-row: 3; display: block; width: 100%; max-width: 56px; border-radius: 8px 8px 3px 3px; background: color-mix(in oklch, var(--color-accent) 28%, var(--color-surface)); transform-origin: bottom; animation: dash-grow .7s var(--ease-out) both; transition: background var(--dur-short); }
.dash-bar.top i, .dash-bar:hover i { background: var(--color-accent); }
.dash-bar .l { grid-row: 4; align-self: start; font-size: var(--text-xs); text-align: center; line-height: 1.3; overflow-wrap: normal; hyphens: auto; padding-top: 4px; }
@keyframes dash-grow { from { transform: scaleY(.1); } to { transform: scaleY(1); } }
/* Recent messages, as the board's activity list. */
.dash-feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.dash-feed a { display: flex; align-items: center; gap: var(--space-sm); padding: 8px 10px; border-radius: var(--radius); color: var(--color-ink); text-decoration: none; }
.dash-feed a:hover { background: var(--color-paper-2); color: var(--color-ink); }
.dash-feed .dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--color-info); }
.dash-feed .dot.ok { background: var(--color-ok); }
.dash-feed .dot.bad { background: var(--color-bad); }
.dash-feed .dot.sun { background: var(--color-sun); }
.dash-feed .what { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-feed .when { flex: none; min-width: 2.5rem; text-align: right; color: var(--color-ink-3); font-size: var(--text-sm); }
@media (prefers-reduced-motion: reduce) { .dash-bar i { animation: none; } }
@media (max-width: 40rem) { .dash-feed .badge { display: none; } }

/* ---------- Table card: the boards' list pattern (Supporters, Gifts, Gift Aid, Messages) ----------
   One card holding a head, the filter bar, the bulk bar, the table and the pager. */
.tcard { background: var(--color-surface); border: var(--rule); border-radius: var(--radius-lg); overflow: hidden; margin-bottom: var(--space-md); min-width: 0; }
.tcard-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: var(--space-md) 18px; border-bottom: 1px solid var(--color-paper-2); }
.tcard-head > div:first-child { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tcard-head h2 { margin: 0; font-family: var(--font-body); letter-spacing: 0; font-size: var(--text-md); font-weight: 700; }
.tcard-head .sub { color: var(--color-ink-3); }
.tcard-head .row { gap: var(--space-xs); }
.tcard .filterbar { margin: 0; padding: 12px 18px; border-bottom: 1px solid var(--color-paper-2); }
.tcard .filter-top { gap: var(--space-xs); }
.tcard .filter-top :is(button, .btn, input, select) { min-height: 36px; }
.tcard .filter-top :is(button, .btn) { padding: 0 12px; border-radius: 9px; font-size: var(--text-sm); }
.tcard .filter-top .search-box { max-width: 23.75rem; }
.tcard .filter-top input[type=search] { font-size: var(--text-sm); border-radius: 9px; }
.tcard .filter-row { padding: var(--space-xs); border-radius: var(--radius); }
.tcard form { margin: 0; }
.tcard .bulkbar { margin: 0; padding: 10px 18px; border: 0; border-bottom: 1px solid color-mix(in oklch, var(--color-accent) 25%, var(--color-surface)); border-radius: 0; box-shadow: none; background: var(--color-accent-soft); color: var(--color-accent-text); }
.tcard .bulkbar :is(select, input) { min-height: 36px; border-color: color-mix(in oklch, var(--color-accent) 25%, var(--color-surface)); }
.tcard .bulkbar .secondary { min-height: 34px; border-color: color-mix(in oklch, var(--color-accent) 25%, var(--color-surface)); color: var(--color-accent-text); }
.tcard .bulkbar .link { color: var(--color-accent-text); text-decoration: underline; }
.tcard .tablewrap { border: 0; border-radius: 0; box-shadow: none; margin: 0; background: transparent; }
.tcard table { border: 0; border-radius: 0; }
.tcard :is(th, td) { padding: 10px 12px; border-bottom: 0; border-top: 1px solid var(--color-paper-2); }
.tcard tr:first-child > th, .tcard thead th { border-top: 0; }
.tcard :is(th, td):first-child { padding-left: 18px; }
.tcard :is(th, td):last-child { padding-right: 18px; }
.tcard th { font-size: var(--text-sm); }
.tcard td.check, .tcard th.check { width: 36px; padding-right: 0; }
.tcard .who { display: flex; align-items: center; gap: 10px; }
.tcard .who > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.tcard .who a { font-weight: 600; }
/* One very long name or value is cut short, not allowed to push every other column off the table. */
.tcard .who a, .tcard td > .muted { display: inline-block; max-width: 22rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.tcard .round { width: 30px; height: 30px; font-size: 11px; }
.tcard .round.av1 { background: var(--color-bad-soft); color: var(--color-bad); }
.tcard .round.av2 { background: var(--color-warn-soft); color: var(--color-warn); }
.tcard .round.av3 { background: var(--color-ok-soft); color: var(--color-ok); }
.tcard .st { font-size: var(--text-xs); font-weight: 600; padding: 3px 10px; border-radius: var(--radius-pill); background: color-mix(in oklch, var(--sw, var(--color-ink-3)) 14%, var(--color-surface)); color: var(--sw, var(--color-ink-2)); }
.tcard .st::before { display: none; }
.tcard .tag { border-radius: var(--radius-pill); background: var(--color-paper-2); color: var(--color-ink-2); padding: 2px 8px; }
.tcard td.empty { padding: 32px 18px; text-align: center; color: var(--color-ink-3); }
.tcard .pager { margin: 0; padding: 12px 18px; border-top: 1px solid var(--color-paper-2); }
.tcard .pager > .muted { color: var(--color-ink-2); font-size: var(--text-sm); }
.tcard .pg { min-width: 34px; height: 34px; border: var(--rule); border-radius: 9px; background: var(--color-surface); font-size: var(--text-sm); font-weight: 600; color: var(--color-ink); }
.tcard .pg.gap { border: 0; background: transparent; }
.tcard .pg.on { background: var(--color-accent); border-color: var(--color-accent); color: var(--color-accent-ink); box-shadow: none; }
.tcard .pg.disabled { opacity: 1; color: var(--color-rule-strong); }

/* ---------- Supporter record: matches the "AppSupporter" board ---------- */
.person { display: flex; flex-direction: column; gap: 18px; }
.person > :is(.notice, .flash) { margin: 0; }
.crumbs { display: flex; flex-wrap: wrap; gap: var(--space-xs); color: var(--color-ink-3); }
.crumbs a { font-weight: 600; }
.crumbs > span:last-child { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-card { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; padding: 22px; border-radius: var(--radius-lg); background: var(--color-surface); border: var(--rule); }
.person-card .round.person-av { width: 72px; height: 72px; font-size: 1.5rem; background: var(--color-bad-soft); color: var(--color-bad); }
.person-id { flex: 1 1 14rem; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.person-name { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.person-name h1 { font-size: 1.75rem; line-height: 2.25rem; font-weight: 700; overflow-wrap: anywhere; }
.person-id .sub { overflow-wrap: anywhere; }
.person-card .sub { color: var(--color-ink-2); }
.person-card .st, .person-side .st { font-size: var(--text-xs); font-weight: 600; padding: 3px 10px; border-radius: var(--radius-pill); background: color-mix(in oklch, var(--sw, var(--color-ink-3)) 14%, var(--color-surface)); color: var(--sw, var(--color-ink-2)); }
.person-card .st::before { display: none; }
.person-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.person-tags .tag { margin: 0; padding: 3px 10px; border-radius: var(--radius-pill); }
.person-card .row { gap: var(--space-xs); flex-wrap: wrap; }
.person-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 18.75rem), 1fr)); gap: 18px; align-items: start; }
.person-grid > div, .person-grid > aside { min-width: 0; display: flex; flex-direction: column; gap: var(--space-md); }
.person-grid .panel { margin: 0; }
.person-grid .panel-body { padding: 18px; }
.person-grid .panel-head { padding: 18px 18px 6px; }
.person-grid .panel h2 { font-size: 0.9375rem; }
.person-left label:not(.check) { font-size: var(--text-xs); color: var(--color-ink-3); }
.person-left label :is(input, select) { font-size: var(--text-base); color: var(--color-ink); }
.person #notes form { display: flex; gap: var(--space-xs); align-items: flex-start; }
.person #notes textarea { flex: 1; width: 100%; min-width: 0; font-family: var(--font-body); }
.person #notes .form-actions { margin: 0 !important; }
.person .timeline { padding: 0 18px 12px; }
.person .timeline > li { gap: 12px; padding: 12px 0; border-bottom: 0; border-top: 1px solid var(--color-paper-2); }
.person .timeline > li:first-child { border-top: 0; }
.person .tl-dot { width: 30px; height: 30px; background: var(--color-ok-soft); color: var(--color-ok); }
.person .tl-dot.out { background: var(--color-info-soft); color: var(--color-info); }
.person .tl-top > b { font-weight: 700; }
.person .tl-body { font-size: var(--text-base); }
.tcard .pill { display: inline-block; font-size: var(--text-xs); font-weight: 600; padding: 3px 10px; border-radius: var(--radius-pill); white-space: nowrap; background: var(--color-paper-2); color: var(--color-ink-2); }
.tcard .pill.ok { background: var(--color-ok-soft); color: var(--color-ok); }
.tcard .pill.bad { background: var(--color-bad-soft); color: var(--color-bad); }
.tcard .pill.info { background: var(--color-info-soft); color: var(--color-info); }
.tcard .pill.warn { background: var(--color-warn-soft); color: var(--color-warn); }
.tcard td.strong, .tcard td.strong a { font-weight: 600; color: var(--color-ink); }
.tcard td.num .cell-sub { color: var(--color-ok); font-weight: 600; }
.tcard td.mono { font-size: var(--text-xs); color: var(--color-ink-2); }
.tcard-note { margin: 0; padding: 8px 18px; border-bottom: 1px solid var(--color-paper-2); }

/* ---------- Gifts & Gift Aid: matches the "AppGiving" board ---------- */
.giving-tiles { grid-template-columns: repeat(auto-fit, minmax(min(100%, 11.875rem), 1fr)); gap: 14px; margin-bottom: 18px; }
.tile.hi-ok { background: var(--color-ok-soft); border-color: color-mix(in oklch, var(--color-ok) 25%, var(--color-ok-soft)); }
.tile.hi-ok span, .tile.hi-ok small { color: var(--color-ok); font-weight: 600; }
.tile.hi-ok b { color: var(--color-ok); }
.claim-steps { list-style: none; margin: 0 0 var(--space-md); padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13.75rem), 1fr)); gap: 12px; }
.claim-steps li { display: flex; gap: 12px; align-items: center; padding: 14px var(--space-md); border-radius: 12px; background: var(--color-surface); border: var(--rule); }
.claim-steps li > div { display: flex; flex-direction: column; min-width: 0; }
.claim-steps li > div > span { font-size: var(--text-sm); color: var(--color-ink-3); }
.claim-steps .step-n { width: 30px; height: 30px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--color-rule); color: var(--color-ink-2); }
.claim-steps li.done .step-n { background: var(--color-ok); color: var(--color-surface); }
.claim-steps li.todo { background: var(--color-sun-soft); border-color: var(--color-sun-rule); }
.claim-steps li.todo .step-n { background: var(--color-sun); color: #1b1d2a; }

/* ---------- Automation and workflow builders: match the "AppAutomations" board ----------
   The steps run down a dotted canvas, joined by a line, from a dark "Starts when" card to an End pill. */
.flow-canvas { display: flex; flex-direction: column; align-items: center; padding: 32px 24px 40px; margin-bottom: var(--space-md); border: var(--rule); border-radius: var(--radius-lg);
  background-color: var(--color-paper); background-image: radial-gradient(var(--color-rule-strong) 1px, transparent 1px); background-size: 20px 20px; }
.flow-canvas > * { width: 100%; max-width: 35rem; }
.flow-canvas > .auto-name { max-width: 35rem; margin-bottom: var(--space-lg); }
.flow-canvas .auto-name input { background: var(--color-surface); }
.flow-build .wf-split > .main-part.flow-canvas { max-width: none; }
.flow-canvas .wf-about { margin-bottom: var(--space-lg); }
.flow-canvas .step, .flow-canvas .auto-parts.flow > li { position: relative; background: var(--color-surface); border: var(--rule); border-radius: var(--radius-lg); }
.flow-build .wf-flow .step + .step, .flow-build #steps > .step:first-child, .flow-build .wf-add { margin-top: 44px; }
.flow-build .wf-flow .step + .step::before, .flow-build #steps > .step:first-child::before, .flow-build .wf-add::before,
.flow-canvas .auto-parts.flow > li + li::before, .flow-canvas .flow-end::before {
  content: ""; position: absolute; left: 50%; top: -44px; height: 44px; width: 0; border-left: 2px solid var(--color-rule-strong); translate: -1px 0; }
.flow-build .wf-add { align-self: center; width: auto; margin-left: 0; }
.flow-build .wf-add-pop { left: 50%; translate: -50% 0; } /* under the centred button, so it stays on a phone screen */
.flow-canvas .auto-parts.flow { display: flex; flex-direction: column; gap: 0; margin: 0; }
.flow-canvas .auto-parts.flow > li { padding: 14px var(--space-md) var(--space-md); gap: 10px; }
.flow-canvas .auto-parts.flow > li + li { margin-top: 44px; }
.flow-canvas .auto-parts.flow > li.part-wide { grid-column: auto; }
.flow-end { position: relative; align-self: center; width: auto !important; margin-top: 44px; padding: 8px var(--space-md); border-radius: var(--radius-pill); background: var(--color-surface); border: var(--rule); color: var(--color-ink-2); font-weight: 600; }
.flow-canvas .auto-reads, .flow-canvas .foot-row { margin-top: var(--space-lg); }
.flow-canvas .foot-row { padding: var(--space-sm) var(--space-md); border-radius: var(--radius-lg); background: var(--color-surface); border: var(--rule); }
.flow-canvas .auto-reads { padding: var(--space-sm) var(--space-md); border-radius: var(--radius-lg); background: var(--color-surface); border: var(--rule); margin-bottom: 0; }
/* The dark "Starts when" band on top of the trigger card. */
.flow-trigger { overflow: hidden; }
.flow-start { display: flex; align-items: center; gap: 12px; margin: -14px calc(var(--space-md) * -1) var(--space-xs); padding: 14px var(--space-md); background: var(--color-ink); color: var(--color-surface); }
.wf-flow .flow-start { margin: calc(var(--space-sm) * -1) -0.875rem var(--space-xs); }
.flow-start small { display: block; font-size: var(--text-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; opacity: .75; }
.flow-start b { font-size: var(--text-md); }
.flow-head { display: flex; align-items: center; gap: 12px; }
.flow-head > span:last-child { display: flex; flex-direction: column; gap: 1px; }
.flow-head small { font-size: var(--text-xs); font-weight: 600; color: var(--color-ink-3); }
.flow-head b { font-size: 0.9375rem; }
.flow-ic { width: 36px; height: 36px; flex: none; border-radius: var(--radius); display: grid; place-items: center; background: var(--color-info-soft); color: var(--color-info); }
.flow-ic.sun { background: var(--color-sun); color: #1b1d2a; }
.flow-ic.ok { background: var(--color-ok-soft); color: var(--color-ok); }
.flow-ic.warn { background: var(--color-warn-soft); color: var(--color-warn); }
.flow-build .step-kind { width: 36px; height: 36px; flex: none; border-radius: var(--radius); align-items: center; justify-content: center; background: var(--color-info-soft); color: var(--color-info); }
.flow-build .wf-trigger .flow-ic { width: 36px; }
/* Automation: canvas on the left, settings and history on the right. */
.flow-layout { display: grid; grid-template-columns: minmax(0, 1fr) 21.25rem; gap: var(--space-md); align-items: start; }
.flow-side { display: flex; flex-direction: column; gap: var(--space-md); min-width: 0; }
.flow-side .panel { margin: 0; }
.flow-safe { display: flex; flex-direction: column; gap: 4px; padding: 14px; border-radius: 12px; background: var(--color-accent-soft); }
.flow-safe b { color: var(--color-accent-text); }
.flow-safe span { font-size: var(--text-sm); color: var(--color-ink-2); }
@media (max-width: 64rem) { .flow-layout { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 40rem) { .flow-canvas { padding: var(--space-md) var(--space-sm); } }

/* ---------- Setup (onboarding): matches the "AppOnboarding" board ----------
   A title with progress, the steps in a card on the left, the current step's card on the right.
   body.onb raises these above auth.css, which loads after this sheet. */
body.solo.onb main.onb-main { max-width: 66rem; padding: 36px var(--space-xl) var(--space-2xl); display: grid; grid-template-columns: minmax(15rem, 19rem) minmax(0, 1fr); gap: var(--space-lg) 20px; align-items: start; }
body.solo.onb main.onb-main > :is(.onb-hero, .flash) { grid-column: 1 / -1; }
body.onb .onb-hero { display: flex; flex-direction: column; gap: 10px; }
body.onb .onb-hero h1 { margin: 0; font-size: 2rem; line-height: 2.375rem; font-weight: 700; letter-spacing: var(--tracking-display); }
body.onb .onb-progress { display: flex; align-items: center; gap: 14px; }
body.onb .onb-progress .bar { flex: 1 1 auto; max-width: 26.25rem; height: 10px; border-radius: 5px; background: var(--color-rule); overflow: hidden; }
body.onb .onb-progress .bar i { display: block; height: 100%; border-radius: 5px; background: var(--color-accent); transition: width .5s var(--ease-out); }
body.onb ol.onb-steps { display: flex; flex-direction: column; gap: 2px; padding: var(--space-xs); border-radius: var(--radius-lg); background: var(--color-surface); border: var(--rule); }
body.onb ol.onb-steps li::before { content: none; }
body.onb ol.onb-steps a { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 12px; color: var(--color-ink); font-size: var(--text-base); line-height: 1.4; text-decoration: none; }
body.onb ol.onb-steps a:hover { background: var(--color-paper-2); text-decoration: none; }
body.onb ol.onb-steps a[aria-current] { background: var(--color-accent-soft); font-weight: 400; }
body.onb ol.onb-steps a > span:last-child { display: flex; flex-direction: column; gap: 2px; }
body.onb ol.onb-steps b { font-size: 0.9375rem; font-weight: 700; }
body.onb ol.onb-steps small { font-size: var(--text-sm); color: var(--color-ink-3); }
body.onb .onb-dot { width: 32px; height: 32px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--color-rule); color: var(--color-ink-2); }
body.onb .onb-steps li.done .onb-dot { background: var(--color-ok); color: var(--color-surface); }
body.onb .onb-steps a[aria-current] .onb-dot { background: var(--color-accent); color: var(--color-accent-ink); }
body.onb .onb-step { padding: 28px; border-radius: var(--radius-xl); background: var(--color-surface); border: var(--rule); gap: 18px; min-width: 0; }
body.onb .onb-kicker { display: block; margin-bottom: 6px; font-size: var(--text-sm); font-weight: 600; color: var(--color-accent-text); }
body.onb .onb-step .auth-head h2 { margin: 0; font-size: 1.625rem; line-height: 2rem; font-weight: 700; letter-spacing: var(--tracking-display); }
body.onb .onb-step .auth-head p { font-size: 0.9375rem; line-height: 1.6; }
body.onb .onb-step > .panel.panel-body { border: 0; padding: 0; background: transparent; }
body.onb .onb-actions { padding-top: 6px; }
body.onb .onb-actions :is(.btn, button):not(.link):not(.secondary) { min-height: 44px; padding: 0 22px; border-radius: 12px; font-weight: 700; }
@media (max-width: 56rem) {
  body.solo.onb main.onb-main { grid-template-columns: minmax(0, 1fr); padding: var(--space-lg) var(--space-md) var(--space-xl); }
  body.onb .onb-step { padding: var(--space-md); }
}
/* Messages: quick filters sit above the log card. */
.msg-filter select { min-height: 36px; border-radius: 9px; font-size: var(--text-sm); }
@media (max-width: 40rem) { .person-grid > .person-main { order: -1; } }
/* In dark the ink token turns light, so the "Starts when" band uses a raised dark surface instead. */
:root[data-theme="dark"] .flow-start { background: var(--color-paper-3); color: var(--color-ink); }
@media (prefers-color-scheme: dark) { :root[data-theme="system"] .flow-start { background: var(--color-paper-3); color: var(--color-ink); } }

/* Shared design-parity fixes */
.site-banner.admin { background: var(--color-sun-soft); color: var(--color-sun-ink); border-bottom: 1px solid var(--color-sun-rule); font-size: var(--text-xs); padding-block: 6px; }
.page-head .eyebrow { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--color-ink-3); }
.page-head .eyebrow a { color: inherit; }
/* Ids are case-sensitive, so a ticket number keeps its case. */
.page-head .eyebrow .mono { text-transform: none; letter-spacing: 0; }
/* A table card holding row menus must not clip them. */
.tcard:has(details.menu), .tcard:has(details.menu) .tablewrap { overflow: visible; }

/* Workflow builder: a card folds to its one-line summary; the "+" on the line under it adds a step there. */
.flow-build .step-sum { flex: 1 1 12rem; display: flex; align-items: center; justify-content: space-between; gap: var(--space-xs); min-height: var(--control-h); padding: 0; border: 0; background: none; color: var(--color-ink); font-weight: 600; text-align: left; cursor: pointer; }
.flow-build .step-sum .icon { flex: none; color: var(--color-ink-3); transition: rotate var(--dur-short) var(--ease-out); }
.flow-build .step-sum[aria-expanded="false"] .icon { rotate: -90deg; }
.flow-build .step:has(> [data-step-body][hidden]) { padding-bottom: var(--space-sm); }
.flow-build .step:has(> [data-step-body][hidden]) .step-head { margin-bottom: 0; }
.flow-build .step-type { display: block; max-width: 16rem; margin-bottom: var(--space-sm); }
.flow-build .wf-insert { position: absolute; left: 50%; bottom: -36px; translate: -50% 0; z-index: 1; width: auto; }
.flow-build .wf-insert > summary.add-dashed { min-height: 28px; width: 28px; padding: 0; justify-content: center; list-style: none; }
.flow-build .wf-insert > summary::-webkit-details-marker { display: none; }
.wf-starter-steps { margin: 0; }
@media (prefers-reduced-motion: reduce) { .flow-build .step-sum .icon { transition: none; } }

/* Notices: the "it worked" variant, app-wide (it was only on account pages). */
.notice.ok { background: var(--color-ok-soft); color: var(--color-ok); }

/* AI assistants (/developers/mcp): the hero with the sunflower highlighter, the connection card,
   the steps joined by a dashed line, the config with its copy button, example questions and tools. */
.mcp-guide .mfa-steps > li > .stack-sm { min-width: 0; display: flex; flex-direction: column; gap: var(--space-xs); }
.mcp-guide .mfa-steps h2, .mcp-guide .mfa-steps p { margin: 0; }
.mcp-guide .segmented { margin: 0; }
.mcp-hero { display: flex; flex-direction: column; gap: var(--space-xs); }
.mcp-hero h2 { margin: 0; font-family: var(--font-display); font-size: var(--text-xl); }
.mcp-hero h2 mark { background: linear-gradient(transparent 62%, var(--color-sun) 62%, var(--color-sun) 92%, transparent 92%); color: inherit; padding: 0 0.15em; }
.mcp-hero .sub, .mcp-hero .hint, .mcp-connection p { margin: 0; }
.mcp-connection { display: flex; flex-direction: column; gap: var(--space-xs); }
.mcp-connection-head { display: flex; align-items: center; gap: var(--space-sm); flex-wrap: wrap; }
.mcp-connection-head .section-h { margin: 0; }
.mcp-connection-head .btn { margin-left: auto; }
/* The dashed line joining the step numbers. */
.mcp-steps > li { position: relative; }
.mcp-steps > li:not(:last-child)::after { content: ""; position: absolute; left: calc(1.25rem + 15px); top: calc(1.25rem + 36px); bottom: calc(-1 * var(--space-md) - 1.25rem); border-left: 2px dashed var(--color-rule-strong); z-index: 1; pointer-events: none; }
.mcp-steps .step-n { position: relative; z-index: 2; }
.mcp-code { position: relative; }
.mcp-code .code-block { padding-right: 6.5rem; }
.mcp-code button { position: absolute; top: var(--space-xs); right: var(--space-xs); }
.mcp-prompts { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-xs); }
.mcp-prompts li { display: flex; align-items: center; gap: var(--space-sm); padding: var(--space-sm) var(--space-md); border: var(--rule); border-radius: var(--radius); background: var(--color-paper-2); }
.mcp-prompts li > span { flex: 1 1 auto; min-width: 0; }
.mcp-prompts li > .icon { color: var(--color-accent); flex: none; }
.mcp-tools { list-style: none; margin: 0 0 var(--space-sm); padding: 0; display: grid; gap: 2px; }
.mcp-tools li { display: grid; grid-template-columns: minmax(11rem, auto) 1fr auto; gap: var(--space-sm); align-items: baseline; padding: var(--space-xs) 0; border-bottom: var(--rule); font-size: var(--text-sm); }
.mcp-tools li > span:not(.badge) { color: var(--color-ink-2); }
@media (max-width: 40rem) {
  .mcp-tools li { grid-template-columns: 1fr auto; }
  .mcp-tools li > span:not(.badge) { grid-column: 1 / -1; grid-row: 2; }
  .mcp-prompts li { flex-wrap: wrap; }
}

/* Sidebar: organisation switcher and account menu */
.sb-switch > summary, .sb-account > summary { list-style: none; cursor: pointer; }
.sb-switch > summary::-webkit-details-marker, .sb-account > summary::-webkit-details-marker { display: none; }
.sb-account { flex: 1; min-width: 0; position: relative; }
.sb-account > summary.sb-me { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: var(--radius); min-width: 0; }
.sb-account > summary.sb-me:hover, .sb-account[open] > summary.sb-me { background: var(--color-paper-2); }
.sb-pop { min-width: 17rem; max-width: min(20rem, calc(100vw - 24px)); padding: 6px; display: flex; flex-direction: column; gap: 2px; z-index: 40; }
.sb-pop-up { top: auto; bottom: calc(100% + 6px); left: 0; right: auto; }
.sb-pop form { margin: 0; }
.sb-pop-h { margin: 6px 8px 2px; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--color-ink-3); }
.sb-pop .sb-pop-row, .sb-pop .sb-pop-row:hover, .sb-pop .sb-pop-link, .sb-pop .sb-pop-link:hover {
  width: 100%; display: flex; align-items: center; gap: 10px; min-height: 0; padding: 8px; border: 0; border-radius: 8px; background: transparent;
  color: var(--color-ink); font: inherit; font-weight: 500; text-align: left; text-decoration: none; box-shadow: none; transform: none; cursor: pointer; }
.sb-pop .sb-pop-row:hover, .sb-pop .sb-pop-link:hover { background: var(--color-paper-2); }
.sb-pop .sb-pop-row.is-me { cursor: default; background: var(--color-accent-soft); }
.sb-pop .sb-pop-link { color: var(--color-ink-2); font-size: var(--text-sm); }
.sb-pop .sb-pop-link .icon { color: var(--color-ink-3); }
.sb-pop-text { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.25; }
.sb-pop-text b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-pop-text small { font-size: var(--text-xs); color: var(--color-ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-pop .avatar { width: 32px; height: 32px; flex: none; }
.sb-pop .org-logo { width: 32px; height: 32px; flex: none; border-radius: 8px; object-fit: contain; background: var(--color-surface); border: var(--rule); }
.sb-pop-tile { width: 32px; height: 32px; flex: none; border-radius: 8px; display: grid; place-items: center; background: var(--color-paper-2); color: var(--color-ink-3); }
.sb-pop-tick { color: var(--color-accent-text); display: inline-flex; }
.sb-pop hr { border: 0; border-top: var(--rule); margin: 4px 2px; }
@media (min-width: 56.01rem) { body[data-sidebar="collapsed"] .sb-account .sb-user { display: none; } }
.tab-switched { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 90; display: flex; align-items: center; gap: 12px; max-width: calc(100vw - 32px);
  padding: 10px 12px 10px 16px; border-radius: var(--radius-lg); background: var(--color-ink); color: var(--color-surface); box-shadow: var(--shadow-2, 0 12px 30px -12px rgb(0 0 0 / .4)); font-size: var(--text-sm); }
.tab-switched button { min-height: 32px; }
/* The menus fit inside the sidebar (it scrolls, so anything wider is clipped). */
.sb-me-row { position: relative; }
.sb-account { position: static; }
.sb-account .sb-pop-up, .sb-switch .sb-pop { left: 0; right: 0; min-width: 0; max-width: none; }
.sb-switch { position: relative; }
.sb-pop .sb-pop-link { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Collapsed sidebar (desktop): the organisation switcher stays as an icon, and both menus open beside the rail at full width. */
.sb-org-icon { display: none; }
@media (min-width: 56.01rem) {
  body[data-sidebar="collapsed"] .sb-switch { position: relative; width: auto; height: auto; overflow: visible; clip: auto; white-space: normal; }
  body[data-sidebar="collapsed"] .sb-switch > summary { justify-content: center; padding: 6px; }
  body[data-sidebar="collapsed"] .sb-switch > summary :is(.sb-org-name, .icon:last-child) { display: none; }
  body[data-sidebar="collapsed"] .sb-switch > summary .sb-org-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: var(--color-paper-2); color: var(--color-ink-2); }
  body[data-sidebar="collapsed"] .sb-switch > summary .sb-org-icon .icon { display: block; }
  body[data-sidebar="collapsed"] :is(.sb-switch .sb-pop, .sb-account .sb-pop-up) {
    position: fixed; left: calc(var(--sidebar-w-collapsed) + 8px); right: auto; width: 18rem; max-width: calc(100vw - var(--sidebar-w-collapsed) - 24px); z-index: 60; }
  body[data-sidebar="collapsed"] .sb-switch .sb-pop { top: 12px; bottom: auto; }
  body[data-sidebar="collapsed"] .sb-account .sb-pop-up { bottom: 12px; top: auto; max-height: calc(100vh - 24px); overflow-y: auto; }
  body[data-sidebar="collapsed"] .sb-account > summary.sb-me { justify-content: center; }
}
@media (min-width: 56.01rem) {
  body[data-sidebar="collapsed"] .sb-org.sb-switch { display: block; }
  body[data-sidebar="collapsed"] .sb-top:has(.sb-switch) { flex-direction: column; gap: 6px; }
}

/* Home: campaign fundraising tiles sit inside a card */
.dash-raised { margin: var(--space-sm) 0 0; }
.dash-raised .tile { background: var(--color-paper-2); }
.dash-raised form { margin-top: var(--space-xs); gap: var(--space-xs); flex-wrap: wrap; }
/* ---------- Pop-ups: menus and switchers fade and lift in, fade out (closing is timed in client/popups.ts) ---------- */
@keyframes pop-in { from { opacity: 0; transform: translateY(-6px) scale(.98); } }
@keyframes pop-in-up { from { opacity: 0; transform: translateY(6px) scale(.98); } }
@keyframes pop-in-side { from { opacity: 0; transform: translateX(-6px) scale(.98); } }
@keyframes pop-out { to { opacity: 0; transform: translateY(-4px) scale(.98); } }
@keyframes pop-out-up { to { opacity: 0; transform: translateY(4px) scale(.98); } }
@keyframes pop-out-side { to { opacity: 0; transform: translateX(-4px) scale(.98); } }
:is(details.menu, details.bub-react)[open] > :not(summary) { transform-origin: top right; animation: pop-in 180ms var(--ease-out); }
:is(details.menu, details.bub-react).is-closing > :not(summary) { animation: pop-out 140ms ease-in forwards; pointer-events: none; }
details.menu[open] > .sb-pop { transform-origin: top left; }
details.menu[open] > .sb-pop-up { transform-origin: bottom left; animation-name: pop-in-up; }
details.menu.is-closing > .sb-pop-up { animation-name: pop-out-up; }
@media (min-width: 56.01rem) {
  body[data-sidebar="collapsed"] details.menu[open] > :is(.sb-pop, .sb-pop-up) { transform-origin: left center; animation-name: pop-in-side; }
  body[data-sidebar="collapsed"] details.menu.is-closing > :is(.sb-pop, .sb-pop-up) { animation-name: pop-out-side; }
}
/* The chevron on a switcher turns as it opens. */
details.menu > summary .icon:last-child { transition: transform var(--dur-short) var(--ease-out); }

/* Confirm box: one question, Cancel and the action. Fades and rises in over a dimmed page. */
dialog.confirm-box { width: min(26rem, calc(100vw - 32px)); padding: var(--space-lg); border: var(--rule); border-radius: var(--radius-lg); background: var(--color-surface); color: var(--color-ink); box-shadow: var(--shadow-pop); animation: dialog-in 200ms var(--ease-out); }
dialog.confirm-box p { margin: 0 0 var(--space-md); font-size: var(--text-md); line-height: 1.5; }
dialog.confirm-box .form-actions { margin: 0; gap: var(--space-xs); }
dialog.confirm-box::backdrop { background: var(--color-scrim, rgb(27 29 42 / .45)); animation: fade-in 200ms var(--ease-out); }
dialog.confirm-box.is-closing { animation: dialog-out 140ms ease-in forwards; }
dialog.confirm-box.is-closing::backdrop { animation: fade-out 140ms ease-in forwards; }
@keyframes dialog-in { from { opacity: 0; transform: translateY(8px) scale(.97); } }
@keyframes dialog-out { to { opacity: 0; transform: translateY(4px) scale(.98); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  :is(details.menu, details.bub-react) > :not(summary), dialog.confirm-box, dialog.confirm-box::backdrop { animation: none !important; }
}

/* Sponsorships: a beneficiary's photo (a person, so a circle) */
.ben-photo { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; border: 1px solid var(--rule); background: var(--color-paper-2); flex: none; }
.ben-photo.sm { width: 40px; height: 40px; }

/* A row menu open in a table shows over the table instead of being clipped by its scroll box; on
   phones, where rows stack and the actions sit on the left, it opens to the right. A small form in
   it saves with an accent button, like the Members menu. */
.tablewrap:has(details.menu[open]) { overflow: visible; }
@media (max-width: 56rem) { .stack-sm td.act .menu-pop { left: 0; right: auto; } }
.menu-pop.member-pop > button.sm:not(.secondary, .danger) { width: auto; background: var(--color-accent); color: var(--color-accent-ink); justify-content: center; padding: 0 10px; align-self: flex-end; }

/* Inbox, new message: one button per switched-on channel; they wrap under the name on phones. */
.new-msg-channels { gap: var(--space-xs); flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 56rem) { .new-msg-channels { justify-content: flex-start; } }

/* Workflow library: one card grid per category, spaced like sections. */
.wf-library { display: grid; gap: var(--space-lg); }

/* Pop-up forms: <dialog class="modal">, opened by a page-head button (commandfor="id" command="show-modal").
   A head with the title and a close button, the fields, then Cancel and the one action at the bottom right.
   Wider (.wide) for an editor; on phones it fills the screen edge to edge. Same motion as the confirm box. */
dialog.modal { width: min(34rem, calc(100vw - 32px)); max-height: calc(100dvh - 48px); padding: 0; border: var(--rule); border-radius: var(--radius-lg); background: var(--color-surface); color: var(--color-ink); box-shadow: var(--shadow-pop); animation: dialog-in 200ms var(--ease-out); overflow: hidden; }
dialog.modal[open] { display: flex; flex-direction: column; }
dialog.modal.wide { width: min(64rem, calc(100vw - 32px)); }
dialog.modal > form { display: flex; flex-direction: column; min-height: 0; flex: 1; margin: 0; }
.modal-head { display: flex; align-items: flex-start; gap: var(--space-sm); padding: var(--space-lg) var(--space-lg) var(--space-sm); }
.modal-head > div { flex: 1; min-width: 0; }
.modal-head h2 { margin: 0; font-size: var(--text-lg); }
.modal-head .sub { margin: var(--space-3xs) 0 0; color: var(--color-ink-2); font-size: var(--text-sm); }
.modal-head .icon-btn { margin: -4px -8px 0 0; }
.modal-body { padding: var(--space-xs) var(--space-lg) var(--space-md); overflow: auto; flex: 1; min-height: 0; }
.modal-body > :last-child { margin-bottom: 0; }
.modal-foot { display: flex; justify-content: flex-end; gap: var(--space-xs); padding: var(--space-sm) var(--space-lg); border-top: var(--rule); background: var(--color-paper-2); }
dialog.modal::backdrop { background: var(--color-scrim, rgb(27 29 42 / .45)); animation: fade-in 200ms var(--ease-out); }
dialog.modal.is-closing { animation: dialog-out 140ms ease-in forwards; }
dialog.modal.is-closing::backdrop { animation: fade-out 140ms ease-in forwards; }
@media (max-width: 40rem) {
  dialog.modal, dialog.modal.wide { width: 100vw; max-width: 100vw; max-height: 100dvh; height: 100dvh; margin: 0; border-radius: 0; border: 0; }
}
@media (prefers-reduced-motion: reduce) { dialog.modal, dialog.modal::backdrop { animation: none !important; } }

/* Merge fields: a well beside an editor with every real field as a chip to click in, grouped. */
.merge-well { display: grid; gap: var(--space-sm); align-content: start; padding: var(--space-sm); border: var(--rule); border-radius: var(--radius); background: var(--color-paper-2); }
.merge-well h3 { margin: 0; font-size: var(--text-sm); font-weight: 600; }
.merge-well .hint { margin: 0; }
.merge-well .chips button { justify-content: flex-start; }
.merge-group { display: grid; gap: var(--space-2xs); }
.merge-group > span { font-size: var(--text-xs); color: var(--color-ink-3); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.editor-split { display: grid; grid-template-columns: minmax(0, 1fr) 15rem; gap: var(--space-md); align-items: start; }
@media (max-width: 48rem) { .editor-split { grid-template-columns: 1fr; } }

/* A card grid of templates (letters): the name, the opening lines, and its actions underneath. */
.tpl-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr)); gap: var(--space-sm); list-style: none; margin: 0; padding: 0; }
.tpl-card { display: flex; flex-direction: column; gap: var(--space-2xs); padding: var(--space-md); border: var(--rule); border-radius: var(--radius-lg); background: var(--color-surface); transition: transform var(--dur-short) var(--ease-out), box-shadow var(--dur-short) var(--ease-out); }
.tpl-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-lift); }
.tpl-card b { font-size: var(--text-md); }
.tpl-card p { margin: 0; color: var(--color-ink-2); font-size: var(--text-sm); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; min-height: 3.9em; }
.tpl-card .row { margin-top: auto; padding-top: var(--space-xs); gap: var(--space-sm); }
@media (prefers-reduced-motion: reduce) { .tpl-card, .tpl-card:hover { transition: none; transform: none; } }
.modal-body .two-up { margin-bottom: var(--space-md) !important; } /* shared field partials set it to 0 for panels */
.modal-foot > .start { margin-right: auto; } /* a danger action sits on the left, away from the save */
/* A panel's title with its own add button on the right (API keys, Webhooks, an event's tabs). */
.panel-title { display: flex; justify-content: space-between; align-items: center; gap: var(--space-sm); flex-wrap: wrap; margin-bottom: var(--space-sm); }
.panel-title > :is(h2, h3) { margin: 0; }
.page-tools { justify-content: flex-end; margin-bottom: var(--space-sm); }
.panel-title > p { margin: 0; max-width: 52rem; }
.panel-title > div > p { margin: 0; }
.panel-actions { margin-top: var(--space-sm); gap: var(--space-xs); align-items: center; }
.merge-inline { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2xs) var(--space-xs); margin: calc(-1 * var(--space-xs)) 0 var(--space-md); }
.after-table { margin-top: var(--space-lg); } /* a panel that follows a table and its pager */
.feats-field { margin: 0; padding: 0; border: 0; }
.feats-field legend { font-weight: 600; font-size: var(--text-sm); margin-bottom: var(--space-xs); }
.feats-field .feats { border: var(--rule); border-radius: var(--radius); }
.modal-body > .panel { border: 0; padding: 0; background: none; box-shadow: none; } /* a shared settings panel shown inside a pop-up */
.notice > .btn:last-child, .notice > button:last-child { margin-left: auto; }
.form-actions.flush { margin: 0; }

/* Leaving page (/l/ links we can't vouch for): the full address, wrapped */
.leaving-url { overflow-wrap: anywhere; color: var(--color-ink-2); }
