.worksheet {
  margin-top: 1.5rem;
}

.worksheet-heading {
  align-items: flex-start;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
}

.worksheet-heading h3 {
  margin: 0 0 0.35rem;
}

.worksheet-heading p {
  color: #52606d;
  margin: 0;
}

.worksheet-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
}

.worksheet-controls button {
  background: #1d4f91;
  border: 1px solid #1d4f91;
  border-radius: 0.35rem;
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  padding: 0.45rem 0.75rem;
  white-space: nowrap;
}

.worksheet-controls button:hover,
.worksheet-controls button:focus-visible {
  background: #173f74;
}

.worksheet-controls button[data-worksheet-action="clear"] {
  background: #fff;
  color: #1d4f91;
}

.worksheet-controls button[data-worksheet-action="clear"]:hover,
.worksheet-controls button[data-worksheet-action="clear"]:focus-visible {
  background: #eaf1f8;
}

.worksheet-table-wrap {
  overflow-x: auto;
}

.worksheet-table {
  border-collapse: collapse;
  table-layout: fixed;
  width: 100%;
}

.worksheet-table th,
.worksheet-table td {
  border: 1px solid #9aa5b1;
  padding: 0.35rem;
  vertical-align: top;
}

.worksheet-table thead th {
  background: #eaf1f8;
  text-align: left;
}

.worksheet-table th:first-child {
  width: 30%;
}

.worksheet-table td {
  width: 35%;
}

.worksheet-table tbody th {
  background: #f8fafc;
  font-weight: 400;
}

.worksheet-table textarea {
  background: transparent;
  border: 1px solid transparent;
  box-sizing: border-box;
  display: block;
  font: inherit;
  min-height: 3.75rem;
  padding: 0.35rem;
  resize: vertical;
  width: 100%;
}

.worksheet-table textarea:hover {
  border-color: #bcccdc;
}

.worksheet-table textarea:focus {
  background: #fff;
  border-color: #1d4f91;
  box-shadow: 0 0 0 2px rgb(29 79 145 / 15%);
  outline: 0;
}

.worksheet-print-value {
  display: none;
  min-height: 12mm;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@media (max-width: 720px) {
  .worksheet-heading {
    display: block;
  }

  .worksheet-controls {
    justify-content: flex-start;
    margin-top: 0.75rem;
  }

  .worksheet-table {
    min-width: 720px;
  }
}

@media print {
  @page {
    margin: 7mm;
    size: A4 portrait;
  }

  body.worksheet-print {
    color: #000;
    font: 7.5pt/1.1 system-ui, sans-serif;
    margin: 0;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  body.worksheet-print #quarto-header,
  body.worksheet-print #quarto-sidebar,
  body.worksheet-print #quarto-margin-sidebar,
  body.worksheet-print .nav-footer,
  body.worksheet-print .page-navigation,
  body.worksheet-print main.content > :not(#worksheet):not(:has(#worksheet)),
  body.worksheet-print section:has(#worksheet) > :not(#worksheet):not(:has(#worksheet)) {
    display: none !important;
  }

  body.worksheet-print #quarto-content,
  body.worksheet-print .page-columns {
    display: block !important;
  }

  body.worksheet-print main.content {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  body.worksheet-print .worksheet {
    margin: 0;
  }

  .worksheet-heading {
    display: none !important;
  }

  .worksheet-table-wrap {
    overflow: visible;
  }

  .worksheet-table thead {
    display: table-header-group;
  }

  .worksheet-table tr {
    break-inside: avoid;
  }

  .worksheet-table th,
  .worksheet-table td {
    border-color: #000;
    padding: 0.7mm 1mm;
  }

  /* Sin el fondo ni el relleno del código en línea: con el interlineado
     apretado de la impresión, su caja tapaba el borde de la fila superior. */
  .worksheet-table code {
    padding: 0;
    background: none;
    font-size: 7pt;
    white-space: nowrap;
  }

  body.worksheet-print .worksheet-table textarea {
    display: none;
  }

  body.worksheet-print .worksheet-print-value {
    display: block;
    min-height: 7mm;
    line-height: 1.05;
  }
}
