.voucher-sheet-page {
  padding-bottom: 1rem;
}

.voucher-sheet-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.sheet-command-bar {
  position: sticky;
  top: 0.5rem;
  z-index: 1030;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid #d2dbe5;
  background: linear-gradient(180deg, #fbfcfe 0%, #f2f5f9 100%);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.sheet-command-copy {
  min-width: 0;
}

.sheet-eyebrow {
  margin-bottom: 0.2rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #2b5db7;
}

.sheet-title {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 700;
  color: #12263a;
}

.sheet-subtitle {
  margin: 0.3rem 0 0;
  max-width: 42rem;
  color: #5c6b7a;
  font-size: 0.92rem;
}

.sheet-command-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-content: flex-start;
  justify-content: flex-end;
}

.sheet-meta-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  border: 1px solid #d2dbe5;
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.sheet-meta-grid .span-2 {
  grid-column: span 2;
}

.sheet-meta-grid .span-3 {
  grid-column: span 3;
}

.sheet-meta-grid .span-4 {
  grid-column: span 4;
}

.sheet-meta-grid .span-12 {
  grid-column: span 12;
}

.sheet-field {
  min-height: 96px;
  padding: 0.6rem 0.7rem 0.7rem;
  border-right: 1px solid #e2e8f0;
  border-bottom: 1px solid #e2e8f0;
  background: linear-gradient(180deg, #fcfdff 0%, #f4f7fb 100%);
}

.sheet-field-label,
.sheet-summary-label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #435365;
}

.sheet-field .form-control,
.sheet-field .select2-selection,
.sheet-items-table .form-control,
.sheet-summary-bar .form-control,
.sheet-modal-tools .form-control {
  border-color: #c8d2dd;
  border-radius: 0;
  box-shadow: none;
}

.sheet-field .form-control,
.sheet-items-table .form-control,
.sheet-summary-bar .form-control {
  background: #ffffff;
}

.sheet-field .select2-container--bootstrap4 .select2-selection--single {
  height: calc(2.25rem + 2px);
}

.sheet-field .select2-container--bootstrap4 .select2-selection--single .select2-selection__rendered {
  line-height: calc(2.25rem + 2px);
}

.sheet-field .select2-container--bootstrap4 .select2-selection--single .select2-selection__arrow {
  height: calc(2.25rem + 2px);
}

.sheet-field textarea.form-control,
.sheet-summary-notes .form-control {
  resize: vertical;
}

.sheet-field-note {
  margin-top: 0.35rem;
  min-height: 1rem;
  font-size: 0.76rem;
  color: #68778a;
}

.sheet-helper-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 1rem;
  min-height: 0;
  background: #eef4fa;
}

.sheet-inline-hint {
  font-size: 0.79rem;
  color: #4f6276;
}

.sheet-items-frame {
  border: 1px solid #d2dbe5;
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.sheet-section-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-end;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid #e2e8f0;
  background: #f7fafc;
}

.sheet-section-head h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: #15283b;
}

.sheet-section-head p,
.sheet-section-note {
  margin: 0.2rem 0 0;
  color: #5f7185;
  font-size: 0.83rem;
}

.sheet-table-wrap {
  max-height: calc(100vh - 32rem);
  min-height: 18rem;
  overflow: auto;
}

.sheet-items-table {
  margin-bottom: 0;
  font-variant-numeric: tabular-nums;
}

.sheet-items-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 0.5rem 0.45rem;
  background: #e9f0f7;
  border-color: #d7e0ea;
  color: #405468;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.sheet-items-table td {
  padding: 0.4rem 0.45rem;
  vertical-align: middle;
  border-color: #dee5ef;
  background: #ffffff;
}

.voucher-item-row.is-active td {
  background: #f2f8ff;
}

.voucher-item-row.is-loaded td {
  background: #fbfffd;
}

.sheet-row-number {
  width: 48px;
  text-align: center;
  font-weight: 700;
  color: #52606d;
  background: #f8fafc;
}

.sheet-code-cell {
  min-width: 180px;
}

.sheet-stock-cell {
  min-width: 260px;
}

.sheet-readonly-cell {
  min-width: 90px;
}

.sheet-inline-action {
  display: flex;
  gap: 0.35rem;
  align-items: center;
}

.sheet-inline-action .form-control {
  min-width: 0;
}

.sheet-items-table .btn {
  border-radius: 0;
}

.sheet-items-table .form-control[readonly] {
  background: #f8fafc;
  color: #435365;
}

.sheet-number-cell {
  min-width: 92px;
  text-align: right;
}

.sheet-weight-cell {
  min-width: 145px;
}

.sheet-weight-display {
  display: inline-flex;
  min-width: 118px;
  justify-content: center;
  padding: 0.32rem 0.45rem;
  border: 1px solid #cfd8e3;
  background: #f8fafc;
  color: #324254;
  font-size: 0.82rem;
}

.sheet-line-total-cell {
  min-width: 120px;
}

.line-total-display {
  display: block;
  text-align: right;
  font-weight: 700;
  color: #12395f;
}

.sheet-status-cell {
  min-width: 180px;
}

.row-message {
  display: block;
  line-height: 1.35;
  font-size: 0.78rem;
}

.sheet-row-actions {
  width: 78px;
}

.sheet-summary-bar {
  position: sticky;
  bottom: 0;
  z-index: 1020;
  display: grid;
  grid-template-columns: 2fr 1.7fr 1.2fr 1.1fr;
  border: 1px solid #d2dbe5;
  background: #f8fafc;
  box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.08);
}

.sheet-summary-block {
  min-height: 100%;
  padding: 0.8rem 0.9rem;
  border-right: 1px solid #dde5ee;
}

.sheet-summary-block:last-child {
  border-right: none;
}

.sheet-summary-notes .form-control {
  min-height: 94px;
}

.sheet-summary-guidance p {
  margin: 0 0 0.45rem;
  color: #4f6276;
  font-size: 0.81rem;
}

.sheet-summary-guidance p:last-child {
  margin-bottom: 0;
}

.sheet-summary-guidance code {
  color: #183b63;
  font-size: 0.8rem;
}

.sheet-summary-metrics {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  justify-content: center;
}

.sheet-metric {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: #314252;
}

.sheet-metric strong {
  font-size: 0.98rem;
}

.sheet-metric.total strong {
  color: #0f5132;
  font-size: 1.08rem;
}

.sheet-metric.balance strong {
  color: #8a4f08;
}

.sheet-summary-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  justify-content: center;
}

.sheet-summary-actions .btn {
  border-radius: 0;
}

.sheet-summary-actions-copy {
  font-size: 0.78rem;
  color: #5f7082;
  line-height: 1.4;
}

.sheet-modal-tools {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #e2e8f0;
  background: #f7fafc;
}

.sheet-modal-tools .input-group {
  max-width: 420px;
}

.sheet-modal-summary {
  font-size: 0.8rem;
  color: #5f7185;
}

.sheet-modal-empty {
  padding: 1.25rem;
  text-align: center;
  color: #64748b;
}

.sheet-stock-result-row {
  cursor: pointer;
}

.sheet-stock-result-row:hover td {
  background: #edf5ff;
}

@media (max-width: 1199.98px) {
  .sheet-meta-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .sheet-meta-grid .span-4 {
    grid-column: span 6;
  }

  .sheet-meta-grid .span-12 {
    grid-column: span 6;
  }

  .sheet-summary-bar {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 991.98px) {
  .sheet-command-bar,
  .sheet-summary-bar {
    position: static;
  }

  .sheet-command-bar,
  .sheet-section-head,
  .sheet-modal-tools {
    flex-direction: column;
    align-items: stretch;
  }

  .sheet-command-actions {
    justify-content: flex-start;
  }

  .sheet-meta-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sheet-meta-grid .span-2,
  .sheet-meta-grid .span-3,
  .sheet-meta-grid .span-4,
  .sheet-meta-grid .span-12 {
    grid-column: span 2;
  }

  .sheet-helper-strip {
    display: block;
  }

  .sheet-inline-hint {
    display: block;
    margin-bottom: 0.35rem;
  }

  .sheet-table-wrap {
    max-height: none;
  }

  .sheet-summary-bar {
    grid-template-columns: 1fr;
  }
}
