/* Coop App v10: aligned mobile order actions + friendly cutoff dates + polished SCM editor. */
.scm-order-edit-actions {display:flex; flex-direction:column; gap:5px; margin-top:10px; padding-top:9px; border-top:1px solid var(--border, #e4e7e9); align-items:flex-start;}
.scm-order-edit-row {display:flex; align-items:center; gap:8px; flex-wrap:wrap;}
.scm-order-edit-row-locked {align-items:flex-start;}
.scm-order-edit-line {font:inherit; color:#fff; background:#168048; border:0; border-radius:9px; padding:8px 12px; font-size:13px; font-weight:600; cursor:pointer;}
.scm-order-edit-line:hover {background:#126b3c;}
.scm-order-edit-line:focus-visible,.scm-order-edit-help:focus-visible,.swal2-popup .scm-order-edit-step:focus-visible,.swal2-popup .scm-order-edit-input:focus-visible {outline:2px solid #168048; outline-offset:3px;}
.scm-order-edit-help {width:24px; height:24px; min-width:24px; border:1px solid #cfd5db; border-radius:999px; background:#fff; color:#5f6b76; font-size:14px; font-weight:700; line-height:1; display:inline-flex; align-items:center; justify-content:center; cursor:pointer; padding:0;}
.scm-order-edit-help:hover {background:#f5f7f8; color:#32414f;}
.scm-order-edit-cutoff,.scm-order-edit-locked {font-size:12px;line-height:1.35;color:var(--muted,#6b7280);}

.swal2-popup.scm-order-edit-popup {padding-bottom:1.2rem;}
.swal2-popup .scm-order-edit-modal {max-width:380px; margin:0 auto; text-align:center;}
.swal2-popup .scm-order-edit-product {margin:0 0 6px; font-size:16px; line-height:1.4; font-weight:600; color:#2c343b;}
.swal2-popup .scm-order-edit-meta {margin:0 0 14px; font-size:13px; line-height:1.4; color:#66727d;}
.swal2-popup .scm-order-edit-quantity {display:flex; align-items:center; justify-content:center; gap:10px; max-width:260px; margin:0 auto 10px;}
.swal2-popup .scm-order-edit-step {flex:0 0 42px; width:42px; height:42px; border:1px solid #d8dfe5; background:#f4f7f5; color:#168048; border-radius:12px; font-size:28px; font-weight:700; line-height:1; cursor:pointer; padding:0; box-shadow:none; display:inline-flex; align-items:center; justify-content:center;}
.swal2-popup .scm-order-edit-step:hover {background:#ecf5ef; border-color:#bfd3c4;}
.swal2-popup .scm-order-edit-step-minus {padding-bottom:3px;}
.swal2-popup .scm-order-edit-input-wrap {flex:0 0 110px; min-width:110px;}
.swal2-popup .scm-order-edit-input {width:100%; height:42px; margin:0; padding:0 10px; border:1px solid #d8dfe5; border-radius:12px; background:#fff; color:#2c343b; text-align:center; font-size:20px; font-weight:700; box-sizing:border-box; appearance:textfield; -moz-appearance:textfield;}
.swal2-popup .scm-order-edit-input::-webkit-outer-spin-button,
.swal2-popup .scm-order-edit-input::-webkit-inner-spin-button {appearance:none; -webkit-appearance:none; margin:0;}
.swal2-popup .scm-order-edit-hint {display:block; max-width:330px; margin:0 auto; font-size:12px; line-height:1.45; color:#6b7280;}

.swal2-popup .scm-coop-help {text-align:left; color:#384047;}
.swal2-popup .scm-coop-help-lead {margin:0 0 12px; line-height:1.5;}
.swal2-popup .scm-coop-help-important {margin:0 0 14px; padding:12px 14px; border-radius:12px; background:#f6fbf4; border:1px solid #d8ead4;}
.swal2-popup .scm-coop-help-important h3,
.swal2-popup .scm-coop-help-subtitle {margin:0 0 8px; font-size:16px; line-height:1.3; color:#163b1d;}
.swal2-popup .scm-coop-help-important p,
.swal2-popup .scm-coop-help-finale {margin:0; line-height:1.5;}
.swal2-popup .scm-coop-help-important p + p,
.swal2-popup .scm-coop-help-steps + .scm-coop-help-finale {margin-top:8px;}
.swal2-popup .scm-coop-help-steps {margin:0 0 12px 18px; padding:0; display:grid; gap:8px;}
.swal2-popup.scm-coop-help-popup {padding-bottom:1.25rem;}

html[data-coop-theme="dark"] body#coop-modern:not(.coop-modern-admin) .scm-order-edit-help {background:#20262c; border-color:#47545f; color:#d7e0e7;}
html[data-coop-theme="dark"] body#coop-modern:not(.coop-modern-admin) .scm-order-edit-help:hover {background:#2a3239; color:#ffffff;}
html[data-coop-theme="dark"] .swal2-popup .scm-order-edit-product {color:#eef3f7;}
html[data-coop-theme="dark"] .swal2-popup .scm-order-edit-meta,
html[data-coop-theme="dark"] .swal2-popup .scm-order-edit-hint {color:#c2ccd4;}
html[data-coop-theme="dark"] .swal2-popup .scm-order-edit-step {background:#1d242a; border-color:#46525d; color:#7ed29a;}
html[data-coop-theme="dark"] .swal2-popup .scm-order-edit-step:hover {background:#263039;}
html[data-coop-theme="dark"] .swal2-popup .scm-order-edit-input {background:#151b20; border-color:#46525d; color:#eef3f7;}
html[data-coop-theme="dark"] .swal2-popup .scm-coop-help {color:#e4edf3;}
html[data-coop-theme="dark"] .swal2-popup .scm-coop-help-important {background:#142019; border-color:#274032;}
html[data-coop-theme="dark"] .swal2-popup .scm-coop-help-important h3,
html[data-coop-theme="dark"] .swal2-popup .scm-coop-help-subtitle {color:#9ae0ac;}

@media (max-width:480px) {
  .swal2-popup.scm-order-edit-popup {width:calc(100% - 24px) !important;}
  .swal2-popup .scm-order-edit-modal {max-width:none;}
  .swal2-popup .scm-order-edit-quantity {gap:8px; max-width:100%;}
  .swal2-popup .scm-order-edit-step {flex-basis:40px; width:40px; height:40px; border-radius:10px; font-size:25px;}
  .swal2-popup .scm-order-edit-input-wrap {flex-basis:96px; min-width:96px;}
  .swal2-popup .scm-order-edit-input {height:40px; font-size:19px;}
  .swal2-popup.scm-coop-help-popup {width:calc(100% - 24px) !important;}
}



/* v10.1 repaired: two fixed button columns, with ALL labels on their own rows.
   The SCM history renderer may PREPEND an 'Есть изменения' badge before
   the native '1 поз.' span: both must span both columns, or buttons jump. */
.scm-order-edit-actions { width: 100%; align-items: stretch; }
.scm-order-edit-row { width: 100%; align-items: center; flex-wrap: nowrap; }
.scm-order-edit-line { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; white-space: nowrap; }

@media (max-width: 600px) {
  body#coop-modern #orders-screen .order-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    column-gap: 12px;
    row-gap: 6px;
  }
  body#coop-modern #orders-screen .order-amount { min-width: 84px; text-align: right; }

  body#coop-modern #orders-screen .order-sub {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    align-items: stretch;
    justify-content: stretch;
  }
  /* Badge + position count each occupy a separate full row.
     This is essential when order-changes.js prepends .oc-change-badge. */
  body#coop-modern #orders-screen .order-sub > span,
  body#coop-modern #orders-screen .order-sub > .oc-change-zero-label {
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
    margin: 0;
  }
  body#coop-modern #orders-screen .order-sub > .order-actions {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    width: 100%;
    min-width: 0;
  }
  body#coop-modern #orders-screen .order-sub > .modern-transfer-button { grid-column: 1; }
  body#coop-modern #orders-screen .order-sub > .order-open-btn { grid-column: 2; }
  body#coop-modern #orders-screen .order-sub > .order-open-btn:only-of-type { grid-column: 1 / -1; }
  body#coop-modern #orders-screen .order-sub > .order-edit-btn:only-of-type { grid-column: 1 / -1; }

  body#coop-modern #orders-screen .order-open-btn,
  body#coop-modern #orders-screen .order-edit-btn,
  body#coop-modern #orders-screen .modern-transfer-button {
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 56px;
    margin: 0;
    padding: 10px 9px;
    font-size: 13px;
    line-height: 1.3;
    text-align: center;
    white-space: normal;
    word-break: normal;
    overflow-wrap: normal;
    hyphens: none;
    border-radius: 10px;
  }
  .scm-order-edit-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 40px;
    gap: 10px;
  }
  .scm-order-edit-line {
    width: 100%;
    min-height: 44px;
    padding: 10px 14px;
    border-radius: 11px;
    font-size: 14px;
  }
  .scm-order-edit-help {
    width: 40px;
    height: 40px;
    min-width: 40px;
  }
}

/* v11: independent native child dialogs. They do not replace an open order SweetAlert. */
dialog.scm-native-modal {
  position: fixed;
  inset: 0;
  margin: auto;
  padding: 0;
  border: 0;
  box-sizing: border-box;
  width: min(560px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  max-height: calc(100dvh - 24px);
  overflow: hidden;
  border-radius: 20px;
  background: #fff;
  color: #26322c;
  box-shadow: 0 18px 64px rgba(14, 26, 19, .26);
  font: inherit;
}
dialog.scm-native-modal::backdrop {
  background: rgba(20, 26, 23, .52);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
.scm-native-modal .scm-native-shell {
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 24px);
  min-width: 0;
}
.scm-native-modal .scm-native-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 36px;
  align-items: start;
  column-gap: 12px;
  padding: 24px 24px 14px;
}
.scm-native-modal .scm-native-heading h2 {
  margin: 0;
  min-width: 0;
  font: inherit;
  font-size: 21px;
  line-height: 1.3;
  font-weight: 650;
  letter-spacing: -.02em;
}
.scm-native-modal .scm-native-close {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: #f1f4f1;
  color: #66756d;
  font-size: 27px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.scm-native-modal .scm-native-close:hover {background: #e8eee9; color: #273b2c;}
.scm-native-modal .scm-native-close:focus-visible,
.scm-native-modal .scm-native-confirm:focus-visible,
.scm-native-modal .scm-native-cancel:focus-visible,
.scm-native-modal .scm-order-edit-step:focus-visible,
.scm-native-modal .scm-order-edit-input:focus-visible {
  outline: 3px solid #278653;
  outline-offset: 2px;
}
.scm-native-modal .scm-native-footer {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 16px 24px 22px;
}
.scm-native-modal .scm-native-confirm,
.scm-native-modal .scm-native-cancel {
  min-width: 116px;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.scm-native-modal .scm-native-confirm {background: #17804a; color: #fff;}
.scm-native-modal .scm-native-confirm:hover {background: #126f40;}
.scm-native-modal .scm-native-cancel {background: #f4f6f5; border-color: #dce3dd; color: #37413b;}
.scm-native-modal .scm-native-cancel:hover {background: #e9efeb;}
.scm-native-modal .scm-native-confirm:disabled,
.scm-native-modal .scm-native-cancel:disabled {opacity: .6; cursor: progress;}

/* Cooperative explanation retains every paragraph and its own scroll area. */
.scm-coop-help-dialog .scm-coop-help-body {
  min-height: 0;
  overflow-y: auto;
  padding: 0 24px 4px;
  overscroll-behavior: contain;
}
.scm-coop-help-dialog .scm-coop-help {text-align: left; color: #384047; font-size: 14px; line-height: 1.5;}
.scm-coop-help-dialog .scm-coop-help-lead {margin: 0 0 12px;}
.scm-coop-help-dialog .scm-coop-help-important {margin: 0 0 14px; padding: 12px 14px; border: 1px solid #d8ead4; border-radius: 12px; background: #f6fbf4;}
.scm-coop-help-dialog .scm-coop-help-important h3,
.scm-coop-help-dialog .scm-coop-help-subtitle {margin: 0 0 8px; color: #163b1d; font-size: 16px; font-weight: 650; line-height: 1.3;}
.scm-coop-help-dialog .scm-coop-help-important p,
.scm-coop-help-dialog .scm-coop-help-finale {margin: 0; line-height: 1.5;}
.scm-coop-help-dialog .scm-coop-help-important p + p,
.scm-coop-help-dialog .scm-coop-help-steps + .scm-coop-help-finale {margin-top: 8px;}
.scm-coop-help-dialog .scm-coop-help-steps {margin: 0 0 12px 18px; padding: 0; display: grid; gap: 8px;}

/* Quantity controls keep the v9-v10 compact look while preserving the order. */
dialog.scm-order-edit-dialog {width: min(460px, calc(100vw - 24px));}
.scm-order-edit-dialog .scm-order-edit-modal {padding: 0 24px; text-align: center;}
.scm-order-edit-dialog .scm-order-edit-product {margin: 0 0 6px; color: #2c343b; font-size: 16px; line-height: 1.4; font-weight: 600;}
.scm-order-edit-dialog .scm-order-edit-meta {margin: 0 0 14px; color: #66727d; font-size: 13px; line-height: 1.4;}
.scm-order-edit-dialog .scm-order-edit-quantity {display: flex; align-items: center; justify-content: center; gap: 10px; max-width: 260px; margin: 0 auto 10px;}
.scm-order-edit-dialog .scm-order-edit-step {
  display: inline-flex; flex: 0 0 42px; align-items: center; justify-content: center;
  width: 42px; height: 42px; padding: 0; border: 1px solid #d8dfe5;
  border-radius: 12px; background: #f4f7f5; color: #168048;
  font: inherit; font-size: 27px; font-weight: 700; line-height: 1; cursor: pointer;
}
.scm-order-edit-dialog .scm-order-edit-step:hover {background: #ecf5ef; border-color: #bfd3c4;}
.scm-order-edit-dialog .scm-order-edit-step-minus {padding-bottom: 3px;}
.scm-order-edit-dialog .scm-order-edit-input-wrap {flex: 0 0 110px; min-width: 0;}
.scm-order-edit-dialog .scm-order-edit-input {
  box-sizing: border-box; width: 100%; height: 42px; margin: 0; padding: 0 10px;
  border: 1px solid #d8dfe5; border-radius: 12px; background: #fff; color: #2c343b;
  text-align: center; font: inherit; font-size: 20px; font-weight: 700;
  appearance: textfield; -moz-appearance: textfield;
}
.scm-order-edit-dialog .scm-order-edit-hint {display: block; max-width: 330px; margin: 0 auto; color: #6b7280; font-size: 12px; line-height: 1.45;}
.scm-order-edit-dialog .scm-order-edit-feedback {margin: 10px auto 0; font-size: 13px; line-height: 1.4; color: #af3333;}
.scm-order-edit-dialog .scm-order-edit-feedback:empty {display: none;}
.scm-order-edit-dialog .scm-order-edit-feedback.scm-is-success {color: #186b3a; font-weight: 600;}

html[data-coop-theme="dark"] dialog.scm-native-modal {
  background: #1f2924; color: #edf3ef;
}
html[data-coop-theme="dark"] .scm-native-modal .scm-native-close,
html[data-coop-theme="dark"] .scm-native-modal .scm-native-cancel {
  background: #303d35; border-color: #526155; color: #edf3ef;
}
html[data-coop-theme="dark"] .scm-native-modal .scm-native-close:hover,
html[data-coop-theme="dark"] .scm-native-modal .scm-native-cancel:hover {background: #39493f;}
html[data-coop-theme="dark"] .scm-coop-help-dialog .scm-coop-help {color: #e4edf3;}
html[data-coop-theme="dark"] .scm-coop-help-dialog .scm-coop-help-important {background: #142019; border-color: #274032;}
html[data-coop-theme="dark"] .scm-coop-help-dialog .scm-coop-help-important h3,
html[data-coop-theme="dark"] .scm-coop-help-dialog .scm-coop-help-subtitle {color: #9ae0ac;}
html[data-coop-theme="dark"] .scm-order-edit-dialog .scm-order-edit-product,
html[data-coop-theme="dark"] .scm-order-edit-dialog .scm-order-edit-input {color: #edf3ef;}
html[data-coop-theme="dark"] .scm-order-edit-dialog .scm-order-edit-meta,
html[data-coop-theme="dark"] .scm-order-edit-dialog .scm-order-edit-hint {color: #bbc9c0;}
html[data-coop-theme="dark"] .scm-order-edit-dialog .scm-order-edit-step {background: #303d35; border-color: #526155; color: #8bdfa5;}
html[data-coop-theme="dark"] .scm-order-edit-dialog .scm-order-edit-input {background: #18211b; border-color: #526155;}
html[data-coop-theme="dark"] .scm-order-edit-dialog .scm-order-edit-feedback.scm-is-success {color: #90e0a6;}

@media(max-width:480px) {
  .scm-native-modal .scm-native-heading {padding: 18px 16px 12px;}
  .scm-native-modal .scm-native-heading h2 {font-size: 19px;}
  .scm-native-modal .scm-native-footer {padding: 12px 16px 18px;}
  .scm-coop-help-dialog .scm-coop-help-body {padding: 0 16px 4px;}
  .scm-order-edit-dialog .scm-order-edit-modal {padding: 0 16px;}
  .scm-order-edit-dialog .scm-order-edit-quantity {gap: 8px;}
  .scm-order-edit-dialog .scm-order-edit-step {flex-basis: 40px; width: 40px; height: 40px;}
  .scm-order-edit-dialog .scm-order-edit-input-wrap {flex-basis: 96px;}
  .scm-order-edit-dialog .scm-order-edit-input {height: 40px;}
}


/* Coop App v12: order fulfillment selector — same delivery policies as cart,
   but independent of line quantity and native child transfer dialogs. */
.of-method-anchor {min-width:0;}
.of-method-control {
  width:100%; box-sizing:border-box; display:grid; gap:12px;
  margin:12px 0 14px; padding:14px;
  border:1px solid #cfe3d5; border-radius:14px;
  background:#f7faf8; text-align:left;
}
.of-method-header {display:flex; justify-content:space-between; align-items:center;}
.of-method-header strong {font-size:14px; font-weight:700; color:#245238; line-height:1.4;}
.of-method-toggle {display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:6px; padding:4px;
  border:1px solid #d5e5da; border-radius:12px; background:#e9f2ec;}
.of-method-option {width:100%; min-width:0; min-height:44px; box-sizing:border-box;
  border:1px solid transparent; border-radius:9px; background:transparent; color:#42614c;
  font:inherit; font-size:14px; font-weight:600; line-height:1.2; text-align:center;
  white-space:normal; cursor:pointer;}
.of-method-option.is-selected {background:#fff; border-color:#aacdb7; color:#176641;
  box-shadow:0 1px 4px rgba(0,43,16,.08);}
.of-method-option:disabled {opacity:.52; cursor:default;}
.of-method-option.is-selected:disabled {opacity:1;}
.of-method-option:focus-visible,.of-method-save:focus-visible {outline:2px solid #168048;outline-offset:2px;}
.of-method-note {display:block; font-size:12px; line-height:1.45; color:#6c786d;}
.of-method-footer {display:flex; justify-content:center;}
.of-method-save {display:inline-flex; align-items:center; justify-content:center;
  min-height:44px; width:100%; box-sizing:border-box; padding:10px 18px;
  border:0; border-radius:11px; background:#18864b; color:#fff;
  font:inherit; font-size:14px; font-weight:650; line-height:1.25;
  text-align:center; cursor:pointer;}
.of-method-save:hover:not(:disabled) {background:#106a3a;}
.of-method-save:disabled {opacity:.55;cursor:default;}
.of-method-feedback {font-size:12px; line-height:1.45; color:#92552a; margin:0; overflow-wrap:anywhere;}
.of-method-feedback:empty {display:none;}
.of-is-success .of-method-feedback {color:#176b42;}
.of-method-control.of-is-busy {opacity:.85;}
html[data-coop-theme="dark"] .swal2-popup .of-method-control {
  background:#1c2821; border-color:#335642; color:#e8f4e9;
}
html[data-coop-theme="dark"] .swal2-popup .of-method-header strong {color:#9bd3a9;}
html[data-coop-theme="dark"] .swal2-popup .of-method-toggle {background:#132017;border-color:#35513f;}
html[data-coop-theme="dark"] .swal2-popup .of-method-option {color:#adc8b4;}
html[data-coop-theme="dark"] .swal2-popup .of-method-option.is-selected {background:#33453a;color:#e7f9ec;border-color:#557661;}
html[data-coop-theme="dark"] .swal2-popup .of-method-note {color:#b1bfb5;}
html[data-coop-theme="dark"] .swal2-popup .of-method-feedback {color:#e8ba8a;}
html[data-coop-theme="dark"] .swal2-popup .of-is-success .of-method-feedback {color:#9edab1;}
@media(max-width:480px) {
  .of-method-control {padding:12px; margin:12px 0;gap:10px;border-radius:12px;}
  .of-method-option {min-height:44px;font-size:13px;}
  .of-method-save {font-size:13px;}
}
