/* DocuGreta · estilos del panel. CSS plano, sin build.
   Diseño: Claude Design "Rediseño DocuGreta" (minimalista y accesible, ver PLAN.md).
   Tokens en :root; el modo oscuro sigue al sistema salvo que el usuario elija uno
   (data-theme en <html>, lo pone static/js/tema.js). */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/static/fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308,
    U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light;
  --bg: #f4f7f6;
  --surface: #ffffff;
  --surface-2: #f7faf9;
  --ink: #14211d;
  --muted: #4d5e59;
  --subtle: #5a6b66;
  --border: #dde5e2;
  --border-strong: #c5d2ce;
  --divider: #eef2f0;

  --brand: #1b7f6b;
  --brand-hover: #156a59;
  --on-brand: #ffffff;
  --brand-ink: #135e50;
  --brand-soft: #e7f3f0;
  --brand-softer: #f2f8f6;
  --drop: #a9c9c0;

  --warn-ink: #92400e;
  --warn-soft: #fef3c7;
  --warn-softer: #fff8e6;
  --warn-line: #f0c36a;
  --warn-ring: #fff3d1;
  --warn-bar: #d97706;
  --warn-bar-2: #fcd34d;
  --warn-text: #5c3a06;

  --info-ink: #1d4e89;
  --info-soft: #e8f0fb;
  --info: #2f6fb3;

  --error-ink: #a8251b;
  --error-soft: #fdecea;

  --shadow: 0 1px 2px rgba(20, 33, 29, .04), 0 8px 24px rgba(20, 33, 29, .06);
  --radius: 10px;
  --radius-lg: 16px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* Modo oscuro: mismos roles, contrastes revisados (texto ≥ 4.5:1 sobre su fondo). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0e1412;
    --surface: #161f1c;
    --surface-2: #1b2622;
    --ink: #e6eeeb;
    --muted: #a7b6b1;
    --subtle: #94a49f;
    --border: #2a3833;
    --border-strong: #3a4a44;
    --divider: #222e2a;
    --brand: #3fbfa3;
    --brand-hover: #5fd0b6;
    --on-brand: #0b1c17;
    --brand-ink: #7fe0c6;
    --brand-soft: #14322a;
    --brand-softer: #13261f;
    --drop: #2f5a4e;
    --warn-ink: #fcd34d;
    --warn-soft: #3a2a0e;
    --warn-softer: #2a2110;
    --warn-line: #7a5a1c;
    --warn-ring: #2f2410;
    --warn-bar: #f59e0b;
    --warn-bar-2: #fcd34d;
    --warn-text: #f6dfa4;
    --info-ink: #9cc3f2;
    --info-soft: #132a45;
    --info: #6aa6e6;
    --error-ink: #f6a39b;
    --error-soft: #3a1714;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1412;
  --surface: #161f1c;
  --surface-2: #1b2622;
  --ink: #e6eeeb;
  --muted: #a7b6b1;
  --subtle: #94a49f;
  --border: #2a3833;
  --border-strong: #3a4a44;
  --divider: #222e2a;
  --brand: #3fbfa3;
  --brand-hover: #5fd0b6;
  --on-brand: #0b1c17;
  --brand-ink: #7fe0c6;
  --brand-soft: #14322a;
  --brand-softer: #13261f;
  --drop: #2f5a4e;
  --warn-ink: #fcd34d;
  --warn-soft: #3a2a0e;
  --warn-softer: #2a2110;
  --warn-line: #7a5a1c;
  --warn-ring: #2f2410;
  --warn-bar: #f59e0b;
  --warn-bar-2: #fcd34d;
  --warn-text: #f6dfa4;
  --info-ink: #9cc3f2;
  --info-soft: #132a45;
  --info: #6aa6e6;
  --error-ink: #f6a39b;
  --error-soft: #3a1714;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
}

/* ----------------------------- Base ----------------------------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font);
  font-size: 16px; line-height: 1.5; font-variant-numeric: tabular-nums;
}
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 28px; font-weight: 700; letter-spacing: -.01em; overflow-wrap: anywhere; }
h2 { font-size: 20px; font-weight: 600; }
p { margin: 0; }
a { color: var(--brand-ink); }
a:hover { color: var(--brand); }
img { max-width: 100%; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--subtle); font-size: 14px; }
.ico { flex: 0 0 auto; }

/* ----------------------------- Marca y header ----------------------------- */
.logo { display: block; height: 32px; width: auto; }
.logo-oscuro { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-claro { display: none; }
  :root:not([data-theme="light"]) .logo-oscuro { display: block; }
}
:root[data-theme="dark"] .logo-claro { display: none; }
:root[data-theme="dark"] .logo-oscuro { display: block; }

.topbar { background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar-in {
  max-width: 1240px; margin: 0 auto; padding: 12px 24px;
  display: flex; align-items: center; gap: 12px 28px; flex-wrap: wrap;
}
.brand { display: inline-flex; text-decoration: none; }
.nav { display: flex; gap: 4px; flex: 1 1 auto; }
.nav a {
  padding: 10px 14px; border-radius: 8px; color: var(--muted); font-size: 15px; text-decoration: none;
  min-height: 44px; display: inline-flex; align-items: center;
}
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; }
.who { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 14px; color: var(--muted); }
.who b { color: var(--ink); font-weight: 600; }
.who form { margin: 0; }

.main { max-width: 1120px; margin: 0 auto; padding: 32px 24px 64px; display: flex; flex-direction: column; gap: 32px; }
.main-ancho { max-width: 1240px; gap: 18px; padding-top: 24px; }
.bare { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }

/* ----------------------------- Botones y campos ----------------------------- */
.btn {
  font: inherit; font-size: 15px; font-weight: 600; min-height: 44px; padding: 0 16px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: var(--radius); border: 1px solid transparent; cursor: pointer; text-decoration: none;
  transition: background-color .18s ease, border-color .18s ease, color .18s ease;
}
.btn-primary { background: var(--brand); color: var(--on-brand); }
.btn-primary:hover { background: var(--brand-hover); color: var(--on-brand); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); border-color: var(--border-strong); }
.btn-outline { background: transparent; color: var(--brand-ink); border-color: var(--brand); }
.btn-outline:hover { background: var(--brand-soft); color: var(--brand-ink); }
.btn-link { background: none; border: 0; color: var(--muted); padding: 0 8px; }
.btn-link:hover { color: var(--ink); }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn-lg { min-height: 48px; font-size: 16px; padding: 0 22px; }
.btn-peligro { color: var(--error-ink); }
.btn[aria-pressed="true"] { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-ink); }
a.btn { text-decoration: none; }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 500; }
.field-ayuda { font-size: 13px; font-weight: 400; color: var(--subtle); }
.input, .field input, .field select, .inline select {
  font: inherit; font-size: 15px; font-weight: 400; color: var(--ink); background: var(--surface);
  padding: 10px 14px; min-height: 44px; border: 1px solid var(--border-strong); border-radius: var(--radius);
  width: 100%;
}
.inline select { width: auto; min-height: 36px; padding: 4px 10px; font-size: 14px; }
.input:focus-visible, .field input:focus-visible, .field select:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.form { display: flex; flex-direction: column; gap: 16px; }
.inline { display: inline-flex; gap: 6px; align-items: center; margin: 0; }

/* ----------------------------- Avisos ----------------------------- */
.flash {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: 12px;
  font-size: 15px; border: 1px solid var(--border); background: var(--surface);
}
.flash-error { color: var(--error-ink); background: var(--error-soft); border-color: transparent; }
.flash-ok { color: var(--brand-ink); background: var(--brand-soft); border-color: transparent; }
.flash-info { color: var(--ink); }
.aviso {
  display: flex; gap: 10px; align-items: flex-start; padding: 14px 16px; border-radius: 12px;
  background: var(--surface-2); font-size: 14px; color: var(--muted);
}
.aviso b { color: var(--ink); }

/* ----------------------------- Tarjetas ----------------------------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 24px; display: flex; flex-direction: column; gap: 18px;
}
.card-alta { box-shadow: var(--shadow); padding: 28px; }
.card-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px; }
.card h2 { font-size: 18px; }

/* ----------------------------- Pastillas de estado (ícono + texto) ----------------------------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; white-space: nowrap;
  padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: var(--surface-2); color: var(--muted);
}
.pill-leyendo { background: var(--info-soft); color: var(--info-ink); }
.pill-revisar { background: var(--warn-soft); color: var(--warn-ink); }
.pill-advertencia { background: var(--warn-softer); color: var(--warn-ink); }
.pill-listo { background: var(--brand-soft); color: var(--brand-ink); }
.pill-error { background: var(--error-soft); color: var(--error-ink); }

/* ----------------------------- Portada ----------------------------- */
.seccion { display: flex; flex-direction: column; gap: 16px; }
.hero { display: flex; flex-wrap: wrap; gap: 32px; align-items: stretch; }
.hero-texto { flex: 1 1 380px; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 16px; }
.eyebrow { font-size: 14px; font-weight: 600; color: var(--brand-ink); letter-spacing: .02em; }
.hero h1 { font-size: clamp(28px, 4vw, 40px); line-height: 1.15; letter-spacing: -.02em; text-wrap: balance; }
.hero-lead { font-size: 17px; line-height: 1.6; color: var(--muted); max-width: 52ch; }
.hero-datos { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 14px; color: var(--muted); }
.hero-datos li { display: flex; align-items: center; gap: 8px; }
.subida { flex: 1 1 420px; min-width: 0; }

.drop {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
  padding: 28px 20px; border: 2px dashed var(--drop); border-radius: 12px; background: var(--brand-softer);
  cursor: pointer; transition: border-color .18s ease, background-color .18s ease;
}
.drop:hover, .drop.sobre { border-color: var(--brand); background: var(--brand-soft); }
.drop:focus-within { outline: 2px solid var(--brand); outline-offset: 2px; }
.drop-titulo { font-size: 16px; font-weight: 600; }
.drop-titulo u { color: var(--brand-ink); }
.drop-archivo { font-size: 14px; font-weight: 600; color: var(--brand-ink); overflow-wrap: anywhere; }
.drop input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }

.pasos-intro { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.paso-intro { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 20px; display: flex; flex-direction: column; gap: 8px; }
.paso-num {
  width: 32px; height: 32px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-ink);
  font-weight: 700; display: flex; align-items: center; justify-content: center; font-size: 15px;
}
.paso-intro.tuyo .paso-num { background: var(--warn-soft); color: var(--warn-ink); }
.paso-intro b { font-size: 16px; font-weight: 600; }
.paso-intro p { font-size: 14px; color: var(--muted); }
.paso-tiempo { margin-top: auto; font-size: 13px; font-weight: 600; color: var(--brand-ink); }
.paso-intro.tuyo .paso-tiempo { color: var(--warn-ink); }

.cifras { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.cifra { padding: 18px; border-radius: 12px; background: var(--surface-2); display: flex; flex-direction: column; gap: 6px; }
.cifra-ok { background: var(--brand-softer); }
.cifra-warn { background: var(--warn-softer); }
.cifra-num { font-size: 34px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.cifra-ok .cifra-num { color: var(--brand-ink); }
.cifra-warn .cifra-num { color: var(--warn-ink); }
.cifra b { font-size: 15px; font-weight: 600; }
.cifra span:last-child { font-size: 13px; color: var(--muted); }

.lista-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.filtros { display: flex; gap: 6px; flex-wrap: wrap; }
.filtro {
  font-size: 14px; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--muted); display: inline-flex; align-items: center; text-decoration: none;
}
.filtro:hover { border-color: var(--border-strong); color: var(--ink); }
.filtro[aria-current="true"] { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; }

.docs { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow-x: auto; }
.docs-tabla { width: 100%; min-width: 720px; border-collapse: collapse; font-size: 15px; }
.docs-tabla th { text-align: left; font-size: 13px; font-weight: 600; color: var(--subtle); padding: 12px 20px; border-bottom: 1px solid var(--border); }
.docs-tabla td { padding: 14px 20px; border-bottom: 1px solid var(--divider); vertical-align: middle; }
.docs-tabla tr:last-child td { border-bottom: 0; }
.docs-tabla tr.tono-revisar td { background: var(--warn-softer); }
.doc-nombre { display: flex; flex-direction: column; gap: 2px; min-width: 0; max-width: 420px; }
.doc-nombre a { font-weight: 600; color: var(--ink); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-nombre a:hover { color: var(--brand-ink); text-decoration: underline; }
.doc-estado { display: flex; flex-direction: column; gap: 6px; }
.doc-accion { text-align: right; white-space: nowrap; }
.vacio {
  background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius-lg);
  padding: 32px 24px; text-align: center; color: var(--muted); display: flex; flex-direction: column; gap: 6px; align-items: center;
}
.vacio b { color: var(--ink); font-size: 16px; }

progress { accent-color: var(--brand); }
.barra { width: 140px; height: 6px; }
.barra-info { accent-color: var(--info); }

/* ----------------------------- Documento ----------------------------- */
.titulo-doc { display: flex; flex-direction: column; gap: 6px; }
.volver { font-size: 14px; color: var(--muted); text-decoration: none; align-self: flex-start; min-height: 32px; display: inline-flex; align-items: center; }
.volver:hover { color: var(--ink); }

.estado-head { display: flex; flex-wrap: wrap; gap: 20px; align-items: center; }
.estado-ico {
  width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex: 0 0 auto;
  background: var(--surface-2); color: var(--muted);
}
.estado-ico.tono-leyendo, .estado-ico.tono-cola { background: var(--info-soft); color: var(--info); }
.estado-ico.tono-revisar { background: var(--warn-soft); color: var(--warn-ink); }
.estado-ico.tono-listo { background: var(--brand-soft); color: var(--brand-ink); }
.estado-ico.tono-error { background: var(--error-soft); color: var(--error-ink); }
.estado-texto { flex: 1 1 340px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.estado-texto h2 { font-size: 22px; font-weight: 700; }
.estado-texto p { font-size: 15px; color: var(--muted); }
.estado-texto p b { color: var(--ink); }
.estado-avance { flex: 0 1 260px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.estado-avance div { display: flex; justify-content: space-between; color: var(--muted); }
.estado-avance div b { color: var(--ink); }
.estado-avance progress { width: 100%; height: 10px; }

.pasos { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.paso { display: flex; flex-direction: column; gap: 4px; padding: 14px; border-radius: 12px; border: 1px dashed var(--border-strong); }
.paso-etiqueta { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--subtle); }
.paso b { font-size: 15px; font-weight: 600; color: var(--muted); }
.paso p { font-size: 13px; color: var(--subtle); }
.paso-hecho { border: 1px solid transparent; background: var(--brand-softer); }
.paso-hecho .paso-etiqueta { color: var(--brand-ink); }
.paso-hecho b { color: var(--ink); }
.paso-hecho p { color: var(--muted); }
.paso-actual { border: 2px solid var(--info); background: var(--info-soft); }
.paso-actual .paso-etiqueta, .paso-actual p { color: var(--info-ink); }
.paso-actual b { color: var(--ink); }
.paso-error { border: 2px solid var(--error-ink); background: var(--error-soft); }
.paso-error .paso-etiqueta, .paso-error p { color: var(--error-ink); }
.paso-error b { color: var(--ink); }
.paso-actual .paso-etiqueta svg { animation: girar 1.4s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .paso-actual .paso-etiqueta svg { animation: none; }
  * { transition: none !important; }
}

.segmentos { display: flex; height: 14px; border-radius: 999px; overflow: hidden; gap: 2px; }
.segmentos span { min-width: 6px; }
.seg-ok { background: var(--brand); }
.seg-revisar { background: var(--warn-bar); }
.seg-adv { background: var(--warn-bar-2); }
.leyenda { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.leyenda li { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: 12px; background: var(--surface-2); }
.leyenda li.l-ok { background: var(--brand-softer); color: var(--brand-ink); }
.leyenda li.l-revisar { background: var(--warn-softer); color: var(--warn-ink); }
.leyenda li.l-adv { background: var(--warn-softer); color: var(--warn-ink); }
.leyenda span { display: flex; flex-direction: column; gap: 2px; color: var(--ink); }
.leyenda b { font-size: 22px; font-weight: 700; }
.leyenda em { font-style: normal; font-size: 14px; font-weight: 600; }
.leyenda small { font-size: 13px; color: var(--muted); }
.acciones { display: flex; flex-wrap: wrap; gap: 10px; }
.acciones-sep { padding-top: 16px; border-top: 1px solid var(--divider); }

.columnas { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.col-principal { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.col-lateral { flex: 1 1 300px; min-width: 0; }
.paginas { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.pagina { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.pagina a.mini { display: block; background: #fff; }
.pagina img { display: block; width: 100%; height: auto; aspect-ratio: 3 / 4; object-fit: cover; object-position: top; }
.pagina-info { padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.pagina-info b { font-size: 13px; }
.entregas { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.entregas li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; overflow-wrap: anywhere; }
.entregas small { color: var(--subtle); width: 100%; }

.guia-excel { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px 24px; font-size: 14px; }
.guia-excel dt { font-weight: 600; }
.guia-excel dd { margin: 2px 0 0; color: var(--muted); }

/* ----------------------------- Revisión ----------------------------- */
.rev-head { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; justify-content: space-between; }
.rev-head > div:first-child { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.rev-head h1 { font-size: 24px; }
.rev-head p { font-size: 14px; color: var(--muted); }
.rev-avance { flex: 0 1 300px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.rev-avance div { display: flex; justify-content: space-between; color: var(--muted); }
.rev-avance div b { color: var(--ink); }
.rev-avance progress { width: 100%; height: 10px; }

.paginas-nav { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.paginas-nav > span { font-size: 14px; color: var(--muted); margin-right: 4px; }
.pag {
  min-width: 44px; min-height: 44px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  font-size: 15px; font-weight: 600; text-decoration: none;
}
.pag:hover { border-color: var(--border-strong); color: var(--ink); }
.pag.pendiente { border-color: var(--warn-line); background: var(--warn-softer); color: var(--warn-ink); }
.pag[aria-current="page"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.pag-n { font-size: 12px; padding: 1px 6px; border-radius: 999px; background: var(--warn-bar-2); color: #14211d; }
.solo { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; font-size: 14px; min-height: 44px; }
.solo a { font-weight: 600; }

.rev { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.rev-img {
  margin: 0; flex: 1 1 340px; min-width: 0; position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
}
.rev-zoom { display: block; width: 100%; padding: 0; border: 0; background: #fff; cursor: zoom-in; }
.rev-zoom img { display: block; width: 100%; height: auto; }
.rev-zoom.zoom { width: 220%; cursor: zoom-out; }
.rev-img figcaption {
  position: sticky; left: 0; bottom: 0; padding: 10px 14px; font-size: 13px; color: var(--muted); background: var(--surface);
  display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; border-top: 1px solid var(--border);
}
.rev-filas { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
@media (max-width: 900px) { .rev-img { position: static; max-height: none; } }

.alerta-pagina { padding: 16px 18px; border-radius: 14px; background: var(--warn-softer); border: 1px solid var(--warn-line); display: flex; flex-direction: column; gap: 8px; color: var(--warn-text); font-size: 14px; }
.alerta-pagina b { color: var(--warn-ink); }
.alerta-pagina ul { margin: 0; padding-left: 18px; }
.alerta-pagina.vista { background: var(--surface); border-color: var(--border); color: var(--muted); }
.alerta-pagina form { margin: 0; }

.fila { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.fila.estado-revisar { border-color: var(--warn-line); box-shadow: 0 0 0 3px var(--warn-ring); }
.fila.estado-advertencia { border-color: var(--warn-line); }
.fila-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; align-items: flex-start; }
.fila-id { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1 1 320px; }
.fila-n { font-size: 13px; color: var(--subtle); }
.campo-desc { font-weight: 600; font-size: 16px; }
.codigos { display: flex; gap: 8px; flex-wrap: wrap; }
.codigos .input { flex: 1 1 160px; font-size: 13px; min-height: 36px; padding: 6px 10px; }
.fila .input.sutil { border-color: transparent; background: transparent; padding-left: 0; padding-right: 0; min-height: 36px; }
.fila .input.sutil:hover { border-color: var(--border); padding-left: 10px; padding-right: 10px; }
.fila .input.sutil:focus-visible { border-color: var(--border-strong); background: var(--surface); padding-left: 10px; padding-right: 10px; }
.porque { padding: 10px 12px; border-radius: 10px; background: var(--warn-softer); font-size: 14px; color: var(--warn-text); }
.porque ul { margin: 4px 0 0; padding-left: 18px; }
.porque.nivel-advertencia { background: var(--surface-2); color: var(--muted); }
.medidas { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; align-items: end; }
.medida { display: flex; flex-direction: column; gap: 4px; }
.medida span, .medida label { font-size: 13px; color: var(--subtle); }
.medida b { font-size: 20px; font-weight: 700; }
.medida small { font-size: 12px; color: var(--subtle); }
.campo-num { font-size: 18px; font-weight: 600; }
.fila-acciones { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.fila-acciones .js-revisada { margin-left: auto; }
.guardado { font-size: 13px; color: var(--subtle); min-height: 1.2em; }
.guardado.error { color: var(--error-ink); font-weight: 600; }
.fila.estado-ok, .fila.estado-revisada { padding: 14px 18px; }

/* ----------------------------- Cuentas ----------------------------- */
.tabla-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.tabla { width: 100%; border-collapse: collapse; font-size: 14px; }
.tabla th, .tabla td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--divider); vertical-align: top; }
.tabla th { color: var(--subtle); font-weight: 600; font-size: 13px; border-bottom-color: var(--border); }
.tabla tr:last-child td { border-bottom: 0; }
.tabla tr.inactiva td:first-child b { color: var(--subtle); }
.acciones-fila { display: flex; flex-wrap: wrap; gap: 6px; min-width: 220px; }
.invitar { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.invitar .field { flex: 1 1 220px; }
.invitar .field-rol { flex: 0 0 160px; }
.editar-nombre { margin-top: 4px; font-size: 13px; }
.editar-nombre summary { cursor: pointer; color: var(--muted, inherit); width: fit-content; }
.editar-nombre .inline { margin-top: 6px; }
.editar-nombre .input { min-height: 36px; padding: 4px 10px; font-size: 14px; width: 220px; max-width: 100%; }
.enlace-nuevo { border-color: var(--brand); }
.enlace-url { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }

/* ----------------------------- Acceso (login / invitación) ----------------------------- */
.acceso { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 16px; }
.acceso .card { gap: 16px; }
.acceso h1 { font-size: 24px; }
.acceso .logo { height: 40px; }
.acceso-pie { display: flex; justify-content: center; }

/* ----------------------------- Selector de tema ----------------------------- */
.tema { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.tema button {
  font: inherit; font-size: 13px; min-height: 36px; min-width: 40px; padding: 0 10px; border: 0; background: var(--surface);
  color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.tema button + button { border-left: 1px solid var(--border); }
.tema button:hover { background: var(--surface-2); color: var(--ink); }
.tema button[aria-pressed="true"] { background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; }

/* Lista de documentos en celular: cada fila es una tarjeta, sin scroll lateral. */
@media (max-width: 700px) {
  .docs { overflow: visible; background: none; border: 0; }
  .docs-tabla { min-width: 0; display: block; }
  .docs-tabla thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .docs-tabla tbody { display: flex; flex-direction: column; gap: 12px; }
  .docs-tabla tr {
    display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; padding: 16px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  }
  .docs-tabla tr.tono-revisar { background: var(--warn-softer); border-color: var(--warn-line); }
  .docs-tabla td { display: block; padding: 0; border: 0; background: none !important; }
  .docs-tabla td:first-child { grid-column: 1 / -1; }
  .doc-nombre { max-width: none; }
  .doc-nombre a { white-space: normal; overflow-wrap: anywhere; }
  .docs-tabla td.muted { grid-column: 1 / -1; order: 3; }
  .doc-accion { text-align: right; align-self: center; }
}

@media (max-width: 640px) {
  .main { padding: 24px 16px 48px; gap: 24px; }
  .topbar-in { padding: 10px 16px; }
  .card, .card-alta { padding: 18px; }
  .tema span { display: none; }
}
