<style>
  * { box-sizing: border-box; }
  @page { size: A4; margin: 18mm 14mm; }

  body {
    margin: 0;
    background: #f3f8f5;
    color: #16241d;
    font-family: "Times New Roman", Times, serif;
    font-size: 10.5pt;
    line-height: 1.5;
  }

  .contract {
    width: 210mm;
    min-height: 297mm;
    margin: 0 auto;
    background: #fff;
    padding: 18mm 15mm;
  }

  h1, h2, h3, p { margin-top: 0; }
  h1 {
    color: #0a3d2e;
    font-size: 17pt;
    letter-spacing: 0.02em;
    line-height: 1.3;
    margin-bottom: 10px;
    text-align: center;
    text-transform: uppercase;
  }
  h2 {
    border-bottom: 1.5px solid #1b9e7a;
    color: #0e5b45;
    font-family: Arial, sans-serif;
    font-size: 11.5pt;
    letter-spacing: 0.04em;
    margin: 20px 0 10px;
    padding-bottom: 5px;
    text-transform: uppercase;
  }
  h3 {
    color: #0a3d2e;
    font-family: Arial, sans-serif;
    font-size: 10.5pt;
    margin: 12px 0 6px;
  }
  p { margin-bottom: 8px; }
  ol { margin: 6px 0 0; padding-left: 20px; }
  li { margin-bottom: 5px; }

  .page-section,
  .article {
    margin-bottom: 18px;
    page-break-inside: avoid;
  }

  /* ── Brand header ─────────────────────────────────────────────────────── */
  .brand-row {
    align-items: center;
    border-bottom: 3px double #1b9e7a;
    display: flex;
    gap: 14px;
    padding-bottom: 14px;
  }
  .logo-mark {
    align-items: center;
    background: linear-gradient(135deg, #0e5b45 0%, #1b9e7a 100%);
    border-radius: 8px;
    color: #fff;
    display: flex;
    font-family: Arial, sans-serif;
    font-size: 16pt;
    font-weight: 700;
    height: 52px;
    justify-content: center;
    letter-spacing: 0.08em;
    width: 72px;
  }
  .kicker {
    color: #0e5b45;
    font-family: Arial, sans-serif;
    font-size: 10pt;
    font-weight: 700;
    letter-spacing: 0.04em;
    margin-bottom: 2px;
    text-transform: uppercase;
  }
  .muted {
    color: #5c6f66;
    font-family: Arial, sans-serif;
    font-size: 9pt;
    margin: 0;
  }
  .muted-note {
    color: #5c6f66;
    font-size: 9.5pt;
  }

  /* ── Cover page ───────────────────────────────────────────────────────── */
  .cover {
    display: flex;
    flex-direction: column;
    min-height: 255mm;
    position: relative;
  }
  .cover-title {
    margin: 34mm 0 22mm;
    text-align: center;
  }
  .cover-rule {
    background: #1b9e7a;
    height: 2px;
    margin: 14px auto;
    width: 46mm;
  }
  .document-label {
    color: #1b9e7a;
    font-family: Arial, sans-serif;
    font-size: 11pt;
    font-weight: 700;
    letter-spacing: 0.18em;
    margin-bottom: 6px;
    text-transform: uppercase;
  }
  .cover-for,
  .cover-between {
    color: #5c6f66;
    font-family: Arial, sans-serif;
    font-size: 9.5pt;
    font-style: italic;
    margin: 10px 0 6px;
  }
  .cover-party {
    color: #0a3d2e;
    font-family: Arial, sans-serif;
    font-size: 12pt;
    font-weight: 700;
    margin: 4px 0;
  }
  .summary-line {
    color: #38493f;
    font-family: Arial, sans-serif;
    font-size: 9.5pt;
    margin-top: 12px;
  }
  .cover-year {
    color: #0e5b45;
    font-family: Arial, sans-serif;
    font-size: 13pt;
    font-weight: 700;
    letter-spacing: 0.1em;
    margin-top: auto;
    text-align: right;
  }

  /* ── Tables ───────────────────────────────────────────────────────────── */
  table {
    border-collapse: collapse;
    width: 100%;
  }
  .meta-grid,
  .details-table,
  .schedule {
    font-size: 9.5pt;
    margin: 10px 0 16px;
  }
  .meta-grid th,
  .meta-grid td,
  .details-table th,
  .details-table td,
  .schedule th,
  .schedule td {
    border: 1px solid #c9e4d9;
    padding: 7px 8px;
    text-align: left;
    vertical-align: top;
  }
  .meta-grid th,
  .details-table th,
  .schedule th {
    background: #e9f6f0;
    color: #0e5b45;
    font-family: Arial, sans-serif;
    font-size: 8.5pt;
    text-transform: uppercase;
  }
  .schedule tbody tr:nth-child(even) td { background: #f5faf8; }
  .total-row td {
    background: #ddf2e9 !important;
    color: #0a3d2e;
    font-weight: 700;
  }

  /* ── Parties ──────────────────────────────────────────────────────────── */
  .lead {
    color: #38493f;
    font-size: 10.5pt;
  }
  .between-label {
    color: #0e5b45;
    font-family: Arial, sans-serif;
    font-size: 9.5pt;
    font-weight: 700;
    letter-spacing: 0.08em;
    margin: 10px 0 4px;
    text-transform: uppercase;
  }
  .party-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: 1fr 1fr;
    margin-top: 12px;
  }
  .party-card {
    border: 1px solid #c9e4d9;
    border-radius: 8px;
    padding: 12px;
  }
  .party-card h3 {
    background: #0e5b45;
    border-radius: 5px;
    color: #fff;
    font-family: Arial, sans-serif;
    font-size: 9pt;
    margin: 0 0 10px;
    padding: 7px 9px;
    text-transform: uppercase;
  }
  .party-name {
    color: #0a3d2e;
    font-weight: 700;
    margin-bottom: 8px;
  }
  dl {
    display: grid;
    grid-template-columns: 32% 68%;
    margin: 0;
  }
  dt {
    color: #47594f;
    font-family: Arial, sans-serif;
    font-size: 8.5pt;
    font-weight: 700;
    padding: 2px 6px 2px 0;
  }
  dd {
    margin: 0;
    padding: 2px 0;
  }

  /* ── Recitals ─────────────────────────────────────────────────────────── */
  .whereas-label {
    color: #0e5b45;
    font-family: Arial, sans-serif;
    font-size: 9pt;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }
  .now-therefore {
    color: #0a3d2e;
    font-weight: 700;
    margin-top: 10px;
  }

  /* ── Dynamic articles ─────────────────────────────────────────────────── */
  .article-heading {
    align-items: baseline;
    display: flex;
    gap: 10px;
  }
  .article-no {
    color: #1b9e7a;
    font-family: Arial, sans-serif;
    font-size: 9.5pt;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
  }
  .article-name { color: #0e5b45; }
  .article-paragraph { margin: 4px 0 0; }
  ol.clauses {
    list-style: none;
    margin: 6px 0 0;
    padding-left: 0;
  }
  ol.clauses > li.clause {
    margin-bottom: 6px;
    text-align: justify;
  }
  ol.clauses .clause-no {
    color: #0e5b45;
    font-family: Arial, sans-serif;
    font-size: 9.5pt;
    font-weight: 700;
    margin-right: 6px;
  }
  /* Sub-clause indentation: each outline level steps in. */
  ol.clauses > li.depth-2 { padding-left: 20px; }
  ol.clauses > li.depth-3 { padding-left: 40px; }
  ol.clauses > li.depth-4 { padding-left: 60px; }
  ol.clauses > li.depth-5 { padding-left: 80px; }
  ol.clauses > li.depth-6 { padding-left: 100px; }
  ul.clause-bullets {
    margin: 5px 0 2px;
    padding-left: 16px;
  }
  ul.clause-bullets > li {
    list-style: none;
    margin-bottom: 3px;
    padding-left: 12px;
    position: relative;
  }
  ul.clause-bullets > li::before {
    color: #1b9e7a;
    content: "▪";
    font-size: 8pt;
    left: 0;
    position: absolute;
    top: 1px;
  }

  /* ── Signatures ───────────────────────────────────────────────────────── */
  .signatures {
    display: grid;
    gap: 18px;
    grid-template-columns: 1fr 1fr;
    margin-top: 24px;
    page-break-inside: avoid;
  }
  .sig-block {
    border: 1.5px solid #1b9e7a;
    border-radius: 8px;
    min-height: 96mm;
    padding: 12px;
  }
  .sig-title {
    color: #0e5b45;
    font-family: Arial, sans-serif;
    font-size: 9pt;
    font-weight: 700;
    margin-bottom: 10px;
    text-transform: uppercase;
  }
  .sig-image-box {
    align-items: center;
    border: 1px dashed #7fbfa9;
    display: flex;
    height: 28mm;
    justify-content: center;
    margin: 14px 0;
  }
  .sig-image-box img {
    display: block;
    max-height: 24mm;
    max-width: 70mm;
  }
  .sig-placeholder {
    color: #7fbfa9;
    font-family: Arial, sans-serif;
    font-size: 8.5pt;
  }
  .sig-line {
    border-top: 1px solid #16241d;
    margin-top: 16px;
    padding-top: 5px;
  }
  .sig-meta {
    color: #47594f;
    font-size: 9pt;
    margin: 4px 0;
  }
  .sig-stamp {
    margin-top: 12px;
  }
  .sig-stamp-label {
    color: #0e5b45;
    font-family: Arial, sans-serif;
    font-size: 7.5pt;
    font-weight: 700;
    letter-spacing: 0.4pt;
    text-transform: uppercase;
  }
  .sig-stamp-box {
    align-items: center;
    display: flex;
    height: 30mm;
    justify-content: center;
    margin-top: 5px;
  }
  .sig-stamp-box img {
    display: block;
    max-height: 30mm;
    max-width: 45mm;
    mix-blend-mode: multiply;
  }

  @media print {
    body { background: #fff; }
    .contract {
      margin: 0;
      padding: 0;
      width: auto;
    }
    .cover { page-break-after: always; }
  }
</style>
