:root {
  --fondo: #f6f5f2;
  --superficie: #ffffff;
  --texto: #1c1c1e;
  --suave: #6b6b70;
  --linea: #e3e1dc;
  --acento: #1f5eff;
  --acento-texto: #ffffff;
  --bien: #1f7a3d;
  --bien-fondo: #e6f4ea;
  --revisar: #8a5a00;
  --revisar-fondo: #fff3d6;
  --mal: #b3261e;
  --mal-fondo: #fde8e6;
  --neutro-fondo: #efeee9;
  --radio: 12px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fondo: #121214;
    --superficie: #1c1c1f;
    --texto: #ececee;
    --suave: #9b9ba1;
    --linea: #2e2e33;
    --acento: #5a8bff;
    --acento-texto: #0b0b0c;
    --bien: #7fd49a;
    --bien-fondo: #16301f;
    --revisar: #f2c66b;
    --revisar-fondo: #33280f;
    --mal: #ff8a80;
    --mal-fondo: #3a1714;
    --neutro-fondo: #26262a;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--fondo);
  color: var(--texto);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--acento); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.75rem; line-height: 1.2; margin: 0.25rem 0 1rem; letter-spacing: -0.01em; }
h2 { font-size: 1.05rem; margin: 0 0 0.75rem; }
.cabecera {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.75rem 1.25rem; background: var(--superficie); border-bottom: 1px solid var(--linea);
  position: sticky; top: 0; z-index: 2;
}
.cabecera nav { display: flex; align-items: center; gap: 1rem; }
.marca { font-weight: 700; font-size: 1.2rem; color: var(--texto); letter-spacing: -0.02em; }
main { max-width: 1180px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
.pie { max-width: 1180px; margin: 0 auto; padding: 0 1rem 2rem; color: var(--suave); font-size: 0.85rem; }

.boton {
  display: inline-flex; align-items: center; justify-content: center; min-height: 40px;
  padding: 0 1rem; border-radius: 999px; border: 1px solid var(--linea);
  background: var(--superficie); color: var(--texto); font: inherit; font-weight: 600; cursor: pointer;
}
.boton:hover { text-decoration: none; border-color: var(--suave); }
.boton-primario { background: var(--acento); border-color: var(--acento); color: var(--acento-texto); }
.boton-primario:hover { filter: brightness(1.06); border-color: var(--acento); }
.boton[aria-busy="true"] { opacity: 0.6; pointer-events: none; }

.tarjeta { background: var(--superficie); border: 1px solid var(--linea); border-radius: var(--radio); padding: 1.25rem; }
.portada { margin-bottom: 2rem; }
.oficios { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.75rem; }
.oficio {
  display: flex; flex-direction: column; gap: 0.25rem; padding: 1rem 1.1rem; border-radius: var(--radio);
  background: var(--superficie); border: 1px solid var(--linea); color: var(--texto);
}
.oficio:hover { border-color: var(--acento); text-decoration: none; }
.oficio-nombre { font-weight: 600; }
.oficio-accion { color: var(--acento); font-size: 0.9rem; }
.tarifas { color: var(--suave); font-size: 0.9rem; margin-top: 0.75rem; }
.vacio { color: var(--suave); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.55rem 0.5rem; border-bottom: 1px solid var(--linea); vertical-align: top; }
thead th { font-size: 0.8rem; color: var(--suave); font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lista { background: var(--superficie); border: 1px solid var(--linea); border-radius: var(--radio); overflow: hidden; }
.lista td, .lista th { padding: 0.7rem 0.9rem; }

.etiqueta { display: inline-block; font-size: 0.75rem; font-weight: 600; padding: 0.05rem 0.5rem; border-radius: 999px; }
.e-comprobado, .e-manual { background: var(--bien-fondo); color: var(--bien); }
.e-a_revisar { background: var(--revisar-fondo); color: var(--revisar); }
.e-rechazado { background: var(--mal-fondo); color: var(--mal); }
.e-vacio { background: var(--neutro-fondo); color: var(--suave); }
.e-conflicto { background: var(--mal-fondo); color: var(--mal); }
.alternativas { margin: 0.35rem 0 0; padding-left: 1rem; color: var(--texto); }
.alternativas li { margin: 0.15rem 0; }

.miga { color: var(--suave); font-size: 0.9rem; margin: 0; }
.aviso { background: var(--revisar-fondo); color: var(--revisar); padding: 0.75rem 1rem; border-radius: var(--radio); }
.bien { color: var(--bien); font-weight: 600; }
.ayuda { color: var(--suave); font-size: 0.9rem; margin: 0.4rem 0 0.75rem; }
.motivo { color: var(--mal); font-size: 0.8rem; }
.fuente { color: var(--suave); font-size: 0.8rem; }
.obligatorio { color: var(--mal); }

.rejilla { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.columna { display: grid; gap: 1rem; }
.campos th[scope="row"] { width: 34%; font-weight: 500; }
.campos th[scope="row"] .etiqueta { margin-top: 0.2rem; }
.campos tr.falta th[scope="row"] label { color: var(--mal); }
.cita { width: 33%; font-size: 0.85rem; color: var(--suave); word-break: break-word; }
.cita q { quotes: "«" "»"; }
.con-unidad { display: flex; align-items: center; gap: 0.4rem; }
.unidad { color: var(--suave); font-size: 0.85rem; white-space: nowrap; }
.confirmar { display: inline-flex; gap: 0.35rem; align-items: center; font-size: 0.85rem; margin-top: 0.35rem; }

input:not([type="radio"]):not([type="checkbox"]):not([type="file"]), select, textarea {
  width: 100%; font: inherit; color: var(--texto); background: var(--fondo);
  border: 1px solid var(--linea); border-radius: 8px; padding: 0.45rem 0.6rem; min-height: 40px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--acento); outline-offset: 1px; border-color: transparent; }
textarea { resize: vertical; line-height: 1.45; }
.respuesta { background: var(--fondo); font-size: 0.95rem; }
.acciones { margin-top: 1rem; display: flex; gap: 0.5rem; justify-content: flex-end; }

.formulario { display: grid; gap: 0.4rem; max-width: 760px; }
.formulario label { font-weight: 600; margin-top: 0.6rem; }
.estrecho { max-width: 420px; }
.entrar { max-width: 420px; margin: 8vh auto 0; }
.orden { background: var(--superficie); border: 1px solid var(--linea); border-radius: 8px; padding: 0.75rem 1rem; overflow-x: auto; font: 0.9rem/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; }
.salir { margin: 0; display: inline; }
.trampa { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.bienvenida { max-width: 720px; margin: 6vh auto 0; }
.bienvenida h1 { font-size: 2.2rem; }
.entradilla { font-size: 1.15rem; color: var(--texto); }
.puntos { padding-left: 1.2rem; color: var(--suave); }
.puntos li { margin: 0.3rem 0; }
.acciones-portada { display: flex; gap: 0.75rem; margin-top: 1.5rem; flex-wrap: wrap; }
.legal { max-width: 760px; }
.saber-seite { max-width: 820px; margin: 0 auto; }
.saber-seite h1 { font-size: 2rem; margin-top: 0.5rem; }
.saber-seite h2 { font-size: 1.35rem; margin: 2rem 0 0.75rem; }
.saber-seite h3 { font-size: 1.05rem; margin: 1.25rem 0 0.35rem; }
.saber-seite .entradilla { font-size: 1.1rem; }
.saber { padding-left: 1.2rem; }
.saber li { margin: 0.35rem 0; }
.tabla-saber { margin: 0.5rem 0 1rem; background: var(--superficie); border: 1px solid var(--linea); border-radius: var(--radio); overflow: hidden; }
.tabla-saber th, .tabla-saber td { padding: 0.55rem 0.7rem; }
.tabla-saber tfoot th, .tabla-saber tfoot td { font-weight: 600; }
.checkliste li { margin: 0.4rem 0; }
.muster { background: var(--superficie); border: 1px solid var(--linea); border-radius: var(--radio); padding: 1.25rem; margin: 0.5rem 0 1rem; }
.rechner { max-width: 520px; }
.ergebnis { display: block; margin-top: 1rem; }
.gepruft { margin: 2.5rem 0 1rem; padding: 0.75rem 1rem; border-left: 3px solid var(--acento); background: var(--superficie); color: var(--suave); font-size: 0.9rem; }
.cta { background: var(--neutro-fondo); border-radius: var(--radio); padding: 1.25rem; margin-top: 1.5rem; }
.cta h2 { margin-top: 0; }
.cta .boton { margin-right: 0.5rem; }
.plantilla [contenteditable="true"]:hover, .plantilla [contenteditable="true"]:focus { outline: 1px dashed var(--acento); outline-offset: 2px; }
.legal h2 { margin-top: 1.5rem; }
.pie a { color: var(--suave); text-decoration: underline; }
.enlace { background: none; border: 0; padding: 0; font: inherit; color: var(--acento); cursor: pointer; }
.enlace:hover { text-decoration: underline; }
.oficios-elegir { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.oficios-elegir legend { font-weight: 600; margin-bottom: 0.4rem; }
.opcion { display: inline-flex; align-items: center; gap: 0.45rem; padding: 0.5rem 0.85rem; border: 1px solid var(--linea); border-radius: 999px; cursor: pointer; font-weight: 500 !important; margin: 0 !important; }
.opcion:has(input:checked) { border-color: var(--acento); background: color-mix(in srgb, var(--acento) 10%, transparent); }

.presupuesto tfoot th { text-align: right; font-weight: 500; }
.presupuesto tfoot .total th, .presupuesto tfoot .total td { font-weight: 700; font-size: 1.05rem; border-bottom: 0; }
.presupuesto tr.abierta td { color: var(--suave); }
.original summary { cursor: pointer; font-weight: 600; }
.original pre { white-space: pre-wrap; word-break: break-word; font: 0.85rem/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; margin: 0.75rem 0 0; max-height: 420px; overflow: auto; }

.pre { white-space: pre-line; }
.hoja {
  background: #fff; color: #1c1c1e; max-width: 210mm; margin: 1.5rem auto 0; padding: 18mm 18mm 20mm;
  border: 1px solid var(--linea); border-radius: 4px; font-size: 11pt; line-height: 1.45;
}
.hoja h1 { font-size: 15pt; margin: 8mm 0 4mm; }
.hoja table th, .hoja table td { border-color: #ddd; }
.hoja thead th { color: #666; }
.membrete { display: flex; justify-content: space-between; gap: 2rem; align-items: flex-start; }
.emisor { font-weight: 700; font-size: 13pt; }
.datos-oferta { display: grid; grid-template-columns: auto auto; gap: 0.1rem 0.75rem; margin: 0; }
.datos-oferta dt { color: #666; }
.datos-oferta dd { margin: 0; text-align: right; }
.destinatario { margin-top: 10mm; }
.subtitulo { font-size: 0.95rem; margin: 1.25rem 0 0.5rem; }
.hoja .subtitulo { font-size: 11pt; margin: 6mm 0 2mm; }
.datos-pieza { display: grid; grid-template-columns: max-content 1fr; gap: 0.15rem 1rem; margin: 0; }
.datos-pieza dt { color: #666; }
.datos-pieza dd { margin: 0; }
.nota { color: #666; font-size: 0.9em; }
@media print {
  @page { size: A4; margin: 0; }
  body { background: #fff; }
  .cabecera, .pie, .no-imprimir { display: none !important; }
  .saber-seite > :not(.plantilla) { display: none; }
  .saber-seite { max-width: none; }
  main { padding: 0; max-width: none; }
  .hoja { border: 0; border-radius: 0; margin: 0; max-width: none; }
}

@media (max-width: 860px) {
  .rejilla { grid-template-columns: 1fr; }
  .cita { width: auto; }
  .campos thead { display: none; }
  .campos tr { display: grid; grid-template-columns: 1fr; border-bottom: 1px solid var(--linea); padding: 0.5rem 0; }
  .campos th, .campos td { border: 0; padding: 0.2rem 0; width: auto !important; }
  .cabecera nav a:not(.boton) { display: none; }
}
