/* ════════════════════════════════════════
   ADD PRODUCT PAGE
════════════════════════════════════════ */

#page-add-product {
  max-width: 100%;
}
#page-add-product.active {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 56px);
  overflow: hidden;
  /* Перекрываем паддинги hub-page */
  padding: 1.25rem 0.5rem 0 0.5rem;
}

/* ── Три колонки: ОПТ | стрелка | РОЗНИЦА | БОТЫ ── */
.ap-page {
  display: grid;
  grid-template-columns: 380px 28px 380px fit-content(260px);
  gap: 0;
  align-items: stretch;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 12px;
}

/* ── Колонки ── */
.ap-col { display: flex; flex-direction: column; height: 100%; }
.ap-col-opt { align-self: stretch; }
.ap-col-ret { align-self: stretch; }
.ap-arrow { align-self: start; }

.ap-col-opt { align-self: stretch; }
.ap-col-ret { align-self: stretch; }

.ap-col-bots { padding-left: 8px; align-self: start; width: fit-content; }

/* ── Заголовки карточек ── */
.ap-card-hdr {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 13px;
  border-radius: 10px 10px 0 0;
}
.ap-hdr-opt  { background: linear-gradient(135deg, #4caf50, #1e6b1e); border: 2px solid #4caf50; border-bottom: none; }
.ap-hdr-ret  { background: linear-gradient(135deg, #c8a820, #a07810); border: 2px solid #c8a820; border-bottom: none; }
.ap-hdr-bots { background: linear-gradient(135deg, #4caf50, #1e6b1e); border: 2px solid #4caf50; border-bottom: none; }

.ap-hdr-icon {
  width: 28px; height: 28px; border-radius: 6px;
  background: rgba(255,255,255,.2);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.ap-hdr-icon svg { width: 14px; height: 14px; }
.ap-hdr-title { font-family: 'Unbounded', sans-serif; font-size: 10px; font-weight: 700; color: #fff; flex: 1; }
.ap-hdr-badge { font-size: 9px; font-weight: 700; padding: 2px 6px; border-radius: 4px; background: rgba(255,255,255,.2); color: #fff; }

/* ── Тело карточек ── */
.ap-card-body {
  background: var(--white);
  border-left: 2px solid #4caf50;
  border-right: 2px solid #4caf50;
  flex: 1;
}
.ap-col-ret .ap-card-body {
  border-color: #c8a820;
}
.ap-col-bots .ap-card-body {
  border-color: #4caf50;
  border-bottom: 2px solid #4caf50;
  border-radius: 0 0 10px 10px;
}

/* ── Строки внутри карточки ── */
.ap-row {
  padding: 7px 12px;
  border-bottom: 1px solid var(--border);
}
.ap-col-ret .ap-row { border-bottom-color: rgba(200,168,32,.2); }
.ap-row-last { border-bottom: none; }
.ap-row-muted {
  background: #fffbee;
  color: #a07810; font-size: 10px; opacity: .7;
  text-align: center; line-height: 1.6;
  display: flex; align-items: center; justify-content: center;
}
.ap-col-opt .ap-row-muted { background: var(--green-pale2); color: var(--green-dark); }

/* Секции */
.ap-sec-row {
  background: var(--green-pale2);
  border-top: 1px solid var(--border-mid);
  border-bottom: none;
  padding: 5px 12px;
  min-height: unset;
}
.ap-sec-gold { background: #fffbee; border-top-color: rgba(200,168,32,.3); }
.ap-sect {
  font-size: 9px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .12em;
  display: flex; align-items: center; justify-content: space-between;
}
.ap-sect-gold { color: #a07810; }
.ap-sect-rst {
  background: none; border: 1px solid var(--border); border-radius: 4px;
  color: var(--text-muted); font-size: 9px; padding: 1px 6px;
  cursor: pointer; font-family: inherit; transition: all .15s;
}
.ap-sect-rst:hover { border-color: rgba(239,68,68,.4); color: #c0392b; }

/* ── Поля ── */
.ap-f { margin-bottom: 5px; }
.ap-f:last-child { margin-bottom: 0; }
.ap-fl { font-size: 10px; color: var(--text-muted); margin-bottom: 2px; font-weight: 500; }
.ap-fv {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 6px; padding: 5px 8px; font-size: 12px;
  color: var(--text); width: 100%;
  font-family: 'Golos Text', sans-serif; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.ap-fv:focus { border-color: #4caf50; box-shadow: 0 0 0 2px rgba(76,175,80,.1); background: var(--white); }
.ap-fv-ret:focus { border-color: #c8a820 !important; box-shadow: 0 0 0 2px rgba(200,168,32,.1) !important; }
.ap-fv::placeholder { color: var(--text-muted); opacity: .55; }
.ap-fv[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; }
.ap-fv[type=number] { -moz-appearance: textfield; }
.ap-fv-ta { resize: none; min-height: 40px; line-height: 1.4; }
.ap-r2 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.ap-r4 { display: grid; grid-template-columns: 1fr 2fr 0.7fr 1fr; gap: 5px; }
.ap-fv-auto {
  background: #fffbee; border: 1px solid rgba(200,168,32,.22);
  border-radius: 6px; padding: 5px 8px; font-size: 11px;
  color: #a07810; font-weight: 700; width: 100%;
  font-family: 'Golos Text', sans-serif; text-align: center;
}
.ap-sku-val {
  background: var(--green-pale); border: 1px solid var(--border-mid);
  border-radius: 6px; padding: 5px 8px; font-size: 11px;
  color: var(--green-dark); font-weight: 700; font-family: monospace;
}
.ap-sku-gold { background: #fdf6d8; border-color: rgba(200,168,32,.35); color: #a07810; }

/* ID + статус строка */
.ap-id-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ap-id-status-row { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; }
.ap-sr-inline { display: flex; gap: 3px; margin-left: auto; flex-shrink: 0; }
.ap-sr-inline .ap-sb { padding: 3px 8px; font-size: 10px; flex: unset; min-width: 62px; }
.ap-id-label { font-size: 10px; color: var(--text-muted); font-weight: 600; white-space: nowrap; }
.ap-id-sub { font-size: 9px; font-weight: 400; opacity: .7; }
.ap-id-input {
  width: 88px; background: var(--bg); border: 1px solid var(--border);
  border-radius: 6px; padding: 4px 8px; font-size: 12px; color: var(--text);
  font-family: 'Golos Text', sans-serif; outline: none;
}
.ap-id-input:focus { border-color: #4caf50; box-shadow: 0 0 0 2px rgba(76,175,80,.1); }
.ap-id-auto {
  padding: 3px 8px; background: var(--green-pale); border: 1px solid var(--border-mid);
  border-radius: 6px; font-size: 10px; font-weight: 700; color: var(--green-dark);
  cursor: pointer; transition: all .15s; white-space: nowrap;
}
.ap-id-auto:hover { background: #2d9e2d; color: #fff; }
.ap-id-hint { font-size: 10px; color: var(--text-muted); }

/* Статус */
.ap-sr { display: flex; gap: 4px; }
.ap-sb {
  flex: 1; padding: 5px; border-radius: 6px;
  font-family: 'Golos Text', sans-serif; font-size: 11px; font-weight: 700;
  cursor: pointer; border: 1px solid var(--border-mid);
  background: var(--bg); color: var(--text-muted);
  transition: all .15s; text-align: center;
}
.ap-sb.ap-pub { background: #4caf50; color: #fff; border-color: #4caf50; font-weight: 700; }
.ap-sb.ap-hid { background: #c8a820; color: #fff; border-color: #c8a820; font-weight: 700; }

/* Фото заглушка */
.ap-photos-stub {
  display: flex; align-items: center; gap: 8px;
  padding: 6px; background: var(--bg);
  border: 1.5px dashed var(--border-mid); border-radius: 8px;
}
.ap-photos-icon {
  width: 34px; height: 34px; border-radius: 7px;
  background: var(--green-pale); border: 1px solid var(--border-mid);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.ap-photos-icon svg { width: 15px; height: 15px; color: var(--text-muted); }
.ap-photos-text { flex: 1; }
.ap-photos-title { font-size: 10px; font-weight: 600; color: var(--text-muted); }
.ap-photos-sub { font-size: 9px; color: var(--text-muted); opacity: .7; }

/* Компактный вариант заглушки фото — одна строка без двухстрочного текста */
.ap-photos-stub-compact {
  padding: 5px 8px;
}
.ap-photos-stub-compact .ap-photos-icon {
  width: 22px;
  height: 22px;
}
.ap-photos-stub-compact .ap-photos-icon svg {
  width: 12px;
  height: 12px;
}
.ap-photos-stub-compact .ap-photos-title {
  font-size: 11px;
  line-height: 1.2;
}

/* Футер прижимается к низу карточки, если тело оказалось короче соседней колонки.
   Делаем это через margin-top:auto на футере — сетка .ap-page уже синхронизирует
   высоту колонок через height:100% на .ap-col и flex-column. */
.ap-col {
  display: flex;
  flex-direction: column;
}
.ap-card-footer {
  margin-top: auto;
}

/* Подвалы */
.ap-card-footer {
  padding: 7px 11px; display: flex; gap: 5px;
  background: var(--white); border-radius: 0 0 10px 10px;
}
.ap-footer-opt { border: 2px solid #4caf50; border-top: 1px solid var(--border); }
.ap-footer-ret { border: 2px solid #c8a820; border-top: 1px solid rgba(200,168,32,.2); }
.ap-btn-save-opt {
  flex: 1; padding: 7px;
  background: linear-gradient(135deg, #4caf50, #1e6b1e);
  color: #fff; font-family: 'Golos Text', sans-serif;
  font-size: 12px; font-weight: 700;
  border: none; border-radius: 7px; cursor: pointer; transition: opacity .15s;
}
.ap-btn-save-opt:hover { opacity: .9; }
.ap-btn-discard {
  padding: 7px 10px; background: var(--bg);
  border: 1px solid var(--border-mid); color: var(--text-muted);
  font-family: 'Golos Text', sans-serif; font-size: 11px;
  border-radius: 7px; cursor: pointer; transition: all .15s;
}
.ap-btn-discard:hover { border-color: rgba(239,68,68,.4); color: #c0392b; }

/* ── Стрелка ── */
.ap-arrow {
  display: flex; flex-direction: column;
  align-items: center; justify-content: flex-start;
  padding-top: 50px; gap: 4px;
  align-self: start;
}
.ap-copy-btn {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--white); border: 1.5px solid var(--border-mid);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all .18s;
  box-shadow: 0 2px 6px rgba(30,107,30,.1);
}
.ap-copy-btn:hover { border-color: #4caf50; background: var(--green-pale); transform: scale(1.1); }
.ap-copy-btn svg { width: 12px; height: 12px; color: var(--text-muted); }
.ap-copy-btn:hover svg { color: var(--green-dark); }
.ap-copy-lbl {
  font-size: 7px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .08em;
  writing-mode: vertical-rl; transform: rotate(180deg);
}

/* ── Блок БОТЫ ── */
.ap-bots-body {
  border: 2px solid #4caf50 !important;
  border-top: none !important;
  border-radius: 0 0 10px 10px;
  display: flex; flex-direction: column;
  height: auto !important;
  flex: none !important;
}

.ap-bots-groups {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--border);
}
.ap-bots-group-right {
  border-left: 1px solid var(--border);
}
.ap-bots-grp-hdr {
  display: flex; align-items: center; gap: 5px;
  padding: 5px 8px;
  font-size: 9px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em;
  border-bottom: 1px solid var(--border);
}
.ap-bots-grp-own { background: var(--green-pale2); color: var(--green-dark); border-bottom-color: var(--border-mid); }
.ap-bots-grp-partner { background: #fffbee; color: #a07810; border-bottom-color: rgba(200,168,32,.3); }
.ap-bots-grp-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.ap-bots-grp-dot-own { background: #4caf50; }
.ap-bots-grp-dot-partner { background: #c8a820; }

.ap-bot-row {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 8px; cursor: pointer;
  transition: background .1s;
  border-bottom: 1px solid var(--border);
}
.ap-bot-row:last-child { border-bottom: none; }
.ap-bot-row:hover { background: var(--green-pale2); }
.ap-bots-group-right .ap-bot-row:hover { background: #fffbee; }
.ap-bot-row input[type=checkbox] {
  width: 13px; height: 13px; flex-shrink: 0;
  accent-color: #4caf50; cursor: pointer;
}
.ap-bots-group-right .ap-bot-row input[type=checkbox] { accent-color: #c8a820; }
.ap-bot-icon {
  width: 20px; height: 20px; border-radius: 5px;
  background: linear-gradient(135deg, #4caf50, #1e6b1e);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.ap-bot-icon svg { width: 10px; height: 10px; }
.ap-bot-icon-gold { background: linear-gradient(135deg, #c8a820, #a07810); }
.ap-bot-name { font-size: 11px; font-weight: 600; color: var(--text); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-bot-type { font-size: 9px; font-weight: 700; padding: 2px 4px; border-radius: 4px; white-space: nowrap; }
.ap-bot-type-r { background: var(--green-pale); color: var(--green-dark); }
.ap-bot-type-p { background: #fdf6d8; color: #a07810; }
.ap-bot-empty { padding: 8px; font-size: 10px; color: var(--text-muted); text-align: center; }

.ap-confirm-sum {
  padding: 8px 10px;
  font-size: 11px; color: var(--text-mid); line-height: 1.6;
  min-height: 40px; background: var(--green-pale2);
  border-bottom: 1px solid var(--border);
}
.ap-confirm-sum b { color: var(--green-dark); font-weight: 700; }
.ap-confirm-empty { color: var(--text-muted); font-size: 10px; }
.ap-sum-divider { height: 1px; background: var(--border); margin: 3px 0; }

.ap-btn-confirm {
  width: 100%; padding: 9px;
  background: linear-gradient(135deg, #4caf50, #1e6b1e);
  color: #fff; font-family: 'Golos Text', sans-serif;
  font-size: 12px; font-weight: 700;
  border: none; border-radius: 0 0 8px 8px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: all .15s;
}
.ap-btn-confirm:hover { opacity: .9; }
.ap-btn-confirm:disabled { opacity: .35; cursor: not-allowed; }

/* ── Валидация — ошибки (как в боте) ── */
.ap-fv.ap-err {
  border-color: rgba(239,68,68,.6) !important;
  background: rgba(239,68,68,.05) !important;
}
.ap-err-hint {
  font-size: 10px;
  color: #f87171;
  margin-top: 2px;
  line-height: 1.3;
}

/* Обязательные поля — метка */
.ap-fl-req::after {
  content: ' *';
  color: #f87171;
  font-weight: 700;
}

/* ── Селект оптового бота в шапке ── */
.ap-opt-select {
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 6px;
  color: #fff;
  font-size: 10px; font-weight: 700;
  font-family: 'Golos Text', sans-serif;
  padding: 3px 22px 3px 7px;
  cursor: pointer; outline: none;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 5px center;
  max-width: 140px;
  transition: background-color .15s;
}
.ap-opt-select:hover { background-color: rgba(255,255,255,.28); }
.ap-opt-select option { background: #1e6b1e; color: #fff; font-size: 11px; }

/* ── Зеркальная строка ID в РОЗНИЦА ── */
.ap-row-id-mirror {
  background: #fffbee;
  min-height: 36px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid rgba(200,168,32,.2);
}
.ap-id-mirror-text {
  font-size: 10px; color: #a07810;
  opacity: .75; font-style: italic;
  white-space: nowrap;
}

/* ── Строка хинт + статус ── */
.ap-hint-status-row {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 4px; padding-bottom: 4px;
}
.ap-hint-status-gold { background: #fffbee; border-bottom-color: rgba(200,168,32,.2); }

/* Заглушка поля ID в РОЗНИЦА */
.ap-id-input-stub {
  width: 88px; background: var(--bg); border: 1px solid var(--border);
  border-radius: 6px; padding: 4px 8px; font-size: 12px;
  color: var(--text-muted); text-align: center; opacity: .4;
}


/* ── Строка ID + Арт. поставщика + Статус ── */
.ap-row-id-block {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: nowrap; padding: 6px 12px;
}
.ap-row-id-block-gold { background: #fffbee; border-bottom-color: rgba(200,168,32,.2); }
.ap-id-field {
  display: flex; flex-direction: column; gap: 1px;
  align-items: flex-start; min-width: 0; flex-shrink: 0;
}
.ap-id-field .ap-id-label { font-size: 9px; color: var(--text-muted); font-weight: 500; white-space: nowrap; }
.ap-id-sep { width: 1px; height: 28px; background: var(--border-mid); flex-shrink: 0; }
.ap-sku-num {
  font-size: 12px; font-weight: 700; font-family: monospace;
  color: var(--green-dark); line-height: 22px; min-height: 22px;
}
.ap-sku-num-gold { color: #a07810; }
.ap-sku-empty {
  display: inline-block; width: 64px; height: 22px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 5px;
}
.ap-sr-id { display: flex; gap: 3px; margin-left: auto; flex-shrink: 0; }
.ap-sr-id .ap-sb { padding: 3px 8px; font-size: 10px; flex: unset; min-width: 62px; }

/* ── Подсказка в лейбле ── */
.ap-fl-sub { font-size: 9px; font-weight: 400; opacity: .6; margin-left: 3px; }

/* ── Селект оптового бота ── */
.ap-opt-select {
  background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.35);
  border-radius: 6px; color: #fff; font-size: 10px; font-weight: 700;
  font-family: 'Golos Text', sans-serif; padding: 3px 22px 3px 7px;
  cursor: pointer; outline: none; -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 5px center;
  max-width: 140px; transition: background-color .15s;
}
.ap-opt-select:hover { background-color: rgba(255,255,255,.28); }
.ap-opt-select option { background: #1e6b1e; color: #fff; font-size: 11px; }

/* ── ID input без стрелок ── */
#ap-o-id { -moz-appearance: textfield; }
#ap-o-id::-webkit-inner-spin-button,
#ap-o-id::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* Блок ботов — высота строго по содержимому */
.ap-col-bots,
.ap-col-bots .ap-card-body,
.ap-col-bots .ap-bots-body {
  height: auto !important;
  flex: none !important;
  min-height: 0 !important;
}

/* ── Название бота — обрезать если длинное ── */
.ap-bot-name {
  font-size: 11px; font-weight: 600; color: var(--text);
  flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 140px;
}

/* ── Поле Название товара — textarea с авторастяжением ── */
.ap-fv-name {
  resize: none;
  overflow: hidden;
  line-height: 1.45;
  padding-top: 6px;
  padding-bottom: 6px;
  min-height: 38px;
  max-height: calc(1.45em * 2 + 12px);
}
.ap-fv-name:focus {
  overflow-y: auto;
}

/* ── Бот блок — высота по содержимому ── */
.ap-col-bots,
.ap-col-bots .ap-card-body,
.ap-col-bots .ap-bots-body {
  height: auto !important;
  flex: none !important;
  min-height: 0 !important;
}
.ap-bots-body {
  border: 2px solid #4caf50 !important;
  border-top: none !important;
  border-radius: 0 0 10px 10px;
}

/* ── Статус кнопки насыщенные ── */
.ap-sb.ap-pub { background: #4caf50; color: #fff; border-color: #4caf50; font-weight: 700; }
.ap-sb.ap-hid { background: #c8a820; color: #fff; border-color: #c8a820; font-weight: 700; }

/* ── Селект оптового бота ── */
.ap-opt-select {
  background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.35);
  border-radius: 6px; color: #fff; font-size: 10px; font-weight: 700;
  font-family: 'Golos Text', sans-serif; padding: 3px 22px 3px 7px;
  cursor: pointer; outline: none; -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 5px center;
  max-width: 140px; transition: background-color .15s;
}
.ap-opt-select:hover { background-color: rgba(255,255,255,.28); }
.ap-opt-select option { background: #1e6b1e; color: #fff; font-size: 11px; }

/* ── ID input без стрелок ── */
#ap-o-id { -moz-appearance: textfield; }
#ap-o-id::-webkit-inner-spin-button,
#ap-o-id::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* ── Строка ID + Арт. поставщика + Статус ── */
.ap-row-id-block {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: nowrap; padding: 6px 12px;
}
.ap-row-id-block-gold { background: #fffbee; border-bottom-color: rgba(200,168,32,.2); }
.ap-id-field { display: flex; flex-direction: column; gap: 1px; align-items: flex-start; min-width: 0; flex-shrink: 0; }
.ap-id-field .ap-id-label { font-size: 9px; color: var(--text-muted); font-weight: 500; white-space: nowrap; }
.ap-id-sep { display: none; }
.ap-sku-num { font-size: 12px; font-weight: 700; font-family: monospace; color: var(--green-dark); line-height: 22px; min-height: 22px; }
.ap-sku-num-gold { color: #a07810; }
.ap-sku-empty { display: inline-block; width: 64px; height: 22px; background: var(--bg); border: 1px solid var(--border); border-radius: 5px; }
.ap-sr-id { display: flex; gap: 3px; margin-left: auto; flex-shrink: 0; }
.ap-sr-id .ap-sb { padding: 3px 8px; font-size: 10px; flex: unset; min-width: 62px; }

/* ── Подсказка в лейбле ── */
.ap-fl-sub { font-size: 9px; font-weight: 400; opacity: .6; margin-left: 3px; }

/* ── align для колонок ── */
.ap-col { display: flex; flex-direction: column; height: 100%; }
.ap-col-opt { align-self: stretch; }
.ap-col-ret { align-self: stretch; }
.ap-arrow { align-self: start; }

/* ── Страница без скролла ── */
#page-add-product.active {
  display: flex; flex-direction: column;
  height: calc(100vh - 56px); overflow: hidden;
  padding: 1.25rem 0.5rem 0;
}
.ap-page {
  flex: 1; min-height: 0;
  overflow-y: auto; overflow-x: hidden;
  padding-bottom: 12px;
}

/* ── Блок фото РОЗНИЦА — зеркало ОПТ по высоте ── */
.ap-photos-stub-gold {
  background: #fffbee;
  border: 1.5px dashed rgba(200,168,32,.4);
}
.ap-photos-icon-gold {
  background: #fdf6d8;
  border-color: rgba(200,168,32,.3);
}
.ap-photos-icon-gold svg { color: #c8a820; }

/* Заглушка ID в рознице — точная высота как у input */
.ap-id-input-stub {
  display: inline-block;
  width: 72px;
  height: 28px; /* совпадает с ap-id-input */
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  opacity: .45;
}
/* Единая высота для ap-id-input */
.ap-id-input {
  height: 28px;
  box-sizing: border-box;
}

/* ── Футер опта: состояние "сохранён" ── */
.ap-saved-label {
  flex: 1;
  font-size: 12px; font-weight: 700;
  color: var(--green-dark);
  display: flex; align-items: center; gap: 5px;
}
.ap-btn-edit-opt {
  padding: 7px 14px;
  background: var(--white);
  border: 1.5px solid var(--green-main);
  color: var(--green-dark);
  font-family: 'Golos Text', sans-serif;
  font-size: 12px; font-weight: 600;
  border-radius: 7px; cursor: pointer;
  transition: all .15s;
}
.ap-btn-edit-opt:hover {
  background: var(--green-pale);
}

/* Поля опта в режиме readonly */
.ap-col-opt input[readonly],
.ap-col-opt textarea[readonly] {
  background: var(--bg);
  color: var(--text-muted);
  cursor: default;
  border-color: var(--border);
}
.ap-col-opt input[readonly]:focus,
.ap-col-opt textarea[readonly]:focus {
  border-color: var(--border);
  box-shadow: none;
}

/* ── Автодополнение категорий ── */
.ap-ac-drop {
  display: none;
  position: absolute;
  top: 100%; left: 0; right: 0;
  background: var(--white);
  border: 1.5px solid var(--green-main);
  border-radius: 0 0 8px 8px;
  box-shadow: 0 4px 16px rgba(30,107,30,.12);
  z-index: 200;
  max-height: 160px;
  overflow-y: auto;
}
.ap-ac-drop.open { display: block; }
.ap-ac-item {
  padding: 7px 10px;
  font-size: 12px; color: var(--text);
  cursor: pointer;
  transition: background .1s;
}
.ap-ac-item:hover { background: var(--green-pale); color: var(--green-dark); }

/* ════════════════════════════════════════
   ЭКРАН ИТОГОВ
════════════════════════════════════════ */
.ap-result-screen {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  align-items: start;
  overflow-y: auto;
  padding: 0 0 16px 0;
}

.apr-col {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: fit-content;
}

.apr-col-hdr {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  font-size: 12px; font-weight: 700; color: #fff;
}
.apr-hdr-opt  { background: linear-gradient(135deg, var(--green-main), var(--green-dark)); }
.apr-hdr-ret  { background: linear-gradient(135deg, #c8a820, #a07810); }
.apr-hdr-bots { background: linear-gradient(135deg, var(--green-main), var(--green-dark)); }

/* Фото */
.apr-photo-stub {
  width: 100%; aspect-ratio: 16/7;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  border-bottom: 1px solid var(--border);
}
.apr-photo-stub svg { width: 32px; height: 32px; color: var(--border-mid); }

/* Тело карточки */
.apr-body {
  padding: 12px 14px;
  display: flex; flex-direction: column; gap: 5px;
  flex: 1;
}
.apr-name {
  font-size: 13px; font-weight: 700; color: var(--text);
  line-height: 1.3;
}
.apr-meta {
  font-size: 11px; color: var(--text-muted);
}
.apr-sku {
  font-size: 11px; color: var(--text-muted);
  font-family: monospace;
}
.apr-price {
  font-size: 13px; font-weight: 700;
  color: var(--green-dark);
  background: var(--green-pale);
  padding: 4px 8px; border-radius: 6px;
  display: inline-block; align-self: flex-start;
}
.apr-col-ret .apr-price {
  color: #a07810;
  background: rgba(200,168,32,.12);
}
.apr-box {
  font-size: 11px; color: var(--text-muted);
}
.apr-date {
  font-size: 11px; color: var(--text-muted);
}
.apr-desc {
  font-size: 11px; color: var(--text-muted);
  line-height: 1.4;
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}
.apr-status {
  font-size: 10px; font-weight: 700;
  padding: 2px 8px; border-radius: 5px;
  align-self: flex-start;
}
.apr-status-pub { background: var(--green-pale); color: var(--green-dark); }
.apr-status-hid { background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); }

/* Боты */
.apr-bots-list {
  padding: 10px 12px;
  display: flex; flex-direction: column; gap: 6px;
}
.apr-bot-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12px;
}
.apr-bot-ok  { background: var(--green-pale); }
.apr-bot-err { background: #fff5f5; }
.apr-bot-icon {
  font-size: 13px; font-weight: 700;
  width: 18px; text-align: center;
}
.apr-bot-ok  .apr-bot-icon { color: var(--green-dark); }
.apr-bot-err .apr-bot-icon { color: #c0392b; }
.apr-bot-name { flex: 1; font-weight: 600; color: var(--text); }
.apr-bot-id {
  font-size: 11px; color: var(--text-muted);
  font-family: monospace;
}
.apr-bot-err-msg {
  font-size: 11px; color: #c0392b;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  text-align: right;
}

/* Кнопка «Повторить» в строке бота при ошибке */
.apr-bot-retry {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  margin-left: 8px;
  border-radius: 6px;
  border: 1px solid #fca5a5;
  background: #fff;
  color: #c0392b;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: .12s ease;
}
.apr-bot-retry:hover:not(:disabled) {
  background: #c0392b;
  color: #fff;
  border-color: #c0392b;
}
.apr-bot-retry:disabled {
  cursor: wait;
}

/* ── Диалог черновика ── */
.ap-dialog-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  border-radius: 12px;
}
.ap-dialog {
  background: var(--white);
  border-radius: 14px;
  padding: 24px 22px 20px;
  max-width: 360px;
  width: 90%;
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.ap-dialog-icon {
  display: flex; justify-content: center;
  color: #c8a820;
}
.ap-dialog-msg {
  font-size: 13px; color: var(--text);
  text-align: center; line-height: 1.5;
}
.ap-dialog-btns {
  display: flex; gap: 8px;
}
.ap-dialog-btn-sec {
  flex: 1; padding: 9px;
  background: var(--bg);
  border: 1px solid var(--border-mid);
  color: var(--text-mid);
  font-family: 'Golos Text', sans-serif;
  font-size: 12px; font-weight: 600;
  border-radius: 8px; cursor: pointer;
  transition: all .15s;
}
.ap-dialog-btn-sec:hover { border-color: var(--green-main); color: var(--green-dark); }
.ap-dialog-btn-pri {
  flex: 1; padding: 9px;
  background: linear-gradient(135deg, var(--green-main), var(--green-dark));
  border: none; color: #fff;
  font-family: 'Golos Text', sans-serif;
  font-size: 12px; font-weight: 700;
  border-radius: 8px; cursor: pointer;
  transition: opacity .15s;
}
.ap-dialog-btn-pri:hover { opacity: .9; }

/* ═══════════════════════════════════════════════════════════
   ДОБАВИТЬ ТОВАР — ФАЗА B (добавление ещё одного варианта розницы)
   ═══════════════════════════════════════════════════════════ */

/* Баннер над страницей в фазе B */
.ap-variant-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  margin: 0 0 14px 0;
  background: linear-gradient(90deg, var(--gold-pale) 0%, #fef9e0 100%);
  border: 1px solid var(--gold-light);
  border-left: 4px solid var(--gold);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}
.ap-variant-banner-icon {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gold);
  color: #fff;
  border-radius: 8px;
}
.ap-variant-banner-body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.ap-variant-banner-title {
  font-family: 'Unbounded', sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
}
.ap-variant-banner-sub {
  font-size: 12.5px;
  color: var(--text-mid);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ap-variant-banner-sub b {
  color: var(--gold);
  font-weight: 600;
}
.ap-variant-banner-close {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-mid);
  transition: .15s ease;
}
.ap-variant-banner-close:hover {
  border-color: #ef4444;
  color: #ef4444;
}

/* В фазе B: скрываем кнопку «Сбросить» на футере опта */
.ap-variant-mode .ap-footer-opt .ap-btn-discard {
  display: none;
}

/* В фазе B: колонка ОПТ чуть приглушена, намекая «зафиксировано» */
.ap-variant-mode .ap-col-opt {
  opacity: .92;
}

/* В фазе B: кнопка «Добавить в боты» -> «Сохранить вариант розницы».
   Повышаем специфичность через .ap-btn-confirm, чтобы перебить базовый стиль. */
.ap-btn-confirm.ap-btn-save-variant {
  background: var(--gold);
  color: #fff;
}
.ap-btn-confirm.ap-btn-save-variant:hover {
  background: #b59418;
  opacity: 1;
}

/* Экран итогов — ряд кнопок под тремя колонками */
.apr-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 18px;
  flex-wrap: wrap;
}
.apr-btn {
  padding: 11px 20px;
  border-radius: 10px;
  font-family: 'Golos Text', sans-serif;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  transition: .15s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.apr-btn:hover {
  border-color: var(--border-mid);
  background: var(--green-pale2);
}
.apr-btn-variant {
  background: var(--gold);
  color: #fff;
  border-color: var(--gold);
}
.apr-btn-variant:hover {
  background: #b59418;
  border-color: #b59418;
  color: #fff;
}
.apr-btn-primary {
  background: var(--green-main);
  color: #fff;
  border-color: var(--green-main);
}
.apr-btn-primary:hover {
  background: var(--green-mid);
  border-color: var(--green-mid);
}

/* Чип-индикатор «Сохранён вариант №N» на экране итогов */
.apr-variant-chip {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--gold-pale);
  border: 1px solid var(--gold-light);
  border-radius: 10px;
  color: var(--text);
  font-size: 13.5px;
  margin-bottom: 4px;
}
.apr-variant-chip b {
  color: var(--gold);
  font-family: 'Unbounded', sans-serif;
  font-weight: 700;
}

/* ═══════════════════════════════════════════════════════════
   ОБЪЕДИНЁННАЯ СТРОКА: Размер коробки + Дата сбора + Время
   ═══════════════════════════════════════════════════════════ */

.ap-r-bx-col {
  display: grid;
  /* fr-пропорции надёжнее процентов: grid сам учитывает gap и не переполняется */
  grid-template-columns: 1fr 1.2fr 1.1fr;
  gap: 8px;
  align-items: stretch;
  width: 100%;
  box-sizing: border-box;
}
.ap-r-bx-col .ap-f {
  margin: 0;
  min-width: 0;
}
.ap-r-bx-col .ap-fv {
  width: 100%;
  box-sizing: border-box;
}
/* В объединённой строке подпись-подсказка «число + единица» не помещается и
   переносится на вторую строку, из-за чего поле «Размер коробки» оказывается
   ниже соседних. Скрываем её — плейсхолдер «10 уп» уже подсказывает формат. */
.ap-r-bx-col .ap-fl-sub {
  display: none;
}
/* Страхуем одинаковую высоту подписи во всех трёх полях строки */
.ap-r-bx-col .ap-fl {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Голубой акцент для полей «Дата сбора» и «Время» — визуально отделяет блок сбора.
   !important нужен, чтобы перекрыть .ap-fv-ret:focus (тоже с !important) в розничной
   колонке, а также любые кэшированные правила. */
.ap-r-bx-col .ap-f-date .ap-fv,
.ap-r-bx-col .ap-f-time .ap-fv {
  border-color: #93c5fd !important;
  background: #eff6ff !important;
}
.ap-r-bx-col .ap-f-date .ap-fv:focus,
.ap-r-bx-col .ap-f-time .ap-fv:focus {
  border-color: #60a5fa !important;
  background: #fff !important;
  outline: none;
  box-shadow: 0 0 0 2px rgba(96,165,250,.18) !important;
}
.ap-r-bx-col .ap-f-date .ap-fl,
.ap-r-bx-col .ap-f-time .ap-fl {
  color: #2563eb !important;
}

/* Обёртка времени — relative, чтобы крестик накладывался справа */
.ap-time-wrap {
  position: relative;
  width: 100%;
}
.ap-time-wrap .ap-fv {
  width: 100%;
  padding-right: 26px;
  box-sizing: border-box;
}

/* Крестик очистки даты+времени */
.ap-collect-clear {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: .12s ease;
}
.ap-collect-clear:hover {
  background: #ef4444;
  color: #fff;
}

/* На узких экранах — схлопнуть в один столбец (все три поля одно под другим) */
@media (max-width: 1280px) {
  .ap-r-bx-col {
    grid-template-columns: 1fr;
    row-gap: 10px;
  }
}
