/* Верхняя панель ТБ Маркета (десктоп): лёгкая навигация над витриной, без
   тяжёлого «островка». Мобильная шапка (.tbm-mobile-header) отдельно. */
body.market-v2 .mkh { display: none; }

@media (min-width: 861px) {
  body.market-v2 .mkh {
    --mkh-brand: var(--mk-brand, #2563eb);
    --mkh-text: var(--mk-text, #0f172a);
    --mkh-muted: var(--mk-muted, #5b6b86);
    --mkh-line: rgba(197, 211, 235, .9);
    --mkh-soft: #f1f5fc;
    display: block;
    position: relative;
    top: auto;
    z-index: 40;
    padding: 8px 16px 4px;
    pointer-events: none;
  }
  body.market-v2 .mkh__bar {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 1560px;
    min-height: 56px;
    margin: 0 auto;
    padding: 5px 2px 10px;
    border: 0;
    border-bottom: 1px solid rgba(197, 211, 235, .72);
    border-radius: 0;
    background: transparent;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    box-shadow: none;
  }

  /* бренд */
  body.market-v2 .mkh__brand { display: inline-flex; align-items: center; gap: 10px; flex: 0 0 auto; color: var(--mkh-text); text-decoration: none; }
  body.market-v2 .mkh__brand .tb-brand-logo-wrap { box-shadow: 0 6px 16px rgba(37, 99, 235, .14); }
  body.market-v2 .mkh__brand-copy { display: grid; line-height: 1.12; }
  body.market-v2 .mkh__brand-copy strong { font-size: 1.02rem; font-weight: 800; letter-spacing: -.01em; white-space: nowrap; }
  body.market-v2 .mkh__brand-copy small { color: var(--mkh-muted); font-size: .68rem; font-weight: 600; white-space: nowrap; }

  /* разделы */
  body.market-v2 .mkh__nav { display: flex; align-items: center; gap: 2px; margin-inline: 8px auto; min-width: 0; }
  body.market-v2 .mkh__link {
    position: relative;
    display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 13px;
    border-radius: 13px; color: var(--mkh-muted); font-size: .9rem; font-weight: 700; white-space: nowrap; text-decoration: none;
    transition: background .15s, color .15s;
  }
  body.market-v2 .mkh__link .mk-ico { flex: 0 0 auto; opacity: .85; }
  body.market-v2 .mkh__link:hover { background: var(--mkh-soft); color: var(--mkh-text); }
  body.market-v2 .mkh__link.is-active { background: transparent; color: var(--mkh-brand); box-shadow: none; }
  body.market-v2 .mkh__link.is-active::after { content: ""; position: absolute; right: 13px; bottom: 2px; left: 13px; height: 2px; border-radius: 99px; background: linear-gradient(90deg, #3b82f6, #8b5cf6); box-shadow: 0 0 12px rgba(98, 112, 255, .42); }
  body.market-v2 .mkh__link.is-active .mk-ico { opacity: 1; }

  /* инструменты */
  body.market-v2 .mkh__tools { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
  body.market-v2 .mkh__form { margin: 0; display: contents; }
  body.market-v2 .mkh__search { position: relative; display: flex; align-items: center; }
  body.market-v2 .mkh__search .mkh__search-toggle,
  body.market-v2 .mkh__search .mkh__search-close { display: none; }
  body.market-v2 .mkh__search-field {
    display: flex; align-items: center; gap: 8px; width: clamp(150px, 15vw, 240px); height: 42px; margin: 0; padding: 0 12px;
    border: 1px solid transparent; border-radius: 14px; background: var(--mkh-soft); color: var(--mkh-muted);
    transition: border-color .15s, background .15s, box-shadow .15s;
  }
  body.market-v2 .mkh__search-field:focus-within { border-color: rgba(37, 99, 235, .45); background: #fff; box-shadow: 0 0 0 4px rgba(37, 99, 235, .10); }
  body.market-v2 .mkh__search-field input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--mkh-text); font: inherit; font-size: .9rem; }

  body.market-v2 .mkh__pill,
  body.market-v2 .mkh__icon-btn,
  body.market-v2 .mkh__avatar {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 42px; border: 1px solid var(--mkh-line);
    border-radius: 14px; background: #fff; color: var(--mkh-text); font: inherit; font-size: .88rem; font-weight: 700; white-space: nowrap;
    text-decoration: none; cursor: pointer; list-style: none; transition: background .15s, border-color .15s, transform .15s;
  }
  body.market-v2 .mkh__pill { padding: 0 13px; }
  body.market-v2 .mkh__pill::-webkit-details-marker,
  body.market-v2 .mkh__avatar::-webkit-details-marker { display: none; }
  body.market-v2 .mkh__pill:hover,
  body.market-v2 .mkh__icon-btn:hover,
  body.market-v2 .mkh__avatar:hover { background: var(--mkh-soft); border-color: rgba(99, 132, 255, .4); }
  body.market-v2 .mkh__city .mkh__pill span { max-width: 130px; overflow: hidden; text-overflow: ellipsis; }
  body.market-v2 .mkh__pill .mk-ico:last-child:not(:first-child) { opacity: .55; }
  body.market-v2 .mkh__pill--crm { color: #1d4ed8; background: linear-gradient(135deg, #eef4ff, #f3eeff); border-color: rgba(99, 132, 255, .35); }
  body.market-v2 .mkh__icon-btn { position: relative; width: 42px; padding: 0; color: var(--mkh-muted); }
  body.market-v2 .mkh__badge {
    position: absolute; top: -5px; right: -5px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 999px;
    background: #ef4444; color: #fff; font-size: .68rem; font-weight: 800; line-height: 19px; text-align: center; box-shadow: 0 0 0 2px #fff;
  }

  /* второстепенные разделы не раздувают основную навигацию */
  body.market-v2 .mkh__more { position: relative; flex: 0 0 auto; }
  body.market-v2 .mkh__more > summary { list-style: none; font-size: 1.1rem; letter-spacing: 2px; }
  body.market-v2 .mkh__more > summary::-webkit-details-marker { display: none; }
  body.market-v2 .mkh__more-menu {
    position: absolute; top: calc(100% + 10px); right: 0; z-index: 60; display: none; min-width: 190px; padding: 7px;
    border: 1px solid var(--mkh-line); border-radius: 16px; background: #fff; box-shadow: 0 18px 48px rgba(23, 37, 70, .18);
  }
  body.market-v2 .mkh__more[open] .mkh__more-menu { display: grid; gap: 2px; }
  body.market-v2 .mkh__more-menu a { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 10px; border-radius: 11px; color: var(--mkh-text); font-size: .88rem; font-weight: 700; text-decoration: none; }
  body.market-v2 .mkh__more-menu a:hover, body.market-v2 .mkh__more-menu a.is-active { color: var(--mkh-brand); background: var(--mkh-soft); }

  /* профиль */
  body.market-v2 .mkh__profile { position: relative; }
  body.market-v2 .mkh__avatar { gap: 6px; padding: 0 9px 0 5px; }
  body.market-v2 .mkh__avatar-name { max-width: 112px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  body.market-v2 .mkh__avatar-mark {
    display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6); color: #fff; font-size: .78rem; font-weight: 800;
  }
  body.market-v2 .mkh__avatar-mark--lg { width: 44px; height: 44px; font-size: .95rem; }
  body.market-v2 .mkh__avatar .mk-ico { opacity: .55; }
  body.market-v2 .mkh__menu {
    position: absolute; right: 0; top: calc(100% + 12px); z-index: 60; display: none; width: 304px; padding: 8px;
    border: 1px solid var(--mkh-line); border-radius: 20px; background: #fff; box-shadow: 0 24px 60px rgba(23, 37, 70, .22);
  }
  body.market-v2 .mkh__profile[open] .mkh__menu { display: grid; gap: 2px; }
  body.market-v2 .mkh__menu-id { display: flex; align-items: center; gap: 12px; padding: 10px 10px 12px; margin-bottom: 4px; border-bottom: 1px solid var(--mkh-line); }
  body.market-v2 .mkh__menu-id strong { display: block; font-size: .98rem; }
  body.market-v2 .mkh__menu-id small { color: var(--mkh-muted); font-size: .78rem; font-weight: 600; }
  body.market-v2 .mkh__menu-label { padding: 10px 12px 4px; color: var(--mkh-muted); font-size: .68rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
  body.market-v2 .mkh__menu a,
  body.market-v2 .mkh__menu button {
    display: flex; align-items: center; gap: 12px; width: 100%; min-height: 42px; padding: 0 12px; border: 0; border-radius: 12px; background: transparent;
    color: var(--mkh-text); font: inherit; font-size: .9rem; font-weight: 650; text-align: left; text-decoration: none; cursor: pointer;
  }
  body.market-v2 .mkh__menu a .mk-ico,
  body.market-v2 .mkh__menu button .mk-ico { color: var(--mkh-brand); opacity: .9; }
  body.market-v2 .mkh__menu a:hover,
  body.market-v2 .mkh__menu button:hover { background: var(--mkh-soft); }
  body.market-v2 .mkh__menu form { margin: 0; }
  body.market-v2 .mkh__menu-crm { color: #1d4ed8 !important; background: linear-gradient(135deg, #eef4ff, #f3eeff) !important; }
  body.market-v2 .mkh__menu-logout { margin-top: 4px; padding-top: 6px; border-top: 1px solid var(--mkh-line); }
  body.market-v2 .mkh__menu-logout button,
  body.market-v2 .mkh__menu-logout button .mk-ico { color: #b91c1c; }

  /* главная кнопка */
  body.market-v2 .mkh__cta {
    display: inline-flex; align-items: center; gap: 7px; height: 42px; padding: 0 18px; border-radius: 14px; border: 0;
    background: linear-gradient(135deg, #2563eb, #7c3aed); color: #fff; font-size: .9rem; font-weight: 800; white-space: nowrap; text-decoration: none;
    box-shadow: 0 10px 24px rgba(79, 70, 229, .32); transition: transform .15s, box-shadow .15s;
  }
  body.market-v2 .mkh__cta:hover { transform: translateY(-1px); box-shadow: 0 14px 30px rgba(79, 70, 229, .38); color: #fff; }
}

/* уже: подписи у неактивных разделов уходят, остаются значки (подсказка — title) */
@media (min-width: 861px) and (max-width: 1699px) {
  body.market-v2 .mkh__brand-copy small { display: none; }
  body.market-v2 .mkh__link:not(.is-active) span { display: none; }
  body.market-v2 .mkh__link { padding: 0 11px; }
  body.market-v2 .mkh__search-field { width: 160px; }
  body.market-v2 .mkh__city .mkh__pill span { max-width: 150px; }
}
@media (min-width: 861px) and (max-width: 1180px) {
  body.market-v2 .mkh__search-field { width: 130px; }
  body.market-v2 .mkh__pill--crm span { display: none; }
  body.market-v2 .mkh__pill--crm { width: 42px; padding: 0; }
  body.market-v2 .mkh__avatar-name { display: none; }
}
@media (min-width: 861px) and (max-width: 1020px) {
  body.market-v2 .mkh__brand-copy { display: none; }
  body.market-v2 .mkh__pill--crm span,
  body.market-v2 .mkh__cta span { display: none; }
  body.market-v2 .mkh__pill--crm,
  body.market-v2 .mkh__cta { width: 42px; padding: 0; justify-content: center; }
  body.market-v2 .mkh__city .mkh__pill span { max-width: 80px; }
}

/* цвета, которые старые правила ссылок перебивали */
body.market-v2 .mkh a.mkh__cta, body.market-v2 .mkh a.mkh__cta span, body.market-v2 .mkh a.mkh__cta .mk-ico { color: #fff !important; }
body.market-v2 .mkh a.mkh__link { color: var(--mkh-muted); }
body.market-v2 .mkh a.mkh__link.is-active { color: var(--mkh-brand); }
body.market-v2 .mkh a.mkh__pill--crm, body.market-v2 .mkh .mkh__pill--crm { color: #1d4ed8; }
body.market-v2 .mkh .mkh__menu a, body.market-v2 .mkh .mkh__menu button { color: var(--mkh-text); }
body.market-v2 .mkh .mkh__menu .mkh__menu-logout button { color: #b91c1c; }

/* ── фото профиля ── */
body.market-v2 .mkh__avatar-mark,
body.market-v2 .mk-profile__avatar,
body.market-v2 .tbm-avatar-edit__preview { overflow: hidden; }
body.market-v2 .mkh__avatar-mark img,
body.market-v2 .mk-profile__avatar img,
body.market-v2 .tbm-avatar-edit__preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
body.market-v2 .tbm-avatar-edit { display: flex; align-items: center; gap: 16px; padding: 14px; border: 1px dashed #c5d3eb; border-radius: 18px; background: #f7f9ff; }
body.market-v2 .tbm-avatar-edit__preview { flex: 0 0 auto; display: grid; place-items: center; width: 84px; height: 84px; border-radius: 50%; color: #fff; font-size: 1.4rem; font-weight: 800; background: linear-gradient(135deg, #3b82f6, #8b5cf6); box-shadow: 0 10px 24px rgba(79, 70, 229, .25); }
body.market-v2 .tbm-avatar-edit__body { display: grid; gap: 4px; min-width: 0; }
body.market-v2 .tbm-avatar-edit__body small { color: #5b6b86; }
body.market-v2 .tbm-avatar-edit__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 6px; }
body.market-v2 .tbm-avatar-edit__pick { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }
body.market-v2 .tbm-avatar-edit__remove { display: inline-flex; align-items: center; gap: 6px; color: #b91c1c; font-size: .86rem; font-weight: 600; cursor: pointer; }
@media (max-width: 520px) { body.market-v2 .tbm-avatar-edit { flex-direction: column; text-align: center; } body.market-v2 .tbm-avatar-edit__actions { justify-content: center; } }

/* настройки профиля: без боковой панели показателей — одна колонка */
body.market-v2--settings .tbm-settings-layout { grid-template-columns: minmax(0, 820px); justify-content: center; }
body.market-v2--settings .tbm-settings-page { justify-items: center; }
body.market-v2--settings .tbm-settings-page > * { width: 100%; max-width: 820px; }
body.market-v2 .tbm-avatar-edit__remove input { width: 18px; height: 18px; margin: 0; flex: 0 0 auto; }

/* ── поиск: поле внутри «капсулы» прозрачное, без белой подложки и прямоугольной рамки фокуса ── */
html body.market-v2 .mkh__search-field input[type="search"]:not([disabled]):not([hidden]),
html body.market-v2 .tbm-mobile-header__search input[type="search"]:not([disabled]):not([hidden]) {
  background: transparent !important; border: 0 !important; box-shadow: none !important; outline: none !important;
  -webkit-appearance: none; appearance: none;
}
body.market-v2 .mkh__search-field input::-webkit-search-cancel-button,
body.market-v2 .tbm-mobile-header__search input::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }
body.market-v2 .tbm-mobile-header__search:focus-within { box-shadow: 0 0 0 3px rgba(37, 99, 235, .16); }

/* поиск специалистов: поле «Опишите задачу» сжималось в квадрат — задача на всю строку, остальное под ней */
body.market-v2 .spec-search { grid-template-columns: repeat(3, minmax(0, 1fr)) auto; }
body.market-v2 .spec-search__field--task { grid-column: 1 / -1; }
@media (max-width: 860px) { body.market-v2 .spec-search { grid-template-columns: repeat(2, minmax(0, 1fr)); } body.market-v2 .spec-search__submit { grid-column: 1 / -1; } }

/* ── нижняя панель: «Разместить» — круглая кнопка без плашки-«овала» вокруг ── */
@media (max-width: 860px) {
  body.market-v2[data-tbos-module="marketplace"] .market-mobile-bar a.is-primary {
    margin-top: -24px; min-height: 0; background: transparent !important; border: 0 !important; box-shadow: none !important; border-radius: 0; color: #60718b !important;
  }
  body.market-v2[data-tbos-module="marketplace"] .market-mobile-bar a.is-primary i {
    width: 54px; height: 54px; border-radius: 50%; color: #fff !important;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    box-shadow: 0 10px 24px rgba(79, 70, 229, .38), 0 0 0 5px rgba(255, 255, 255, .97);
  }
  body.market-v2[data-tbos-module="marketplace"] .market-mobile-bar a.is-primary i .mk-ico { width: 26px; height: 26px; }
  body.market-v2[data-tbos-module="marketplace"] .market-mobile-bar a.is-primary span { margin-top: 3px; color: #60718b; }
}

/* колокольчик уведомлений в мобильной шапке рядом с CRM */
body.market-v2 .tbm-mobile-header__bell { position: relative; display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; color: #475569; }
body.market-v2 .tbm-mobile-header__bell b { position: absolute; top: -3px; right: -3px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 99px; background: #ef4444; color: #fff; font-size: .64rem; line-height: 17px; text-align: center; box-shadow: 0 0 0 2px #fff; }

/* Профиль всегда доступен из верхней панели и на телефоне: не отправляем
   пользователя на отдельную страницу только ради выбора следующего действия. */
body.market-v2 .tbm-mobile-profile { position: relative; }
body.market-v2 .tbm-mobile-profile summary { list-style: none; cursor: pointer; }
body.market-v2 .tbm-mobile-profile summary::-webkit-details-marker { display: none; }
body.market-v2 .tbm-mobile-profile__trigger,
body.market-v2 .tbm-mobile-profile__trigger > span,
body.market-v2 .tbm-mobile-profile__identity > span { display: grid; place-items: center; overflow: hidden; border-radius: 50%; background: linear-gradient(135deg, #3b82f6, #8b5cf6); color: #fff; font-size: .72rem; font-weight: 850; }
body.market-v2 .tbm-mobile-profile__trigger { width: 40px; height: 40px; }
body.market-v2 .tbm-mobile-profile__trigger > span { width: 32px; height: 32px; }
body.market-v2 .tbm-mobile-profile :is(img) { width: 100%; height: 100%; object-fit: cover; }
body.market-v2 .tbm-mobile-profile__menu { position: fixed; top: calc(var(--mk-safe-top, 0px) + 60px); right: 10px; z-index: 120; display: none; width: min(320px, calc(100vw - 20px)); padding: 9px; border: 1px solid rgba(151, 170, 211, .62); border-radius: 20px; background: rgba(255, 255, 255, .98); box-shadow: 0 22px 52px rgba(29, 48, 91, .25); }
body.market-v2 .tbm-mobile-profile[open] .tbm-mobile-profile__menu { display: grid; gap: 3px; }
body.market-v2 .tbm-mobile-profile__identity { display: flex; align-items: center; gap: 10px; padding: 8px 8px 12px; margin-bottom: 3px; border-bottom: 1px solid var(--mk-line, #e3eaf5); }
body.market-v2 .tbm-mobile-profile__identity > span { width: 42px; height: 42px; flex: 0 0 42px; }
body.market-v2 .tbm-mobile-profile__identity div { min-width: 0; display: grid; gap: 2px; }
body.market-v2 .tbm-mobile-profile__identity strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--mk-text); font-size: .92rem; }
body.market-v2 .tbm-mobile-profile__identity small { color: var(--mk-muted); font-size: .75rem; }
body.market-v2 .tbm-mobile-profile__menu a,
body.market-v2 .tbm-mobile-profile__menu button { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 0 10px; border: 0; border-radius: 12px; background: transparent; color: var(--mk-text); font: inherit; font-size: .88rem; font-weight: 720; text-align: left; text-decoration: none; }
body.market-v2 .tbm-mobile-profile__menu a:hover,
body.market-v2 .tbm-mobile-profile__menu a:focus-visible { background: var(--mk-brand-soft); color: var(--mk-brand); }
body.market-v2 .tbm-mobile-profile__menu form { margin: 5px 0 0; padding-top: 5px; border-top: 1px solid var(--mk-line, #e3eaf5); }
body.market-v2 .tbm-mobile-profile__menu form button { color: #b42318; }
