:root {
  --fondo: #ffffff;
  --tinta: #161616;
  --suave: #5c5c5c;
  --linea: #d4d4d4;
  --panel: #f6f6f6;
  --gris: #ececec;
  --negro: #111111;
  --acento: #3d5670;
  --acento-activo: #2f4458;
  --verde-fondo: #e3f0e4;
  --verde-linea: #b7d0b9;
  --ambar-fondo: #f6edd8;
  --ambar-linea: #e0d0a4;
  --rojo-fondo: #f8e8e6;
  --rojo-linea: #e0b2ae;
  --rojo-marca: #8d3d3a;
  color-scheme: light;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { font-size: 100%; height: 100%; }

body {
  margin: 0;
  height: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--fondo);
  color: var(--tinta);
  font-family: "Segoe UI", "Liberation Sans", "Helvetica Neue", Arial, sans-serif;
  line-height: 1.45;
}

.contenido {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.cabecera,
.pagina {
  width: min(1120px, calc(100% - 2rem));
  margin-inline: auto;
}

.cabecera { padding: 1.5rem 0 0.5rem; }

.marca {
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--suave);
}

h1 {
  margin: 0.2rem 0 0.4rem;
  font-size: clamp(1.45rem, 2.4vw, 1.9rem);
  line-height: 1.2;
  font-weight: 650;
}

h2 {
  margin: 0 0 0.8rem;
  font-size: 1.15rem;
}

h3 {
  margin: 1.2rem 0 0.45rem;
  font-size: 1rem;
}

.bajada,
.ayuda {
  margin: 0.35rem 0 0.8rem;
  color: var(--suave);
  font-size: 0.92rem;
}

.pagina { padding-bottom: 1.25rem; }

.rejilla {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.rejilla > .panel:first-child { max-width: 46rem; }

.panel {
  border: 1px solid var(--linea);
  background: var(--fondo);
  padding: 1rem;
  margin-bottom: 1rem;
}

label,
legend {
  display: block;
  font-weight: 600;
  margin-bottom: 0.3rem;
}

input[type="text"],
textarea {
  width: 100%;
  border: 1px solid #bdbdbd;
  background: #fff;
  color: var(--tinta);
  font: inherit;
  font-size: 1rem;
  padding: 0.45rem 0.55rem;
}

textarea {
  resize: vertical;
  min-height: 7rem;
  line-height: 1.4;
}

input[readonly] { background: var(--panel); }

.linea-archivo {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.5rem;
  align-items: center;
}

.zona {
  border: 1px dashed #bdbdbd;
  padding: 0.75rem;
  margin-bottom: 0.9rem;
  background: #fff;
}

.zona.sobre {
  border-color: var(--negro);
  background: var(--panel);
}

.fila-botones {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.7rem 0;
}

.boton {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--negro);
  background: #fff;
  color: var(--negro);
  font: inherit;
  font-size: 0.95rem;
  padding: 0.48rem 0.8rem;
  cursor: pointer;
  text-decoration: none;
}

.boton-principal {
  background: var(--acento);
  border-color: var(--acento);
  color: #fff;
}

.boton:hover { background: #333; color: #fff; }

.boton-secundario:hover { background: var(--negro); color: #fff; }

.boton-principal:hover {
  background: var(--acento-activo);
  border-color: var(--acento-activo);
  color: #fff;
}

.boton:focus-visible,
input:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--negro);
  outline-offset: 2px;
}

.boton:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.boton input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  font-size: 0;
}

.conteo {
  font-weight: 650;
  margin: 0.2rem 0 0.9rem;
}

fieldset.filas,
details {
  border: 1px solid var(--linea);
  background: var(--panel);
  padding: 0.75rem;
  margin: 0.4rem 0 0.9rem;
}

summary {
  cursor: pointer;
  font-weight: 650;
}

.tolerancia {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.tolerancia label { margin: 0; font-weight: 500; }

.tolerancia input { width: 5rem; }

.precios {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 9rem;
  gap: 0.45rem 0.7rem;
  align-items: center;
  margin-bottom: 0.7rem;
}

.precios label { margin: 0; font-weight: 500; }

.visor {
  min-height: 280px;
  border: 1px solid var(--linea);
  background: var(--panel);
  display: flex;
  align-items: center;
  justify-content: center;
  align-items: safe center;
  justify-content: safe center;
  overflow: auto;
}

.visor p { margin: 1rem; color: var(--suave); }

.visor img,
.visor iframe,
.visor canvas {
  display: block;
  width: 100%;
  background: #fff;
}

.visor canvas {
  width: auto;
  max-width: none;
  flex: 0 0 auto;
}

.visor iframe { height: 460px; border: 0; }

.visor img { height: auto; max-height: 70vh; object-fit: contain; }

.visor-panel {
  padding: 0 1rem 1rem;
  border-color: #c5d3e2;
}

.visor-cabeza {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  background: #eef3f8;
  margin: 0 -1rem 0.85rem;
  padding: 0.7rem 1rem;
  border-bottom: 3px solid var(--acento);
}

.visor-cabeza h2 { margin: 0; color: var(--tinta); }

.visor-cabeza .fila-botones { margin: 0; }

.visor-panel .visor {
  background: #f7f9fb;
  border-color: #d5e0ea;
}

.boton[aria-pressed="true"] {
  background: var(--acento);
  border-color: var(--acento);
  color: #fff;
}

.boton[aria-pressed="true"]:hover {
  background: var(--acento-activo);
  border-color: var(--acento-activo);
  color: #fff;
}

.leyenda {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1rem;
  list-style: none;
  padding: 0.6rem 0 0;
  margin: 0;
  font-size: 0.88rem;
}

.leyenda li { display: flex; align-items: center; gap: 0.35rem; }

.marca-punto {
  width: 0.78rem;
  height: 0.78rem;
  display: inline-block;
  border: 1.5px solid #3d5670;
  background: #d4e1ee;
  flex: 0 0 auto;
}

.marca-m { background: #d4e1ee; border-color: #3d5670; border-radius: 50%; }
.marca-aux { background: #f6edd4; border-color: #6f5e3c; border-radius: 0; }
.marca-ce {
  background:
    linear-gradient(45deg, transparent 40%, #3e6846 40%, #3e6846 60%, transparent 60%),
    linear-gradient(-45deg, transparent 40%, #3e6846 40%, #3e6846 60%, transparent 60%),
    #dcebd9;
  border-color: #3e6846;
  border-radius: 50%;
}
.marca-co {
  width: 0;
  height: 0;
  border: 0;
  border-left: 0.42rem solid transparent;
  border-right: 0.42rem solid transparent;
  border-bottom: 0.72rem solid #3d6560;
  background: transparent;
  position: relative;
}
.marca-co::after {
  content: "";
  position: absolute;
  left: -0.3rem;
  top: 0.16rem;
  border-left: 0.3rem solid transparent;
  border-right: 0.3rem solid transparent;
  border-bottom: 0.5rem solid #d7ebe8;
}
.marca-pr {
  background: #e7e1ee;
  border-color: #5a4d66;
  transform: rotate(45deg);
  width: 0.58rem;
  height: 0.58rem;
  border-radius: 0;
}

.tabla-contenedor { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

th,
td {
  border-bottom: 1px solid var(--linea);
  padding: 0.5rem 0.6rem;
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--acento);
  color: #fff;
  font-weight: 600;
}

td.num,
th.num { text-align: right; font-variant-numeric: tabular-nums; }

tbody tr:nth-child(even):not(.por-confirmar) td { background: #fafafa; }

tbody tr.por-confirmar td { background: var(--ambar-fondo); }

tbody tr.por-confirmar td:first-child { box-shadow: inset 3px 0 0 var(--ambar-linea); }

tfoot th,
tfoot td {
  background: var(--panel);
  color: var(--tinta);
  font-weight: 700;
}

td small {
  display: block;
  color: var(--suave);
  font-size: 0.82rem;
  margin-top: 0.2rem;
}

.total {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0.8rem 0 0.4rem;
  padding: 0.65rem 0.75rem;
  background: var(--verde-fondo);
  border: 1px solid var(--verde-linea);
  color: var(--tinta);
}

.resumen {
  white-space: pre-line;
  margin: 0.3rem 0 0.6rem;
}

.notas { list-style: none; padding: 0; margin: 0; }

.notas li {
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 1fr);
  gap: 0.6rem;
  border-bottom: 1px solid var(--linea);
  padding: 0.45rem 0;
}

.notas .tipo {
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.notas li.nota-pendiente {
  background: var(--ambar-fondo);
  border-bottom-color: var(--ambar-linea);
  margin-inline: -0.45rem;
  padding-inline: 0.45rem;
}

.aviso {
  width: min(1120px, calc(100% - 2rem));
  margin: 0.8rem auto 0;
  border: 1px solid var(--rojo-linea);
  border-left: 4px solid var(--rojo-marca);
  background: var(--rojo-fondo);
  color: var(--tinta);
  padding: 0.7rem 0.8rem;
  white-space: pre-wrap;
}

.aviso-dentro {
  width: auto;
  margin: 0.4rem 0;
  min-height: 0;
}

.aviso-dentro:empty { display: none; }

.estado {
  flex: 0 0 auto;
  border-top: 1px solid var(--linea);
  background: var(--panel);
  padding: 0.7rem 1rem;
  color: var(--tinta);
}

dialog {
  border: 1px solid var(--negro);
  padding: 1.1rem;
  width: min(34rem, calc(100% - 2rem));
  background: #fff;
  color: var(--tinta);
}

dialog::backdrop { background: rgba(0, 0, 0, 0.45); }

dialog h2 { margin-top: 0; }

.prefijo-caja {
  border: 1px solid var(--linea);
  padding: 0.6rem 0.7rem;
  margin: 0.5rem 0;
  background: var(--panel);
}

.prefijo-caja legend { padding: 0; }

.prefijo-caja label { font-weight: 500; margin: 0.2rem 0; }

@media (max-width: 860px) {
  .rejilla > .panel:first-child { max-width: none; }
  .precios { grid-template-columns: 1fr; }
  .linea-archivo { grid-template-columns: 1fr; }
  .visor iframe { height: 320px; }
  .notas li { grid-template-columns: 1fr; gap: 0.15rem; }
}

@media (max-width: 420px) {
  .cabecera,
  .pagina,
  .aviso { width: min(1120px, calc(100% - 1rem)); }
  .boton { width: 100%; }
  .fila-botones { flex-direction: column; }
  .visor-cabeza .fila-botones { width: 100%; }
  .tabla-contenedor table { table-layout: fixed; font-size: 0.84rem; }
  .tabla-contenedor th,
  .tabla-contenedor td {
    overflow-wrap: break-word;
    padding: 0.42rem 0.32rem;
  }
}
