:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #17202a;
  background: #eef1f4;
}

.profile-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.profile-toolbar h2 { margin: 0; font-size: 20px; }
.profile-toolbar button { padding: 10px 16px; }
.profile-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.profile-actions .secondary-button { margin: 0; font-size: 12px; }
.ui-icon { width: 19px; height: 19px; flex: 0 0 19px; vertical-align: middle; }
.profile-navigation { display: flex; flex-wrap: wrap; gap: 6px; position: sticky; top: -1px; z-index: 10; margin: 0 -1px 20px; padding: 12px 0; background: #fff; border-bottom: 1px solid #d7e3df; }
.profile-navigation button { display: inline-flex; align-items: center; gap: 7px; border: 1px solid transparent; padding: 8px 10px; background: #f0f6f3; color: #255f52; border-radius: 6px; font-size: 12px; cursor: pointer; }
.profile-navigation button:hover { background: #e1efe8; border-color: #b8d3c5; }
.sheet-section { scroll-margin-top: 110px; }
.section-symbol { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 7px; background: #eef6f2; color: #287565; }
.sheet-section > summary { display: flex; align-items: center; gap: 10px; list-style: none; }
.sheet-section > summary::-webkit-details-marker { display: none; }
.section-chevron { margin-left: auto; display: flex; }
.sheet-section[open] > summary .section-chevron { transform: rotate(90deg); }
.fact-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 10px; }
.fact-groups .summary-entry { margin: 0; }
.summary-entry .field-list > div { display: block; }
.summary-entry .field-list dt { margin-bottom: 5px; }
.contact-card { display: flex; align-items: flex-start; gap: 12px; min-width: 0; padding: 4px 0; }
.contact-card > div { min-width: 0; }
.contact-symbol { display: inline-grid; place-items: center; width: 33px; height: 33px; flex: 0 0 33px; border-radius: 8px; background: #eff6f2; color: #287565; }
.card-label { display: block; color: #667684; font-size: 11px; line-height: 1.5; margin-bottom: 5px; }
.contact-value, .location-primary { display: block; font-size: 14px; line-height: 1.5; color: #20372f; overflow-wrap: anywhere; }
.location-primary { margin-bottom: 12px; }
.location-coordinate-set { padding: 10px; margin-top: 10px; border: 1px solid #dfebe5; border-radius: 5px; background: #f7faf8; break-inside: avoid; }
.location-coordinate-set .field-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.location-coordinate-set .field-list > div { border: 0; padding: 3px 0; }
.topic-candidates { border-top: 1px solid #e0e6e4; padding-top: 12px; margin-top: 18px; }
.topic-candidates > summary { color: #775522; font-size: 12px; font-weight: 650; }
.candidate-body { margin-top: 12px; }
.candidate-body .event-entry { border-color: #e3d8c4; background: #fffcf7; }
.count-badge { display: inline-block; padding: 1px 7px; margin-left: 5px; border-radius: 10px; background: #f7ead4; color: #6e4c17; font-size: 11px; }
.record-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 12px; padding-top: 9px; border-top: 1px solid #e5eae7; }
.record-actions .secondary-button { margin: 0; padding: 7px 10px; font-size: 11px; }
.text-button { padding: 4px 0; border: 0; background: transparent; color: #287565; font-size: 11px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.lookup-status { color: #667684; font-size: 12px; }
.print-only { display: none; }
.app-shell.search-collapsed { grid-template-columns: minmax(0, 1fr); }
.search-collapsed .search-panel { display: none; }
.query-history { display: flex; flex-wrap: wrap; gap: 7px; margin: 18px 0; }
.query-history[hidden] { display: none; }
.query-history button { max-width: 280px; border: 1px solid #b9cbc5; padding: 8px 12px; border-radius: 6px; background: #fff; color: #285e52; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; font-size: 12px; }
.query-history button[aria-current="page"] { background: #216b5d; border-color: #216b5d; color: #fff; }
.person-link { display: inline; border: 0; padding: 0; background: transparent; color: #216b5d; font: inherit; text-align: inherit; text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 3px; cursor: pointer; }
.person-link:hover { text-decoration-style: solid; }
.age-badge { display: inline-block; border-radius: 4px; padding: 2px 6px; margin-left: 6px; background: #eff7f5; color: #216b5d; font-size: 11px; font-weight: 650; white-space: nowrap; }
.location-figure { margin: 20px 0 8px; break-inside: avoid; }
.location-figure figcaption { font-size: 13px; font-weight: 650; margin-bottom: 10px; }
.location-map { height: 340px; width: 100%; border: 1px solid #bdcfc8; border-radius: 6px; background: #e6eef0; z-index: 0; }
.location-marker { background: none; border: 0; }
.location-marker > span { display: block; width: 22px; height: 22px; border-radius: 50% 50% 0 50%; transform: rotate(45deg); background: #b23d36; border: 2px solid white; box-shadow: 1px 2px 4px #0005; }
.location-marker > span::after { content: ''; display: block; position: absolute; width: 7px; height: 7px; border-radius: 50%; background: white; left: 5.5px; top: 5.5px; }
.map-place-label { color: #426459; font-size: 11px; line-height: 1.25; text-align: center; text-shadow: 1px 1px 2px white, -1px -1px 2px white; }
.map-caption { display: block; margin-top: 7px; color: #667684; font-size: 10px; }
.map-print { display: none; }
.person-sheet { background: #fff; border: 1px solid #d7dee5; border-radius: 8px; padding: 22px; overflow-wrap: anywhere; }
.sheet-header h2 { margin: 8px 0; font-size: 24px; }
.sheet-header .person-link { text-decoration: none; }
.sheet-header .person-link:hover { text-decoration: underline dotted; }
.sheet-header p { margin: 6px 0; color: #596977; font-size: 12px; line-height: 1.5; }
.sheet-metrics { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 20px 0; }
.sheet-metrics div { background: #eff7f5; padding: 12px; font-size: 11px; border-radius: 5px; }
.sheet-metrics strong { display: block; font-size: 23px; color: #216b5d; }
.sheet-section { margin-top: 24px; }
.sheet-section h3 { margin: 0 0 12px; padding-bottom: 10px; border-bottom: 2px solid #287565; font-size: 15px; }
.sheet-section > summary { padding: 0 0 10px; border-bottom: 2px solid #287565; font-size: 15px; font-weight: 700; color: #194f46; }
summary { cursor: pointer; line-height: 1.5; }
summary:focus-visible { outline: 3px solid #287565; outline-offset: 3px; }
.section-body { padding-top: 12px; }
.section-body h4 { margin: 18px 0 10px; font-size: 13px; }
.section-body p, .section-body li { font-size: 12px; line-height: 1.6; }
.summary-entry, .event-entry { margin: 10px 0 16px; padding: 12px; border: 1px solid #d7dee5; border-radius: 6px; }
.summary-entry .field-list > div:last-child, .event-entry .field-list > div:last-child { border-bottom: 0; }
.fact-contexts { list-style: none; margin: 8px 0 0; padding: 0; color: #596977; }
.fact-contexts li { margin-top: 4px; font-size: 11px; }
.fact-variant + .fact-variant { margin-top: 10px; }
.match-label { display: inline-block; margin: 8px 0 0 8px; font-size: 11px; color: #596977; }
.match-label[data-level="conflicto"] { color: #923c28; font-weight: 600; }
.event-context { margin-top: 10px; color: #596977; font-size: 12px; line-height: 1.5; }
.section-empty { color: #596977; }
.event-title { font-size: 13px; line-height: 1.5; }
.review-badge { display: inline-block; margin: 8px 0 0; padding: 3px 7px; color: #714b0c; background: #fff5e3; border-radius: 4px; font-size: 11px; }
.profile-tool { margin: 14px 0; padding: 14px; border: 1px solid #c4d0d8; border-radius: 6px; background: #fff; }
.profile-tool > summary, .original-detail > summary { font-size: 13px; font-weight: 650; color: #216b5d; }
.profile-tool #childrenForm { border: 0; padding: 12px 0 0; margin: 0; }
.profile-tool input { background: #fff; color: #17202a; border-color: #9caeb8; }
.variant-label { display: block; color: #925500; font-size: 10px; margin-top: 4px; }
.sheet-section > p { font-size: 12px; line-height: 1.5; }
.profile-review { margin: 24px 0; }
.profile-review h3 { font-size: 15px; }
.review-record { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; border-bottom: 1px solid #d7dee5; }
.review-record .review-row { flex: 1 1 220px; min-width: 0; border-bottom: 0; }
.inspect-button { flex: 0 0 auto; padding: 7px 10px; margin: 8px 0; font-size: 12px; }
.review-row { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-bottom: 1px solid #d7dee5; cursor: pointer; }
.review-row input { width: 17px; height: 17px; flex: 0 0 auto; accent-color: #287565; }
.review-row strong { font-size: 12px; }
.review-row small { display: block; font-size: 11px; color: #596977; margin-top: 3px; overflow-wrap: anywhere; }
.original-detail { border-top: 2px solid #c4d0d8; padding-top: 20px; }
.secondary-button { border: 1px solid #287565; border-radius: 5px; color: #216b5d; background: #fff; padding: 10px; margin: 12px 0; cursor: pointer; }
button:focus-visible { outline: 3px solid #287565; outline-offset: 3px; }
@page { size: A4; margin: 15mm; }
@media print {
  :root, body { background: white; color: black; }
  .search-panel, .profile-toolbar, .profile-review, .original-detail, .query-history { display: none !important; }
  .profile-navigation, .record-actions, .section-chevron { display: none !important; }
  .print-only { display: inline; }
  .contact-value, .location-primary { font-size: 10pt; }
  .card-label { font-size: 8pt; }
  .section-symbol { width: 25px; height: 25px; background: none; }
  .sheet-section { scroll-margin-top: 0; }
  .topic-candidates { break-inside: auto; }
  .topic-candidates > summary { break-after: avoid; }
  .topic-candidates > .candidate-body { display: block !important; }
  .person-link { color: inherit; text-decoration: none; }
  .age-badge { font-size: 8pt; }
  .location-map { height: 75mm; }
  .location-map .leaflet-control-container { display: none; }
  .map-snapshot-ready .location-map { display: none; }
  .map-snapshot-ready .map-print { display: block; width: 100%; max-height: 82mm; object-fit: contain; border: 1px solid #bdcfc8; }
  .app-shell, .workspace, .detail-panel { display: block !important; height: auto !important; max-height: none !important; overflow: visible !important; padding: 0 !important; background: white !important; }
  .person-sheet { border: 0; border-radius: 0; padding: 0; }
  .sheet-header h2 { font-size: 21pt; }
  .sheet-section h3 { break-after: avoid; }
  .field-list > div, .sheet-metrics { break-inside: avoid; }
  .field-list > div { grid-template-columns: 32% minmax(0, 1fr); padding: 6px 0; }
  .field-list dt, .field-list dd { font-size: 9pt; }
  .fact-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 16px; }
  .fact-groups { gap: 10px; }
  .fact-groups .summary-entry { margin: 0; }
  .sheet-metrics { margin: 14px 0; }
  .sheet-metrics div { padding: 8px; }
  .sheet-section { margin-top: 18px; }
  details > summary { list-style: none; }
  details > summary::-webkit-details-marker { display: none; }
  .sheet-section > summary, h4, .event-title { break-after: avoid; }
  .sheet-section > .section-body { display: block !important; }
  .fact-variant { break-inside: avoid; }
  .summary-entry, .event-entry { padding: 8px; }
  .summary-entry, .event-entry { break-inside: avoid; }
  p { orphans: 3; widows: 3; }
}

* {
  box-sizing: border-box;
}

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

button,
input,
select {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 350px minmax(0, 1fr);
}

.search-panel {
  min-width: 0;
  padding: 20px;
  background: #18232d;
  color: #f7fafc;
  display: flex;
  flex-direction: column;
  gap: 22px;
  overflow-y: auto;
  max-height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: #40b7a2;
  color: #10231f;
  font-weight: 800;
}

.brand h1,
.brand p {
  margin: 0;
  letter-spacing: 0;
}

.brand h1 {
  font-size: 20px;
}

.brand p {
  margin-top: 2px;
  color: #aab7c3;
  font-size: 13px;
}

.search-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.full-width {
  grid-column: 1 / -1;
}

.field {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.field label,
.source-fieldset legend {
  color: #c9d2db;
  font-size: 12px;
  font-weight: 600;
}

input,
select {
  width: 100%;
  min-width: 0;
  height: 38px;
  border: 1px solid #40505e;
  border-radius: 5px;
  padding: 7px 9px;
  background: #101922;
  color: #ffffff;
  outline: none;
}

input:focus,
select:focus {
  border-color: #40b7a2;
  box-shadow: 0 0 0 2px rgba(64, 183, 162, 0.18);
}

.source-fieldset {
  margin: 2px 0 0;
  padding: 10px 0 0;
  border: 0;
  border-top: 1px solid #34424f;
}

.source-fieldset legend {
  padding: 0 8px 0 0;
}

.source-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px 10px;
}

.check-option {
  min-width: 0;
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  align-items: start;
  gap: 7px;
  color: #e4eaf0;
  font-size: 12px;
  cursor: pointer;
}

.check-option input {
  width: 15px;
  height: 15px;
  margin: 1px 0 0;
  accent-color: #40b7a2;
}

.check-option small {
  grid-column: 2;
  color: #e2a94f;
  font-size: 10px;
}

.primary-button {
  min-height: 40px;
  border: 0;
  border-radius: 5px;
  background: #40b7a2;
  color: #10231f;
  font-weight: 750;
  cursor: pointer;
}

.primary-button:hover {
  background: #56c7b3;
}

.primary-button:disabled {
  opacity: 0.65;
  cursor: wait;
}

.global-status {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid #34424f;
  color: #aab7c3;
  font-size: 12px;
  line-height: 1.45;
}

.global-status[data-tone="ok"] {
  color: #7ed6c6;
}

.global-status[data-tone="warning"] {
  color: #f0bd68;
}

.global-status[data-tone="error"] {
  color: #ff8c87;
}

.workspace {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  max-height: 100vh;
}

.detail-panel {
  min-width: 0;
  overflow-y: auto;
  padding: 20px;
}


.detail-panel {
  background: #f4f6f8;
}

.detail-heading {
  padding-bottom: 15px;
  border-bottom: 1px solid #d7dee5;
}

.detail-heading h2 {
  margin: 6px 0 0;
  font-size: 20px;
  overflow-wrap: anywhere;
}

.source-tag {
  display: inline-block;
  color: #287565;
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
}

.detail-content {
  padding-top: 16px;
}

.detail-summary {
  padding-bottom: 12px;
  border-bottom: 1px solid #d7dee5;
}

.detail-summary span {
  color: #287565;
  font-size: 11px;
  font-weight: 750;
}

.detail-summary p {
  margin: 5px 0 0;
  color: #667684;
  font-size: 12px;
}

.field-list {
  margin: 0;
}

.field-list > div {
  display: grid;
  grid-template-columns: minmax(130px, 0.36fr) minmax(0, 0.64fr);
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid #dfe5ea;
}

.field-list dt,
.field-list dd {
  margin: 0;
  min-width: 0;
  font-size: 12px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.field-list dt {
  color: #667684;
}

.field-list dd {
  color: #17202a;
  font-weight: 550;
}

#childrenForm { display: grid; gap: 12px; padding: 16px; margin-bottom: 20px; border: 1px solid #d7dee5; border-radius: 8px; }
#childrenForm label { display: grid; gap: 5px; min-width: 0; }
#childrenForm input { box-sizing: border-box; width: 100%; min-width: 0; padding: 9px; }
#childrenForm button { white-space: normal; }

.empty-state {
  min-height: 180px;
  display: grid;
  place-items: center;
  color: #7a8791;
  text-align: center;
  font-size: 13px;
}

@media screen and (max-width: 1300px) {
  .app-shell {
    grid-template-columns: 320px minmax(0, 1fr);
  }

  .workspace {
    grid-template-columns: 1fr;
    max-height: none;
  }

  .detail-panel {
    max-height: none;
  }

}

@media screen and (max-width: 760px) {
  .fact-groups { grid-template-columns: 1fr; }
  .profile-navigation { flex-wrap: nowrap; overflow-x: auto; padding: 10px 0; }
  .profile-navigation button { flex: 0 0 auto; }
  .sheet-section { scroll-margin-top: 72px; }
  .app-shell {
    grid-template-columns: 1fr;
  }

  .search-panel {
    max-height: none;
  }

  .workspace {
    display: block;
  }


  .field-list > div {
    grid-template-columns: 1fr;
    gap: 3px;
  }
}
