/* Sistema de diseño: Together AI (papel glaciar, tinta negra, pasteles como categorías) */
:root {
  --obsidian: #000000;
  --paper-white: #ffffff;
  --slate: #4d4d4d;
  --hairline: #d6d6d6;
  --midnight-ink: #010120;
  --periwinkle: #bdbbff;
  --mint-cyan: #c8f6f9;
  --sky: #c1dff9;
  --blush: #fde3f6;
  --peach: #ffdccd;

  --surface: var(--paper-white);
  --surface-raised: var(--paper-white);
  --ink: var(--obsidian);
  --ink-muted: var(--slate);
  --border: var(--hairline);
  --border-strong: #767676;
  --accent: var(--periwinkle);
  --on-pastel: var(--obsidian);

  --radius-md: 4px;
  --shadow-xl: rgba(1, 1, 32, 0.1) -10px 0px 75px 0px;
  --page-max-width: 1200px;
  --font-sans: "The Future", "Inter Tight", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "PP Neue Montreal Mono", "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
[data-theme="midnight"] {
  --surface: var(--midnight-ink);
  --surface-raised: #0e0e38;
  --ink: var(--paper-white);
  --ink-muted: #b8b8d2;
  --border: #34345c;
  --border-strong: #8a8aa8;
  background: var(--surface);
  color: var(--ink);
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--surface); color: var(--ink); font-family: var(--font-sans); font-size: 16px; line-height: 1.3; letter-spacing: -0.16px; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* Mono: solo etiquetas, badges, botones y metadatos */
.label { font-family: var(--font-mono); font-size: 11px; font-weight: 500; line-height: 1.4; letter-spacing: 0.08px; text-transform: uppercase; color: var(--ink-muted); }
.meta { font-family: var(--font-mono); font-size: 11px; font-weight: 400; line-height: 1.4; letter-spacing: 0.08px; color: var(--ink-muted); }

/* Layout */
.wrap { max-width: var(--page-max-width); margin: 0 auto; padding: 0 24px; }
header.top { position: sticky; top: 0; z-index: 5; background: var(--paper-white); box-shadow: var(--shadow-xl); }
header.top .wrap { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 16px; }
.brand { display: flex; align-items: baseline; gap: 12px; }
.brand strong { font-size: 22px; font-weight: 500; line-height: 1.25; letter-spacing: -0.22px; }

.hero { padding: 64px 0 40px; display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.hero h1 { font-size: 40px; line-height: 1.15; font-weight: 500; letter-spacing: -0.8px; margin: 12px 0 0; }
.hero h1 span { display: block; font-weight: 400; color: var(--ink-muted); }

/* Botones (TogetherAI.Button) */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; min-height: 36px; border-radius: var(--radius-md); border: 0; background: var(--obsidian); color: var(--paper-white); font-family: var(--font-mono); font-size: 13px; font-weight: 500; line-height: 1.2; letter-spacing: 0.09px; text-transform: uppercase; cursor: pointer; white-space: nowrap; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--border); }
.btn.ghost:hover { color: var(--obsidian); }
[data-theme="midnight"] .btn { background: var(--paper-white); color: var(--obsidian); }
[data-theme="midnight"] .btn.ghost { background: transparent; color: var(--ink); border-color: var(--border-strong); }
.btn.sm { min-height: 32px; padding: 6px 12px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* Estado del rastreador */
.crawler[hidden] { display: none; }
.crawler { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 12px 16px; margin-bottom: 24px; border: 1px solid var(--border); border-radius: var(--radius-md); }
.crawler-info { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; min-width: 0; }
.crawler-info .dash { width: 12px; height: 2px; background: var(--accent); flex: none; }
.crawler-text { font-size: 14px; letter-spacing: -0.14px; color: var(--ink-muted); }
.crawler-text strong { font-weight: 500; color: var(--ink); }

/* Filtros (estilo Platform Tab compacto) */
.bar { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding-bottom: 24px; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.tab { min-height: 36px; padding: 8px 12px; border-radius: var(--radius-md); border: 1px solid var(--border); background: var(--paper-white); cursor: pointer; display: inline-flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 500; letter-spacing: -0.16px; }
.tab .n { font-family: var(--font-mono); font-size: 11px; font-weight: 400; letter-spacing: 0.08px; color: var(--ink-muted); }
.tab[aria-pressed="true"] { background: var(--mint-cyan); border-color: var(--mint-cyan); color: var(--on-pastel); }
.search { height: 36px; width: 280px; max-width: 100%; border: 1px solid var(--border-strong); border-radius: var(--radius-md); padding: 0 12px; background: var(--paper-white); font-size: 16px; }

/* Tabla */
.table { border-top: 1px solid var(--ink); }
.row { display: grid; grid-template-columns: minmax(180px, 1.4fr) minmax(160px, 1.2fr) 120px minmax(150px, 1fr) 120px 96px; gap: 16px; align-items: center; padding: 16px 4px; border-bottom: 1px solid var(--border); cursor: pointer; }
.row:hover .company { text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 4px; }
.row.head { cursor: default; padding: 12px 4px; }
.company { font-size: 18px; font-weight: 500; letter-spacing: -0.18px; }
.sub { color: var(--ink-muted); font-size: 14px; letter-spacing: -0.14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell { min-width: 0; }

/* Badges: pastel = tipo de señal (una categoría por pastel); estado = Category Badge mono sin relleno */
.chip { display: inline-flex; align-items: center; min-height: 24px; padding: 2px 8px; border-radius: var(--radius-md); font-family: var(--font-mono); font-size: 11px; font-weight: 500; line-height: 1.4; letter-spacing: 0.08px; text-transform: uppercase; color: var(--on-pastel); white-space: nowrap; }
.s-ronda { background: var(--sky); }
.s-contratacion { background: var(--blush); }
.s-lanzamiento { background: var(--peach); }
.s-otro, .s-stage { background: transparent; border: 1px solid var(--border); color: var(--ink); }
.status { font-family: var(--font-mono); font-size: 11px; font-weight: 500; line-height: 1.4; letter-spacing: 0.08px; text-transform: uppercase; color: var(--ink); display: inline-flex; align-items: center; gap: 8px; }
.status::before { content: ""; width: 12px; height: 2px; background: var(--border-strong); }
.status.st-respondio::before { background: var(--ink); }
.status.st-contactado::before { background: var(--accent); }
.status.st-descartado { color: var(--ink-muted); }

.empty { padding: 80px 0; text-align: center; color: var(--ink-muted); font-size: 18px; letter-spacing: -0.18px; }
.empty h2 { font-size: 28px; font-weight: 500; letter-spacing: -0.42px; line-height: 1.2; margin: 0 0 12px; color: var(--ink); }
.empty p { margin: 0 0 24px; }

/* Panel lateral */
.scrim { position: fixed; inset: 0; background: rgba(1, 1, 32, .24); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 10; }
.scrim.open { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(640px, 100%); background: var(--paper-white); border-left: 1px solid var(--border); transform: translateX(100%); transition: transform .25s ease; z-index: 11; display: flex; flex-direction: column; }
.drawer.open { transform: none; }
.d-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 24px; border-bottom: 1px solid var(--border); }
.d-head h2 { margin: 4px 0 0; font-size: 28px; font-weight: 500; line-height: 1.2; letter-spacing: -0.42px; }
.d-body { flex: 1; overflow-y: auto; padding: 0 24px 40px; }
.x { width: 36px; height: 36px; border-radius: var(--radius-md); border: 1px solid var(--border); background: var(--paper-white); cursor: pointer; font-size: 18px; line-height: 1; }

section.block { padding: 24px 0; border-bottom: 1px solid var(--border); }
section.block:last-child { border-bottom: 0; }
section.block > .label { display: block; margin-bottom: 16px; }
.sublabel { display: block; margin: 24px 0 12px; }

.status-picker { display: flex; gap: 8px; flex-wrap: wrap; }
.status-picker button, .seg button { min-height: 32px; padding: 6px 12px; border-radius: var(--radius-md); border: 1px solid var(--border); background: var(--paper-white); cursor: pointer; font-size: 14px; font-weight: 500; letter-spacing: -0.14px; color: var(--obsidian); }
.status-picker button[aria-pressed="true"], .seg button[aria-pressed="true"] { background: var(--mint-cyan); border-color: var(--mint-cyan); color: var(--on-pastel); }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field label { font-family: var(--font-mono); font-size: 11px; font-weight: 500; line-height: 1.4; letter-spacing: 0.08px; text-transform: uppercase; color: var(--ink-muted); }
.field input, .field select, .field textarea { width: 100%; border: 1px solid var(--border-strong); border-radius: var(--radius-md); padding: 8px 12px; background: var(--paper-white); font-size: 16px; }
.field textarea { resize: vertical; min-height: 72px; line-height: 1.3; }
.links { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 16px; }
.linkout { font-family: var(--font-mono); font-size: 11px; font-weight: 500; letter-spacing: 0.08px; text-transform: uppercase; text-decoration: none; border-bottom: 2px solid var(--accent); padding-bottom: 2px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; align-items: center; margin-top: 24px; }

/* Redactor con IA: la única banda midnight de la página */
section.block.ai-band { margin: 0 -24px; padding: 32px 24px; border-bottom: 0; }
.ai-band > .label { color: var(--ink-muted); }
.ai-band .dash { display: block; width: 12px; height: 2px; background: var(--accent); margin-bottom: 12px; }
.ai-band h3 { margin: 0 0 4px; font-size: 22px; font-weight: 500; line-height: 1.25; letter-spacing: -0.22px; }
.ai-band h3 span { font-weight: 400; color: var(--ink-muted); }
.ai-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 16px; }
.seg { display: inline-flex; gap: 4px; }
[data-theme="midnight"] .seg button { background: transparent; border-color: var(--border-strong); color: var(--ink); }
[data-theme="midnight"] .seg button[aria-pressed="true"] { background: var(--mint-cyan); border-color: var(--mint-cyan); color: var(--on-pastel); }
.instr { flex: 1; min-width: 200px; min-height: 36px; border: 1px solid var(--border-strong); border-radius: var(--radius-md); padding: 8px 12px; background: var(--surface-raised); font-size: 14px; }
.instr::placeholder, .draft::placeholder { color: var(--ink-muted); }
.draft { width: 100%; min-height: 200px; margin-top: 16px; border: 1px solid var(--border-strong); border-radius: var(--radius-md); padding: 16px; background: var(--surface-raised); resize: vertical; font-size: 16px; line-height: 1.45; }
.draft-meta { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.count.over { color: var(--ink); font-weight: 500; }
.count.over::after { content: " · ↑ EXCEDE EL LÍMITE"; }
.draft-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.hint { color: var(--ink-muted); font-size: 14px; letter-spacing: -0.14px; margin: 16px 0 0; max-width: 52ch; }

.history { margin-top: 24px; }
.history summary { cursor: pointer; font-family: var(--font-mono); font-size: 11px; font-weight: 500; letter-spacing: 0.08px; text-transform: uppercase; color: var(--ink-muted); }
.h-item { border-top: 1px solid var(--border); padding: 12px 0; }
.h-item p { margin: 8px 0 12px; white-space: pre-wrap; font-size: 14px; letter-spacing: -0.14px; color: var(--ink-muted); }
.h-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.spinner { width: 12px; height: 12px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 16px); background: var(--obsidian); color: var(--paper-white); padding: 8px 16px; border-radius: var(--radius-md); font-family: var(--font-mono); font-size: 13px; font-weight: 500; letter-spacing: 0.09px; opacity: 0; pointer-events: none; transition: all .2s; z-index: 20; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error::before { content: "ERROR · "; color: var(--periwinkle); }

.m-meta { display: none; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
@media (max-width: 900px) {
  .row { grid-template-columns: 1fr auto; gap: 4px 12px; }
  .row.head { display: none; }
  .row .cell.signal, .row .cell.stage, .row .cell.contact, .row .cell.date-cell { display: none; }
  .row .m-meta { display: flex; }
}
@media (max-width: 560px) {
  .wrap { padding: 0 16px; }
  .hero { padding: 40px 0 24px; }
  .hero h1 { font-size: 32px; letter-spacing: -0.64px; }
  .grid { grid-template-columns: 1fr; }
  .d-head { padding: 16px; }
  .d-body { padding: 0 16px 40px; }
  section.block.ai-band { margin: 0 -16px; padding: 24px 16px; }
  .search { width: 100%; }
  .brand .label { display: none; }
}

/* Navegación entre secciones */
.nav { display: flex; gap: 24px; align-items: center; }
.nav a { font-size: 16px; letter-spacing: -0.16px; text-decoration: none; color: var(--ink-muted); padding: 4px 0; border-bottom: 2px solid transparent; }
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); font-weight: 500; border-bottom-color: var(--accent); }
@media (max-width: 560px) { .nav { gap: 16px; } #who { display: none; } }

/* ---------- Benchmark ---------- */

/* Banda de síntesis: la única banda midnight de esa página */
.band { padding: 48px 0; margin-bottom: 40px; }
.band .dash { display: block; width: 12px; height: 2px; background: var(--accent); margin-bottom: 12px; }
.band h2 { margin: 8px 0 0; font-size: 28px; font-weight: 500; line-height: 1.2; letter-spacing: -0.42px; }
.band h2 span { font-weight: 400; color: var(--ink-muted); }
.band-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.band p.lead { font-size: 18px; letter-spacing: -0.18px; line-height: 1.35; color: var(--ink); max-width: 72ch; margin: 0 0 32px; }
.band .muted { color: var(--ink-muted); font-size: 16px; max-width: 60ch; margin: 0; }
.ideas { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; margin-bottom: 32px; }
.idea { background: var(--surface-raised); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 20px; display: flex; flex-direction: column; gap: 8px; }
.idea .n { font-family: var(--font-mono); font-size: 11px; font-weight: 500; letter-spacing: 0.08px; color: var(--ink-muted); }
.idea h3 { margin: 0; font-size: 18px; font-weight: 500; line-height: 1.3; letter-spacing: -0.18px; }
.idea p { margin: 0; font-size: 14px; letter-spacing: -0.14px; color: var(--ink-muted); }
.idea .tags { display: flex; gap: 12px; flex-wrap: wrap; margin-top: auto; padding-top: 8px; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 32px; }
.cols h4, .facts h4, .pcard h4 { margin: 0 0 12px; font-family: var(--font-mono); font-size: 11px; font-weight: 500; letter-spacing: 0.08px; text-transform: uppercase; color: var(--ink-muted); }
.cols ul, .pcard ul, .facts ul { margin: 0; padding: 0; list-style: none; }
.cols li, .pcard li, .facts li { position: relative; padding: 0 0 10px 20px; font-size: 15px; line-height: 1.4; letter-spacing: -0.15px; }
.cols li::before, .pcard li::before, .facts li::before { content: ""; position: absolute; left: 0; top: 10px; width: 10px; height: 2px; background: var(--accent); }
.ind { padding: 0 0 14px; }
.ind strong { font-weight: 500; font-size: 15px; }
.ind .meta { display: block; margin: 2px 0 4px; }
.ind p { margin: 0; font-size: 14px; color: var(--ink-muted); }
.diff { margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--border); font-size: 18px; letter-spacing: -0.18px; line-height: 1.35; }

/* Ficha de competidor */
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 24px; }
.facts .full { grid-column: 1 / -1; }
.facts p { margin: 0; font-size: 15px; line-height: 1.4; letter-spacing: -0.15px; }
.facts dl { margin: 0; display: grid; gap: 8px; }
.facts dt { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08px; text-transform: uppercase; color: var(--ink-muted); }
.facts dd { margin: 0; font-size: 15px; line-height: 1.4; }
.summary { font-size: 18px; line-height: 1.35; letter-spacing: -0.18px; margin: 0 0 16px; }
.pcards { display: grid; gap: 12px; }
.pcard { border-radius: var(--radius-md); padding: 20px; color: var(--on-pastel); }
.pcard h4 { color: var(--on-pastel); }
.pcard.ideas-c { background: var(--mint-cyan); }
.pcard.opp-c { background: var(--peach); }
.pcard.str-c { background: var(--sky); }
.pcard.threat-c { background: var(--blush); }
.pcard p { margin: 0; font-size: 15px; line-height: 1.4; }
.pcard .why { display: block; font-size: 14px; color: var(--slate); margin-top: 2px; }
.sources { display: flex; flex-direction: column; gap: 6px; }
.sources a { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08px; color: var(--ink-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.analyzing { display: flex; gap: 12px; align-items: center; padding: 20px; border: 1px dashed var(--border-strong); border-radius: var(--radius-md); color: var(--ink-muted); font-size: 15px; }
.threat { font-family: var(--font-mono); font-size: 11px; font-weight: 500; letter-spacing: 0.08px; text-transform: uppercase; display: inline-flex; align-items: center; gap: 8px; }
.threat::before { content: ""; width: 12px; height: 2px; background: var(--border-strong); }
.threat.t-alta::before { background: var(--ink); height: 4px; }
.threat.t-media::before { background: var(--ink); }
.threat.t-baja::before { background: var(--accent); }
.row.bench { grid-template-columns: minmax(200px, 1.6fr) minmax(160px, 1.2fr) minmax(120px, 1fr) 110px 120px; }
@media (max-width: 900px) {
  .row.bench { grid-template-columns: 1fr auto; }
  .row.bench .cell.ind-cell, .row.bench .cell.size-cell, .row.bench .cell.date-cell { display: none; }
}
@media (max-width: 560px) {
  .facts { grid-template-columns: 1fr; }
  .band { padding: 32px 0; }
}
.pcard li::before { background: var(--on-pastel); }
