:root {
  /* Палитра M.E.R.Y.O.S.A.B (обновлённая) */
  --msb-primary: #d40000;
  --msb-primary-dark: #a30000;
  --msb-secondary: #6b7280;
  --msb-accent: #ffb020;
  --msb-danger: #e11d48;
  --msb-light: #ffffff;
  --msb-dark: #050816;
  --msb-surface: #f7f7f8;
  --msb-border: #e1e1e1;
  --msb-radius: 14px;
  --msb-shadow: 0 18px 45px rgba(0, 0, 0, 0.28);
}

/* =========================================================
   ОБЁРТКА
   ========================================================= */
.msb-op-wrap {
  width: 100%;
  max-width: 1200px;
  margin: 24px auto;
  padding: 0 16px;
  box-sizing: border-box;
}

/* ===== Карточка формы ===== */
.msb-op-container {
  position: relative;
  border-radius: var(--msb-radius);
  overflow: hidden;

  /* «панель» на светлом фоне */
  background: radial-gradient(circle at 0% 0%, #ffffff, #f3f4f6 55%, #e5e7eb 100%);
  border: 1px solid rgba(15, 23, 42, 0.12);
  box-shadow: var(--msb-shadow);
}

/* лёгкий подсвет «под формой» */
.msb-op-container::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 0% 0%, rgba(212, 0, 0, 0.08), transparent 60%),
    radial-gradient(circle at 100% 100%, rgba(15, 23, 42, 0.18), transparent 55%);
  mix-blend-mode: multiply;
}

/* чтобы контент был сверху */
.msb-op-header,
.msb-op-form-container {
  position: relative;
  z-index: 1;
}

/* ===== Верхняя панель: логотип + ID заявки ===== */
.msb-op-header {
  padding: 14px 18px;
  background:
    radial-gradient(circle at 0% 0%, rgba(248, 113, 113, 0.55), transparent 55%),
    linear-gradient(135deg, #020617, #050816, #090e1a);
  color: var(--msb-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.35);
}

.msb-op-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.msb-op-logo {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--msb-primary), var(--msb-primary-dark));
  color: var(--msb-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 12px;
  text-transform: uppercase;
  text-align: center;
  line-height: 1.1;
  box-shadow:
    0 6px 16px rgba(0, 0, 0, 0.7),
    0 0 0 1px rgba(248, 250, 252, 0.14);
}

.msb-op-order-id {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid rgba(248, 250, 252, 0.35);
  background: rgba(15, 23, 42, 0.6);
  font-size: 12px;
  font-weight: 600;
  color: #f9fafb;
  white-space: nowrap;
  font-family: "JetBrains Mono", Consolas, monospace;
}

/* ===== Тело формы ===== */
.msb-op-form-container {
  padding: 20px 20px 22px;
  background: linear-gradient(180deg, var(--msb-surface), #ffffff);
}

/* Заголовок формы + счётчик фото */
.msb-op-form-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 12px;
  margin-bottom: 18px;
  border-bottom: 1px dashed var(--msb-border);
}

.msb-op-form-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--msb-dark);
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.02em;
}

.msb-op-form-title::before {
  content: "";
  width: 4px;
  height: 18px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--msb-primary), #ff6b1a);
}

.msb-op-photo-count {
  font-size: 13px;
  color: var(--msb-secondary);
  padding: 4px 10px;
  border-radius: 999px;
  background: #e5e7eb;
}

/* Группы полей */
.msb-op-form-group {
  margin-bottom: 18px;
}

.msb-op-form-label {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 14px;
  color: var(--msb-dark);
}

.msb-op-required {
  color: var(--msb-danger);
  font-weight: 700;
}

/* Инпуты / селекты / textarea */
.msb-op-form-control {
  width: 100%;
  padding: 10px 12px;
  border-radius: 9px;
  border: 1px solid var(--msb-border);
  background: rgba(255, 255, 255, 0.96);
  font-size: 14px;
  line-height: 1.4;
  color: var(--msb-dark);
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease,
    transform 0.08s ease;
  box-sizing: border-box;
}

.msb-op-form-control::placeholder {
  color: #9ca3af;
}

.msb-op-form-control:focus {
  outline: none;
  border-color: var(--msb-primary);
  box-shadow:
    0 0 0 1px rgba(212, 0, 0, 0.55),
    0 0 0 6px rgba(212, 0, 0, 0.12);
  background: #ffffff;
  transform: translateY(-0.5px);
}

.msb-op-form-control.msb-op-error {
  border-color: var(--msb-danger);
  background: #fff5f7;
  box-shadow: 0 0 0 1px rgba(225, 29, 72, 0.3);
}

.msb-op-radio-group.msb-op-error .msb-op-radio-label {
  border-color: var(--msb-danger);
  box-shadow: 0 0 0 1px rgba(225, 29, 72, 0.2);
}

/* Блок "что нужно" + кнопка камеры справа */
.msb-op-need-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: flex-start;
}

.msb-op-need-textarea {
  min-height: 110px;
  resize: vertical;
}

/* Кнопка 📷 */
.msb-op-attach-btn {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.16);
  background: radial-gradient(circle at 30% 0%, #fee2e2, #ffffff);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 20px;
  color: var(--msb-primary);
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.35);
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    background 0.15s ease,
    color 0.15s ease;
}

.msb-op-attach-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.45);
  background: radial-gradient(circle at 30% 0%, #fecaca, #ffffff);
}

.msb-op-attach-btn:active {
  transform: translateY(0);
  box-shadow: 0 3px 8px rgba(15, 23, 42, 0.4);
}

/* Очистить фото + превью */
.msb-op-thumbs-bar {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
}

.msb-op-thumbnails {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 10px;
}

.msb-op-thumbnail {
  position: relative;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--msb-border);
  background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
}

.msb-op-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.msb-op-thumbnail-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: rgba(225, 29, 72, 0.98);
  color: #fff;
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.5);
}

/* Доставка */
.msb-op-radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.msb-op-radio {
  position: relative;
}

.msb-op-radio input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.msb-op-radio-label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid var(--msb-border);
  background: #ffffff;
  font-size: 13px;
  font-weight: 500;
  color: var(--msb-dark);
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    transform 0.1s ease,
    box-shadow 0.15s ease;
}

.msb-ship-icon {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.msb-ship-icon-air {
  background: #fef2f2;
}

.msb-ship-icon-car {
  background: #f3f4ff;
}

.msb-ship-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.msb-ship-main {
  font-size: 13px;
  font-weight: 700;
}

.msb-ship-sub {
  font-size: 11px;
  color: var(--msb-secondary);
}

.msb-op-radio input:checked + .msb-op-radio-label {
  background: #ffe6e6;
  border-color: var(--msb-primary);
  color: var(--msb-primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(212, 0, 0, 0.4);
}

/* Сетка контактов */
.msb-op-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.msb-op-form-hint {
  margin-top: 4px;
  font-size: 12px;
  color: var(--msb-secondary);
}

/* Кнопки */
.msb-op-buttons {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px dashed var(--msb-border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.msb-op-button {
  padding: 10px 22px;
  border-radius: 999px;
  border: none;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    background 0.15s ease,
    color 0.15s ease;
  white-space: nowrap;
}

.msb-op-button-primary {
  background: linear-gradient(135deg, var(--msb-primary), var(--msb-primary-dark));
  color: #ffffff;
  box-shadow: 0 5px 14px rgba(212, 0, 0, 0.65);
}

.msb-op-button-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 7px 18px rgba(212, 0, 0, 0.75);
}

.msb-op-button-primary:active {
  transform: translateY(0);
  box-shadow: 0 3px 10px rgba(212, 0, 0, 0.7);
}

.msb-op-button-ghost {
  background: transparent;
  color: var(--msb-secondary);
  border: 1px solid var(--msb-border);
}

.msb-op-button-ghost:hover {
  background: #f3f4f6;
  color: var(--msb-dark);
}

/* Успех */
.msb-op-success {
  margin-top: 18px;
  margin-bottom: 4px;
  padding: 14px 14px;
  border-radius: 12px;
  background: #ecfdf3;
  border: 1px solid #4ade80;
}

.msb-op-success-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.msb-op-success-icon {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: #22c55e;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 16px;
}

.msb-op-success-title {
  font-size: 15px;
  font-weight: 700;
  color: #166534;
}

.msb-op-success-message {
  font-size: 13px;
  color: #14532d;
  line-height: 1.4;
}

/* Toast */
.msb-op-toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: 320px;
  background: #111827;
  color: #f9fafb;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 9999;
}

.msb-op-toast.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.msb-op-toast.success {
  background: #15803d;
}

.msb-op-toast.error {
  background: #b91c1c;
}

.msb-op-toast.info {
  background: #374151;
}

/* Honeypot */
.msb-op-hp {
  display: none !important;
}

/* =========================================================
   МОБИЛКА
   ========================================================= */
@media (max-width: 768px) {

  .msb-op-wrap.msb-op-auto,
  .msb-op-wrap.msb-op-fullwidth {
    max-width: 100vw !important;
    width: 100vw !important;
    margin-left: calc(50% - 50vw) !important;
    margin-right: calc(50% - 50vw) !important;
    padding: 0 !important;
    overflow-x: hidden;
  }

  .msb-op-wrap.msb-op-auto .msb-op-container,
  .msb-op-wrap.msb-op-fullwidth .msb-op-container {
    padding-left: max(0.1rem, env(safe-area-inset-left));
    padding-right: max(0.1rem, env(safe-area-inset-right));
    border-radius: 0;
  }

  .msb-op-container {
    border-radius: 10px;
  }

  .msb-op-header {
    padding: 10px 12px;
    flex-direction: row;
    justify-content: space-between;
    gap: 8px;
  }

  .msb-op-logo {
    width: 46px;
    height: 46px;
    font-size: 11px;
  }

  .msb-op-order-id {
    font-size: 11px;
    padding: 4px 10px;
  }

  .msb-op-form-container {
    padding: 14px;
  }

  .msb-op-form-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .msb-op-form-title {
    font-size: 16px;
  }

  .msb-op-photo-count {
    font-size: 12px;
  }

  .msb-op-form-label {
    font-size: 13px;
  }

  .msb-op-form-control {
    font-size: 13px;
    padding: 9px 11px;
  }

  .msb-op-need-row {
    grid-template-columns: 1fr;
  }

  .msb-op-attach-btn {
    width: 100%;
    height: 42px;
    font-size: 18px;
  }

  .msb-op-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .msb-op-radio-group {
    flex-direction: column;
    align-items: stretch;
  }

  .msb-op-radio-label {
    width: 100%;
    justify-content: flex-start;
    font-size: 12px;
    padding: 8px 12px;
  }

  .msb-ship-icon {
    width: 26px;
    height: 26px;
    font-size: 15px;
  }

  .msb-ship-main {
    font-size: 13px;
  }

  .msb-ship-sub {
    font-size: 10px;
  }

  .msb-op-buttons {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .msb-op-button {
    width: 100%;
    font-size: 13px;
    padding: 9px 18px;
  }

  .msb-op-success-title {
    font-size: 14px;
  }

  .msb-op-success-message {
    font-size: 12px;
  }

  .msb-op-toast {
    left: 12px;
    right: 12px;
    max-width: none;
    font-size: 12px;
    padding: 9px 12px;
  }
}
