@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/DMSans-Regular.woff2") format("woff2");
}
@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/fonts/DMSans-SemiBold.woff2") format("woff2");
}
@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/fonts/DMSans-Bold.woff2") format("woff2");
}

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

:root {
  --ink: #191b20;
  --muted: #5f5d52;
  --rule: #191b20;
  --cream: #f4efdf;
  --teal: #0d857e;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: #e8e4d6;
  color: var(--ink);
  font-family: "DM Sans", system-ui, "Helvetica Neue", Arial, sans-serif;
  font-size: 10pt;
  line-height: 1.25;
}

.toolbar {
  max-width: 210mm;
  margin: 0 auto;
  padding: 14px 12px 16px;
  font-size: 14px;
  line-height: 1.4;
  background: #f4efdf;
}
.toolbar p { margin: 0 0 10px; }
.toolbar .btn, .toolbar button.btn {
  display: inline-block;
  margin: 0 8px 8px 0;
  background: #0d857e;
  color: #fff;
  border: 0;
  padding: 10px 16px;
  font: 600 15px/1.3 "DM Sans", system-ui, "Helvetica Neue", Arial, sans-serif;
  text-decoration: none;
  cursor: pointer;
  border-radius: 8px;
}
.toolbar .btn-back {
  display: inline-block;
  margin: 0 8px 8px 0;
  background: transparent;
  color: #0d857e;
  border: 1px solid #b8912b;
  padding: 10px 16px;
  font: 600 15px/1.3 "DM Sans", system-ui, "Helvetica Neue", Arial, sans-serif;
  text-decoration: none;
  border-radius: 8px;
}
body.embed .toolbar { display: none; }

.sheet {
  width: 210mm;
  height: 297mm;
  margin: 0 auto 16px;
  padding: 0 10mm 8mm;
  background: #fff;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.accent {
  height: 2.2mm;
  background: var(--teal);
  margin: 0 -10mm 4mm;
  flex: 0 0 2.2mm;
}

.mast {
  margin: 0 0 2.2mm;
  flex: 0 0 auto;
}
.brand {
  margin: 0;
  font-size: 17pt;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--ink);
}
.brand-sub {
  margin: 1.4mm 0 0;
  font-size: 8pt;
  font-weight: 400;
  color: var(--muted);
  line-height: 1.3;
}

.block {
  border: 0.75pt solid var(--rule);
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
}
.block + .block { border-top: 0; }

.cells { display: grid; }

.cell {
  border-right: 0.75pt solid var(--rule);
  border-bottom: 0.75pt solid var(--rule);
  padding: 1.5mm 2.2mm 1.6mm;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}
.cells .cell:last-child { border-right: 0; }
.block > .cells:last-child .cell { border-bottom: 0; }

.lbl {
  display: block;
  font-size: 8pt;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.15;
  margin: 0 0 1mm;
}
.hint {
  display: block;
  font-size: 8pt;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--muted);
  line-height: 1.2;
  margin: -0.2mm 0 0.8mm;
}
.write {
  flex: 1 1 auto;
  min-height: 0;
}

.sec-title {
  margin: 0;
  padding: 1.3mm 2.2mm;
  font-size: 8pt;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--cream);
  border-bottom: 0.75pt solid var(--rule);
  line-height: 1.2;
}

.row-2 { grid-template-columns: 1fr 1fr; }
.row-3 { grid-template-columns: 1.15fr 1.25fr 0.8fr; }
.row-4 { grid-template-columns: 1.35fr 0.85fr 0.85fr 0.85fr; }
.row-meta { grid-template-columns: 1fr 1fr 1.25fr; }

.h-meta { height: 11mm; }
.h-firm { height: 13.5mm; }
.h-line { height: 11mm; }
.h-hint { height: 13.5mm; }
.h-addr { height: 14.5mm; }
.h-work-sm { height: 13.5mm; }
.h-work { height: 16mm; }
.h-follow { height: 16mm; }
.h-sig { height: 21mm; }
.h-checks { height: 13mm; }

.materials { width: 100%; border-collapse: collapse; table-layout: fixed; }
.materials th, .materials td {
  border-right: 0.75pt solid var(--rule);
  border-bottom: 0.75pt solid var(--rule);
  text-align: left;
  vertical-align: top;
  padding: 1.3mm 2.2mm;
}
.materials th:last-child,
.materials td:last-child { border-right: 0; }
.materials tr:last-child td { border-bottom: 0; }
.materials th {
  font-size: 8pt;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  background: #fbf8ee;
  height: 6mm;
  padding-top: 1.3mm;
  padding-bottom: 1.3mm;
}
.materials td { height: 7mm; padding: 0 2.2mm; }
.materials .col-item { width: 58%; }
.materials .col-qty { width: 12%; }
.materials .col-notes { width: 30%; }

.checks {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  height: 13mm;
}
.check {
  display: flex;
  align-items: flex-start;
  gap: 2mm;
  padding: 2.2mm 2.2mm 2.2mm;
  border-right: 0.75pt solid var(--rule);
  border-bottom: 0.75pt solid var(--rule);
  font-size: 9pt;
  line-height: 1.25;
  overflow: hidden;
}
.checks .check:last-child { border-right: 0; }
.tick {
  flex: 0 0 3.6mm;
  width: 3.6mm;
  height: 3.6mm;
  border: 0.75pt solid var(--rule);
  margin-top: 0.5mm;
  background: #fff;
}
.check .txt { min-width: 0; padding-top: 0.15mm; }
.check .count {
  display: block;
  margin-top: 0.8mm;
  font-size: 8pt;
  color: var(--muted);
  line-height: 1.2;
}
.count-line {
  display: inline-block;
  border-bottom: 0.7pt solid var(--rule);
  width: 12mm;
  height: 3.6mm;
  vertical-align: baseline;
  margin-left: 1mm;
}

.sig-space { flex: 1 1 auto; min-height: 8mm; }
.sig-date {
  display: grid;
  grid-template-columns: 11mm 1fr;
  gap: 2mm;
  align-items: end;
  margin-top: 1mm;
}
.sig-date .lbl {
  margin: 0;
  padding-bottom: 0.8mm;
}
.sig-date .write {
  border-bottom: 0.7pt solid var(--rule);
  min-height: 5.5mm;
}

.foot {
  margin-top: auto;
  padding-top: 2mm;
  display: flex;
  justify-content: space-between;
  gap: 4mm;
  font-size: 8pt;
  color: var(--muted);
  line-height: 1.3;
  flex: 0 0 auto;
}

.group { margin-top: 1.8mm; }

@media screen {
  body.embed {
    background: #fff;
  }
  body.embed .sheet-scale,
  body.embed .sheet {
    margin: 0;
    box-shadow: none;
  }
  .sheet-scale {
    width: min(210mm, calc(100% - 1.5rem));
    margin: 0 auto 20px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 1px 2px rgba(60, 50, 10, 0.08), 0 8px 24px rgba(60, 50, 10, 0.08);
    height: calc(297mm * (min(210mm, 100vw - 1.5rem) / 210mm));
  }
  .sheet-scale .sheet {
    width: 210mm;
    height: 297mm;
    margin: 0;
    transform-origin: top left;
    transform: scale(calc((min(210mm, 100vw - 1.5rem)) / 210mm));
  }
}

@media print {
  html, body { background: #fff; }
  .toolbar { display: none !important; }
  .sheet-scale, .sheet-scale .sheet {
    transform: none !important;
    width: 210mm;
    height: 297mm;
    overflow: hidden;
    margin: 0;
    box-shadow: none;
  }
  .sheet { box-shadow: none; }
}
