/* Radar — estética de periódico. Papel claro y edición nocturna. */
:root {
  --paper: #f4efe4;
  --paper-2: #ece5d6;
  --ink: #1b1a17;
  --ink-2: #4a463e;
  --ink-3: #7a7466;
  --rule: #1b1a17;
  --rule-soft: #c9c0ad;
  --accent: #8e1b1b;          /* rojo de titular urgente */
  --accent-soft: #f1dcd6;
  --ok: #2f5d3a;
  --warn: #8a5a00;
  --masthead: "UnifrakturMaguntia", "Old English Text MT", serif;
  --headline: "Playfair Display", Georgia, serif;
  --body: "Source Serif 4", Georgia, "Times New Roman", serif;
  --label: "Old Standard TT", Georgia, serif;
  --gutter: 16px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #16140f; --paper-2: #1f1c16; --ink: #ece6d8; --ink-2: #c3bba9; --ink-3: #8d8574;
    --rule: #ece6d8; --rule-soft: #3c372d; --accent: #e07a6a; --accent-soft: #3a1f1a; --ok: #8cc49a; --warn: #e2b55c;
  }
}
:root[data-theme="dark"] {
  --paper: #16140f; --paper-2: #1f1c16; --ink: #ece6d8; --ink-2: #c3bba9; --ink-3: #8d8574;
  --rule: #ece6d8; --rule-soft: #3c372d; --accent: #e07a6a; --accent-soft: #3a1f1a; --ok: #8cc49a; --warn: #e2b55c;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); color: var(--ink); }
body {
  font-family: var(--body); font-size: 17px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
a { color: inherit; }
/* Los textos vienen de páginas externas: URLs y palabras largas deben poder partirse. */
.paper { overflow-wrap: anywhere; hyphens: auto; }
.paper h1, .paper .chip, .paper .stamp, .tabbar, nav.sections a { overflow-wrap: normal; hyphens: manual; }
.paper .agenda-row a > *, .paper .strip-card > *, .factbox > div { min-width: 0; }
/* Red de seguridad: la app nunca se desplaza en horizontal. */
html, body { overflow-x: clip; }
button { font: inherit; color: inherit; }
.paper { max-width: 1100px; margin: 0 auto; padding: 12px var(--gutter) 64px; }
.loading { font-family: var(--label); text-align: center; margin-top: 30vh; color: var(--ink-3); }

/* Cabecera */
.masthead { text-align: center; padding-top: 6px; }
.masthead .ear { display: flex; justify-content: space-between; gap: 8px; font-family: var(--label); font-size: 12px; color: var(--ink-2); text-transform: uppercase; letter-spacing: .06em; }
.masthead h1 { font-family: var(--masthead); font-weight: 400; font-size: clamp(48px, 13vw, 96px); line-height: 1; margin: 6px 0 2px; letter-spacing: .01em; }
.masthead h1 a { text-decoration: none; }
.masthead .motto { font-family: var(--label); font-style: italic; font-size: 13px; color: var(--ink-2); margin: 0 0 6px; }
.dateline {
  display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap;
  border-top: 3px double var(--rule); border-bottom: 1px solid var(--rule);
  padding: 5px 2px; font-family: var(--label); font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em;
}
.dateline .coverage.bad { color: var(--accent); }
nav.sections { display: flex; gap: 4px 14px; justify-content: center; flex-wrap: wrap; padding: 7px 0; border-bottom: 1px solid var(--rule); font-family: var(--label); font-size: 13px; text-transform: uppercase; letter-spacing: .07em; }
nav.sections a { text-decoration: none; padding: 2px 0; }
nav.sections a[aria-current="page"] { border-bottom: 2px solid var(--ink); }

@media (max-width: 640px) {
  .masthead .ear { font-size: 10.5px; }
  .masthead h1 { font-size: 58px; margin: 4px 0 0; }
  .masthead .motto { font-size: 12px; }
  .dateline { font-size: 11px; padding: 4px 0; row-gap: 2px; }
  .dateline > span:nth-child(2) { order: 3; flex-basis: 100%; }
  nav.sections { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; scrollbar-width: none; font-size: 12px; gap: 16px; -webkit-overflow-scrolling: touch; }
  nav.sections::-webkit-scrollbar { display: none; }
  nav.sections a { white-space: nowrap; }
  .deck { font-size: 17px; font-weight: 400; }
  .byline { font-size: 11.5px; }
}

/* ---------- Piezas comunes nuevas ---------- */
.mob { display: none; }
.chip { display: inline-block; font-family: var(--label); font-size: 12px; font-weight: 700; letter-spacing: .03em; padding: 2px 8px; border-radius: 999px; background: var(--paper-2); border: 1px solid var(--rule-soft); color: var(--ink-2); margin-right: 6px; white-space: nowrap; }
.chip.hot { background: var(--accent); border-color: var(--accent); color: var(--paper); }
.chip.closed { color: var(--ink-3); text-decoration: line-through; }
.story-top { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 0; margin: 0 0 5px; min-height: 20px; }
.story-top:empty { display: none; }
.story { position: relative; }
.story h3 a::after { content: ""; position: absolute; inset: 0; }   /* toda la tarjeta es pulsable */
.story .sum { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tabbar { display: none; }

/* Agenda */
.agenda-list { list-style: none; margin: 0 0 18px; padding: 0; }
.agenda-row a { display: grid; grid-template-columns: 48px 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px dotted var(--rule-soft); text-decoration: none; min-height: 56px; }
.agenda-row .when { font-family: var(--label); font-weight: 700; font-size: 22px; line-height: 1; text-align: center; }
.agenda-row .when small { display: block; font-weight: 400; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; margin-top: 3px; color: var(--ink-3); }
.agenda-row .when.soon { color: var(--accent); }
.agenda-row .what strong { display: block; font-family: var(--headline); font-weight: 600; font-size: 17px; line-height: 1.25; }
.agenda-row .what small { display: block; font-size: 13px; color: var(--ink-3); margin-top: 2px; }
.agenda-row .chip { margin: 0; }

.deadline-note { font-size: 14.5px; color: var(--ink-2); margin: -4px 0 14px; padding: 8px 10px; background: var(--paper-2); border-left: 3px solid var(--rule); }

/* Requisitos contra tu perfil */
.elig-sum { margin: 0 0 8px; font-style: italic; color: var(--ink-2); }
.elig-list { list-style: none; margin: 0; padding: 0; }
.elig { display: grid; grid-template-columns: 26px 1fr; gap: 8px; padding: 7px 0; border-bottom: 1px dotted var(--rule-soft); }
.elig:last-child { border-bottom: 0; }
.elig .mark { font-family: var(--label); font-weight: 700; font-size: 16px; text-align: center; line-height: 1.3; }
.elig.ok .mark { color: var(--ok); }
.elig.no .mark { color: var(--accent); }
.elig.unk .mark { color: var(--warn); }
.elig strong { font-weight: 600; display: block; font-size: 15.5px; line-height: 1.35; }
.elig small { display: block; color: var(--ink-3); font-size: 13.5px; margin-top: 2px; }

/* Barra de decisión de la ficha */
.decide { display: flex; gap: 8px; margin: 22px 0 8px; }
.decide .btn { flex: 1; text-align: center; }

@media (max-width: 640px) {
  .desk { display: none !important; }
  .mob { display: block; }
  .paper { padding-bottom: calc(92px + env(safe-area-inset-bottom)); }

  /* Cabecera compacta: nombre + fecha; la portada un poco más grande */
  .masthead { padding-top: 2px; }
  .masthead h1 { font-size: 40px; margin: 2px 0 4px; }
  .masthead.is-home h1 { font-size: 52px; }
  .dateline { border-top-width: 3px; font-size: 11px; justify-content: center; gap: 4px 12px; }
  .dateline > span:nth-child(2) { order: 0; flex-basis: auto; }

  /* Secciones: fija arriba al hacer scroll */
  nav.sections { position: sticky; top: 0; z-index: 5; background: var(--paper); margin: 0 calc(-1 * var(--gutter)); padding: 9px var(--gutter); border-bottom: 1px solid var(--rule); }

  /* Portada */
  .front { margin-top: 12px; }
  .lead { padding-bottom: 14px; margin-bottom: 10px; }
  .paper .byline { text-transform: none; letter-spacing: 0; font-family: var(--body); font-size: 13.5px; }
  .paper .decide .btn { font-size: 12.5px; letter-spacing: .04em; padding: 10px 6px; white-space: nowrap; }
  .lead h2 { font-size: 30px; }
  .lead .deck { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
  .story { padding-bottom: 14px; margin-bottom: 14px; }
  .story h3 { font-size: 20px; }
  .story .meta { font-size: 12.5px; }
  .section-title { font-size: 13px; letter-spacing: .1em; }

  /* Tira de próximos plazos */
  .strip { margin: 4px 0 18px; }
  .strip-row { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 calc(-1 * var(--gutter)); padding: 2px var(--gutter) 6px; scrollbar-width: none; }
  .strip-row::-webkit-scrollbar { display: none; }
  .strip-card { flex: 0 0 72%; scroll-snap-align: start; display: grid; grid-template-columns: 44px 1fr; gap: 10px; align-items: center; border: 1px solid var(--rule); background: var(--paper-2); padding: 10px 12px; text-decoration: none; min-height: 72px; }
  .strip-card .d { font-family: var(--label); font-weight: 700; font-size: 24px; line-height: 1; text-align: center; }
  .strip-card .d small { display: block; font-size: 11px; font-weight: 400; text-transform: uppercase; margin-top: 3px; }
  .strip-card.hot .d { color: var(--accent); }
  .strip-card .t { font-family: var(--headline); font-weight: 600; font-size: 15.5px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

  /* Ficha */
  .article { margin-top: 12px; }
  .article h2 { font-size: 30px; }
  .article .body { font-size: 17px; }
  .factbox { grid-template-columns: 1fr 1fr; }
  .factbox div:nth-child(2n) { border-right: 0; }
  .factbox div:nth-child(-n+2) { border-bottom: 1px solid var(--rule-soft); }
  .decide { position: sticky; bottom: calc(64px + env(safe-area-inset-bottom)); z-index: 4; background: var(--paper); margin: 18px calc(-1 * var(--gutter)) 0; padding: 10px var(--gutter); border-top: 1px solid var(--rule); }

  /* Barra de navegación inferior */
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: var(--paper); border-top: 3px double var(--rule); padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); }
  .tabbar[hidden] { display: none; }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; text-decoration: none; padding: 6px 0 4px; min-height: 52px; color: var(--ink-3); font-family: var(--label); font-size: 10.5px; letter-spacing: .04em; text-transform: uppercase; }
  .tabbar a[aria-current] { color: var(--ink); font-weight: 700; }
  .tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
  .toast { bottom: calc(76px + env(safe-area-inset-bottom)); }
  .footer { font-size: 11.5px; }
}

/* Portada */
/* minmax(0, …): la columna puede encogerse aunque dentro haya una tira deslizable muy ancha. */
.front { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 28px; margin-top: 18px; }
.front > * { min-width: 0; }
@media (min-width: 860px) { .front { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); } }
.lead { border-bottom: 1px solid var(--rule); padding-bottom: 16px; margin-bottom: 16px; }
.kicker { font-family: var(--label); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); margin: 0 0 4px; }
.kicker.calm { color: var(--ink-2); }
.lead h2 { font-family: var(--headline); font-weight: 800; font-size: clamp(30px, 6.4vw, 46px); line-height: 1.06; margin: 0 0 10px; }
.lead h2 a, .story h3 a { text-decoration: none; }
.lead h2 a:hover, .story h3 a:hover { text-decoration: underline; text-decoration-thickness: 1px; }
.deck { font-family: var(--headline); font-style: italic; font-weight: 600; font-size: 19px; line-height: 1.3; color: var(--ink-2); margin: 0 0 10px; }
.byline { font-family: var(--label); font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); margin: 0 0 10px; }
.dropcap::first-letter { font-family: var(--headline); font-weight: 800; float: left; font-size: 3.3em; line-height: .82; padding: 6px 8px 0 0; }

.columns { column-count: 1; column-gap: 28px; column-rule: 1px solid var(--rule-soft); }
@media (min-width: 640px) { .columns { column-count: 2; } }
@media (min-width: 1000px) { .columns.wide { column-count: 3; } }
.section-block { break-inside: avoid; margin-bottom: 22px; }
.section-title { font-family: var(--label); font-weight: 700; font-size: 14px; text-transform: uppercase; letter-spacing: .12em; border-top: 2px solid var(--rule); border-bottom: 1px solid var(--rule); padding: 4px 0; margin: 0 0 10px; display: flex; justify-content: space-between; align-items: baseline; }
.section-title a { text-decoration: none; font-weight: 400; font-size: 12px; letter-spacing: .06em; white-space: nowrap; margin-left: 10px; }
.story { break-inside: avoid; padding: 0 0 12px; margin: 0 0 12px; border-bottom: 1px solid var(--rule-soft); }
.story:last-child { border-bottom: 0; }
.story h3 { font-family: var(--headline); font-weight: 600; font-size: 21px; line-height: 1.18; margin: 0 0 5px; }
.story p { margin: 0 0 6px; font-size: 15.5px; color: var(--ink-2); }
.story .meta { font-family: var(--label); font-size: 12px; color: var(--ink-3); letter-spacing: .03em; }
.empty { font-style: italic; color: var(--ink-3); font-size: 15px; }

/* Columna lateral */
aside .box { border: 1px solid var(--rule); padding: 10px 12px; margin-bottom: 18px; background: var(--paper-2); }
aside .box h4 { font-family: var(--label); text-transform: uppercase; letter-spacing: .1em; font-size: 13px; margin: 0 0 8px; border-bottom: 1px solid var(--rule); padding-bottom: 4px; }
.deadlines { list-style: none; margin: 0; padding: 0; }
.deadlines li { display: grid; grid-template-columns: 58px 1fr; gap: 8px; padding: 6px 0; border-bottom: 1px dotted var(--rule-soft); font-size: 14.5px; line-height: 1.3; }
.deadlines li:last-child { border-bottom: 0; }
.deadlines .when { font-family: var(--label); font-weight: 700; text-align: center; line-height: 1.1; }
.deadlines .when small { display: block; font-weight: 400; font-size: 11px; text-transform: uppercase; }
.deadlines .when.soon { color: var(--accent); }
.deadlines a { text-decoration: none; }

/* Sellos */
.stamp { display: inline-block; font-family: var(--label); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; border: 1px solid currentColor; padding: 1px 6px; margin-right: 6px; vertical-align: 2px; }
.stamp.actuar { color: var(--accent); }
.stamp.consultar { color: var(--warn); }
.stamp.vigilar, .stamp.descartar { color: var(--ink-3); }
.stamp.nuevo { color: var(--ok); }
.stamp.cerrada { color: var(--ink-3); text-decoration: line-through; }

/* Artículo */
.article { max-width: 720px; margin: 18px auto 0; }
.article h2 { font-family: var(--headline); font-weight: 800; font-size: clamp(30px, 6.8vw, 44px); line-height: 1.07; margin: 2px 0 10px; }
.article .body { font-size: 18px; }
.article h5 { font-family: var(--label); text-transform: uppercase; letter-spacing: .1em; font-size: 13px; margin: 22px 0 6px; border-top: 1px solid var(--rule); padding-top: 6px; }
.factbox { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0; border-top: 2px solid var(--rule); border-bottom: 1px solid var(--rule); margin: 14px 0; }
.factbox div { padding: 8px 10px; border-right: 1px solid var(--rule-soft); }
.factbox div:last-child { border-right: 0; }
.factbox dt { font-family: var(--label); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); }
.factbox dd { margin: 2px 0 0; font-weight: 600; font-size: 15.5px; line-height: 1.3; }
.factbox dd.soon { color: var(--accent); }
ul.reqs { margin: 0; padding-left: 20px; }
ul.reqs li { margin: 3px 0; }
ul.reqs.pending li::marker { content: "? "; color: var(--warn); font-weight: 700; }
blockquote.pull { margin: 12px 0; padding: 8px 0 8px 14px; border-left: 3px solid var(--rule); font-family: var(--headline); font-style: italic; font-size: 17px; color: var(--ink-2); }
blockquote.pull cite { display: block; margin-top: 4px; font-family: var(--label); font-style: normal; font-size: 12px; color: var(--ink-3); }
.history { font-size: 14.5px; color: var(--ink-2); }

/* Acciones */
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 18px 0; }
.btn { font-family: var(--label); text-transform: uppercase; letter-spacing: .08em; font-size: 13px; background: transparent; border: 1px solid var(--ink); padding: 10px 14px; cursor: pointer; text-decoration: none; display: inline-block; min-height: 44px; }
.btn:hover { background: var(--ink); color: var(--paper); }
.btn.on { background: var(--ink); color: var(--paper); }
.btn.danger.on { background: var(--accent); border-color: var(--accent); color: var(--paper); }
.btn:disabled { opacity: .45; cursor: default; }
textarea.note { width: 100%; min-height: 70px; font: inherit; font-size: 15px; background: var(--paper-2); color: var(--ink); border: 1px solid var(--rule-soft); padding: 8px; }

/* Filtros */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 16px; font-family: var(--label); font-size: 13px; }
.filters input, .filters select { font: inherit; background: var(--paper-2); color: var(--ink); border: 1px solid var(--rule-soft); padding: 8px; min-height: 40px; }
.filters input { flex: 1 1 180px; }

/* Páginas de servicio */
.page { max-width: 640px; margin: 22px auto 0; }
.page h2 { font-family: var(--headline); font-size: 30px; margin: 0 0 6px; }
.page table { width: 100%; border-collapse: collapse; font-size: 15px; }
.page td, .page th { text-align: left; padding: 7px 4px; border-bottom: 1px solid var(--rule-soft); vertical-align: top; }
.page th { font-family: var(--label); font-weight: 400; text-transform: uppercase; font-size: 12px; letter-spacing: .06em; color: var(--ink-3); width: 42%; }
.pair-code { font-family: var(--label); font-size: 34px; letter-spacing: .4em; text-align: center; width: 100%; padding: 12px; background: var(--paper-2); border: 1px solid var(--rule); color: var(--ink); }
.notice { border: 1px solid var(--rule); padding: 10px 12px; background: var(--paper-2); margin: 12px 0; font-size: 15px; }
.notice.bad { border-color: var(--accent); color: var(--accent); }
.footer { margin-top: 36px; border-top: 3px double var(--rule); padding-top: 8px; font-family: var(--label); font-size: 12px; color: var(--ink-3); display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.footer a { text-decoration: none; }
.toast { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--paper); font-family: var(--label); font-size: 13px; padding: 10px 16px; letter-spacing: .04em; max-width: calc(100% - 32px); z-index: 10; }
@media (prefers-reduced-motion: no-preference) { .toast { animation: rise .2s ease-out; } @keyframes rise { from { opacity: 0; transform: translate(-50%, 8px); } } }

/* Pasos para solicitar */
ol.steps { margin: 0; padding-left: 22px; }
ol.steps li { margin: 5px 0; }

/* Resumen frente a análisis a fondo */
.deep-note { margin: 18px 0 8px; padding: 10px 12px; border: 1px solid var(--rule-soft); background: var(--paper-2); font-size: 15px; }
.deep-note.working { border-color: var(--warn); }
.deep-note.bad { border-color: var(--accent); color: var(--accent); }
.linkbtn { background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; font: inherit; color: inherit; }
