:root {
  --bg-deep: #0e1114;
  --bg-sheet: #161a1f;
  --bg-sheet-2: #1c2229;
  --ink: #e8eaed;
  --ink-muted: #9aa3ad;
  --line: #8b949e;
  --accent: #c5a572;
  --box-bg: #0a0c0e;
  --sheet-w: 210mm;
  --sheet-h: 297mm;
  /* Fixed label width so every colon sits on one vertical line */
  --num-w: 7mm;
  --label-w: 72mm;
  --colon-w: 4mm;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Source Sans 3", "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg-deep);
  min-height: 100vh;
  padding: 24px 16px 48px;
}

.toolbar {
  max-width: var(--sheet-w);
  margin: 0 auto 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
}

.btn {
  appearance: none;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  font: 600 14px/1 "Source Sans 3", sans-serif;
  padding: 10px 18px;
  border-radius: 4px;
  cursor: pointer;
  letter-spacing: 0.02em;
}

.btn:hover {
  background: var(--accent);
  color: #111;
}

.hint {
  font-size: 13px;
  color: var(--ink-muted);
}

.hint strong {
  color: var(--ink);
}

/* —— A4 sheet —— */
.sheet {
  width: var(--sheet-w);
  height: var(--sheet-h);
  margin: 0 auto;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(197, 165, 114, 0.06), transparent 45%),
    linear-gradient(165deg, var(--bg-sheet) 0%, var(--bg-sheet-2) 100%);
  position: relative;
  overflow: hidden;
  padding: 10mm 14mm 10mm 12mm;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  color: var(--ink);
}

/* Header */
.header {
  display: grid;
  grid-template-columns: 30mm 1fr 28mm;
  gap: 4mm;
  align-items: start;
  margin-bottom: 5mm;
}

.brand {
  display: flex;
  align-items: flex-start;
}

.logo {
  width: 28mm;
  height: 28mm;
  object-fit: contain;
  display: block;
  background: #000;
}

.titles {
  text-align: center;
  padding-top: 3mm;
}

.titles h1 {
  font-family: "Source Sans 3", sans-serif;
  font-size: 14pt;
  font-weight: 700;
  color: #f2f4f6;
  letter-spacing: 0.04em;
  line-height: 1.15;
}

.titles h2 {
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 12pt;
  font-weight: 700;
  color: var(--accent);
  margin-top: 1.5mm;
  letter-spacing: 0.08em;
}

.photo-box {
  width: 28mm;
  height: 34mm;
  border: 1px solid var(--line);
  background: var(--box-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 7pt;
  color: var(--ink-muted);
  line-height: 1.25;
  justify-self: end;
}

/* Fields — identical columns on every row so colons align */
.fields {
  list-style: none;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2.5mm;
  font-size: 9pt;
}

.row {
  display: grid;
  grid-template-columns: var(--num-w) var(--label-w) var(--colon-w) 1fr;
  align-items: end;
  column-gap: 2mm;
}

.row-wrap,
.row-multi,
.row-address,
.row-refs,
.row-project,
.row-payment,
.row-checks {
  align-items: start;
}

.row-wrap .label,
.row-multi .label,
.row-refs .label,
.row-project .label,
.row-address .label,
.row-payment .label,
.row-checks .label {
  padding-top: 0.4mm;
}

.row-wrap .colon,
.row-multi .colon,
.row-refs .colon,
.row-project .colon,
.row-address .colon,
.row-payment .colon,
.row-checks .colon {
  align-self: start;
  padding-top: 0.4mm;
}

.num {
  font-weight: 600;
  text-align: left;
  color: var(--ink);
}

.label {
  font-weight: 400;
  line-height: 1.3;
  color: var(--ink);
}

.label-wide {
  font-size: 8pt;
  line-height: 1.25;
}

.colon {
  text-align: center;
  font-weight: 700;
  color: var(--ink);
  line-height: 1;
}

.input {
  min-width: 0;
}

.line {
  display: block;
  border-bottom: 0.7pt solid var(--line);
  height: 4.2mm;
  min-height: 4.2mm;
}

.line.flex {
  flex: 1;
  min-width: 8mm;
}

.line.short {
  width: 26mm;
  flex: 0 0 26mm;
  display: inline-block;
}

.inline-fields,
.checks-line,
.tel-fields,
.project-line,
.sub-row,
.pay-opt,
.yes-box,
.meta {
  display: flex;
  align-items: flex-end;
  gap: 2mm;
  width: 100%;
}

.prefix,
.suffix,
.fixed,
.sub-label {
  white-space: nowrap;
  font-size: 9pt;
  padding-bottom: 0.4mm;
  color: var(--ink);
}

.sub-label {
  min-width: 22mm;
  font-weight: 600;
}

.multi-lines {
  display: flex;
  flex-direction: column;
  gap: 2.8mm;
  width: 100%;
}

.address-block,
.project-block,
.payment-block {
  display: flex;
  flex-direction: column;
  gap: 2.4mm;
  width: 100%;
}

.checks-line {
  gap: 3mm;
}

.check-group {
  display: flex;
  align-items: center;
  gap: 1.5mm;
  white-space: nowrap;
  font-size: 8pt;
  padding-bottom: 0.5mm;
  flex-shrink: 0;
  color: var(--ink);
}

.box {
  width: 3.2mm;
  height: 3.2mm;
  border: 0.7pt solid var(--line);
  display: inline-block;
  background: transparent;
  flex-shrink: 0;
}

.tel-fields {
  gap: 3mm;
}

.tel {
  display: flex;
  align-items: flex-end;
  gap: 1.5mm;
  flex: 1;
  min-width: 0;
}

.project-line {
  gap: 2mm;
}

.project-meta {
  flex-wrap: nowrap;
  gap: 2.5mm;
}

.meta {
  flex: 1;
  min-width: 0;
  gap: 1.2mm;
}

.meta .fixed {
  font-size: 8pt;
}

.pay-opt {
  justify-content: space-between;
  gap: 4mm;
}

.pay-label {
  font-size: 9pt;
}

.yes-box {
  gap: 2mm;
  align-items: center;
  flex-shrink: 0;
  padding-bottom: 0;
}

.yes-box .box {
  width: 4mm;
  height: 4mm;
}

@media screen and (max-width: 860px) {
  body {
    padding: 12px 0 32px;
  }

  .sheet {
    transform-origin: top center;
    transform: scale(0.92);
  }
}

@media screen and (max-width: 720px) {
  .sheet {
    transform: scale(0.72);
    margin-bottom: -80px;
  }

  .toolbar {
    padding: 0 12px;
  }
}

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

@media print {
  body {
    background: none;
    padding: 0;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .no-print {
    display: none !important;
  }

  .sheet {
    width: 210mm;
    height: 297mm;
    margin: 0;
    box-shadow: none;
    page-break-after: always;
    break-after: page;
  }
}
