/* The enterprise company logo is intentionally visible only on printed output. */
.legacy-print-company-logo {
  display: none !important;
}

.legacy-invoice-head-grid {
  margin-top: 0 !important;
}

/* Keep totals physically on the left and notes on the right in RTL screens. */
.legacy-document-bottom {
  direction: ltr;
}

.legacy-document-bottom > * {
  direction: rtl;
}

.legacy-commercial-nav-source {
  display: none !important;
}

.legacy-sales-ribbon-menu {
  position: relative;
  z-index: 1600;
}

.legacy-sales-icon {
  font-size: 27px;
  line-height: 1;
}

.legacy-sales-caret {
  font-size: 14px;
}

.legacy-sales-submenu {
  z-index: 5000 !important;
  min-width: 285px !important;
}

.legacy-sales-submenu a {
  display: grid !important;
  gap: 3px;
  padding: 9px 12px !important;
  text-decoration: none;
}

.legacy-sales-submenu a small {
  color: #62727c;
  font-size: 10px;
}

.legacy-lines select[data-line="unit"] {
  width: 100%;
  min-width: 0;
  height: 34px;
  border: 1px solid #9aa7ad;
  background: #fff;
  padding: 4px;
  text-align: center;
  font-weight: 700;
}

/* Invoice workspace: one clean cell border and scrolling limited to line items. */
@media screen {
  .legacy-document-screen {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 185px);
    min-height: 520px;
    overflow: hidden;
  }

  .legacy-document-toolbar {
    flex: 0 0 auto;
  }

  .legacy-invoice-paper {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
  }

  .legacy-invoice-header,
  .legacy-invoice-meta,
  .legacy-add-line,
  .legacy-document-bottom {
    flex: 0 0 auto;
  }

  .legacy-lines-wrap {
    flex: 1 1 auto;
    min-height: 150px;
    overflow: auto;
    scrollbar-gutter: stable;
    background: #fff;
  }

  .legacy-lines thead th {
    position: sticky;
    top: 0;
    z-index: 4;
    box-shadow: inset 0 -1px #505a61;
  }

  .legacy-lines td {
    height: 58px;
    padding: 0 5px;
    background: #fff;
  }

  .legacy-lines tbody tr:nth-child(even) td {
    background: #fbfcfc;
  }

  .legacy-lines input,
  .legacy-lines textarea,
  .legacy-lines select[data-line="unit"],
  .legacy-lines output {
    width: 100%;
    min-width: 0;
    min-height: 54px;
    margin: 0;
    padding: 6px;
    border: 0 !important;
    border-radius: 0 !important;
    outline: 0;
    background: transparent !important;
    box-shadow: none !important;
  }

  .legacy-lines textarea {
    display: block;
    height: auto;
    resize: none;
    overflow: hidden;
    line-height: 1.45;
  }

  .legacy-lines input:focus,
  .legacy-lines textarea:focus,
  .legacy-lines select:focus {
    background: #edfafa !important;
    box-shadow: inset 0 0 0 2px #20a9bd !important;
  }

  .legacy-line-description {
    min-height: 54px;
    align-items: stretch;
  }

  .legacy-line-tools {
    align-content: center;
  }
}

.legacy-item-field-code { order: 1; }
.legacy-item-field-name { order: 2; }
.legacy-item-field-group { order: 3; }
.legacy-item-field-price { order: 4; }
.legacy-item-field-unit { order: 5; }
.legacy-item-field-active { order: 6; }

@media print {
  .legacy-lines select[data-line="unit"] {
    appearance: none !important;
    border: 0 !important;
    background: transparent !important;
    padding: 0 !important;
  }
}

@media print {
  .legacy-print-company-logo:not([hidden]) {
    display: block !important;
    width: 100% !important;
    max-height: 24mm !important;
    object-fit: contain !important;
    margin: 0 0 2mm !important;
  }
}

.legacy-picker-selection-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 9px;
  padding: 7px 10px;
  border: 1px solid #aebbc2;
  background: #eef6f8;
}

.legacy-picker-selection-bar label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 800;
}

.legacy-picker-selection-bar input,
.legacy-picker-table input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #0a789e;
}

.legacy-picker-table tr.selected {
  background: #d8f1f8;
}

.legacy-picker-actions {
  display: flex;
  justify-content: center !important;
  flex-wrap: wrap;
  gap: 8px;
}

.legacy-picker-actions button {
  min-width: 150px !important;
}

.legacy-picker-actions .primary {
  color: #fff;
  background: #086b94;
}

.legacy-picker-actions button:disabled {
  cursor: not-allowed;
  opacity: .5;
}
