/* Beauty Foam — unified sales module UI. Presentation only; no workflow rules. */

:root {
  --sales-ink: #142f43;
  --sales-muted: #526b7c;
  --sales-line: #a9bbc8;
  --sales-line-strong: #7892a5;
  --sales-soft: #eef4f8;
  --sales-hover: #f2f8fc;
  --sales-blue: #176795;
  --sales-green: #148160;
  --sales-radius: 5px;
}

/* ---------- Sales pages ---------- */
.app-shell :is(
  #orders-view,
  #order-details-view,
  #customers-view,
  #customer-forms-view,
  #quotations-view,
  #preparation-work-view,
  #preparation-completed-view,
  #deliveries-view,
  #reports-view,
  #returns-view,
  #sales-invoices-view
) {
  padding: 3px 6px 12px !important;
  color: var(--sales-ink) !important;
}

.app-shell :is(
  #orders-view,
  #order-details-view,
  #customers-view,
  #customer-forms-view,
  #quotations-view,
  #preparation-work-view,
  #preparation-completed-view,
  #deliveries-view,
  #reports-view,
  #returns-view,
  #sales-invoices-view
) > .page-heading,
.app-shell #order-details-view > .document-header {
  height: 31px !important;
  min-height: 31px !important;
  max-height: 31px !important;
  margin: 0 0 4px !important;
  padding: 2px 3px !important;
  border-bottom: 1px solid var(--sales-line-strong) !important;
  background: #fff !important;
  overflow: visible !important;
}

.app-shell :is(
  #orders-view,
  #order-details-view,
  #customers-view,
  #customer-forms-view,
  #quotations-view,
  #preparation-work-view,
  #preparation-completed-view,
  #deliveries-view,
  #reports-view,
  #returns-view,
  #sales-invoices-view
) :is(.page-heading, .document-header) .eyebrow,
.app-shell :is(
  #orders-view,
  #order-details-view,
  #customers-view,
  #customer-forms-view,
  #quotations-view,
  #preparation-work-view,
  #preparation-completed-view,
  #deliveries-view,
  #reports-view,
  #returns-view,
  #sales-invoices-view
) > .page-heading p {
  display: none !important;
}

.app-shell :is(
  #orders-view,
  #order-details-view,
  #customers-view,
  #customer-forms-view,
  #quotations-view,
  #preparation-work-view,
  #preparation-completed-view,
  #deliveries-view,
  #reports-view,
  #returns-view,
  #sales-invoices-view
) :is(.page-heading h1, .document-title h1) {
  margin: 0 !important;
  font-size: 13px !important;
  font-weight: 900 !important;
  line-height: 1 !important;
  color: var(--sales-ink) !important;
}

/* Unified compact action language. */
.app-shell :is(
  #orders-view,
  #order-details-view,
  #customers-view,
  #customer-forms-view,
  #quotations-view,
  #preparation-work-view,
  #preparation-completed-view,
  #deliveries-view,
  #reports-view,
  #returns-view,
  #sales-invoices-view
) :is(.button, .small-action, .doc-action) {
  height: 25px !important;
  min-height: 25px !important;
  min-width: 0 !important;
  padding: 0 8px !important;
  border: 1px solid #91a8b8 !important;
  border-radius: 4px !important;
  box-shadow: none !important;
  font-size: 9px !important;
  font-weight: 900 !important;
  line-height: 1 !important;
  white-space: nowrap !important;
}
.app-shell :is(
  #orders-view,
  #order-details-view,
  #customers-view,
  #customer-forms-view,
  #quotations-view,
  #preparation-work-view,
  #preparation-completed-view,
  #deliveries-view,
  #reports-view,
  #returns-view,
  #sales-invoices-view
) :is(.button.primary, .small-action.primary, .doc-action.print) {
  background: var(--sales-blue) !important;
  border-color: var(--sales-blue) !important;
  color: #fff !important;
}
.app-shell :is(
  #orders-view,
  #order-details-view,
  #customers-view,
  #customer-forms-view,
  #quotations-view,
  #preparation-work-view,
  #preparation-completed-view,
  #deliveries-view,
  #reports-view,
  #returns-view,
  #sales-invoices-view
) :is(.button.success, .small-action.success) {
  background: var(--sales-green) !important;
  border-color: var(--sales-green) !important;
  color: #fff !important;
}
.app-shell :is(
  #orders-view,
  #order-details-view,
  #customers-view,
  #customer-forms-view,
  #quotations-view,
  #preparation-work-view,
  #preparation-completed-view,
  #deliveries-view,
  #reports-view,
  #returns-view,
  #sales-invoices-view
) :is(.button.danger, .small-action.danger) {
  background: #fff5f5 !important;
  border-color: #d6a5aa !important;
  color: #9b2f3b !important;
}

/* Inner sales navigation and actions share one bar. */
.app-shell :is(#orders-view, #preparation-work-view, #deliveries-view) .sales-orders-command-bar {
  display: flex !important;
  align-items: center !important;
  gap: 2px !important;
  height: 31px !important;
  min-height: 31px !important;
  margin: 0 0 4px !important;
  padding: 2px !important;
  border: 1px solid var(--sales-line) !important;
  border-radius: var(--sales-radius) !important;
  background: var(--sales-soft) !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
}
.app-shell :is(#orders-view, #preparation-work-view, #deliveries-view) .sales-orders-command-bar > button {
  height: 25px !important;
  min-height: 25px !important;
  padding: 0 10px !important;
  border-radius: 4px !important;
  font-size: 9.5px !important;
  font-weight: 900 !important;
}
.app-shell :is(#orders-view, #preparation-work-view, #deliveries-view) .sales-cycle-actions {
  display: flex !important;
  align-items: center !important;
  gap: 3px !important;
  margin-right: auto !important;
  margin-left: 0 !important;
}

/* Cards, toolbars, searches and filters. */
.app-shell :is(
  #orders-view,
  #order-details-view,
  #customers-view,
  #customer-forms-view,
  #quotations-view,
  #preparation-work-view,
  #preparation-completed-view,
  #deliveries-view,
  #reports-view,
  #returns-view,
  #sales-invoices-view
) .content-card {
  border: 1px solid var(--sales-line) !important;
  border-radius: var(--sales-radius) !important;
  background: #fff !important;
  box-shadow: none !important;
  overflow: hidden !important;
}
.app-shell :is(
  #orders-view,
  #order-details-view,
  #customers-view,
  #customer-forms-view,
  #quotations-view,
  #preparation-work-view,
  #preparation-completed-view,
  #deliveries-view,
  #reports-view,
  #returns-view,
  #sales-invoices-view
) .card-toolbar {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 5px !important;
  min-height: 32px !important;
  height: auto !important;
  padding: 3px 5px !important;
  border-bottom: 1px solid #d5e0e7 !important;
  background: #fff !important;
}
.app-shell :is(
  #orders-view,
  #order-details-view,
  #customers-view,
  #customer-forms-view,
  #quotations-view,
  #preparation-work-view,
  #preparation-completed-view,
  #deliveries-view,
  #reports-view,
  #returns-view,
  #sales-invoices-view
) .card-toolbar h2 {
  margin: 0 !important;
  font-size: 12px !important;
  font-weight: 900 !important;
  line-height: 1.1 !important;
  color: var(--sales-ink) !important;
}
.app-shell :is(
  #orders-view,
  #order-details-view,
  #customers-view,
  #customer-forms-view,
  #quotations-view,
  #preparation-work-view,
  #preparation-completed-view,
  #deliveries-view,
  #reports-view,
  #returns-view,
  #sales-invoices-view
) .card-toolbar p {
  display: none !important;
}
.app-shell :is(
  #orders-view,
  #customers-view,
  #reports-view
) :is(.table-search, .compact-field, .report-customer-filter) {
  min-width: 0 !important;
  height: 27px !important;
  min-height: 27px !important;
  margin: 0 !important;
  border: 1px solid var(--sales-line) !important;
  border-radius: 4px !important;
  background: #fff !important;
}
.app-shell :is(#orders-view, #customers-view) .table-search {
  width: min(290px, 38vw) !important;
}
.app-shell :is(#orders-view, #customers-view, #reports-view) :is(.table-search input, .compact-field input, .compact-field select) {
  height: 25px !important;
  min-height: 25px !important;
  padding: 2px 6px !important;
  border: 0 !important;
  font-size: 9.5px !important;
  color: var(--sales-ink) !important;
}
.app-shell :is(#orders-view, #customers-view) .toolbar-actions {
  display: flex !important;
  align-items: center !important;
  gap: 3px !important;
  margin-right: auto !important;
}

/* Dense readable registers. */
.app-shell :is(
  #orders-view,
  #order-details-view,
  #customers-view,
  #customer-forms-view,
  #quotations-view,
  #preparation-work-view,
  #preparation-completed-view,
  #deliveries-view,
  #reports-view,
  #returns-view,
  #sales-invoices-view
) .table-wrap {
  max-width: 100% !important;
  overflow: auto !important;
}
.app-shell :is(
  #orders-view,
  #order-details-view,
  #customers-view,
  #customer-forms-view,
  #quotations-view,
  #preparation-work-view,
  #preparation-completed-view,
  #deliveries-view,
  #reports-view,
  #returns-view,
  #sales-invoices-view
) table {
  width: 100% !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
}
.app-shell :is(
  #orders-view,
  #order-details-view,
  #customers-view,
  #customer-forms-view,
  #quotations-view,
  #preparation-work-view,
  #preparation-completed-view,
  #deliveries-view,
  #reports-view,
  #returns-view,
  #sales-invoices-view
) th {
  height: 25px !important;
  padding: 3px 5px !important;
  border-bottom: 1px solid var(--sales-line-strong) !important;
  background: #eaf1f5 !important;
  color: #29475b !important;
  font-size: 9px !important;
  font-weight: 900 !important;
  line-height: 1.1 !important;
  white-space: nowrap !important;
}
.app-shell :is(
  #orders-view,
  #order-details-view,
  #customers-view,
  #customer-forms-view,
  #quotations-view,
  #preparation-work-view,
  #preparation-completed-view,
  #deliveries-view,
  #reports-view,
  #returns-view,
  #sales-invoices-view
) td {
  height: 34px !important;
  padding: 4px 6px !important;
  border-top: 0 !important;
  border-bottom: 1px solid #c9d5de !important;
  background: #fff !important;
  color: var(--sales-ink) !important;
  font-size: 10px !important;
  line-height: 1.2 !important;
  vertical-align: middle !important;
}
.app-shell :is(
  #orders-view,
  #order-details-view,
  #customers-view,
  #customer-forms-view,
  #quotations-view,
  #preparation-work-view,
  #preparation-completed-view,
  #deliveries-view,
  #reports-view,
  #returns-view,
  #sales-invoices-view
) tbody tr:nth-child(even) td {
  background: #fbfdfe !important;
}
.app-shell :is(
  #orders-view,
  #order-details-view,
  #customers-view,
  #customer-forms-view,
  #quotations-view,
  #preparation-work-view,
  #preparation-completed-view,
  #deliveries-view,
  #reports-view,
  #returns-view,
  #sales-invoices-view
) tbody tr:hover td {
  background: var(--sales-hover) !important;
}
.app-shell :is(
  #orders-view,
  #order-details-view,
  #customers-view,
  #customer-forms-view,
  #quotations-view,
  #preparation-work-view,
  #preparation-completed-view,
  #deliveries-view,
  #reports-view,
  #returns-view,
  #sales-invoices-view
) td small {
  display: block !important;
  margin-top: 2px !important;
  color: var(--sales-muted) !important;
  font-size: 8px !important;
  line-height: 1.1 !important;
}
.app-shell :is(
  #orders-view,
  #order-details-view,
  #customers-view,
  #customer-forms-view,
  #quotations-view,
  #preparation-work-view,
  #preparation-completed-view,
  #deliveries-view,
  #reports-view,
  #returns-view,
  #sales-invoices-view
) .document-action-cell {
  display: flex !important;
  width: max-content !important;
  max-width: none !important;
  margin-right: auto !important;
  margin-left: 0 !important;
  align-items: center !important;
  justify-content: flex-end !important;
  flex-wrap: nowrap !important;
  gap: 2px !important;
}
.app-shell :is(
  #orders-view,
  #order-details-view,
  #customers-view,
  #customer-forms-view,
  #quotations-view,
  #preparation-work-view,
  #preparation-completed-view,
  #deliveries-view,
  #reports-view,
  #returns-view,
  #sales-invoices-view
) .document-action-cell > .document-action-cell {
  display: contents !important;
}
.app-shell :is(
  #orders-view,
  #order-details-view,
  #customers-view,
  #customer-forms-view,
  #quotations-view,
  #preparation-work-view,
  #preparation-completed-view,
  #deliveries-view,
  #reports-view,
  #returns-view,
  #sales-invoices-view
) .document-action-cell :is(.button, .small-action, .doc-action) {
  height: 22px !important;
  min-height: 22px !important;
  padding: 0 5px !important;
  border-radius: 3px !important;
  font-size: 8px !important;
}

/* Orders register and resume strip. */
.app-shell #orders-view .sales-order-workspace-notice {
  min-height: 32px !important;
  margin: 0 0 4px !important;
  padding: 4px 7px !important;
  border: 1px solid #8faec1 !important;
  border-right: 3px solid var(--sales-blue) !important;
  border-radius: 4px !important;
  background: #f3f8fb !important;
}
.app-shell #orders-view .sales-order-workspace-notice :is(strong, span) {
  font-size: 9px !important;
  line-height: 1.15 !important;
}
.app-shell #orders-view .tabs {
  display: flex !important;
  gap: 2px !important;
  min-height: 28px !important;
  padding: 2px 5px !important;
  border-block: 1px solid #d5e0e7 !important;
  overflow-x: auto !important;
}
.app-shell #orders-view .tabs button {
  height: 23px !important;
  padding: 0 9px !important;
  border-bottom-width: 2px !important;
  font-size: 9px !important;
  white-space: nowrap !important;
}

/* Customers and agents. */
.app-shell #customers-view .customer-directory-tabs {
  display: flex !important;
  align-items: center !important;
  gap: 2px !important;
  height: 30px !important;
  min-height: 30px !important;
  margin: 0 0 4px !important;
  padding: 2px !important;
  border: 1px solid var(--sales-line) !important;
  border-radius: var(--sales-radius) !important;
  background: var(--sales-soft) !important;
}
.app-shell #customers-view .customer-directory-tabs button {
  height: 24px !important;
  min-height: 24px !important;
  padding: 0 13px !important;
  border-radius: 4px !important;
  font-size: 9.5px !important;
  font-weight: 900 !important;
}
.app-shell #customers-view .customer-directory-tabs b {
  min-width: 18px !important;
  padding: 1px 4px !important;
  border-radius: 9px !important;
  font-size: 8px !important;
}

/* Customer requests and delivery eligibility are compact operational strips. */
.app-shell #customer-forms-view .workflow-rule,
.app-shell #deliveries-view .workflow-banner {
  display: flex !important;
  align-items: center !important;
  gap: 7px !important;
  min-height: 31px !important;
  margin: 0 0 4px !important;
  padding: 4px 7px !important;
  border: 1px solid #91adbe !important;
  border-radius: 4px !important;
  background: #f2f7fa !important;
  color: var(--sales-ink) !important;
  font-size: 9px !important;
}
.app-shell #customer-forms-view .workflow-rule span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.app-shell #deliveries-view .workflow-banner .order-chips {
  display: flex !important;
  align-items: center !important;
  gap: 3px !important;
  overflow-x: auto !important;
}
.app-shell #deliveries-view .workflow-banner .order-chips > * {
  flex: 0 0 auto !important;
  font-size: 8px !important;
}

/* Old statistic cards are removed from operational quotation screens. */
.app-shell #quotations-view > .stats-grid {
  display: none !important;
}

/* Order detail uses one compact facts strip, then document tables. */
.app-shell #order-details-view .document-title {
  min-width: 0 !important;
  gap: 5px !important;
}
.app-shell #order-details-view .document-title .icon-button {
  width: 25px !important;
  min-width: 25px !important;
  height: 25px !important;
  padding: 0 !important;
  border: 1px solid var(--sales-line) !important;
  border-radius: 4px !important;
  font-size: 14px !important;
}
.app-shell #order-details-view .document-header-actions {
  display: flex !important;
  align-items: center !important;
  gap: 3px !important;
  margin-right: auto !important;
}
.app-shell #order-details-view .order-detail-grid {
  display: grid !important;
  gap: 5px !important;
}
.app-shell #order-details-view .order-overview {
  padding: 5px !important;
}
.app-shell #order-details-view .detail-metrics {
  display: grid !important;
  grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
  gap: 4px !important;
}
.app-shell #order-details-view .detail-metrics > div {
  min-width: 0 !important;
  min-height: 48px !important;
  padding: 4px 6px !important;
  border: 1px solid #bac8d2 !important;
  border-radius: 4px !important;
  background: #f8fafb !important;
}
.app-shell #order-details-view .detail-metrics :is(span, strong, small) {
  display: block !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}
.app-shell #order-details-view .detail-metrics span { font-size: 8px !important; color: var(--sales-muted) !important; }
.app-shell #order-details-view .detail-metrics strong { margin-top: 2px !important; font-size: 10px !important; color: var(--sales-ink) !important; }
.app-shell #order-details-view .detail-metrics small { margin-top: 2px !important; font-size: 7.5px !important; color: var(--sales-muted) !important; }
.app-shell #order-details-view :is(.order-detail-lines, .order-related) .card-toolbar {
  min-height: 31px !important;
}
.app-shell #order-details-view .related-docs {
  display: grid !important;
  gap: 3px !important;
  padding: 5px !important;
}
.app-shell #order-details-view .related-docs > div {
  display: grid !important;
  grid-template-columns: minmax(160px, 1fr) minmax(180px, 1fr) auto !important;
  align-items: center !important;
  gap: 5px !important;
  min-height: 31px !important;
  padding: 3px 5px !important;
  border: 1px solid #c2d0d9 !important;
  border-radius: 4px !important;
}

/* Sales analytics keeps information, but in a compact dashboard. */
.app-shell #reports-view .report-filterbar {
  display: grid !important;
  grid-template-columns: 125px 125px minmax(220px, 1fr) auto !important;
  align-items: end !important;
  gap: 4px !important;
  margin: 0 0 4px !important;
  padding: 4px !important;
}
.app-shell #reports-view .compact-field {
  display: grid !important;
  grid-template-rows: 12px 26px !important;
  height: auto !important;
  border: 0 !important;
  gap: 1px !important;
}
.app-shell #reports-view .compact-field > span {
  font-size: 8px !important;
  font-weight: 900 !important;
  color: var(--sales-muted) !important;
}
.app-shell #reports-view .compact-field :is(input, select) {
  height: 26px !important;
  border: 1px solid var(--sales-line) !important;
  border-radius: 4px !important;
}
.app-shell #reports-view .sales-kpi-grid {
  display: grid !important;
  grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  gap: 4px !important;
  margin: 0 0 4px !important;
}
.app-shell #reports-view .sales-kpi {
  min-height: 52px !important;
  padding: 5px 7px !important;
  border: 1px solid var(--sales-line) !important;
  border-radius: 4px !important;
  background: #fff !important;
  box-shadow: none !important;
}
.app-shell #reports-view .sales-kpi span { font-size: 8px !important; color: var(--sales-muted) !important; }
.app-shell #reports-view .sales-kpi strong { display: block !important; margin: 2px 0 !important; font-size: 14px !important; color: var(--sales-ink) !important; }
.app-shell #reports-view .sales-kpi small { font-size: 7.5px !important; color: var(--sales-muted) !important; }
.app-shell #reports-view .sales-report-layout {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 5px !important;
}
.app-shell #reports-view .analytics-panel {
  min-height: 0 !important;
  padding: 6px !important;
}
.app-shell #reports-view .analytics-heading {
  min-height: 27px !important;
  margin: 0 0 4px !important;
  padding-bottom: 3px !important;
  border-bottom: 1px solid #d7e1e7 !important;
}
.app-shell #reports-view .analytics-heading h2 { margin: 0 !important; font-size: 11px !important; color: var(--sales-ink) !important; }
.app-shell #reports-view .analytics-heading p { display: none !important; }
.app-shell #reports-view .report-orders-panel { grid-column: 1 / -1 !important; }

/* ---------- Agent/customer portal ---------- */
#agent-portal-shell {
  color: var(--sales-ink) !important;
  background: #f2f5f7 !important;
}
#agent-portal-shell .agent-portal-header {
  min-height: 44px !important;
  padding: 4px 10px !important;
  border-bottom: 1px solid var(--sales-line) !important;
  box-shadow: none !important;
}
#agent-portal-shell .agent-portal-main {
  width: min(1440px, calc(100% - 12px)) !important;
  padding: 6px 0 15px !important;
}
#agent-portal-shell .agent-welcome {
  min-height: 50px !important;
  margin-bottom: 5px !important;
  padding: 6px 9px !important;
  border: 1px solid var(--sales-line) !important;
  border-radius: 5px !important;
  background: #fff !important;
  box-shadow: none !important;
}
#agent-portal-shell .agent-welcome h1 { margin: 0 !important; font-size: 15px !important; color: var(--sales-ink) !important; }
#agent-portal-shell .agent-welcome p:not(.eyebrow) { margin: 2px 0 0 !important; font-size: 9px !important; color: var(--sales-muted) !important; }
#agent-portal-shell .agent-welcome .eyebrow { display: none !important; }
#agent-portal-shell :is(.agent-order-form, .agent-recent) {
  margin-bottom: 5px !important;
  padding: 6px !important;
  border: 1px solid var(--sales-line) !important;
  border-radius: 5px !important;
  box-shadow: none !important;
}
#agent-portal-shell :is(.button, input, select, textarea, .smart-select-trigger, .smart-select-input) {
  border-radius: 4px !important;
}
#agent-portal-shell .button {
  height: 26px !important;
  min-height: 26px !important;
  padding: 0 9px !important;
  font-size: 9px !important;
  font-weight: 900 !important;
  box-shadow: none !important;
}
#agent-portal-shell .agent-lines-title {
  min-height: 29px !important;
  margin: 3px 0 !important;
  padding: 2px 0 !important;
  border-bottom: 1px solid #d7e1e7 !important;
}
#agent-portal-shell .agent-lines-title h2 { margin: 0 !important; font-size: 12px !important; }
#agent-portal-shell .agent-lines-title p { display: none !important; }
#agent-portal-shell .agent-order-footer {
  min-height: 31px !important;
  margin-top: 4px !important;
  padding-top: 4px !important;
  border-top: 1px solid #d7e1e7 !important;
}

/* ---------- Sales-cycle modals ---------- */
body > :is(
  #customer-modal,
  #agent-customers-modal,
  #customer-report-modal,
  #quotation-modal,
  #delivery-modal,
  #delivery-detail-modal,
  #return-modal,
  #customer-request-modal,
  #cutting-create-modal,
  #cutting-preview-modal,
  #preparation-modal,
  #sales-invoice-editor-modal,
  #new-sales-invoice-modal,
  #invoice-modal,
  #document-relations-modal
).modal-layer {
  padding: 10px !important;
  background: rgba(14, 35, 51, .57) !important;
  backdrop-filter: blur(1px);
}
body > :is(
  #customer-modal,
  #agent-customers-modal,
  #customer-report-modal,
  #quotation-modal,
  #delivery-modal,
  #delivery-detail-modal,
  #return-modal,
  #customer-request-modal,
  #cutting-create-modal,
  #cutting-preview-modal,
  #preparation-modal,
  #sales-invoice-editor-modal,
  #new-sales-invoice-modal,
  #invoice-modal,
  #document-relations-modal
) .modal-card {
  display: flex !important;
  flex-direction: column !important;
  width: min(760px, calc(100vw - 20px)) !important;
  max-width: calc(100vw - 20px) !important;
  max-height: calc(100vh - 20px) !important;
  padding: 0 !important;
  border: 1px solid #8199aa !important;
  border-radius: 7px !important;
  background: #fff !important;
  box-shadow: 0 18px 48px rgba(8, 27, 41, .25) !important;
  overflow: hidden !important;
}
body > :is(#delivery-modal, #customer-report-modal, #agent-customers-modal, #document-relations-modal) .modal-card {
  width: min(1080px, calc(100vw - 20px)) !important;
}
body > :is(#delivery-detail-modal, #customer-request-modal, #cutting-preview-modal, #preparation-modal) .modal-card {
  width: min(1280px, calc(100vw - 20px)) !important;
}
body > #sales-invoice-editor-modal .modal-card {
  width: min(1380px, calc(100vw - 20px)) !important;
}
body > :is(
  #customer-modal,
  #agent-customers-modal,
  #customer-report-modal,
  #quotation-modal,
  #delivery-modal,
  #delivery-detail-modal,
  #return-modal,
  #customer-request-modal,
  #cutting-create-modal,
  #cutting-preview-modal,
  #preparation-modal,
  #sales-invoice-editor-modal,
  #new-sales-invoice-modal,
  #invoice-modal,
  #document-relations-modal
) .modal-header {
  position: sticky !important;
  top: 0 !important;
  z-index: 12 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  flex: 0 0 38px !important;
  min-height: 38px !important;
  margin: 0 !important;
  padding: 4px 7px !important;
  border-bottom: 1px solid var(--sales-line-strong) !important;
  background: #f8fafb !important;
}
body > :is(
  #customer-modal,
  #agent-customers-modal,
  #customer-report-modal,
  #quotation-modal,
  #delivery-modal,
  #delivery-detail-modal,
  #return-modal,
  #customer-request-modal,
  #cutting-create-modal,
  #cutting-preview-modal,
  #preparation-modal,
  #sales-invoice-editor-modal,
  #new-sales-invoice-modal,
  #invoice-modal,
  #document-relations-modal
) .modal-header .eyebrow {
  display: none !important;
}
body > :is(
  #customer-modal,
  #agent-customers-modal,
  #customer-report-modal,
  #quotation-modal,
  #delivery-modal,
  #delivery-detail-modal,
  #return-modal,
  #customer-request-modal,
  #cutting-create-modal,
  #cutting-preview-modal,
  #preparation-modal,
  #sales-invoice-editor-modal,
  #new-sales-invoice-modal,
  #invoice-modal,
  #document-relations-modal
) .modal-header h2 {
  margin: 0 !important;
  font-size: 13px !important;
  font-weight: 900 !important;
  line-height: 1.1 !important;
  color: var(--sales-ink) !important;
}
body > :is(
  #customer-modal,
  #agent-customers-modal,
  #customer-report-modal,
  #quotation-modal,
  #delivery-modal,
  #delivery-detail-modal,
  #return-modal,
  #customer-request-modal,
  #cutting-create-modal,
  #cutting-preview-modal,
  #preparation-modal,
  #sales-invoice-editor-modal,
  #new-sales-invoice-modal,
  #invoice-modal,
  #document-relations-modal
) .modal-header p:not(.eyebrow) {
  max-width: 760px !important;
  margin: 2px 0 0 !important;
  overflow: hidden !important;
  color: var(--sales-muted) !important;
  font-size: 8px !important;
  line-height: 1 !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}
body > :is(
  #customer-modal,
  #agent-customers-modal,
  #customer-report-modal,
  #quotation-modal,
  #delivery-modal,
  #delivery-detail-modal,
  #return-modal,
  #customer-request-modal,
  #cutting-create-modal,
  #cutting-preview-modal,
  #preparation-modal,
  #sales-invoice-editor-modal,
  #new-sales-invoice-modal,
  #invoice-modal,
  #document-relations-modal
) .modal-header > .icon-button {
  flex: 0 0 26px !important;
  width: 26px !important;
  height: 26px !important;
  min-width: 26px !important;
  padding: 0 !important;
  border: 1px solid #9eb1bf !important;
  border-radius: 4px !important;
  background: #fff !important;
  color: #263f52 !important;
  font-size: 15px !important;
}

body > :is(
  #customer-modal,
  #quotation-modal,
  #delivery-modal,
  #return-modal,
  #preparation-modal,
  #sales-invoice-editor-modal,
  #new-sales-invoice-modal,
  #invoice-modal
) form,
body > :is(#cutting-create-modal, #cutting-preview-modal) .cutting-create-body,
body > :is(#agent-customers-modal, #customer-report-modal, #delivery-detail-modal, #customer-request-modal, #document-relations-modal) :is(#agent-customers-content, #customer-report-content, #delivery-detail-content, #portal-review-content, #document-relations-content) {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  padding: 6px !important;
  overflow: auto !important;
}
body > #cutting-preview-modal #cutting-preview-content {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  padding: 6px !important;
  overflow: auto !important;
}

/* Modal fields have one label row and one control row. */
body > :is(
  #customer-modal,
  #quotation-modal,
  #delivery-modal,
  #return-modal,
  #cutting-preview-modal,
  #preparation-modal,
  #sales-invoice-editor-modal,
  #new-sales-invoice-modal,
  #invoice-modal
) .form-grid {
  gap: 5px !important;
}
body > :is(
  #customer-modal,
  #quotation-modal,
  #delivery-modal,
  #return-modal,
  #cutting-preview-modal,
  #preparation-modal,
  #sales-invoice-editor-modal,
  #new-sales-invoice-modal,
  #invoice-modal
) .field {
  min-width: 0 !important;
  gap: 2px !important;
  margin: 0 !important;
}
body > :is(
  #customer-modal,
  #quotation-modal,
  #delivery-modal,
  #return-modal,
  #cutting-preview-modal,
  #preparation-modal,
  #sales-invoice-editor-modal,
  #new-sales-invoice-modal,
  #invoice-modal
) .field > span {
  min-height: 13px !important;
  font-size: 9px !important;
  font-weight: 900 !important;
  line-height: 13px !important;
  color: #2c4659 !important;
  white-space: nowrap !important;
}
body > :is(
  #customer-modal,
  #quotation-modal,
  #delivery-modal,
  #return-modal,
  #cutting-preview-modal,
  #preparation-modal,
  #sales-invoice-editor-modal,
  #new-sales-invoice-modal,
  #invoice-modal
) .field :is(input, select, textarea, .smart-select-trigger, .smart-select-input) {
  width: 100% !important;
  min-width: 0 !important;
  height: 29px !important;
  min-height: 29px !important;
  padding: 3px 6px !important;
  border: 1px solid var(--sales-line) !important;
  border-radius: 4px !important;
  background: #fff !important;
  color: var(--sales-ink) !important;
  font-size: 10px !important;
  font-weight: 650 !important;
}
body > :is(#customer-modal, #quotation-modal, #delivery-modal, #return-modal) .field textarea {
  height: 44px !important;
  min-height: 44px !important;
  resize: vertical !important;
}
body > :is(
  #customer-modal,
  #quotation-modal,
  #delivery-modal,
  #return-modal,
  #cutting-preview-modal,
  #preparation-modal,
  #sales-invoice-editor-modal,
  #new-sales-invoice-modal,
  #invoice-modal
) .field small {
  margin: 0 !important;
  color: var(--sales-muted) !important;
  font-size: 7.5px !important;
  line-height: 1.15 !important;
}

body > #customer-modal .modal-card { width: min(940px, calc(100vw - 20px)) !important; }
body > #customer-modal .modal-form { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
body > #customer-modal .modal-form .span-2 { grid-column: span 2 !important; }

/* Sticky, visible feedback and actions; errors can no longer hide under content. */
body > :is(
  #customer-modal,
  #quotation-modal,
  #delivery-modal,
  #delivery-detail-modal,
  #return-modal,
  #customer-request-modal,
  #cutting-create-modal,
  #cutting-preview-modal,
  #preparation-modal,
  #sales-invoice-editor-modal,
  #new-sales-invoice-modal,
  #invoice-modal
) .form-message:not(.hidden) {
  position: sticky !important;
  bottom: 36px !important;
  z-index: 15 !important;
  min-height: 30px !important;
  margin: 4px 0 0 !important;
  padding: 6px 8px !important;
  border: 1px solid currentColor !important;
  border-radius: 4px !important;
  box-shadow: 0 -3px 10px rgba(17, 44, 64, .1) !important;
  font-size: 10px !important;
  font-weight: 800 !important;
  line-height: 1.35 !important;
}
body > :is(
  #customer-modal,
  #agent-customers-modal,
  #customer-report-modal,
  #quotation-modal,
  #delivery-modal,
  #delivery-detail-modal,
  #return-modal,
  #customer-request-modal,
  #cutting-create-modal,
  #cutting-preview-modal,
  #preparation-modal,
  #sales-invoice-editor-modal,
  #new-sales-invoice-modal,
  #invoice-modal,
  #document-relations-modal
) .modal-actions {
  position: sticky !important;
  bottom: 0 !important;
  z-index: 14 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  flex: 0 0 36px !important;
  min-height: 36px !important;
  margin: 0 !important;
  padding: 4px 6px !important;
  border-top: 1px solid var(--sales-line) !important;
  background: #f8fafb !important;
  gap: 3px !important;
}
body > :is(
  #customer-modal,
  #agent-customers-modal,
  #customer-report-modal,
  #quotation-modal,
  #delivery-modal,
  #delivery-detail-modal,
  #return-modal,
  #customer-request-modal,
  #cutting-create-modal,
  #cutting-preview-modal,
  #preparation-modal,
  #sales-invoice-editor-modal,
  #new-sales-invoice-modal,
  #invoice-modal,
  #document-relations-modal
) .modal-actions :is(.button, .small-action) {
  height: 27px !important;
  min-height: 27px !important;
  padding: 0 9px !important;
  border: 1px solid #91a8b8 !important;
  border-radius: 4px !important;
  box-shadow: none !important;
  font-size: 9px !important;
  font-weight: 900 !important;
  white-space: nowrap !important;
}
body > :is(
  #customer-modal,
  #agent-customers-modal,
  #customer-report-modal,
  #quotation-modal,
  #delivery-modal,
  #delivery-detail-modal,
  #return-modal,
  #customer-request-modal,
  #cutting-create-modal,
  #cutting-preview-modal,
  #preparation-modal,
  #sales-invoice-editor-modal,
  #new-sales-invoice-modal,
  #invoice-modal
) .modal-actions .primary,
body > :is(
  #customer-modal,
  #agent-customers-modal,
  #customer-report-modal,
  #quotation-modal,
  #delivery-modal,
  #delivery-detail-modal,
  #return-modal,
  #customer-request-modal,
  #cutting-create-modal,
  #cutting-preview-modal,
  #preparation-modal,
  #sales-invoice-editor-modal,
  #new-sales-invoice-modal,
  #invoice-modal
) .modal-actions .success {
  background: var(--sales-green) !important;
  border-color: var(--sales-green) !important;
  color: #fff !important;
}

/* Tables inside document modals. */
body > :is(
  #agent-customers-modal,
  #customer-report-modal,
  #delivery-modal,
  #delivery-detail-modal,
  #customer-request-modal,
  #cutting-preview-modal,
  #preparation-modal,
  #sales-invoice-editor-modal
) .table-wrap {
  max-width: 100% !important;
  overflow: auto !important;
  border: 1px solid var(--sales-line) !important;
  border-radius: 4px !important;
}
body > :is(
  #agent-customers-modal,
  #customer-report-modal,
  #delivery-modal,
  #delivery-detail-modal,
  #customer-request-modal,
  #cutting-preview-modal,
  #preparation-modal,
  #sales-invoice-editor-modal
) table {
  width: 100% !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
}
body > :is(
  #agent-customers-modal,
  #customer-report-modal,
  #delivery-modal,
  #delivery-detail-modal,
  #customer-request-modal,
  #cutting-preview-modal,
  #preparation-modal,
  #sales-invoice-editor-modal
) th {
  height: 25px !important;
  padding: 3px 4px !important;
  border-bottom: 1px solid var(--sales-line-strong) !important;
  background: #eaf1f5 !important;
  color: #29475b !important;
  font-size: 8.5px !important;
  font-weight: 900 !important;
  white-space: nowrap !important;
}
body > :is(
  #agent-customers-modal,
  #customer-report-modal,
  #delivery-modal,
  #delivery-detail-modal,
  #customer-request-modal,
  #cutting-preview-modal,
  #preparation-modal,
  #sales-invoice-editor-modal
) td {
  height: 34px !important;
  padding: 3px 4px !important;
  border-bottom: 1px solid #c9d5de !important;
  background: #fff !important;
  color: var(--sales-ink) !important;
  font-size: 9.5px !important;
  line-height: 1.2 !important;
  vertical-align: middle !important;
}
body > :is(
  #delivery-modal,
  #delivery-detail-modal,
  #customer-request-modal,
  #cutting-preview-modal,
  #preparation-modal,
  #sales-invoice-editor-modal
) td :is(input, select, .smart-select-input, .smart-select-trigger) {
  width: 100% !important;
  min-width: 0 !important;
  height: 27px !important;
  min-height: 27px !important;
  padding: 2px 4px !important;
  border: 1px solid #a9bbc8 !important;
  border-radius: 4px !important;
  background: #fff !important;
  font-size: 9px !important;
  font-weight: 700 !important;
}

/* Cutting order: sheet-like grids and compact group totals. */
body > #cutting-create-modal .modal-card { width: min(680px, calc(100vw - 20px)) !important; }
body > #cutting-create-modal .cutting-create-body {
  display: grid !important;
  gap: 5px !important;
}
body > #cutting-create-modal .cutting-order-search {
  width: 100% !important;
  height: 29px !important;
  margin: 0 !important;
  border: 1px solid var(--sales-line) !important;
  border-radius: 4px !important;
}
body > #cutting-create-modal .cutting-orders-dropdown {
  border: 1px solid var(--sales-line) !important;
  border-radius: 4px !important;
  background: #fff !important;
}
body > #cutting-create-modal .cutting-orders-dropdown summary {
  min-height: 31px !important;
  padding: 5px 7px !important;
  font-size: 9.5px !important;
  font-weight: 900 !important;
}
body > #cutting-create-modal .cutting-order-options {
  max-height: 310px !important;
  padding: 3px !important;
  overflow: auto !important;
}
body > :is(#cutting-preview-modal, #preparation-modal) :is(.cutting-preview-page, .cutting-order-sheet) {
  margin: 0 0 6px !important;
  padding: 0 !important;
  border: 1px solid #8fa6b6 !important;
  border-radius: 4px !important;
  background: #fff !important;
  overflow: hidden !important;
}
body > :is(#cutting-preview-modal, #preparation-modal) :is(.cutting-preview-group-head, .cutting-order-sheet-head) {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  min-height: 31px !important;
  padding: 4px 6px !important;
  border-bottom: 1px solid var(--sales-line) !important;
  background: #eef4f8 !important;
  color: var(--sales-ink) !important;
  font-size: 9px !important;
}

.cutting-remove-orders-card{width:min(920px,94vw);max-height:90vh;overflow:auto;padding:0;background:#f8fafc}
.cutting-remove-orders-card .modal-header{position:sticky;top:0;z-index:4;margin:0;padding:14px 18px;background:#fff;border-bottom:1px solid #d8e2eb}
.cutting-remove-orders-card form{padding:14px 18px 0}
.cutting-revision-banner{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;margin-bottom:12px}
.cutting-revision-banner>div{display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:58px;padding:10px 13px;border:1px solid #cbd9e6;border-radius:9px;background:#fff}
.cutting-revision-banner span{font-size:11px;color:#61768a}.cutting-revision-banner strong{font-size:16px;color:#0c426a;direction:ltr}
.cutting-remove-search{margin-bottom:9px}.cutting-remove-search input{min-height:38px;background:#fff}
.cutting-remove-order-options{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;max-height:330px;overflow:auto;padding:4px;border:1px solid #d5e0e9;border-radius:9px;background:#eef3f7}
.cutting-remove-order-option{display:grid;grid-template-columns:auto 1fr auto;align-items:center;gap:10px;min-height:62px;padding:9px 11px;border:1px solid #d1dde7;border-radius:8px;background:#fff;cursor:pointer;transition:border-color .15s,box-shadow .15s,background .15s}
.cutting-remove-order-option:hover{border-color:#6ea7d2;box-shadow:0 2px 8px rgba(18,72,111,.09)}
.cutting-remove-order-option:has(input:checked){border-color:#cf5353;background:#fff8f8;box-shadow:0 0 0 2px rgba(207,83,83,.1)}
.cutting-remove-order-option input{width:17px;height:17px;accent-color:#c53f45}.cutting-remove-order-option span{min-width:0}.cutting-remove-order-option strong,.cutting-remove-order-option small{display:block}.cutting-remove-order-option strong{font-size:12px;color:#123752}.cutting-remove-order-option small{margin-top:3px;font-size:10px;color:#63788b;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.cutting-remove-order-option>b{padding:3px 7px;border-radius:999px;background:#fff0f0;color:#ad2e35;font-size:10px}
.cutting-remove-reason{margin-top:10px}.cutting-revision-history{margin-top:12px;border:1px solid #d4e0ea;border-radius:9px;background:#fff;overflow:hidden}.cutting-revision-history-head{display:flex;justify-content:space-between;padding:8px 11px;background:#eaf1f6;border-bottom:1px solid #d4e0ea}.cutting-revision-history-head span{font-size:10px;color:#61768a}
#cutting-revision-history-list{max-height:150px;overflow:auto}.cutting-revision-item{display:grid;grid-template-columns:110px 1fr 190px;gap:8px;padding:8px 11px;border-bottom:1px solid #edf1f4;align-items:center}.cutting-revision-item:last-child{border-bottom:0}.cutting-revision-item strong{direction:ltr;text-align:right;color:#0c5485}.cutting-revision-item span{font-size:11px}.cutting-revision-item small{font-size:9px;color:#718294}
.cutting-remove-orders-card .modal-actions{position:sticky;bottom:0;margin:12px -18px 0;padding:9px 18px;background:#fff;border-top:1px solid #d8e2eb}
@media(max-width:720px){.cutting-revision-banner,.cutting-remove-order-options{grid-template-columns:1fr}.cutting-revision-item{grid-template-columns:1fr}.cutting-revision-item small{text-align:right}}
body > #cutting-preview-modal .cutting-preview-notes {
  flex: 0 0 auto !important;
  margin: 0 6px 5px !important;
}
body > #preparation-modal #preparation-form {
  display: flex !important;
  flex: 1 1 auto !important;
  flex-direction: column !important;
  min-height: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
}
body > #preparation-modal .preparation-order-summary {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  padding: 6px !important;
  overflow: auto !important;
}
body > #preparation-modal #preparation-form > .form-grid {
  flex: 0 0 auto !important;
  padding: 0 6px 5px !important;
}

/* Delivery and invoice entry show facts and totals without oversized panels. */
body > :is(#delivery-modal, #delivery-detail-modal) :is(.delivery-order-preview, .delivery-detail-head, .portal-review-head) {
  margin: 5px 0 !important;
}
body > :is(#delivery-detail-modal, #customer-request-modal) :is(.delivery-detail-head, .portal-review-head) {
  display: grid !important;
  grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
  gap: 4px !important;
}
body > :is(#delivery-detail-modal, #customer-request-modal) :is(.delivery-detail-head, .portal-review-head) > div {
  min-width: 0 !important;
  min-height: 45px !important;
  padding: 4px 5px !important;
  border: 1px solid #bbc9d2 !important;
  border-radius: 4px !important;
  background: #f8fafb !important;
}
body > :is(#delivery-detail-modal, #customer-request-modal) :is(.delivery-detail-head, .portal-review-head) :is(span, strong, small) {
  display: block !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}
body > :is(#delivery-detail-modal, #customer-request-modal) :is(.delivery-detail-head, .portal-review-head) span { font-size: 8px !important; color: var(--sales-muted) !important; }
body > :is(#delivery-detail-modal, #customer-request-modal) :is(.delivery-detail-head, .portal-review-head) strong { margin-top: 2px !important; font-size: 10px !important; color: var(--sales-ink) !important; }
body > :is(#delivery-detail-modal, #customer-request-modal) :is(.delivery-detail-head, .portal-review-head) small { margin-top: 2px !important; font-size: 7.5px !important; color: var(--sales-muted) !important; }
body > :is(#delivery-detail-modal, #customer-request-modal) :is(.delivery-integration-note, .document-source-note, .portal-review-audit) {
  margin: 4px 0 !important;
  padding: 5px 7px !important;
  border: 1px solid #adc0cc !important;
  border-right: 3px solid var(--sales-blue) !important;
  border-radius: 4px !important;
  background: #f4f8fb !important;
  color: var(--sales-ink) !important;
  font-size: 9px !important;
  line-height: 1.35 !important;
}
body > :is(#delivery-detail-modal, #customer-request-modal) :is(.delivery-measure-total, .portal-review-total),
body > #sales-invoice-editor-modal .invoice-editor-total {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 12px !important;
  min-height: 34px !important;
  margin: 4px 0 !important;
  padding: 5px 7px !important;
  border: 1px solid #9cb3c2 !important;
  border-radius: 4px !important;
  background: #eef4f8 !important;
  font-size: 9px !important;
}
body > :is(#delivery-detail-modal, #customer-request-modal) :is(.delivery-measure-total, .portal-review-total) strong,
body > #sales-invoice-editor-modal .invoice-editor-total strong {
  font-size: 12px !important;
  color: #105f46 !important;
}
body > #sales-invoice-editor-modal .invoice-editor-head {
  display: grid !important;
  grid-template-columns: 125px 125px 150px minmax(220px, 1fr) !important;
  gap: 5px !important;
  margin-bottom: 5px !important;
}
body > #sales-invoice-editor-modal .invoice-editor-lines {
  max-height: calc(100vh - 235px) !important;
}
body > #sales-invoice-editor-modal .invoice-editor-lines table {
  min-width: 1540px !important;
}
body > #sales-invoice-editor-modal .invoice-editor-lines th,
body > #sales-invoice-editor-modal .invoice-editor-lines td {
  padding: 3px 4px !important;
  font-size: 9px !important;
  white-space: nowrap !important;
}
body > #sales-invoice-editor-modal .invoice-editor-lines td:nth-child(3) {
  min-width: 145px !important;
  white-space: normal !important;
}
body > #sales-invoice-editor-modal .invoice-editor-lines input {
  width: 74px !important;
  height: 27px !important;
  padding: 2px 4px !important;
}
body > #sales-invoice-editor-modal .invoice-editor-lines td:nth-child(3) input {
  width: 100% !important;
  margin-top: 2px !important;
}
body > #sales-invoice-editor-modal .invoice-db-summary {
  display: flex !important;
  justify-content: flex-end !important;
  flex-wrap: wrap !important;
  gap: 4px !important;
  margin: 4px 0 0 !important;
  transition: opacity 120ms ease !important;
}
body > #sales-invoice-editor-modal .invoice-db-summary.invoice-preview-pending {
  opacity: .55 !important;
}
body > #sales-invoice-editor-modal .invoice-db-summary span {
  min-width: 145px !important;
  padding: 4px 6px !important;
  border: 1px solid #b4c5d0 !important;
  border-radius: 4px !important;
  background: #fff !important;
  color: #263d4d !important;
  font-size: 8px !important;
}
body > #sales-invoice-editor-modal .invoice-db-summary strong {
  display: block !important;
  margin-top: 1px !important;
  color: #0d5276 !important;
  font-size: 10px !important;
}

/* Responsive fallbacks preserve labels and actions. */
@media (max-width: 1100px) {
  .app-shell #order-details-view .detail-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
  .app-shell #reports-view .sales-kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
  body > :is(#delivery-detail-modal, #customer-request-modal) :is(.delivery-detail-head, .portal-review-head) {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 760px) {
  .app-shell :is(
    #orders-view,
    #order-details-view,
    #customers-view,
    #customer-forms-view,
    #quotations-view,
    #preparation-work-view,
    #preparation-completed-view,
    #deliveries-view,
    #reports-view,
    #returns-view,
    #sales-invoices-view
  ) {
    padding-inline: 4px !important;
  }
  .app-shell :is(#orders-view, #preparation-work-view, #deliveries-view) .sales-orders-command-bar {
    height: auto !important;
  }
  .app-shell :is(#orders-view, #preparation-work-view, #deliveries-view) .sales-cycle-actions {
    margin-inline-start: 8px !important;
  }
  .app-shell #order-details-view > .document-header {
    height: auto !important;
    min-height: 31px !important;
    max-height: none !important;
    flex-wrap: wrap !important;
  }
  .app-shell #order-details-view .document-header-actions {
    width: 100% !important;
    padding-top: 3px !important;
    overflow-x: auto !important;
  }
  .app-shell #order-details-view .detail-metrics,
  .app-shell #reports-view .sales-kpi-grid,
  .app-shell #reports-view .sales-report-layout {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  .app-shell #reports-view .report-filterbar {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  .app-shell #reports-view .report-customer-filter {
    grid-column: 1 / -1 !important;
  }
  .app-shell #reports-view .report-orders-panel {
    grid-column: 1 / -1 !important;
  }
  body > :is(
    #customer-modal,
    #agent-customers-modal,
    #customer-report-modal,
    #quotation-modal,
    #delivery-modal,
    #delivery-detail-modal,
    #return-modal,
    #customer-request-modal,
    #cutting-create-modal,
    #cutting-preview-modal,
    #preparation-modal,
    #sales-invoice-editor-modal,
    #new-sales-invoice-modal,
    #invoice-modal,
    #document-relations-modal
  ).modal-layer {
    padding: 4px !important;
  }
  body > :is(
    #customer-modal,
    #agent-customers-modal,
    #customer-report-modal,
    #quotation-modal,
    #delivery-modal,
    #delivery-detail-modal,
    #return-modal,
    #customer-request-modal,
    #cutting-create-modal,
    #cutting-preview-modal,
    #preparation-modal,
    #sales-invoice-editor-modal,
    #new-sales-invoice-modal,
    #invoice-modal,
    #document-relations-modal
  ) .modal-card {
    width: calc(100vw - 8px) !important;
    max-width: calc(100vw - 8px) !important;
    max-height: calc(100vh - 8px) !important;
    border-radius: 5px !important;
  }
  body > #customer-modal .modal-form,
  body > :is(#quotation-modal, #delivery-modal, #return-modal) .modal-form {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  body > #customer-modal .modal-form .span-2,
  body > :is(#quotation-modal, #delivery-modal, #return-modal) .modal-form .span-2 {
    grid-column: 1 / -1 !important;
  }
  body > :is(#delivery-detail-modal, #customer-request-modal) :is(.delivery-detail-head, .portal-review-head) {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  body > #sales-invoice-editor-modal .invoice-editor-head {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  body > #sales-invoice-editor-modal .invoice-editor-notes {
    grid-column: 1 / -1 !important;
  }
  body > :is(
    #customer-modal,
    #agent-customers-modal,
    #customer-report-modal,
    #quotation-modal,
    #delivery-modal,
    #delivery-detail-modal,
    #return-modal,
    #customer-request-modal,
    #cutting-create-modal,
    #cutting-preview-modal,
    #preparation-modal,
    #sales-invoice-editor-modal,
    #new-sales-invoice-modal,
    #invoice-modal,
    #document-relations-modal
  ) .modal-actions {
    overflow-x: auto !important;
  }
}
