:root {
  --ink: #242824;
  --muted: #65706b;
  --paper: #f8f5ee;
  --surface: #fffdf8;
  --line: #ded8ca;
  --navy: #253b45;
  --navy-soft: #e8eef0;
  --sage: #53705d;
  --sage-soft: #e2ece5;
  --gold: #b57f2e;
  --gold-soft: #f6ead2;
  --red: #a44b43;
  --red-soft: #f5e2de;
  --violet: #715d7e;
  --violet-soft: #eee8f2;
  --shadow: 0 18px 50px rgba(42, 45, 38, 0.08);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

body {
  margin: 0;
  min-width: 320px;
}

a {
  color: var(--navy);
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(181, 127, 46, 0.42);
  outline-offset: 2px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
  letter-spacing: -0.025em;
}

h1 {
  font-size: clamp(2.2rem, 5vw, 4.2rem);
  line-height: 1;
  margin-bottom: 0.7rem;
}

h2 {
  font-size: 1.6rem;
  line-height: 1.15;
  margin-bottom: 0.55rem;
}

h3 {
  font-size: 1.25rem;
}

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

.site-header {
  align-items: center;
  background: rgba(248, 245, 238, 0.96);
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 2rem;
  grid-template-columns: minmax(210px, 1fr) auto minmax(90px, 1fr);
  min-height: 76px;
  padding: 0 4vw;
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  align-items: center;
  display: flex;
  gap: 0.8rem;
  text-decoration: none;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.06rem;
}

.brand small {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand-mark {
  align-items: center;
  background: var(--navy);
  border-radius: 10px;
  color: white;
  display: inline-flex;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.8rem;
  height: 38px;
  justify-content: center;
  letter-spacing: 0.08em;
  width: 38px;
}

.brand-mark-large {
  height: 48px;
  margin-bottom: 1.2rem;
  width: 48px;
}

.site-header nav {
  display: flex;
  gap: 0.25rem;
}

.site-header nav a {
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 650;
  padding: 0.55rem 0.9rem;
  text-decoration: none;
}

.site-header nav a:hover,
.site-header nav a.active {
  background: var(--navy-soft);
  color: var(--navy);
}

.site-header > form {
  justify-self: end;
}

.text-button {
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  padding: 0.5rem;
}

.page-shell {
  margin: 0 auto;
  max-width: 1440px;
  padding: 3.5rem 4vw 5rem;
}

.eyebrow {
  color: var(--sage);
  display: block;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  margin-bottom: 0.65rem;
  text-transform: uppercase;
}

.page-heading {
  align-items: end;
  display: flex;
  justify-content: space-between;
  margin-bottom: 2.5rem;
}

.page-heading p {
  color: var(--muted);
  font-size: 1.06rem;
  margin: 0;
  max-width: 720px;
}

.compact-heading {
  align-items: start;
}

.compact-heading h1 {
  font-size: clamp(2.5rem, 5vw, 3.8rem);
}

.sync-card {
  background: var(--navy);
  border-radius: 15px;
  color: white;
  min-width: 190px;
  padding: 1rem 1.2rem;
}

.sync-card span,
.sync-card small,
.sync-card strong {
  display: block;
}

.sync-card span,
.sync-card small {
  color: #cbd6d9;
  font-size: 0.75rem;
}

.sync-card strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.2rem;
  margin: 0.15rem 0;
}

.metric-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(4, 1fr);
  margin-bottom: 1rem;
}

.metric-grid article {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem 1.4rem;
}

.metric-grid span,
.metric-grid small,
.metric-grid strong {
  display: block;
}

.metric-grid span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
}

.metric-grid strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2.25rem;
  font-weight: 500;
  margin: 0.2rem 0;
}

.metric-grid small {
  color: var(--muted);
}

.dashboard-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1.45fr 1fr;
  margin-top: 1rem;
}

.lower-grid {
  grid-template-columns: 1.2fr 1fr;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.6rem;
}

.panel-heading {
  align-items: start;
  display: flex;
  justify-content: space-between;
  margin-bottom: 1.2rem;
}

.panel-heading a {
  font-size: 0.84rem;
  font-weight: 750;
}

.panel-heading .eyebrow {
  margin-bottom: 0.45rem;
}

.panel-heading h2 {
  margin: 0;
}

.coverage-list {
  display: grid;
  gap: 1rem;
}

.coverage-row {
  align-items: center;
  display: grid;
  gap: 1rem;
  grid-template-columns: 155px 1fr 48px;
}

.coverage-row strong,
.coverage-row span {
  display: block;
}

.coverage-row span {
  color: var(--muted);
  font-size: 0.75rem;
}

progress {
  accent-color: var(--sage);
  background: #e8e4da;
  border: 0;
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
  width: 100%;
}

progress::-webkit-progress-bar {
  background: #e8e4da;
  border-radius: 999px;
}

progress::-webkit-progress-value {
  background: var(--sage);
  border-radius: 999px;
}

.panel-note {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.78rem;
  margin: 1.25rem 0 0;
  padding-top: 1rem;
}

.tier-stack {
  display: grid;
  gap: 0.55rem;
}

.tier-row {
  align-items: center;
  border-radius: 11px;
  display: grid;
  gap: 0.7rem;
  grid-template-columns: 70px 45px 1fr;
  padding: 0.7rem 0.8rem;
}

.tier-row span,
.tier-row strong {
  font-weight: 750;
}

.tier-row small {
  color: var(--muted);
}

.tier-1 {
  background: var(--sage-soft);
}

.tier-2 {
  background: var(--navy-soft);
}

.tier-3 {
  background: var(--gold-soft);
}

.tier-4 {
  background: var(--red-soft);
}

.tier-none {
  background: #eeece7;
}

.queue-list,
.task-list,
.relationship-list,
.mini-task-list {
  display: grid;
}

.queue-list a {
  align-items: center;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 0.8rem;
  grid-template-columns: 38px 1fr auto;
  padding: 0.85rem 0;
  text-decoration: none;
}

.queue-list a:first-child {
  border-top: 0;
}

.queue-list strong,
.queue-list small {
  display: block;
}

.queue-list small {
  color: var(--muted);
}

.fact-monogram {
  align-items: center;
  background: var(--gold-soft);
  border-radius: 50%;
  color: #79541d;
  display: flex;
  font-family: Georgia, "Times New Roman", serif;
  height: 36px;
  justify-content: center;
  width: 36px;
}

.task-list > div,
.mini-task-list > div {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 0.45rem 0.65rem;
  grid-template-columns: auto 1fr;
  padding: 0.85rem 0;
}

.task-list > div:first-child,
.mini-task-list > div:first-child {
  border-top: 0;
}

.task-list small {
  color: var(--muted);
  grid-column: 2;
}

.priority,
.status-label {
  align-self: start;
  border-radius: 999px;
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 0.25rem 0.45rem;
  text-transform: uppercase;
}

.priority-high {
  background: var(--red-soft);
  color: var(--red);
}

.priority-medium {
  background: var(--gold-soft);
  color: #79541d;
}

.priority-low {
  background: var(--navy-soft);
  color: var(--navy);
}

.privacy-note {
  align-items: center;
  background: #efebe2;
  border-radius: 12px;
  color: var(--muted);
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
  padding: 0.8rem 1.1rem;
}

.privacy-note strong {
  color: var(--ink);
  font-size: 0.82rem;
}

.filter-bar {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  display: flex;
  gap: 0.7rem;
  margin-bottom: 1rem;
  padding: 0.8rem;
}

.filter-bar .search-field {
  flex: 1;
}

input,
select,
textarea {
  background: white;
  border: 1px solid #cfc8ba;
  border-radius: 9px;
  color: var(--ink);
  padding: 0.68rem 0.75rem;
  width: 100%;
}

textarea {
  resize: vertical;
}

label {
  color: var(--muted);
  display: grid;
  font-size: 0.8rem;
  font-weight: 700;
  gap: 0.35rem;
}

.primary-button,
.secondary-button {
  align-items: center;
  border: 0;
  border-radius: 9px;
  cursor: pointer;
  display: inline-flex;
  font-weight: 750;
  justify-content: center;
  min-height: 42px;
  padding: 0.65rem 1rem;
  text-decoration: none;
}

.primary-button {
  background: var(--navy);
  color: white;
}

.secondary-button {
  background: var(--navy-soft);
  color: var(--navy);
}

.filter-count {
  color: var(--muted);
  font-size: 0.8rem;
  margin-left: auto;
  padding: 0 0.5rem;
}

.table-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.people-table {
  align-items: center;
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(260px, 1.3fr) 120px minmax(190px, 0.8fr) minmax(160px, 0.8fr);
}

.table-header {
  background: #efebe2;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 0.75rem 1.2rem;
  text-transform: uppercase;
}

.table-row {
  border-top: 1px solid var(--line);
  color: var(--ink);
  min-height: 78px;
  padding: 0.75rem 1.2rem;
  text-decoration: none;
}

.table-row:hover {
  background: #fbf8f1;
}

.table-row > span {
  color: var(--muted);
  font-size: 0.84rem;
}

.table-row progress {
  display: block;
  margin-top: 0.45rem;
  width: 150px;
}

.person-cell {
  align-items: center;
  display: flex;
  gap: 0.85rem;
}

.person-cell strong,
.person-cell small {
  display: block;
}

.person-cell strong {
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1rem;
}

.avatar {
  align-items: center;
  background: var(--navy-soft);
  border-radius: 50%;
  color: var(--navy);
  display: flex;
  flex: 0 0 auto;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.05rem;
  height: 42px;
  justify-content: center;
  width: 42px;
}

.avatar-large {
  font-size: 2rem;
  height: 84px;
  width: 84px;
}

.living-label {
  color: var(--sage);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.evidence-pill {
  align-items: center;
  border-radius: 999px;
  display: inline-flex;
  font-size: 0.7rem;
  font-weight: 800;
  gap: 0.4rem;
  padding: 0.32rem 0.55rem;
  white-space: nowrap;
}

.evidence-pill > span {
  border-radius: 50%;
  height: 7px;
  width: 7px;
}

.evidence-strong {
  background: var(--sage-soft);
  color: #355440;
}

.evidence-strong > span {
  background: var(--sage);
}

.evidence-developing {
  background: var(--navy-soft);
  color: var(--navy);
}

.evidence-developing > span {
  background: var(--navy);
}

.evidence-weak {
  background: var(--gold-soft);
  color: #79541d;
}

.evidence-weak > span {
  background: var(--gold);
}

.evidence-unclassified,
.evidence-none {
  background: var(--red-soft);
  color: var(--red);
}

.evidence-unclassified > span,
.evidence-none > span {
  background: var(--red);
}

.pagination {
  align-items: center;
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 1.5rem;
}

.pagination a {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
  font-weight: 700;
  padding: 0.55rem 0.8rem;
  text-decoration: none;
}

.pagination span {
  color: var(--muted);
  font-size: 0.85rem;
}

.back-link {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  text-decoration: none;
}

.person-hero {
  align-items: center;
  display: flex;
  gap: 1.25rem;
  margin-bottom: 2.5rem;
}

.person-hero h1 {
  font-size: clamp(2.4rem, 5vw, 4rem);
  margin-bottom: 0.5rem;
}

.person-hero p {
  color: var(--muted);
  margin: 0;
}

.person-layout {
  align-items: start;
  display: grid;
  gap: 1.25rem;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
}

.section-heading {
  align-items: end;
  display: flex;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.section-heading h2,
.section-heading .eyebrow {
  margin-bottom: 0;
}

.section-heading > span {
  color: var(--muted);
  font-size: 0.8rem;
}

.fact-timeline {
  display: grid;
  gap: 0.8rem;
}

.fact-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left-width: 5px;
  border-radius: 14px;
  padding: 1.25rem;
}

.evidence-border-strong {
  border-left-color: var(--sage);
}

.evidence-border-developing {
  border-left-color: var(--navy);
}

.evidence-border-weak {
  border-left-color: var(--gold);
}

.evidence-border-unclassified,
.evidence-border-none {
  border-left-color: var(--red);
}

.fact-card-heading {
  align-items: start;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
}

.fact-card-heading h3 {
  margin: 0.15rem 0;
}

.fact-card-heading p {
  color: var(--muted);
  margin: 0;
}

.fact-type {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.fact-score {
  text-align: right;
}

.fact-score small {
  color: var(--muted);
  display: block;
  margin-top: 0.35rem;
}

.fact-detail {
  margin: 1rem 0 0;
}

details > summary {
  color: var(--navy);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 750;
}

.citation-details,
.review-box {
  border-top: 1px solid var(--line);
  margin-top: 1rem;
  padding-top: 0.8rem;
}

.citation-list {
  display: grid;
  gap: 0.6rem;
  margin-top: 0.7rem;
}

.citation-list > div {
  background: #f6f2e9;
  border-radius: 9px;
  display: grid;
  gap: 0.35rem;
  grid-template-columns: auto 1fr;
  padding: 0.75rem;
}

.citation-list small,
.citation-list details {
  color: var(--muted);
  grid-column: 2;
}

.citation-list details p {
  color: var(--ink);
  margin: 0.5rem 0 0;
  white-space: pre-wrap;
}

.tier-badge {
  align-self: start;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 800;
  padding: 0.28rem 0.5rem;
  white-space: nowrap;
}

.no-citation {
  background: var(--red-soft);
  border-radius: 8px;
  color: var(--red);
  font-size: 0.78rem;
  margin-top: 1rem;
  padding: 0.65rem 0.75rem;
}

.review-box form,
.source-review-form {
  display: grid;
  gap: 0.7rem;
  margin-top: 0.8rem;
}

.review-box form {
  grid-template-columns: 180px 1fr auto;
}

.person-sidebar {
  display: grid;
  gap: 1rem;
  position: sticky;
  top: 95px;
}

.relationship-list a {
  border-top: 1px solid var(--line);
  display: grid;
  padding: 0.65rem 0;
  text-decoration: none;
}

.relationship-list a:first-child {
  border-top: 0;
}

.relationship-list span,
.relationship-list small {
  color: var(--muted);
  font-size: 0.72rem;
}

.relationship-list strong {
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
}

.stack-form {
  display: grid;
  gap: 0.8rem;
}

.mini-task-list {
  border-top: 1px solid var(--line);
  margin-top: 1rem;
  padding-top: 0.4rem;
}

.source-list {
  display: grid;
  gap: 0.65rem;
}

.source-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 1rem 1.15rem;
}

.source-summary {
  align-items: start;
  display: grid;
  gap: 1rem;
  grid-template-columns: 78px 1fr 90px;
}

.source-summary h2 {
  font-family: inherit;
  font-size: 1rem;
  font-weight: 750;
  letter-spacing: 0;
  margin: 0 0 0.2rem;
}

.source-summary p {
  color: var(--muted);
  font-size: 0.8rem;
  margin: 0;
}

.source-usage {
  text-align: right;
}

.source-usage strong,
.source-usage span {
  display: block;
}

.source-usage strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.25rem;
}

.source-usage span {
  color: var(--muted);
  font-size: 0.7rem;
}

.source-card > details {
  border-top: 1px solid var(--line);
  margin-top: 0.8rem;
  padding-top: 0.65rem;
}

.source-review-form {
  grid-template-columns: minmax(230px, 0.7fr) 1fr auto;
}

.tab-bar {
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.tab-bar a {
  border-bottom: 3px solid transparent;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 750;
  padding: 0.7rem 0.8rem;
  text-decoration: none;
}

.tab-bar a.active {
  border-bottom-color: var(--sage);
  color: var(--ink);
}

.task-board {
  display: grid;
  gap: 0.8rem;
  grid-template-columns: repeat(3, 1fr);
}

.task-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  min-height: 230px;
  padding: 1.2rem;
}

.task-card > div {
  display: flex;
  gap: 0.45rem;
}

.task-card h2 {
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 750;
  letter-spacing: 0;
  margin: 1rem 0 0.45rem;
}

.task-card > a {
  font-weight: 700;
}

.task-card > span,
.task-card > small,
.task-card > p {
  color: var(--muted);
  font-size: 0.8rem;
}

.task-card > p {
  margin: 0.9rem 0;
}

.task-card form {
  display: flex;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 1rem;
}

.status-open {
  background: var(--red-soft);
  color: var(--red);
}

.status-in_progress {
  background: var(--gold-soft);
  color: #79541d;
}

.status-done {
  background: var(--sage-soft);
  color: var(--sage);
}

.empty-state {
  color: var(--muted);
  margin: 0;
}

.empty-state strong {
  color: var(--ink);
}

.empty-state.roomy {
  padding: 3rem;
  text-align: center;
}

.flash-stack {
  left: 50%;
  max-width: 520px;
  position: fixed;
  top: 90px;
  transform: translateX(-50%);
  width: calc(100% - 2rem);
  z-index: 20;
}

.flash {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  margin-bottom: 0.5rem;
  padding: 0.75rem 1rem;
}

.flash-error {
  border-color: var(--red);
  color: var(--red);
}

.flash-success {
  border-color: var(--sage);
  color: var(--sage);
}

.login-page {
  background:
    radial-gradient(circle at 15% 15%, rgba(181, 127, 46, 0.13), transparent 28rem),
    linear-gradient(120deg, var(--paper) 0%, #edf1ec 100%);
  min-height: 100vh;
}

.login-shell {
  align-items: center;
  display: flex;
  min-height: 100vh;
  padding: 5vw;
}

.login-panel {
  align-items: center;
  display: grid;
  gap: clamp(3rem, 8vw, 8rem);
  grid-template-columns: minmax(0, 1.15fr) minmax(340px, 440px);
  margin: 0 auto;
  max-width: 1180px;
  width: 100%;
}

.login-intro h1 {
  font-size: clamp(3rem, 6vw, 5.8rem);
  max-width: 780px;
}

.login-intro > p {
  color: var(--muted);
  font-size: 1.13rem;
  max-width: 650px;
}

.evidence-key {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 2rem;
}

.evidence-key span {
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 750;
  padding: 0.4rem 0.65rem;
}

.key-strong {
  background: var(--sage-soft);
}

.key-developing {
  background: var(--navy-soft);
}

.key-weak {
  background: var(--gold-soft);
}

.key-none {
  background: var(--red-soft);
}

.login-card {
  background: rgba(255, 253, 248, 0.94);
  border: 1px solid rgba(222, 216, 202, 0.8);
  border-radius: 24px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 1rem;
  padding: 2.2rem;
}

.login-card h2 {
  font-size: 2rem;
  margin-bottom: 0.4rem;
}

.login-card p,
.login-card small {
  color: var(--muted);
}

.login-card small {
  text-align: center;
}

.error-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin: 8vh auto;
  max-width: 620px;
  padding: 3rem;
  text-align: center;
}

.tree-page {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
}

.tree-page .site-header {
  flex: 0 0 auto;
  position: relative;
}

.tree-shell {
  flex: 1 1 auto;
  min-height: 0;
}

.atlas {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.atlas-toolbar {
  align-items: center;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: grid;
  flex: 0 0 auto;
  gap: 1rem;
  grid-template-columns: minmax(245px, 1fr) minmax(250px, 440px) minmax(300px, 1fr);
  padding: 0.75rem 4vw;
  position: relative;
  z-index: 8;
}

.atlas-heading {
  align-items: center;
  display: flex;
  gap: 0.85rem;
}

.atlas-heading .eyebrow {
  border-right: 1px solid var(--line);
  margin: 0;
  padding-right: 0.85rem;
}

.atlas-heading h1 {
  font-size: 1.45rem;
  line-height: 1;
  margin: 0 0 0.2rem;
}

.atlas-heading div > span {
  color: var(--muted);
  display: block;
  font-size: 0.72rem;
}

.atlas-search {
  position: relative;
}

.atlas-search input {
  background: #f7f4ed;
  border-color: var(--line);
  border-radius: 999px;
  min-height: 42px;
  padding-left: 1rem;
}

.atlas-search-results {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  left: 0;
  max-height: min(420px, 60vh);
  overflow: auto;
  padding: 0.35rem;
  position: absolute;
  right: 0;
  top: calc(100% + 0.45rem);
}

.atlas-search-results button {
  background: transparent;
  border: 0;
  border-radius: 9px;
  color: var(--ink);
  cursor: pointer;
  display: block;
  padding: 0.65rem 0.75rem;
  text-align: left;
  width: 100%;
}

.atlas-search-results button:hover,
.atlas-search-results button:focus-visible {
  background: var(--navy-soft);
}

.atlas-search-results strong,
.atlas-search-results small {
  display: block;
}

.atlas-search-results small,
.atlas-search-empty {
  color: var(--muted);
  font-size: 0.73rem;
}

.atlas-search-results em {
  color: var(--sage);
  float: right;
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 800;
  margin-top: -1.05rem;
  text-transform: uppercase;
}

.atlas-search-empty {
  display: block;
  padding: 0.8rem;
}

.atlas-actions {
  align-items: center;
  display: flex;
  gap: 0.45rem;
  justify-content: flex-end;
}

.atlas-button {
  background: var(--navy-soft);
  border: 0;
  border-radius: 9px;
  color: var(--navy);
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 750;
  min-height: 38px;
  padding: 0.5rem 0.72rem;
}

.atlas-button:disabled {
  cursor: default;
  opacity: 0.45;
}

.atlas-icon-button {
  font-size: 1.1rem;
  min-width: 38px;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

.atlas-toggle {
  align-items: center;
  background: #f2efe8;
  border-radius: 9px;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  font-size: 0.74rem;
  gap: 0.45rem;
  min-height: 38px;
  padding: 0.5rem 0.72rem;
}

.atlas-toggle input {
  accent-color: var(--sage);
  height: 15px;
  padding: 0;
  width: 15px;
}

.atlas-stage {
  background-color: #f3efe6;
  background-image:
    linear-gradient(rgba(83, 112, 93, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(83, 112, 93, 0.045) 1px, transparent 1px);
  background-size: 28px 28px;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

#family-atlas {
  height: 100%;
  opacity: 0;
  position: relative;
  transition: opacity 220ms ease;
  width: 100%;
}

#family-atlas.atlas-ready {
  opacity: 1;
}

.atlas-loading {
  align-items: center;
  background: rgba(243, 239, 230, 0.94);
  display: flex;
  flex-direction: column;
  inset: 0;
  justify-content: center;
  position: absolute;
  z-index: 6;
}

.atlas-loading[hidden] {
  display: none;
}

.atlas-loading strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.35rem;
  font-weight: 500;
  margin: 0.9rem 0 0.2rem;
}

.atlas-loading small {
  color: var(--muted);
}

.atlas-loading-error {
  color: var(--red);
}

.atlas-spinner {
  animation: atlas-spin 850ms linear infinite;
  border: 3px solid rgba(83, 112, 93, 0.2);
  border-radius: 50%;
  border-top-color: var(--sage);
  height: 34px;
  width: 34px;
}

@keyframes atlas-spin {
  to {
    transform: rotate(360deg);
  }
}

.atlas-level,
.atlas-legend {
  backdrop-filter: blur(8px);
  background: rgba(255, 253, 248, 0.9);
  border: 1px solid rgba(222, 216, 202, 0.88);
  border-radius: 12px;
  bottom: 1rem;
  box-shadow: 0 8px 24px rgba(42, 45, 38, 0.08);
  padding: 0.65rem 0.8rem;
  position: absolute;
  z-index: 5;
}

.atlas-branch-label {
  backdrop-filter: blur(8px);
  background: rgba(255, 253, 248, 0.88);
  border: 1px solid rgba(222, 216, 202, 0.88);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(42, 45, 38, 0.06);
  padding: 0.55rem 0.75rem;
  position: absolute;
  top: 1rem;
  z-index: 5;
}

.atlas-branch-label strong,
.atlas-branch-label small {
  display: block;
}

.atlas-branch-label strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.92rem;
  font-weight: 500;
}

.atlas-branch-label small {
  color: var(--muted);
  font-size: 0.66rem;
}

.atlas-branch-paternal {
  border-left: 4px solid var(--sage);
  left: 1rem;
}

.atlas-branch-maternal {
  border-right: 4px solid var(--violet);
  right: 1rem;
  text-align: right;
}

.atlas-level {
  left: 1rem;
}

.atlas-level span,
.atlas-level small {
  display: block;
}

.atlas-level span {
  font-size: 0.75rem;
  font-weight: 800;
}

.atlas-level small {
  color: var(--muted);
  font-size: 0.68rem;
}

.atlas-legend {
  display: grid;
  gap: 0.35rem 0.7rem;
  grid-template-columns: repeat(3, auto);
  right: 1rem;
}

.atlas-legend strong,
.atlas-legend small {
  grid-column: 1 / -1;
}

.atlas-legend strong {
  font-size: 0.72rem;
}

.atlas-legend span,
.atlas-legend small {
  color: var(--muted);
  font-size: 0.66rem;
}

.atlas-legend i {
  border-radius: 50%;
  display: inline-block;
  height: 8px;
  margin-right: 0.2rem;
  width: 8px;
}

.legend-strong {
  background: var(--sage);
}

.legend-developing {
  background: #3f697a;
}

.legend-weak {
  background: var(--gold);
}

.atlas-detail {
  background: rgba(255, 253, 248, 0.97);
  border: 1px solid var(--line);
  border-radius: 17px;
  box-shadow: var(--shadow);
  max-height: calc(100% - 2rem);
  overflow: auto;
  padding: 1.35rem;
  position: absolute;
  right: 1rem;
  top: 1rem;
  width: min(330px, calc(100% - 2rem));
  z-index: 7;
}

.atlas-detail[hidden] {
  display: none;
}

.atlas-detail .eyebrow {
  margin-bottom: 0.4rem;
}

.atlas-detail h2 {
  font-size: 1.5rem;
  margin-bottom: 0.2rem;
  padding-right: 1.5rem;
}

.atlas-detail-years {
  color: var(--muted);
  margin-bottom: 1rem;
}

.atlas-detail-close {
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.45rem;
  line-height: 1;
  padding: 0.3rem;
  position: absolute;
  right: 0.75rem;
  top: 0.6rem;
}

.atlas-evidence-summary {
  background: #f2efe8;
  border-radius: 11px;
  margin-bottom: 1rem;
  padding: 0.85rem;
}

.atlas-evidence-summary div:first-child {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.atlas-evidence-summary span,
.atlas-evidence-summary small {
  color: var(--muted);
  font-size: 0.7rem;
}

.atlas-evidence-summary strong {
  font-size: 0.74rem;
}

.atlas-score-track {
  background: #dcd6c9;
  border-radius: 999px;
  height: 6px;
  margin: 0.65rem 0;
  overflow: hidden;
}

.atlas-score-track span {
  background: var(--sage);
  display: block;
  height: 100%;
  transition: width 200ms ease;
}

.atlas-detail-note {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.55;
}

.atlas-detail .primary-button {
  width: 100%;
}

.atlas-detail-actions {
  display: grid;
  gap: 0.55rem;
}

.atlas-detail-actions .secondary-button {
  width: 100%;
}

.atlas-error {
  background: var(--red-soft);
  border-radius: 10px;
  color: var(--red);
  left: 50%;
  padding: 1rem;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
}

@media (max-width: 1000px) {
  .site-header {
    gap: 0.7rem;
    grid-template-columns: 1fr auto;
    padding: 0.65rem 3vw;
  }

  .site-header nav {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: center;
    order: 3;
    overflow-x: auto;
  }

  .site-header > form {
    grid-column: 2;
    grid-row: 1;
  }

  .metric-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .dashboard-grid,
  .lower-grid,
  .person-layout {
    grid-template-columns: 1fr;
  }

  .person-sidebar {
    position: static;
  }

  .people-table {
    grid-template-columns: minmax(230px, 1.3fr) 100px minmax(170px, 0.8fr);
  }

  .people-table > span:last-child {
    display: none;
  }

  .task-board {
    grid-template-columns: repeat(2, 1fr);
  }

  .atlas-toolbar {
    grid-template-columns: minmax(180px, 1fr) minmax(220px, 1fr);
    padding: 0.7rem 3vw;
  }

  .atlas-actions {
    grid-column: 1 / -1;
    justify-content: center;
  }
}

@media (max-width: 700px) {
  .page-shell {
    padding: 2.5rem 1rem 4rem;
  }

  .brand small,
  .site-header .text-button {
    display: none;
  }

  .site-header nav {
    justify-content: start;
  }

  .site-header nav a {
    white-space: nowrap;
  }

  .page-heading {
    align-items: start;
    flex-direction: column;
    gap: 1.2rem;
  }

  .sync-card {
    width: 100%;
  }

  .metric-grid {
    grid-template-columns: 1fr 1fr;
  }

  .metric-grid article {
    padding: 1rem;
  }

  .metric-grid strong {
    font-size: 1.8rem;
  }

  .coverage-row {
    grid-template-columns: 1fr 45px;
  }

  .coverage-row progress {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .tier-row {
    grid-template-columns: 65px 35px 1fr;
  }

  .queue-list a {
    grid-template-columns: 36px 1fr;
  }

  .queue-list .evidence-pill {
    display: none;
  }

  .filter-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .filter-count {
    margin-left: 0;
  }

  .table-header {
    display: none;
  }

  .people-table {
    grid-template-columns: 1fr auto;
  }

  .table-row > span:nth-child(2),
  .table-row > span:nth-child(4) {
    display: none;
  }

  .table-row progress {
    width: 90px;
  }

  .person-hero {
    align-items: start;
  }

  .avatar-large {
    height: 62px;
    width: 62px;
  }

  .fact-card-heading {
    flex-direction: column;
  }

  .fact-score {
    text-align: left;
  }

  .review-box form,
  .source-review-form,
  .source-summary {
    grid-template-columns: 1fr;
  }

  .source-usage {
    text-align: left;
  }

  .task-board {
    grid-template-columns: 1fr;
  }

  .login-shell {
    padding: 1rem;
  }

  .login-panel {
    gap: 2rem;
    grid-template-columns: 1fr;
  }

  .login-intro h1 {
    font-size: 3rem;
  }

  .privacy-note {
    align-items: start;
    flex-direction: column;
  }

  .tree-page {
    height: 100dvh;
  }

  .tree-page .site-header {
    display: none;
  }

  .atlas-toolbar {
    align-items: stretch;
    gap: 0.65rem;
    grid-template-columns: 1fr;
    padding: 0.7rem;
  }

  .atlas-heading {
    justify-content: space-between;
  }

  .atlas-heading .eyebrow {
    border: 0;
    padding: 0;
  }

  .atlas-heading h1 {
    font-size: 1.25rem;
  }

  .atlas-search {
    grid-row: 2;
  }

  .atlas-actions {
    grid-column: 1;
    grid-row: 3;
    justify-content: space-between;
  }

  .atlas-toggle {
    margin-left: auto;
  }

  .atlas-legend {
    display: none;
  }

  .atlas-level {
    bottom: 0.6rem;
    left: 0.6rem;
  }

  .atlas-branch-label {
    padding: 0.42rem 0.55rem;
    top: 0.6rem;
  }

  .atlas-branch-paternal {
    left: 0.6rem;
  }

  .atlas-branch-maternal {
    right: 0.6rem;
  }

  .atlas-branch-label strong {
    font-size: 0.78rem;
  }

  .atlas-branch-label small {
    display: none;
  }

  .atlas-detail {
    bottom: 0.6rem;
    left: 0.6rem;
    max-height: min(320px, calc(100% - 1.2rem));
    right: 0.6rem;
    top: auto;
    width: auto;
  }
}
