/* ============================================================
   ADMINISTRACIÓN DE TERRITORIO — tema claro propio
   Sólo lo carga admin.html. El mapa público no depende de este archivo.
   Paleta costera: tinta (azul profundo), papel, mar (acciones),
   médano (positivo suave) y bengala (sólo para lo que necesita atención).
   ============================================================ */

:root {
  --ink: #193d50;
  --ink-2: #2a5468;
  --paper: #f6f7f2;
  --surface: #ffffff;
  --sea: #2b7a8c;
  --sea-dark: #1f5f6d;
  --sea-soft: #e3f0f2;
  --dune: #e7f1ea;
  --dune-ink: #24613b;
  --flare: #e8613a;
  --flare-soft: #fdece5;
  --flare-ink: #a63a17;
  --doubt: #fbf1dc;
  --doubt-ink: #7a5310;
  --text: #1d2a2f;
  --muted: #56676d;
  --line: #d9ded6;
  --line-soft: #e8ebe4;
  --focus: #2b7a8c;
  --radius: 12px;
  --radius-sm: 8px;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body.admin-body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { color: var(--ink); line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: 28px; margin: 0 0 6px; }
h2 { font-size: 22px; margin: 0 0 6px; }
h3 { font-size: 17px; margin: 0 0 4px; }
h4 { font-size: 15px; margin: 18px 0 8px; }
p { margin: 0 0 8px; }
a { color: var(--sea-dark); }
a:hover { color: var(--ink); }
code { font: 13px/1.45 ui-monospace, "Cascadia Mono", Consolas, monospace; overflow-wrap: anywhere; }

.muted { color: var(--muted); }
.lead { color: var(--muted); font-size: 17px; max-width: 70ch; margin: 0; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ---------- controles ---------- */

input, select, textarea {
  font: inherit; font-size: 15px; color: var(--text);
  background: var(--surface); border: 1px solid #b9c2bd; border-radius: var(--radius-sm);
  padding: 9px 11px; min-height: 42px; max-width: 100%;
}
textarea { min-height: 72px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(43, 122, 140, .35); outline-offset: 0; border-color: var(--sea); }
input[type="checkbox"], input[type="radio"] { min-height: 0; accent-color: var(--sea); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 42px; padding: 8px 16px; border-radius: var(--radius-sm);
  border: 1px solid #b9c2bd; background: var(--surface); color: var(--ink);
  font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; text-decoration: none;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.btn:hover { border-color: var(--ink-2); background: #f1f4ef; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--sea); border-color: var(--sea); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--sea-dark); border-color: var(--sea-dark); }
.btn.ok { background: var(--dune); border-color: #9cc7a8; color: var(--dune-ink); }
.btn.ok:hover:not(:disabled) { background: #d4e8da; }
.btn.warn { background: var(--doubt); border-color: #e2c27c; color: var(--doubt-ink); }
.btn.danger { background: var(--surface); border-color: #e7a58f; color: var(--flare-ink); }
.btn.danger:hover:not(:disabled) { background: var(--flare-soft); }
.btn.quiet { background: transparent; border-color: transparent; color: var(--sea-dark); padding-left: 10px; padding-right: 10px; }
.btn.quiet:hover:not(:disabled) { background: var(--sea-soft); border-color: transparent; }
.btn.armed { background: var(--ink); border-color: var(--ink); color: #fff; }
.link-button {
  appearance: none; border: 0; background: none; padding: 6px 2px; min-height: 36px;
  color: var(--sea-dark); font: inherit; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}

.msg { padding: 9px 12px; border-radius: var(--radius-sm); }
.msg.ok { background: var(--dune); color: var(--dune-ink); }
.msg.err { background: var(--flare-soft); color: var(--flare-ink); }
.msg.warn { background: var(--doubt); color: var(--doubt-ink); }

.field { display: block; margin: 14px 0 5px; font-size: 14px; font-weight: 600; color: var(--ink); }

/* ---------- ingreso ---------- */

.login-view { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card {
  width: 100%; max-width: 400px; padding: 28px 26px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 18px 40px rgba(25, 61, 80, .08);
}
.login-brand { margin: 0 0 4px; color: var(--sea-dark); font-weight: 700; font-size: 14px; }
.login-card h1 { font-size: 26px; }
.login-card input { width: 100%; }
.login-submit { width: 100%; margin-top: 18px; }
.login-recovery-links { margin-top: 12px; text-align: center; }
#login-error { min-height: 22px; margin: 10px 0 0; color: var(--flare-ink); font-size: 14px; }
.login-recovery-message { min-height: 22px; margin: 14px 0 6px; font-size: 14px; }
.backlink { margin: 14px 0 0; text-align: center; font-size: 14px; }

/* ---------- barra superior y navegación ---------- */

.topbar {
  position: sticky; top: 0; z-index: 500;
  display: flex; align-items: center; gap: 18px;
  padding: 0 20px; min-height: 64px;
  background: var(--ink); color: #fff;
}
.topbar-brand { display: flex; flex-direction: column; line-height: 1.15; flex: none; }
.topbar-brand strong { font-size: 18px; }
.topbar-brand span { font-size: 12.5px; color: #b9d3dc; }
.mainnav { display: flex; gap: 4px; flex: 1; justify-content: center; }
.mainnav .tab {
  position: relative; display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 8px 14px; border: 0; border-radius: 10px;
  background: transparent; color: #d9e8ed; font: inherit; font-size: 15px; font-weight: 600; cursor: pointer;
}
.mainnav .tab:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.mainnav .tab.active { background: #fff; color: var(--ink); }
.mainnav .tab:focus-visible { outline-color: #9fd6e2; }
.nav-ico {
  display: inline-block; width: 20px; height: 20px; flex: none; background: currentColor;
  -webkit-mask: var(--ico) center / contain no-repeat; mask: var(--ico) center / contain no-repeat;
}
.nav-badge {
  min-width: 22px; padding: 1px 7px; border-radius: 999px;
  background: var(--flare); color: #fff; font-size: 12px; font-weight: 700; text-align: center; line-height: 18px;
}
.topbar-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.topbar-link { color: #d9e8ed; font-size: 14px; padding: 8px 10px; border-radius: 8px; text-decoration: none; }
.topbar-link:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.topbar .btn.quiet { color: #d9e8ed; }
.topbar .btn.quiet:hover { color: #fff; background: rgba(255, 255, 255, .08); }

/* ---------- secciones ---------- */

.main { max-width: 1320px; margin: 0 auto; padding: 28px 24px 64px; }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.view-head > div { min-width: 0; }
.count-line { margin: 0 0 12px; color: var(--muted); font-size: 14px; }
.count-line:empty { display: none; }
.panel-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 22px; margin-bottom: 20px;
}
.empty { padding: 28px 20px; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }
.empty p { margin-bottom: 10px; }

.toolbar {
  display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end;
  padding: 14px; margin-bottom: 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.toolbar-search { flex: 1 1 280px; }
.toolbar-search input { width: 100%; }
.toolbar-field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: var(--muted); flex: 0 1 200px; min-width: 150px; }
.toolbar-field select { width: 100%; }

.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 42%); gap: 20px; align-items: start; }
.split-map { position: sticky; top: 84px; }
.map-box { height: 460px; border: 1px solid var(--line); border-radius: var(--radius); background: #e9ece6; overflow: hidden; }
.map-note { margin: 8px 2px 0; color: var(--muted); font-size: 14px; }

.more-button { margin: 12px auto 0; display: flex; }

/* píldoras de estado */
.state-pill {
  display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: var(--line-soft); color: var(--muted);
}
.state-pill.is-ready, .state-pill.is-approved { background: var(--dune); color: var(--dune-ink); }
.state-pill.is-pending { background: var(--doubt); color: var(--doubt-ink); }
.state-pill.is-off, .state-pill.is-rejected { background: #eceeea; color: #4f5a5d; }

/* detalles técnicos: siempre cerrados y en segundo plano */
.tech { margin-top: 8px; font-size: 13px; color: var(--muted); }
.tech > summary { cursor: pointer; width: fit-content; padding: 2px 0; color: var(--muted); }
.tech > summary:hover { color: var(--ink); }
.tech dl { margin: 8px 0 0; padding: 10px 12px; background: #f3f5f1; border-radius: var(--radius-sm); }
.tech dl > div { display: grid; grid-template-columns: minmax(120px, 38%) minmax(0, 1fr); gap: 10px; padding: 3px 0; }
.tech dt { font-weight: 600; }
.tech dd { margin: 0; overflow-wrap: anywhere; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; }

/* ícono de capa (mismos SVG locales que el mapa público) */
.layer-glyph {
  display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 50%;
  background: var(--glyph-color, #5b6b70);
}
.layer-glyph i {
  display: block; width: 20px; height: 20px; background: #fff;
  -webkit-mask: var(--ico) center / contain no-repeat; mask: var(--ico) center / contain no-repeat;
}

/* ---------- Lugares ---------- */

.place-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.place-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: start; padding: 14px 16px; border-top: 1px solid var(--line-soft); }
.place-row:first-child { border-top: 0; }
.place-row.is-selected { background: var(--sea-soft); }
.place-main h3 { margin: 0; font-size: 17px; }
.place-meta, .place-line { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.place-meta span::before { content: "en "; }
.place-meta span { margin-left: 4px; }
.place-line span + span::before { content: ""; display: inline-block; width: 1px; height: 12px; margin: 0 8px; background: var(--line); vertical-align: -1px; }
.place-line.is-empty { font-style: italic; }
.place-main .state-pill { margin-top: 6px; }
.place-actions { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }

/* Leaflet: pines con ícono de capa */
.cat-pin > span {
  box-sizing: border-box; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  border: 2.5px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .25), 0 2px 6px rgba(0, 0, 0, .35);
}
.cat-pin-glyph {
  display: block; width: 15px; height: 15px; background: #fff;
  -webkit-mask: var(--layer-icon) center / contain no-repeat; mask: var(--layer-icon) center / contain no-repeat;
}
.cat-pin.is-selected > span { transform: scale(1.35); box-shadow: 0 0 0 4px rgba(232, 97, 58, .55), 0 2px 8px rgba(0, 0, 0, .4); }
.mdd-pin span { display: block; width: 17px; height: 17px; border-radius: 50%; border: 2.5px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .25), 0 2px 6px rgba(0, 0, 0, .35); }
.mdd-report-pin > span { width: 22px; height: 22px; }
.mdd-tag { display: inline-block; padding: 3px 10px; border-radius: 999px; color: #fff; font-size: 12px; font-weight: 700; }
.leaflet-container { font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.leaflet-popup-content { margin: 12px 14px; }
.mdd-popup p { margin: 6px 0 0; }

/* ---------- Capas ---------- */

.layer-group { margin-bottom: 12px; }
.layer-group > h2 { font-size: 17px; margin: 0; font-weight: 700; }
.layer-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.layer-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line-soft); }
.layer-row:first-child { border-top: 0; }
.layer-row.is-off .layer-glyph { filter: grayscale(1); opacity: .55; }
.layer-main h3 { margin: 0; font-size: 16px; }
.layer-main p { margin: 0; color: var(--muted); font-size: 14px; }
.layer-main p span { margin-left: 10px; color: var(--doubt-ink); }
.layer-actions { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; justify-content: flex-end; }
.icon-up, .icon-down { min-width: 64px; }

.switch { display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 8px; cursor: pointer; font-size: 14px; font-weight: 600; color: var(--ink); }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch i { position: relative; width: 42px; height: 24px; border-radius: 999px; background: #c5ccc7; transition: background .15s ease; flex: none; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .15s ease; }
.switch input:checked + i { background: var(--sea); }
.switch input:checked + i::after { transform: translateX(18px); }
.switch input:focus-visible + i { outline: 3px solid var(--focus); outline-offset: 2px; }
.switch span { min-width: 9.5em; }

/* ---------- Reportes ---------- */

.segmented { display: inline-flex; padding: 3px; background: #e9ece6; border-radius: 10px; }
.seg { min-height: 40px; padding: 6px 14px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font: inherit; font-weight: 600; cursor: pointer; }
.seg.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(25, 61, 80, .15); }

#report-list { display: flex; flex-direction: column; gap: 10px; }
.report-group > h2 { margin: 0; font-size: 17px; }
.report-group-list { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }

/* Grupos plegables del Admin (Capas, Fuentes y Reportes): la cabecera entera es un botón. Ver admin-plegable.js. */
.fold-heading { margin: 0; }
.fold-toggle {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 8px 12px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface);
  font: inherit; font-weight: 700; color: var(--ink); text-align: left; cursor: pointer;
}
.fold-toggle:hover { background: #f4f6f1; }
.fold-toggle:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.fold-chevron { flex: none; width: 9px; height: 9px; margin: 0 3px 0 2px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); }
.fold-toggle[aria-expanded="true"] .fold-chevron { transform: rotate(45deg); margin-top: -4px; }
.fold-title { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.fold-count { flex: none; padding: 1px 9px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--line-soft); color: var(--muted); white-space: nowrap; }
.fold-body { margin-top: 8px; }
.fold-tools { display: flex; justify-content: flex-end; gap: 6px; margin-bottom: 8px; }
.fold-tools .btn { padding: 4px 10px; font-size: 13px; }
.report-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.report-card.is-pending { border-color: #f0c9bb; background: #fffaf8; }
.report-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.report-cat { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px 4px 8px; border-radius: 999px; background: var(--cat); color: #fff; font-weight: 700; font-size: 14px; }
.report-cat .report-category-glyph { width: 18px; height: 18px; background: #fff; }
.report-desc { margin: 10px 0 8px; font-size: 16px; white-space: pre-wrap; overflow-wrap: anywhere; }
.report-facts { margin: 0; display: grid; gap: 2px; font-size: 14px; }
.report-facts > div { display: flex; gap: 8px; }
.report-facts dt { color: var(--muted); min-width: 7.5em; }
.report-facts dd { margin: 0; }
.report-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.tools-box h2 { font-size: 16px; }
.tools-box { margin-top: 16px; padding: 14px; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }

/* ---------- Fuentes: bandeja de revisión ---------- */

.inbox-head h1 { font-size: 30px; }
.kind-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.kind-tab {
  display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 6px 14px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink);
  font: inherit; font-size: 15px; font-weight: 600; cursor: pointer;
}
.kind-tab b { min-width: 24px; padding: 0 6px; border-radius: 999px; background: var(--line-soft); font-size: 13px; text-align: center; }
.kind-tab:hover { border-color: var(--ink-2); }
.kind-tab.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.kind-tab.active b { background: rgba(255, 255, 255, .2); }

.inbox { display: grid; grid-template-columns: minmax(300px, 400px) minmax(0, 1fr); gap: 20px; align-items: start; }
.inbox-list { min-width: 0; }
.inbox-detail { min-width: 0; position: sticky; top: 84px; max-height: calc(100vh - 100px); overflow: auto; border-radius: var(--radius); }

.prio { margin-bottom: 18px; }
.prio > h2 { margin: 0; font-size: 17px; }
.prio > h2 .fold-title::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 8px; border-radius: 50%; }
.prio-atencion > h2 .fold-title::before { background: var(--flare); }
.prio-facil > h2 .fold-title::before { background: #4f9a66; }
.prio-duplicado > h2 .fold-title::before { background: #c0577a; }
.prio-riesgo > h2 .fold-title::before { background: #d9a441; }
.prio-capa > h2 .fold-title::before { border-radius: 2px; background: var(--sea-dark); }

/* revisión por lote: una tarjeta en lugar de muchas filas iguales */
.lote-card { margin: 0 0 10px; padding: 14px 16px; background: var(--dune); border: 1px solid #b9d8c3; border-radius: var(--radius); }
.lote-card.is-selected { box-shadow: inset 4px 0 0 var(--sea); }
.lote-card h3 { margin: 6px 0 2px; font-size: 18px; color: var(--dune-ink); }
.lote-source, .lote-why { margin: 0; font-size: 14px; color: var(--text); }
.lote-why { color: var(--muted); }
.lote-examples { list-style: none; margin: 10px 0 0; padding: 0; background: var(--surface); border-radius: var(--radius-sm); }
.lote-examples li { display: grid; gap: 1px; padding: 8px 12px; font-size: 14px; }
.lote-examples li + li { border-top: 1px solid var(--line-soft); }
.lote-examples span { color: var(--muted); overflow-wrap: anywhere; }
.lote-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.lote-filter { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; padding: 10px 14px; background: var(--dune); border-radius: var(--radius-sm); }
.lote-filter p { margin: 0; }
.lote-conditions { margin: 14px 0 0; padding: 12px 14px 12px 32px; background: var(--dune); border-radius: var(--radius-sm); color: var(--dune-ink); font-size: 15px; }
.lote-conditions li + li { margin-top: 4px; }
.lote-all { margin-top: 14px; font-size: 14px; }
.lote-all > summary { cursor: pointer; color: var(--sea-dark); font-weight: 600; }
.lote-all ul { max-height: 260px; overflow: auto; margin: 8px 0 0; padding-left: 20px; overflow-wrap: anywhere; }
.lote-confirm { display: flex; align-items: flex-start; gap: 10px; margin: 0 0 12px; font-weight: 600; cursor: pointer; }
.lote-confirm input { width: 20px; height: 20px; margin-top: 2px; flex: none; }
.kind-tag.kind-lote { background: #d4e8da; color: var(--dune-ink); }
.notice.why strong { font-weight: 700; }
.case-provenance a { margin-left: 6px; font-weight: 600; color: var(--sea-dark); }
.prio-hint { margin: 2px 0 8px; color: var(--muted); font-size: 14px; }
.prio ul { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.prio li + li { border-top: 1px solid var(--line-soft); }
.case-row {
  display: grid; gap: 2px; width: 100%; padding: 12px 14px; text-align: left;
  border: 0; background: transparent; color: var(--text); font: inherit; cursor: pointer;
}
.case-row:hover { background: #f4f6f1; }
.case-row.is-selected { background: var(--sea-soft); box-shadow: inset 4px 0 0 var(--sea); }
.case-row strong { font-size: 16px; color: var(--ink); overflow-wrap: anywhere; }
.case-meta { color: var(--muted); font-size: 14px; }
.case-reason { font-size: 14px; color: var(--text); }

.kind-tag { justify-self: start; display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 700; background: var(--line-soft); color: var(--ink-2); }
.kind-tag.kind-nuevo { background: var(--sea-soft); color: var(--sea-dark); }
.kind-tag.kind-cambio { background: #eef0fb; color: #3c4a8a; }
.kind-tag.kind-duplicado { background: var(--flare-soft); color: var(--flare-ink); }
.kind-tag.kind-ausente { background: #eceeea; color: #4f5a5d; }
.kind-tag.kind-dudas { background: var(--doubt); color: var(--doubt-ink); }
.kind-tag.kind-historica { margin-left: 6px; background: #e4e6e2; color: #4f5a5d; }
.kind-tag.kind-capa { background: #e3eef0; color: var(--sea-dark); }

.detail-empty { padding: 36px 28px; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); }
.detail-empty h2 { font-size: 20px; }

.case { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px 18px; }
.back-button { display: none; margin: -6px 0 8px -10px; }
.case-head h2 { margin: 8px 0 2px; font-size: 26px; overflow-wrap: anywhere; }
.case-head h2:focus { outline: none; }
.case-where { margin: 0; color: var(--muted); font-size: 15px; }
.case-where span { display: block; color: var(--text); }
.case-headline { margin: 10px 0 0; font-size: 17px; font-weight: 600; color: var(--ink); }
.case-provenance { list-style: none; margin: 14px 0 0; padding: 10px 14px; background: #f3f5f1; border-radius: var(--radius-sm); font-size: 14px; color: var(--muted); }
.case-provenance li + li { margin-top: 2px; }
.case-provenance li:first-child { color: var(--ink); font-weight: 600; }

.notice { margin: 14px 0 0; padding: 10px 14px; border-radius: var(--radius-sm); font-size: 15px; }
.notice.is-quiet { background: #eceeea; color: #3f4b4e; }
.notice.is-attention { background: var(--flare-soft); color: var(--flare-ink); }
.notice.is-block { background: var(--doubt); color: var(--doubt-ink); font-weight: 700; }
.notice.is-ok { background: var(--dune); color: var(--dune-ink); }

/* comparación lado a lado: lo memorable de la pantalla */
.compare { margin-top: 20px; }
.compare-head { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 0 2px 6px; font-size: 14px; font-weight: 700; color: var(--muted); }
.compare-head span:last-child { color: var(--sea-dark); }
.cmp-row { padding: 14px 0 16px; border-top: 1px solid var(--line); }
.cmp-row h3 { font-size: 15px; margin: 0 0 8px; color: var(--muted); }
.cmp-values { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.cmp-current, .cmp-proposed { min-width: 0; padding: 10px 12px; border-radius: var(--radius-sm); font-size: 16px; overflow-wrap: anywhere; }
.cmp-current { background: #f3f5f1; }
.cmp-proposed { background: var(--sea-soft); }
.cmp-current p, .cmp-proposed p { margin: 0; }
.cmp-values .is-empty { color: var(--muted); font-style: italic; }
.cmp-label { display: none; font-size: 12.5px; font-weight: 700; color: var(--muted); margin-bottom: 2px; }
.cmp-explain { position: relative; margin: 10px 0 0; font-size: 15px; font-weight: 600; padding-left: 20px; --mark: var(--line); }
.cmp-explain::before { content: ""; position: absolute; left: 2px; top: .45em; width: 10px; height: 10px; border-radius: 50%; background: var(--mark); }
.cmp-row.kind-distinto .cmp-explain { --mark: var(--flare); color: var(--flare-ink); }
.cmp-row.kind-igual .cmp-explain { --mark: #6fae82; color: var(--dune-ink); }
.cmp-row.kind-completa .cmp-explain, .cmp-row.kind-compatible .cmp-explain { --mark: var(--sea); color: var(--sea-dark); }
.cmp-row.kind-dudoso .cmp-explain, .cmp-row.kind-cerca .cmp-explain { --mark: #d9a441; color: var(--doubt-ink); }
.cmp-authority { margin: 6px 0 0 16px; font-size: 14px; color: var(--ink-2); }
.cmp-suggest { margin: 6px 0 0 16px; font-size: 14px; color: var(--muted); }
.cmp-same { margin: 8px 0 0 16px; font-size: 14px; color: var(--dune-ink); }
.cmp-choice { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.cmp-choice label {
  display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 6px 14px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; font-weight: 600; font-size: 15px;
}
.cmp-choice label:has(input:checked) { border-color: var(--sea); background: var(--sea-soft); color: var(--sea-dark); }
.cmp-choice input { width: 18px; height: 18px; }

.found-box { margin-top: 18px; }
.found-box h3, .related h3, .case-map h3 { font-size: 16px; }
.found-layer { margin: 0 0 6px; }
.found { margin: 0; display: grid; gap: 4px; }
.found > div { display: grid; grid-template-columns: minmax(110px, 30%) minmax(0, 1fr); gap: 10px; }
.found dt { color: var(--muted); }
.found dd { margin: 0; overflow-wrap: anywhere; }

.related { margin-top: 18px; }
.related ul { list-style: none; margin: 8px 0 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.related li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 10px 12px; }
.related li + li { border-top: 1px solid var(--line-soft); }
.related li > span { grid-column: 1; color: var(--muted); font-size: 14px; }
.related li > b { grid-column: 2; grid-row: 1; color: var(--ink); font-size: 14px; white-space: nowrap; }
.candidates li.candidate { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
.candidate > div { display: grid; gap: 1px; min-width: 0; }
.candidate > div span { color: var(--muted); font-size: 14px; }
.candidate .distance { grid-column: 2; grid-row: 1; justify-self: end; font-size: 15px; color: var(--flare-ink); }
.candidate .btn { grid-column: 1 / -1; justify-self: start; margin-top: 6px; }
#fu-both { margin-top: 4px; }

.case-map { margin-top: 20px; }
.case-map .map-box { height: 300px; }
.case-nomap { margin-top: 16px; font-size: 14px; }
.map-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; list-style: none; margin: 8px 0 0; padding: 0; font-size: 14px; color: var(--muted); }
.map-legend li { display: inline-flex; align-items: center; gap: 6px; }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .3); }
.dot.is-territory, .fu-pin.is-territory span { background: var(--ink); }
.dot.is-source, .fu-pin.is-source span { background: var(--flare); }
.dot.is-other, .fu-pin.is-other span { background: #8f9a95; }
.dot.is-picked, .fu-pin.is-picked span { background: var(--sea); }
.fu-pin span { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .3), 0 2px 6px rgba(0, 0, 0, .35); color: #fff; font: 700 12px/1 system-ui, sans-serif; }
.fu-pin.is-other span { width: 16px; height: 16px; margin: 2px; }
.fu-distance { background: var(--ink); color: #fff; border: 0; font-weight: 700; }
.fu-distance::before { display: none; }

.decision { margin-top: 20px; padding: 16px; background: #f3f5f1; border-radius: var(--radius-sm); }
.decision-summary { margin: 0 0 12px; font-size: 16px; font-weight: 600; color: var(--ink); }
.decision-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.choice-help { margin: 0 0 12px; padding-left: 18px; font-size: 14px; }
.choice-help li + li { margin-top: 4px; }
.case-message { margin: 12px 0 0; }
.case-message:empty { display: none; }

.sources-overview { margin-top: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; }
.sources-overview > summary { cursor: pointer; font-weight: 600; color: var(--ink); }
.table-wrap { overflow-x: auto; margin-top: 10px; }
.sources-overview table { width: 100%; border-collapse: collapse; font-size: 14px; }
.sources-overview th, .sources-overview td { text-align: left; padding: 8px 10px; border-top: 1px solid var(--line-soft); vertical-align: top; }
.sources-overview thead th { border-top: 0; color: var(--muted); font-weight: 600; }

/* herramientas técnicas de Fuentes (vista previa «¿Están todos?») */
.tech-tools { margin-top: 24px; padding: 12px 16px; background: #eef1ec; border: 1px solid var(--line); border-radius: var(--radius); }
.tech-tools > summary { cursor: pointer; font-weight: 600; color: var(--muted); }
.tech-tools[open] > summary { margin-bottom: 8px; }
.source-integrity { margin-top: 10px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.source-integrity > header p { color: var(--muted); font-size: 14px; }
.source-preview-form > label { display: block; margin-bottom: 5px; font-weight: 600; font-size: 14px; }
.source-preview-form input { width: 100%; }
.source-preview-filters { margin: 12px 0 0; padding: 10px 12px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); min-width: 0; }
.source-preview-filters > legend { padding: 0 6px; font-weight: 700; font-size: 14px; }
.source-preview-filters p { font-size: 14px; }
.source-preview-filters summary { cursor: pointer; color: var(--muted); font-size: 14px; }
.source-preview-filter { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 6px; align-items: center; margin-top: 6px; color: var(--muted); }
.source-preview-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
#source-preview-message { margin: 10px 0 0; }
#source-preview-result:not(:empty) { margin-top: 12px; }
.source-preview-progress { margin-top: 12px; }
.source-preview-progress progress { display: block; width: 100%; height: 8px; accent-color: var(--sea); }
.source-preview-progress p { margin: 6px 0 0; font-weight: 700; }
.source-runs-integrity { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.source-run-when { margin: 0 0 4px; color: var(--muted); font-size: 13px; }
.integrity-card { margin: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); overflow: hidden; }
.integrity-card > div { display: grid; grid-template-columns: minmax(96px, 38%) minmax(0, 1fr); gap: 10px; padding: 7px 12px; border-top: 1px solid var(--line-soft); }
.integrity-card > div:first-child { border-top: 0; }
.integrity-card dt { margin: 0; color: var(--muted); font-size: 13px; font-weight: 600; align-self: center; }
.integrity-card dd { margin: 0; font-size: 14px; overflow-wrap: anywhere; }
.integrity-card .integrity-state dd { font-weight: 700; }
.integrity-card.is-complete .integrity-state dd { color: var(--dune-ink); }
.integrity-card.is-incomplete .integrity-state dd { color: var(--flare-ink); }
.integrity-card.is-unknown .integrity-state dd { color: var(--doubt-ink); }
.integrity-card.is-progress .integrity-state dd { color: var(--sea-dark); }

/* ---------- Embebido ---------- */

.embed-grid { display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); gap: 20px; align-items: start; }
.embed-controls input[type="text"], .embed-controls select { width: 100%; }
.choice-list { margin: 18px 0 0; padding: 0; border: 0; min-width: 0; }
.choice-list > legend { padding: 0; margin-bottom: 6px; font-weight: 600; color: var(--ink); font-size: 14px; }
.choice-list label, .embed-module-option { display: flex; align-items: flex-start; gap: 10px; padding: 8px 4px; cursor: pointer; }
.choice-list label span, .embed-module-option span { display: grid; }
.choice-list small, .embed-module-option small { color: var(--muted); font-size: 13px; }
.choice-list input { margin-top: 4px; width: 18px; height: 18px; }
.embed-module-option.is-disabled { opacity: .55; }
.embed-controls > .btn { margin-top: 18px; width: 100%; }
.embed-preview-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.embed-preview-head h2 { font-size: 18px; }
.embed-preview-shell { height: 460px; margin-top: 8px; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: #e9ece6; }
.embed-preview-shell iframe { width: 100%; height: 100%; border: 0; }
.copy-block { margin-top: 16px; }
.copy-block > div { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.copy-block h3 { font-size: 15px; margin: 0; }
.copy-block code { display: block; margin-top: 6px; padding: 10px 12px; background: #f3f5f1; border-radius: var(--radius-sm); }

.switch-list { margin-top: 10px; }
.switch-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line-soft); cursor: pointer; }
.switch-row span { display: grid; }
.switch-row small { color: var(--muted); font-size: 14px; }
.switch-row input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-row i { position: relative; width: 42px; height: 24px; border-radius: 999px; background: #c5ccc7; transition: background .15s ease; }
.switch-row i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .15s ease; }
.switch-row input:checked + i { background: var(--sea); }
.switch-row input:checked + i::after { transform: translateX(18px); }
.switch-row input:focus-visible + i { outline: 3px solid var(--focus); outline-offset: 2px; }
.switch-row.select-row { cursor: default; }
.switch-row.select-row label { display: grid; cursor: pointer; }
.switch-row.select-row select { min-width: 132px; }

.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; }

/* ---------- Mi cuenta ---------- */

.account-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 20px; margin-bottom: 20px; }
.account-grid .panel-card { margin-bottom: 0; }
.big-value { font-size: 19px; font-weight: 600; color: var(--ink); margin: 6px 0 2px; overflow-wrap: anywhere; }
.pending-value { margin: 6px 0; color: var(--doubt-ink); }
.inline-form > div { display: flex; flex-wrap: wrap; gap: 8px; }
.inline-form input { flex: 1 1 220px; }
.inline-form p { margin-top: 8px; font-size: 14px; }
.stack-form { display: grid; }
.stack-form input, .stack-form select { width: 100%; }
.stack-form > .btn { margin-top: 16px; justify-self: start; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.add-admin-form { margin: 16px 0; padding: 14px; background: #f3f5f1; border-radius: var(--radius-sm); }
.administrators-list { margin-top: 12px; }
.administrator-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line-soft); }
.administrator-identity { display: grid; min-width: 0; }
.administrator-identity strong { overflow-wrap: anywhere; }
.administrator-identity span { color: var(--muted); font-size: 14px; }
.administrator-badges, .administrator-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.recovery-code-once { display: block; margin: 12px 0; padding: 14px; background: #f3f5f1; border-radius: var(--radius-sm); font-size: 18px; letter-spacing: .04em; text-align: center; }

/* ---------- ventanas ---------- */

.modal {
  position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center;
  padding: 16px; background: rgba(25, 61, 80, .45);
}
.modal-box {
  width: 100%; max-width: 480px; max-height: 92vh; overflow: auto;
  padding: 22px 24px; background: var(--surface); border-radius: 16px; box-shadow: 0 24px 60px rgba(25, 61, 80, .25);
}
.modal-box.is-wide { max-width: 980px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 4px; }
.modal-head h2 { margin: 0; }
.form-section { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.form-section:first-child { border-top: 0; padding-top: 0; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 12px; margin-top: 10px; }
.form-grid label span, .form-wide span { display: block; margin-bottom: 4px; font-size: 14px; font-weight: 600; color: var(--ink); }
.form-grid input, .form-grid select, .form-wide textarea { width: 100%; }
.form-wide { display: block; margin-top: 12px; }
.check-line { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-weight: 600; }
.check-line input { width: 18px; height: 18px; }
.geometry-tools { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin: 8px 0; }
.geometry-tools p { margin: 0; color: var(--muted); font-size: 14px; }
#layer-item-map { height: 340px; }
#layer-item-duplicate-warning { margin-top: 10px; }

/* ---------- pantallas medianas y celulares ---------- */

@media (max-width: 1099px) {
  .inbox { grid-template-columns: 1fr; }
  .inbox-detail { position: static; max-height: none; overflow: visible; display: none; }
  .inbox.is-detail-open .inbox-list { display: none; }
  .inbox.is-detail-open .inbox-detail { display: block; }
  .back-button { display: inline-flex; }
}

@media (max-width: 1100px) {
  .topbar { gap: 10px; padding: 0 14px; }
  .mainnav .tab { padding: 8px 10px; }
  .topbar-link { display: none; }
}

@media (max-width: 900px) {
  .split { grid-template-columns: 1fr; }
  .split-map { position: static; order: -1; }
  .map-box { height: 300px; }
  .embed-grid { grid-template-columns: 1fr; }
}

/* Celular: la navegación pasa a una barra fija abajo, con ícono y nombre. */
@media (max-width: 760px) {
  body.admin-body { font-size: 16px; }
  h1 { font-size: 24px; }
  .inbox-head h1 { font-size: 24px; }
  .lead { font-size: 16px; }
  .topbar { min-height: 56px; justify-content: space-between; }
  .mainnav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 600;
    display: grid; grid-template-columns: repeat(8, minmax(46px, 1fr)); gap: 0; overflow-x: auto;
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
    background: var(--ink); box-shadow: 0 -2px 10px rgba(0, 0, 0, .18);
  }
  .mainnav .tab { flex-direction: column; gap: 2px; min-height: 56px; padding: 6px 1px; font-size: 11px; border-radius: 8px; min-width: 0; }
  .mainnav .tab span { line-height: 1.1; text-align: center; }
  .nav-ico { width: 22px; height: 22px; }
  .nav-badge { position: absolute; top: 2px; left: 52%; min-width: 18px; padding: 0 5px; font-size: 11px; line-height: 16px; }
  .main { padding: 18px 16px calc(96px + env(safe-area-inset-bottom)); }
  .view-head { flex-direction: column; align-items: stretch; gap: 12px; }
  .view-head .btn { align-self: flex-start; }
  .toolbar { padding: 12px; }
  .toolbar-field { flex: 1 1 140px; }
  .place-row { grid-template-columns: auto minmax(0, 1fr); padding: 12px; }
  .place-actions { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; }
  .place-actions .btn { flex: 1 1 140px; }
  .layer-row { grid-template-columns: auto minmax(0, 1fr); padding: 12px; }
  .layer-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .switch span { min-width: 0; }
  .case { padding: 16px 14px; }
  .case-head h2 { font-size: 22px; }
  .compare-head { display: none; }
  .cmp-values { grid-template-columns: 1fr; gap: 8px; }
  .cmp-label { display: block; }
  .decision-actions .btn { flex: 1 1 100%; }
  .administrator-row { grid-template-columns: 1fr; }
  .modal { align-items: flex-end; padding: 0; }
  .modal-box { max-height: 94vh; border-radius: 16px 16px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
  .embed-preview-shell { height: 380px; }
  .tech dl > div { grid-template-columns: 1fr; gap: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ---------- Capas: crear y editar ---------- */

.modal-box.is-medium { max-width: 640px; }
.icon-picker, .color-picker { margin: 18px 0 0; padding: 0; border: 0; min-width: 0; }
.icon-picker > legend, .color-picker > legend { padding: 0; margin-bottom: 8px; font-weight: 600; color: var(--ink); font-size: 14px; }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; max-height: 260px; overflow: auto; padding: 2px; }
.icon-choice {
  position: relative; display: grid; justify-items: center; gap: 4px; padding: 10px 4px 8px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; text-align: center;
}
.icon-choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.icon-choice i { display: block; width: 26px; height: 26px; background: var(--ink); -webkit-mask: var(--ico) center / contain no-repeat; mask: var(--ico) center / contain no-repeat; }
.icon-choice span { font-size: 12.5px; line-height: 1.2; color: var(--muted); }
.icon-choice.is-checked { border-color: var(--sea); background: var(--sea-soft); box-shadow: inset 0 0 0 1px var(--sea); }
.icon-choice.is-checked i { background: var(--sea-dark); }
.icon-choice.is-checked span { color: var(--sea-dark); font-weight: 600; }
.icon-choice:has(input:focus-visible), .color-choice:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.color-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.color-choice { position: relative; width: 36px; height: 36px; border-radius: 50%; background: var(--swatch); border: 3px solid #fff; box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.color-choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.color-choice.is-checked { outline: 3px solid var(--ink); outline-offset: 1px; }
.layer-preview { display: flex; align-items: center; gap: 12px; margin-top: 16px; padding: 10px 12px; background: #f3f5f1; border-radius: var(--radius-sm); font-weight: 600; color: var(--ink); }
.layer-main p .layer-kind { margin-left: 10px; color: var(--muted); }
/* Admin → Lugares: la lista general arranca plegada (los filtros, el buscador y el mapa siguen a la vista). */
.places-folded { padding: 18px 16px; text-align: center; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }
.places-folded p { margin: 0 0 12px; }
.places-folded .btn, .places-hide-list { min-height: 44px; }
.places-hide-list { margin: 0 0 10px; }
/* Buscador de ubicación del mini-mapa (sólo índice local; buscar no agrega nada). */
.map-search { margin: 0 0 10px; }
.map-search-row { display: flex; gap: 8px; }
.map-search-row input { flex: 1 1 auto; min-width: 0; min-height: 44px; }
.map-search-row .btn { flex: 0 0 auto; min-height: 44px; }
.map-search-msg { margin: 8px 0 0; font-size: 14px; }
.map-search-msg:empty { display: none; }
.map-search-msg.is-ok { color: var(--dune-ink); }
.map-search-msg.is-attention { color: var(--flare-ink); }
.map-search-msg .btn { margin-top: 6px; }
.map-search-results { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 4px; }
.map-search-results .btn { width: 100%; justify-content: flex-start; text-align: left; }
.map-search-help { margin: 6px 0 0; font-size: 13px; }
.dot.is-provisional, .fu-pin.is-provisional span { background: #fff; color: var(--sea-dark); border: 3px dashed var(--sea-dark); }
/* Fechas de un caso: la de la fuente y las de Territorio, separadas y en lenguaje simple. */
.case-dates { margin: 10px 0 0; padding: 10px 12px; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); background: #f7f8f5; }
.case-dates dl { display: grid; gap: 6px; margin: 6px 0 0; }
.case-dates dl > div { display: grid; grid-template-columns: minmax(150px, 38%) 1fr; gap: 8px; }
.case-dates dt { color: var(--muted); font-size: 14px; }
.case-dates dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.case-dates dd small { display: block; font-weight: 400; color: var(--muted); font-size: 13px; }
.case-presence { margin: 0; font-size: 14px; font-weight: 600; }
.case-presence.presence-antes, .case-presence.presence-ausente { color: var(--flare-ink); }
.case-dates-short { display: block; font-size: 13px; color: var(--muted); }
.compare-dates { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 6px 0 10px; font-size: 13px; color: var(--muted); }
@media (max-width: 640px) { .case-dates dl > div { grid-template-columns: 1fr; gap: 0; } }
/* Nueva capa sugerida: cada salida es un bloque propio dentro de la decisión. */
.proposal-option { margin: 0 0 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.proposal-option legend { padding: 0 4px; font-weight: 700; }
.proposal-option input, .proposal-option select { width: 100%; margin-bottom: 8px; }
/* Fuentes que alimentan una capa (Admin → Capas). */
.layer-sources { margin-top: 22px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #f7f8f5; }
.layer-sources h3 { font-size: 15px; }
.layer-sources p { font-size: 14px; }
.layer-sources-list { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 8px; }
.layer-sources-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius-sm); }
.layer-sources-list li span { display: block; font-size: 13px; color: var(--muted); }
.layer-sources-add { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; }
.layer-sources-add .field { flex: 1 1 100%; }
.layer-sources-add select { flex: 1 1 220px; }
.danger-zone { margin-top: 22px; padding: 14px; border: 1px solid #f0c9bb; border-radius: var(--radius-sm); background: #fffaf8; }
.danger-zone h3 { font-size: 15px; color: var(--flare-ink); }
.danger-zone p { font-size: 14px; }
.stack-form input[type="radio"], .stack-form input[type="checkbox"] { width: 18px; height: 18px; flex: none; }
.stack-form .choice-list label { align-items: flex-start; }

/* ---------- Servicios ---------- */

.services-global { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.services-global h2 { font-size: 18px; }
.services-global p { margin: 0; max-width: 60ch; }
.service-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); gap: 16px; }
.service-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; display: grid; align-content: start; gap: 8px; }
.service-card.is-disabled { background: #fafbf8; }
.service-card > header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.service-card > header h2 { font-size: 18px; margin: 0; }
.service-card > p { margin: 0; color: var(--text); }
.service-facts { margin: 4px 0; display: grid; gap: 4px; font-size: 14px; }
.service-facts > div { display: grid; grid-template-columns: minmax(110px, 32%) minmax(0, 1fr); gap: 8px; }
.service-facts dt { color: var(--muted); }
.service-facts dd { margin: 0; }
.seg-field { margin: 4px 0 0; padding: 0; border: 0; min-width: 0; }
.seg-field > legend { padding: 0; margin-bottom: 6px; font-size: 14px; font-weight: 600; color: var(--ink); }
.seg-options { display: inline-flex; flex-wrap: wrap; padding: 3px; background: #e9ece6; border-radius: 10px; }
.seg-option { position: relative; display: inline-flex; align-items: center; min-height: 38px; padding: 4px 14px; border-radius: 8px; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg-option input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg-option.is-checked { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(25, 61, 80, .15); }
.seg-option.is-blocked { opacity: .5; cursor: not-allowed; }
.seg-option:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 1px; }
.service-switch { padding-left: 0; }
.service-switch.is-disabled { opacity: .6; cursor: not-allowed; }
.service-help { margin: -4px 0 4px; color: var(--muted); font-size: 13.5px; }
.service-now { margin: 0; font-size: 14px; font-weight: 600; color: var(--ink-2); }
.service-actions { display: flex; gap: 8px; }
.service-test-result:empty { display: none; }

/* ---------- pulido de usabilidad: duplicados, nuevos y cambios ---------- */

.case-question { margin: 20px 0 6px; font-size: 20px; color: var(--ink); }
.case-question.is-secondary { font-size: 17px; }
.main-candidate { margin: 8px 0 10px; font-size: 16px; }
.pin-letter { display: inline-grid; place-items: center; width: 22px; height: 22px; margin-right: 6px; border-radius: 50%; color: #fff; font-size: 12px; font-weight: 700; vertical-align: -2px; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .25); }
.pin-letter.is-source { background: var(--flare); }
.pin-letter.is-territory { background: var(--ink); }
.dup-compare { margin-top: 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.dup-head, .dup-row { display: grid; grid-template-columns: minmax(90px, 16%) minmax(0, 1fr) minmax(0, 1fr) minmax(110px, 18%); gap: 10px; padding: 9px 12px; align-items: start; }
.dup-head { background: #f3f5f1; font-size: 13.5px; font-weight: 700; color: var(--muted); }
.dup-row { border-top: 1px solid var(--line-soft); font-size: 15px; }
.dup-label { color: var(--muted); font-weight: 600; }
.dup-a, .dup-b { overflow-wrap: anywhere; }
.dup-a small, .dup-b small { display: none; }
.dup-a em, .dup-b em { color: var(--muted); }
.dup-verdict { font-weight: 700; font-size: 14px; }
.dup-row.v-same .dup-verdict { color: var(--dune-ink); }
.dup-row.v-compatible .dup-verdict { color: var(--sea-dark); }
.dup-row.v-different .dup-verdict { color: var(--flare-ink); }
.dup-row.v-unknown .dup-verdict { color: var(--muted); }
.dup-row.v-distance { grid-template-columns: minmax(90px, 16%) minmax(0, 1fr); background: #fafbf8; }
.dup-distance { font-weight: 700; color: var(--ink); }
.dup-reasons { margin-top: 12px; }
.dup-reasons h4 { margin: 0 0 6px; font-size: 15px; }
.dup-reasons ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.dup-reasons li { position: relative; padding-left: 22px; font-size: 15px; }
.dup-reasons li::before { position: absolute; left: 0; top: 0; font-weight: 700; }
.dup-reasons li.tone-a-favor::before { content: "✓"; color: var(--dune-ink); }
.dup-reasons li.tone-en-contra::before { content: "✗"; color: var(--flare-ink); }
.dup-reasons li.tone-neutro::before { content: "?"; color: var(--muted); }
.dup-reasons .muted { margin: 6px 0 0; font-size: 13.5px; }
#fu-both { margin-top: 8px; }
.checks, .preview { margin-top: 18px; }
.checks h3, .preview h3 { font-size: 16px; }
.checks dl, .preview dl { margin: 6px 0 0; display: grid; gap: 4px; }
.checks dl > div, .preview dl > div { display: grid; grid-template-columns: minmax(150px, 55%) minmax(0, 1fr); gap: 10px; font-size: 15px; }
.preview dl > div { grid-template-columns: minmax(90px, 25%) minmax(0, 1fr); }
.checks dt, .preview dt { color: var(--muted); }
.checks dd, .preview dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.preview { padding: 12px 14px; background: var(--sea-soft); border-radius: var(--radius-sm); }
.preview em { color: var(--muted); font-weight: 400; }
.decision-note { margin: 10px 0 0; font-size: 14px; }
.row-tag { display: inline-block; margin-left: 6px; padding: 1px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 700; vertical-align: 1px; background: var(--line-soft); color: var(--ink-2); }
.row-tag.tag-completa, .row-tag.tag-ampliado { background: var(--dune); color: var(--dune-ink); }
.row-tag.tag-igual { background: #eef3ef; color: var(--dune-ink); }
.row-tag.tag-distinto { background: var(--flare-soft); color: var(--flare-ink); }
.row-tag.tag-dudoso, .row-tag.tag-cerca, .row-tag.tag-parcial { background: var(--doubt); color: var(--doubt-ink); }
.legend-distance strong { color: var(--ink); }

@media (max-width: 760px) {
  .dup-head { display: none; }
  .dup-row { grid-template-columns: 1fr auto; gap: 2px 10px; }
  .dup-label { grid-column: 1; }
  .dup-verdict { grid-column: 2; grid-row: 1; text-align: right; }
  .dup-a, .dup-b { grid-column: 1 / -1; }
  .dup-a small, .dup-b small { display: inline-grid; place-items: center; width: 18px; height: 18px; margin-right: 6px; border-radius: 50%; color: #fff; font-size: 11px; font-weight: 700; }
  .dup-a small { background: var(--flare); }
  .dup-b small { background: var(--ink); }
  .dup-row.v-distance { grid-template-columns: 1fr; }
  .checks dl > div, .preview dl > div { grid-template-columns: 1fr; gap: 0; }
}

/* Lugares → Posibles conflictos (lugar existente contra lugar existente; assets/js/admin-conflictos.js). */
.view-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.view-actions .nav-badge { position: static; margin-left: 6px; }
.conflicts-root { max-width: 1100px; }
.pc-top { margin-bottom: 8px; }
.pc-title { margin: 4px 0 6px; font-size: 1.35rem; line-height: 1.25; overflow-wrap: anywhere; }
.pc-lead { max-width: 70ch; margin: 0 0 14px; }
.pc-vs { color: var(--muted); font-weight: 400; }
.pc-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.pc-tab { min-height: 44px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--text); font: inherit; cursor: pointer; }
.pc-tab.is-on { background: var(--ink); border-color: var(--ink); color: #fff; }
.pc-n { font-weight: 700; }
.pc-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.pc-card { display: grid; gap: 4px; width: 100%; min-height: 44px; padding: 12px 14px; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); font: inherit; cursor: pointer; }
.pc-card:hover, .pc-card:focus-visible { border-color: var(--sea); box-shadow: 0 0 0 2px var(--sea-soft); }
.pc-card-top, .pc-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.pc-names { overflow-wrap: anywhere; }
.pc-meta, .pc-reason { color: var(--muted); font-size: .92rem; }
.pc-reason { color: var(--text); }
.pc-hidden { font-style: normal; font-size: .8rem; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 0 6px; }
.pc-level, .pc-tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .8rem; font-weight: 700; line-height: 1.5; }
.pc-level.is-alta { background: var(--flare-soft); color: var(--flare-ink); }
.pc-level.is-media { background: var(--doubt); color: var(--doubt-ink); }
.pc-level.is-baja { background: var(--sea-soft); color: var(--sea-dark); }
.pc-tag { background: var(--line-soft); color: var(--ink-2); font-weight: 600; }
.pc-tag.is-hint { background: var(--doubt); color: var(--doubt-ink); }
.pc-why { margin: 12px 0; padding: 12px 14px; background: var(--sea-soft); border-radius: var(--radius); }
.pc-why p { margin: 0 0 6px; }
.pc-why ul { margin: 0 0 8px; padding-left: 20px; }
.pc-why-title { font-weight: 700; }
.pc-map-wrap { margin: 12px 0; }
.pc-map { height: 300px; border-radius: var(--radius); border: 1px solid var(--line); }
.pc-distance { margin: 8px 0 0; overflow-wrap: anywhere; }
.pc-letter { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--flare); color: #fff; font-weight: 700; font-size: 12px; vertical-align: middle; }
.pc-letter.is-b, .pc-place.is-b .pc-letter { background: var(--ink); }
.pc-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 12px 0; }
.pc-place { min-width: 0; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.pc-place.is-a { border-color: var(--flare); }
.pc-place.is-b { border-color: var(--ink); }
.pc-place h3 { margin: 0 0 8px; font-size: 1.05rem; overflow-wrap: anywhere; }
.pc-place dl { margin: 0; }
.pc-row { display: grid; grid-template-columns: 9.5em 1fr; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line-soft); }
.pc-row dt { color: var(--muted); font-size: .88rem; }
.pc-row dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.pc-rel { display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: 999px; font-size: .75rem; font-weight: 700; }
.pc-row.is-same .pc-rel { background: var(--dune); color: var(--dune-ink); }
.pc-row.is-diff .pc-rel { background: var(--doubt); color: var(--doubt-ink); }
.pc-row.is-empty .pc-rel { background: var(--line-soft); color: var(--muted); }
.pc-row.is-diff dd { font-weight: 600; }
.pc-decide { margin: 14px 0; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.pc-decide h3 { margin: 0 0 10px; font-size: 1.05rem; }
.pc-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.pc-buttons .btn { min-height: 44px; }
.pc-confirm { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.pc-wrong { margin: 8px 0; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.pc-radio { display: flex; gap: 8px; align-items: center; min-height: 40px; overflow-wrap: anywhere; }
.pc-notes { display: grid; gap: 4px; margin: 8px 0; }
.pc-notes input { min-height: 44px; width: 100%; box-sizing: border-box; }
.pc-tech { margin: 12px 0; }
.pc-tech table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: .85rem; }
.pc-tech th, .pc-tech td { padding: 4px 6px; border-top: 1px solid var(--line-soft); text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.pc-tech th { width: 38%; color: var(--muted); font-weight: 600; }
@media (max-width: 760px) {
  .pc-compare { grid-template-columns: 1fr; }
  .pc-row { grid-template-columns: 1fr; gap: 0; }
  .pc-map { height: 240px; }
  .pc-buttons .btn { flex: 1 1 100%; }
}

/* Lugares → Estado del lugar (visible / oculto / archivado) y borrado seguro (assets/js/admin-ciclo.js). */
.state-pill.is-archived { background: var(--line-soft); color: var(--ink-2); }
.lc h3 { margin-bottom: 8px; }
.lc-states { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 6px; }
.lc-state { display: grid; grid-template-columns: 18px 1fr; gap: 8px; align-items: start; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--muted); }
.lc-state.is-on { border-color: var(--sea); background: var(--sea-soft); color: var(--text); }
.lc-dot { width: 12px; height: 12px; margin-top: 4px; border-radius: 50%; border: 2px solid var(--line); }
.lc-state.is-on .lc-dot { background: var(--sea); border-color: var(--sea); }
.lc-now { font-style: normal; font-size: .8rem; font-weight: 700; color: var(--sea-dark); }
.lc-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.lc-actions .btn { min-height: 44px; }
.lc-confirm { margin: 8px 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.lc-confirm p { margin: 0 0 8px; }
.lc-note { display: grid; gap: 4px; }
.lc-note input { min-height: 44px; width: 100%; box-sizing: border-box; }
.lc-history { margin: 10px 0; }
.lc-history ul { margin: 6px 0 0; padding-left: 18px; }
.lc-history li { margin-bottom: 4px; overflow-wrap: anywhere; }
/* Zona de borrado: separada del resto y claramente destructiva. */
.lc-danger { margin-top: 22px; padding: 12px 14px; border: 1px solid #e3a69a; border-radius: var(--radius-sm); background: var(--flare-soft); }
.lc-danger h4 { margin: 0 0 6px; color: var(--flare-ink); }
.lc-danger p { margin: 0 0 10px; }
.lc-danger .btn { min-height: 44px; }
.lc-check { margin-top: 10px; }
.lc-deps { margin: 6px 0 10px; padding-left: 18px; }
.lc-deps li.is-block { font-weight: 700; color: var(--flare-ink); }
/* Fuentes: coincide con un lugar archivado. */
.archived-match .archived-place { overflow-wrap: anywhere; }
.archived-pick { margin: 8px 0; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.archived-pick label { display: flex; gap: 8px; align-items: flex-start; min-height: 40px; overflow-wrap: anywhere; }
@media (max-width: 760px) {
  .lc-actions .btn { flex: 1 1 100%; }
  .lc-danger .btn { width: 100%; }
}
.lc-danger.is-pending { background: var(--line-soft); border-color: var(--line); }
.lc-danger.is-pending h4 { color: var(--ink-2); }

/* ---------- Analíticas (ver admin-analiticas.js) ---------- */

.ana-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-bottom: 14px; }
.ana-fresh { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.ana-updated { font-size: 14px; }
.ana-custom { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; padding: 14px; margin-bottom: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.ana-date { display: grid; gap: 4px; font-size: 14px; font-weight: 600; color: var(--ink); }
.ana-custom-msg { flex: 1 1 100%; margin: 0; color: var(--flare-ink); font-size: 14px; }
.ana-status { margin-bottom: 14px; }
.ana-status:empty { display: none; }
.ana-status.is-error { padding: 16px 18px; background: var(--flare-soft); border: 1px solid #f0c9bb; border-radius: var(--radius); color: var(--flare-ink); }
.ana-error-title { font-weight: 700; margin-bottom: 4px; }
.ana-error-detail { font-size: 14px; }
.ana-status.is-error .btn { margin-top: 8px; }
.ana-content.is-loading { opacity: .55; }
.ana-range { margin: 0 0 10px; font-size: 14px; }

/* Resumen: siempre visible. */
.ana-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.ana-card { min-width: 0; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.ana-card-label { margin: 0 0 6px; font-size: 14px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.ana-card-value { margin: 0 0 6px; font-size: 32px; line-height: 1.1; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.ana-card-value.is-none { font-size: 20px; font-weight: 600; color: var(--muted); }
.ana-card .ana-chip { margin-bottom: 6px; }
.ana-card-change, .ana-card-hint { margin: 0; font-size: 13.5px; color: var(--muted); }
.ana-card-change.is-good { color: var(--dune-ink); }
.ana-card-change.is-bad { color: var(--flare-ink); }
.ana-chip { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.ana-chip.is-good { background: var(--dune); color: var(--dune-ink); }
.ana-chip.is-needs-improvement { background: var(--doubt); color: var(--doubt-ink); }
.ana-chip.is-poor { background: var(--flare-soft); color: var(--flare-ink); }

/* Evolución: gráfico SVG liviano; los rótulos son texto normal para que se lean en cualquier ancho. */
.ana-chart-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-bottom: 14px; }
.ana-chart-head h2 { margin: 0; font-size: 18px; }
.ana-chart-head p { margin: 0; font-size: 14px; }
.ana-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0 0 0 auto; padding: 0; list-style: none; font-size: 14px; color: var(--muted); }
.ana-legend li::before { content: ""; display: inline-block; width: 14px; height: 3px; margin-right: 6px; vertical-align: middle; border-radius: 2px; background: var(--sea); }
.ana-legend li.is-pageViews::before { background: #8ea4ad; }
.ana-plot { display: flex; gap: 8px; }
.ana-yaxis { display: flex; flex-direction: column; justify-content: space-between; flex: none; min-width: 2.2em; height: 200px; font-size: 12px; line-height: 1; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.ana-yaxis span:first-child { margin-top: -5px; }
.ana-yaxis span:last-child { margin-bottom: -5px; }
.ana-canvas { flex: 1 1 auto; min-width: 0; }
.ana-svg { display: block; width: 100%; height: 200px; overflow: visible; }
.ana-grid { stroke: var(--line-soft); stroke-width: 1; vector-effect: non-scaling-stroke; }
.ana-line { fill: none; stroke: var(--sea); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.ana-line.is-pageViews { stroke: #8ea4ad; stroke-width: 2; }
.ana-area { fill: var(--sea-soft); stroke: none; opacity: .75; }
.ana-dots { fill: none; stroke: var(--sea); stroke-width: 6; stroke-linecap: round; }
.ana-dots.is-pageViews { stroke: #8ea4ad; stroke-width: 5; }
.ana-zone { fill: transparent; }
.ana-zone:hover { fill: rgba(25, 61, 80, .06); }
.ana-xaxis { display: flex; justify-content: space-between; margin-top: 8px; font-size: 12px; color: var(--muted); }
.ana-chart-data { margin-top: 12px; }
.ana-chart-data summary { min-height: 32px; cursor: pointer; color: var(--sea-dark); font-weight: 600; }
.ana-chart-data .ana-table-wrap { max-height: 320px; overflow: auto; margin-top: 8px; }
.ana-notes { margin-bottom: 18px; }
.ana-notes p { margin: 0 0 4px; font-size: 13.5px; }

/* Secciones plegables (mismo patrón que Capas, Fuentes y Reportes). */
.ana-sections { display: flex; flex-direction: column; gap: 8px; }
.ana-section > h2 { margin: 0; font-size: 17px; }
.ana-section-body { padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.ana-block { min-width: 0; }
.ana-block + .ana-block { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line-soft); }
.ana-block h3 { margin: 0 0 8px; font-size: 16px; }
.ana-block-state { margin: 0; color: var(--muted); }
.ana-block-note { margin: 8px 0 0; font-size: 13.5px; }
.ana-table-wrap { overflow-x: auto; }
.ana-table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.ana-table th, .ana-table td { padding: 8px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: top; font-weight: 400; }
.ana-table thead th { font-size: 13px; font-weight: 600; color: var(--muted); border-bottom-color: var(--line); }
.ana-table tbody tr:last-child > * { border-bottom: 0; }
.ana-table .is-text { text-align: left; overflow-wrap: anywhere; color: var(--text); }
.ana-table thead .is-text { color: var(--muted); }
.ana-table .is-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ana-table thead .is-num { white-space: normal; }
.ana-table .is-muted { color: var(--muted); }
.ana-share-bar { display: block; height: 4px; max-width: 100%; margin: 4px 0 0 auto; border-radius: 2px; background: var(--sea); }
.ana-vitals { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.ana-vital { min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.ana-vital-head h4 { margin: 0; font-size: 16px; }
.ana-vital-head p { margin: 2px 0 10px; font-size: 13.5px; }
.ana-vital-main { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 10px; }
.ana-vital-value { margin: 0; font-size: 26px; line-height: 1.1; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.ana-dist { display: flex; gap: 2px; height: 8px; overflow: hidden; border-radius: 4px; background: var(--line-soft); }
.ana-dist i { display: block; min-width: 0; }
.ana-dist .is-good, .ana-dist-legend .is-good::before { background: #5fa777; }
.ana-dist .is-needs-improvement, .ana-dist-legend .is-needs-improvement::before { background: #d9a441; }
.ana-dist .is-poor, .ana-dist-legend .is-poor::before { background: var(--flare); }
.ana-dist-legend { display: flex; flex-wrap: wrap; gap: 2px 12px; margin: 6px 0 10px; padding: 0; list-style: none; font-size: 13px; color: var(--muted); }
.ana-dist-legend li::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 5px; border-radius: 50%; }
.ana-vital-percentiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 0; }
.ana-vital-percentiles dt { font-size: 12px; color: var(--muted); }
.ana-vital-percentiles dd { margin: 0; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.ana-facts { display: grid; margin: 0; }
.ana-facts > div { display: grid; grid-template-columns: minmax(140px, 260px) minmax(0, 1fr); gap: 2px 16px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.ana-facts > div:last-child { border-bottom: 0; }
.ana-facts dt { color: var(--muted); }
.ana-facts dd { margin: 0; overflow-wrap: anywhere; }

@media (max-width: 1100px) {
  .ana-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .ana-periods { display: flex; width: 100%; }
  .ana-periods .seg { flex: 1 1 auto; min-height: 44px; padding: 6px 8px; }
  .ana-fresh { width: 100%; margin-left: 0; justify-content: space-between; }
  .ana-custom .ana-date { flex: 1 1 130px; }
  .ana-custom .ana-date input { width: 100%; }
  .ana-custom .btn { flex: 1 1 100%; }
  .ana-card { padding: 12px 14px; }
  .ana-card-value { font-size: 26px; }
  .ana-legend { width: 100%; margin-left: 0; }
  .ana-svg, .ana-yaxis { height: 160px; }
  .ana-xaxis span:nth-child(even) { display: none; }
  .ana-section-body { padding: 12px; }
  .ana-table { font-size: 14px; }
  .ana-table th, .ana-table td { padding: 7px 6px; }
  .ana-facts > div { grid-template-columns: 1fr; }
}
/* Con ocho secciones, en celulares angostos los nombres de la barra inferior van un punto más chicos para no tocarse. */
@media (max-width: 430px) {
  .mainnav .tab { font-size: 10px; letter-spacing: -.01em; }
  .mainnav .tab span { white-space: nowrap; }
}
@media (max-width: 380px) {
  .ana-summary { gap: 8px; }
  .ana-card { padding: 10px 12px; }
  .ana-card-value { font-size: 22px; }
  .ana-periods .seg { padding: 6px 5px; font-size: 14px; }
}

/* ---------- Fuentes: «Buscar novedades ahora» y «Revisión automática» (ver admin-barrido.js) ---------- */

.fu-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px 8px; flex: none; }
.fu-actions-help { margin: -8px 0 14px; font-size: 14px; max-width: 80ch; }
.fu-actions-help strong { color: var(--ink); font-weight: 600; }
.sweep { margin-bottom: 14px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--sea); border-radius: var(--radius); }
.sweep.has-errors { border-left-color: var(--flare); }
.sweep.is-ok { border-left-color: #6fae82; }
.sweep-title { margin: 0 0 4px; font-size: 18px; font-weight: 700; color: var(--ink); }
.sweep-current { margin: 0 0 10px; overflow-wrap: anywhere; }
.sweep-bar { display: block; width: 100%; height: 10px; margin: 0 0 10px; accent-color: var(--sea); }
.sweep-hint { margin: 0; font-size: 13.5px; }
.sweep-notice { margin: 4px 0 10px; padding: 9px 12px; border-radius: var(--radius-sm); background: var(--doubt); color: var(--doubt-ink); }
.sweep-summary { margin: 8px 0 10px; padding: 0 0 0 20px; }
.sweep-summary li { margin-bottom: 3px; }
.sweep-summary .is-error { color: var(--flare-ink); font-weight: 600; }
.sweep-news { font-weight: 600; color: var(--ink); }
.sweep-breakdown { font-weight: 400; color: var(--muted); }
.sweep-details { margin: 8px 0; }
.sweep-details > summary { min-height: 32px; cursor: pointer; color: var(--sea-dark); font-weight: 600; }
.sweep-details ul { margin: 6px 0 0; padding-left: 20px; font-size: 14px; }
.sweep-details li { margin-bottom: 5px; overflow-wrap: anywhere; }
.sweep-details li span { color: var(--muted); }
.sweep-close { margin-top: 6px; }
.sweep-auto { margin-bottom: 14px; padding: 12px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.sweep-auto-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.sweep-auto-label { font-weight: 600; color: var(--ink); }
.sweep-auto-select { min-width: 12em; }
.sweep-auto-dates { display: flex; flex-wrap: wrap; gap: 4px 28px; margin: 10px 0 6px; font-size: 14px; }
.sweep-auto-dates > div { display: flex; gap: 6px; min-width: 0; }
.sweep-auto-dates dt { color: var(--muted); }
.sweep-auto-dates dd { margin: 0; font-weight: 600; color: var(--ink); }
.sweep-auto-note { margin: 0; font-size: 13.5px; max-width: 90ch; }
.sweep-auto-note.is-warn { padding: 8px 12px; border-radius: var(--radius-sm); background: var(--doubt); color: var(--doubt-ink); }
.sweep-auto-status { min-height: 0; margin: 6px 0 0; font-size: 14px; color: var(--dune-ink); }
.sweep-auto-status:empty { display: none; }
.sweep-auto-status.is-error { color: var(--flare-ink); }

@media (max-width: 760px) {
  .fu-actions { justify-content: stretch; }
  .fu-actions .btn { flex: 1 1 100%; align-self: stretch; }
  .fu-actions-help { margin-top: 0; }
  .sweep { padding: 14px; }
  .sweep-auto-row { align-items: stretch; flex-direction: column; }
  .sweep-auto-select { width: 100%; }
  .sweep-auto-dates { flex-direction: column; gap: 4px; }
  .sweep-auto-dates > div { flex-wrap: wrap; }
}

/* Barra superior con ocho secciones y contadores: en pantallas medianas se ajusta para que ningún nombre se parta en dos renglones. */
@media (min-width: 1101px) {
  .mainnav .tab span { white-space: nowrap; }
}
@media (min-width: 1101px) and (max-width: 1400px) {
  .topbar { gap: 10px; }
  .mainnav { gap: 2px; }
  .mainnav .tab { padding: 8px 9px; gap: 6px; }
}

/* En el celular la barra inferior puede deslizarse; no muestra una barra de desplazamiento propia. */
@media (max-width: 760px) {
  .mainnav { scrollbar-width: none; }
  .mainnav::-webkit-scrollbar { display: none; }
}

/* ---------- Fuentes: «Para después» (casos apartados; siguen pendientes) ---------- */

.kind-tab.kind-later { border-style: dashed; }
.kind-tab.kind-later.active { border-style: solid; }
.later-hint { margin: 0 0 10px; padding: 9px 12px; border-radius: var(--radius-sm); background: var(--line-soft); color: var(--ink-2); font-size: 14px; }
.later-note { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.later-note span { flex: 1 1 220px; min-width: 0; }
.later-note .btn { min-height: 40px; background: var(--surface); border-color: var(--line); }
@media (max-width: 760px) {
  .later-note .btn { flex: 1 1 100%; }
}

/* ---------- Fuentes: estado de la última revisión de cada fuente («Ver las fuentes») ---------- */

.src-state { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 13.5px; font-weight: 600; background: var(--line-soft); color: var(--ink-2); }
.src-state::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.src-state.is-ok { background: var(--dune); color: var(--dune-ink); }
.src-state.is-warn { background: var(--doubt); color: var(--doubt-ink); }
.src-state.is-info { background: var(--sea-soft); color: var(--sea-dark); }
.src-state.is-muted { background: var(--line-soft); color: var(--muted); }
.src-detail { display: block; margin-top: 4px; max-width: 46ch; font-size: 13px; line-height: 1.4; color: var(--muted); }
.sources-overview th[scope="row"] { font-weight: 600; overflow-wrap: anywhere; }
/* Celular: cada fuente pasa a ser una ficha (nombre, estado, última revisión, para revisar), sin desplazamiento lateral. */
@media (max-width: 760px) {
  .sources-overview thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .sources-overview table, .sources-overview tbody, .sources-overview tr, .sources-overview th, .sources-overview td { display: block; }
  .sources-overview tr { padding: 10px 0; border-top: 1px solid var(--line-soft); }
  .sources-overview tr:first-child { border-top: 0; }
  .sources-overview th[scope="row"], .sources-overview td { padding: 2px 0; border-top: 0; }
  .sources-overview td[data-label="Última revisión"]::before, .sources-overview td[data-label="Para revisar"]::before { content: attr(data-label) ": "; color: var(--muted); }
  .sources-overview td[data-label="Estado"] { margin: 4px 0; }
  .sources-overview td.is-record::before { content: none; }
}

/* ---------- pulido: pantallas medianas (tablet o ventana angosta, 761 a 1199 px) ---------- */

/* Las ocho secciones no entran en un renglón con el ícono al lado del nombre: «Mi cuenta» y «Salir» quedaban fuera
   de la pantalla y toda la página se deslizaba de costado. Se usa el armado del celular (ícono arriba, nombre abajo)
   dentro de la misma barra superior. Si aun así no entrara, la barra se desliza sola, sin mover la página.
   Medido: con el nombre al lado del ícono, la barra completa necesita 1196 px. */
@media (min-width: 761px) and (max-width: 1199px) {
  .topbar { gap: 8px; padding: 0 12px; }
  .mainnav { gap: 2px; min-width: 0; overflow-x: auto; scrollbar-width: none; justify-content: flex-start; justify-content: safe center; }
  .mainnav::-webkit-scrollbar { display: none; }
  .mainnav .tab { flex: none; flex-direction: column; gap: 2px; min-height: 52px; padding: 6px; font-size: 12px; }
  .mainnav .tab span { line-height: 1.1; text-align: center; white-space: nowrap; }
  .nav-badge { position: absolute; top: 2px; left: 54%; min-width: 18px; padding: 0 5px; font-size: 11px; line-height: 16px; }
}

/* Capas: con poco ancho, las acciones bajan a su propio renglón (como en el celular) para que el nombre de la capa
   no quede aplastado en una columna de menos de 100 px. */
@media (min-width: 761px) and (max-width: 900px) {
  .layer-row { grid-template-columns: auto minmax(0, 1fr); }
  .layer-actions { grid-column: 1 / -1; justify-content: flex-start; }
}
