/* frontend/assets/css/app.css
 * Sistema de tokens dark/light + componentes base + tipografía editorial.
 * Tailwind hace utilidades; aquí van las variables CSS, componentes y
 * estilos imposibles de expresar con utilities (newspaper columns, gantt, etc).
 * ─────────────────────────────────────────────────────────────────────── */

[x-cloak] { display: none !important; }

/* ─── Tokens ──────────────────────────────────────────────────────────── */
:root, :root[data-theme="dark"] {
  --bg:           #020617;
  --bg-soft:      #04070f;
  --surface1:     #0b1220;
  --surface2:     #0f172a;
  --surface3:     #1e293b;
  --surface-hover:#172033;
  --border:       #1e293b;
  --border-strong:#334155;
  --text1:        #f1f5f9;
  --text2:        #cbd5e1;
  --text3:        #94a3b8;
  --text4:        #64748b;
  --text5:        #475569;

  --masthead:     #d92e3f;    /* rojo nameplate */
  --gold:         #d4a017;
  --info:         #6366f1;
  --info-2:       #818cf8;
  --ok:           #10b981;
  --ok-2:         #34d399;
  --warn:         #f59e0b;
  --warn-2:       #fbbf24;
  --err:          #ef4444;
  --err-2:        #f87171;
  --terminal:     #10b981;

  --shadow-card:  0 1px 0 rgba(255,255,255,0.02) inset, 0 4px 18px -8px rgba(0,0,0,0.6);
  --shadow-pop:   0 24px 48px -12px rgba(0,0,0,0.65), 0 0 0 1px rgba(51,65,85,0.6);
}

:root[data-theme="light"] {
  --bg:           #f7f5ee;     /* papel envejecido */
  --bg-soft:      #ede9d8;
  --surface1:     #fffdf6;
  --surface2:     #f4f0e2;
  --surface3:     #e9e2cd;
  --surface-hover:#efeadb;
  --border:       #e0d8c0;
  --border-strong:#c1b693;
  --text1:        #18181b;
  --text2:        #3f3f46;
  --text3:        #6b6b6b;
  --text4:        #8a8a8a;
  --text5:        #b1b1b1;

  --masthead:     #a30d20;
  --gold:         #a87a14;
  --info:         #4f46e5;
  --info-2:       #6366f1;
  --ok:           #047857;
  --ok-2:         #059669;
  --warn:         #b45309;
  --warn-2:       #d97706;
  --err:          #b91c1c;
  --err-2:        #dc2626;
  --terminal:     #047857;

  --shadow-card:  0 1px 0 rgba(255,255,255,0.7) inset, 0 4px 14px -8px rgba(80, 60, 20, 0.18);
  --shadow-pop:   0 24px 48px -12px rgba(60,40,10,0.18), 0 0 0 1px rgba(176, 154, 100, 0.35);
}

/* ─── Reset base ──────────────────────────────────────────────────────── */
html {
  font-feature-settings: 'ss01', 'cv11';
}
body {
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text2);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
:root[data-theme="dark"] body {
  background-image:
    radial-gradient(900px 600px at 100% -10%, rgba(99,102,241,0.07), transparent 60%),
    radial-gradient(700px 500px at -10% 110%, rgba(16,185,129,0.04), transparent 60%);
  background-attachment: fixed;
}
:root[data-theme="light"] body {
  background-image:
    radial-gradient(900px 600px at 100% -10%, rgba(163,13,32,0.04), transparent 60%),
    radial-gradient(700px 500px at -10% 110%, rgba(216,166,23,0.05), transparent 60%);
  background-attachment: fixed;
}

/* ─── Tipografía ──────────────────────────────────────────────────────── */
.font-sans  { font-family: 'Inter', ui-sans-serif, system-ui, sans-serif; }
.font-serif { font-family: 'Source Serif 4', 'Source Serif Pro', 'Charter', 'Georgia', 'Times New Roman', serif; font-feature-settings: 'lnum'; }
.font-mono  { font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, 'Menlo', monospace; font-feature-settings: 'cv02','cv03','cv04','zero'; }
.tabular-nums { font-variant-numeric: tabular-nums; }
.uppercase-kicker {
  font-family: 'JetBrains Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 10.5px;
  font-weight: 500;
  color: var(--text4);
}

/* ─── Scrollbars ──────────────────────────────────────────────────────── */
* { scrollbar-width: thin; scrollbar-color: var(--surface3) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 999px; }
*::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* ─── Surfaces base ───────────────────────────────────────────────────── */
.surface-1 { background: var(--surface1); }
.surface-2 { background: var(--surface2); }
.surface-3 { background: var(--surface3); }
.border-app { border-color: var(--border); }
.border-app-strong { border-color: var(--border-strong); }
.text-1 { color: var(--text1); }
.text-2 { color: var(--text2); }
.text-3 { color: var(--text3); }
.text-4 { color: var(--text4); }
.text-5 { color: var(--text5); }
.text-masthead { color: var(--masthead); }
.text-gold { color: var(--gold); }
.text-info { color: var(--info); }
.text-ok   { color: var(--ok); }
.text-warn { color: var(--warn); }
.text-err  { color: var(--err); }
.bg-app { background: var(--bg); }
.bg-app-soft { background: var(--bg-soft); }

/* ─── Card ────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface1);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-card);
}
.card-tight { border-radius: 8px; }
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.card-kicker {
  font-family: 'JetBrains Mono', monospace;
  text-transform: uppercase; letter-spacing: 0.12em;
  font-size: 10.5px; color: var(--text4);
}
.card-title { font-size: 14px; font-weight: 600; color: var(--text1); letter-spacing: -0.005em; }
.card-meta  { font-size: 11.5px; color: var(--text4); font-family: 'JetBrains Mono', monospace; }

/* ─── Botones ─────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; font-size: 12.5px; line-height: 1; font-weight: 500;
  border-radius: 7px; border: 1px solid transparent; cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease, transform 100ms ease;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn:active   { transform: translateY(1px); }

.btn-primary {
  background: var(--info);
  color: white;
  border-color: var(--info);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), 0 1px 0 rgba(0,0,0,0.25);
}
.btn-primary:hover { background: var(--info-2); border-color: var(--info-2); }

.btn-ghost {
  background: var(--surface2);
  color: var(--text2);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--surface-hover); color: var(--text1); border-color: var(--border-strong); }

.btn-icon { padding: 6px; }

.btn-kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  font-family: 'JetBrains Mono', monospace; font-size: 10px; font-weight: 500;
  background: var(--surface3); color: var(--text3);
  border: 1px solid var(--border-strong);
  border-radius: 4px; line-height: 1;
}

/* ─── Inputs ──────────────────────────────────────────────────────────── */
.input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text1);
  padding: 8px 12px;
  font-size: 13px;
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}
.input::placeholder { color: var(--text4); }
.input:focus {
  outline: none;
  border-color: var(--info);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--info) 22%, transparent);
  background: var(--surface1);
}

/* ─── Chips ───────────────────────────────────────────────────────────── */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; font-size: 11px; font-weight: 500;
  border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface2); color: var(--text2);
  letter-spacing: 0.01em; white-space: nowrap;
  line-height: 1.4;
}
.chip-mono { font-family: 'JetBrains Mono', monospace; }
.chip .dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }

.chip-ok   { background: color-mix(in oklab, var(--ok)   14%, transparent); color: var(--ok-2);   border-color: color-mix(in oklab, var(--ok)   45%, transparent); }
.chip-warn { background: color-mix(in oklab, var(--warn) 14%, transparent); color: var(--warn-2); border-color: color-mix(in oklab, var(--warn) 45%, transparent); }
.chip-err  { background: color-mix(in oklab, var(--err)  14%, transparent); color: var(--err-2);  border-color: color-mix(in oklab, var(--err)  45%, transparent); }
.chip-info { background: color-mix(in oklab, var(--info) 14%, transparent); color: var(--info-2); border-color: color-mix(in oklab, var(--info) 45%, transparent); }
.chip-gold { background: color-mix(in oklab, var(--gold) 14%, transparent); color: var(--gold);   border-color: color-mix(in oklab, var(--gold) 45%, transparent); }
.chip-masthead { background: color-mix(in oklab, var(--masthead) 14%, transparent); color: var(--masthead); border-color: color-mix(in oklab, var(--masthead) 45%, transparent); }

/* ─── StatusDot ───────────────────────────────────────────────────────── */
.statusdot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.statusdot-ok   { background: var(--ok);   box-shadow: 0 0 8px -1px color-mix(in oklab, var(--ok) 70%, transparent); }
.statusdot-run  { background: var(--info); box-shadow: 0 0 8px -1px color-mix(in oklab, var(--info) 70%, transparent); animation: pulseRun 1.4s ease-in-out infinite; }
.statusdot-warn { background: var(--warn); box-shadow: 0 0 8px -1px color-mix(in oklab, var(--warn) 70%, transparent); }
.statusdot-err  { background: var(--err);  box-shadow: 0 0 8px -1px color-mix(in oklab, var(--err)  70%, transparent); }
.statusdot-idle { background: var(--text5); }
.statusdot-info { background: var(--info); }
@keyframes pulseRun {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.5; transform: scale(0.78); }
}

/* ─── Skeleton ────────────────────────────────────────────────────────── */
@keyframes shimmer { 0% { background-position: -400px 0; } 100% { background-position: 400px 0; } }
.skel {
  background: linear-gradient(90deg,
    color-mix(in oklab, var(--surface2) 70%, transparent) 0%,
    color-mix(in oklab, var(--surface3) 80%, transparent) 50%,
    color-mix(in oklab, var(--surface2) 70%, transparent) 100%);
  background-size: 800px 100%;
  animation: shimmer 1.4s linear infinite;
  border-radius: 4px;
}

/* ─── Animaciones de entrada ─────────────────────────────────────────── */
@keyframes fadeIn   { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideIn  { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes popIn    { from { transform: scale(0.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.anim-fadein  { animation: fadeIn  180ms ease; }
.anim-slidein { animation: slideIn 240ms cubic-bezier(.2,.7,.3,1); }
.anim-popin   { animation: popIn   180ms cubic-bezier(.2,.7,.3,1); }

/* ─── Newspaper (run detail) ──────────────────────────────────────────── */
.newspaper {
  background: var(--surface1);
  padding: 36px 40px 44px;
  border-radius: 10px;
  border: 1px solid var(--border);
}
:root[data-theme="light"] .newspaper {
  background: #fbf8ef;
  box-shadow: 0 1px 0 rgba(255,255,255,1) inset, 0 4px 22px -10px rgba(80, 60, 20, 0.18);
}
.newspaper .nameplate {
  font-family: 'Source Serif 4', 'Charter', serif;
  font-weight: 900; font-style: italic;
  font-size: 32px; letter-spacing: -0.015em;
  color: var(--masthead);
  border-top: 3px double var(--text1);
  border-bottom: 3px double var(--text1);
  padding: 10px 0 8px;
  text-align: center;
  text-transform: uppercase;
  line-height: 1;
}
.newspaper .nameplate-meta {
  display: flex; justify-content: space-between; align-items: center;
  font-family: 'JetBrains Mono', monospace; font-size: 10.5px;
  color: var(--text3); padding: 6px 2px 0; text-transform: uppercase;
  letter-spacing: 0.1em;
}
.newspaper .kicker {
  font-family: 'JetBrains Mono', monospace;
  text-transform: uppercase; letter-spacing: 0.15em;
  font-size: 11px; color: var(--masthead);
  font-weight: 600;
  margin-top: 26px;
}
.newspaper h1.headline {
  font-family: 'Source Serif 4', 'Charter', serif;
  font-weight: 700; font-size: 38px; line-height: 1.1;
  color: var(--text1); margin: 6px 0 10px;
  letter-spacing: -0.018em; text-wrap: balance;
}
.newspaper .deck {
  font-family: 'Source Serif 4', 'Charter', serif;
  font-size: 17px; line-height: 1.45; color: var(--text2);
  font-style: italic; margin-bottom: 10px;
  text-wrap: balance;
}
.newspaper .byline {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text4); border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border); padding: 8px 0; margin-bottom: 20px;
}
.newspaper .article {
  column-count: 2; column-gap: 32px;
  column-rule: 1px solid var(--border);
  font-family: 'Source Serif 4', 'Charter', serif;
  font-size: 14.5px; line-height: 1.62; color: var(--text2);
  text-align: justify; hyphens: auto;
}
.newspaper .article > * { break-inside: avoid-column; }
.newspaper .article p { margin: 0 0 0.9em; }
.newspaper .article p.lede:first-letter {
  font-size: 3.4em; font-weight: 700;
  float: left; line-height: 0.85; padding: 4px 8px 0 0;
  color: var(--masthead); font-family: 'Source Serif 4', serif;
}
.newspaper .article h2 {
  font-family: 'Source Serif 4', serif;
  font-weight: 700; font-size: 18px; color: var(--text1);
  margin: 1.3em 0 0.4em; column-span: none;
}
.newspaper .article h3 {
  font-family: 'JetBrains Mono', monospace;
  text-transform: uppercase; letter-spacing: 0.1em; font-size: 11.5px;
  font-weight: 600; color: var(--text3);
  margin: 1.2em 0 0.4em;
}
.newspaper .article blockquote {
  border-left: 3px solid var(--masthead);
  padding: 4px 0 4px 12px; margin: 1em 0;
  font-style: italic; color: var(--text2);
}
.newspaper .article a {
  color: var(--info); text-decoration: underline;
  text-decoration-color: color-mix(in oklab, var(--info) 40%, transparent);
}
.newspaper .article ul, .newspaper .article ol {
  padding-left: 1.2em; margin: 0 0 0.9em;
}
.newspaper .article li { margin: 0.2em 0; }

/* móvil: una sola columna */
@media (max-width: 720px) {
  .newspaper { padding: 22px 18px 28px; }
  .newspaper .article { column-count: 1; }
  .newspaper h1.headline { font-size: 28px; }
  .newspaper .nameplate { font-size: 24px; }
}

/* ─── Iframe writer ───────────────────────────────────────────────────── */
iframe.writer-frame {
  width: 100%; min-height: 520px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface2);
}

/* ─── Terminal ────────────────────────────────────────────────────────── */
.terminal {
  background: #0a0d14;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px; line-height: 1.55;
  color: #c5d1d9;
  padding: 14px 16px;
  overflow: auto;
}
:root[data-theme="light"] .terminal {
  background: #1c1e22;
  color: #d7d9de;
}
.terminal-line { display: grid; grid-template-columns: 110px 60px 110px 1fr; gap: 12px; }
.terminal-line .ts  { color: #6b7280; }
.terminal-line .mod { color: #8b95a3; }
.terminal-line.lvl-INFO    .lvl { color: #6b7280; }
.terminal-line.lvl-STEP    .lvl { color: #60a5fa; }
.terminal-line.lvl-WARNING .lvl { color: #fbbf24; }
.terminal-line.lvl-ERROR   .lvl { color: #f87171; }
.terminal-line.lvl-ERROR   .msg { color: #fca5a5; }
.terminal .blink {
  display: inline-block; width: 8px; height: 14px;
  background: var(--terminal); margin-left: 4px; vertical-align: middle;
  animation: blinker 1s steps(2) infinite;
}
@keyframes blinker { 50% { opacity: 0; } }

/* ─── Sidebar / topbar ────────────────────────────────────────────────── */
.sidebar {
  background: var(--surface1);
  border-right: 1px solid var(--border);
  transition: width 200ms cubic-bezier(.4,0,.2,1);
}
.side-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: 7px;
  color: var(--text3); cursor: pointer;
  font-size: 13px; font-weight: 500;
  transition: background 120ms ease, color 120ms ease;
  position: relative; min-height: 36px;
}
.side-item:hover { background: var(--surface2); color: var(--text1); }
.side-item.is-active {
  background: color-mix(in oklab, var(--info) 12%, transparent);
  color: var(--text1);
}
.side-item.is-active::before {
  content: ''; position: absolute; left: -10px; top: 6px; bottom: 6px;
  width: 2.5px; border-radius: 2px; background: var(--info);
}
.side-item .ico { flex-shrink: 0; width: 16px; height: 16px; }

/* ─── Health row ─────────────────────────────────────────────────────── */
.health-item {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 6px;
  font-size: 11.5px; color: var(--text3);
  background: var(--surface2); border: 1px solid var(--border);
  font-family: 'JetBrains Mono', monospace;
  white-space: nowrap;
}
.health-item .lbl { color: var(--text4); text-transform: uppercase; letter-spacing: 0.08em; font-size: 9.5px; }
.health-item .val { color: var(--text1); }

/* ─── Score bar (stacked horizontal) ──────────────────────────────────── */
.scorebar {
  height: 8px; border-radius: 999px; overflow: hidden;
  display: flex; background: var(--surface2);
  border: 1px solid var(--border);
}
.scorebar > span { display: block; height: 100%; }
.scorebar-source    { background: var(--info); }
.scorebar-freshness { background: var(--ok); }
.scorebar-relevance { background: var(--warn); }
.scorebar-trends    { background: var(--masthead); }
.scorebar-gemini    { background: var(--gold); }

/* ─── Gantt ───────────────────────────────────────────────────────────── */
.gantt-grid {
  position: relative;
  background-image: linear-gradient(to right, var(--border) 1px, transparent 1px);
  background-size: calc(100% / 10) 100%;
  background-position: 0 0;
}
.gantt-lane {
  /* responsivo: definido en bloque inferior */
  display: grid; align-items: center; min-height: 28px;
}
.gantt-bar {
  position: relative; height: 18px; border-radius: 4px;
  font-size: 10px; color: var(--text1); padding: 2px 6px;
  display: flex; align-items: center;
  border: 1px solid color-mix(in oklab, var(--text1) 6%, transparent);
}
.gantt-bar-info { background: color-mix(in oklab, var(--info) 28%, transparent); border-color: var(--info); color: var(--info-2); }
.gantt-bar-ok   { background: color-mix(in oklab, var(--ok) 28%, transparent);   border-color: var(--ok);   color: var(--ok-2); }
.gantt-bar-warn { background: color-mix(in oklab, var(--warn) 28%, transparent); border-color: var(--warn); color: var(--warn-2); }
.gantt-bar-err  { background: color-mix(in oklab, var(--err) 28%, transparent);  border-color: var(--err);  color: var(--err-2); }

/* ─── Tables ──────────────────────────────────────────────────────────── */
.t-row { transition: background 100ms ease; }
.t-row:hover { background: var(--surface-hover); }
.t-row-selected { background: color-mix(in oklab, var(--gold) 8%, transparent); }
.t-th {
  text-align: left; font-weight: 500; font-size: 10.5px;
  text-transform: uppercase; letter-spacing: 0.1em; color: var(--text4);
  padding: 8px 12px; border-bottom: 1px solid var(--border);
  background: var(--surface2);
}
.t-td {
  padding: 10px 12px; font-size: 12.5px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

/* ─── Toast ───────────────────────────────────────────────────────────── */
.toast {
  background: var(--surface1);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-pop);
  backdrop-filter: blur(8px);
  border-radius: 8px;
}

/* ─── Focus visible ───────────────────────────────────────────────────── */
button:focus-visible, a:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid color-mix(in oklab, var(--info) 70%, transparent);
  outline-offset: 2px; border-radius: 6px;
}

/* ─── Sparkline path stroke (Chart.js + svg components) ──────────────── */
.sparkline path { stroke-linecap: round; stroke-linejoin: round; }

/* ─── highlight.js minor overrides ────────────────────────────────────── */
pre code.hljs { background: transparent; padding: 0; }

/* ─── Mobile sidebar drawer ───────────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar.is-mobile {
    position: fixed; inset: 0 auto 0 0;
    width: 256px !important; z-index: 50;
    transform: translateX(-100%);
    transition: transform 200ms ease;
  }
  .sidebar.is-mobile.is-open { transform: translateX(0); }
}

/* ─── InfoTip ("?" en círculo con tooltip) ────────────────────────────── */
/* Funciona en hover (desktop) y en focus/tap (mobile). El tooltip se
   posiciona fuera del flujo y usa z-index alto. Los cards que lo contienen
   NO deben usar overflow:hidden o el tooltip se recorta. */
.infotip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--surface3); color: var(--text4);
  font-size: 10px; font-weight: 700; cursor: help;
  position: relative;
  transition: background 120ms ease, color 120ms ease;
  font-family: 'Inter', sans-serif;
  vertical-align: middle;
  letter-spacing: 0;
  user-select: none;
  line-height: 1;
  padding: 0;
  /* Crea contexto de apilamiento propio cuando está activo */
  isolation: isolate;
}
.infotip:hover,
.infotip:focus-visible,
.infotip:focus,
.infotip:active { background: var(--info); color: #ffffff; outline: none; }

.infotip[data-tip]:hover::after,
.infotip[data-tip]:focus::after,
.infotip[data-tip]:focus-visible::after,
.infotip[data-tip]:active::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 9px);
  right: -6px;
  background: var(--surface1);
  color: var(--text1);
  border: 1px solid var(--border-strong);
  padding: 9px 11px;
  border-radius: 7px;
  font-size: 11.5px;
  font-weight: 400;
  line-height: 1.55;
  width: max(220px, min(280px, 80vw));
  text-align: left;
  z-index: 9999;
  box-shadow: var(--shadow-pop);
  pointer-events: none;
  white-space: pre-line;
  letter-spacing: 0;
  font-family: 'Inter', sans-serif;
  text-transform: none;
}
.infotip[data-tip]:hover::before,
.infotip[data-tip]:focus::before,
.infotip[data-tip]:focus-visible::before,
.infotip[data-tip]:active::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 4px);
  right: 0px;
  border: 5px solid transparent;
  border-top-color: var(--border-strong);
  z-index: 9999;
}
/* posicionamientos alternos */
.infotip.tip-left[data-tip]:hover::after,
.infotip.tip-left[data-tip]:focus::after,
.infotip.tip-left[data-tip]:active::after { right: auto; left: -6px; }
.infotip.tip-left[data-tip]:hover::before,
.infotip.tip-left[data-tip]:focus::before,
.infotip.tip-left[data-tip]:active::before { right: auto; left: 0; }
.infotip.tip-below[data-tip]:hover::after,
.infotip.tip-below[data-tip]:focus::after,
.infotip.tip-below[data-tip]:active::after { bottom: auto; top: calc(100% + 9px); }
.infotip.tip-below[data-tip]:hover::before,
.infotip.tip-below[data-tip]:focus::before,
.infotip.tip-below[data-tip]:active::before { bottom: auto; top: calc(100% + 4px); border-top-color: transparent; border-bottom-color: var(--border-strong); }

/* ─── Gantt bar tooltip (data-tip) ────────────────────────────────────── */
.gantt-bar[data-tip] { cursor: default; overflow: visible; }
.gantt-bar[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 7px);
  left: 0;
  background: var(--surface1);
  color: var(--text1);
  border: 1px solid var(--border-strong);
  padding: 8px 11px;
  border-radius: 6px;
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 400;
  line-height: 1.55;
  white-space: pre-line;
  z-index: 9999;
  box-shadow: var(--shadow-pop);
  pointer-events: none;
  min-width: 160px;
  max-width: 260px;
}
.gantt-bar[data-tip]:hover::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 2px);
  left: 8px;
  border: 5px solid transparent;
  border-top-color: var(--border-strong);
  z-index: 9999;
}

/* Importante: cualquier ancestor con overflow:hidden recorta el tooltip.
   En desktop, los KPI cards de Overview tenían overflow-hidden para clipear
   la sparkline; ahora la sparkline se clipea via clip-path en lugar de
   recortar todo el card. */
.kpi-card { overflow: visible !important; position: relative; }
.kpi-card .kpi-spark {
  position: absolute; right: 12px; bottom: 8px;
  pointer-events: none;
  max-width: 50%;
  /* clip-path para no salirse aunque sea responsive */
  clip-path: inset(0 0 0 0 round 4px);
}

/* ─── Gantt responsive ────────────────────────────────────────────────── */
.gantt-lane {
  display: grid;
  grid-template-columns: clamp(78px, 14vw, 130px) 1fr;
  gap: clamp(6px, 1.2vw, 14px);
  align-items: center;
  min-height: 28px;
}
.gantt-lane-label {
  font-size: 11.5px;
  color: var(--text3);
  font-family: 'JetBrains Mono', monospace;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
@media (max-width: 540px) {
  .gantt-lane { grid-template-columns: 1fr; gap: 4px; min-height: 0; padding: 4px 0; }
  .gantt-lane-label { font-size: 10.5px; }
}

/* ─── Sparkline interactiva ──────────────────────────────────────────── */
.sparkline-i { position: relative; display: inline-block; }
.sparkline-i .sp-points circle {
  opacity: 0;
  transition: opacity 120ms ease;
  cursor: pointer;
  pointer-events: all;
}
.sparkline-i:hover .sp-points circle { opacity: 0.6; }
.sparkline-i .sp-points circle:hover { opacity: 1; transform-origin: center; }
.sparkline-tip {
  position: absolute;
  bottom: calc(100% + 6px);
  background: var(--surface1);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 5px 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: var(--text1);
  white-space: nowrap;
  pointer-events: none;
  box-shadow: var(--shadow-pop);
  transform: translateX(-50%);
  display: none;
  z-index: 30;
}
.sparkline-i .sp-points circle:hover ~ .sparkline-tip,
.sparkline-i .sp-points circle:hover + foreignObject .sparkline-tip { display: block; }

/* ─── Diagnóstico panel (Run Detail) ─────────────────────────────────── */
.diagnostic-card {
  background: linear-gradient(180deg,
    color-mix(in oklab, var(--err) 8%, transparent),
    color-mix(in oklab, var(--err) 3%, transparent));
  border: 1px solid color-mix(in oklab, var(--err) 50%, var(--border));
  border-radius: 10px;
  overflow: hidden;
}
.diagnostic-card .diag-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid color-mix(in oklab, var(--err) 30%, var(--border));
  background: color-mix(in oklab, var(--err) 7%, transparent);
}
.diagnostic-card .diag-attempt {
  padding: 14px 16px;
  border-bottom: 1px solid color-mix(in oklab, var(--err) 14%, var(--border));
}
.diagnostic-card .diag-attempt:last-child { border-bottom: 0; }

/* Tail: keep DOMPurify-sanitized blocks tidy when used outside .newspaper */
.prose-mini h2, .prose-mini h3 { color: var(--text1); }
.prose-mini p { color: var(--text2); margin: 0 0 0.8em; }
.prose-mini a { color: var(--info); text-decoration: underline; }
