/* Panel del documentador. Todo color, tamaño y espacio sale de estas variables. */
@font-face { font-family: Inter; src: url(/fuentes/inter-latin-400-normal.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: Inter; src: url(/fuentes/inter-latin-500-normal.woff2) format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: Inter; src: url(/fuentes/inter-latin-600-normal.woff2) format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: Fraunces; src: url(/fuentes/fraunces-latin-600-normal.woff2) format("woff2"); font-weight: 600; font-display: swap; }

:root {
  /* Marca: verde petróleo (principal) y coral (acento, su complementario) */
  --p-50: #eef6f5; --p-100: #d6eae8; --p-200: #aed4d0; --p-300: #7fb8b3; --p-400: #4f9893;
  --p-500: #2f7a75; --p-600: #1f5f5b; --p-700: #1a4d4a; --p-800: #163e3c; --p-900: #122f2e; --p-950: #0b1f1e;
  --a-100: #fbe5db; --a-500: #d9663b; --a-600: #bf5129; --a-700: #9c4121;
  /* Neutros teñidos del principal */
  --n-0: #ffffff; --n-50: #f6f7f6; --n-100: #eceeed; --n-200: #dde1e0; --n-300: #c4cac9; --n-400: #959e9c;
  --n-500: #6c7674; --n-600: #525b59; --n-700: #3d4544; --n-800: #282e2d; --n-900: #1a1f1e; --n-950: #111514;

  --color-bg: var(--n-50);
  --color-surface: var(--n-0);
  --color-surface-2: var(--n-100);
  --color-border: var(--n-200);
  --color-text: var(--n-900);
  --color-text-muted: var(--n-600);
  --color-primary: var(--p-600);
  --color-primary-hover: var(--p-700);
  --color-primary-soft: var(--p-50);
  --color-on-primary: var(--n-0);
  --color-accent: var(--a-600);
  --color-active: var(--p-500);
  --color-ok: #2e7d4f; --color-ok-soft: #e3f2e8;
  --color-warn: #a86a12; --color-warn-soft: #fbf0dc;
  --color-error: #c0392b; --color-error-soft: #fae3e0;
  --color-info: #2b6cb0; --color-info-soft: #e1ecf8;

  --font: Inter, system-ui, sans-serif;
  --font-titulo: Fraunces, Georgia, serif;
  --t-12: 0.75rem; --t-14: 0.875rem; --t-16: 1rem; --t-20: 1.25rem; --t-24: 1.5rem; --t-30: 1.875rem; --t-36: 2.25rem;

  --r-s: 6px; --r: 10px; --r-l: 16px;
  --sombra: 0 8px 24px color-mix(in srgb, var(--p-900) 14%, transparent);
  --active-line: linear-gradient(90deg, transparent, var(--color-active) 50%, transparent);
  --active-glow: linear-gradient(90deg, transparent, color-mix(in srgb, var(--color-active) 14%, transparent) 50%, transparent);
  color-scheme: light;
}

:root[data-modo="oscuro"] {
  --color-bg: var(--n-950);
  --color-surface: var(--n-900);
  --color-surface-2: var(--n-800);
  --color-border: var(--n-700);
  --color-text: #eef1f0;
  --color-text-muted: var(--n-400);
  --color-primary: var(--p-400);
  --color-primary-hover: var(--p-300);
  --color-primary-soft: color-mix(in srgb, var(--p-400) 14%, transparent);
  --color-on-primary: var(--n-950);
  --color-accent: var(--a-500);
  --color-active: var(--p-300);
  --color-ok: #6cc28f; --color-ok-soft: color-mix(in srgb, #6cc28f 14%, transparent);
  --color-warn: #e0ad5c; --color-warn-soft: color-mix(in srgb, #e0ad5c 14%, transparent);
  --color-error: #ef8a7e; --color-error-soft: color-mix(in srgb, #ef8a7e 14%, transparent);
  --color-info: #7fb2e8; --color-info-soft: color-mix(in srgb, #7fb2e8 14%, transparent);
  --sombra: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: var(--font); font-size: var(--t-16); line-height: 1.5; color: var(--color-text); background: var(--color-bg); }
a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
h1, h2 { font-family: var(--font-titulo); font-weight: 600; line-height: 1.2; margin: 0; }
h1 { font-size: var(--t-30); }
h2 { font-size: var(--t-20); }
.muted { color: var(--color-text-muted); }
.pequeno { font-size: var(--t-14); }

/* ---------- Barra superior ---------- */
.barra { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 24px; height: 60px; padding: 0 32px;
  background: var(--color-surface); border-bottom: 1px solid var(--color-border); }
.marca { font-family: var(--font-titulo); font-size: var(--t-20); color: var(--color-text); white-space: nowrap; }
.marca:hover { text-decoration: none; }
.migas { display: flex; gap: 8px; align-items: center; font-size: var(--t-14); color: var(--color-text-muted); min-width: 0; flex: 1; }
.migas a { color: var(--color-text-muted); }
.migas strong { color: var(--color-text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.migas .sep { opacity: 0.6; }
.buscador input { width: 280px; }
.tema { display: flex; border: 1px solid var(--color-border); border-radius: var(--r); overflow: hidden; }
.tema button { border: 0; background: none; padding: 6px 10px; font: inherit; font-size: var(--t-12); color: var(--color-text-muted); cursor: pointer; min-height: 36px; }
.tema button.on { font-weight: 600; color: var(--color-text); background: var(--active-line) bottom / 100% 2px no-repeat; }

/* ---------- Estructura ---------- */
.cuerpo { display: grid; grid-template-columns: 240px 1fr; min-height: calc(100vh - 60px); }
.lateral { padding: 24px 16px; border-right: 1px solid var(--color-border); background: var(--color-surface); }
.grupo { font-size: var(--t-12); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-text-muted); margin: 24px 12px 8px; }
.grupo:first-child { margin-top: 0; }
.nav-link { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; color: var(--color-text); border-radius: var(--r-s); font-size: var(--t-14); }
.nav-link:hover { background: var(--color-surface-2); text-decoration: none; }
.nav-link.active { border-radius: 0; font-weight: 600;
  background: var(--active-line) top / 100% 1px no-repeat, var(--active-line) bottom / 100% 1px no-repeat, var(--active-glow); }
.cuenta { font-size: var(--t-12); color: var(--color-text-muted); font-weight: 500; }
main { padding: 32px; min-width: 0; max-width: 1680px; }

/* ---------- Subpestañas ---------- */
.pestanas { display: flex; gap: 4px; border-bottom: 1px solid var(--color-border); margin: 24px 0; overflow-x: auto; }
.tab { padding: 10px 16px; color: var(--color-text-muted); font-size: var(--t-14); white-space: nowrap; }
.tab:hover { color: var(--color-text); text-decoration: none; }
.tab.on { color: var(--color-text); font-weight: 600; background: var(--active-line) bottom / 100% 2px no-repeat; }

/* ---------- Componentes ---------- */
.boton { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: var(--r); border: 1px solid var(--color-border);
  background: var(--color-surface); color: var(--color-text); font: inherit; font-size: var(--t-14); font-weight: 500; cursor: pointer; white-space: nowrap; }
.boton:hover { background: var(--color-surface-2); text-decoration: none; }
.boton.principal { background: var(--color-primary); border-color: var(--color-primary); color: var(--color-on-primary); }
.boton.principal:hover { background: var(--color-primary-hover); }
input[type=text], input[type=password], input[type=search] { min-height: 40px; padding: 0 12px; border: 1px solid var(--color-border); border-radius: var(--r);
  background: var(--color-surface); color: var(--color-text); font: inherit; font-size: var(--t-14); width: 100%; }
label { display: block; font-size: var(--t-14); font-weight: 500; margin-bottom: 4px; }

.insignia { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: var(--t-12); font-weight: 600; white-space: nowrap; }
.insignia::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.e-marcha { color: var(--color-info); background: var(--color-info-soft); }
.e-espera { color: var(--color-warn); background: var(--color-warn-soft); }
.e-ok { color: var(--color-ok); background: var(--color-ok-soft); }
.e-error { color: var(--color-error); background: var(--color-error-soft); }

.lista { display: flex; flex-direction: column; border: 1px solid var(--color-border); border-radius: var(--r-l); background: var(--color-surface); overflow: hidden; }
.fila { display: grid; grid-template-columns: 1fr 200px 160px; gap: 24px; align-items: center; padding: 16px 24px; border-top: 1px solid var(--color-border); color: var(--color-text); }
.fila:first-child { border-top: 0; }
.fila:hover { background: var(--color-surface-2); text-decoration: none; }
.fila .titulo { font-weight: 600; }
.barra-progreso { height: 6px; border-radius: 3px; background: var(--color-surface-2); overflow: hidden; margin-top: 6px; }
.barra-progreso span { display: block; height: 100%; background: var(--color-primary); }

.rejilla { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 24px; }
.tarjeta { display: flex; flex-direction: column; border: 1px solid var(--color-border); border-radius: var(--r-l); background: var(--color-surface); overflow: hidden; color: var(--color-text); }
.tarjeta:hover { box-shadow: var(--sombra); text-decoration: none; border-color: var(--color-primary); }
.miniatura { aspect-ratio: 16 / 10; background: var(--color-surface-2) center top / cover no-repeat; border-bottom: 1px solid var(--color-border); }
.tarjeta .texto { padding: 16px; display: flex; flex-direction: column; gap: 4px; }

.vacio { padding: 64px 24px; text-align: center; border: 1px dashed var(--color-border); border-radius: var(--r-l); color: var(--color-text-muted); }
.vacio strong { display: block; color: var(--color-text); font-size: var(--t-20); font-family: var(--font-titulo); margin-bottom: 8px; }
.aviso { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; padding: 16px 20px; border-radius: var(--r); border-left: 3px solid var(--color-error);
  background: var(--color-error-soft); margin: 24px 0; }
.aviso.espera { border-left-color: var(--color-warn); background: var(--color-warn-soft); }

/* ---------- Ficha de un trabajo ---------- */
.cabecera { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; flex-wrap: wrap; }
.cabecera .datos { display: flex; flex-direction: column; gap: 8px; }
.acciones { display: flex; gap: 8px; flex-wrap: wrap; }
.documento { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 32px; align-items: start; }
video { width: 100%; border-radius: var(--r-l); background: #000; display: block; }
.pasos { display: flex; flex-direction: column; gap: 4px; }
.paso-boton { display: grid; grid-template-columns: 52px 1fr; gap: 12px; text-align: left; padding: 10px 12px; border: 0; border-radius: var(--r-s); background: none;
  color: var(--color-text); font: inherit; font-size: var(--t-14); cursor: pointer; min-height: 44px; }
.paso-boton:hover { background: var(--color-surface-2); }
.paso-boton.on { border-radius: 0; font-weight: 600;
  background: var(--active-line) top / 100% 1px no-repeat, var(--active-line) bottom / 100% 1px no-repeat, var(--active-glow); }
.paso-boton .tiempo { font-variant-numeric: tabular-nums; color: var(--color-text-muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 2px 10px; border-radius: 999px; background: var(--color-primary-soft); color: var(--color-primary); font-size: var(--t-12); font-weight: 500; }
.bloque { margin-top: 32px; }
.bloque h2 { margin-bottom: 12px; }

.capturas { display: flex; flex-direction: column; gap: 16px; }
.captura { display: grid; grid-template-columns: 1fr auto; gap: 24px; padding: 20px 24px; border: 1px solid var(--color-border); border-radius: var(--r-l); background: var(--color-surface); }
.captura dl { display: grid; grid-template-columns: 140px 1fr; gap: 4px 16px; margin: 12px 0 0; font-size: var(--t-14); }
.captura dt { color: var(--color-text-muted); }
.captura dd { margin: 0; }
.imagenes { display: flex; gap: 12px; align-items: flex-start; }
.imagenes img { height: 200px; border: 1px solid var(--color-border); border-radius: var(--r-s); }

.registro { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--color-border); }
.registro li { position: relative; padding: 0 0 16px 20px; font-size: var(--t-14); }
.registro li::before { content: ""; position: absolute; left: -6px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--color-primary); }
.registro time { display: block; color: var(--color-text-muted); font-size: var(--t-12); font-variant-numeric: tabular-nums; }

.resultado { padding: 20px 24px; border-top: 1px solid var(--color-border); }
.resultado:first-child { border-top: 0; }
.resultado ul { margin: 8px 0 0; padding-left: 20px; font-size: var(--t-14); }

/* ---------- Entrar ---------- */
.entrar { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.entrar form { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 16px; padding: 32px; background: var(--color-surface);
  border: 1px solid var(--color-border); border-radius: var(--r-l); box-shadow: var(--sombra); }
.error-campo { color: var(--color-error); font-size: var(--t-14); }

/* ---------- Móvil y tableta ---------- */
@media (max-width: 1100px) { .documento { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
  .cuerpo { grid-template-columns: 1fr; }
  .lateral { display: flex; gap: 8px; overflow-x: auto; padding: 8px 16px; border-right: 0; border-bottom: 1px solid var(--color-border); }
  .grupo { display: none; }
  .nav-link { white-space: nowrap; }
  main { padding: 24px 16px; }
  .barra { padding: 0 16px; gap: 12px; }
  .buscador { display: none; }
  .migas > :not(:last-child) { display: none; }
  .fila { grid-template-columns: 1fr; gap: 8px; }
  .captura { grid-template-columns: 1fr; }
  .captura dl { grid-template-columns: 1fr; }
  .imagenes img { height: 160px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
