:root {
  --navy-950: #081d31;
  --navy-900: #0b2946;
  --navy-800: #0f3558;
  --navy-700: #174a72;
  --sky-500: #6fa8c4;
  --sky-300: #a9cada;
  --sky-100: #e9f3f7;
  --ink: #183044;
  --muted: #627789;
  --line: #d8e3e9;
  --paper: #ffffff;
  --canvas: #f4f7f9;
  --success: #24735a;
  --warning: #a86916;
  --danger: #a13f48;
  --shadow: 0 16px 40px rgba(8, 29, 49, 0.10);
  --radius: 18px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--canvas); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.eyebrow { margin: 0 0 6px; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--sky-500); }

.auth-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(360px, 0.8fr);
  background:
    radial-gradient(circle at 15% 20%, rgba(111, 168, 196, 0.26), transparent 34%),
    linear-gradient(135deg, var(--navy-950), var(--navy-800) 58%, #346b8b);
}
.auth-brand { display: flex; align-items: center; gap: 42px; padding: clamp(40px, 8vw, 110px); color: white; }
.auth-logo { width: min(36vw, 430px); max-height: 62vh; object-fit: contain; filter: drop-shadow(0 30px 50px rgba(0,0,0,.2)); }
.auth-brand h1 { margin: 0; font-size: clamp(3rem, 8vw, 7rem); letter-spacing: -0.06em; line-height: .95; }
.auth-tagline { max-width: 540px; font-size: clamp(1rem, 1.6vw, 1.3rem); line-height: 1.6; color: #dceaf1; }
.auth-card { align-self: center; margin: 32px 7vw 32px 0; padding: 34px; background: rgba(255,255,255,.98); border-radius: 26px; box-shadow: 0 30px 90px rgba(0,0,0,.28); }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 26px; padding: 5px; border-radius: 12px; background: var(--sky-100); }
.auth-tab { border: 0; border-radius: 9px; padding: 11px; background: transparent; color: var(--muted); font-weight: 800; }
.auth-tab.active { background: white; color: var(--navy-800); box-shadow: 0 2px 8px rgba(8,29,49,.08); }
.auth-note { margin: 22px 0 0; font-size: .83rem; color: var(--muted); line-height: 1.45; }

.stack-form { display: grid; gap: 18px; }
label { display: grid; gap: 7px; font-size: .86rem; font-weight: 750; color: var(--ink); }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  background: white;
  color: var(--ink);
  outline: none;
  transition: border-color .16s, box-shadow .16s;
}
input:focus, textarea:focus, select:focus { border-color: var(--sky-500); box-shadow: 0 0 0 3px rgba(111,168,196,.16); }
textarea { min-height: 110px; resize: vertical; }
.form-error { min-height: 1.2em; margin: 0; color: var(--danger); font-size: .85rem; }
.primary-button, .secondary-button, .text-button, .icon-button, .menu-button {
  border: 0;
  border-radius: 10px;
  font-weight: 800;
}
.primary-button { padding: 11px 16px; background: var(--navy-800); color: white; box-shadow: 0 7px 18px rgba(15,53,88,.18); }
.primary-button:hover { background: var(--navy-700); }
.secondary-button { padding: 10px 15px; background: var(--sky-100); color: var(--navy-800); }
.secondary-button:hover { background: #dcecf3; }
.text-button { padding: 8px 0; background: transparent; color: var(--sky-300); }
.icon-button { width: 38px; height: 38px; background: var(--sky-100); color: var(--navy-800); font-size: 1.4rem; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 260px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 24px 18px; background: linear-gradient(180deg, var(--navy-950), var(--navy-800)); color: white; }
.brand-lockup { display: flex; align-items: center; gap: 12px; padding: 0 8px 24px; border-bottom: 1px solid rgba(255,255,255,.1); }
.brand-logo { width: 48px; height: 48px; object-fit: contain; }
.brand-lockup strong { display: block; font-size: 1.15rem; }
.brand-lockup span { display: block; margin-top: 3px; color: var(--sky-300); font-size: .76rem; }
.main-nav { display: grid; gap: 7px; margin-top: 24px; }
.nav-item { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; border-radius: 11px; padding: 12px 14px; background: transparent; color: #d5e6ee; text-align: left; font-weight: 750; }
.nav-item span { width: 20px; color: var(--sky-300); text-align: center; }
.nav-item:hover, .nav-item.active { background: rgba(255,255,255,.11); color: white; }
.sidebar-footer { margin-top: auto; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.1); }
.profile-button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 0; border: 0; background: transparent; color: white; text-align: left; }
.avatar { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--sky-500); color: var(--navy-950); font-weight: 900; }
.profile-copy { min-width: 0; }
.profile-copy strong, .profile-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-copy small { margin-top: 3px; color: var(--sky-300); }
.workspace { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 18px; min-height: 88px; padding: 18px clamp(22px, 4vw, 54px); background: rgba(244,247,249,.92); border-bottom: 1px solid rgba(216,227,233,.85); backdrop-filter: blur(16px); }
.topbar h2 { margin: 0; font-size: 1.55rem; }
.topbar-actions { margin-left: auto; }
.menu-button { display: none; width: 42px; height: 42px; background: white; color: var(--navy-800); box-shadow: 0 4px 14px rgba(8,29,49,.08); }
.page-content { padding: 28px clamp(22px, 4vw, 54px) 64px; }

.hero { display: flex; justify-content: space-between; gap: 24px; align-items: end; margin-bottom: 24px; padding: 28px; border-radius: var(--radius); background: linear-gradient(135deg, var(--navy-800), #3b7898); color: white; box-shadow: var(--shadow); overflow: hidden; }
.hero h3 { margin: 0 0 8px; font-size: clamp(1.55rem, 3vw, 2.4rem); letter-spacing: -.025em; }
.hero p { max-width: 650px; margin: 0; color: #dcebf1; line-height: 1.55; }
.hero .primary-button { background: white; color: var(--navy-800); box-shadow: none; white-space: nowrap; }

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card, .panel, .record-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(8,29,49,.045); }
.stat-card { padding: 20px; }
.stat-card span { display: block; color: var(--muted); font-size: .8rem; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; }
.stat-card strong { display: block; margin-top: 8px; font-size: 2rem; color: var(--navy-800); }
.panel-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(300px, .75fr); gap: 20px; }
.panel { padding: 22px; }
.panel-header { display: flex; justify-content: space-between; align-items: start; gap: 16px; margin-bottom: 18px; }
.panel-header h3 { margin: 0; font-size: 1.05rem; }
.panel-header p { margin: 5px 0 0; color: var(--muted); font-size: .88rem; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 18px; }
.toolbar .search { flex: 1 1 260px; }
.toolbar select { width: auto; min-width: 150px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: white; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 13px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: #f7fafb; color: var(--muted); font-size: .74rem; letter-spacing: .06em; text-transform: uppercase; }
td { font-size: .9rem; }
tr:last-child td { border-bottom: 0; }
.row-title { font-weight: 800; color: var(--navy-800); }
.row-subtitle { display: block; margin-top: 3px; color: var(--muted); font-size: .8rem; }
.row-actions { display: flex; gap: 6px; }
.small-button { border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; background: white; color: var(--navy-800); font-size: .78rem; font-weight: 800; }
.small-button:hover { background: var(--sky-100); }
.small-button.danger { color: var(--danger); }

.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 5px 9px; background: var(--sky-100); color: var(--navy-700); font-size: .74rem; font-weight: 850; }
.badge.success { background: #e6f4ef; color: var(--success); }
.badge.warning { background: #fff2dd; color: var(--warning); }
.badge.muted { background: #edf1f4; color: var(--muted); }
.tag-list { display: flex; flex-wrap: wrap; gap: 5px; }

.card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.record-card { padding: 20px; }
.record-card h3 { margin: 10px 0 6px; color: var(--navy-800); }
.record-card p { color: var(--muted); line-height: 1.5; }
.record-meta { display: flex; justify-content: space-between; gap: 12px; margin-top: 18px; padding-top: 15px; border-top: 1px solid var(--line); color: var(--muted); font-size: .8rem; }
.progress-track { height: 10px; border-radius: 999px; background: var(--sky-100); overflow: hidden; }
.progress-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--sky-500), var(--navy-700)); }
.empty-state { padding: 44px 24px; text-align: center; border: 1px dashed #bfcfd8; border-radius: var(--radius); background: rgba(255,255,255,.55); }
.empty-state h3 { margin: 0 0 7px; color: var(--navy-800); }
.empty-state p { max-width: 560px; margin: 0 auto 18px; color: var(--muted); line-height: 1.55; }
.task-list { display: grid; gap: 10px; }
.task-row { display: grid; grid-template-columns: auto 1fr auto; gap: 11px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 11px; }
.task-row input { width: 18px; height: 18px; }
.task-row.done .task-title { text-decoration: line-through; color: var(--muted); }
.task-title { font-weight: 750; }
.task-meta { display: block; margin-top: 4px; color: var(--muted); font-size: .78rem; }
.due-overdue { color: var(--danger); font-weight: 800; }

.entity-dialog { width: min(760px, calc(100vw - 30px)); max-height: calc(100vh - 30px); padding: 0; border: 0; border-radius: 20px; box-shadow: 0 30px 90px rgba(8,29,49,.32); }
.entity-dialog::backdrop { background: rgba(8,29,49,.62); backdrop-filter: blur(4px); }
.dialog-frame { display: flex; flex-direction: column; max-height: calc(100vh - 30px); }
.dialog-header, .dialog-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 24px; }
.dialog-header { border-bottom: 1px solid var(--line); }
.dialog-header h3 { margin: 0; }
.dialog-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; padding: 22px 24px; overflow: auto; }
.dialog-fields .full { grid-column: 1 / -1; }
.dialog-footer { border-top: 1px solid var(--line); justify-content: flex-end; }
#dialog-error { padding: 0 24px; }
.toast { position: fixed; z-index: 100; right: 22px; bottom: 22px; max-width: 360px; transform: translateY(20px); opacity: 0; pointer-events: none; padding: 13px 16px; border-radius: 11px; background: var(--navy-950); color: white; box-shadow: var(--shadow); transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 1100px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .auth-brand { gap: 24px; padding: 50px; }
  .auth-logo { width: 250px; }
}
@media (max-width: 820px) {
  .auth-screen { grid-template-columns: 1fr; }
  .auth-brand { justify-content: center; text-align: center; padding: 34px 22px 10px; }
  .auth-logo { width: 150px; }
  .auth-card { margin: 22px; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 30; left: 0; width: 260px; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .sidebar.open { transform: translateX(0); }
  .menu-button { display: inline-grid; place-items: center; }
  .panel-grid { grid-template-columns: 1fr; }
  .card-grid { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .auth-brand { display: block; }
  .auth-brand h1 { font-size: 3rem; }
  .hero { display: block; }
  .hero .primary-button { margin-top: 18px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .dialog-fields { grid-template-columns: 1fr; }
  .dialog-fields .full { grid-column: auto; }
  .topbar { padding-inline: 16px; }
  .page-content { padding-inline: 16px; }
}

/* PrideLink access and administration */
.auth-heading { margin-bottom: 24px; }
.auth-heading h2 { margin: 0 0 8px; color: var(--navy-800); font-size: 1.7rem; }
.auth-heading p:last-child { margin: 0; color: var(--muted); line-height: 1.5; }
.auth-card .text-button { color: var(--navy-700); text-align: center; }
input[readonly] { background: #f2f6f8; color: var(--muted); }
button:disabled { cursor: wait; opacity: .65; }

.setup-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 24px;
  padding: 22px 24px;
  border: 1px solid #dfc38d;
  border-radius: var(--radius);
  background: #fff8ea;
  box-shadow: 0 8px 24px rgba(8,29,49,.045);
}
.setup-banner h3 { margin: 0 0 6px; color: var(--navy-800); }
.setup-banner p:last-child { margin: 0; color: var(--muted); line-height: 1.5; }
.setup-banner .primary-button { flex: 0 0 auto; }

.admin-panels { grid-template-columns: minmax(360px, .9fr) minmax(0, 1.1fr); margin-bottom: 20px; }
.admin-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.admin-form label:nth-child(3), .admin-form button { grid-column: 1 / -1; }
.invite-result { display: grid; gap: 10px; margin-top: 18px; padding: 16px; border: 1px solid var(--sky-300); border-radius: 12px; background: var(--sky-100); }
.invite-result strong, .invite-result span { display: block; }
.invite-result span { margin-top: 3px; color: var(--muted); font-size: .82rem; }
.inline-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.admin-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 13px; border: 1px solid var(--line); border-radius: 11px; }
.admin-row strong, .admin-row span, .admin-row small { display: block; }
.admin-row span { margin-top: 3px; color: var(--muted); font-size: .82rem; }
.admin-row small { margin-top: 4px; color: var(--muted); }
.empty-state.compact { padding: 26px 20px; }
.empty-state.compact p { margin-bottom: 0; }

@media (max-width: 980px) {
  .admin-panels { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .setup-banner, .admin-row { align-items: stretch; flex-direction: column; }
  .admin-form { grid-template-columns: 1fr; }
  .admin-form label:nth-child(3), .admin-form button { grid-column: auto; }
}

/* PrideLink relationship links and contact groups */
.row-title-button,
.task-title-button {
  display: inline;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--navy-800);
  font-weight: 800;
  text-align: left;
}
.row-title-button:hover,
.task-title-button:hover { text-decoration: underline; }

.row-tags { margin-top: 8px; }
.button-badge { border: 0; cursor: pointer; }
.button-badge:hover { box-shadow: inset 0 0 0 1px rgba(15,53,88,.2); }

.filter-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  padding: 12px 15px;
  border: 1px solid var(--sky-300);
  border-radius: 12px;
  background: var(--sky-100);
  color: var(--navy-800);
}

.task-row { grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; }
.task-main { min-width: 0; }
.task-end {
  display: grid;
  justify-items: end;
  gap: 8px;
  color: var(--muted);
  font-size: .8rem;
  white-space: nowrap;
}
.task-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.relation-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 9px;
  background: white;
  color: var(--navy-700);
  font-size: .73rem;
  font-weight: 800;
  line-height: 1.2;
  text-decoration: none;
}
button.relation-chip { cursor: pointer; }
.relation-chip:hover { background: var(--sky-100); border-color: var(--sky-300); }
.group-chip { background: #eef5ed; }
.campaign-chip { background: #f3eef9; }
.link-chip { background: #fff7e8; }
.task-row.done .task-links { opacity: .62; }

.field-help {
  display: block;
  margin-top: -2px;
  color: var(--muted);
  font-size: .76rem;
  font-weight: 500;
  line-height: 1.4;
}
select[multiple] { min-height: 120px; }
.link-builder { display: grid; gap: 10px; }
.field-label { display: block; font-size: .86rem; font-weight: 750; color: var(--ink); }
.external-link-rows { display: grid; gap: 10px; }
.external-link-row {
  display: grid;
  grid-template-columns: minmax(150px, .75fr) minmax(220px, 1.25fr) auto;
  align-items: end;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f9fbfc;
}
.remove-link-button { width: 42px; height: 42px; color: var(--danger); }
.add-link-button { justify-self: start; }

.contact-detail { display: grid; gap: 20px; }
.contact-detail-heading {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
}
.contact-detail-heading h4 { margin: 0; color: var(--navy-800); font-size: 1.2rem; }
.contact-detail-heading p { margin: 4px 0 0; color: var(--muted); }
.large-avatar { width: 48px; height: 48px; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.detail-item {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #f9fbfc;
}
.detail-item span,
.detail-label {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.detail-item strong { display: block; overflow-wrap: anywhere; color: var(--ink); font-size: .9rem; }
.detail-section { padding-top: 16px; border-top: 1px solid var(--line); }
.detail-section p { margin: 0; color: var(--ink); line-height: 1.55; }

@media (max-width: 700px) {
  .external-link-row { grid-template-columns: 1fr; }
  .remove-link-button { width: 100%; }
  .contact-detail-heading { grid-template-columns: auto 1fr; }
  .contact-detail-heading .secondary-button { grid-column: 1 / -1; }
  .detail-grid { grid-template-columns: 1fr; }
  .task-row { grid-template-columns: auto minmax(0, 1fr); }
  .task-end { grid-column: 2; justify-items: start; grid-auto-flow: column; align-items: center; }
  .filter-banner { align-items: flex-start; }
}
.task-row.done .task-title-button { text-decoration: line-through; color: var(--muted); }
.relation-chip { flex: 0 1 auto; white-space: normal; overflow-wrap: anywhere; text-align: left; }

/* Revision 5: task sharing, contact import, and donation records */
.hero-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; }
.hero .hero-actions .secondary-button { background: rgba(255,255,255,.16); color: white; border: 1px solid rgba(255,255,255,.35); white-space: nowrap; }
.hero .hero-actions .secondary-button:hover { background: rgba(255,255,255,.24); }
.teammate-chip { background: #edf4f8; }

.detail-section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.detail-section-heading p { margin: 4px 0 0; color: var(--muted); }
.donation-section { display: grid; gap: 14px; }
.donation-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.donation-summary > div { padding: 13px; border: 1px solid var(--line); border-radius: 11px; background: var(--sky-100); }
.donation-summary span { display: block; color: var(--muted); font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.donation-summary strong { display: block; margin-top: 5px; color: var(--navy-800); font-size: 1.05rem; }
.donation-list { display: grid; gap: 8px; }
.donation-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: #f9fbfc; }
.donation-row strong, .donation-row span, .donation-row small { display: block; }
.donation-row span { margin-top: 3px; color: var(--muted); font-size: .8rem; }
.donation-row small { margin-top: 5px; color: var(--muted); }
.donation-overview-row { align-items: center; }

.import-panel { display: grid; gap: 16px; }
.import-panel > p { margin: 0; color: var(--muted); line-height: 1.55; }
.import-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 12px; }
.file-picker input { margin-top: 2px; padding: 9px; }
.checkbox-label { display: flex; align-items: flex-start; gap: 9px; font-weight: 600; line-height: 1.45; }
.checkbox-label input { width: auto; margin-top: 3px; flex: 0 0 auto; }
.import-preview { min-height: 130px; border: 1px solid var(--line); border-radius: 13px; overflow: hidden; background: #f9fbfc; }
.import-summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 15px; border-bottom: 1px solid var(--line); background: var(--sky-100); }
.import-summary strong, .import-summary span { display: block; }
.import-summary span { color: var(--muted); font-size: .8rem; text-align: right; }
.import-table { margin: 0; border: 0; border-radius: 0; box-shadow: none; }
.import-preview .empty-state { border: 0; background: transparent; }

@media (max-width: 720px) {
  .hero-actions { width: 100%; justify-content: stretch; }
  .hero-actions button { flex: 1 1 auto; }
  .donation-summary { grid-template-columns: 1fr; }
  .donation-row, .detail-section-heading, .import-summary { align-items: stretch; flex-direction: column; }
  .import-summary span { text-align: left; }
  .import-actions { grid-template-columns: 1fr; }
}

/* Revision 6: Apollo research and enrichment */
.entity-dialog:has(.apollo-search-panel),
.entity-dialog:has(.apollo-enrichment-panel) { width: min(980px, calc(100vw - 30px)); }
.apollo-search-panel,
.apollo-enrichment-panel { display: grid; gap: 18px; }
.apollo-notice {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid #bed8e7;
  border-radius: 12px;
  background: var(--sky-100);
}
.apollo-notice strong { color: var(--navy-800); }
.apollo-notice span { color: var(--muted); line-height: 1.5; }
.apollo-notice.credit-note { border-color: #e5d7a6; background: #fffaf0; }
.apollo-search-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.apollo-search-grid .full { grid-column: 1 / -1; }
.apollo-search-actions { align-items: center; }
.apollo-results {
  min-height: 150px;
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #f9fbfc;
}
.apollo-result-list { display: grid; }
.apollo-result-row {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 13px 15px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.apollo-result-row:last-child { border-bottom: 0; }
.apollo-result-row:hover { background: var(--sky-100); }
.apollo-result-row > input { width: auto; }
.apollo-result-main { display: grid; gap: 3px; min-width: 0; }
.apollo-result-main strong { color: var(--navy-800); }
.apollo-result-main span,
.apollo-result-main small { overflow-wrap: anywhere; color: var(--muted); }
.apollo-import-settings { display: grid; gap: 10px; padding-top: 4px; }
.apollo-import-settings h4 { margin: 0; color: var(--navy-800); }
.compact-fields { padding: 0; overflow: visible; }
.apollo-comparison-list { display: grid; gap: 8px; }
.apollo-comparison-row {
  display: grid;
  grid-template-columns: auto minmax(180px, .8fr) minmax(220px, 1.2fr);
  align-items: center;
  gap: 13px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #f9fbfc;
}
.apollo-comparison-row > input { width: auto; }
.apollo-comparison-row span { display: grid; gap: 3px; }
.apollo-comparison-row small { color: var(--muted); overflow-wrap: anywhere; }
.apollo-comparison-row.same { opacity: .65; }
.apollo-new-value { color: var(--navy-800); font-weight: 700; overflow-wrap: anywhere; }
.apollo-section { display: grid; gap: 12px; }
.apollo-meta-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.apollo-meta-grid > div {
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f9fbfc;
}
.apollo-meta-grid span { display: block; color: var(--muted); font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.apollo-meta-grid strong { display: block; margin-top: 4px; overflow-wrap: anywhere; }
.apollo-facts { display: flex; flex-wrap: wrap; gap: 8px; }
.apollo-facts span { padding: 7px 10px; border-radius: 999px; background: var(--sky-100); color: var(--navy-800); font-size: .8rem; font-weight: 700; }
.apollo-description { color: var(--muted) !important; }
.integration-panel { margin-bottom: 20px; }
.integration-status { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #f9fbfc; }
.integration-status > div { display: grid; gap: 3px; }
.integration-status span { color: var(--muted); }
.integration-dot { width: 12px; height: 12px; flex: 0 0 auto; border-radius: 50%; background: #9aa9b4; }
.integration-status.connected .integration-dot { background: #2a8a64; box-shadow: 0 0 0 4px rgba(42,138,100,.12); }
.integration-status.error .integration-dot { background: #b94b4b; box-shadow: 0 0 0 4px rgba(185,75,75,.12); }
.error-state h3 { color: #9d3535; }

@media (max-width: 720px) {
  .apollo-search-grid,
  .apollo-meta-grid { grid-template-columns: 1fr; }
  .apollo-search-grid .full { grid-column: auto; }
  .apollo-result-row { grid-template-columns: auto auto minmax(0, 1fr); }
  .apollo-result-row .badge { grid-column: 2 / -1; justify-self: start; }
  .apollo-comparison-row { grid-template-columns: auto minmax(0, 1fr); }
  .apollo-new-value { grid-column: 2; }
}

/* Revision 7: list-aware Apollo contact import */
.apollo-selection-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 14px;
  border: 1px solid #bed8e7;
  border-radius: 11px;
  background: var(--sky-100);
}
.apollo-selection-summary strong { color: var(--navy-800); }
.apollo-selection-summary span { color: var(--muted); font-size: .82rem; text-align: right; }
.apollo-page-tools {
  display: flex;
  justify-content: flex-end;
  gap: 14px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  background: white;
  position: sticky;
  top: 0;
  z-index: 1;
}
.apollo-result-row { cursor: default; }
.apollo-result-decision {
  display: grid;
  justify-items: end;
  gap: 7px;
  min-width: 185px;
}
.apollo-result-decision select { min-width: 185px; padding: 8px 30px 8px 9px; font-size: .78rem; }
.apollo-context { color: var(--navy-700) !important; font-weight: 650; }
.apollo-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.apollo-pagination span { color: var(--muted); font-size: .82rem; text-align: center; }
.apollo-search-grid label > .field-help { margin-top: 5px; }

@media (max-width: 720px) {
  .apollo-selection-summary,
  .apollo-pagination { align-items: stretch; flex-direction: column; }
  .apollo-selection-summary span,
  .apollo-pagination span { text-align: left; }
  .apollo-result-row { grid-template-columns: auto auto minmax(0, 1fr); align-items: start; }
  .apollo-result-decision { grid-column: 2 / -1; justify-items: stretch; width: 100%; min-width: 0; }
  .apollo-result-decision select { width: 100%; min-width: 0; }
  .apollo-page-tools { justify-content: flex-start; }
}


/* Revision 7: polished contact profile and reliable donation workflow */
.entity-dialog:has(.contact-profile) {
  width: min(1060px, calc(100vw - 30px));
}
.contact-profile {
  display: grid;
  gap: 18px;
}
.contact-profile-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  padding: 22px;
  border-radius: 16px;
  background:
    radial-gradient(circle at 85% 15%, rgba(169, 202, 218, .28), transparent 34%),
    linear-gradient(135deg, var(--navy-900), var(--navy-700));
  color: white;
}
.contact-profile-identity {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}
.contact-profile-avatar {
  width: 64px;
  height: 64px;
  flex: 0 0 64px;
  background: white;
  color: var(--navy-800);
  font-size: 1.15rem;
  box-shadow: 0 8px 22px rgba(0,0,0,.18);
}
.contact-name-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.contact-name-line h4 {
  margin: 0;
  color: white;
  font-size: 1.65rem;
  letter-spacing: -.025em;
}
.contact-profile-identity p {
  margin: 5px 0 0;
  color: #d9e9f0;
}
.contact-profile-hero .badge {
  border: 1px solid rgba(255,255,255,.24);
  background: rgba(255,255,255,.14);
  color: white;
}
.contact-profile-hero > .primary-button {
  flex: 0 0 auto;
  background: white;
  color: var(--navy-800);
  box-shadow: none;
}
.contact-identity-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 14px;
  margin-top: 10px;
  color: #c5dce7;
  font-size: .78rem;
  font-weight: 700;
}
.contact-identity-meta span {
  position: relative;
}
.contact-identity-meta span + span::before {
  content: "•";
  margin-right: 14px;
  color: var(--sky-300);
}
.contact-profile-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(330px, .85fr);
  align-items: start;
  gap: 16px;
}
.contact-profile-main,
.contact-profile-side {
  display: grid;
  gap: 16px;
}
.profile-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: white;
  box-shadow: 0 5px 16px rgba(8,29,49,.035);
}
.profile-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}
.profile-card-header h5 {
  margin: 4px 0 0;
  color: var(--navy-800);
  font-size: 1rem;
}
.profile-kicker {
  display: block;
  color: var(--muted);
  font-size: .68rem;
  font-weight: 850;
  letter-spacing: .075em;
  text-transform: uppercase;
}
.compact-button {
  padding: 9px 12px;
  font-size: .8rem;
}
.profile-data-list {
  display: grid;
}
.profile-data-row {
  display: grid;
  grid-template-columns: 145px minmax(0, 1fr);
  gap: 14px;
  padding: 11px 0;
  border-top: 1px solid var(--line);
}
.profile-data-row:first-child {
  padding-top: 0;
  border-top: 0;
}
.profile-data-row:last-child {
  padding-bottom: 0;
}
.profile-data-row > span {
  color: var(--muted);
  font-size: .78rem;
  font-weight: 750;
}
.profile-data-row strong {
  min-width: 0;
  color: var(--ink);
  font-size: .88rem;
  overflow-wrap: anywhere;
}
.profile-data-row a {
  color: var(--navy-700);
  text-decoration: none;
}
.profile-data-row a:hover {
  text-decoration: underline;
}
.missing-value,
.muted-copy {
  color: var(--muted);
  font-weight: 500;
}
.relationship-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}
.relationship-facts > div {
  padding: 12px;
  border-radius: 11px;
  background: #f7fafb;
}
.relationship-facts span {
  display: block;
  color: var(--muted);
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .045em;
  text-transform: uppercase;
}
.relationship-facts strong {
  display: block;
  margin-top: 5px;
  color: var(--navy-800);
  font-size: .88rem;
}
.relationship-tags {
  display: grid;
  gap: 14px;
  margin-top: 16px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
}
.relationship-tags .tag-list {
  margin-top: 8px;
}
.removable-relation {
  display: inline-flex;
  align-items: stretch;
  overflow: hidden;
  border: 1px solid rgba(15, 53, 88, .12);
  border-radius: 999px;
}
.removable-relation.group-relation { background: #eef5ed; }
.removable-relation.campaign-relation { background: #f3eef9; }
.removable-relation .button-badge {
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.removable-relation .button-badge:hover { background: rgba(255, 255, 255, .45); }
.relation-remove-button {
  display: grid;
  place-items: center;
  width: 28px;
  min-width: 28px;
  padding: 0;
  border: 0;
  border-left: 1px solid rgba(15, 53, 88, .12);
  background: transparent;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
}
.relation-remove-button:hover,
.relation-remove-button:focus-visible {
  background: #fff0f0;
  color: var(--danger);
  outline: none;
}
.relationship-tags .muted-copy {
  margin: 7px 0 0;
  font-size: .84rem;
}
.note-card p {
  margin: 0;
  color: var(--ink);
  line-height: 1.6;
}
.giving-card {
  overflow: hidden;
}
.giving-total {
  margin: 0 -18px;
  padding: 18px;
  background: linear-gradient(135deg, var(--sky-100), #f6fbfd);
  border-block: 1px solid var(--line);
}
.giving-total span,
.giving-mini-stats span {
  display: block;
  color: var(--muted);
  font-size: .68rem;
  font-weight: 850;
  letter-spacing: .065em;
  text-transform: uppercase;
}
.giving-total > strong {
  display: block;
  margin-top: 5px;
  color: var(--navy-800);
  font-size: 2rem;
  letter-spacing: -.04em;
}
.giving-total small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}
.giving-mini-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 14px;
}
.giving-mini-stats > div {
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
}
.giving-mini-stats strong {
  display: block;
  margin-top: 4px;
  color: var(--navy-800);
  font-size: .9rem;
}
.profile-donation-list {
  display: grid;
  gap: 8px;
  max-height: 310px;
  margin-top: 14px;
  overflow: auto;
}
.profile-donation-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fafcfd;
}
.profile-donation-row strong,
.profile-donation-row span,
.profile-donation-row small {
  display: block;
}
.profile-donation-row > div > strong {
  color: var(--navy-800);
}
.profile-donation-row span {
  margin-top: 3px;
  color: var(--muted);
  font-size: .75rem;
  line-height: 1.4;
}
.profile-donation-row small {
  margin-top: 5px;
  color: var(--ink);
  line-height: 1.4;
}
.donation-row-actions {
  display: flex;
  gap: 5px;
}
.giving-empty {
  margin-top: 14px;
  padding: 18px;
  border: 1px dashed #bfd0d9;
  border-radius: 11px;
  text-align: center;
  background: #fafcfd;
}
.giving-empty p {
  margin: 0;
  color: var(--muted);
}
.research-card {
  display: grid;
  gap: 12px;
}
.research-card .profile-card-header {
  margin-bottom: 0;
}
.research-empty {
  display: grid;
  justify-items: start;
  gap: 8px;
  padding: 14px;
  border-radius: 11px;
  background: #f7fafb;
}
.research-empty p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}
.research-linked {
  display: grid;
  gap: 12px;
}
.research-status-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.research-status-line small {
  color: var(--muted);
}
.research-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.research-details > div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fafcfd;
}
.research-details span {
  display: block;
  color: var(--muted);
  font-size: .65rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .055em;
}
.research-details strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: .8rem;
}
.research-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.research-actions .secondary-button {
  padding-inline: 10px;
  font-size: .78rem;
}
.research-actions .secondary-button:only-child {
  grid-column: 1 / -1;
}

@media (max-width: 900px) {
  .contact-profile-layout {
    grid-template-columns: 1fr;
  }
  .contact-profile-side {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 700px) {
  .contact-profile-hero {
    align-items: stretch;
    flex-direction: column;
  }
  .contact-profile-hero > .primary-button {
    width: 100%;
  }
  .contact-profile-identity {
    align-items: flex-start;
  }
  .contact-profile-avatar {
    width: 52px;
    height: 52px;
    flex-basis: 52px;
  }
  .contact-name-line h4 {
    font-size: 1.3rem;
  }
  .contact-identity-meta {
    display: grid;
    gap: 4px;
  }
  .contact-identity-meta span + span::before {
    content: none;
  }
  .contact-profile-side {
    grid-template-columns: 1fr;
  }
  .relationship-facts,
  .giving-mini-stats,
  .research-details,
  .research-actions {
    grid-template-columns: 1fr;
  }
  .profile-data-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .profile-donation-row {
    grid-template-columns: 1fr;
  }
  .donation-row-actions {
    justify-content: flex-start;
  }
}

/* Revision 8: deeper projects, campaigns, stewardship, and compact contacts */
.project-chip { background: #eaf2fb; }
.success-button { color: #1e6b4d; background: #e7f4ed; }
.success-button:hover { background: #d8ecdf; }
.danger-text { color: var(--danger); }
.contact-profile-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.donation-thank-you-line { display: flex !important; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 7px !important; }
.donation-thank-you-line .badge { display: inline-flex; }

.compact-contact-table tbody tr { cursor: pointer; }
.compact-contact-table tbody tr:hover { background: #f3f8fa; }
.compact-contact-table td:last-child { width: 1%; white-space: nowrap; }
.compact-contact-table .muted-copy { font-size: .8rem; }

.entity-card-grid { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.entity-summary-card { display: grid; gap: 14px; }
.entity-summary-card h3,
.entity-summary-card p { margin: 0; }
.entity-summary-card p { color: var(--muted); line-height: 1.55; }
.entity-card-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.entity-card-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.entity-card-stats > div { padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: #f8fbfc; }
.entity-card-stats span { display: block; color: var(--muted); font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .045em; }
.entity-card-stats strong { display: block; margin-top: 4px; color: var(--navy-800); font-size: 1.08rem; }
.entity-card-actions { margin-top: auto; }
.campaign-card-progress { display: grid; gap: 8px; }
.campaign-card-progress > div:first-child { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.campaign-card-progress span { color: var(--muted); font-size: .78rem; text-align: right; }

.entity-dialog:has(.entity-workspace),
.entity-dialog:has(.thank-you-letter-editor) { width: min(1120px, calc(100vw - 30px)); }
.entity-workspace { display: grid; gap: 18px; }
.entity-workspace-hero { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; padding: 24px; border-radius: 16px; background: linear-gradient(135deg, var(--navy-800), #3b7898); color: white; }
.entity-workspace-hero h4 { margin: 10px 0 7px; font-size: 1.75rem; }
.entity-workspace-hero p { max-width: 720px; margin: 0; color: #dbeaf1; line-height: 1.55; }
.entity-workspace-badges { display: flex; flex-wrap: wrap; gap: 8px; }
.entity-workspace-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.entity-workspace-hero .secondary-button { border: 1px solid rgba(255,255,255,.32); background: rgba(255,255,255,.15); color: white; }
.entity-workspace-hero .primary-button { background: white; color: var(--navy-800); }
.entity-overview-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 9px; }
.entity-overview-grid > div { min-width: 0; padding: 13px; border: 1px solid var(--line); border-radius: 11px; background: #f8fbfc; }
.entity-overview-grid span { display: block; color: var(--muted); font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.entity-overview-grid strong { display: block; margin-top: 5px; overflow-wrap: anywhere; color: var(--navy-800); font-size: .9rem; }
.entity-workspace-columns { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(300px, .75fr); gap: 16px; align-items: start; }
.entity-section { padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: white; }
.entity-section > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.entity-section h5 { margin: 3px 0 0; color: var(--navy-800); font-size: 1.05rem; }
.entity-task-list,
.milestone-list { display: grid; gap: 8px; }
.entity-task-row,
.milestone-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; gap: 10px; padding: 11px; border: 1px solid var(--line); border-radius: 10px; background: #fafcfd; }
.entity-task-row.done,
.milestone-row.done { opacity: .72; background: #f4f7f7; }
.entity-task-row.done .entity-task-copy strong,
.milestone-row.done > div strong { text-decoration: line-through; }
.entity-task-copy strong,
.entity-task-copy span,
.entity-task-copy small,
.milestone-row strong,
.milestone-row span,
.milestone-row small { display: block; }
.entity-task-copy strong,
.milestone-row strong { color: var(--navy-800); }
.entity-task-copy span,
.milestone-row span { margin-top: 3px; color: var(--muted); font-size: .76rem; }
.entity-task-copy small,
.milestone-row small { margin-top: 5px; color: var(--ink); line-height: 1.4; }
.task-state-button { display: grid; place-items: center; width: 27px; height: 27px; border: 1px solid #b9cbd4; border-radius: 50%; background: white; color: var(--navy-800); font-weight: 900; }
.task-state-button.complete { border-color: #89b9a3; background: #e7f4ed; color: #1e6b4d; }
.team-work-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.team-work-card { padding: 13px; border: 1px solid var(--line); border-radius: 11px; background: #fafcfd; }
.team-work-heading { display: flex; align-items: center; gap: 9px; }
.team-work-heading .avatar { width: 34px; height: 34px; }
.team-work-heading strong,
.team-work-heading span { display: block; }
.team-work-heading span { margin-top: 2px; color: var(--muted); font-size: .72rem; }
.team-work-card ul { margin: 10px 0 0; padding-left: 19px; color: var(--ink); font-size: .8rem; line-height: 1.5; }
.team-work-card p { margin: 10px 0 0; color: var(--muted); font-size: .8rem; }
.entity-contact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; }
.entity-contact-grid button { display: flex; align-items: center; gap: 9px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: #fafcfd; text-align: left; }
.entity-contact-grid button:hover { background: var(--sky-100); }
.entity-contact-grid .avatar { width: 34px; height: 34px; flex: 0 0 34px; }
.entity-contact-grid strong,
.entity-contact-grid small { display: block; }
.entity-contact-grid small { margin-top: 2px; color: var(--muted); }
.fundraising-workspace-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.fundraising-workspace-summary > div { padding: 10px; border-radius: 10px; background: #f8fbfc; }
.fundraising-workspace-summary span,
.fundraising-workspace-summary strong { display: block; }
.fundraising-workspace-summary span { color: var(--muted); font-size: .7rem; font-weight: 800; text-transform: uppercase; }
.fundraising-workspace-summary strong { margin-top: 4px; color: var(--navy-800); }
.fundraising-workspace-summary .full { grid-column: 1 / -1; }
.fundraising-workspace-summary small { display: block; margin-top: 6px; color: var(--muted); }

.thank-you-layout { display: grid; grid-template-columns: minmax(340px, .82fr) minmax(0, 1.18fr); gap: 18px; align-items: start; }
.template-form { display: grid; gap: 14px; }
.template-body { min-height: 260px; }
.template-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.thank-you-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; margin-bottom: 14px; }
.thank-you-stats button { padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: #f8fbfc; text-align: left; }
.thank-you-stats button.active { border-color: var(--sky-500); background: var(--sky-100); box-shadow: inset 0 0 0 1px var(--sky-300); }
.thank-you-stats span,
.thank-you-stats strong { display: block; }
.thank-you-stats span { color: var(--muted); font-size: .68rem; font-weight: 800; text-transform: uppercase; }
.thank-you-stats strong { margin-top: 3px; color: var(--navy-800); font-size: 1.15rem; }
.thank-you-queue-panel,
.thank-you-list,
.thank-you-row { min-width: 0; }
.thank-you-list { display: grid; gap: 8px; }
.thank-you-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "donor amount"
    "status status"
    "actions actions";
  align-items: start;
  gap: 9px 14px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fafcfd;
}
.thank-you-donor { grid-area: donor; min-width: 0; }
.thank-you-donor .row-title-button { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thank-you-amount { grid-area: amount; align-self: center; color: var(--navy-800); white-space: nowrap; }
.thank-you-status-copy { grid-area: status; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; min-width: 0; }
.thank-you-row .row-actions { grid-area: actions; display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 7px; min-width: 0; }
.thank-you-donor span { display: block; margin-top: 3px; color: var(--muted); font-size: .74rem; overflow-wrap: anywhere; }
.thank-you-status-copy span { display: inline; margin: 0; color: var(--muted); font-size: .74rem; overflow-wrap: anywhere; }
.thank-you-status-copy .badge { display: inline-flex; margin: 0; flex: 0 0 auto; }
.thank-you-letter-editor { display: grid; gap: 14px; }
.letter-editor-meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.letter-editor-meta > div { padding: 11px; border: 1px solid var(--line); border-radius: 10px; background: #f8fbfc; }
.letter-editor-meta span,
.letter-editor-meta strong { display: block; }
.letter-editor-meta span { color: var(--muted); font-size: .68rem; font-weight: 800; text-transform: uppercase; }
.letter-editor-meta strong { margin-top: 4px; overflow-wrap: anywhere; }
.letter-textarea { min-height: 390px; font-family: Georgia, serif; font-size: 1rem; line-height: 1.65; }
.letter-editor-actions { display: flex; flex-wrap: wrap; gap: 8px; }

@media (max-width: 1050px) {
  .entity-overview-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .thank-you-layout { grid-template-columns: 1fr; }
}
@media (max-width: 800px) {
  .entity-workspace-hero { flex-direction: column; }
  .entity-workspace-actions { width: 100%; }
  .entity-workspace-actions button { flex: 1; }
  .entity-workspace-columns { grid-template-columns: 1fr; }
  .letter-editor-meta { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .contact-profile-actions { width: 100%; }
  .contact-profile-actions button { flex: 1; }
  .entity-card-stats,
  .entity-overview-grid,
  .fundraising-workspace-summary,
  .thank-you-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .entity-task-row,
  .milestone-row { grid-template-columns: auto minmax(0, 1fr); }
  .entity-task-row .row-actions,
  .milestone-row .row-actions { grid-column: 2; justify-content: flex-start; }
}

/* Revision 8.2 — professional thank-you letterhead and print preview */
.optional-label { color: var(--muted); font-size: .72rem; font-weight: 650; }
.template-section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; padding-top: 2px; }
.template-section-heading span { color: var(--navy-800); font-weight: 850; }
.template-section-heading small { color: var(--muted); font-size: .72rem; line-height: 1.4; text-align: right; }
.thank-you-template-preview-wrap { display: grid; gap: 10px; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.thank-you-template-preview { overflow: auto; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: #e8eef2; }
.thank-you-paper {
  width: min(100%, 680px);
  min-height: 880px;
  margin: 0 auto;
  padding: 44px 52px 34px;
  display: flex;
  flex-direction: column;
  background: white;
  color: var(--ink);
  box-shadow: 0 12px 32px rgba(8, 29, 49, .14);
}
.thank-you-paper.sample { min-height: 820px; }
.thank-you-letterhead { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.thank-you-brand-lockup { display: flex; align-items: center; gap: 16px; min-width: 0; }
.thank-you-brand-lockup img { width: 76px; height: 76px; flex: 0 0 auto; object-fit: contain; }
.thank-you-org-name { max-width: 310px; color: var(--navy-800); font-size: 1.25rem; font-weight: 900; line-height: 1.08; letter-spacing: -.02em; }
.thank-you-org-tagline { margin-top: 6px; color: var(--muted); font-size: .62rem; font-weight: 850; letter-spacing: .075em; line-height: 1.35; text-transform: uppercase; }
.thank-you-letterhead-contact { max-width: 210px; color: var(--muted); font-size: .61rem; line-height: 1.5; text-align: right; overflow-wrap: anywhere; }
.thank-you-contact-item { white-space: nowrap; }
.thank-you-letterhead-rule {
  display: block;
  width: 100%;
  height: 5px;
  margin: 16px 0 30px;
  overflow: visible;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
.thank-you-letter-content { flex: 1; font-family: Georgia, "Times New Roman", serif; font-size: .86rem; line-height: 1.62; }
.thank-you-letter-date { margin-bottom: 20px; }
.thank-you-recipient { margin-bottom: 25px; font-family: Inter, ui-sans-serif, system-ui, sans-serif; font-size: .73rem; line-height: 1.45; }
.thank-you-letter-copy { line-height: 1.68; }
.thank-you-letter-footer { margin-top: 34px; padding-top: 11px; border-top: 1px solid var(--line); color: var(--muted); font-size: .56rem; line-height: 1.5; text-align: center; }
.thank-you-footer-note { font-style: italic; }
.thank-you-footer-ein { margin-top: 5px; font-weight: 700; letter-spacing: .02em; }
.thank-you-editor-grid { display: grid; grid-template-columns: minmax(310px, .72fr) minmax(480px, 1.28fr); gap: 18px; align-items: start; }
.thank-you-editor-fields { display: grid; gap: 13px; position: sticky; top: 0; }
.thank-you-letter-preview-pane { min-width: 0; display: grid; gap: 9px; }
.thank-you-letter-preview-pane .thank-you-template-preview { max-height: 690px; }
.thank-you-letter-preview-pane .thank-you-paper { width: 610px; min-height: 790px; padding: 39px 46px 31px; }
.thank-you-letter-preview-pane .thank-you-brand-lockup img { width: 68px; height: 68px; }
.thank-you-letter-preview-pane .thank-you-org-name { font-size: 1.12rem; }
.thank-you-letter-preview-pane .thank-you-letter-content { font-size: .78rem; }

@media (max-width: 900px) {
  .thank-you-editor-grid { grid-template-columns: 1fr; }
  .thank-you-editor-fields { position: static; }
  .thank-you-letter-preview-pane .thank-you-paper { width: min(100%, 610px); }
}
@media (max-width: 620px) {
  .template-section-heading { display: grid; gap: 3px; }
  .template-section-heading small { text-align: left; }
  .thank-you-template-preview { padding: 8px; }
  .thank-you-paper,
  .thank-you-letter-preview-pane .thank-you-paper { min-height: 720px; padding: 28px 25px 24px; }
  .thank-you-letterhead { align-items: flex-start; }
  .thank-you-brand-lockup img { width: 52px; height: 52px; }
  .thank-you-org-name { font-size: .9rem; }
  .thank-you-letterhead-contact { display: none; }
  .thank-you-letter-content { font-size: .76rem; }
}

.thank-you-layout { grid-template-columns: minmax(520px, 1.25fr) minmax(340px, .75fr); }
@media (max-width: 1050px) {
  .thank-you-layout { grid-template-columns: 1fr; }
}

/* Revision 8.4 — handwritten-signature spacing and signer hierarchy */
.thank-you-signature-block {
  margin-top: 24px;
  line-height: 1.35;
}
.thank-you-signature-closing { margin-bottom: 0; }
.thank-you-signature-space { height: 52px; }
.thank-you-signature-name {
  color: var(--navy-900, #0b2945);
  font-weight: 800;
}
.thank-you-signature-title {
  margin-top: 2px;
  color: var(--muted);
  font-size: .78em;
  line-height: 1.3;
}
.thank-you-letter-preview-pane .thank-you-signature-space { height: 42px; }

@media (max-width: 700px) {
  .thank-you-signature-space { height: 38px; }
}

/* Revision 9 — approval workflow and batch print packet */
.thank-you-stats { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.hero .hero-actions button:disabled {
  cursor: not-allowed;
  opacity: .58;
}
@media (max-width: 760px) {
  .thank-you-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .thank-you-stats button:last-child { grid-column: 1 / -1; }
}
