/* ==========================================================================
   Pulso187 — sistema visual compartido (home + central de agentes)
   Rojo de marca reservado para acentos y acciones; colores semánticos aparte.
   ========================================================================== */

:root {
  /* Marca */
  --red: #FF1616;            /* acento de marca: líneas, foco, datos destacados */
  --red-ink: #E01010;        /* fondo de botón primario (contraste AA con blanco) */
  --red-ink-hover: #C80D0D;
  --red-text: #FF4A4A;       /* texto rojo pequeño sobre superficies */
  --red-soft: rgba(255, 22, 22, 0.10);
  --red-line: rgba(255, 22, 22, 0.35);

  /* Neutros */
  --bg: #111111;
  --surface: #171717;
  --surface-2: #1E1E1E;
  --surface-3: #262626;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #F2F1EC;
  --text-2: #A9A79F;
  --text-3: #8C8A83;
  --white: #FFFFFF;

  /* Semánticos (distintos del rojo de marca) */
  --ok: #3DD68C;
  --ok-soft: rgba(61, 214, 140, 0.12);
  --warn: #F5B841;
  --warn-soft: rgba(245, 184, 65, 0.12);
  --err: #FF7A8A;
  --err-soft: rgba(255, 122, 138, 0.12);
  --info: #7DB7FF;
  --info-soft: rgba(125, 183, 255, 0.12);

  /* Tipografía */
  --font-display: 'Bebas Neue', 'Arial Narrow', sans-serif;
  --font-ui: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'DM Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;

  /* Ritmo */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --gap: 16px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --sidebar-w: 248px;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
h1, h2, h3, h4, p { margin: 0; }
ul, ol { margin: 0; padding: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

::selection { background: var(--red); color: var(--white); }

main:focus, [tabindex="-1"]:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
  border-radius: 4px;
}

.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;
}
.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 200;
  background: var(--red-ink); color: var(--white);
  padding: 8px 14px; border-radius: var(--r-sm); text-decoration: none; font-weight: 600;
}
.skip-link:focus { top: 12px; }

/* ── Tipografía ─────────────────────────────────────────────────────────── */
.display {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: 0.01em;
  line-height: 0.95;
  text-transform: uppercase;
}
.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-2);
}
.eyebrow.is-red { color: var(--red-text); }
.h2 { font-size: clamp(22px, 2.6vw, 28px); font-weight: 600; line-height: 1.25; letter-spacing: -0.01em; }
.h3 { font-size: 17px; font-weight: 600; line-height: 1.35; }
.lead { font-size: 17px; color: var(--text-2); line-height: 1.65; }
.muted { color: var(--text-2); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.mono { font-family: var(--font-mono); }
.num { font-variant-numeric: tabular-nums; }
.text-red { color: var(--red-text); }
.stack > * + * { margin-top: var(--stack, 12px); }

/* ── Botones ─────────────────────────────────────────────────────────────── */
.btn {
  --btn-bg: var(--surface-2);
  --btn-fg: var(--text);
  --btn-line: var(--line-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px;
  padding: 10px 18px;
  border-radius: var(--r-sm);
  border: 1px solid var(--btn-line);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: 14px; font-weight: 600; line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s var(--ease), border-color .15s var(--ease), transform .15s var(--ease);
  white-space: nowrap;
}
.btn:hover { border-color: var(--text-3); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary { --btn-bg: var(--red-ink); --btn-fg: var(--white); --btn-line: var(--red-ink); }
.btn-primary:hover { --btn-bg: var(--red-ink-hover); --btn-line: var(--red-ink-hover); }
.btn-ghost { --btn-bg: transparent; }
.btn-quiet { --btn-bg: transparent; --btn-line: transparent; padding-inline: 10px; color: var(--text-2); }
.btn-quiet:hover { color: var(--text); border-color: transparent; background: var(--surface-2); }
.btn-sm { min-height: 34px; padding: 6px 12px; font-size: 13px; }
.btn-lg { min-height: 50px; padding: 14px 24px; font-size: 15px; }
.btn-block { width: 100%; }
.btn .ico { width: 16px; height: 16px; flex: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* ── Superficies ─────────────────────────────────────────────────────────── */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 22px;
}
.panel-tight { padding: 16px; }
.panel-2 { background: var(--surface-2); }
.panel-accent { border-color: var(--red-line); }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.divider { height: 1px; background: var(--line); border: 0; margin: 18px 0; }

/* ── Etiquetas ───────────────────────────────────────────────────────────── */
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; line-height: 1;
  padding: 5px 9px; border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--text-2);
  white-space: nowrap;
}
.tag::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag.no-dot::before { display: none; }
.tag-ok { color: var(--ok); border-color: rgba(61, 214, 140, .35); background: var(--ok-soft); }
.tag-warn { color: var(--warn); border-color: rgba(245, 184, 65, .35); background: var(--warn-soft); }
.tag-err { color: var(--err); border-color: rgba(255, 122, 138, .35); background: var(--err-soft); }
.tag-info { color: var(--info); border-color: rgba(125, 183, 255, .35); background: var(--info-soft); }
.tag-red { color: var(--red-text); border-color: var(--red-line); background: var(--red-soft); }
.tag-demo { color: var(--warn); border-color: rgba(245, 184, 65, .35); background: transparent; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-2);
  background: var(--surface-2); border: 1px solid var(--line);
  padding: 4px 9px; border-radius: var(--r-sm);
}
.chip b { color: var(--text); font-weight: 600; }

/* ── Avisos ──────────────────────────────────────────────────────────────── */
.notice {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 16px; border-radius: var(--r-md);
  border: 1px solid var(--line-strong); background: var(--surface-2);
  font-size: 14px; color: var(--text-2);
}
.notice strong { color: var(--text); }
.notice .ico { width: 18px; height: 18px; flex: none; margin-top: 2px; }
.notice-info { border-color: rgba(125, 183, 255, .3); background: var(--info-soft); }
.notice-info .ico { color: var(--info); }
.notice-warn { border-color: rgba(245, 184, 65, .3); background: var(--warn-soft); }
.notice-warn .ico { color: var(--warn); }
.notice-err { border-color: rgba(255, 122, 138, .35); background: var(--err-soft); }
.notice-err .ico { color: var(--err); }
.notice-ok { border-color: rgba(61, 214, 140, .3); background: var(--ok-soft); }
.notice-ok .ico { color: var(--ok); }
.demo-banner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 14px; border-radius: var(--r-md);
  border: 1px dashed rgba(245, 184, 65, .55); background: var(--warn-soft);
  font-size: 14px; color: var(--text);
}

/* ── Formularios ─────────────────────────────────────────────────────────── */
.field { display: grid; gap: 6px; }
.field + .field { margin-top: 16px; }
.label { font-size: 14px; font-weight: 600; color: var(--text); }
.hint { font-size: 13px; color: var(--text-2); }
.input, .select, .textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  color: var(--text);
  transition: border-color .15s var(--ease);
}
.textarea { min-height: 110px; resize: vertical; line-height: 1.55; }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%), linear-gradient(135deg, var(--text-2) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--text-3); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.field-error { font-size: 13px; color: var(--err); }
.counter { font-size: 12px; color: var(--text-3); text-align: right; }

/* Opciones accesibles (radio / checkbox reales) */
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choices.is-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.choice > span {
  display: flex; align-items: center; gap: 10px;
  min-height: 44px; padding: 10px 14px;
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: var(--surface-2); color: var(--text-2);
  font-size: 14px; font-weight: 500; line-height: 1.35;
  transition: border-color .15s var(--ease), background .15s var(--ease), color .15s var(--ease);
}
.choice > span::before {
  content: ''; flex: none; width: 16px; height: 16px;
  border: 1.5px solid var(--text-3); border-radius: 50%;
  transition: border-color .15s var(--ease), background .15s var(--ease);
}
.choice input[type="checkbox"] + span::before { border-radius: 4px; }
.choice input:hover + span { border-color: var(--text-3); color: var(--text); }
.choice input:checked + span { border-color: var(--red); background: var(--red-soft); color: var(--text); }
.choice input:checked + span::before { border-color: var(--red); background: var(--red); box-shadow: inset 0 0 0 3px var(--surface-2); }
.choice input:focus-visible + span { outline: 2px solid var(--red); outline-offset: 2px; }

.toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; }
.toggle input { width: 18px; height: 18px; accent-color: var(--red-ink); }

/* Zona de carga de archivos */
.dropzone {
  position: relative;
  display: grid; place-items: center; gap: 6px; text-align: center;
  padding: 26px 18px;
  border: 1.5px dashed var(--line-strong); border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--text-2); font-size: 14px;
  transition: border-color .15s var(--ease), background .15s var(--ease);
}
.dropzone.is-over { border-color: var(--red); background: var(--red-soft); }
.dropzone.is-loaded { border-style: solid; border-color: rgba(61, 214, 140, .45); }
.dropzone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone strong { color: var(--text); }

/* ── Tablas ──────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-md); }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th, table.data td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data th { font-weight: 600; color: var(--text-2); background: var(--surface-2); font-size: 12px; position: sticky; top: 0; }
table.data td.r, table.data th.r { text-align: right; font-variant-numeric: tabular-nums; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: rgba(255, 255, 255, 0.02); }
table.data button.linkish { background: none; border: 0; padding: 0; color: var(--text); text-decoration: underline; text-decoration-color: var(--text-3); text-underline-offset: 3px; cursor: pointer; }

/* ── KPIs y medidores ────────────────────────────────────────────────────── */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 16px; }
.kpi-label { font-size: 13px; color: var(--text-2); display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.kpi-value { font-family: var(--font-display); font-size: 36px; line-height: 1.05; letter-spacing: 0.01em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi-delta { font-size: 13px; font-weight: 600; margin-top: 2px; }
.delta-good { color: var(--ok); }
.delta-bad { color: var(--err); }
.delta-flat { color: var(--text-2); }
.kpi details { margin-top: 8px; font-size: 13px; color: var(--text-2); }
.kpi summary { cursor: pointer; color: var(--text-3); font-size: 12px; list-style: none; }
.kpi summary::-webkit-details-marker { display: none; }
.kpi summary::before { content: '¿Qué significa? '; }
.kpi details[open] summary::before { content: 'Ocultar '; }

.bar { height: 6px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: inherit; background: var(--red); width: var(--w, 0%); transition: width .8s var(--ease); }

/* ── Progreso honesto ────────────────────────────────────────────────────── */
.progress-list { display: grid; gap: 10px; list-style: none; }
.progress-list li { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-3); }
.progress-list li::before { content: ''; width: 18px; height: 18px; flex: none; border-radius: 50%; border: 1.5px solid var(--line-strong); }
.progress-list li.is-active { color: var(--text); }
.progress-list li.is-active::before { border-color: var(--red); border-top-color: transparent; animation: spin 0.9s linear infinite; }
.progress-list li.is-done { color: var(--text-2); }
.progress-list li.is-done::before { border-color: var(--ok); background: var(--ok) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23111' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5L20 7'/%3E%3C/svg%3E") center / 11px no-repeat; }
.progress-list li.is-failed { color: var(--err); }
.progress-list li.is-failed::before { border-color: var(--err); }
@keyframes spin { to { transform: rotate(360deg); } }

.linear { height: 3px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.linear > i { display: block; height: 100%; width: var(--w, 0%); background: var(--red); transition: width .35s var(--ease); }

/* ── Diálogo y toast ─────────────────────────────────────────────────────── */
dialog.modal {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 0; border: 1px solid var(--line-strong); border-radius: var(--r-lg);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow);
}
dialog.modal::backdrop { background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(2px); }
.modal-body { padding: 22px; display: grid; gap: 14px; }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.modal-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }

.toast-region { position: fixed; left: 50%; bottom: 88px; transform: translateX(-50%); z-index: 300; display: grid; gap: 8px; pointer-events: none; }
.toast { pointer-events: auto; background: var(--surface-3); border: 1px solid var(--line-strong); color: var(--text); padding: 10px 16px; border-radius: var(--r-md); font-size: 14px; box-shadow: var(--shadow); animation: toast-in .2s var(--ease); }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ── Iconos ──────────────────────────────────────────────────────────────── */
.ico { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ==========================================================================
   HOME
   ========================================================================== */
.site-nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px clamp(16px, 4vw, 40px);
  background: rgba(17, 17, 17, 0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.brand img { width: 38px; height: 38px; border-radius: 6px; }
.brand-word { font-family: var(--font-display); font-size: 24px; letter-spacing: 0.04em; line-height: 1; }
.brand-word span { color: var(--red); }
.site-links { display: flex; align-items: center; gap: 6px; list-style: none; }
.site-links a:not(.btn) { padding: 8px 10px; border-radius: var(--r-sm); font-size: 14px; color: var(--text-2); text-decoration: none; }
.site-links a:not(.btn):hover { color: var(--text); background: var(--surface-2); }

.wrap { width: min(1180px, 100% - 32px); margin-inline: auto; }
.section { padding: clamp(56px, 8vw, 96px) 0; }
.section + .section { border-top: 1px solid var(--line); }
.section-head { display: grid; gap: 10px; max-width: 680px; margin-bottom: 32px; }
.section-title { font-family: var(--font-display); font-size: clamp(38px, 5vw, 58px); line-height: 0.95; letter-spacing: 0.01em; text-transform: uppercase; }

.hero { padding: clamp(36px, 6vw, 72px) 0 clamp(48px, 6vw, 80px); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: clamp(28px, 4vw, 56px); align-items: start; }
.hero-title { font-size: clamp(50px, 7.4vw, 96px); margin: 14px 0 18px; }
.hero-title em { font-style: normal; color: var(--red); }
.hero-points { display: grid; gap: 8px; margin: 22px 0 26px; list-style: none; }
.hero-points li { display: flex; gap: 10px; font-size: 15px; color: var(--text-2); }
.hero-points li::before { content: ''; flex: none; width: 14px; height: 1.5px; margin-top: 12px; background: var(--red); }

.need-panel { padding: 0; overflow: hidden; }
.need-tabs { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--line); }
.need-tab {
  appearance: none; background: transparent; border: 0; border-bottom: 2px solid transparent;
  padding: 14px 8px 12px; cursor: pointer; color: var(--text-2);
  display: grid; gap: 2px; justify-items: center; text-align: center;
}
.need-tab .verb { font-family: var(--font-display); font-size: 22px; letter-spacing: 0.03em; line-height: 1; }
.need-tab .agent { font-size: 11px; font-family: var(--font-mono); letter-spacing: 0.06em; color: var(--text-3); }
.need-tab:hover { color: var(--text); background: rgba(255, 255, 255, 0.02); }
.need-tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--red); background: var(--surface-2); }
.need-tab[aria-selected="true"] .agent { color: var(--red-text); }
.need-body { padding: 22px; display: grid; gap: 18px; }
.need-body > .btn { justify-self: start; }
.need-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.need-meta div { font-size: 13px; color: var(--text-2); }
.need-meta b { display: block; font-size: 11px; font-family: var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-3); font-weight: 400; margin-bottom: 4px; }

.example { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg); padding: 16px; position: relative; }
.example-label { position: absolute; top: -9px; left: 12px; background: var(--surface); padding: 0 8px; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--warn); }

.agents-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.agent-card { display: flex; flex-direction: column; gap: 14px; }
.agent-card .agent-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.agent-name { font-family: var(--font-display); font-size: 30px; letter-spacing: 0.02em; line-height: 1; }
.agent-name span { color: var(--red); }
.agent-card dl { display: grid; gap: 12px; margin: 0; }
.agent-card dt { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-3); }
.agent-card dd { margin: 3px 0 0; font-size: 14px; color: var(--text-2); }
.agent-card .btn { margin-top: auto; }

.helper { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 24px; align-items: start; }
.helper-result { align-self: start; }
section[id], main[id] { scroll-margin-top: 76px; }

.flow { display: grid; gap: 14px; }
.flow-row { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; align-items: stretch; gap: 10px; }
.flow-node { padding: 16px; border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface); }
.flow-node b { display: block; font-family: var(--font-display); font-size: 24px; letter-spacing: 0.03em; font-weight: 400; line-height: 1; margin-bottom: 6px; }
.flow-node p { font-size: 13px; color: var(--text-2); }
.flow-arrow { display: grid; place-items: center; color: var(--red); }
.flow-control { padding: 16px; border: 1px dashed var(--red-line); border-radius: var(--r-md); background: var(--red-soft); display: flex; gap: 14px; align-items: center; }
.flow-control b { font-family: var(--font-display); font-size: 24px; letter-spacing: 0.03em; font-weight: 400; }

.truth-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.human { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: 28px; align-items: center; }

.site-footer { border-top: 1px solid var(--line); padding: 28px 0 36px; color: var(--text-2); font-size: 13px; }
.site-footer .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.site-footer a { color: var(--text-2); text-decoration: none; }
.site-footer a:hover { color: var(--text); }
.footer-links { display: flex; flex-wrap: wrap; gap: 16px; }

/* ==========================================================================
   CENTRAL (app)
   ========================================================================== */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 6px;
  padding: 18px 14px;
  border-right: 1px solid var(--line);
  background: var(--surface);
}
.sidebar .brand { padding: 4px 8px 16px; }
.nav-group-label { padding: 14px 10px 6px; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-3); }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--r-sm);
  color: var(--text-2); text-decoration: none; font-size: 14px; font-weight: 500;
  border: 1px solid transparent;
}
.nav-item .ico { width: 18px; height: 18px; }
.nav-item small { margin-left: auto; font-size: 11px; color: var(--text-3); font-family: var(--font-mono); }
.nav-item:hover { color: var(--text); background: var(--surface-2); }
.nav-item[aria-current="page"] { color: var(--text); background: var(--surface-2); border-color: var(--line-strong); }
.nav-item[aria-current="page"] .ico { color: var(--red); }
.sidebar-foot { margin-top: auto; display: grid; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.sidebar-foot p { font-size: 12px; color: var(--text-3); padding: 0 6px; }

.topbar { display: none; }
.tabbar { display: none; }

.main { min-width: 0; padding: clamp(18px, 3vw, 36px) clamp(16px, 3.4vw, 44px) 64px; }
.page { width: min(1040px, 100%); margin-inline: auto; display: grid; gap: 20px; }
/* Los hijos de grillas no deben crecer por tablas o gráficos anchos: desplazan su propio contenido. */
.page > *, #view, #view > *, .panel, .grid-2 > *, .grid-3 > *, .tiles > * { min-width: 0; }
#view { display: grid; gap: 20px; }

.agent-header { display: grid; gap: 14px; }
.agent-title-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.agent-title { font-family: var(--font-display); font-size: clamp(40px, 5vw, 56px); letter-spacing: 0.02em; line-height: 0.95; }
.agent-title span { color: var(--red); }

.stepper { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; list-style: none; counter-reset: step; }
.stepper li { counter-increment: step; display: grid; gap: 6px; font-size: 12px; color: var(--text-3); }
.stepper li::before { content: ''; height: 3px; border-radius: 999px; background: var(--surface-3); }
.stepper li span::before { content: counter(step, decimal-leading-zero) ' '; font-family: var(--font-mono); }
.stepper li.is-done { color: var(--text-2); }
.stepper li.is-done::before { background: var(--text-3); }
.stepper li.is-current { color: var(--text); font-weight: 600; }
.stepper li.is-current::before { background: var(--red); }

.understand { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; padding: 0; }
.understand > div { padding: 18px; border-right: 1px solid var(--line); }
.understand > div:last-child { border-right: 0; }
.understand h3 { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-3); font-weight: 400; margin-bottom: 8px; }
.understand p, .understand li { font-size: 14px; color: var(--text-2); }
.understand ul { list-style: none; display: grid; gap: 4px; }
.understand li::before { content: '— '; color: var(--text-3); }

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

/* Cuestionario */
.qcard { display: grid; gap: 18px; }
.q-title { font-size: clamp(20px, 2.4vw, 24px); font-weight: 600; line-height: 1.3; }
.q-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.q-progress { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--text-2); }
.q-progress .linear { flex: 1; }

/* Resultado de auditoría */
.score-card { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 24px; align-items: center; }
.gauge { width: 210px; height: auto; }
.gauge text { font-family: var(--font-ui); }
.dims { display: grid; gap: 14px; }
.dim { display: grid; gap: 6px; }
.dim-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.dim-name { font-size: 14px; font-weight: 600; }
.dim-score { font-family: var(--font-display); font-size: 22px; line-height: 1; letter-spacing: 0.02em; font-variant-numeric: tabular-nums; }
.dim-src { font-size: 12px; color: var(--text-3); }
.dim.is-na .dim-score { font-family: var(--font-ui); font-size: 12px; color: var(--text-2); }

.finding { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); }
.finding:first-child { border-top: 0; padding-top: 0; }
.finding:last-child { padding-bottom: 0; }
.prio { width: 10px; height: 10px; border-radius: 50%; margin-top: 7px; }
.prio-alta { background: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.prio-media { background: var(--warn); }
.prio-baja { background: var(--text-3); }
.finding h4 { font-size: 15px; font-weight: 600; }
.finding p { font-size: 14px; color: var(--text-2); margin-top: 4px; }
.finding .meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

.action { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: start; padding: 14px 0; border-top: 1px solid var(--line); }
.action:first-child { border-top: 0; padding-top: 0; }
.action-n { font-family: var(--font-display); font-size: 28px; line-height: 1; color: var(--red); }

.offer { display: grid; gap: 10px; padding: 18px; border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface-2); }
.offer ul { list-style: none; display: grid; gap: 4px; font-size: 14px; color: var(--text-2); }
.offer li::before { content: '→ '; color: var(--red); }
.offer .why { font-size: 13px; color: var(--text-2); border-left: 2px solid var(--red); padding-left: 10px; }

/* Gráficos */
.chart { width: 100%; height: auto; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .axis-text { fill: var(--text-3); font-size: 11px; font-family: var(--font-ui); }
.chart .s-current { stroke: var(--red); stroke-width: 2.2; fill: none; }
.chart .s-prev { stroke: var(--text-3); stroke-width: 1.6; fill: none; stroke-dasharray: 4 4; }
.chart .area { fill: url(#areaGrad); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--text-2); }
.legend i { display: inline-block; width: 14px; height: 2px; vertical-align: middle; margin-right: 6px; background: var(--red); }
.legend i.prev { background: repeating-linear-gradient(90deg, var(--text-3) 0 4px, transparent 4px 8px); }

/* Mapeo de columnas */
.mapping { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }

/* Concilia */
.state-filter { display: flex; flex-wrap: wrap; gap: 8px; }
.state-filter button { appearance: none; border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text-2); padding: 7px 12px; border-radius: 999px; font-size: 13px; cursor: pointer; }
.state-filter button[aria-pressed="true"] { border-color: var(--red); color: var(--text); background: var(--red-soft); }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.compare dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 13px; }
.compare dt { color: var(--text-3); }
.compare dd { margin: 0; word-break: break-word; }

/* Creative */
.concept { display: grid; gap: 14px; }
.copy-edit { width: 100%; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; color: var(--text); resize: vertical; min-height: 44px; line-height: 1.5; }
.copy-edit:focus { outline: none; border-color: var(--red); }
.source-line { font-size: 13px; color: var(--text-2); border-left: 2px solid var(--red); padding-left: 10px; }

/* Resumen de la central */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.tile { display: grid; gap: 10px; text-decoration: none; transition: border-color .15s var(--ease); }
.tile:hover { border-color: var(--line-strong); }
.tile .agent-name { font-size: 28px; }

/* Impresión de informes */
@media print {
  body { background: #fff; color: #111; }
  .sidebar, .topbar, .tabbar, .no-print, .site-nav, .toast-region { display: none !important; }
  .app { display: block; }
  .panel, .kpi { background: #fff; border-color: #ddd; break-inside: avoid; }
  .muted, .hint, .finding p, .dim-src { color: #444 !important; }
  .main { padding: 0; }
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 1080px) {
  .agents-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .understand { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .understand > div:nth-child(2) { border-right: 0; }
  .understand > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}
@media (max-width: 900px) {
  .hero-grid, .helper, .human { grid-template-columns: 1fr; }
  .truth-grid { grid-template-columns: 1fr; }
  .site-links .hide-sm { display: none; }
  .flow-row { grid-template-columns: 1fr; }
  .flow-arrow { transform: rotate(90deg); height: 24px; }

  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar {
    position: sticky; top: 0; z-index: 40;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 10px 16px;
    background: rgba(17, 17, 17, 0.92); backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
  }
  .topbar .brand img { width: 32px; height: 32px; }
  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    display: grid; grid-template-columns: repeat(5, 1fr);
    background: rgba(23, 23, 23, 0.96); backdrop-filter: blur(10px);
    border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar a { display: grid; justify-items: center; gap: 2px; padding: 8px 2px 9px; font-size: 11px; color: var(--text-3); text-decoration: none; }
  .tabbar a .ico { width: 20px; height: 20px; }
  .tabbar a[aria-current="page"] { color: var(--text); }
  .tabbar a[aria-current="page"] .ico { color: var(--red); }
  .main { padding-bottom: 96px; }
  .score-card { grid-template-columns: 1fr; justify-items: center; }
  .score-card .dims { width: 100%; }
  .grid-2, .grid-3, .tiles { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .agents-grid { grid-template-columns: 1fr; }
  .need-meta { grid-template-columns: 1fr; }
  .need-tab .verb { font-size: 19px; }
  .need-tab .agent { display: none; }
  .understand { grid-template-columns: 1fr; }
  .understand > div { border-right: 0; border-bottom: 1px solid var(--line); }
  .understand > div:last-child { border-bottom: 0; }
  .stepper li span { display: none; }
  .stepper li.is-current span { display: inline; position: absolute; }
  .stepper { position: relative; padding-bottom: 18px; }
  .action { grid-template-columns: auto minmax(0, 1fr); }
  .action > .btn, .action > .btn-row { grid-column: 2; justify-self: start; }
  .compare { grid-template-columns: 1fr; }
  .panel { padding: 18px; }
  .q-nav .btn { flex: 1; }
  .site-links a:not(.btn) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
