/* ============================================================
   InurApp · Manual operativo
   Estilo plano alineado a InurApp
   Sidebar oscuro (gray-950) + contenido claro + dorado primary
   Tipografía: Inter · Rutas/código: JetBrains Mono
   ============================================================ */

:root {
  /* Grises InurApp */
  --ink: #1f2937;         /* gray-800 */
  --ink-soft: #374151;    /* gray-700 */
  --muted: #6b7280;       /* gray-500 */
  --bg: #f4f5f7;
  --line: #e5e7eb;        /* gray-200 */
  --line-2: #eceef1;
  --paper: #ffffff;
  --card: #ffffff;

  /* Oscuro (sidebar app = gray-950) */
  --panel: #0b1120;
  --panel-2: #111827;     /* gray-900 */

  /* Dorado InurApp (escala primary) */
  --gold-50: #fefce8;
  --gold-100: #fef9c3;
  --gold: #ca8a04;        /* primary-600 */
  --gold-ink: #854d0e;    /* primary-800 · texto sobre claro */
  --gold-deep: #a16207;   /* primary-700 */
  --gold-bright: #facc15; /* primary-400 · sobre oscuro */

  --shadow-card: 0 1px 2px rgba(17, 24, 39, 0.04);

  --r-xl: 20px;
  --r-lg: 16px;
  --r-md: 12px;
  --r-sm: 9px;
  --content: 1000px;

  --font-display: "Inter", "SF Pro Display", "Segoe UI", ui-sans-serif, system-ui, sans-serif;
  --font-body: "Inter", "SF Pro Text", "Segoe UI", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", "Menlo", monospace;

  --ease: cubic-bezier(0.2, 0, 0, 1);
}

@page { size: A4; margin: 15mm 12mm; }

* { box-sizing: border-box; }

html { scroll-behavior: smooth; background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.68;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background: var(--bg);
}

::selection { background: rgba(250, 204, 21, 0.4); color: #422006; }

/* ---------- Barra de progreso de lectura ---------- */
.reading-progress {
  position: fixed;
  z-index: 60;
  inset: 0 0 auto 0;
  height: 3px;
  background: transparent;
}
.reading-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--gold-bright);
  transition: width 90ms linear;
}

/* ---------- Layout base ---------- */
.manual-shell {
  position: relative;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 28px;
  width: min(1440px, calc(100% - 48px));
  margin: 24px auto 64px;
}

/* ====================  SIDEBAR  ==================== */
.manual-sidebar {
  position: sticky;
  top: 24px;
  align-self: start;
  height: calc(100vh - 48px);
  padding: 20px 16px;
  color: #e5e7eb;
  border-radius: var(--r-xl);
  background: var(--panel);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.brand-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
}
.brand-mark {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px; height: 44px;
  border-radius: 12px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 16px;
  letter-spacing: -0.03em;
  color: #1a1204;
  background: var(--gold-bright);
}
.brand-card h1 {
  margin: 2px 0 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 21px;
  letter-spacing: -0.02em;
  color: #f8fafc;
}
.eyebrow {
  margin: 0;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(229, 231, 235, 0.5);
}
.eyebrow.gold { color: var(--gold-ink); }

.side-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 14px 2px;
}
.side-meta span {
  padding: 5px 10px;
  border-radius: 7px;
  font-size: 11.5px;
  font-weight: 600;
  color: rgba(229, 231, 235, 0.8);
  background: rgba(255, 255, 255, 0.05);
}
.side-meta span:first-child { color: #1a1204; background: var(--gold-bright); }

.toc-label {
  margin: 4px 4px 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(229, 231, 235, 0.4);
}

.manual-toc {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 2px 6px 12px 2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(250, 204, 21, 0.4) transparent;
}
.manual-toc::-webkit-scrollbar { width: 6px; }
.manual-toc::-webkit-scrollbar-thumb { background: rgba(250, 204, 21, 0.3); border-radius: 999px; }
.manual-toc ul { list-style: none; margin: 0; padding: 0; }
.manual-toc li { margin: 1px 0; }
.manual-toc a {
  position: relative;
  display: block;
  padding: 9px 12px;
  border-radius: 9px;
  color: rgba(229, 231, 235, 0.68);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  text-decoration: none;
  transition: background 140ms var(--ease), color 140ms var(--ease);
}
.manual-toc a:hover { color: #fff; background: rgba(255, 255, 255, 0.05); }
.manual-toc a.is-active {
  color: var(--gold-bright);
  background: rgba(250, 204, 21, 0.12);
  font-weight: 650;
}

.side-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(229, 231, 235, 0.35);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

/* ====================  MAIN  ==================== */
.manual-main { min-width: 0; }

/* ---------- HERO / PORTADA (claro y plano) ---------- */
.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  gap: 32px;
  align-items: center;
  padding: clamp(28px, 4vw, 52px);
  border-radius: var(--r-xl);
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 3px solid var(--gold);
}
.hero-copy .eyebrow.gold { color: var(--gold-ink); }
.hero-copy h1 {
  max-width: 16ch;
  margin: 12px 0 14px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(34px, 4.6vw, 58px);
  line-height: 1.04;
  letter-spacing: -0.04em;
  color: var(--ink);
  text-wrap: balance;
}
.hero-copy h1 em { font-style: normal; color: var(--gold-deep); }
.hero-lead {
  max-width: 56ch;
  margin: 0;
  color: var(--muted);
  font-size: clamp(15px, 1.4vw, 18px);
  line-height: 1.55;
  text-wrap: pretty;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 20px;
  border-radius: 10px;
  font-weight: 650;
  font-size: 14.5px;
  text-decoration: none;
  transition: background 140ms var(--ease), border-color 140ms var(--ease);
}
.btn.primary { color: #1a1204; background: var(--gold-bright); }
.btn.primary:hover { background: var(--gold); }
.btn.secondary { color: var(--ink); background: #fff; border: 1px solid var(--line); }
.btn.secondary:hover { background: var(--bg); border-color: #d1d5db; }

.hero-stats { display: grid; gap: 10px; align-content: center; }
.hero-stats div {
  padding: 16px 18px;
  border-radius: var(--r-md);
  background: var(--bg);
  border: 1px solid var(--line);
}
.hero-stats strong {
  display: block;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 34px;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--gold-deep);
  font-variant-numeric: tabular-nums;
}
.hero-stats span { font-size: 12.5px; font-weight: 600; color: var(--muted); }

/* ---------- ARTÍCULO ---------- */
.manual-article {
  width: min(var(--content), 100%);
  margin: 24px auto 0;
  padding: clamp(24px, 3.4vw, 48px) clamp(22px, 3.4vw, 52px);
  border-radius: var(--r-xl);
  background: var(--card);
  border: 1px solid var(--line);
}

/* Ficha de metadatos */
.doc-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 28px;
  margin: 0 0 10px;
  padding: 22px 24px;
  border-radius: var(--r-lg);
  background: var(--bg);
  border: 1px solid var(--line);
}
.doc-meta .meta-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-left: 13px;
  border-left: 2px solid var(--gold);
}
.doc-meta .meta-k {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-ink);
}
.doc-meta .meta-v { font-size: 14.5px; line-height: 1.4; color: var(--ink-soft); }
.doc-meta .meta-item:last-child { grid-column: 1 / -1; }

/* Tipografía de contenido */
.manual-article h2,
.manual-article h3,
.manual-article h4 { text-wrap: balance; }

.manual-article h2 {
  scroll-margin-top: 20px;
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin: 60px 0 22px;
  padding: 0 0 16px;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(26px, 3vw, 36px);
  line-height: 1.1;
  letter-spacing: -0.035em;
  color: var(--ink);
}
.manual-article h2:first-of-type { margin-top: 8px; }
.manual-article h2 .h2-num {
  flex: none;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.42em;
  color: var(--gold-ink);
  padding: 5px 9px;
  border-radius: 7px;
  background: var(--gold-50);
  border: 1px solid var(--gold-100);
  transform: translateY(-0.3em);
}

.manual-article h3 {
  scroll-margin-top: 20px;
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 38px 0 12px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(18px, 1.8vw, 22px);
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: #111827;
}
.manual-article h3::before {
  content: "";
  flex: none;
  width: 7px; height: 7px;
  border-radius: 2px;
  transform: translateY(-2px);
  background: var(--gold);
}

.manual-article h4 { margin: 24px 0 10px; font-size: 16px; font-weight: 700; color: #374151; }

.manual-article p { margin: 13px 0; color: var(--ink-soft); text-wrap: pretty; }
.manual-article strong { color: var(--ink); font-weight: 650; }

/* Etiqueta que introduce una captura */
.lead-label {
  margin: 24px 0 -8px !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--gold-ink) !important;
}

/* Enlaces */
.manual-article a {
  color: var(--gold-ink);
  text-decoration-color: rgba(202, 138, 4, 0.35);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
}
.manual-article a:hover { color: #713f12; text-decoration-color: currentColor; }

/* Código y rutas */
code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  padding: 0.14em 0.42em;
  border-radius: 6px;
  background: var(--gold-50);
  color: var(--gold-ink);
  border: 1px solid var(--gold-100);
  word-break: break-word;
}
code.is-route { padding-left: 1.5em; position: relative; font-weight: 500; }
code.is-route::before {
  content: "›";
  position: absolute;
  left: 0.55em; top: 50%;
  transform: translateY(-50%);
  color: var(--gold);
  font-weight: 800;
}

/* Listas */
.manual-article ul:not(.plain),
.manual-article ol {
  margin: 16px 0 22px;
  padding: 16px 20px;
  border-radius: var(--r-lg);
  background: #fcfcfd;
  border: 1px solid var(--line);
}
.manual-article li { margin: 6px 0; padding-left: 4px; }
.manual-article ul:not(.plain) { list-style: none; padding-left: 18px; }
.manual-article ul:not(.plain) > li { position: relative; padding-left: 24px; }
.manual-article ul:not(.plain) > li::before {
  content: "";
  position: absolute;
  left: 3px; top: 0.62em;
  width: 7px; height: 7px;
  border-radius: 2px;
  background: var(--gold);
}

/* Flujos numerados = stepper plano */
.manual-article ol { list-style: none; counter-reset: step; padding-left: 20px; }
.manual-article ol > li {
  position: relative;
  counter-increment: step;
  padding: 3px 0 3px 42px;
  min-height: 28px;
}
.manual-article ol > li::before {
  content: counter(step);
  position: absolute;
  left: 0; top: 1px;
  display: grid;
  place-items: center;
  width: 27px; height: 27px;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 600;
  color: #1a1204;
  background: var(--gold-bright);
}
.manual-article ol > li::after {
  content: "";
  position: absolute;
  left: 13px; top: 31px; bottom: -4px;
  width: 1px;
  background: var(--gold-100);
}
.manual-article ol > li:last-child::after { display: none; }

/* Cita informativa */
blockquote {
  position: relative;
  margin: 22px 0;
  padding: 18px 20px 18px 54px;
  border-radius: var(--r-lg);
  color: var(--ink-soft);
  background: var(--gold-50);
  border: 1px solid var(--gold-100);
}
blockquote p { margin: 0; }
blockquote::before {
  content: "i";
  position: absolute;
  left: 18px; top: 18px;
  display: grid;
  place-items: center;
  width: 24px; height: 24px;
  border-radius: 999px;
  font-weight: 700;
  font-style: italic;
  color: #fff;
  background: var(--gold);
}

hr { border: 0; height: 1px; margin: 42px 0; background: var(--line); }

/* ---------- CAPTURAS enmarcadas como ventana ---------- */
.shot {
  margin: 20px 0 30px;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  break-inside: avoid;
  page-break-inside: avoid;
}
.shot-chrome {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--panel-2);
}
.shot-dots { display: flex; gap: 6px; flex: none; }
.shot-dots i { width: 10px; height: 10px; border-radius: 999px; background: #3b4252; }
.shot-dots i:nth-child(1) { background: #ef4444; }
.shot-dots i:nth-child(2) { background: #facc15; }
.shot-dots i:nth-child(3) { background: #22c55e; }
.shot-title {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: rgba(229, 231, 235, 0.7);
}
.shot-tag {
  flex: none;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold-bright);
  background: rgba(250, 204, 21, 0.12);
}
.shot img { display: block; width: 100%; height: auto; margin: 0; border: 0; border-radius: 0; }
.shot figcaption {
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  background: #fafafa;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
}

/* Imagen suelta (fallback sin JS) */
.manual-article img {
  display: block;
  width: 100%;
  height: auto;
  margin: 18px 0 26px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  break-inside: avoid;
}

.screenshot-block { margin: 24px 0 30px; }
.screenshot-block > p { margin: 0 0 -8px !important; }

/* ---------- TABLAS ---------- */
.table-scroll {
  margin: 20px 0 28px;
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 1px solid var(--line);
  overflow-x: auto;
}
.table-scroll table { margin: 0; border-radius: 0; border: 0; }

table {
  width: 100%;
  border-spacing: 0;
  border-collapse: separate;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  font-size: 14px;
}
thead th {
  position: sticky;
  top: 0;
  color: #f8fafc;
  background: var(--panel-2);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
th, td {
  padding: 12px 15px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}
tbody tr:nth-child(even) { background: #fafafa; }
tbody tr:hover { background: var(--gold-50); }
tbody tr:last-child td { border-bottom: 0; }
td code { white-space: nowrap; }
td strong { color: var(--gold-ink); }

/* ---------- Botón volver arriba ---------- */
.back-to-top {
  position: fixed;
  right: 24px; bottom: 24px;
  z-index: 50;
  display: grid;
  place-items: center;
  width: 46px; height: 46px;
  border: 0;
  border-radius: 12px;
  color: #1a1104;
  background: var(--gold-bright);
  font-size: 19px;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 180ms var(--ease), transform 180ms var(--ease), background 140ms var(--ease);
}
.back-to-top.is-visible { opacity: 1; pointer-events: auto; transform: translateY(0); }
.back-to-top:hover { background: var(--gold); }

/* ---------- Toggle TOC móvil ---------- */
.toc-toggle { display: none; }

/* ---------- Reveal (sutil) ---------- */
.reveal { opacity: 0; transform: translateY(10px); transition: opacity 480ms var(--ease), transform 480ms var(--ease); }
.reveal.is-in { opacity: 1; transform: none; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1120px) {
  .manual-shell { grid-template-columns: 1fr; gap: 16px; width: min(100% - 30px, 1000px); }
  .manual-sidebar {
    position: sticky;
    top: 0;
    height: auto;
    padding: 14px 16px;
    z-index: 40;
  }
  .manual-sidebar.is-collapsed .manual-toc,
  .manual-sidebar.is-collapsed .side-footer,
  .manual-sidebar.is-collapsed .toc-label { display: none; }
  .manual-toc { max-height: min(60vh, 460px); }
  .toc-toggle {
    display: inline-grid;
    place-items: center;
    position: absolute;
    right: 14px; top: 14px;
    width: 40px; height: 40px;
    border: 0;
    border-radius: 10px;
    color: #1a1204;
    background: var(--gold-bright);
    font-size: 18px;
    cursor: pointer;
  }
  .hero-panel { grid-template-columns: 1fr; }
  .hero-stats { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 680px) {
  body { font-size: 15px; }
  .manual-shell { width: min(100% - 18px, 1000px); margin-top: 10px; }
  .hero-panel { padding: 24px 20px; }
  .hero-stats { grid-template-columns: 1fr; }
  .manual-article { padding: 20px 18px; }
  .doc-meta { grid-template-columns: 1fr; }
  .manual-article h2 { margin-top: 44px; gap: 12px; }
  .back-to-top { right: 16px; bottom: 16px; }
}

/* ============================================================
   ACCESIBILIDAD
   ============================================================ */
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 5px; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation: none !important; }
  .reveal { opacity: 1; transform: none; }
}

/* ============================================================
   IMPRESIÓN / PDF
   ============================================================ */
@media print {
  html, body { background: #fff; font-size: 11.5px; }
  .reading-progress, .manual-sidebar, .hero-actions, .hero-stats,
  .back-to-top, .toc-toggle { display: none !important; }
  .manual-shell { display: block; width: auto; margin: 0; gap: 0; }
  .manual-main { display: block; }
  .hero-panel {
    display: block;
    padding: 0 0 14px;
    margin-bottom: 18px;
    border: 0;
    border-bottom: 2px solid var(--gold);
    border-radius: 0;
  }
  .hero-copy h1 { font-size: 28px; }
  .manual-article { width: auto; margin: 0; padding: 0; border: 0; border-radius: 0; }
  .manual-article h2 { break-after: avoid; font-size: 21px; margin-top: 26px; }
  .manual-article h3 { break-after: avoid; font-size: 16px; }
  .shot, .manual-article img, table, .table-scroll, blockquote, li { break-inside: avoid; }
  thead th { color: #111827; background: var(--gold-100); }
}
