.ms-offer-compiler-shell {
  --offer-compiler-main-span: 12fr;
  width: 100%;
  min-width: 0;
  padding: 8px;
}

.ms-offer-compiler-grid {
  display: grid;
  grid-template-columns: minmax(0, var(--offer-compiler-main-span));
  gap: 0;
}

.ms-offer-compiler-workspace {
  /* The document composer is deliberately isolated from the shell theme. */
  --ms-surface: #ffffff;
  --ms-surface-primary: #ffffff;
  --ms-surface-secondary: #f7f8fc;
  --ms-surface-tertiary: #eef1f6;
  --ms-text-primary: #182236;
  --ms-text-secondary: #5f697c;
  --ms-text-muted: #8a94a8;
  --ms-border-color: #dfe4ee;
  --ms-theme-surface: #ffffff;
  --ms-theme-surface-soft: #f7f8fc;
  --ms-theme-text: #182236;
  --ms-theme-muted: #8a94a8;
  --ms-theme-border: #dfe4ee;
  color-scheme: light;
  min-width: 0;
  min-height: 420px;
  display: grid;
  place-items: center;
  padding: 24px;
  border: 1px solid var(--ms-border-color, #dfe4ee);
  border-radius: var(--ms-radius-lg, 16px);
  background: var(--ms-surface, #fff);
  box-shadow: var(--ms-shadow-card, 0 8px 24px rgba(31, 42, 68, .06));
}

.ms-offer-compiler-main {
  --ms-theme-surface: var(--ms-surface, #fff);
  --ms-theme-surface-soft: var(--ms-surface-secondary, #f7f8fc);
  --ms-theme-text: var(--ms-text-primary, #182236);
  --ms-theme-border: var(--ms-border-color, #dfe4ee);
  max-width: 100%;
  overflow: hidden;
}

.ms-offer-compiler-main.is-runtime-mounted {
  display: block;
  place-items: initial;
  padding: 0;
}

.ms-offer-compiler-main .commercial-composer-shell,
.ms-offer-compiler-main .commercial-table-panel,
.ms-offer-compiler-main .commercial-table-wrap {
  max-width: 100%;
  min-width: 0;
}

.ms-offer-compiler-main button:disabled {
  cursor: not-allowed;
  opacity: .48;
}

.ms-offer-compiler-empty {
  color: var(--ms-text-muted, #8a94a8);
  font-size: 13px;
  text-align: center;
}

@media (max-width: 980px) {
  .ms-offer-compiler-workspace {
    min-height: 260px;
  }
}

@media (max-width: 640px) {
  .ms-offer-compiler-shell {
    padding: 6px;
  }
}

/* OMNIA_R10_COMMERCIAL_OFFER_AUTOMATION_START */
.ms-r10-offer-overlay {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(2, 8, 23, .66);
  backdrop-filter: blur(8px);
}

.ms-r10-offer-dialog {
  width: min(720px, 100%);
  max-height: min(820px, calc(100vh - 32px));
  overflow: auto;
  padding: 22px;
  border: 1px solid rgba(56, 189, 248, .34);
  border-radius: 20px;
  background: var(--ms-surface, #fff);
  color: var(--ms-text, #172033);
  box-shadow:
    0 28px 80px rgba(0, 0, 0, .36),
    inset 0 1px rgba(255, 255, 255, .12);
}

.ms-r10-offer-head,
.ms-r10-offer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ms-r10-offer-head h3 {
  margin: 0;
  font-size: 20px;
}

.ms-r10-offer-head p {
  margin: 4px 0 0;
  opacity: .72;
}

.ms-r10-offer-head [data-r10-close] {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 12px;
  font-size: 26px;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.ms-r10-offer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 20px;
}

.ms-r10-offer-grid label {
  display: grid;
  gap: 6px;
  font-weight: 650;
}

.ms-r10-offer-grid select,
.ms-r10-offer-grid textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid rgba(100, 116, 139, .32);
  border-radius: 12px;
  padding: 11px 12px;
  background: var(--ms-surface-elevated, rgba(255,255,255,.06));
  color: inherit;
  font: inherit;
}

.ms-r10-offer-wide {
  grid-column: 1 / -1;
}

.ms-r10-offer-summary {
  display: grid;
  gap: 4px;
  margin-top: 18px;
  padding: 12px 14px;
  border-radius: 13px;
  background: rgba(14, 165, 233, .10);
  border: 1px solid rgba(14, 165, 233, .20);
}

.ms-r10-offer-summary span {
  font-size: 13px;
  opacity: .78;
}

.ms-r10-offer-error {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(239, 68, 68, .12);
  color: #ef4444;
}

.ms-r10-offer-actions {
  justify-content: flex-end;
  margin-top: 20px;
}

.ms-r10-offer-actions button {
  min-height: 42px;
  padding: 0 17px;
  border-radius: 12px;
  font-weight: 750;
  cursor: pointer;
}

.ms-r10-secondary {
  border: 1px solid rgba(100, 116, 139, .34);
  background: transparent;
  color: inherit;
}

.ms-r10-primary {
  border: 1px solid rgba(14, 165, 233, .42);
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: #fff;
  box-shadow: 0 8px 22px rgba(37, 99, 235, .22);
}

html[data-theme="dark"] .ms-r10-offer-dialog,
body[data-theme="dark"] .ms-r10-offer-dialog,
.dark .ms-r10-offer-dialog {
  background: #09182b;
  color: #f1f5f9;
}

@media (max-width: 640px) {
  .ms-r10-offer-overlay {
    padding: 10px;
  }

  .ms-r10-offer-dialog {
    padding: 16px;
    border-radius: 16px;
  }

  .ms-r10-offer-grid {
    grid-template-columns: 1fr;
  }

  .ms-r10-offer-wide {
    grid-column: auto;
  }

  .ms-r10-offer-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}
/* OMNIA_R10_COMMERCIAL_OFFER_AUTOMATION_END */

/* OMNIA_R12B_QUOTATION_PI_UI_START */
.ms-r12b-document-overlay {
  position: fixed;
  inset: 0;
  z-index: 10040;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(3, 10, 24, 0.68);
  backdrop-filter: blur(12px);
}

.ms-r12b-document-dialog {
  width: min(680px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 22px;
  border: 1px solid rgba(66, 185, 255, 0.34);
  border-radius: 20px;
  color: var(--text-primary, #f7fbff);
  background:
    linear-gradient(
      145deg,
      rgba(16, 38, 68, 0.98),
      rgba(7, 20, 40, 0.98)
    );
  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.44),
    0 0 32px rgba(29, 156, 255, 0.12);
}

.ms-r12b-document-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.ms-r12b-document-head h3 {
  margin: 4px 0 0;
  font-size: 22px;
}

.ms-r12b-document-kicker {
  color: #7ed8ff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ms-r12b-icon-button {
  min-width: 44px;
  min-height: 44px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 12px;
  color: inherit;
  background: rgba(255,255,255,.06);
  cursor: pointer;
}

.ms-r12b-document-status {
  display: grid;
  grid-template-columns:
    repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.ms-r12b-document-status > div {
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 14px;
  background: rgba(255,255,255,.045);
}

.ms-r12b-document-status span {
  display: block;
  margin-bottom: 5px;
  color: rgba(235,245,255,.70);
  font-size: 12px;
}

.ms-r12b-document-status strong {
  overflow-wrap: anywhere;
}

.ms-r12b-document-message,
.ms-r12b-document-error {
  margin-bottom: 16px;
  padding: 13px 14px;
  border-radius: 12px;
}

.ms-r12b-document-message {
  border: 1px solid rgba(65,204,255,.18);
  background: rgba(24,155,230,.08);
}

.ms-r12b-document-error {
  border: 1px solid rgba(255,95,115,.34);
  background: rgba(255,70,90,.10);
}

.ms-r12b-document-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.ms-r12b-button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 12px;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.ms-r12b-button-primary {
  color: #fff;
  border-color: rgba(69,197,255,.44);
  background:
    linear-gradient(
      135deg,
      #087ee8,
      #15b8e8
    );
}

.ms-r12b-button-confirm {
  color: #071b15;
  border-color: rgba(102,255,195,.45);
  background:
    linear-gradient(
      135deg,
      #57e6a5,
      #82f4c5
    );
}

.ms-r12b-button-secondary {
  color: inherit;
  border-color: rgba(255,255,255,.15);
  background: rgba(255,255,255,.07);
}

.ms-r12b-button:disabled {
  opacity: .58;
  cursor: wait;
}

@media (max-width: 640px) {
  .ms-r12b-document-overlay {
    align-items: end;
    padding: 12px;
  }

  .ms-r12b-document-dialog {
    max-height: calc(100vh - 24px);
    padding: 16px;
    border-radius: 18px;
  }

  .ms-r12b-document-status {
    grid-template-columns: 1fr;
  }

  .ms-r12b-document-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .ms-r12b-button {
    width: 100%;
  }
}

[data-theme="light"]
.ms-r12b-document-dialog,
.theme-light
.ms-r12b-document-dialog {
  color: #10233c;
  border-color: rgba(27,116,194,.22);
  background:
    linear-gradient(
      145deg,
      rgba(255,255,255,.99),
      rgba(240,247,255,.99)
    );
  box-shadow:
    0 24px 60px rgba(35,74,110,.20);
}

[data-theme="light"]
.ms-r12b-document-status > div,
.theme-light
.ms-r12b-document-status > div {
  border-color: rgba(24,85,145,.12);
  background: rgba(20,101,185,.045);
}

[data-theme="light"]
.ms-r12b-document-status span,
.theme-light
.ms-r12b-document-status span {
  color: #5a6c82;
}

[data-theme="light"]
.ms-r12b-button-secondary,
.theme-light
.ms-r12b-button-secondary {
  color: #17314e;
  border-color: rgba(24,85,145,.16);
  background: rgba(20,101,185,.06);
}
/* OMNIA_R12B_QUOTATION_PI_UI_END */

/* R15 uses the existing offer form geometry and Foundation surface tokens. */
[data-r15-terms]{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
[data-r15-terms] label{min-width:0}
[data-r15-terms] button{min-height:44px;margin:4px 4px 0 0}
[data-r15-terms] input,[data-r15-terms] textarea{box-sizing:border-box;width:100%;max-width:100%;color:inherit;background:var(--ms-surface);border:1px solid var(--ms-border);border-radius:8px;padding:10px}
.ms-r10-offer-actions{flex-wrap:wrap}
.ms-astra-commercial-mail{display:grid;gap:10px;min-width:0;max-width:100%;overflow-wrap:anywhere}
.ms-astra-commercial-mail label{display:grid;gap:4px;min-width:0}
.ms-astra-commercial-mail input:not([type=checkbox]),.ms-astra-commercial-mail textarea{width:100%;max-width:100%;box-sizing:border-box;color:inherit;background:var(--ms-surface);min-height:44px}
.ms-astra-commercial-mail button,[data-commercial-post-save] button{min-height:44px}
@media(max-width:600px){[data-r15-terms]{grid-template-columns:minmax(0,1fr)}}
/* Scoped containment for the shared toolbar inside the commercial form. */
.ms-r10-offer-dialog{box-sizing:border-box;min-width:0}
.ms-r10-offer-dialog .ms-canonical-toolbar,.ms-r10-offer-dialog .ms-canonical-toolbar-actions{min-width:0;max-width:100%;flex-wrap:wrap}
.ms-r10-offer-dialog .ms-canonical-toolbar-search[hidden]{display:none}
.ms-r10-offer-dialog [data-r15-terms] .ms-canonical-toolbar{padding:0}
.ms-r10-offer-dialog .ms-canonical-toolbar-button{min-height:44px}
@media(max-width:640px){.ms-r10-offer-actions{display:flex;flex-wrap:wrap}.ms-r10-offer-actions>.ms-canonical-toolbar{width:100%}}

[data-r2-section-order] { display:grid; gap:10px; min-width:0; }
[data-r2-section-order] label { grid-template-columns:minmax(0,1fr) 72px; align-items:center; }
[data-r2-section-order] span { overflow-wrap:anywhere; }
.commercial-document-price-display { display:flex; flex-wrap:wrap; gap:8px; align-items:center; margin-top:8px; font-size:12px; }
.commercial-document-price-display select { max-width:100%; min-height:36px; color:inherit; background:var(--ms-surface); border:1px solid var(--ms-border); border-radius:6px; }
[data-r3-governance],.ms-r3-config-form {display:grid;gap:12px;min-width:0}
[data-r3-governance] input {width:100%;box-sizing:border-box;min-width:0;min-height:40px;font:inherit;color:inherit;background:var(--ms-surface);border:1px solid var(--ms-border);border-radius:8px}
[data-r3-governance] input[type=checkbox] {width:24px}
[data-r3-block-order] label {grid-template-columns:minmax(0,1fr) 72px;align-items:center}
.ms-r3-commission {display:grid;gap:8px;border-top:1px solid var(--ms-border);padding:10px 0}
[data-r3-governance] summary {cursor:pointer;padding:12px 0}
.ms-template-choice-field{display:grid;gap:8px;min-width:0;width:100%;font-weight:600}
.ms-template-choice-field select{box-sizing:border-box;display:block;width:100%;max-width:100%;min-width:0;min-height:44px;padding:10px 12px;border:1px solid var(--ms-border);border-radius:10px;background:var(--ms-surface);color:inherit;font:inherit;text-overflow:ellipsis}
.ms-template-choice-field select:focus-visible{outline:2px solid var(--ms-accent,#2363c9);outline-offset:2px}
[data-r5-template-section]{display:grid;gap:10px;min-width:0}
[data-r5-template-status]{overflow-wrap:anywhere;min-width:0}

/* OMNIA_OFFER_DESIGN_R4_DIALOGS — local overlays only, never global theme. */
.ms-r10-offer-dialog,.ms-r12b-document-dialog,.commercial-discount-dialog {
  color:#10264b !important;background:#fff !important;border:1px solid #dce6f3 !important;
  border-radius:16px !important;box-shadow:0 12px 40px rgba(16,38,75,.12) !important;
}
.ms-r10-offer-dialog :is(input,select,textarea),.ms-r12b-document-dialog :is(input,select,textarea),.commercial-discount-dialog :is(input,select) {
  color:#10264b !important;background:#f8fbff !important;border-color:#dce6f3 !important;border-radius:8px !important;
}
.ms-r10-offer-dialog .ms-r10-primary,.ms-r12b-document-dialog .ms-r12b-primary,.commercial-discount-dialog .commercial-discount-dialog-save {
  color:#fff !important;background:#1765d8 !important;border-color:#1765d8 !important;
}

/* Keep the canonical template command before the product/document fields. */
.ms-r10-offer-template {display:flex;flex-wrap:wrap;align-items:center;gap:12px;margin-top:16px;min-width:0}
.ms-r10-offer-template output {min-width:0;overflow-wrap:anywhere;flex:1 1 180px}
.ms-r10-offer-template button {min-height:44px;max-width:100%;white-space:normal;cursor:pointer}
@media(max-height:300px){
  .ms-r10-offer-overlay {padding:4px}
  .ms-r10-offer-dialog {max-height:calc(100vh - 8px);padding:8px}
}

/* The dialog owns scrolling; keep its mobile secondary commands in flow. */
@media(max-width:767px){
  .ms-r10-offer-dialog .ms-canonical-toolbar-overflow[open] > .ms-canonical-toolbar-secondary {
    position:static;left:auto;right:auto;top:auto;z-index:auto;max-height:none;
  }
}

/* R5.3C: the economic review owns the remaining height and both scroll axes. */
.ms-r10-offer-dialog.ms-r53-offer-review {width:min(1380px,100%);height:calc(100dvh - 48px);max-height:calc(100dvh - 48px);display:flex;flex-direction:column;overflow:hidden;box-sizing:border-box;padding:14px;gap:8px}
.ms-r53-offer-review > * {flex:none;min-width:0}
.ms-r53-offer-review > [data-document-price-modes] {flex:1;min-height:0;display:flex;flex-direction:column}
.ms-r53-offer-review [data-document-price-modes] h4 {margin:0;font-size:15px}
.ms-r53-offer-review [data-review-count] {font-size:12px}
.ms-r53-offer-review .ms-r10-offer-template {margin:0;gap:8px}
.ms-r53-document-details {order:-0;max-height:35%;overflow:auto;border:1px solid #dce6f3;border-radius:8px;padding:0 8px}
.ms-r53-document-details summary {cursor:pointer;padding:8px;font-weight:650}
.ms-r53-document-details .ms-r10-offer-grid {margin:0;padding:4px 0 8px;gap:8px}
.ms-r53-offer-review .ms-r10-offer-summary {margin:0;padding:6px 10px;gap:2px;font-size:12px}
.ms-r53-offer-review .ms-r10-offer-actions {margin:0;gap:6px}
.ms-r53-offer-review .ms-r10-offer-error {margin:0;padding:6px 10px;max-height:60px;overflow:auto}
.ms-r53-review-scroll {flex:1;min-height:0;max-width:100%;overflow:auto;margin-top:6px;border:1px solid #dce6f3;border-radius:8px}
.ms-r53-review-scroll:focus-visible {outline:2px solid #1765d8;outline-offset:2px}
.ms-r53-review-table {width:100%;min-width:1280px;border-collapse:separate;border-spacing:0;font-size:13px;line-height:1.4;color:#10264b}
.ms-r53-review-table caption {text-align:left;padding:6px 8px;font-weight:650}
.ms-r53-review-table th,.ms-r53-review-table td {padding:7px 8px;border-bottom:1px solid #dce6f3;vertical-align:top;text-align:left}
.ms-r53-review-table thead th,.ms-r53-line-group th,.ms-r53-product-subtotal {background:#f8fbff}
.ms-r53-review-table thead th {position:sticky;top:0;z-index:2;white-space:nowrap}
.ms-r53-review-table .ms-r53-numeric {text-align:right;white-space:nowrap;font-variant-numeric:tabular-nums}
.ms-r53-review-table [data-review-field=code] {white-space:nowrap;min-width:120px}
.ms-r53-review-table .ms-r53-description {min-width:300px;white-space:pre-line;overflow-wrap:break-word;font-weight:400}
.ms-r53-review-table select {width:100%;min-width:160px;min-height:44px;font:inherit;padding:6px;box-sizing:border-box}
.ms-r53-review-table tfoot {font-weight:700}
.ms-r53-review-table tfoot th,.ms-r53-review-table tfoot td {position:sticky;bottom:0;z-index:2;background:#eef4fc;border-top:1px solid #c5d6ec}
.ms-r53-zero-price td {background:#fff9e9}
.ms-r53-zero-price [data-review-field=net-price] {box-shadow:inset 3px 0 #d7ad51}
.ms-r53-subtotal-help {margin:4px 0 0;font-size:12px;line-height:1.3}
@media(max-width:640px){
 .ms-r10-offer-overlay:has(.ms-r53-offer-review) {padding:8px}
 .ms-r10-offer-dialog.ms-r53-offer-review {padding:8px;height:calc(100dvh - 16px);max-height:calc(100dvh - 16px);gap:5px}
 .ms-r53-offer-review .ms-r10-offer-head h3 {font-size:16px}
 .ms-r53-offer-review .ms-r10-offer-head p {font-size:12px}
 .ms-r53-offer-review .ms-r10-offer-summary span {font-size:11px}
 .ms-r53-offer-review .ms-r10-offer-template {font-size:12px}
}

/* Owner template action shares the existing template section and confirmation dialog. */
.ms-template-owner-action{box-sizing:border-box;justify-self:start;max-width:100%;min-height:44px;padding:10px 16px;border:1px solid var(--ms-border);border-radius:10px;background:var(--ms-surface);color:inherit;font:inherit;font-weight:600;white-space:normal;cursor:pointer}
.ms-template-owner-action:focus-visible{outline:2px solid var(--ms-accent,#2363c9);outline-offset:2px}
.ms-template-owner-action:disabled{opacity:.65;cursor:default}
.ms-template-owner-action[hidden],[data-quotation-form-status][hidden]{display:none}
[data-quotation-form-status]{display:block;min-width:0;overflow-wrap:anywhere;font-size:13px;line-height:1.5}
@media(max-width:640px){.ms-template-owner-action{width:100%;justify-self:stretch}}
