
  :root {
    --bg: #faf6f0;
    --bg-card: #ffffff;
    --bg-soft: #f3ece0;
    --ink: #2d1f0e;
    --ink-soft: #5a4a36;
    --ink-faint: #8a7a64;
    --accent: #8b0000;
    --accent-soft: #b04040;
    --gold: #a07820;
    --polish-red: #dc143c;
    --polish-white: #ffffff;
    --document: #fffaf0;
    --border: #d9cdb8;
    --tree-line: #b09870;
    --shadow: 0 2px 8px rgba(45, 31, 14, 0.08);
    --shadow-hover: 0 4px 16px rgba(45, 31, 14, 0.15);
    --serif: Georgia, "Times New Roman", serif;
    --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  }

  * { box-sizing: border-box; margin: 0; padding: 0; }
  html { scroll-behavior: smooth; }
  body {
    font-family: var(--sans);
    background: var(--bg);
    color: var(--ink);
    line-height: 1.6;
    font-size: 16px;
  }

  /* Header */
  header.site {
    background: linear-gradient(135deg, #6b0000 0%, #8b0000 50%, #6b0000 100%);
    color: white;
    padding: 3rem 2rem 2rem;
    text-align: center;
    border-bottom: 4px solid var(--gold);
  }
  header.site h1 {
    font-family: var(--serif);
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: 1px;
  }
  header.site .subtitle {
    font-family: var(--serif);
    font-style: italic;
    font-size: 1.1rem;
    opacity: 0.95;
    margin-bottom: 0.5rem;
  }
  header.site .lineage {
    font-size: 0.95rem;
    opacity: 0.85;
    margin-top: 0.75rem;
  }

  /* Navigation */
  nav.tabs {
    position: sticky;
    top: 0;
    background: var(--ink);
    color: white;
    z-index: 100;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  }
  nav.tabs ul {
    display: flex;
    flex-wrap: wrap;
    max-width: 1200px;
    margin: 0 auto;
    list-style: none;
    justify-content: center;
  }
  nav.tabs li button {
    padding: 1rem 1.5rem;
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 0.95rem;
    font-family: var(--sans);
    transition: all 0.2s;
    border-bottom: 3px solid transparent;
  }
  nav.tabs li button:hover { background: rgba(255,255,255,0.1); }
  nav.tabs li button.active {
    border-bottom-color: var(--gold);
    background: rgba(255,255,255,0.05);
  }

  /* Main */
  main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
  }
  section.view {
    display: none;
    animation: fadeIn 0.3s ease;
  }
  section.view.active { display: block; }
  @keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
  }

  h2 {
    font-family: var(--serif);
    font-size: 2rem;
    color: var(--accent);
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--gold);
    padding-bottom: 0.5rem;
  }
  h3 {
    font-family: var(--serif);
    font-size: 1.4rem;
    color: var(--ink);
    margin: 1.5rem 0 0.75rem;
  }
  h4 {
    font-family: var(--serif);
    font-size: 1.1rem;
    color: var(--accent);
    margin: 1rem 0 0.5rem;
  }
  p { margin-bottom: 0.75rem; }

  /* Overview cards */
  .stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
  }
  .stat-card {
    background: var(--bg-card);
    padding: 1.25rem;
    border-radius: 8px;
    border-left: 4px solid var(--accent);
    box-shadow: var(--shadow);
    text-align: center;
  }
  .stat-card .number {
    font-family: var(--serif);
    font-size: 2.2rem;
    color: var(--accent);
    font-weight: bold;
    display: block;
  }
  .stat-card .label {
    font-size: 0.85rem;
    color: var(--ink-soft);
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }
  .overview-intro {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
    border-top: 4px solid var(--gold);
  }
  .overview-intro h3 { margin-top: 0; }
  .key-finding {
    background: var(--document);
    border-left: 4px solid var(--gold);
    padding: 1rem 1.25rem;
    margin: 1rem 0;
    border-radius: 0 6px 6px 0;
    font-style: italic;
  }

  /* ===========================================
     TREE VIEW — Genealogical Tree with SVG lines
     =========================================== */
  .tree-view-toggle {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
  }
  .tree-view-toggle button {
    padding: 0.5rem 1.1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--ink-soft);
    transition: all 0.2s;
  }
  .tree-view-toggle button.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
  }

  .pedigree {
    position: relative;
    padding: 1rem 0;
    overflow-x: auto;
  }
  .pedigree-inner {
    position: relative;
    min-width: 100%;
  }
  .pedigree svg.tree-lines {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
  }
  .pedigree-row {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 4rem;
    position: relative;
    z-index: 1;
    flex-wrap: nowrap;
  }
  .pedigree-row:last-child { margin-bottom: 1rem; }

  .gen-tag {
    position: absolute;
    left: 0;
    top: -1.5rem;
    background: var(--gold);
    color: white;
    padding: 2px 10px;
    font-size: 0.75rem;
    font-weight: bold;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }

  .couple {
    display: flex;
    align-items: stretch;
    position: relative;
    gap: 0;
  }
  .couple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--tree-line);
    z-index: -1;
  }

  .node {
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 0.55rem 0.75rem;
    width: 165px;
    min-height: 75px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--shadow);
    position: relative;
    text-align: center;
  }
  .node:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
  }
  .node.direct {
    border-color: var(--accent);
    background: linear-gradient(135deg, #fff 0%, #fff8f0 100%);
  }
  .node.you {
    border-color: var(--polish-red);
    background: linear-gradient(135deg, #fff 0%, #fff0f0 100%);
    border-width: 3px;
  }
  .node.polish-born::before {
    content: "🇵🇱";
    position: absolute;
    top: -10px;
    right: -10px;
    background: white;
    border-radius: 50%;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow);
    font-size: 0.85rem;
  }
  .node .node-name {
    font-family: var(--serif);
    font-weight: bold;
    color: var(--accent);
    font-size: 0.9rem;
    line-height: 1.2;
    margin-bottom: 0.2rem;
  }
  .node .node-dates {
    font-size: 0.78rem;
    color: var(--ink-soft);
  }
  .node .node-place {
    font-size: 0.7rem;
    color: var(--ink-faint);
    font-style: italic;
    margin-top: 0.15rem;
  }

  /* Siblings panel */
  .siblings-panel {
    background: var(--bg-card);
    padding: 1.25rem 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-top: 2rem;
    border-left: 4px solid var(--gold);
  }
  .siblings-panel h3 { margin-top: 0; }
  .siblings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.6rem;
    margin-top: 0.75rem;
  }
  .sibling-chip {
    background: var(--bg-soft);
    padding: 0.5rem 0.75rem;
    border-radius: 5px;
    border-left: 3px solid var(--gold);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
  }
  .sibling-chip:hover {
    background: var(--document);
    transform: translateY(-1px);
  }
  .sibling-chip .sib-name {
    font-weight: bold;
    color: var(--accent);
    font-size: 0.92rem;
  }
  .sibling-chip .sib-dates {
    color: var(--ink-soft);
    font-size: 0.78rem;
  }

  /* Generations row view (alternative) */
  .gens-rows {
    display: flex;
    flex-direction: column;
    gap: 2rem;
  }
  .gens-rows .gen-block {
    background: var(--bg-card);
    padding: 1.25rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--gold);
  }
  .gens-rows .gen-block h4 {
    margin-top: 0;
    margin-bottom: 0.75rem;
  }
  .gens-rows .gen-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  /* People */
  .filter-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
  }
  .filter-btn {
    padding: 0.5rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    color: var(--ink-soft);
    font-size: 0.9rem;
    transition: all 0.2s;
  }
  .filter-btn:hover { border-color: var(--accent); }
  .filter-btn.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
  }
  .people-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1rem;
  }
  .person-card {
    background: var(--bg-card);
    border-radius: 8px;
    padding: 1.25rem;
    box-shadow: var(--shadow);
    border-top: 3px solid var(--border);
    transition: all 0.2s;
  }
  .person-card.direct { border-top-color: var(--accent); }
  .person-card.polish-born { border-top-color: var(--polish-red); }
  .person-card:hover { box-shadow: var(--shadow-hover); }
  .person-card .header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
  }
  .person-card .name {
    font-family: var(--serif);
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--accent);
    margin-bottom: 0.25rem;
  }
  .person-card .relation {
    font-size: 0.85rem;
    color: var(--ink-faint);
    font-style: italic;
    margin-bottom: 0.75rem;
  }
  .person-card .facts { list-style: none; margin-top: 0.75rem; }
  .person-card .facts li {
    font-size: 0.9rem;
    padding: 0.25rem 0;
    color: var(--ink);
    display: flex;
    gap: 0.5rem;
  }
  .person-card .facts .icon {
    color: var(--gold);
    min-width: 18px;
  }
  .person-card .notes {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px dashed var(--border);
    font-size: 0.85rem;
    color: var(--ink-soft);
    font-style: italic;
  }

  /* Documents */
  .documents-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }
  .doc-card {
    background: var(--bg-card);
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow: hidden;
    border-left: 4px solid var(--gold);
  }
  .doc-header {
    padding: 1rem 1.25rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
  }
  .doc-header:hover { background: var(--bg-soft); }
  .doc-header .doc-info { flex: 1; }
  .doc-header .doc-type {
    font-size: 0.75rem;
    background: var(--accent);
    color: white;
    padding: 2px 8px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-block;
    margin-bottom: 0.4rem;
  }
  .doc-header .doc-title {
    font-family: var(--serif);
    font-weight: bold;
    font-size: 1.05rem;
    color: var(--ink);
    margin-bottom: 0.2rem;
  }
  .doc-header .doc-meta {
    font-size: 0.85rem;
    color: var(--ink-soft);
  }
  .doc-toggle {
    font-size: 1.5rem;
    color: var(--accent);
    transition: transform 0.2s;
  }
  .doc-card.expanded .doc-toggle { transform: rotate(180deg); }
  .doc-body {
    display: none;
    padding: 0 1.25rem 1.25rem;
    border-top: 1px solid var(--border);
  }
  .doc-card.expanded .doc-body { display: block; }
  .doc-body h5 {
    font-family: var(--serif);
    color: var(--gold);
    margin: 1rem 0 0.5rem;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
  }
  .doc-body .doc-image-wrap {
    background: var(--ink);
    padding: 0.5rem;
    border-radius: 4px;
    text-align: center;
    margin-top: 0.5rem;
    border: 1px solid var(--border);
  }
  .doc-body .doc-image-wrap img {
    max-width: 100%;
    height: auto;
    cursor: zoom-in;
    border-radius: 2px;
  }
  .doc-body .doc-image-missing {
    background: var(--bg-soft);
    padding: 2rem 1rem;
    border-radius: 6px;
    text-align: center;
    color: var(--ink-faint);
    font-style: italic;
    border: 2px dashed var(--border);
    margin-top: 0.5rem;
  }
  .doc-body .doc-image-missing code {
    background: var(--ink);
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: monospace;
    font-size: 0.85rem;
    font-style: normal;
  }
  .doc-body .transcription {
    background: var(--document);
    padding: 1rem 1.25rem;
    border-radius: 4px;
    font-family: var(--serif);
    font-style: italic;
    font-size: 0.9rem;
    line-height: 1.7;
    border-left: 3px solid var(--gold);
    color: var(--ink);
    white-space: pre-wrap;
  }
  .doc-body .key-facts {
    list-style: none;
    margin-top: 0.5rem;
  }
  .doc-body .key-facts li {
    padding: 0.4rem 0;
    font-size: 0.9rem;
    border-bottom: 1px dotted var(--border);
  }
  .doc-body .key-facts li:last-child { border-bottom: none; }
  .doc-body .key-facts strong { color: var(--accent); }

  /* ====================================
     TIMELINE — improved with decades
     ==================================== */
  .timeline-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
    align-items: center;
  }
  .timeline-controls .filter-btn { font-size: 0.85rem; padding: 0.4rem 0.85rem; }

  .timeline-jump {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    padding: 0.75rem;
    background: var(--bg-card);
    border-radius: 6px;
    box-shadow: var(--shadow);
  }
  .timeline-jump span {
    font-size: 0.8rem;
    color: var(--ink-faint);
    align-self: center;
    margin-right: 0.5rem;
  }
  .timeline-jump a {
    background: var(--gold);
    color: white;
    padding: 0.3rem 0.7rem;
    border-radius: 3px;
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 600;
  }
  .timeline-jump a:hover { background: var(--accent); }

  .decade-block {
    margin-bottom: 2rem;
  }
  .decade-header {
    background: linear-gradient(90deg, var(--accent) 0%, var(--accent-soft) 100%);
    color: white;
    padding: 0.75rem 1.25rem;
    border-radius: 6px 6px 0 0;
    font-family: var(--serif);
    font-size: 1.25rem;
    font-weight: bold;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .decade-header .count {
    font-size: 0.85rem;
    font-weight: normal;
    background: rgba(255,255,255,0.2);
    padding: 2px 10px;
    border-radius: 12px;
  }
  .decade-events {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 6px 6px;
    padding: 1rem 1.25rem;
    box-shadow: var(--shadow);
  }
  .timeline-event {
    display: flex;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px dashed var(--border);
    align-items: flex-start;
  }
  .timeline-event:last-child { border-bottom: none; }
  .timeline-event .event-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
    font-weight: bold;
  }
  .timeline-event.birth .event-icon { background: #2c7d2c; }
  .timeline-event.death .event-icon { background: #5a5a5a; }
  .timeline-event.marriage .event-icon { background: var(--gold); }
  .timeline-event.immigration .event-icon { background: var(--polish-red); }
  .timeline-event.milestone .event-icon { background: var(--accent); }
  .timeline-event .event-body { flex: 1; }
  .timeline-event .event-year {
    font-family: var(--serif);
    font-weight: bold;
    color: var(--accent);
    font-size: 0.92rem;
  }
  .timeline-event .event-date {
    font-size: 0.78rem;
    color: var(--ink-faint);
    margin-left: 0.5rem;
  }
  .timeline-event .event-desc {
    margin-top: 0.15rem;
    font-size: 0.92rem;
  }
  .timeline-event .event-loc {
    font-size: 0.78rem;
    color: var(--ink-faint);
    margin-top: 0.2rem;
    font-style: italic;
  }
  .timeline-event.hidden { display: none; }

  .timeline-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border-radius: 6px;
    box-shadow: var(--shadow);
  }
  .timeline-legend span {
    display: flex;
    align-items: center;
    font-size: 0.85rem;
    gap: 0.5rem;
  }
  .timeline-legend .dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
  }

  /* Citizenship case */
  .case-section {
    background: var(--bg-card);
    padding: 1.5rem 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
    border-left: 5px solid var(--polish-red);
  }
  .case-section h3 { margin-top: 0; }
  .case-section.success { border-left-color: #2c7d2c; }
  .case-section.next { border-left-color: var(--gold); }
  .chain-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    background: var(--document);
    border-radius: 4px;
    overflow: hidden;
  }
  .chain-table th, .chain-table td {
    padding: 0.6rem 0.9rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
  }
  .chain-table th {
    background: var(--accent);
    color: white;
    font-family: var(--serif);
  }
  .chain-table tr:last-child td { border-bottom: none; }
  .chain-table tr.user { background: #fff3e8; }
  .evidence-list {
    list-style: none;
    counter-reset: evidence;
  }
  .evidence-list li {
    counter-increment: evidence;
    padding: 0.6rem 0 0.6rem 2.5rem;
    position: relative;
    border-bottom: 1px dotted var(--border);
  }
  .evidence-list li::before {
    content: counter(evidence);
    position: absolute;
    left: 0;
    top: 0.55rem;
    width: 1.75rem;
    height: 1.75rem;
    background: var(--accent);
    color: white;
    border-radius: 50%;
    text-align: center;
    line-height: 1.75rem;
    font-weight: bold;
    font-size: 0.85rem;
  }
  .next-steps {
    counter-reset: step;
    list-style: none;
  }
  .next-steps li {
    counter-increment: step;
    padding: 0.6rem 0 0.6rem 2.5rem;
    position: relative;
  }
  .next-steps li::before {
    content: counter(step);
    position: absolute;
    left: 0;
    top: 0.55rem;
    width: 1.75rem;
    height: 1.75rem;
    background: var(--gold);
    color: white;
    border-radius: 50%;
    text-align: center;
    line-height: 1.75rem;
    font-weight: bold;
    font-size: 0.85rem;
  }

  /* Modal */
  .modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
  }
  .modal-backdrop.active { display: flex; }
  .modal {
    background: var(--bg-card);
    border-radius: 8px;
    max-width: 600px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  }
  .modal-header {
    padding: 1.25rem 1.5rem;
    background: var(--accent);
    color: white;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .modal-header h3 {
    color: white;
    margin: 0;
    font-size: 1.3rem;
  }
  .modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
  }
  .modal-body { padding: 1.5rem; }
  .modal-body p { margin-bottom: 0.75rem; }

  /* Image lightbox */
  .lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.9);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    cursor: zoom-out;
  }
  .lightbox.active { display: flex; }
  .lightbox img {
    max-width: 95vw;
    max-height: 95vh;
    box-shadow: 0 10px 60px rgba(0,0,0,0.5);
  }

  footer {
    text-align: center;
    padding: 2rem;
    color: var(--ink-faint);
    font-size: 0.85rem;
    border-top: 1px solid var(--border);
    margin-top: 2rem;
  }
  footer code {
    background: var(--bg-soft);
    padding: 1px 6px;
    border-radius: 3px;
    font-family: monospace;
  }

  /* Responsive */
  @media (max-width: 768px) {
    header.site h1 { font-size: 1.8rem; }
    h2 { font-size: 1.5rem; }
    main { padding: 1rem; }
    .people-grid { grid-template-columns: 1fr; }
    nav.tabs li button { padding: 0.75rem 1rem; font-size: 0.85rem; }
    .node { width: 130px; min-height: 65px; padding: 0.45rem 0.55rem; }
    .node .node-name { font-size: 0.8rem; }
    .node .node-dates { font-size: 0.7rem; }
  }

  /* ===== Extras: família Martini ===== */
  :root { --italy-green: #1f7a3a; }
  .node.italian-born::before {
    content: "🇮🇹"; position: absolute; top: -10px; right: -10px; background: white;
    border-radius: 50%; width: 26px; height: 26px; display: flex; align-items: center;
    justify-content: center; box-shadow: var(--shadow); font-size: 0.85rem;
  }
  .person-card.italian-born { border-top-color: var(--italy-green); }
  .pedigree { padding-top: 2.25rem; }
  .node .node-ev { margin-top: 0.3rem; }
  .node .node-ev .badge { font-size: 0.6rem; }

  .badge {
    display: inline-block; font-family: var(--sans); font-size: 0.68rem; font-weight: 700;
    font-style: normal; padding: 1px 7px; border-radius: 10px; color: white;
    text-transform: uppercase; letter-spacing: 0.4px; vertical-align: middle; white-space: nowrap;
    background: #777;
  }
  .badge.ev-confirmado { background: #2c7d2c; }
  .badge.ev-provavel { background: #1f5f8b; }
  .badge.ev-tradicao { background: #7a4a9a; }
  .badge.ev-hipotese { background: #c0612b; }
  .badge.ev-ilustrativa { background: var(--ink-faint); }

  .finding { padding: 0.75rem 0; border-bottom: 1px dotted var(--border); }
  .finding:last-of-type { border-bottom: none; }
  .finding-title { font-family: var(--serif); font-weight: bold; color: var(--accent); margin-bottom: 0.25rem; }
  .plain-list { margin-left: 1.25rem; }
  .plain-list li { margin-bottom: 0.5rem; }
  .table-scroll { overflow-x: auto; }
  .chain-table tr.resolved td { color: var(--ink-soft); }
  .chain-table td { vertical-align: top; }

  a.cite { color: var(--accent); text-decoration: none; font-size: 0.85em; }
  a.cite:hover { text-decoration: underline; }

  .story-jump { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1.5rem; }
  .story-jump a {
    background: var(--gold); color: white; padding: 0.3rem 0.8rem; border-radius: 3px;
    text-decoration: none; font-size: 0.85rem; font-weight: 600;
  }
  .story-jump a:hover { background: var(--accent); }
  .figure-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem; margin-top: 1.25rem;
  }
  figure.fig {
    background: var(--bg-soft); border: 1px solid var(--border); border-radius: 6px;
    overflow: hidden; display: flex; flex-direction: column;
  }
  figure.fig img {
    width: 100%; height: 200px; object-fit: cover; cursor: zoom-in; display: block; background: var(--ink);
  }
  figure.fig figcaption { padding: 0.6rem 0.75rem; font-size: 0.8rem; color: var(--ink); line-height: 1.45; }
  figure.fig .credit { display: block; margin-top: 0.35rem; color: var(--ink-faint); font-size: 0.74rem; }
  figure.fig .credit a { color: var(--accent); }
  .images-note { font-size: 0.85rem; color: var(--ink-soft); font-style: italic; margin-top: 1rem; }

  .doc-body .doc-image-wrap img { cursor: zoom-in; }
  .doc-caption { font-size: 0.8rem; color: var(--ink-soft); margin-top: 0.4rem; }
  .doc-header .badge { margin-bottom: 0.4rem; }

  .person-card .fs-link { margin-top: 0.6rem; font-size: 0.85rem; }
  .person-card .fs-link a { color: var(--accent); }

  .sources-list { list-style: none; }
  .sources-list li {
    display: flex; gap: 0.6rem; padding: 0.5rem 0.4rem; border-bottom: 1px dotted var(--border);
    font-size: 0.9rem; word-break: break-word; transition: background 0.6s;
  }
  .sources-list li .src-n { font-weight: bold; color: var(--accent); min-width: 2.6rem; }
  .sources-list li a { color: var(--accent); word-break: break-all; }
  .sources-list li.flash { background: #fff1c9; }
  .case-section a { color: var(--accent); }

  .lightbox { flex-direction: column; }
  .lightbox-caption {
    color: #eee; max-width: 900px; text-align: center; font-size: 0.85rem; margin-top: 0.75rem;
  }
  .lightbox img { max-height: 85vh; }

  /* Stat cards: números longos (ex.: 29/12/1888) sempre cabem no cartão */
  .stats { grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr)); }
  .stat-card { min-width: 0; container-type: inline-size; }
  .stat-card .number {
    font-size: clamp(1.25rem, 4vw + 0.5rem, 2.2rem);
    font-size: clamp(1.1rem, 16cqi, 2.2rem);
    line-height: 1.15;
    overflow-wrap: anywhere;
    max-width: 100%;
  }
  .stat-card .label { overflow-wrap: break-word; }

  /* ===== Aviso de privacidade (LGPD) ===== */
  .privacy-notice {
    max-width: 1152px; margin: 1rem auto 0; padding: 0.75rem 1.1rem;
    background: var(--document); border: 1px solid var(--border); border-left: 4px solid var(--gold);
    border-radius: 0 6px 6px 0; font-size: 0.88rem; line-height: 1.5; color: var(--ink-soft);
    overflow-wrap: break-word; min-width: 0;
  }
  @media (max-width: 1200px) { .privacy-notice { margin-left: 1rem; margin-right: 1rem; } }
  .node.living { border-style: dashed; }

/* mobile: links longos e tabelas largas não estouram a tela */
a{overflow-wrap:anywhere;word-break:break-word}
@media (max-width:640px){table{display:block;max-width:100%;overflow-x:auto}}
