:root {
  --navy: #17243a;
  --blue: #2463a6;
  --muted: #59667a;
  --line: #c5d0dc;
  --paper: #ffffff;
  --bg: #e7edf3;
  --soft: #eef2f6;
  --danger: #8c1d18;
  --danger-bg: #fdeceb;
  --ok: #0d3b2e;
  --ok-bg: #e7f6ef;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--navy);
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.4;
}

.local-note {
  max-width: 860px;
  margin: 12px auto 0;
  padding: 0 16px;
  color: var(--muted);
  font-size: 14px;
}

.sheet {
  max-width: 860px;
  margin: 12px auto 32px;
  background: var(--paper);
  padding: 20px 16px 28px;
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(23, 36, 58, 0.08);
}

.masthead {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 14px;
}

.masthead img {
  width: 148px;
  height: auto;
  flex: 0 0 auto;
}

.titles { flex: 1; text-align: center; }

h1 {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: 0.04em;
  line-height: 1.15;
}

.place {
  margin: 6px 0 0;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 18px;
  background: var(--soft);
  border-radius: 10px;
  padding: 12px 14px;
}

.info p { margin: 0; }

.date-note,
.lead-sub,
.hint,
.photo-field p,
.when-pad p {
  color: var(--muted);
  font-size: 0.92rem;
}

.lead { margin: 16px 0 4px; }

.errors {
  background: var(--danger-bg);
  color: var(--danger);
  border-radius: 8px;
  padding: 10px 12px;
  margin: 12px 0;
}

.errors:focus { outline: 2px solid var(--danger); }

.error-title { margin: 0 0 6px; font-weight: 700; }

.errors ul { margin: 0; padding-left: 1.2rem; }

.need {
  background: #fff6e8;
  border-left: 4px solid #a15c07;
  padding: 8px 12px;
  margin: 8px 0 12px;
}

.need p { margin: 0; }

.thead,
.item {
  display: grid;
  grid-template-columns: 88px minmax(96px, 130px) 1fr auto;
  gap: 8px 12px;
  align-items: center;
}

.thead {
  margin-top: 8px;
  background: var(--navy);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 8px;
  border-radius: 8px 8px 0 0;
}

.item {
  padding: 10px 8px;
  border: 1px solid var(--line);
  border-top: 0;
}

.item:last-of-type { border-radius: 0 0 8px 8px; }

.model { margin: 0; font-weight: 700; }

.desc,
.cants p,
.printed { margin: 0; }

.ok { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }

.ok-box {
  width: 28px;
  height: 28px;
  border: 2px solid var(--navy);
  background: #fff;
  position: relative;
}

.ok-box.is-on::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 7px;
  width: 12px;
  height: 6px;
  border-left: 3px solid var(--navy);
  border-bottom: 3px solid var(--navy);
  transform: rotate(-45deg);
}

.ok-state { font-size: 0.75rem; color: var(--muted); }

.qty { display: flex; gap: 8px; margin-top: 6px; }

.qty button,
.secondary,
.primary,
.estado {
  font: inherit;
}

.qty button {
  min-width: 44px;
  min-height: 44px;
  border: 2px solid var(--navy);
  background: #fff;
  color: var(--navy);
  border-radius: 8px;
  font-weight: 700;
}

.qty button.is-selected {
  background: var(--navy);
  color: #fff;
}

.status {
  border: 0;
  margin: 18px 0 8px;
  padding: 0;
}

.status legend {
  font-weight: 800;
  letter-spacing: 0.03em;
  margin-bottom: 8px;
}

.estado {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 2px solid var(--blue);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  cursor: pointer;
}

.estado input {
  appearance: none;
  width: 28px;
  height: 28px;
  border: 2px solid var(--navy);
  margin: 0;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  background: #fff;
}

.estado input:checked {
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2 6.2 L4.6 8.8 L10 3.2' fill='none' stroke='%2317243a' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 16px 16px;
}

.estado:has(input:checked) { background: #f3f7fc; }

label.block { display: block; margin: 12px 0 6px; }

textarea,
input[type="text"],
input[type="file"] {
  width: 100%;
  font: inherit;
  font-size: 16px;
  border: 1px solid #8ea0b8;
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--navy);
  background: #fff;
}

textarea { min-height: 96px; resize: vertical; }

.printed { margin-top: 16px; font-weight: 700; }

.checkline {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 8px 0;
}

.checkline input { width: 22px; height: 22px; margin-top: 2px; flex: 0 0 auto; }

.sign-block {
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  gap: 16px;
  margin-top: 16px;
}

.sign-pad {
  position: relative;
  height: 180px;
  border: 1px solid #8ea0b8;
  border-radius: 8px;
  background: #fff;
  touch-action: none;
}

.sign-pad canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: crosshair;
}

.sign-pad::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 36px;
  border-bottom: 1px solid var(--navy);
  pointer-events: none;
}

.sign-caption {
  position: absolute;
  left: 12px;
  bottom: 12px;
  color: var(--muted);
  font-size: 0.82rem;
  pointer-events: none;
}

.when-pad {
  border-top: 0;
  padding-top: 8px;
}

.when-line {
  border-bottom: 1px solid var(--navy);
  height: 72px;
  margin-bottom: 8px;
}

.when-label { margin: 0; color: var(--muted); font-size: 0.82rem; }

#cuando { margin: 8px 0 0; color: var(--navy); font-weight: 700; }

.photo-field {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 16px 0;
  padding: 12px;
}

.photo-field legend { font-weight: 700; padding: 0 6px; }

#foto-vista {
  display: block;
  max-width: 100%;
  max-height: 220px;
  margin-top: 10px;
  border-radius: 8px;
}

.primary,
.secondary {
  min-height: 48px;
  border-radius: 8px;
  padding: 10px 14px;
  font-weight: 700;
}

.primary {
  width: 100%;
  border: 0;
  background: var(--navy);
  color: #fff;
  margin-top: 8px;
}

.secondary {
  border: 2px solid var(--navy);
  background: #fff;
  color: var(--navy);
  margin-top: 8px;
}

.primary:disabled { opacity: 0.6; }

.result {
  margin-top: 14px;
  background: var(--ok-bg);
  color: var(--ok);
  border-radius: 8px;
  padding: 12px;
}

.result p { margin: 0 0 8px; }

footer {
  margin-top: 22px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.82rem;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid #7aa2d6;
  outline-offset: 2px;
}

@media (max-width: 720px) {
  .info,
  .sign-block,
  .masthead { grid-template-columns: 1fr; display: block; }
  .masthead { display: flex; flex-direction: column; text-align: center; }
  .thead { display: none; }
  .item {
    grid-template-columns: auto 1fr;
    grid-template-areas:
      "ok model"
      "desc desc"
      "cant cant";
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-top: 8px;
  }
  .ok { grid-area: ok; }
  .model { grid-area: model; }
  .desc { grid-area: desc; }
  .cants { grid-area: cant; }
  .titles { text-align: center; }
}

@media (min-width: 721px) {
  .sheet { padding: 28px 32px 36px; }
  h1 { font-size: 1.7rem; }
}
