:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1c2430;
  --muted: #5a6573;
  --border: #dde2e8;
  --accent: #2d5bd7;
  --accent-soft: #e8eefc;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --ok: #1a7f37;
  --ok-soft: #e6f4ea;
  --warn-soft: #fff4e5;
  --warn: #8a4b00;
  --focus: #2d5bd7;
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161c;
    --surface: #1b2129;
    --text: #e6eaef;
    --muted: #9aa5b1;
    --border: #2c3440;
    --accent: #7d9df0;
    --accent-soft: #232e45;
    --danger: #f59b8f;
    --danger-soft: #3a1f1d;
    --ok: #7ee2a0;
    --ok-soft: #1c3325;
    --warn-soft: #3a2c16;
    --warn: #f5c37a;
    --focus: #9db6f5;
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.55;
}

.wrap {
  width: 100%;
  max-width: 60rem;
  margin: 0 auto;
  padding-inline: 16px;
}

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.header-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  min-height: 3.5rem;
  padding-block: 0.5rem;
}

.brand {
  font-weight: 650;
  letter-spacing: 0.01em;
}

main { padding-top: 2.5rem; padding-bottom: 2.5rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem 1.5rem;
}

h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.5rem, 1.2rem + 1.5vw, 2rem);
  line-height: 1.2;
}

.lead { margin: 0 0 1.25rem; color: var(--muted); }

.notice {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.badge {
  display: inline-block;
  padding: 0.125rem 0.625rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.8125rem;
  font-weight: 600;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -3rem;
  padding: 0.5rem 0.75rem;
  background: var(--surface);
  color: var(--accent);
  border: 2px solid var(--focus);
  border-radius: var(--radius);
  z-index: 10;
}

.skip-link:focus { top: 0.5rem; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

main:focus { outline: none; }

.account {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}

.signed-in { color: var(--muted); font-size: 0.9375rem; }
.signed-in strong { color: var(--text); font-weight: 600; }

.inline-form { margin: 0; }

.main-nav { padding-bottom: 0.5rem; }

.main-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-item {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  min-height: 2.75rem;
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
}

.nav-item.is-disabled { color: var(--muted); cursor: not-allowed; }

.card-narrow { max-width: 26rem; margin-inline: auto; }

.form { display: grid; gap: 1rem; }

.field { display: grid; gap: 0.375rem; }

label { font-weight: 600; font-size: 0.9375rem; }

input[type="text"],
input[type="search"],
input[type="password"],
select {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.5rem 0.75rem;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.5rem 1.125rem;
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
}

.button-secondary {
  min-height: 2.5rem;
  color: var(--accent);
  background: var(--surface);
  border-color: var(--border);
}

.error {
  margin: 0 0 1rem;
  padding: 0.625rem 0.875rem;
  border-radius: 8px;
  background: var(--danger-soft);
  color: var(--danger);
  font-weight: 600;
}

.card-narrow .notice { margin-bottom: 1rem; }

@media (prefers-color-scheme: dark) {
  .button:not(.button-secondary) { color: #10151c; }
}

/* ---- 1.3a: Settings → Agents, Contacts ---- */

a { color: var(--accent); }
.nav-item[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-item:not(.is-disabled):hover { background: var(--accent-soft); }

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.875em;
  overflow-wrap: anywhere;
}

h2 { margin: 0; font-size: 1.25rem; line-height: 1.3; }
h3, .h3 { margin: 1.25rem 0 0.5rem; font-size: 1rem; }

.eyebrow { margin: 0 0 0.25rem; color: var(--muted); font-size: 0.9375rem; }
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.page-head h1 { margin: 0; }
.muted { color: var(--muted); }
.help { margin: 0; color: var(--muted); font-size: 0.875rem; }
.empty { color: var(--muted); }
.card + .card { margin-top: 1.25rem; }
.card-form { max-width: 40rem; }

.flash { margin-bottom: 1rem; padding: 0.625rem 0.875rem; border-radius: 8px; background: var(--ok-soft); color: var(--ok); font-weight: 600; }
main > .error { margin-bottom: 1rem; }
.warning {
  margin: 0 0 1rem;
  padding: 0.75rem 0.875rem;
  border-radius: 8px;
  background: var(--warn-soft);
  color: var(--warn);
}

.agent-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; }
.agent.is-revoked h2 { color: var(--muted); }

.status {
  display: inline-block;
  padding: 0.125rem 0.625rem;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 600;
  border: 1px solid currentColor;
}
.status-active { color: var(--ok); background: var(--ok-soft); }
.status-revoked, .status-expired { color: var(--danger); background: var(--danger-soft); }

.scope-list { margin: 0 0 0.75rem; padding-left: 1.25rem; }
.scope-list li { margin: 0.125rem 0; }
.scope-list code { color: var(--muted); }

.credential-list { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: 0.75rem; }
.credential { border: 1px solid var(--border); border-radius: 8px; padding: 0.75rem 0.875rem; }
.credential-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }

.facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.25rem 1rem;
  margin: 0 0 0.75rem;
}
.facts dt { color: var(--muted); }
.facts dd { margin: 0; min-width: 0; }
@media (max-width: 30rem) {
  .facts { grid-template-columns: 1fr; gap: 0; }
  .facts dd { margin-bottom: 0.375rem; }
}

.issue-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}
.issue-form .field { flex: 1 1 14rem; }
.danger-zone { margin: 1rem 0 0; }

.button-danger { color: var(--danger); background: var(--surface); border-color: var(--danger); min-height: 2.5rem; }
.button-danger-solid { color: #fff; background: var(--danger); border-color: var(--danger); }
@media (prefers-color-scheme: dark) {
  .button-danger-solid { color: #10151c; }
}

fieldset.scope-field { border: 1px solid var(--border); border-radius: 8px; padding: 0.75rem 1rem 1rem; margin: 0; min-width: 0; }
fieldset.scope-field legend { font-weight: 600; padding: 0 0.25rem; }
.check { display: flex; align-items: flex-start; gap: 0.625rem; margin-top: 0.625rem; }
.check input { width: 1.25rem; height: 1.25rem; margin: 0.15rem 0 0; flex: none; }
.check label { font-weight: 400; }
.check code { color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }

.copy-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.copy-row input { flex: 1 1 14rem; min-width: 0; }
.token { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.search-form { margin-bottom: 1rem; display: grid; gap: 0.375rem; }
.record-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.record-list li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.25rem 1rem; padding: 0.75rem 1rem; }
.record-list li + li { border-top: 1px solid var(--border); }
.notes { white-space: pre-wrap; overflow-wrap: anywhere; }

/* OAuth consent and Connections (1.3b) */
.wrap-anywhere { overflow-wrap: anywhere; word-break: break-word; }
.consent-facts { margin: 1rem 0; }
.consent-facts dd .status { margin-left: 0.25rem; }
.consent .notice { margin: 0 0 1rem; }
.agent-choice label .help { display: block; font-weight: 400; }
.new-agent { margin: 0.5rem 0 0 1.875rem; display: grid; gap: 0.25rem; }
.new-agent .field { margin-bottom: 0.5rem; }
.agent-choice .warning-inline { color: var(--warn); font-weight: 600; }

/* ---- 2.1: Contacts, Companies, Relationship list ---- */

input[type="url"],
input[type="datetime-local"],
textarea {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.5rem 0.75rem;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}
textarea { resize: vertical; line-height: 1.45; }
[aria-invalid="true"] { border-color: var(--danger) !important; box-shadow: 0 0 0 1px var(--danger); }
fieldset[aria-invalid="true"] { border-color: var(--danger); }
button[aria-disabled="true"] { opacity: 0.7; cursor: progress; }
.small { font-size: 0.875rem; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.filter-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 0.75rem 1rem;
  align-items: end;
  margin-bottom: 1.25rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.filter-form .field-wide { grid-column: 1 / -1; }
.filter-form .actions { grid-column: 1 / -1; }

.badges { display: flex; flex-wrap: wrap; gap: 0.25rem 0.375rem; margin: 0; padding: 0; list-style: none; }
.badge-rel { background: var(--accent-soft); color: var(--accent); border: 1px solid transparent; }
.badge-rel.is-retired { background: transparent; color: var(--muted); border-color: var(--border); }
.badge-note { font-weight: 400; }
.badge-tag { background: transparent; color: var(--text); border: 1px solid var(--border); font-weight: 500; }
.status-archived { color: var(--warn); background: var(--warn-soft); }
.tag-row { margin-top: 0.375rem; }

.record-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.record-table th, .record-table td {
  padding: 0.75rem 0.875rem;
  text-align: left;
  vertical-align: top;
  border-top: 1px solid var(--border);
}
.record-table thead th {
  border-top: 0;
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.record-table tbody th { font-weight: 600; overflow-wrap: break-word; }
@media (max-width: 45rem) {
  .record-table, .record-table tbody, .record-table tr, .record-table th, .record-table td { display: block; width: 100%; }
  .record-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .record-table tr { padding: 0.75rem 0.875rem; border-top: 1px solid var(--border); }
  .record-table tbody tr:first-child { border-top: 0; }
  .record-table th, .record-table td { padding: 0.125rem 0; border: 0; }
  .record-table td { display: grid; grid-template-columns: 8.5rem 1fr; gap: 0.5rem; }
  .record-table td::before { content: attr(data-label); color: var(--muted); font-size: 0.875rem; }
  .record-table tbody th { margin-bottom: 0.25rem; font-size: 1.0625rem; }
}

.pager { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1rem; }

.record-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; margin-bottom: 0.5rem; }
.record-head h1 { margin: 0; overflow-wrap: anywhere; }
.record-actions { margin: 0.75rem 0 1.25rem; }

.details-list {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.5rem 1.25rem;
  margin: 0 0 0.75rem;
}
.details-list dt { color: var(--muted); }
.details-list dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 30rem) {
  .details-list { grid-template-columns: 1fr; gap: 0; }
  .details-list dd { margin-bottom: 0.625rem; }
}
.plain-list { margin: 0.25rem 0 0.5rem; padding-left: 1.25rem; }
.plain-list li { margin: 0.25rem 0; }

.saved-values { margin-bottom: 1.25rem; background: var(--bg); }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: 1rem; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 0 1rem; }
.save-status { color: var(--muted); font-weight: 600; }

.sub-nav ul { display: flex; flex-wrap: wrap; gap: 0.25rem 0.5rem; margin: 0 0 1rem; padding: 0; list-style: none; }
.sub-nav a {
  display: inline-flex; align-items: center; min-height: 2.5rem; padding: 0.25rem 0.75rem;
  border: 1px solid var(--border); border-radius: 999px; text-decoration: none; color: var(--text);
}
.sub-nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); font-weight: 600; }

.value-list { list-style: none; margin: 0.5rem 0 0; padding: 0; display: grid; gap: 0.75rem; }
.value-row { border: 1px solid var(--border); border-radius: 8px; padding: 0.75rem 0.875rem; display: grid; gap: 0.5rem; }
.value-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.625rem; }
.value-actions { display: flex; flex-wrap: wrap; gap: 0.5rem 0.75rem; align-items: center; }
.rename-form { display: flex; flex-wrap: wrap; gap: 0.5rem; flex: 1 1 18rem; }
.rename-form input { flex: 1 1 10rem; min-width: 0; }
.card-title { margin-top: 0; }
.card > :first-child, .card > .h3:first-child { margin-top: 0; }

/* ---- 2.2 ---- */
.saved-values dd.differs { font-weight: 600; }
.button-small { min-height: 2.25rem; padding: 0.25rem 0.75rem; font-size: 0.9375rem; }
.status-ended { color: var(--muted); background: transparent; }
.badge-type { background: transparent; color: var(--text); border: 1px solid var(--border); }
.method-list, .affiliation-list, .people-list { list-style: none; margin: 0.75rem 0; padding: 0; display: grid; gap: 0.75rem; }
.method, .affiliation { border: 1px solid var(--border); border-radius: 8px; padding: 0.75rem 0.875rem; display: grid; gap: 0.375rem; min-width: 0; }
.affiliation.is-current { border-color: var(--accent); }
.method-head, .affiliation-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.5rem; }
.method-value { font-size: 1.0625rem; overflow-wrap: anywhere; }
.method-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.method-edit summary { cursor: pointer; color: var(--accent); font-weight: 600; min-height: 2.25rem; display: inline-flex; align-items: center; }
.method-edit[open] { padding-top: 0.25rem; }
.method-edit .form { margin-top: 0.5rem; }
.people-list li { overflow-wrap: anywhere; }
.current-company { font-size: 1.0625rem; overflow-wrap: anywhere; }
.field-grow { grid-column: span 2; }
@media (max-width: 30rem) { .field-grow { grid-column: auto; } }
.filter-chip { margin-bottom: 1rem; padding: 0.5rem 0.75rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.add-method { padding-top: 0.25rem; }
input[type="date"] {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.5rem 0.75rem;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}

/* ---- 2.3: search, Duplicate candidates ---- */
.header-search { display: flex; gap: 0.5rem; flex: 1 1 18rem; max-width: 28rem; }
.header-search input { min-height: 2.25rem; padding: 0.25rem 0.625rem; min-width: 0; }
@media (max-width: 45rem) { .header-search { order: 3; flex-basis: 100%; max-width: none; } }
mark { background: var(--warn-soft); color: inherit; font-weight: 700; padding: 0 0.0625rem; border-radius: 3px; }
.result-list { list-style: none; margin: 0.75rem 0 0; padding: 0; display: grid; gap: 0.625rem; }
.result { border-top: 1px solid var(--border); padding-top: 0.625rem; min-width: 0; }
.result:first-child { border-top: 0; padding-top: 0; }
.result-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.5rem; }
.result-name { font-weight: 600; overflow-wrap: anywhere; }
.snippet { margin: 0.125rem 0 0; color: var(--muted); overflow-wrap: anywhere; }
.snippet-label { font-weight: 600; }
.pair-list { list-style: none; margin: 0; padding: 0; }
.pair-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; }
.pair-head h2 { margin: 0; overflow-wrap: anywhere; }
.reason-list { margin: 0.75rem 0; padding-left: 1.25rem; }
.pair-sides { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
@media (max-width: 40rem) { .pair-sides { grid-template-columns: 1fr; } }
.pair-side { border: 1px solid var(--border); border-radius: 8px; padding: 0.75rem 0.875rem; min-width: 0; }
.pair-label { margin: 0; text-transform: uppercase; letter-spacing: 0.03em; }
.pair-name { margin: 0.125rem 0 0.375rem; font-weight: 600; overflow-wrap: anywhere; }
.pair-facts { list-style: none; margin: 0; padding: 0; font-size: 0.9375rem; display: grid; gap: 0.125rem; }
.dismiss-form { display: grid; gap: 0.75rem; margin-top: 1rem; padding-top: 0.75rem; border-top: 1px solid var(--border); }
.status-high { color: var(--danger); background: var(--danger-soft); }
.status-medium { color: var(--warn); background: var(--warn-soft); }
.status-low { color: var(--muted); background: transparent; }
.inline-options { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; margin: 0 0 1rem; }
.inline-options .check { margin-top: 0; }
.possible-list { margin: 0.5rem 0; padding-left: 1.25rem; }
button[disabled] { opacity: 0.6; cursor: not-allowed; }

/* ---- Activities (3.1) ---------------------------------------------------------------- */
.section-head { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; justify-content: space-between; }
.section-head h2 { margin: 0; }
.last-interaction { margin: .25rem 0 .75rem; }
.timeline { list-style: none; margin: .75rem 0; padding: 0; }
.timeline-item { display: grid; grid-template-columns: minmax(8.5rem, 11rem) 1fr; gap: .25rem 1rem; padding: .6rem 0; border-top: 1px solid var(--border, #d8dde3); }
.timeline-item:first-child { border-top: 0; }
.timeline-item.is-retracted .timeline-summary { text-decoration: line-through; }
.timeline-when { font-variant-numeric: tabular-nums; color: var(--muted, #52606d); }
.timeline-main { min-width: 0; }
.timeline-summary { font-weight: 600; overflow-wrap: anywhere; }
.timeline-links { margin: .25rem 0 0; overflow-wrap: anywhere; }
.activity-badges { margin: .35rem 0 0; }
.badge-kind { font-weight: 600; }
.badge-unconfirmed { background: #fff4d6; color: #6b4a00; border: 1px solid #c99700; }
.badge-retracted { background: #fde8e8; color: #8a1c1c; border: 1px solid #c53030; }
.badge-undated { border-style: dashed; }
.badge-failed, .badge-missed, .badge-cancelled, .badge-attempted { border-style: dotted; }
.choice-row { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; }
.pick-list li { margin: .2rem 0; }
.pick-list .is-flagged label { font-style: italic; }
.add-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-end; }
.add-row label { flex-basis: 100%; }
.add-row input { flex: 1 1 12rem; min-width: 0; }
.advanced { margin: 1rem 0; }
.advanced summary { cursor: pointer; font-weight: 600; }
.retired-values > summary { cursor: pointer; padding: .25rem 0; min-height: 2.75rem; }
.retired-values > summary .summary-heading { display: inline; margin: 0; }
.history-list li { margin: .35rem 0; }
[hidden] { display: none !important; }
@media (max-width: 40rem) {
  .timeline-item { grid-template-columns: 1fr; }
}

/* ---- Follow-ups (3.2) ---------------------------------------------------------------- */
.follow-up-list { list-style: none; margin: .75rem 0; padding: 0; }
.follow-up { display: grid; grid-template-columns: 1fr auto; gap: .5rem 1rem; padding: .7rem 0; border-top: 1px solid var(--border); align-items: start; }
.follow-up:first-child { border-top: 0; }
.follow-up-main { min-width: 0; }
.follow-up-title { font-weight: 600; overflow-wrap: anywhere; }
.follow-up-meta { margin: .25rem 0 0; overflow-wrap: anywhere; }
.follow-up-actions { display: flex; flex-wrap: wrap; gap: .375rem; align-items: center; justify-content: flex-end; }
.reschedule-form { display: flex; flex-wrap: wrap; gap: .375rem; align-items: center; }
.reschedule-form input[type=date] { min-height: 2rem; padding: .125rem .375rem; width: auto; }
.badge-overdue { background: var(--danger-soft); color: var(--danger); border: 1px solid var(--danger); font-weight: 600; }
.badge-today { background: var(--warn-soft); color: var(--warn); border: 1px solid var(--warn); font-weight: 600; }
.badge-upcoming { border: 1px dashed var(--accent); }
.badge-completed { background: var(--ok-soft); color: var(--ok); }
.badge-cancelled { border-style: dotted; }
.follow-up.is-overdue .follow-up-title { color: var(--danger); }
.completes-list li { margin: .3rem 0; }
.new-follow-up { margin-top: 1rem; }
@media (max-width: 40rem) {
  .follow-up { grid-template-columns: 1fr; }
  .follow-up-actions { justify-content: flex-start; }
}

/* ---- List columns and Going quiet (3.3) ------------------------------------------------ */
.cell { min-width: 0; overflow-wrap: break-word; }
.cell .activity-badges { margin: .25rem 0 0; }
.cell-due { display: block; color: var(--muted); }
.badge-type { font-size: .75rem; font-weight: 400; }
.badge-never { border: 1px dashed var(--muted); white-space: nowrap; }
.quiet-table td:last-child { white-space: nowrap; }

/* Merge (4.1): the review page, the moves list and the Notes block. */
.pair-side.is-survivor { border-color: var(--accent); border-width: 2px; }
.merge-choose fieldset { border: 0; padding: 0; margin: 0 0 1rem; }
.merge-moves dt { font-weight: 600; margin-top: 0.75rem; }
.merge-moves dd { margin: 0.25rem 0 0; }
.merge-moves ul { margin: 0; padding-left: 1.25rem; }
.merge-block { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--accent-soft); border: 1px solid var(--border); border-radius: 6px; padding: 0.75rem; font-family: inherit; font-size: 0.9rem; max-width: 100%; }
.merge-survived { list-style: none; padding-left: 0.875rem; }
.merge-survived li + li { margin-top: 0.25rem; }

/* Settings → Audit history (4.2) */
.audit-list { list-style: none; margin: 0; padding: 0; }
.audit-list .audit-entry + .audit-entry { margin-top: 0.75rem; }
.audit-head { display: flex; flex-wrap: wrap; gap: 0.25rem 0.75rem; align-items: baseline; justify-content: space-between; }
.audit-who, .audit-record { margin: 0.25rem 0; overflow-wrap: anywhere; }
.change-list { list-style: none; margin: 0.5rem 0; padding: 0.5rem 0.75rem; border-left: 3px solid var(--border); display: grid; gap: 0.375rem; }
.change-field { font-weight: 600; margin-right: 0.375rem; }
.change-field::after { content: ":"; }
.change-values { overflow-wrap: anywhere; }
.change-list del { color: var(--muted); text-decoration: line-through; }
.change-list ins { text-decoration: none; }
.audit-value { white-space: pre-wrap; overflow-wrap: anywhere; }
.audit-more { display: inline; }
.audit-more summary { display: inline; cursor: pointer; }
.audit-more[open] summary .audit-value { display: none; }
.audit-full { display: block; }
.audit-facts { margin-top: 0.5rem; font-size: 0.875rem; }
.history-link { margin-top: 0.5rem; }
.api-doc pre { overflow-x: auto; max-width: 100%; padding: 0.75rem; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; font-size: 0.8125rem; }
.api-doc table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.api-doc th, .api-doc td { text-align: left; padding: 0.375rem 0.5rem; border-bottom: 1px solid var(--border); vertical-align: top; overflow-wrap: anywhere; }
.api-doc code { overflow-wrap: anywhere; }

/* ---- Lists (6.1): wide fluid container, compact rows, sortable headers, numbered pages ---- */
.wrap-wide { max-width: 88rem; padding-inline: clamp(16px, 2.5vw, 32px); }
.record-table th, .record-table td { padding: 0.5rem 0.75rem; }
.record-table { font-size: 0.9375rem; line-height: 1.4; }
/* Names wrap at spaces only, never mid-word (no "Adam Najber/g"). */
.record-table tbody th, .record-table td { word-break: normal; overflow-wrap: break-word; hyphens: manual; }
.record-table .col-name { min-width: 11rem; }
.record-table .col-company { min-width: 9rem; }
.record-table .col-when { min-width: 8.5rem; }
.record-table .col-added, .record-table .col-size,
.contacts-table tbody td:nth-child(7), .companies-table tbody td:nth-child(7),
.companies-table tbody td:nth-child(3) { white-space: nowrap; }
.record-table .col-select { width: 2.5rem; }
.record-table .col-type, .record-table .col-quiet { white-space: nowrap; }
.record-table thead th { position: sticky; top: 0; z-index: 1; background: var(--surface); border-bottom: 1px solid var(--border); }
.record-table thead th:first-child { border-top-left-radius: var(--radius); }
.record-table thead th:last-child { border-top-right-radius: var(--radius); }
.record-table tbody tr:first-child > * { border-top: 0; }
.record-table tbody tr:hover { background: var(--bg); }
.record-table .badges { gap: 0.25rem; }
.record-table .badge { padding: 0.0625rem 0.5rem; font-size: 0.75rem; white-space: nowrap; }
.record-table .activity-badges { margin-top: 0.125rem; }
.badge-more { background: transparent; color: var(--muted); border: 1px dashed var(--border); font-weight: 500; cursor: help; }
.cell-due { font-size: 0.8125rem; }
.sort-link { display: inline-flex; align-items: center; gap: 0.25rem; color: inherit; text-decoration: none; min-height: 1.75rem; }
.sort-link:hover, .sort-link.is-sorted { color: var(--text); }
.sort-link:hover { text-decoration: underline; }
.sort-icon { font-size: 0.6875rem; opacity: 0.55; }
.sort-link.is-sorted .sort-icon { opacity: 1; color: var(--accent); }
.list-status { margin: 0 0 0.5rem; color: var(--muted); font-size: 0.9375rem; }
.list-results { position: relative; }
.list-main.htmx-request .list-results { opacity: 0.55; transition: opacity 150ms ease-in 120ms; }
.list-loading { visibility: hidden; color: var(--muted); font-size: 0.875rem; }
.list-main.htmx-request .list-loading { visibility: visible; }
.filter-panel { margin-bottom: 0.75rem; }
.filter-summary { display: none; }
.filter-panel .filter-form { margin-bottom: 0; padding: 0.75rem 1rem; gap: 0.5rem 0.75rem; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); }
.filter-panel .filter-form .field-search { grid-column: span 2; }
.filter-panel .filter-form .actions { grid-column: auto; align-self: end; gap: 0.5rem; }
.filter-panel input[type="text"], .filter-panel input[type="search"], .filter-panel input[type="date"], .filter-panel select { min-height: 2.375rem; padding-block: 0.25rem; }
/* Wide screens: the panel is always open (lists.js opens it too, for browsers
   without ::details-content). */
@media (min-width: 45.0625rem) {
  .filter-panel::details-content { content-visibility: visible; block-size: auto; }
}
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 0.375rem 0.5rem; margin: 0 0 0.625rem; padding: 0; list-style: none; }
.chip { display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.125rem 0.25rem 0.125rem 0.625rem; border: 1px solid var(--border); border-radius: 999px; background: var(--accent-soft); font-size: 0.875rem; max-width: 100%; }
.chip-label { color: var(--muted); }
.chip-value { font-weight: 600; overflow-wrap: anywhere; }
.chip-remove { display: inline-flex; align-items: center; justify-content: center; width: 1.75rem; height: 1.75rem; border-radius: 999px; text-decoration: none; font-size: 1.125rem; line-height: 1; color: var(--text); }
.chip-remove:hover { background: var(--surface); }
.chip-clear { font-size: 0.875rem; }
.page-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem 1.5rem; margin-top: 0.75rem; }
.page-size { display: flex; align-items: center; gap: 0.5rem; margin: 0; }
.page-size label { font-weight: 400; color: var(--muted); font-size: 0.875rem; }
.page-size select { width: auto; min-height: 2.25rem; padding: 0.125rem 0.5rem; }
.pager { display: flex; flex-wrap: wrap; align-items: center; gap: 0.375rem; margin-top: 0; }
.pager-link, .page-number { display: inline-flex; align-items: center; justify-content: center; min-width: 2.5rem; min-height: 2.5rem; padding: 0.25rem 0.625rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); text-decoration: none; font-weight: 600; }
.page-number[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: #fff; }
@media (prefers-color-scheme: dark) { .page-number[aria-current="page"] { color: #10151c; } }
.page-numbers { display: flex; flex-wrap: wrap; gap: 0.375rem; margin: 0; padding: 0; list-style: none; }
.page-gap { display: inline-flex; align-items: center; padding: 0 0.25rem; color: var(--muted); }
.page-of { display: none; color: var(--muted); font-size: 0.875rem; }
.sort-choices { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.5rem; margin: 0 0 0.75rem; }
.sort-choice { display: inline-flex; align-items: center; min-height: 2.25rem; padding: 0.125rem 0.75rem; border: 1px solid var(--border); border-radius: 999px; text-decoration: none; font-size: 0.875rem; color: var(--text); }
.sort-choice[aria-current="true"] { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); font-weight: 600; }
.row-action { white-space: nowrap; font-size: 0.875rem; font-weight: 600; }
.quiet-table td:last-child { white-space: nowrap; }
.select-all { display: inline-flex; }
.record-table input[type="checkbox"] { width: 1.125rem; height: 1.125rem; margin: 0.125rem 0 0; }
.bulk-form { margin: 0; }
.bulk-panel { margin: 0 0 0.75rem; padding: 0.5rem 0.875rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.bulk-panel > summary { cursor: pointer; font-weight: 600; color: var(--accent); min-height: 2.25rem; display: flex; align-items: center; gap: 0.5rem; }
.bulk-count { color: var(--text); font-weight: 400; }
.bulk-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: 0.5rem 0.75rem; align-items: end; padding: 0.5rem 0 0.25rem; }
.bulk-fields .field-grow { grid-column: span 2; }
.bulk-fields .actions { grid-column: 1 / -1; }
.focus-note { margin: 0 0 0.5rem; }
@media (max-width: 75rem) {
  .contacts-table .col-added, .contacts-table tbody td:nth-child(7),
  .companies-table .col-added, .companies-table tbody td:nth-child(7) { display: none; }
}
@media (max-width: 45rem) {
  .filter-summary { display: flex; align-items: center; gap: 0.375rem; min-height: 2.75rem; padding: 0.25rem 0.875rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); font-weight: 600; cursor: pointer; }
  .filter-panel[open] .filter-summary { border-bottom-left-radius: 0; border-bottom-right-radius: 0; border-bottom-color: transparent; }
  .filter-panel[open] .filter-form { border-top-left-radius: 0; border-top-right-radius: 0; }
  .filter-count { color: var(--accent); }
  .filter-summary::-webkit-details-marker { display: none; }
  .filter-summary::after { content: "\25BE"; margin-left: auto; color: var(--muted); }
  .filter-panel[open] .filter-summary::after { content: "\25B4"; }
  .filter-panel .filter-form { grid-template-columns: 1fr; }
  .filter-panel .filter-form .field-search { grid-column: auto; }
  .record-table thead th { position: static; }
  .record-table tr { padding: 0.625rem 0.75rem; }
  .record-table td { grid-template-columns: 7.5rem 1fr; }
  .contacts-table .col-added, .contacts-table tbody td:nth-child(7),
  .companies-table .col-added, .companies-table tbody td:nth-child(7) { display: grid; }
  .quiet-table tbody td[data-label="Select"] { display: flex; align-items: center; gap: 0.5rem; }
  .quiet-table tbody td[data-label="Select"]::before { content: none; }
  .page-numbers { display: none; }
  .page-of { display: inline; }
  .pager-end { display: none; }
  .page-controls { justify-content: center; }
  .bulk-fields .field-grow { grid-column: auto; }
}

/* ---- Home table, row menus, bulk bar (6.2) ------------------------------------------------ */
.bucket-summary { display: flex; flex-wrap: wrap; gap: 0.375rem 0.5rem; margin: 0 0 0.625rem; }
.bucket-link { display: inline-flex; align-items: center; gap: 0.375rem; min-height: 2.25rem; padding: 0.125rem 0.75rem; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); text-decoration: none; color: var(--text); font-size: 0.875rem; }
.bucket-link[aria-current="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.bucket-count { font-weight: 700; font-variant-numeric: tabular-nums; }
.bucket-overdue .bucket-count { color: var(--danger); }
.bulk-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.375rem 0.5rem; margin: 0 0 0.625rem; padding: 0.375rem 0.75rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.bulk-bar .error { flex-basis: 100%; margin: 0.25rem 0; }
.bulk-label { font-weight: 600; font-size: 0.875rem; }
.bulk-bar .help { margin-left: auto; }
.home-table .col-select, .home-table .cell-select { width: 2.25rem; }
.home-table .col-title { width: 44%; }
.home-table .cell-title { max-width: 0; }
.home-table .col-record { min-width: 12rem; }
.home-table .col-due { min-width: 11rem; }
.home-table .col-assignee { min-width: 6rem; }
.home-table .col-actions, .home-table .cell-actions { width: 1%; white-space: nowrap; }
.fu-title { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.fu-prompt { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 400; }
.home-table tbody th { font-weight: 600; }
.bucket-row th { padding: 0.5rem 0.75rem 0.25rem; background: var(--bg); font-size: 0.8125rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text); }
.home-table tbody.bucket-group + tbody.bucket-group .bucket-row th { border-top: 1px solid var(--border); }
.due-cell { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem; }
@media (min-width: 64rem) { .home-table .due-cell { flex-wrap: nowrap; } }
.due-date { white-space: nowrap; }
.row-actions { display: flex; align-items: center; gap: 0.375rem; justify-content: flex-end; }
.row-menu { position: relative; }
.row-menu > summary { list-style: none; cursor: pointer; }
.row-menu > summary::-webkit-details-marker { display: none; }
.row-menu > summary::after { content: "\25BE"; margin-left: 0.25rem; font-size: 0.75rem; }
.row-menu-panel { position: absolute; right: 0; top: calc(100% + 0.25rem); z-index: 5; display: grid; gap: 0.25rem; min-width: 15rem; padding: 0.5rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 6px 24px rgb(0 0 0 / 0.14); text-align: left; white-space: normal; }
.menu-form { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.375rem; }
.menu-item { flex: 1 1 auto; min-height: 2.25rem; padding: 0.25rem 0.625rem; font: inherit; font-size: 0.9375rem; text-align: left; color: var(--accent); background: transparent; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; }
.menu-item:hover { background: var(--accent-soft); }
.menu-item-danger { color: var(--danger); }
.menu-move { padding-top: 0.25rem; border-top: 1px solid var(--border); }
.menu-move label { flex-basis: 100%; font-size: 0.8125rem; color: var(--muted); font-weight: 600; }
.menu-move input[type="date"] { flex: 1 1 8rem; width: auto; min-height: 2.25rem; padding: 0.125rem 0.375rem; }
.fu-rows { list-style: none; margin: 0.5rem 0; padding: 0; }
.fu-row { display: flex; align-items: center; gap: 0.5rem 0.75rem; padding: 0.5rem 0; border-top: 1px solid var(--border); }
.fu-row:first-child { border-top: 0; }
.fu-main { flex: 1 1 auto; min-width: 0; }
.fu-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.375rem; margin-top: 0.125rem; }
.home-page .filter-panel .filter-form { grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); }
.home-page .filter-panel .filter-form .actions { grid-column: auto; flex-wrap: wrap; }
@media (max-width: 45rem) { .home-page .filter-panel .filter-form .actions { grid-column: auto; flex-wrap: wrap; } }
.home-table .button-small { min-height: 2rem; padding: 0.125rem 0.625rem; font-size: 0.875rem; }
.home-table td, .home-table tbody th { vertical-align: middle; }
.fu-title { color: var(--text); text-decoration: none; }
.fu-title:hover, .fu-title:focus-visible { color: var(--accent); text-decoration: underline; }
.bulk-bar .button { gap: 0.25rem; }
.bulk-count:not(:empty) { margin-left: 0.25rem; }
@media (max-width: 45rem) {
  .home-table tbody tr.fu { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.5rem; padding: 0.625rem 0.75rem; }
  .home-table tr.fu > td, .home-table tr.fu > th { display: block; width: auto; max-width: none; padding: 0; }
  .home-table tr.fu > td::before { content: none; }
  /* min-width: 0 lets the card's title cell shrink below its one-line Prompt/Result,
     which then ends in "…" (a long real Prompt pushed the page to 514px at 390px). */
  .home-table tr.fu > th.cell-title { flex: 1 1 100%; min-width: 0; max-width: 100%; padding-right: 2.25rem; margin: 0; font-size: 1rem; }
  .home-table .fu-prompt { max-width: 100%; }
  .home-table .fu-title { white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }
  .home-table tr.fu > td.cell-select { position: absolute; top: 0.625rem; right: 0.75rem; }
  .home-table tr.fu > td.cell-assignee.is-owner { display: none; }
  .home-table tr.fu > td.cell-actions { margin-left: auto; }
  .home-table .bucket-row { padding: 0; }
  .home-table .bucket-row th { display: block; padding: 0.5rem 0.75rem 0.25rem; }
  .home-table .due-cell { flex-wrap: nowrap; }
  .row-menu-panel { right: 0; }
  .bulk-bar .help { display: none; }
  .bucket-link { min-height: 2rem; padding: 0.0625rem 0.625rem; }
  .fu-row { flex-wrap: wrap; }
  .fu-row .row-actions { margin-left: auto; }
}
@media (max-width: 45rem) { .hide-phone { display: none; } }

/* ---- Header (6.2): one row on wide screens; brand + "Menu" + search on a phone ---------- */
.site-header { position: relative; }
.header-bar { gap: 0.375rem 0.75rem; min-height: 0; padding-block: 0.375rem; justify-content: flex-start; }
.brand { order: 0; color: var(--text); text-decoration: none; white-space: nowrap; }
.brand:hover { color: var(--accent); }
.site-menu { order: 1; }
.site-menu-toggle { display: inline-flex; align-items: center; gap: 0.5rem; min-height: 2.5rem; padding: 0.25rem 0.75rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font-weight: 600; cursor: pointer; list-style: none; }
.site-menu-toggle::-webkit-details-marker { display: none; }
.menu-icon { display: inline-block; width: 1rem; height: 2px; background: currentColor; box-shadow: 0 -5px 0 currentColor, 0 5px 0 currentColor; }
.main-nav { padding-bottom: 0; }
.main-nav ul { gap: 0.125rem 0.25rem; }
.nav-item { min-height: 2.5rem; padding: 0.25rem 0.625rem; }
.header-search { order: 2; flex: 1 1 12rem; max-width: 22rem; }
.account-bar { order: 3; }
.account .signed-in { font-size: 0.875rem; }
@media (max-width: 45rem) {
  .site-menu { margin-left: auto; }
  .site-menu[open] > .site-menu-toggle { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
  .site-menu-body { position: absolute; left: 0; right: 0; top: 3.25rem; z-index: 20; display: grid; gap: 0.5rem; padding: 0.5rem 16px 0.75rem; background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: 0 8px 24px rgb(0 0 0 / 0.12); }
  .main-nav ul { display: grid; grid-template-columns: 1fr 1fr; }
  .account-menu { justify-content: space-between; padding-top: 0.5rem; border-top: 1px solid var(--border); }
  .account-bar, .main-nav-bar { display: none; }
  .header-search { order: 2; flex: 1 1 100%; max-width: none; }
}
.main-nav-bar { order: 1; }
@media (min-width: 45.0625rem) {
  /* The row has its own nav and account (no JavaScript or ::details-content needed). */
  .site-menu { display: none; }
  .header-search { margin-left: auto; }
}

/* ---- Contact and Company pages (6.2): two columns from 1100px ------------------------- */
.detail-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; align-items: start; }
.detail-layout > * { min-width: 0; }
.detail-side, .detail-main { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; min-width: 0; }
.detail-layout .card + .card { margin-top: 0; }
.detail-layout .card { padding: 1rem 1.125rem; }
.detail-head-top { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 0.5rem 1rem; }
.detail-title { min-width: 0; flex: 1 1 20rem; }
.detail-head .record-head { margin-bottom: 0.125rem; }
.detail-head .record-actions { margin: 0; }
.head-line { margin: 0; font-size: 1.0625rem; overflow-wrap: anywhere; }
.key-facts { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; margin: 0.75rem 0 0; }
.key-facts > div { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.5rem; min-width: 0; }
.key-facts dt { color: var(--muted); font-size: 0.875rem; }
.key-facts dd { margin: 0; min-width: 0; }
.detail-head .warning, .detail-head .notice { margin-top: 0.75rem; margin-bottom: 0; }
.last-card { padding-block: 0.625rem; border-left: 4px solid var(--accent); }
.last-card .last-interaction { margin: 0; font-size: 1.0625rem; }
.detail-layout h2 { font-size: 1.125rem; }
.detail-layout .section-head { margin-bottom: 0.25rem; }
.detail-layout .details-list { gap: 0.375rem 1rem; margin: 0.5rem 0; }
.not-recorded { margin: 0.25rem 0 0; }
.inline-list { display: flex; flex-wrap: wrap; gap: 0.125rem 0.75rem; margin: 0; padding: 0; list-style: none; }
.notes-more > summary { cursor: pointer; }
.notes-preview { white-space: pre-wrap; overflow-wrap: anywhere; }
.notes-toggle { color: var(--accent); font-weight: 600; white-space: nowrap; }
.notes-more[open] .notes-preview, .notes-more[open] .notes-toggle { display: none; }
.notes-more[open] > summary::after { content: "Show less"; color: var(--accent); font-weight: 600; }
.notes-more .notes { margin: 0.25rem 0 0; }
.record-info > summary { cursor: pointer; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.75rem; min-height: 2.25rem; }
.summary-heading { display: inline; margin: 0; }
.record-info[open] > summary { margin-bottom: 0.5rem; }
.add-method-panel { margin-top: 0.75rem; }
.add-method-panel > summary { cursor: pointer; display: inline-flex; align-items: center; min-height: 2.25rem; padding: 0.125rem 0.75rem; border: 1px solid var(--border); border-radius: 8px; color: var(--accent); }
.add-method-panel > summary .summary-heading { font-size: 0.9375rem; color: inherit; }
.add-method-panel[open] > summary { margin-bottom: 0.5rem; }
.detail-layout .method-list, .detail-layout .affiliation-list, .detail-layout .people-list { gap: 0.375rem; margin: 0.5rem 0; }
.detail-layout .method, .detail-layout .affiliation { padding: 0.5rem 0.75rem; gap: 0.125rem; }
.detail-layout .method { grid-template-columns: minmax(0, 1fr) auto; column-gap: 0.75rem; align-items: center; }
.detail-layout .method-head { grid-column: 1; }
.detail-layout .method-value { grid-column: 1; font-size: 1rem; }
.detail-layout .method > .muted, .detail-layout .method-edit { grid-column: 1 / -1; }
.detail-layout .method-actions { grid-column: 2; grid-row: 1 / span 2; justify-content: flex-end; }
.detail-layout .method-actions .button-small { min-height: 2rem; padding: 0.125rem 0.5rem; font-size: 0.875rem; }
.affiliation-correct { margin-left: auto; }
.detail-layout .timeline-item { grid-template-columns: minmax(9.5rem, 11rem) minmax(0, 1fr); padding: 0.5rem 0; }
.detail-layout .h3, .detail-layout h3 { margin: 0.75rem 0 0.25rem; font-size: 0.9375rem; }
@media (min-width: 68.75rem) {
  .detail-layout { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
  .detail-head { grid-column: 1 / -1; }
  .detail-main { grid-column: 1; grid-row: 2; }
  .detail-side { grid-column: 2; grid-row: 2; }
}
@media (max-width: 40rem) {
  .detail-layout .method { grid-template-columns: 1fr; }
  .detail-layout .method-actions { grid-column: 1; grid-row: auto; justify-content: flex-start; }
  .detail-layout .timeline-item { grid-template-columns: 1fr; }
}
@media (max-width: 45rem) {
  .fu-row .fu-title { white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }
}

/* Contacts and Companies: calm browsing, with one selected-record preview. */
.records-page, .browse-preview-dialog {
  --accent: #285b75;
  --accent-soft: #eaf2f6;
  --focus: #285b75;
}
@media (prefers-color-scheme: dark) {
  .records-page, .browse-preview-dialog {
    --accent: #91c9e5;
    --accent-soft: #293e4c;
    --focus: #91c9e5;
  }
}
.browse-filter-form { margin-bottom: 1rem; }
.browse-search-line { display: flex; align-items: end; gap: 0.75rem; }
.browse-search-line .field { flex: 1; min-width: 0; }
.browse-search-line .list-loading { align-self: center; }
.browse-filter-panel { margin-top: 0.75rem; }
.records-page .filter-summary { display: inline-flex; gap: 0.5rem; min-height: 2.75rem; padding: 0.375rem 0; font-weight: 500; cursor: pointer; background: transparent; border: 0; }
.records-page .filter-summary::-webkit-details-marker { display: none; }
.records-page .filter-summary::after { content: "\25BE"; color: var(--muted); }
.records-page .browse-filter-panel[open] .filter-summary::after { content: "\25B4"; }
.browse-filter-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); align-items: end; gap: 0.75rem 1rem; padding: 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.browse-filter-fields .actions { grid-column: 1 / -1; }
.browse-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 1rem; }
.browse-sort { flex: 1 1 14rem; }
.browse-sort > summary { min-height: 2.5rem; display: list-item; width: fit-content; padding: 0.375rem 0; color: var(--muted); cursor: pointer; }
.browse-sort-form { display: flex; flex-wrap: wrap; align-items: end; gap: 0.75rem; padding-block: 0.75rem; }
.browse-sort-form .field { flex: 1 1 10rem; }
.browse-layout-choices { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.browse-layout-choices[hidden] { display: none; }
.browse-layout-choices [aria-pressed="true"] { background: var(--accent-soft); color: var(--text); border-color: var(--accent); }
.records-browser { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.browse-list, .record-preview-slot { min-width: 0; }
.records-browser[data-browse-view="table"] { display: block; }
.records-browser[data-browse-view="table"] .record-preview-slot { display: none; }
.browse-table { table-layout: fixed; line-height: 1.5; }
.browse-table thead th { text-transform: none; letter-spacing: 0; font-size: 0.875rem; font-weight: 500; }
.browse-table tbody th, .browse-table td { padding: 1rem; }
.browse-table th:first-child { width: 34%; }
.browse-table th:nth-child(2) { width: 16%; }
.browse-table th:nth-child(3) { width: 22%; }
.browse-table th:nth-child(4) { width: 28%; }
.browse-table .browse-record-link { display: inline-block; color: var(--text); font-size: 1rem; font-weight: 650; text-decoration: none; }
.browse-table .browse-record-link:hover { text-decoration: underline; color: var(--accent); }
.browse-context { display: block; font-size: 0.9375rem; line-height: 1.5; color: var(--muted); font-weight: 400; margin: 0.25rem 0 0; overflow-wrap: anywhere; }
.browse-row-meta { display: none; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 0.375rem 1rem; margin-top: 0.625rem; }
.browse-relationships { color: var(--muted); font-size: 0.875rem; font-weight: 400; }
.browse-secondary { display: block; margin-top: 0.25rem; font-size: 0.875rem; color: var(--muted); font-weight: 400; }
.browse-attention { color: var(--warn); font-size: 0.875rem; font-weight: 600; }
.browse-due { display: block; font-size: 0.875rem; margin-bottom: 0.25rem; }
.records-browser[data-browse-view="browse"] .browse-table thead,
.records-browser[data-browse-view="browse"] .browse-table tbody td { display: none; }
.records-browser[data-browse-view="browse"] .browse-table td::before { content: none; }
.records-browser[data-browse-view="browse"] .browse-table tbody th { width: 100%; }
.records-browser[data-browse-view="browse"] .browse-row-meta { display: flex; }
.records-browser[data-browse-view="browse"] .browse-table [data-selected="true"] { background: var(--accent-soft); }
.records-browser[data-browse-view="browse"] .browse-table [data-selected="true"] th { box-shadow: inset 3px 0 var(--accent); }
.record-preview-slot { position: sticky; top: 1rem; }
.record-preview-slot:has(details[open]) { position: static; }
.record-preview { padding: 1.5rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow-wrap: anywhere; }
.browse-eyebrow { margin: 0 0 0.5rem; color: var(--muted); font-size: 0.8125rem; }
.record-preview h2 { font-size: 1.5rem; line-height: 1.3; }
.browse-preview-section { margin-top: 1.5rem; }
.browse-preview-section h3 { color: var(--muted); font-size: 0.875rem; font-weight: 500; margin: 0 0 0.5rem; }
.browse-preview-section > a { display: inline-block; }
.browse-preview-section p { margin-bottom: 0; }
.browse-preview-overdue { background: var(--warn-soft); border-radius: 7px; padding: 1rem; }
.browse-preview-overdue h3 { color: var(--warn); }
.browse-extra { margin-top: 1.25rem; padding-top: 0.75rem; border-top: 1px solid var(--border); }
.browse-extra summary { min-height: 2.75rem; padding-block: 0.5rem; color: var(--muted); cursor: pointer; }
.browse-extra .facts { margin-top: 0.75rem; }
.browse-preview-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.5rem; }
.browse-preview-status { color: var(--muted); font-size: 0.875rem; margin: 0 0 0.75rem; }
.browse-preview-empty { margin: 0; color: var(--muted); }
.browse-preview-dialog { width: calc(100% - 2rem); max-width: 40rem; max-height: calc(100dvh - 2rem); padding: 1rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); }
.browse-preview-dialog::backdrop { background: #0008; }
.browse-preview-dialog > .record-preview { padding: 0.75rem 0.25rem; border: 0; border-radius: 0; }
.browse-preview-dialog .browse-close { display: block; margin-left: auto; }
@media (max-width: 60rem) {
  .records-browser { display: block; }
  .record-preview-slot { display: none; }
  .browse-layout-choices { width: 100%; }
}
@media (max-width: 45rem) {
  .browse-search-line { flex-wrap: wrap; }
  .browse-search-line .field { flex-basis: calc(100% - 7rem); }
  .browse-search-line .list-loading { display: none; }
  .browse-filter-fields { grid-template-columns: 1fr; }
  .browse-table tbody th, .browse-table td { padding: 0.125rem 0; }
  .browse-table tbody th { width: 100%; }
  .browse-table tr { padding: 1rem; }
  .browse-table td { grid-template-columns: minmax(0, 7.25rem) minmax(0, 1fr); }
  .records-browser[data-browse-view="browse"] .browse-table tr { padding: 0; }
  .records-browser[data-browse-view="browse"] .browse-table tbody th { padding: 1rem; margin: 0; }
  .browse-extra .facts { grid-template-columns: 1fr; gap: 0.125rem; }
  .browse-extra .facts dd { margin-bottom: 0.5rem; }
}
@media (prefers-reduced-motion: reduce) {
  .records-page .list-main.htmx-request .list-results { transition: none; }
}
