/* Native66.11: paper controls keep their action rhythm and original business state. */
body#wltProduct480.wlt-desk {
  --desk-pending-ink: #805017;
  --desk-pending-paper: #F8F0E3;
  --desk-pending-line: #D9C7A7;
  --desk-disabled-ink: #68656A;
}
body#wltProduct480.wlt-desk.wlt-dark-product {
  --desk-pending-ink: #F4CD86;
  --desk-pending-paper: #3C3228;
  --desk-pending-line: #786044;
  --desk-disabled-ink: #B2ADA8;
}

/* Focus follows the actual field, without moving the form or its controls. */
body#wltProduct480.wlt-desk :is(#orderForm .v430-field,.query-field):focus-within > span {
  color: var(--desk-accent) !important;
}
body#wltProduct480.wlt-desk .query-field :is(input,select):focus {
  border-color: var(--desk-accent) !important;
  box-shadow: 0 0 0 2px color-mix(in srgb,var(--desk-accent),transparent 84%) !important;
}
body#wltProduct480.wlt-desk :is([id="orderForm"],.query-center,.pro-workspace,.wlt-record-detail) :is(button,input,select,textarea,summary,a):focus-visible {
  outline: 2px solid var(--desk-accent) !important;
  outline-offset: 3px !important;
}
body#wltProduct480.wlt-desk :is(.query-segments,.desk-detail-index) button:focus-visible {
  outline-offset: -3px !important;
}
body#wltProduct480.wlt-desk .query-table tbody tr:focus-within {
  background: var(--desk-field);
  box-shadow: inset 3px 0 0 var(--desk-accent);
}

/* A pending fact stays visibly pending in either theme. Amount colours are unchanged. */
body#wltProduct480.wlt-desk .desk-tag.pending {
  color: var(--desk-pending-ink);
  background: var(--desk-pending-paper);
  border-color: var(--desk-pending-line);
}
body#wltProduct480.wlt-desk .query-pending:not(:empty) {
  color: var(--desk-pending-ink);
  background: var(--desk-pending-paper);
  border-left: 3px solid var(--desk-pending-line);
  border-radius: 0 6px 6px 0;
  padding: 7px 10px;
}

/* Disabled and in-flight controls remain readable; these styles do not enable them. */
body#wltProduct480.wlt-desk :is(#orderForm,.query-center,.pro-workspace,.modal-shell) button:disabled {
  opacity: 1;
  color: var(--desk-disabled-ink) !important;
  background: var(--desk-field) !important;
  border-color: var(--desk-line) !important;
  box-shadow: none !important;
  cursor: not-allowed;
}
body#wltProduct480.wlt-desk :is(#orderForm,.query-center,.modal-shell) button.desk-saving[aria-busy="true"] {
  color: var(--desk-ink) !important;
  border-color: var(--desk-accent) !important;
  box-shadow: inset 0 -3px 0 var(--desk-accent) !important;
}
body#wltProduct480.wlt-desk :is(#orderForm,.modal-shell) button.desk-save-failed {
  border-color: var(--desk-accent) !important;
}

/* Keep the total and both save routes together, rather than shrinking their labels. */
body#wltProduct480.wlt-desk .desk-order-total { min-width: 0; }
body#wltProduct480.wlt-desk .desk-order-total output { overflow-wrap: anywhere; }
body#wltProduct480.wlt-desk .desk-order-tools {
  border-bottom-color: var(--desk-line);
  box-shadow: 0 3px 0 var(--desk-field);
}
body#wltProduct480.wlt-desk #orderForm .ux-section-title:not(:first-child) {
  border-top: 1px solid var(--desk-line) !important;
  padding-top: 15px !important;
}
body#wltProduct480.wlt-desk #orderForm .ux-impact {
  border-left: 3px solid var(--desk-pending-line) !important;
}
@media (max-width: 600px) {
  body#wltProduct480.wlt-desk .desk-order-tools {
    display: grid;
    grid-template-columns: minmax(0,1fr);
    gap: 9px;
    align-items: start;
  }
  body#wltProduct480.wlt-desk .desk-order-save-actions {
    margin-left: 0 !important;
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    width: 100%;
    gap: 8px !important;
  }
  body#wltProduct480.wlt-desk .desk-order-save-actions button {
    min-height: 40px !important;
    font-size: 12px !important;
    padding: 8px 10px !important;
    white-space: normal;
  }
}

/* Modal safe areas follow the viewport; original scrolling and close actions remain. */
@media (max-width: 640px) {
  body#wltProduct480.wlt-desk .modal-shell { padding: 8px !important; }
  body#wltProduct480.wlt-desk .modal-shell .modal-card {
    max-width: 100% !important;
    max-height: calc(100dvh - 16px) !important;
  }
}
@media (max-height: 620px) {
  body#wltProduct480.wlt-desk .modal-shell { padding-top: 8px !important; padding-bottom: 8px !important; }
  body#wltProduct480.wlt-desk .modal-shell .modal-card { max-height: calc(100dvh - 16px) !important; }
  body#wltProduct480.wlt-desk .desk-print-frame { min-height: 180px !important; }
}

@media (prefers-reduced-motion: reduce) {
  body#wltProduct480.wlt-desk :is(#orderForm,.query-center,.pro-workspace,.modal-shell) :is(button,input,select,textarea) {
    transition-duration: 0s !important;
  }
}
html[data-motion="reduced"] body#wltProduct480.wlt-desk :is(#orderForm,.query-center,.pro-workspace,.modal-shell) :is(button,input,select,textarea) {
  transition-duration: 0s !important;
}
