/* Estilos de la demo de la etapa 1 que aprobó Rosario (v11), más lo que necesita la versión real. */
/* Layout: barra superior fija, navegación lateral en escritorio y en fila desplazable en el teléfono; contenido en una columna ancha. */
:root {
  --bg: #f5f5fa; --surface: #ffffff; --ink: #1c1a36; --muted: #5d5a77; --line: #e2e1ee;
  --accent: #312783; --accent-ink: #ffffff; --accent-soft: #ecebf8;
  --ok: #1d7448; --ok-soft: #e2f3e9; --warn: #8f5600; --warn-soft: #fcf0d9;
  --bad: #b0281b; --bad-soft: #fbe6e3; --info: #2f4f9a; --info-soft: #e6ecfa;
  --font-display: "Archivo", "Segoe UI", system-ui, sans-serif;
  --font-body: "Montserrat", "Segoe UI", system-ui, sans-serif;
  --r-sm: 6px; --r-md: 10px; --r-lg: 14px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121124; --surface: #1b1a31; --ink: #ecebf6; --muted: #a9a6c4; --line: #2e2c4a;
    --accent: #9d93f0; --accent-ink: #15132b; --accent-soft: #29264a;
    --ok: #6fd3a0; --ok-soft: #173326; --warn: #f2bd62; --warn-soft: #3a2b12;
    --bad: #f39185; --bad-soft: #3d1a17; --info: #9db6f5; --info-soft: #1d2747;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121124; --surface: #1b1a31; --ink: #ecebf6; --muted: #a9a6c4; --line: #2e2c4a;
  --accent: #9d93f0; --accent-ink: #15132b; --accent-soft: #29264a;
  --ok: #6fd3a0; --ok-soft: #173326; --warn: #f2bd62; --warn-soft: #3a2b12;
  --bad: #f39185; --bad-soft: #3d1a17; --info: #9db6f5; --info-soft: #1d2747;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 14px; line-height: 1.5; }
h1, h2, h3 { font-family: var(--font-display); margin: 0; text-wrap: balance; letter-spacing: -0.01em; }
h1 { font-size: 1.55rem; font-weight: 700; }
h2 { font-size: 1.15rem; font-weight: 600; }
h3 { font-size: 1rem; font-weight: 600; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: .84rem; }

body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--accent); }
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--accent); color: var(--accent-ink);
  padding-block: 10px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.top .marca { font-family: var(--font-display); font-weight: 700; font-size: 1.02rem; }
.top .marca span { font-weight: 400; opacity: .85; }
.top .esp { flex: 1; }
.chip-user { display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,.14); border-radius: 999px; padding: 4px 6px 4px 12px; }
.chip-user b { font-weight: 600; }
.btn-top { border: 0; background: var(--accent-ink); color: var(--accent); border-radius: 999px; padding: 4px 12px; font-weight: 600; font-size: .85rem; }
.aviso { background: var(--warn-soft); color: var(--warn); padding-block: 8px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); font-size: .86rem; }

.app { display: grid; grid-template-columns: 230px minmax(0, 1fr); max-width: 1320px; margin: 0 auto; }
.nav { padding: 20px 12px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 52px; align-self: start; }
.nav button { text-align: left; border: 0; background: transparent; border-radius: var(--r-sm); padding: 9px 12px; color: var(--muted); font-weight: 500; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.nav button:hover { background: var(--accent-soft); color: var(--ink); }
.nav button[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav .cand { font-size: .75rem; color: var(--muted); }
.nav .sep { margin: 12px 12px 4px; font-size: .78rem; color: var(--muted); }
.main { padding-block: 22px 56px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.cab { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.cab p { color: var(--muted); max-width: 76ch; margin-top: 4px; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; min-width: 0; }
.panel > h2 { margin-bottom: 12px; }
.panel > h2 + p { margin: -6px 0 12px; color: var(--muted); }
.grid-cifras { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.cifra { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 16px; }
.cifra .n { font-family: var(--font-display); font-size: 1.8rem; font-weight: 700; line-height: 1.1; }
.cifra .t { color: var(--muted); font-size: .84rem; margin-top: 4px; }
.cifra.ok .n { color: var(--ok); } .cifra.warn .n { color: var(--warn); } .cifra.acc .n { color: var(--accent); } .cifra.bad .n { color: var(--bad); }

.tabla-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-md); }
table { border-collapse: collapse; width: 100%; min-width: 640px; background: var(--surface); }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; color: var(--muted); font-size: .82rem; background: var(--bg); }
tr:last-child td { border-bottom: 0; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover td { background: var(--accent-soft); }
td.r, th.r { text-align: right; } td.c, th.c { text-align: center; }
td.r, td:first-child, td .pill { white-space: nowrap; }
td.dif { color: var(--bad); font-weight: 600; }
tfoot td { font-weight: 600; background: var(--bg); }

.pill { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.p-ok { background: var(--ok-soft); color: var(--ok); } .p-warn { background: var(--warn-soft); color: var(--warn); }
.p-bad { background: var(--bad-soft); color: var(--bad); } .p-info { background: var(--info-soft); color: var(--info); }
.p-acc { background: var(--accent-soft); color: var(--accent); } .p-gris { background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.regla { display: inline-block; border: 1px solid var(--line); color: var(--muted); border-radius: var(--r-sm); padding: 0 6px; font-size: .74rem; margin-left: 6px; white-space: nowrap; }
.regla.pv { border-color: var(--warn); color: var(--warn); }

.btn { border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-sm); padding: 8px 14px; font-weight: 600; }
.btn:hover { border-color: var(--accent); }
.btn.pri { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.peligro { color: var(--bad); }
.btn.mini { padding: 4px 10px; font-size: .84rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.acciones { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filtros { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.filtros button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 12px; font-size: .84rem; }
.filtros button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.filtros select { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 10px; font-size: .84rem; }

.detalle { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.checks li { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 10px; align-items: start; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-md); }
.checks li.bad { border-color: var(--bad); }
.ic { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .8rem; }
.ic.ok { background: var(--ok-soft); color: var(--ok); } .ic.bad { background: var(--bad-soft); color: var(--bad); }
.ic.warn { background: var(--warn-soft); color: var(--warn); } .ic.info, .ic.dec { background: var(--info-soft); color: var(--info); }
.ic.exc { background: var(--accent-soft); color: var(--accent); }
.checks .d { color: var(--muted); font-size: .86rem; }
.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 14px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; }
.pasos { list-style: none; margin: 0; padding: 0; counter-reset: p; display: flex; flex-direction: column; gap: 8px; }
.pasos li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.pasos li:last-child { border-bottom: 0; padding-bottom: 0; }
.pasos .x { color: var(--muted); font-size: .84rem; grid-column: 1 / -1; }
.pasos .v { font-weight: 600; text-align: right; }
.pasos li.total .v { color: var(--accent); font-size: 1.05rem; }
.manual label { display: flex; gap: 10px; align-items: flex-start; padding: 7px 0; }
.manual input { margin-top: 3px; }
details { border: 1px solid var(--line); border-radius: var(--r-md); padding: 8px 12px; }
details summary { cursor: pointer; font-weight: 600; }
textarea.borrador { width: 100%; min-height: 130px; background: var(--bg); border: 1px dashed var(--line); border-radius: var(--r-md); padding: 10px 12px; font-size: .9rem; resize: vertical; }
.volver { border: 0; background: transparent; color: var(--accent); font-weight: 600; padding: 0; }
.linea-tiempo { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.linea-tiempo li { border: 1px solid var(--line); border-radius: var(--r-md); padding: 8px 10px; font-size: .84rem; }
.linea-tiempo li b { display: block; font-weight: 600; font-size: .9rem; }
.linea-tiempo li.vacio { color: var(--muted); border-style: dashed; }

.acceso { max-width: 760px; margin: 36px auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); display: flex; flex-direction: column; gap: 18px; }
.acceso .logo { font-family: var(--font-display); font-weight: 700; font-size: 1.6rem; color: var(--accent); }
.usuarios-acc { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.u-card { text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-lg); padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.u-card:hover { border-color: var(--accent); }
.u-card b { font-family: var(--font-display); font-size: 1.05rem; }
.campo { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.campo label { font-weight: 600; font-size: .88rem; }
.campo input, .campo select, .campo textarea { border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-sm); padding: 9px 11px; min-width: 0; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: end; }
.error { color: var(--bad); font-size: .86rem; }
.ok-msg { color: var(--ok); font-size: .9rem; font-weight: 500; }
.porque { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--r-md); padding: 10px 14px; }
.porque-corto { margin-top: 4px; max-width: 220px; white-space: normal; }
.enlace { border: 0; background: transparent; padding: 0; color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.candado { display: flex; gap: 10px; align-items: center; background: var(--accent-soft); color: var(--accent); border-radius: var(--r-md); padding: 10px 12px; font-weight: 500; }

.cargas { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.carga { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; background: var(--surface); display: flex; flex-direction: column; gap: 10px; }
.carga .estado { font-size: .86rem; }
.informe { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: .86rem; }
.informe li.e { color: var(--bad); } .informe li.o { color: var(--ok); } .informe li.a { color: var(--warn); }

.subtabs { display: flex; gap: 6px; flex-wrap: wrap; }
.subtabs button { border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-sm); padding: 6px 12px; font-weight: 500; }
.subtabs button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); font-weight: 600; }
.tabla-pct td.sel { background: var(--accent-soft); font-weight: 700; color: var(--accent); }

.leyenda { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 8px; }
.leyenda div { font-size: .84rem; color: var(--muted); }
.leyenda .pill { margin-right: 6px; }

.etapas { display: flex; flex-direction: column; gap: 10px; }
.etapa { display: grid; grid-template-columns: 54px minmax(0, 1fr) auto; gap: 14px; align-items: start; padding: 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.etapa .k { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; background: var(--accent-soft); color: var(--accent); }
.etapa.hecha .k { background: var(--ok-soft); color: var(--ok); }
.etapa .fechas { text-align: right; font-size: .84rem; color: var(--muted); }
.etapa .fechas b { color: var(--ink); font-weight: 600; }
.barra { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.barra > i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.si { color: var(--ok); font-weight: 700; } .no { color: var(--muted); }
.log { list-style: none; margin: 0; padding: 0; }
.log li { padding: 10px 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 12px; }
.log li:last-child { border-bottom: 0; }

.fondo { position: fixed; inset: 0; background: rgba(15, 13, 35, .45); z-index: 20; display: grid; place-items: center; padding: 16px; }
.modal { background: var(--surface); border-radius: var(--r-lg); border: 1px solid var(--line); padding: 20px; width: min(560px, 100%); max-height: 90vh; overflow: auto; display: flex; flex-direction: column; gap: 12px; }

@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .nav { position: static; flex-direction: row; overflow-x: auto; padding: 10px 16px 0; gap: 6px; }
  .nav button { white-space: nowrap; }
  .nav .cand, .nav .sep { display: none; }
  .grid-cifras { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detalle, .cargas { grid-template-columns: minmax(0, 1fr); }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .usuarios-acc { grid-template-columns: minmax(0, 1fr); }
  .linea-tiempo { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .etapa { grid-template-columns: 48px minmax(0, 1fr); }
  .etapa .fechas { grid-column: 2; text-align: left; }
  .log li { grid-template-columns: minmax(0, 1fr); gap: 2px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Versión real */
.form-col { display: flex; flex-direction: column; gap: 12px; }
.acceso .panel { display: flex; flex-direction: column; gap: 12px; }
.qr { width: 200px; height: 200px; background: #fff; border-radius: var(--r-md); padding: 8px; border: 1px solid var(--line); }
.secreto { font-family: ui-monospace, Consolas, monospace; word-break: break-all; user-select: all; }
.pre { white-space: pre-wrap; }
tr.tachado td { color: var(--muted); text-decoration: line-through; }
tr.tachado td .pill { text-decoration: none; }
.check { display: flex; gap: 8px; align-items: flex-start; }
table.editable { min-width: 520px; }
table.editable input { width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-sm); padding: 6px 8px; min-width: 0; }
.nav button { font-size: .92rem; }
a.btn { text-decoration: none; color: inherit; display: inline-block; }
.cab .acciones .pill { font-size: .85rem; }
.chip-user .rol { opacity: .85; font-weight: 400; margin-left: 6px; }
.top .marca span { margin-left: 6px; }
.volver { align-self: flex-start; }
/* Fase 1, parte C */
.aviso-plazo { background: var(--warn-soft); color: var(--warn); border-radius: var(--r-md); padding: 10px 14px; }
.aviso-plazo.urgente { background: var(--bad-soft); color: var(--bad); }
.nav .cand.alerta { display: inline-block; background: var(--bad); color: #fff; border-radius: 999px; padding: 0 7px; font-size: .74rem; font-weight: 700; }
.dif-txt { color: var(--bad); font-weight: 600; }
.reg-cambios div { word-break: break-word; }
.manual .check { padding: 3px 0; }
@media (max-width: 900px) { .nav .cand.alerta { display: inline-block; } }
