/* Atlas shell. Legacy ficha styles remain isolated in modelos/legacy. */
.atlas-header, .atlas-stage, .atlas-profile-actions, .atlas-notice { display: none; }
.atlas-enabled { --atlas-header-height: 68px; --atlas-sidebar-width: var(--leftPanelW, 380px); }
.atlas-enabled body { --atlas-bg: #111412; --atlas-surface: #191d19; --atlas-ink: #f0ece2; --atlas-muted: #b4b7ac; --atlas-line: #343b32; --atlas-accent: #cfb773; }
.atlas-enabled body.theme-light { --atlas-bg: #f4f1e8; --atlas-surface: #fffdf7; --atlas-ink: #272e27; --atlas-muted: #62695f; --atlas-line: #d9dacc; --atlas-accent: #816929; }
.atlas-enabled body { overflow: hidden; }
.atlas-enabled .atlas-header { display: flex; align-items:center; gap:24px; min-height:68px; position: fixed; inset: 0 0 auto; z-index: 10020; background: var(--atlas-bg); color: var(--atlas-ink); border-bottom: 1px solid var(--atlas-line); padding: 9px 78px 9px 24px; }
.atlas-brand { display: grid; flex-shrink:0; gap: 3px; text-decoration: none; color: inherit; }
.atlas-brand-kicker { font: 10px 'Hanken Grotesk', sans-serif; letter-spacing: .19em; color: var(--atlas-muted); }
.atlas-brand-title { font: 28px/1.15 'Instrument Serif', Georgia, serif; letter-spacing: -.02em; }
.atlas-sections { display: flex; flex-shrink:0; align-items: center; gap: 18px; font: 13px 'Hanken Grotesk', sans-serif; }
.atlas-sections a { color: var(--atlas-muted); text-decoration: none; }
.atlas-sections [aria-current] { color: var(--atlas-ink); }
.atlas-views { display: flex; align-items: center; gap: 18px; margin-right:auto; }
.atlas-views .compactLabel { margin: 0; color: var(--atlas-muted); font-size: 11px; }
.atlas-header .libraryViewToggle { display: flex; gap: 6px; background: none; border: 0; padding: 0; border-radius: 0; }
.atlas-header .libraryViewToggle :is(button, a) { background: transparent; color: var(--atlas-muted); border: 0; border-bottom: 2px solid transparent; border-radius: 0; box-shadow: none; padding: 12px 12px; font: 13px 'Hanken Grotesk', sans-serif; cursor: pointer; }
.atlas-header .libraryViewToggle :is(button, a).is-active { color: var(--atlas-ink); border-bottom-color: var(--atlas-accent); background: none; }
.atlas-header .libraryViewToggle :is(button, a) { flex: none; width: auto; white-space: nowrap; }
.atlas-enabled body::before, .atlas-enabled body::after { content: none !important; }
.atlas-enabled .accessEditorialAside::after, .atlas-enabled .landingMasthead::after { content: none !important; }
#atlasMobileView { color: var(--atlas-ink) !important; -webkit-text-fill-color: var(--atlas-ink) !important; background: var(--atlas-surface) !important; border: 1px solid var(--atlas-line) !important; opacity: 1; }
.atlas-header button:focus-visible, .atlas-view button:focus-visible, .atlas-profile-actions button:focus-visible { outline: 2px solid var(--atlas-accent); outline-offset: 2px; }
#atlasFiltersButton { flex-shrink:0; white-space:nowrap; border: 1px solid var(--atlas-line); background: transparent; color: var(--atlas-ink); padding: 8px 12px; border-radius: 5px; font: 12px 'Hanken Grotesk', sans-serif; cursor: pointer; }
.atlas-header .atlasLocaleSwitch { flex-shrink:0; border-color:var(--atlas-line); background:var(--atlas-surface); }
.atlas-header .atlasLocaleSwitch .localeSwitch__link { color:var(--atlas-muted); }
.atlas-header .atlasLocaleSwitch .localeSwitch__link:hover,
.atlas-header .atlasLocaleSwitch .localeSwitch__link:focus-visible { color:var(--atlas-ink); }
.atlas-mobile-view { display: none; }
.atlas-enabled body .app { position: fixed; inset: var(--atlas-header-height) 0 0; width: 100%; height: auto; max-height: none; padding: 0; display: block; }
.atlas-enabled body .app > .panel.left { position: absolute !important; inset: 0 auto 0 0 !important; width: var(--atlas-sidebar-width) !important; height: 100% !important; max-height: 100% !important; max-width: none; margin: 0; padding: 18px 18px 24px; border-right: 1px solid var(--atlas-line); border-radius: 0; transform: none !important; }
.atlas-enabled body .app > .panel.right { position: absolute !important; inset: 0 0 0 var(--atlas-sidebar-width) !important; width: auto !important; height: 100% !important; max-height: none !important; max-width: none; margin: 0; border-radius: 0; overflow-y: auto; transform: none; }
.atlas-enabled .appsHomeLink, .atlas-enabled #tmpsAppsNav, .atlas-enabled .nav-speed { display: none !important; }
.atlas-enabled body .authUserMenu { top: 17px; right: 24px; bottom: auto; z-index: 10030; }
.atlas-enabled .authMenuButton { width: 32px; height: 32px; }
.atlas-enabled .authMenuDropdown { top: 42px; bottom: auto; }
.atlas-enabled .atlas-stage:not([hidden]) { display: block; position: absolute; inset: 0; background: var(--atlas-bg); color: var(--atlas-ink); overflow: hidden; }
.atlas-enabled .atlas-spatial .app > .panel.left { display: none !important; }
.atlas-enabled .atlas-spatial.atlas-filters-open .app > .panel.left { display: block !important; z-index: 610; background: var(--atlas-bg); }
.atlas-enabled .atlas-spatial.atlas-filters-open .atlas-stage { left: var(--atlas-sidebar-width); }
.atlas-enabled .atlas-spatial .app > .panel.right { display: none !important; }
.atlas-enabled .atlas-spatial.atlas-profile-open .app > .panel.right { display: block !important; inset: 0 0 0 auto !important; width: min(500px, 43vw) !important; z-index: 620; background: var(--atlas-bg); border-left: 1px solid var(--atlas-line); box-shadow: -12px 0 40px #0003; }
.atlas-enabled .atlas-spatial.atlas-profile-open .atlas-stage { right: min(500px, 43vw); }
.atlas-enabled body.model-info-pending.atlas-spatial .app > .panel.right { display:none !important; }
.atlas-enabled body.model-info-pending.atlas-spatial .atlas-stage { right:0 !important; }
.atlas-enabled body.model-info-pending :is(.atlas-profile-actions,.modelCloseBtn) { display:none !important; }
.atlas-enabled body.infoFull:not(.atlas-spatial) .app > .panel.right { inset: 0 !important; z-index: 800; }
.atlas-enabled .atlas-profile-actions:not([hidden]) { display:flex; align-items:flex-start; flex-wrap:wrap; gap:6px; position:sticky; top:0; height:0; padding:0 14px; transform:translateY(12px); color:var(--atlas-ink); z-index:100; pointer-events:none; }
.atlas-profile-actions button { pointer-events:auto; font:600 11px 'Hanken Grotesk', sans-serif; padding:7px 10px; color:inherit; background:color-mix(in srgb,var(--atlas-bg) 82%,transparent); border:1px solid color-mix(in srgb,var(--atlas-line) 88%,transparent); border-radius:999px; box-shadow:0 5px 18px #0005; backdrop-filter:blur(10px); -webkit-backdrop-filter:blur(10px); cursor:pointer; }
#atlasCloseProfile { margin-left: auto; }
.atlas-enabled .atlas-notice:not([hidden]) { display: flex; gap: 14px; align-items: center; position: fixed; top: calc(var(--atlas-header-height) + 64px); left: 50%; transform: translateX(-50%); max-width: calc(100vw - 40px); z-index: 900; padding: 18px 22px; background: var(--atlas-surface); color: var(--atlas-ink); border: 1px solid var(--atlas-line); box-shadow: 0 10px 40px #0003; font-size: 13px; }
.atlas-notice button { cursor: pointer; padding: 8px 12px; }
.atlas-view { height: 100%; display: flex; flex-direction: column; min-width: 0; }
.atlas-view[hidden] { display: none !important; }
.atlas-view-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 12px 18px; border-bottom: 1px solid var(--atlas-line); background: var(--atlas-bg); font: 12px 'Hanken Grotesk', sans-serif; }
.atlas-view-tools > span:first-child { margin-right: auto; color: var(--atlas-muted); }
.atlas-view-tools button, .atlas-timebar button { background: var(--atlas-surface); color: var(--atlas-ink); border: 1px solid var(--atlas-line); border-radius: 4px; padding: 8px 10px; font: inherit; cursor: pointer; }
.atlas-view button:disabled { opacity: .4; cursor: default; }
.atlas-view-tools label { display: flex; align-items: center; gap: 5px; }
.atlas-view-tools select { width: auto; max-width: 180px; margin: 0; padding: 7px; color: var(--atlas-ink); background: var(--atlas-surface); border: 1px solid var(--atlas-line); font: inherit; }
.atlas-view-status { margin: 0; padding: 9px 18px; min-height: 34px; border-top: 1px solid var(--atlas-line); background: var(--atlas-bg); color: var(--atlas-muted); font: 11px/1.5 'Hanken Grotesk', sans-serif; }
.atlas-map-canvas { flex: 1; min-height: 130px; background: var(--atlas-bg); isolation: isolate; }
.atlas-map-marker { background: transparent; border: 0; }
.atlas-map-marker span { display: block; width: 14px; height: 14px; margin: 4px; border: 2px solid #fff; background: var(--marker-color); border-radius: 50%; box-shadow: 0 0 0 5px #0002, 0 3px 12px #0005; }
.atlas-map-marker.is-selected span { outline: 4px solid #e6c571; outline-offset: 3px; }
.atlas-map-cluster { display: grid; place-items: center; background: #262e27e8; border: 1px solid #c7b47c; border-radius: 50%; color: #fff8dc; font: 12px 'Inter', sans-serif; box-shadow: 0 0 0 5px #bba96a24; }
.atlas-map-canvas .leaflet-tooltip { white-space: normal; width: max-content; max-width: 260px; }
.atlas-timebar { display: flex; gap: 14px; align-items: center; padding: 12px 20px; background: var(--atlas-bg); border-top: 1px solid var(--atlas-line); font: 12px 'Hanken Grotesk', sans-serif; }
.atlas-timebar label { flex: 1; display: flex; gap: 10px; align-items: center; white-space: nowrap; }
.atlas-timebar input { width: 100%; min-width: 45px; accent-color: var(--atlas-accent); }
.atlas-timebar output { min-width: 4ch; font-variant-numeric: tabular-nums; }
.atlas-genealogy-scroll { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; cursor: grab; scrollbar-color: var(--atlas-line) var(--atlas-bg); }
.atlas-genealogy-scroll:active { cursor: grabbing; }
.atlas-genealogy-size { position: relative; }
.atlas-genealogy-world { position: absolute; inset: 0 auto auto 0; transform-origin: 0 0; }
.atlas-year line { stroke:var(--atlas-line); }
.atlas-year text { fill:var(--atlas-muted); font:11px Inter,sans-serif; }
.atlas-enabled body.theme-light .ed-ficha .ed-hero-inner .ed-title { color: #fbf6ee !important; }
@media (min-width: 981px) {
  .atlas-enabled body:not(.atlas-spatial) #atlasFiltersButton { display: none; }
}
@media (min-width:601px) and (max-width:1280px) {
  .atlas-enabled .atlas-header { gap:16px; }
  .atlas-brand-title { font-size:24px; }
  .atlas-views { display:none; }
  .atlas-mobile-view { display:flex; align-items:center; margin-right:auto; min-width:0; }
  .atlas-mobile-view > span { display:none; }
  .atlas-mobile-view select { width:160px; max-width:100%; margin:0; padding:8px; font:12px 'Hanken Grotesk',sans-serif; }
}
@media (max-width: 980px) {
  .atlas-enabled .atlas-header { padding: 9px 60px 9px 15px; gap:12px; }
  .atlas-brand-title { font-size: 24px; }
  .atlas-sections { display:none; }
  .atlas-enabled body .authUserMenu { right: 14px; top: 15px; }
  .atlas-enabled body .app > .panel.left { width: 100% !important; }
  .atlas-enabled body .app > .panel.right { display: none !important; }
  .atlas-enabled body.model-info-open:not([data-atlas-view="network"]) .app > .panel.right { display: block !important; inset: 0 !important; width: 100% !important; z-index: 700; }
  .atlas-enabled body[data-atlas-view="network"] .app > .panel.right { display: block !important; inset: 0 !important; width: 100% !important; }
  .atlas-enabled body[data-atlas-view="network"].atlas-filters-open .app > .panel.left { display: block !important; width: min(var(--atlas-sidebar-width), 92vw) !important; z-index: 710; background: var(--atlas-bg); }
  .atlas-enabled .atlas-spatial.atlas-filters-open .app > .panel.left { width: min(var(--atlas-sidebar-width), 92vw) !important; }
  .atlas-enabled .atlas-spatial .atlas-stage { left: 0 !important; right: 0 !important; }
  .atlas-enabled .atlas-spatial.atlas-profile-open .app > .panel.right { inset: 0 !important; width: 100% !important; }
  .atlas-enabled body.model-info-pending .app > .panel.right { display:none !important; }
  .atlas-enabled body.model-info-pending:not(.atlas-spatial) .app > .panel.left { display:block !important; }
  .atlas-enabled body.model-info-pending.atlas-spatial .app > .panel.left { display:none !important; }
  .atlas-enabled #btnInfoFull { display: none !important; }
  .atlas-view-tools { gap: 7px; padding: 10px; }
  .atlas-view-tools > span:first-child { flex-basis: 100%; }
}
@media (max-width: 600px) {
  .atlas-enabled .atlas-header { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:6px 12px; padding:8px 15px; }
  .atlas-brand { grid-column:1; grid-row:1; }
  .atlas-brand-title { font-size: 22px; }
  .atlas-brand-kicker { font-size: 9px; }
  .atlas-sections { display: none; }
  .atlas-header .atlasLocaleSwitch { grid-column:2; grid-row:1; margin-right:44px; justify-self:end; }
  .atlas-header .atlasLocaleSwitch .localeSwitch__link { min-width:29px; padding-inline:6px; }
  .atlas-views { display: none; }
  .atlas-mobile-view { grid-column:1; grid-row:2; display: flex; align-items: center; gap: 8px; color: var(--atlas-muted); font-size: 12px; }
  .atlas-mobile-view select { width: auto; max-width: 175px; margin: 0; padding: 7px 8px; color: var(--atlas-ink); background: var(--atlas-surface); border: 1px solid var(--atlas-line); font: 12px 'Hanken Grotesk', sans-serif; }
  #atlasFiltersButton { grid-column:2; grid-row:2; padding: 7px 8px; font-size: 11px; }
  .atlas-timebar { gap: 7px; padding: 10px; }
  .atlas-timebar label { flex-wrap: wrap; gap: 3px 7px; }
  .atlas-timebar input { flex-basis: 100%; }
  .atlas-view-status { padding: 8px 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .atlas-enabled *, .atlas-enabled *::before, .atlas-enabled *::after { scroll-behavior: auto !important; }
}

/* La red conserva la navegación principal por botones también en pantallas
   compactas; dentro de esta vista no se sustituye por un desplegable. */
@media (max-width:1280px) {
  .atlas-enabled body[data-atlas-view="network"] .atlas-views {
    display:flex;
    min-width:0;
    margin-right:auto;
    overflow-x:auto;
    scrollbar-width:none;
  }
  .atlas-enabled body[data-atlas-view="network"] .atlas-views::-webkit-scrollbar { display:none; }
  .atlas-enabled body[data-atlas-view="network"] .atlas-views > .compactLabel { display:none; }
  .atlas-enabled body[data-atlas-view="network"] .atlas-mobile-view { display:none; }
  .atlas-enabled body[data-atlas-view="network"] .atlas-header .libraryViewToggle {
    flex-wrap:nowrap;
    min-width:max-content;
  }
  .atlas-enabled body[data-atlas-view="network"] .atlas-header .libraryViewToggle :is(button, a) {
    padding:9px 8px;
    font-size:11px;
  }
}

/* La red dibuja sobre todo el escenario. Su ficha contextual es un rail
   superpuesto y no debe reservar espacio cuando está cerrada. */
.atlas-enabled body.network-mode .app > .panel.right {
  inset:0 !important;
  width:100% !important;
}

@media (max-width:600px) {
  .atlas-enabled body[data-atlas-view="network"] .atlas-header {
    display:flex;
    gap:10px;
    padding:7px 58px 7px 12px;
  }
  .atlas-enabled body[data-atlas-view="network"] .atlas-brand-title { font-size:20px; }
  .atlas-enabled body[data-atlas-view="network"] .atlas-brand-kicker { display:none; }
  .atlas-enabled body[data-atlas-view="network"] .atlas-views { grid-column:auto; grid-row:auto; }
  .atlas-enabled body[data-atlas-view="network"] .atlas-header .libraryViewToggle :is(button, a) {
    padding:8px 6px;
    font-size:10px;
  }
  .atlas-enabled body[data-atlas-view="network"] #atlasFiltersButton,
  .atlas-enabled body[data-atlas-view="network"] .atlasLocaleSwitch { display:none; }
}

@media (max-width:600px) {
  .atlas-enabled body[data-atlas-view="genealogy"] .atlas-header {
    display:flex;
    gap:6px;
    min-height:54px;
    padding:7px 54px 7px 10px;
  }
  .atlas-enabled body[data-atlas-view="genealogy"] .atlas-brand-kicker { display:none; }
  .atlas-enabled body[data-atlas-view="genealogy"] .atlas-brand-title { font-size:18px; white-space:nowrap; }
  .atlas-enabled body[data-atlas-view="genealogy"] .atlas-mobile-view { flex:0 0 auto; min-width:0; margin-left:auto; }
  .atlas-enabled body[data-atlas-view="genealogy"] .atlas-mobile-view > span { display:none; }
  .atlas-enabled body[data-atlas-view="genealogy"] .atlas-mobile-view select { width:104px; padding:6px; font-size:11px; }
  .atlas-enabled body[data-atlas-view="genealogy"] .atlasLocaleSwitch { flex:0 0 auto; margin-right:0; }
  .atlas-enabled body[data-atlas-view="genealogy"] #atlasFiltersButton { display:none; }
}

@media (max-width:350px) {
  .atlas-enabled body[data-atlas-view="genealogy"] .atlas-brand-title { font-size:0; }
  .atlas-enabled body[data-atlas-view="genealogy"] .atlas-brand-title::after { content:'Atlas'; font-size:18px; }
  .atlas-enabled body[data-atlas-view="genealogy"] .atlas-mobile-view select { width:96px; }
}
