/* Estilos del centro de ayuda (comunes a castellano, catalán e inglés). */
:root {
  --night: #111827;
  --industrial: #1f2937;
  --orange: #f97316;
  --orange-strong: #ea580c;
  --orange-soft: #ffedd5;
  --orange-tint: #fff7ed;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --subtle: #f9fafb;
  --border: #e5e7eb;
  --text: #1f2937;
  --heading: #111827;
  --muted: #6b7280;
  --ok: #15803d;
  --ok-soft: #dcfce7;
  --warn: #a16207;
  --warn-soft: #fef9c3;
  --bad: #b91c1c;
  --bad-soft: #fee2e2;
  --info: #1d4ed8;
  --info-soft: #dbeafe;
  --neutral-soft: #f3f4f6;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(17 24 39 / 5%), 0 6px 20px rgb(17 24 39 / 6%);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1120;
    --surface: #151d2c;
    --subtle: #1a2333;
    --border: #273244;
    --text: #e5e7eb;
    --heading: #f9fafb;
    --muted: #9ca3af;
    --orange-soft: #3b2414;
    --orange-tint: #2a1c12;
    --ok: #4ade80;
    --ok-soft: #12301f;
    --warn: #facc15;
    --warn-soft: #382f0c;
    --bad: #f87171;
    --bad-soft: #3b1515;
    --info: #93c5fd;
    --info-soft: #172554;
    --neutral-soft: #1f2937;
    --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 6px 20px rgb(0 0 0 / 30%);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 84px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, Helvetica, Arial, sans-serif;
  font-size: 15.5px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--orange-strong); }

h1, h2, h3 { color: var(--heading); letter-spacing: -0.02em; line-height: 1.2; }

h2 { font-size: 26px; margin: 0 0 6px; }

h3 { font-size: 17px; margin: 0 0 6px; letter-spacing: -0.01em; }

p { margin: 0 0 12px; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 24px; }

/* Cabecera fija */
.top {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--night);
  color: #fff;
  box-shadow: 0 1px 0 rgb(255 255 255 / 6%);
}

.top__inner { display: flex; align-items: center; gap: 16px; height: 64px; }

.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 800; font-size: 19px; letter-spacing: -0.02em; }

.brand svg { width: 30px; height: 30px; }

.brand small { color: #fdba74; font-weight: 600; font-size: 13px; letter-spacing: 0; }

.top__spacer { flex: 1; }

.top__link { color: #d1d5db; text-decoration: none; font-size: 14px; font-weight: 600; }

.top__link:hover { color: #fff; }

/* Selector de idioma */
.langs { display: inline-flex; border: 1px solid rgb(255 255 255 / 18%); border-radius: 999px; padding: 3px; }

.langs a { padding: 3px 10px; border-radius: 999px; color: #d1d5db; text-decoration: none; font-size: 12.5px; font-weight: 700; }

.langs a:hover { color: #fff; }

.langs a[aria-current="page"] { background: rgb(255 255 255 / 14%); color: #fff; }

.langs a:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }

/* Portada */
.hero {
  background:
    radial-gradient(800px 360px at 90% -20%, rgb(249 115 22 / 22%), transparent 60%),
    radial-gradient(600px 300px at -10% 120%, rgb(59 130 246 / 12%), transparent 60%),
    var(--night);
  color: #f9fafb;
  padding: 56px 0 72px;
}

.hero h1 { color: #fff; font-size: clamp(32px, 4.4vw, 48px); margin: 0 0 12px; }

.hero h1 em { font-style: normal; color: var(--orange); }

.hero p { color: #cbd5e1; font-size: 18px; max-width: 40em; }

.search {
  position: relative;
  max-width: 620px;
  margin-top: 24px;
}

.search svg { position: absolute; left: 16px; top: 50%; width: 20px; height: 20px; transform: translateY(-50%); color: #9ca3af; }

.search input {
  width: 100%;
  height: 54px;
  padding: 0 16px 0 48px;
  border: 1px solid rgb(255 255 255 / 14%);
  border-radius: 12px;
  background: rgb(255 255 255 / 8%);
  color: #fff;
  font: inherit;
  font-size: 16px;
  outline: none;
}

.search input::placeholder { color: #9ca3af; }

.search input:focus { border-color: var(--orange); background: rgb(255 255 255 / 12%); }

.search__hint { margin-top: 10px; color: #9ca3af; font-size: 13px; }

/* Accesos rápidos */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: -40px; position: relative; z-index: 2; }

.tile {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--text);
  text-decoration: none;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.tile:hover { transform: translateY(-2px); border-color: var(--orange); }

.tile strong { display: block; color: var(--heading); font-size: 15px; }

.tile small { color: var(--muted); font-size: 13px; line-height: 1.45; display: block; }

.icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: var(--orange-soft);
  color: var(--orange-strong);
}

.icon svg { width: 20px; height: 20px; }

/* Cuerpo con índice */
.layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 40px; padding: 48px 0 80px; }

.toc { position: sticky; top: 88px; align-self: start; }

.toc__title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 0 0 8px; }

.toc a {
  display: block;
  padding: 6px 10px;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}

.toc a:hover { color: var(--heading); background: var(--neutral-soft); }

.toc a.active { color: var(--orange-strong); background: var(--orange-tint); font-weight: 600; }

section.topic { padding: 8px 0 40px; border-bottom: 1px solid var(--border); margin-bottom: 40px; }

section.topic:last-child { border-bottom: 0; }

.lead { font-size: 17px; color: var(--muted); max-width: 46em; margin-bottom: 22px; }

.eyebrow { display: inline-flex; align-items: center; gap: 8px; color: var(--orange-strong); font-weight: 700; font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 6px; }

.card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 20px 22px; }

.grid2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }

.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

.card p:last-child, .card ul:last-child { margin-bottom: 0; }

.card h3 { display: flex; align-items: center; gap: 10px; }

ul.clean { margin: 0; padding-left: 1.1rem; }

ul.clean li { margin: 4px 0; }

.muted { color: var(--muted); }

/* Pasos numerados */
.steps { counter-reset: step; display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }

.steps li {
  position: relative;
  padding: 16px 18px 16px 64px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.steps li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 18px;
  top: 16px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--orange);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
}

.steps strong { color: var(--heading); }

.steps .where { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; background: var(--neutral-soft); color: var(--muted); font-size: 12px; font-weight: 600; }

/* Etiquetas */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }

.pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.pill--ok { background: var(--ok-soft); color: var(--ok); }

.pill--warn { background: var(--warn-soft); color: var(--warn); }

.pill--bad { background: var(--bad-soft); color: var(--bad); }

.pill--info { background: var(--info-soft); color: var(--info); }

.pill--neutral { background: var(--neutral-soft); color: var(--muted); }

/* Roles */
.role { border-top: 4px solid var(--border); }

.role--admin { border-top-color: var(--orange); }

.role--manager { border-top-color: #3b82f6; }

.role--viewer { border-top-color: #9ca3af; }

.role .tag { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }

/* Glosario */
.glossary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

.term { padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }

.term b { display: block; color: var(--heading); margin-bottom: 2px; }

.term span { color: var(--muted); font-size: 14px; line-height: 1.5; }

/* Carriles contratante / proveedora */
.lanes { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.lane { border-radius: var(--radius); padding: 18px; border: 1px solid var(--border); background: var(--surface); }

.lane__title { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; font-weight: 700; color: var(--heading); }

.lane ol { margin: 0; padding-left: 1.2rem; }

.lane li { margin: 6px 0; }

.lane--client { border-left: 4px solid var(--orange); }

.lane--provider { border-left: 4px solid #3b82f6; }

/* Diagrama */
figure.diagram { margin: 18px 0 0; padding: 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }

figure.diagram { overflow-x: auto; }

figure.diagram svg { width: 100%; min-width: 620px; height: auto; display: block; }

figure.diagram figcaption { margin-top: 8px; color: var(--muted); font-size: 13.5px; }

.dg-box { fill: none; stroke: var(--muted); stroke-width: 1.25; }

.dg-main { fill: var(--orange-soft); stroke: var(--orange); stroke-width: 2; }

.dg-text { fill: var(--heading); font-size: 13px; font-family: inherit; }

.dg-label { fill: var(--muted); font-size: 11.5px; font-family: inherit; }

.dg-line { fill: none; stroke: var(--muted); stroke-width: 1.25; }

/* Tablas */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }

table { width: 100%; border-collapse: collapse; font-size: 14.5px; }

th, td { text-align: left; padding: 11px 16px; border-bottom: 1px solid var(--border); vertical-align: top; }

th { background: var(--subtle); color: var(--muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.05em; }

tr:last-child td { border-bottom: 0; }

td.value { font-weight: 600; color: var(--heading); white-space: nowrap; }

/* Notas */
.note { display: flex; gap: 12px; padding: 14px 16px; border-radius: 12px; background: var(--orange-tint); border: 1px solid var(--orange-soft); margin-top: 14px; }

.note svg { flex: none; width: 20px; height: 20px; color: var(--orange-strong); margin-top: 2px; }

.note p { margin: 0; }

/* Preguntas frecuentes */
.faq-group { margin: 26px 0 12px; font-size: 16px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }

.faq-group:first-of-type { margin-top: 8px; }

details { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); margin-bottom: 10px; }

summary { cursor: pointer; list-style: none; padding: 14px 18px; font-weight: 600; color: var(--heading); display: flex; justify-content: space-between; gap: 12px; }

summary::-webkit-details-marker { display: none; }

summary::after { content: '+'; color: var(--orange-strong); font-size: 20px; line-height: 1; }

details[open] summary::after { content: '–'; }

details > div { padding: 0 18px 16px; color: var(--text); }

summary:focus-visible, .tile:focus-visible, .toc a:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }

.empty { display: none; padding: 32px; text-align: center; color: var(--muted); border: 1px dashed var(--border); border-radius: var(--radius); }

mark { background: var(--orange-soft); color: inherit; border-radius: 3px; padding: 0 2px; }

footer { border-top: 1px solid var(--border); background: var(--surface); }

footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 20px; padding-top: 22px; padding-bottom: 22px; color: var(--muted); font-size: 14px; }

footer nav { display: flex; gap: 16px; flex-wrap: wrap; }

@media (max-width: 980px) {
  .layout { grid-template-columns: minmax(0, 1fr); padding-top: 32px; }
  .toc { display: none; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .glossary, .grid3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .tiles, .glossary, .grid2, .grid3, .lanes { grid-template-columns: 1fr; }
  .hero { padding: 36px 0 64px; }
  .top__link { display: none; }
  td.value { white-space: normal; }
  h2 { font-size: 23px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .tile { transition: none; }
}
