:root {
  --paper: #f6f6f3;
  --surface: #ffffff;
  --ink: #15191f;
  --muted: #545b67;
  --line: #d5d9d2;
  --accent: #0d6e5f;
  --accent-ink: #ffffff;
  --ok: #1d6b47;
  --ok-bg: #e2f1e9;
  --ia: #0d4f7a;
  --ia-bg: #e1edf6;
  --warn: #7a5200;
  --warn-bg: #f7ecd2;
  --error: #8a1f1f;
  --error-bg: #f6dede;
  --font: ui-sans-serif, "Avenir Next", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1 { font-size: 28px; line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 8px; font-weight: 700; }
h2 { font-size: 19px; margin: 0 0 12px; letter-spacing: -0.01em; font-weight: 650; }
p { margin: 0 0 12px; }
.texto { color: var(--muted); max-width: 70ch; }
.texto-chico { color: var(--muted); font-size: 14px; }
.kicker { font-size: 13px; color: var(--muted); margin: 0 0 6px; font-weight: 600; }
.nota { color: var(--muted); font-size: 14px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Demo banner */
.barra-demo {
  background: var(--warn-bg);
  color: var(--warn);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  padding: 6px 12px;
  border-bottom: 1px solid #ecd9a4;
}

/* App bar */
.barra {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 20px;
  height: 60px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.marca { font-weight: 700; text-decoration: none; color: var(--ink); font-size: 17px; }
.nav { display: flex; gap: 18px; flex: 1; }
.nav-link { color: var(--muted); text-decoration: none; font-size: 15px; padding: 18px 0; border-bottom: 2px solid transparent; }
.nav-link.activo { color: var(--ink); border-bottom-color: var(--accent); }
.usuario { font-size: 14px; color: var(--muted); }

.principal { max-width: 1100px; margin: 0 auto; padding: 28px 20px 64px; }
.pantalla-angosta { max-width: 560px; margin: 40px auto; }

/* Forms */
.formulario { display: grid; gap: 16px; margin: 24px 0; }
label { display: grid; gap: 6px; font-size: 14px; font-weight: 600; color: var(--ink); }
input {
  font: inherit;
  font-weight: 400;
  padding: 11px 12px;
  border: 1px solid #aeb5ad;
  background: var(--surface);
  color: var(--ink);
  border-radius: 0;
}
input:focus { border-color: var(--accent); outline: 2px solid var(--accent); outline-offset: 0; }

/* Buttons */
.btn-principal, .btn-secundario {
  display: inline-block;
  font: inherit;
  font-weight: 600;
  font-size: 15px;
  padding: 12px 20px;
  border-radius: 0;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.btn-principal { background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent); }
.btn-principal:hover { background: #0a5a4d; }
.btn-principal:disabled { background: #cfd6d1; border-color: #cfd6d1; color: #5a6460; cursor: not-allowed; }
.btn-secundario { background: var(--surface); color: var(--ink); border: 1px solid #aeb5ad; }
.btn-secundario:hover { border-color: var(--ink); }
.acciones { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 16px; align-items: center; }

/* Chips: estado siempre con texto, nunca solo color */
.chip {
  display: inline-block;
  font-size: 12px;
  font-weight: 650;
  padding: 3px 8px;
  border-radius: 0;
  white-space: nowrap;
  border: 1px solid transparent;
}
.chip-ok { background: var(--ok-bg); color: var(--ok); border-color: #b9dcc8; }
.chip-ia { background: var(--ia-bg); color: var(--ia); border-color: #b5d0e6; }
.chip-warn { background: var(--warn-bg); color: var(--warn); border-color: #ecd9a4; }
.chip-error { background: var(--error-bg); color: var(--error); border-color: #e7bcbc; }
.chip-vacio, .chip-neutro { background: #eceee9; color: var(--muted); border-color: #d5d9d2; }

/* Headers and tables */
.encabezado { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.tabla-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); }
.tabla { width: 100%; border-collapse: collapse; font-size: 15px; }
.tabla th, .tabla td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.tabla th { font-size: 13px; color: var(--muted); font-weight: 650; background: #f1f2ee; }
.tabla tr:last-child td { border-bottom: 0; }
.tabla a { font-weight: 600; }
.tarjeta { background: var(--surface); border: 1px solid var(--line); padding: 20px; margin-bottom: 16px; }

/* Plan */
.planes { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 20px 0; }
.plan { background: var(--surface); border: 1px solid var(--line); padding: 20px; }
.plan h2 { margin-bottom: 4px; }
.precio { font-weight: 650; color: var(--muted); margin: 0 0 10px; }
.aviso-demo { background: var(--warn-bg); color: var(--warn); padding: 12px 14px; font-size: 14px; margin-bottom: 8px; }

/* Avalúo tabs */
.pestanas { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.pestana { padding: 10px 14px; color: var(--muted); text-decoration: none; font-size: 15px; white-space: nowrap; border-bottom: 2px solid transparent; }
.pestana.activa { color: var(--ink); border-bottom-color: var(--accent); font-weight: 650; }

/* Captura por capítulo */
.captura { display: grid; grid-template-columns: 240px 1fr; gap: 24px; align-items: start; }
.lista-capitulos { background: var(--surface); border: 1px solid var(--line); }
.capitulo { display: grid; grid-template-columns: 26px 1fr auto; gap: 8px; align-items: center; padding: 11px 12px; color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line); font-size: 14px; }
.capitulo:last-child { border-bottom: 0; }
.capitulo.activo { background: #eef4f1; }
.capitulo .num { font-weight: 700; color: var(--muted); text-align: left; }

/* Visita */
.linea-tiempo { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.evento { display: grid; grid-template-columns: 60px 1fr; gap: 12px; padding: 0 0 18px 16px; position: relative; }
.evento::before { content: ""; position: absolute; left: -6px; top: 6px; width: 10px; height: 10px; background: var(--accent); }
.evento-alerta::before { background: var(--error); }
.evento-foto::before { background: var(--ia); }
.hora { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.tipo { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.evento p { margin: 2px 0 0; }
.accion { font-size: 14px; color: var(--muted); }

/* Datos de cuenta */
.datos { display: grid; grid-template-columns: max-content 1fr; gap: 10px 24px; margin: 0; }
.datos dt { color: var(--muted); }
.datos dd { margin: 0; }

/* Mobile */
@media (max-width: 760px) {
  .captura { grid-template-columns: 1fr; }
  .lista-capitulos { display: flex; overflow-x: auto; }
  .capitulo { min-width: 180px; border-bottom: 0; border-right: 1px solid var(--line); }
  .planes { grid-template-columns: 1fr; }
  .barra { gap: 12px; padding: 0 14px; }
  .usuario { display: none; }
  .encabezado { flex-direction: column; }
  h1 { font-size: 24px; }
  .col-opc { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Revisión de avalúo */
.volver { text-decoration: none; font-size: 14px; }
.encabezado { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: flex-start; margin-bottom: 18px; }
.paso { display: inline-grid; place-items: center; width: 26px; height: 26px; margin-right: 6px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: 14px; }
.chip { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 999px; white-space: nowrap; }
.chip.neutro { background: var(--paper); color: var(--muted); border: 1px solid var(--line); }
.chip.principal-chip { background: var(--ia-bg); color: var(--ia); }
.chip.ok-chip { background: var(--ok-bg); color: var(--ok); }
.chip.aviso-chip { background: var(--warn-bg); color: var(--warn); }
.chip.error-chip { background: var(--error-bg); color: var(--error); }
.carga { display: flex; flex-wrap: wrap; gap: 14px; align-items: end; padding: 16px; border: 1px dashed var(--line); border-radius: 10px; background: var(--paper); }
select, textarea { font: inherit; padding: 9px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); }
.vacio { color: var(--muted); padding: 14px 0 0; }
.archivos { list-style: none; margin: 14px 0 0; padding: 0; }
.archivos li { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.archivos p { margin: 4px 0 0; }
.proteccion { border-left: 4px solid var(--ok); }
.contadores { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin-bottom: 12px; }
.contador { padding: 12px; border: 1px solid var(--line); border-radius: 10px; text-align: center; color: var(--muted); }
.contador strong { display: block; font-size: 26px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.contador span { font-size: 13px; }
.contador.activo { background: var(--ok-bg); border-color: transparent; color: var(--ok); }
.paginas { display: flex; flex-wrap: wrap; gap: 10px; font-size: 14px; margin: 0 0 6px; }
.boton.grande { padding: 13px 26px; font-size: 17px; }
.boton:disabled { opacity: .45; cursor: not-allowed; }
.tabla-ancha { overflow-x: auto; }
.citas { list-style: none; margin: 0; padding: 0; }
.cita { margin: 6px 0; padding: 8px 10px; border-left: 3px solid var(--line); background: var(--paper); border-radius: 0 6px 6px 0; font-size: 14px; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.cita q { flex-basis: 100%; font-family: var(--mono); font-size: 13px; overflow-wrap: anywhere; }
.hallazgo { border: 1px solid var(--line); border-left-width: 4px; border-radius: 10px; padding: 16px; margin-bottom: 12px; }
.hallazgo.alta { border-left-color: var(--error); }
.hallazgo.media { border-left-color: var(--warn); }
.hallazgo.descartado { opacity: .6; }
.hallazgo h3 { font-size: 16px; margin: 10px 0 4px; }
.decidir { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.decidir input[type=text] { flex: 1 1 220px; max-width: none; }
.nueva-nota summary { cursor: pointer; color: var(--accent); font-weight: 600; }

/* Guía y siguiente paso */
.siguiente { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; padding: 14px 18px; margin-bottom: 14px; border-radius: 10px; background: var(--ia-bg); color: var(--ia); border: 1px solid #b5d0e6; }
.siguiente strong { text-transform: uppercase; font-size: 12px; letter-spacing: .05em; }
.siguiente span { font-size: 17px; font-weight: 600; }
.guia { border-left: 4px solid var(--accent); }
.pasos-guia { margin: 10px 0; padding-left: 22px; }
.pasos-guia li { margin: 8px 0; max-width: 70ch; }
.guia-plegable { margin-bottom: 14px; }
.guia-plegable > summary { cursor: pointer; color: var(--accent); font-weight: 600; margin-bottom: 8px; }
