.spire-representation-worksheet {
  display: none;
}

@media print {
  @page representation-worksheet {
    size: A4 landscape;
    margin: 8mm;
  }

  html[data-spire-print-page="a4-landscape"] body[data-spire-print-mode="representation-worksheet"] {
    page: representation-worksheet;
    width: 281mm !important;
    height: 194mm !important;
    min-height: 0 !important;
    max-height: 194mm !important;
    margin: 0 !important;
    overflow: hidden !important;
    color: #102131;
    background: #ffffff !important;
    font-family: Arial, Helvetica, sans-serif;
  }

  body[data-spire-print-mode="representation-worksheet"] > :not(.spire-representation-worksheet) {
    display: none !important;
  }

  body[data-spire-print-mode="representation-worksheet"] > .spire-representation-worksheet {
    box-sizing: border-box;
    width: 281mm !important;
    height: 194mm !important;
    min-height: 0 !important;
    max-height: 194mm !important;
    display: grid !important;
    grid-template-rows: 15mm 13mm minmax(0, 1fr) 5mm;
    gap: 2.5mm;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    color: #102131;
    background: #ffffff;
    break-inside: avoid-page;
    page-break-inside: avoid;
  }

  body[data-spire-print-mode="representation-worksheet"] > .spire-representation-worksheet[data-layout="fact-family"] {
    grid-template-rows: 15mm 19mm minmax(0, 1fr) 5mm;
  }

  .spire-representation-worksheet__header {
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8mm;
    padding-bottom: 2mm;
  }

  .spire-representation-worksheet__logo {
    width: 38mm;
    height: auto;
    display: block;
    object-fit: contain;
  }

  .spire-representation-worksheet__header h2 {
    margin: 0;
    color: #102131;
    font-size: 18pt;
    line-height: 1;
    text-align: right;
  }

  .spire-representation-worksheet__fact {
    min-width: 0;
    display: flex;
    align-items: flex-end;
    gap: 3mm;
    margin: 0;
    padding: 0 1mm 1.5mm;
    font-size: 14pt;
    font-weight: 800;
  }

  .spire-representation-worksheet__fact-line {
    min-width: 0;
    height: 1.15em;
    flex: 1 1 auto;
    border-bottom: 0.45mm solid #102131;
  }

  .spire-representation-worksheet__grid {
    min-width: 0;
    min-height: 0;
    display: grid;
    gap: 3mm;
  }

  .spire-fact-family-worksheet__relationship {
    min-width: 0;
    min-height: 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5mm;
  }

  .spire-fact-family-worksheet__field {
    min-width: 0;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: end;
    gap: 2.5mm;
    padding: 1mm 1.5mm 2mm;
  }

  .spire-fact-family-worksheet__field-label {
    font-size: 12pt;
    font-weight: 800;
    white-space: nowrap;
  }

  .spire-fact-family-worksheet__field-line {
    min-width: 0;
    height: 1.2em;
    border-bottom: 0.45mm solid #102131;
  }

  .spire-fact-family-worksheet__grid {
    min-width: 0;
    min-height: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: 3mm;
  }

  .spire-representation-worksheet[data-layout="addition-subtraction"] .spire-representation-worksheet__grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-rows: minmax(0, 1fr) minmax(0, 0.82fr);
  }

  .spire-representation-worksheet[data-layout="addition-subtraction"] .spire-representation-worksheet__card:last-child {
    grid-column: 1 / -1;
  }

  .spire-representation-worksheet[data-layout="multiplication-division"] .spire-representation-worksheet__grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
  }

  .spire-representation-worksheet__card {
    min-width: 0;
    min-height: 0;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    align-content: stretch;
    border: 0.4mm solid #8094a3;
    border-radius: 2mm;
    padding: 2.5mm;
    overflow: hidden;
    break-inside: avoid;
  }

  .spire-representation-worksheet__card h3 {
    margin: 0;
    color: #102131;
    font-size: 11pt;
    line-height: 1.08;
  }

  .spire-representation-worksheet__description {
    margin: 1mm 0 1.5mm;
    color: #405464;
    font-size: 8.5pt;
    font-weight: 700;
    line-height: 1.15;
  }

  .spire-representation-worksheet__drawing-area {
    min-width: 0;
    min-height: 0;
    border-top: 0.25mm solid #d3dde4;
  }

  .spire-fact-family-worksheet__card {
    grid-template-rows: auto auto 12mm minmax(0, 1fr);
  }

  .spire-fact-family-worksheet__equation {
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 2.5mm;
    margin-bottom: 1.5mm;
  }

  .spire-fact-family-worksheet__number-box {
    min-width: 0;
    height: 10mm;
    border: 0.4mm solid #102131;
    border-radius: 1.5mm;
    background: #ffffff;
  }

  .spire-fact-family-worksheet__operator {
    font-size: 15pt;
    font-weight: 900;
    line-height: 1;
  }

  .spire-representation-worksheet__copyright {
    margin: 0;
    color: #000000;
    font-size: 8.5pt;
    font-weight: 700;
    line-height: 1;
    text-align: right;
  }
}
