:root {
  color-scheme: light;
  --ink: #171717;
  --muted: #5d6470;
  --line: #d6dbe3;
  --paper: #ffffff;
  --surface: #f4f6f8;
  --accent: #8f1d1d;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--surface);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(260px, 330px) minmax(0, 900px);
  gap: 24px;
  align-items: start;
  justify-content: center;
  padding: 24px;
}

.toolbar {
  position: sticky;
  top: 24px;
  display: grid;
  gap: 16px;
  padding: 18px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 50px rgba(24, 32, 42, 0.08);
}

.form-panel {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 0 0 16px;
  border: 0;
  border-bottom: 1px solid var(--line);
}

.form-panel h2 {
  margin: 0;
  font-size: 17px;
  line-height: 1.2;
}

.toolbar label {
  display: grid;
  gap: 6px;
  font-size: 14px;
  font-weight: 700;
}

.toolbar span {
  color: var(--muted);
}

.toolbar input {
  width: 100%;
  height: 42px;
  border: 1px solid #b8c0cc;
  border-radius: 6px;
  padding: 0 12px;
  font: 700 18px/1 Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: #fff;
}

.toolbar input:focus {
  border-color: var(--accent);
  outline: 2px solid rgba(143, 29, 29, 0.16);
  outline-offset: 1px;
}

.field:focus {
  border-color: transparent;
  outline: 0;
}

.date-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.print-button {
  height: 44px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font: 700 16px/1 Arial, Helvetica, sans-serif;
}

.print-button:hover {
  background: #761616;
}

.sheet {
  position: relative;
  width: min(100%, 900px);
  aspect-ratio: 3165 / 4473;
  background: #fff;
  box-shadow: 0 22px 70px rgba(24, 32, 42, 0.18);
}

.sheet img {
  display: block;
  width: 100%;
  height: 100%;
  user-select: none;
  pointer-events: none;
}

.field {
  position: absolute;
  z-index: 2;
  border: 1px solid transparent;
  border-radius: 0;
  padding: 0.35em 1.2% 0;
  color: #111;
  background: transparent;
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 700;
  line-height: 1;
  text-align: center;
}

.field.number {
  left: 12.75%;
  width: 11.7%;
  height: 2.45%;
  padding-top: 0.18em;
  font-size: clamp(14px, 1.75vw, 24px);
}

.field.car,
.field.plate {
  left: 37.55%;
  width: 41.95%;
  height: 2.55%;
  font-size: clamp(14px, 1.65vw, 23px);
}

.field.date-from {
  left: 37.55%;
  width: 12.85%;
  height: 2.55%;
  font-size: clamp(13px, 1.45vw, 20px);
}

.field.date-to {
  left: 57.2%;
  width: 22%;
  height: 2.55%;
  font-size: clamp(13px, 1.45vw, 20px);
}

.field.number.top {
  top: 26.85%;
}

.field.car.top {
  top: 30.15%;
}

.field.plate.top {
  top: 33.7%;
}

.field.date-from.top,
.field.date-to.top {
  top: 37.1%;
}

.field.number.bottom {
  top: 74.35%;
}

.field.car.bottom {
  top: 77.6%;
}

.field.plate.bottom {
  top: 81.15%;
}

.field.date-from.bottom,
.field.date-to.bottom {
  top: 84.65%;
}

@media (max-width: 980px) {
  .workspace {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .toolbar {
    position: static;
  }

  .sheet {
    width: 100%;
  }
}

@page {
  size: A4 portrait;
  margin: 0;
}

@media print {
  html,
  body {
    width: 210mm;
    height: 297mm;
    overflow: hidden;
    background: #fff;
  }

  .workspace {
    display: block;
    width: 210mm;
    padding: 0;
  }

  .toolbar {
    display: none;
  }

  .sheet {
    width: 210mm;
    height: 297mm;
    box-shadow: none;
  }

  .field {
    border-color: transparent;
    background: transparent;
    outline: 0;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .field.number {
    font-size: 15pt;
  }

  .field.car,
  .field.plate {
    font-size: 15pt;
  }

  .field.date-from,
  .field.date-to {
    font-size: 14pt;
  }
}
