@page {
  size: A4;
  margin: 14mm 16mm 14mm 16mm;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: #171717;
  background: #e8e8e8;
  font-family: Arial, "Helvetica Neue", sans-serif;
  font-size: 13px;
  line-height: 1.42;
}

.toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px;
  background: #ffffff;
  border-bottom: 1px solid #d8d8d8;
}

.toolbar span {
  display: inline-flex;
  align-items: center;
  color: #606060;
  font-size: 13px;
}

.toolbar a,
.toolbar button {
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid #c9c9c9;
  border-radius: 6px;
  color: #171717;
  background: #ffffff;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.toolbar button {
  color: #ffffff;
  border-color: #3f6b45;
  background: #3f6b45;
}

.toolbar button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.document {
  display: grid;
  gap: 22px;
  padding: 28px 0;
}

@media (max-width: 720px) {
  .toolbar {
    justify-content: stretch;
  }

  .toolbar a,
  .toolbar button {
    flex: 1 1 140px;
  }

  .toolbar span {
    flex-basis: 100%;
    justify-content: center;
    text-align: center;
  }

  .document {
    padding: 0;
  }

  .page {
    width: 100%;
    padding: 16px;
    box-shadow: none;
  }
}

.page {
  width: 210mm;
  margin: 0 auto;
  padding: 18mm 18mm;
  background: #ffffff;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.16);
  break-after: page;
}

.page:last-child {
  break-after: auto;
}

.doc-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 2px solid #171717;
}

.doc-header p {
  margin: 0 0 7px;
  color: #666666;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.doc-header h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.12;
}

.doc-header span {
  white-space: nowrap;
  font-weight: 800;
}

.notice {
  padding: 9px 12px;
  border-left: 4px solid #3f6b45;
  background: #f4f7f2;
  color: #3b3b3b;
}

h2 {
  margin: 18px 0 8px;
  font-size: 16px;
  line-height: 1.2;
}

p {
  margin: 0 0 7px;
}

ol {
  margin: 0 0 12px 20px;
  padding: 0;
}

li {
  margin-bottom: 5px;
}

table {
  width: 100%;
  margin: 9px 0 10px;
  border-collapse: collapse;
  font-size: 11px;
  break-inside: avoid;
}

.compact-table {
  font-size: 10.5px;
}

th,
td {
  padding: 5px 6px;
  border: 1px solid #cfcfcf;
  vertical-align: top;
}

th {
  background: #f2f2f2;
  text-align: left;
}

tr,
li,
p,
.notice,
.signatures {
  break-inside: avoid;
}

h2 {
  break-after: avoid;
}

.signatures {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 36px;
  margin-top: 46px;
}

.signatures div {
  display: grid;
  gap: 22px;
  min-height: 130px;
  padding-top: 16px;
  border-top: 1px solid #171717;
}

@media print {
  body {
    background: #ffffff;
  }

  .toolbar {
    display: none;
  }

  .document {
    display: block;
    padding: 0;
  }

  .page {
    width: auto;
    min-height: 0;
    margin: 0;
    padding: 0;
    box-shadow: none;
    break-after: auto;
  }

  .page:last-child {
    break-after: auto;
  }
}
