:root {
  --ink: #193237;
  --muted: #607175;
  --brand: #183e43;
  --accent: #b8783d;
  --paper: #f6f7f5;
  --line: #dce3df;
  --light: #eaf1ee;
  --warn: #946024;
  --danger: #a23535;
  font-family:
    Inter,
    Segoe UI,
    Arial,
    sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-size: 16px;
  font-synthesis: none;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select,
textarea {
  font: inherit;
}
button {
  cursor: pointer;
}
button,
a,
input,
select,
textarea {
  outline-offset: 4px;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid #b8783d;
}
button {
  border: 1px solid var(--line);
  background: white;
  border-radius: 7px;
  padding: 10px 14px;
  color: var(--ink);
}
button:hover {
  background: var(--light);
}
button:disabled {
  opacity: 0.55;
  cursor: wait;
}
button.primary {
  background: var(--brand);
  color: white;
  border-color: var(--brand);
}
button.danger {
  color: var(--danger);
}
button.quiet {
  background: transparent;
  border-color: transparent;
}
a {
  color: var(--brand);
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h1,
h2 {
  font-family: Georgia, serif;
  font-weight: 400;
}
h1 {
  font-size: 2.25rem;
  margin-bottom: 10px;
}
h2 {
  font-size: 1.65rem;
}
h3 {
  font-size: 1rem;
}
small,
.meta {
  font-size: 0.8125rem;
  color: var(--muted);
}
.eyebrow {
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 650;
}
.muted {
  color: var(--muted);
}
.loading {
  padding: 60px;
}
.login {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
}
.login-story {
  background: var(--brand);
  color: white;
  padding: 9vw 7vw;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.login-story .eyebrow {
  color: #d1c59f;
}
.login-story h1 {
  font-size: clamp(2.5rem, 5vw, 4.5rem);
  line-height: 1.04;
  max-width: 580px;
  margin: 35px 0;
}
.login-story p {
  color: #d4e1dd;
  max-width: 360px;
  line-height: 1.8;
}
.family-mark {
  width: 66px;
  height: 66px;
}
.login-form {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}
.login-form form {
  width: 100%;
  max-width: 360px;
}
.login-form h2 {
  font-size: 2rem;
}
.login-form button {
  width: 100%;
  margin-top: 8px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 16px;
}
.field label {
  font-size: 0.875rem;
  font-weight: 600;
}
input,
select,
textarea {
  width: 100%;
  border: 1px solid #cbd6d1;
  border-radius: 6px;
  background: white;
  padding: 11px 12px;
  color: var(--ink);
  min-width: 0;
}
textarea {
  min-height: 95px;
  resize: vertical;
}
.error {
  color: var(--danger);
  line-height: 1.5;
}
.shell {
  display: grid;
  grid-template-columns: 222px minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  background: var(--brand);
  color: #eef3f0;
  padding: 30px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 10px;
}
.brand img {
  width: 39px;
  height: 39px;
}
.brand strong {
  font-family: Georgia, serif;
  font-size: 1.5rem;
  font-weight: 400;
}
.brand small {
  display: block;
  color: #bbcdca;
  margin-top: 4px;
  font-size: 0.75rem;
}
.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.nav-button {
  text-align: left;
  background: transparent;
  color: #d7e3df;
  border: none;
  padding: 13px 15px;
}
.nav-button.active {
  color: white;
  background: #315359;
}
.nav-button span {
  display: inline-block;
  width: 25px;
}
.sidebar-bottom {
  margin-top: auto;
  border-top: 1px solid #456167;
  padding: 22px 10px 0;
  display: grid;
  gap: 12px;
}
.sidebar-bottom small {
  color: #bacec7;
}
.sidebar-bottom button {
  color: white;
  border-color: #456167;
  background: transparent;
  font-size: 0.875rem;
  padding: 8px;
}
.main {
  min-width: 0;
}
.topbar {
  height: 76px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 34px;
  background: white;
  border-bottom: 1px solid var(--line);
  gap: 16px;
}
.topbar .eyebrow {
  color: var(--ink);
}
.private {
  font-size: 0.8125rem;
  color: var(--muted);
}
.content {
  padding: 30px 34px;
}
.page-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  margin-bottom: 26px;
}
.page-head p {
  margin: 0;
  line-height: 1.6;
}
.stats {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
  padding-bottom: 22px;
  margin-bottom: 25px;
}
.stat {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.stat strong {
  font-size: 1.5rem;
  font-weight: 500;
}
.stat span {
  font-size: 0.875rem;
  color: var(--muted);
}
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.toolbar input {
  max-width: 330px;
}
.toolbar select {
  max-width: 230px;
}
.toolbar .spacer {
  flex: 1;
}
.segmented {
  display: flex;
  gap: 0;
}
.segmented button {
  border-radius: 0;
  font-size: 0.875rem;
}
.segmented button:first-child {
  border-radius: 6px 0 0 6px;
}
.segmented button:last-child {
  border-radius: 0 6px 6px 0;
}
.segmented .active {
  background: var(--brand);
  color: white;
}
.tree-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 20px;
  align-items: start;
}
.tree-wrap {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.tree-caption {
  padding: 17px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.875rem;
}
.tree-canvas {
  overflow: auto;
  min-height: 510px;
  background-image: radial-gradient(#d8e1dc 0.8px, transparent 0.8px);
  background-size: 19px 19px;
}
.tree-canvas svg {
  display: block;
  width: 100%;
  min-width: 620px;
  height: auto;
}
.node rect {
  fill: #fff;
  stroke: #cbd8d1;
  stroke-width: 1.3;
}
.node:hover rect,
.node:focus rect {
  stroke: var(--accent);
  stroke-width: 2.5;
}
.node.selected rect {
  fill: var(--brand);
  stroke: var(--brand);
}
.node text {
  font-family:
    Segoe UI,
    Arial,
    sans-serif;
  fill: var(--ink);
  font-size: 14px;
}
.node.selected text {
  fill: white;
}
.node .node-meta {
  font-size: 12px;
  fill: var(--muted);
}
.node.selected .node-meta {
  fill: #cbdad4;
}
.node {
  cursor: pointer;
  outline: none;
}
.edge {
  stroke: #71968b;
  stroke-width: 1.6;
  fill: none;
}
.edge.uncertain {
  stroke: #b88c4c;
  stroke-dasharray: 5 5;
}
.edge.partner {
  stroke: #8e839b;
}
.row-label {
  font-size: 12px;
  fill: #607175;
  letter-spacing: 1.1px;
}
.legend {
  display: flex;
  gap: 18px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  font-size: 0.75rem;
  color: var(--muted);
  flex-wrap: wrap;
}
.legend i {
  display: inline-block;
  width: 20px;
  border-top: 2px solid #71968b;
  margin-right: 6px;
  vertical-align: middle;
}
.legend i.dashed {
  border-color: #b88c4c;
  border-top-style: dashed;
}
.profile {
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.profile-head {
  padding: 24px;
  background: var(--light);
}
.avatar {
  height: 50px;
  width: 50px;
  border-radius: 50%;
  background: #d5e3dc;
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: Georgia, serif;
  font-size: 1.35rem;
  margin-bottom: 17px;
}
.profile h2 {
  font-size: 1.7rem;
  line-height: 1.2;
  margin-bottom: 10px;
  overflow-wrap: anywhere;
}
.profile-body {
  padding: 22px;
}
.profile dl {
  margin: 0;
}
.profile dt {
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 5px;
}
.profile dd {
  font-size: 0.875rem;
  margin: 0 0 18px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  white-space: pre-line;
}
.profile button {
  width: 100%;
  margin-top: 10px;
  font-size: 0.875rem;
}
.badge {
  display: inline-block;
  border-radius: 4px;
  padding: 4px 7px;
  background: #edf1ee;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.3;
}
.badge.warn {
  background: #fbefd9;
  color: #81541e;
}
.badge.critical,
.badge.high {
  color: #922d2d;
  background: #f9e5e1;
}
.badge.ok {
  color: #255d44;
  background: #e1f0e6;
}
.notice {
  padding: 13px 16px;
  background: #faf0df;
  border: 1px solid #e6d5b5;
  border-radius: 7px;
  color: #785126;
  font-size: 0.875rem;
  line-height: 1.6;
  margin: 16px 0;
}
.results {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  margin-bottom: 18px;
  max-height: 260px;
  overflow: auto;
}
.results button {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  text-align: left;
  border: none;
}
.empty {
  padding: 35px;
  background: white;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  line-height: 1.6;
}
.table-wrap {
  overflow: auto;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
}
table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.875rem;
}
th {
  background: #edf2ef;
  font-weight: 600;
  font-size: 0.75rem;
  color: var(--muted);
  padding: 14px 18px;
  white-space: nowrap;
}
td {
  padding: 14px 18px;
  border-top: 1px solid #e6ebe8;
  line-height: 1.5;
}
td button {
  font-size: 0.8125rem;
  padding: 6px 10px;
}
.person-link {
  border: 0;
  background: none;
  padding: 0;
  text-align: left;
  font-size: 0.875rem;
  font-weight: 600;
}
.cards {
  display: grid;
  gap: 14px;
}
.review-card {
  background: white;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.review-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}
.review-card h3 {
  margin: 0;
  line-height: 1.5;
}
.review-card p {
  font-size: 0.875rem;
  line-height: 1.65;
  margin-bottom: 12px;
  white-space: pre-line;
}
.review-card details {
  font-size: 0.875rem;
  line-height: 1.6;
  margin: 14px 0;
  overflow-wrap: anywhere;
}
.review-card summary {
  cursor: pointer;
  color: var(--brand);
}
.review-card .actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.review-card .meta {
  margin: 12px 0 0;
}
.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.tabs .active {
  background: var(--brand);
  color: white;
}
.two-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.form-hint {
  font-size: 0.8125rem;
  color: var(--muted);
  line-height: 1.6;
}
.dialog-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 20px;
}
.dialog-head h2 {
  margin-bottom: 24px;
}
.dialog-head button {
  padding: 3px 9px;
  font-size: 1.5rem;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 25px;
}
dialog {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 28px;
  width: min(620px, calc(100vw - 30px));
  max-height: 90vh;
  color: var(--ink);
}
dialog::backdrop {
  background: #112c35a8;
  backdrop-filter: blur(3px);
}
dialog form {
  margin: 0;
}
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--brand);
  color: white;
  padding: 14px 22px;
  border-radius: 8px;
  box-shadow: 0 6px 25px #0002;
  z-index: 100;
  display: none;
  max-width: 90vw;
}
#toast.visible {
  display: block;
}
.source-name {
  overflow-wrap: anywhere;
}
.audit-json {
  white-space: pre-wrap;
  font-size: 0.8125rem;
  max-height: 250px;
  overflow: auto;
}
.text-right {
  text-align: right;
}
.count-note {
  margin: 10px 0 18px;
}
.profile .badge {
  margin-right: 4px;
}
.login-footer {
  margin-top: 30px;
  font-size: 0.8125rem;
  color: var(--muted);
  line-height: 1.6;
}
@media (min-width: 1600px) {
  .content {
    max-width: 1600px;
    margin: auto;
  }
}
@media (max-width: 1180px) {
  .tree-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .profile {
    display: grid;
    grid-template-columns: 250px 1fr;
  }
  .profile-body dl {
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: 8px;
  }
  .profile dt,
  .profile dd {
    margin-bottom: 8px;
  }
  .profile button {
    width: auto;
    margin-right: 8px;
  }
  .content {
    padding: 25px;
  }
  .topbar {
    padding: 0 25px;
  }
}
@media (max-width: 760px) {
  .shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    height: auto;
    position: static;
    padding: 15px;
    gap: 18px;
  }
  .brand {
    padding: 0;
  }
  .sidebar nav {
    flex-direction: row;
    overflow: auto;
    gap: 3px;
  }
  .nav-button {
    white-space: nowrap;
    padding: 10px;
    font-size: 0.875rem;
  }
  .nav-button span {
    display: none;
  }
  .sidebar-bottom {
    margin: 0;
    padding: 12px 0 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
  }
  .sidebar-bottom small {
    margin-right: auto;
  }
  .sidebar-bottom button {
    padding: 5px 8px;
  }
  .topbar {
    height: 54px;
    padding: 0 18px;
  }
  .content {
    padding: 22px 16px;
  }
  .page-head {
    align-items: flex-start;
  }
  .page-head h1 {
    font-size: 1.9rem;
  }
  .page-head p {
    font-size: 0.875rem;
  }
  .stats {
    gap: 15px;
  }
  .stat {
    gap: 5px;
  }
  .stat strong {
    font-size: 1.2rem;
  }
  .stat span {
    font-size: 0.75rem;
  }
  .tree-layout {
    gap: 16px;
  }
  .profile {
    display: block;
  }
  .profile-body dl {
    display: block;
  }
  .profile dt {
    margin-bottom: 5px;
  }
  .profile dd {
    margin-bottom: 15px;
  }
  .tree-canvas {
    min-height: 400px;
  }
  .toolbar input {
    max-width: 100%;
  }
  .toolbar .spacer {
    display: none;
  }
  .login {
    grid-template-columns: 1fr;
  }
  .login-story {
    padding: 34px;
  }
  .login-story h1 {
    font-size: 2.5rem;
    margin: 18px 0;
  }
  .login-story p {
    margin-bottom: 0;
  }
  .login-story .family-mark {
    display: none;
  }
  .login-form {
    padding: 32px 25px;
  }
  .two-fields {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .private {
    font-size: 0.75rem;
  }
  .review-card {
    padding: 17px;
  }
  .review-card header {
    align-items: flex-start;
  }
  .profile-body dl dd {
    display: block;
  }
  .tree-caption {
    align-items: start;
  }
  .tree-caption small {
    max-width: 160px;
  }
  dialog {
    padding: 22px;
  }
  .stat {
    flex-wrap: wrap;
  }
  .topbar .eyebrow {
    font-size: 0.625rem;
  }
}

.tree-canvas svg {
  width: auto;
  min-width: 100%;
  height: auto;
}
.sidebar {
  min-width: 0;
}
.sidebar nav {
  min-width: 0;
}
@media (max-width: 760px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
  }
  .page-head > button {
    white-space: nowrap;
    flex-shrink: 0;
  }
  .tree-caption > strong {
    min-width: 0;
  }
  .tree-caption small {
    flex-shrink: 0;
    max-width: 140px;
  }
}
