/* ============================================================================
 *  Конструктор набора «Собрать свой набор 💅»
 *  Только существующие токены проекта (--brand, --milk, --text, --border …).
 *  Mobile-first, без сторонних анимационных библиотек.
 * ==========================================================================*/

/* ---- CTA на витрине ---- */
.kb-cta {
    display: flex; align-items: center; gap: 14px; width: 100%;
    padding: 16px 18px; margin: 0 0 4px;
    background: linear-gradient(120deg, var(--brand-tint-bg, #FFF2FB), var(--white, #fff));
    border: 1px solid var(--brand-ring, rgba(255,51,204,.22));
    border-radius: 16px; cursor: pointer; text-align: left;
    transition: box-shadow .2s ease, transform .2s ease;
}
.kb-cta:hover { box-shadow: 0 8px 26px rgba(255,51,204,.14); transform: translateY(-2px); }
.kb-cta__ico { font-size: 26px; line-height: 1; flex: 0 0 auto; }
.kb-cta__t { display: block; font-weight: 700; font-size: 15.5px; color: var(--graphite, #1a1a1a); }
.kb-cta__s { display: block; font-size: 12.5px; color: var(--text-2, #666); margin-top: 2px; }
.kb-cta__go { margin-left: auto; color: var(--brand, #FF33CC); font-weight: 700; flex: 0 0 auto; }
@media (max-width: 640px) { .kb-cta__s { display: none; } }

/* ---- оверлей ---- */
body.kb-lock { overflow: hidden; }
.kb { position: fixed; inset: 0; z-index: 9000; display: flex; align-items: center; justify-content: center; }
.kb__backdrop { position: absolute; inset: 0; background: rgba(20,12,18,.7); opacity: 0; transition: opacity .28s ease-out; }
.kb__win {
    position: relative; width: min(1120px, 100%); height: min(92vh, 100%);
    background: var(--milk, #FAFAF8); border-radius: 20px; overflow: hidden;
    display: flex; flex-direction: column;
    opacity: 0; transform: scale(.96); transition: opacity .28s ease-out, transform .28s ease-out;
    box-shadow: 0 24px 70px rgba(0,0,0,.28);
}
.kb--in .kb__backdrop { opacity: 1; }
.kb--in .kb__win { opacity: 1; transform: scale(1); }
.kb--noanim .kb__backdrop, .kb--noanim .kb__win { transition: none; opacity: 1; transform: none; }

/* ---- шапка ---- */
.kb__top { display: flex; align-items: center; gap: 14px; padding: 14px 18px; background: var(--white, #fff); border-bottom: 1px solid var(--border-light, #F2EFEB); }
.kb__progress { flex: 1; min-width: 0; }
.kb__progress-txt { font-size: 12px; font-weight: 600; color: var(--text-2, #666); }
.kb__bar { height: 5px; margin-top: 6px; background: var(--cream, #F5F3F0); border-radius: 99px; overflow: hidden; }
.kb__bar i { display: block; height: 100%; width: 0; background: var(--brand, #FF33CC); border-radius: 99px; transition: width .3s ease; }
.kb__x { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--border, #EAE6E2); background: var(--white,#fff); font-size: 22px; line-height: 1; color: var(--text-2,#666); cursor: pointer; flex: 0 0 auto; }
.kb__x:hover { background: var(--cream, #F5F3F0); color: var(--graphite,#1a1a1a); }

/* ---- тело: 32% консультант + товары ---- */
.kb__body { flex: 1; display: flex; min-height: 0; }
.kb__aside { width: 32%; max-width: 340px; padding: 20px; border-right: 1px solid var(--border-light,#F2EFEB); background: var(--white,#fff); overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.kb__laylo { display: flex; align-items: center; gap: 10px; }
.kb__ava { width: 42px; height: 42px; border-radius: 50%; background: var(--brand-tint-bg,#FFF2FB); display: grid; place-items: center; font-size: 20px; flex: 0 0 auto; }
.kb__laylo b { display: block; font-size: 14px; color: var(--graphite,#1a1a1a); }
.kb__laylo span { display: block; font-size: 11.5px; color: var(--text-3,#999); }
.kb__say { font-size: 14px; line-height: 1.55; color: var(--text,#222); background: var(--brand-soft,rgba(255,51,204,.06)); border-radius: 14px; padding: 12px 14px; margin: 0; }
.kb__main { flex: 1; padding: 22px; overflow-y: auto; outline: none; transition: opacity .2s ease, transform .2s ease; }
.kb-out-l { opacity: 0; transform: translateX(-20px); }
.kb-out-r { opacity: 0; transform: translateX(20px); }
.kb-in-r  { animation: kbInR .24s ease-out; }
.kb-in-l  { animation: kbInL .24s ease-out; }
@keyframes kbInR { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }
@keyframes kbInL { from { opacity: 0; transform: translateX(-20px); } to { opacity: 1; transform: none; } }

/* ---- типографика/кнопки ---- */
.kb-h { font-size: 21px; font-weight: 800; color: var(--graphite,#1a1a1a); margin: 0 0 16px; }
.kb-sub { color: var(--text-2,#666); font-size: 14px; margin: 0 0 20px; }
.kb-center { max-width: 460px; margin: 6vh auto 0; text-align: center; }
.kb-center h2 { font-size: 24px; font-weight: 800; margin: 0 0 10px; color: var(--graphite,#1a1a1a); }
.kb-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.kb-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 11px 18px; border-radius: 12px; border: 1px solid var(--border,#EAE6E2); background: var(--white,#fff); color: var(--graphite,#1a1a1a); font-family: inherit; font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none; transition: background .15s, box-shadow .15s, transform .1s; }
.kb-btn:hover { background: var(--cream,#F5F3F0); }
.kb-btn:active { transform: scale(.97); }
.kb-btn--main { background: var(--brand,#FF33CC); border-color: var(--brand,#FF33CC); color: #fff; }
.kb-btn--main:hover { background: var(--brand-hover,#E81FB8); }
.kb-btn--main[disabled] { opacity: .5; cursor: not-allowed; }
.kb-btn--ghost { border-color: transparent; background: transparent; color: var(--text-2,#666); }
.kb-btn--lg { min-height: 52px; padding: 14px 26px; font-size: 15px; }
.kb-btn--sm { min-height: 38px; padding: 9px 14px; font-size: 13px; }
.kb-btn--full { width: 100%; }
.kb-link { background: none; border: 0; padding: 4px 0; color: var(--brand,#FF33CC); font: inherit; font-size: 12.5px; cursor: pointer; text-decoration: underline; }
.kb-btn:focus-visible, .kb-link:focus-visible, .kb-pick:focus-visible, .kb-card button:focus-visible { outline: 2px solid var(--brand,#FF33CC); outline-offset: 2px; }

/* ---- выбор уровня/бюджета ---- */
.kb-picks { display: grid; gap: 12px; }
.kb-picks--2 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.kb-pick { position: relative; display: block; width: 100%; text-align: left; padding: 18px 46px 18px 18px; border-radius: 16px; border: 2px solid var(--border,#EAE6E2); background: var(--white,#fff); cursor: pointer; font-family: inherit; transition: border-color .18s, box-shadow .18s, transform .15s; }
.kb-pick:hover { border-color: var(--brand-ring,rgba(255,51,204,.22)); transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,.06); }
.kb-pick.on { border-color: var(--brand,#FF33CC); background: var(--brand-soft,rgba(255,51,204,.06)); transform: scale(1.01); }
.kb-pick__ico { font-size: 26px; display: block; margin-bottom: 6px; }
.kb-pick b { display: block; font-size: 16px; color: var(--graphite,#1a1a1a); }
.kb-pick em { display: block; font-style: normal; font-size: 13px; color: var(--text-2,#666); margin-top: 3px; }
.kb-pick__ck { position: absolute; top: 14px; right: 14px; width: 24px; height: 24px; border-radius: 50%; background: var(--brand,#FF33CC); color: #fff; display: none; place-items: center; font-size: 13px; }
.kb-pick.on .kb-pick__ck { display: grid; }
.kb-pick--sm { padding: 15px 44px 15px 16px; }
.kb-custom { margin-top: 14px; display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.kb-custom label { display: block; font-size: 12.5px; color: var(--text-2,#666); margin-bottom: 4px; }
.kb-custom input { min-height: 44px; padding: 10px 12px; border: 1px solid var(--border,#EAE6E2); border-radius: 12px; font: inherit; min-width: 180px; }

/* ---- карточки товара ---- */
.kb-cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.kb-card { position: relative; display: flex; flex-direction: column; background: var(--white,#fff); border: 2px solid var(--border-light,#F2EFEB); border-radius: 16px; overflow: hidden; transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.kb-card:hover { transform: translateY(-3px); box-shadow: 0 10px 26px rgba(0,0,0,.09); }
.kb-card.on { border-color: var(--brand,#FF33CC); }
.kb-card__badge { position: absolute; top: 10px; left: 10px; z-index: 2; background: var(--graphite,#1a1a1a); color: #fff; font-size: 10.5px; font-weight: 700; padding: 4px 9px; border-radius: 99px; }
.kb-card__img { position: relative; aspect-ratio: 1/1; background: var(--cream,#F5F3F0); overflow: hidden; }
.kb-card__img img { width: 100%; height: 100%; object-fit: cover; transition: transform .2s ease; }
.kb-card:hover .kb-card__img img { transform: scale(1.03); }
.kb-card__ck { position: absolute; top: 10px; right: 10px; width: 26px; height: 26px; border-radius: 50%; background: var(--brand,#FF33CC); color: #fff; display: none; place-items: center; font-size: 14px; }
.kb-card.on .kb-card__ck { display: grid; }
.kb-card__b { padding: 12px 13px 14px; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.kb-card__b b { font-size: 13.5px; font-weight: 600; line-height: 1.35; color: var(--graphite,#1a1a1a); }
.kb-card__f { display: flex; flex-wrap: wrap; gap: 5px; }
.kb-card__f span { font-size: 10.5px; color: var(--text-2,#666); background: var(--cream,#F5F3F0); padding: 3px 7px; border-radius: 99px; }
.kb-card__p { font-size: 16px; font-weight: 800; color: var(--graphite,#1a1a1a); margin-top: auto; }
.kb-card__a { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.kb-card__a .kb-btn { width: 100%; }

.kb-more { margin-top: 14px; }
.kb-own { display: block; width: 100%; margin-top: 14px; padding: 13px; border: 1px dashed var(--border,#EAE6E2); border-radius: 14px; background: transparent; color: var(--text-2,#666); font: inherit; font-weight: 600; cursor: pointer; }
.kb-own:hover { border-color: var(--brand,#FF33CC); color: var(--brand,#FF33CC); }
.kb-empty { padding: 34px 18px; text-align: center; color: var(--text-2,#666); background: var(--white,#fff); border-radius: 16px; line-height: 1.6; }
.kb-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 20px; }
.kb-sticky { position: sticky; bottom: 0; padding: 12px 0 4px; background: linear-gradient(to top, var(--milk,#FAFAF8) 70%, transparent); }
.kb-sticky:not(.on) { display: none; }
.kb-sticky .kb-btn { width: 100%; }

/* ---- панель «Ваш набор» ---- */
.kb__kit { margin-top: auto; border-top: 1px solid var(--border-light,#F2EFEB); padding-top: 14px; }
.kb-kit__h { font-size: 13px; font-weight: 700; color: var(--graphite,#1a1a1a); display: flex; align-items: center; gap: 7px; margin-bottom: 10px; }
.kb-kit__h span { background: var(--brand,#FF33CC); color: #fff; font-size: 11px; min-width: 20px; height: 20px; border-radius: 99px; display: grid; place-items: center; padding: 0 5px; }
.kb-bounce { animation: kbBounce .4s ease; }
@keyframes kbBounce { 0%,100% { transform: none; } 30% { transform: scale(1.14); } 60% { transform: scale(.96); } }
.kb-kit__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; max-height: 34vh; overflow-y: auto; }
.kb-kit__row { display: flex; align-items: center; gap: 8px; }
.kb-kit__row img, .kb-kit__ph { width: 38px; height: 38px; border-radius: 9px; object-fit: cover; background: var(--cream,#F5F3F0); flex: 0 0 auto; }
.kb-kit__row div { min-width: 0; flex: 1; }
.kb-kit__row b { display: block; font-size: 12px; font-weight: 600; color: var(--text,#222); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kb-kit__row em { display: block; font-style: normal; font-size: 10.5px; color: var(--text-3,#999); }
.kb-kit__row span { font-size: 11.5px; color: var(--text-2,#666); }
.kb-kit__del { width: 24px; height: 24px; border: 0; background: transparent; color: var(--text-3,#999); font-size: 17px; cursor: pointer; border-radius: 6px; flex: 0 0 auto; }
.kb-kit__del:hover { background: var(--cream,#F5F3F0); color: #d33; }
.kb-kit__empty { font-size: 12.5px; color: var(--text-3,#999); margin: 0; }
.kb-kit__sum { display: flex; justify-content: space-between; margin-top: 12px; font-size: 13px; color: var(--text-2,#666); }
.kb-kit__sum b { color: var(--graphite,#1a1a1a); font-size: 15px; }
.kb-kit__bud { margin-top: 10px; }
.kb-kit__bud-t { font-size: 12px; font-weight: 600; color: var(--text,#222); }
.kb-kit__bud-bar { height: 5px; margin: 5px 0; background: var(--cream,#F5F3F0); border-radius: 99px; overflow: hidden; }
.kb-kit__bud-bar i { display: block; height: 100%; background: var(--brand,#FF33CC); transition: width .3s ease; }
.kb-kit__bud-bar.over i { background: #E5484D; }
.kb-kit__bud-l { font-size: 11.5px; color: var(--text-2,#666); }

/* ---- финал ---- */
.kb-review { max-width: 620px; margin: 0 auto; }
.kb-complete { font-size: 14px; color: var(--text-2,#666); margin-bottom: 12px; }
.kb-complete b { color: var(--brand,#FF33CC); font-size: 17px; }
.kb-check { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 5px; }
.kb-check li { font-size: 13px; color: var(--text,#222); }
.kb-check li.warn { color: #C2680A; }
.kb-check li.skip { color: var(--text-3,#999); }
.kb-check em { font-style: normal; color: var(--text-3,#999); font-size: 11.5px; }
.kb-final { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 9px; }
.kb-final li { display: flex; align-items: center; gap: 10px; background: var(--white,#fff); border-radius: 12px; padding: 9px 12px; }
.kb-final img { width: 42px; height: 42px; border-radius: 9px; object-fit: cover; }
.kb-final div { flex: 1; min-width: 0; }
.kb-final b { display: block; font-size: 13px; font-weight: 600; }
.kb-final em { font-style: normal; font-size: 11px; color: var(--text-3,#999); }
.kb-final span { font-weight: 700; font-size: 13.5px; white-space: nowrap; }
.kb-final__empty { color: var(--text-3,#999); justify-content: center; }
.kb-total { display: flex; justify-content: space-between; align-items: center; padding: 13px 14px; background: var(--white,#fff); border-radius: 12px; margin-bottom: 12px; }
.kb-total b { font-size: 19px; font-weight: 800; color: var(--graphite,#1a1a1a); }
.kb-total span { color: var(--text-2,#666); font-size: 13px; }
.kb-ship { font-size: 13px; padding: 11px 14px; border-radius: 12px; background: var(--brand-soft,rgba(255,51,204,.06)); color: var(--text,#222); margin-bottom: 14px; }
.kb-ship.ok { background: rgba(46,160,67,.09); color: #1F7A34; }

/* ---- мобильная нижняя панель ---- */
.kb__mob { display: none; }
.kb-mob__bar { width: 100%; min-height: 52px; border: 0; border-top: 1px solid var(--border-light,#F2EFEB); background: var(--white,#fff); font: inherit; font-size: 14px; font-weight: 600; color: var(--graphite,#1a1a1a); cursor: pointer; padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); }

/* ---- загрузка каталога ---- */
.kb-spin { width: 34px; height: 34px; margin: 0 auto 14px; border-radius: 50%; border: 3px solid var(--cream, #F5F3F0); border-top-color: var(--brand, #FF33CC); animation: kbSpin .8s linear infinite; }
@keyframes kbSpin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .kb-spin { animation-duration: 2s; } }

/* ---- toast ---- */
.kb-toast { position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 14px); z-index: 99999; background: var(--graphite,#1a1a1a); color: #fff; font-size: 13.5px; font-weight: 600; padding: 12px 20px; border-radius: 12px; opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; }
.kb-toast--on { opacity: 1; transform: translate(-50%, 0); }

/* ---- мобильная раскладка ---- */
@media (max-width: 860px) {
    .kb__win { width: 100%; height: 100%; border-radius: 0; }
    .kb__body { flex-direction: column; }
    .kb__aside { width: 100%; max-width: none; border-right: 0; border-bottom: 1px solid var(--border-light,#F2EFEB); padding: 14px 16px; overflow: visible; }
    .kb__kit { display: none; }
    .kb--kitopen .kb__kit { display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; background: var(--white,#fff); border-radius: 18px 18px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px)); box-shadow: 0 -10px 34px rgba(0,0,0,.16); max-height: 70vh; overflow-y: auto; }
    .kb__main { padding: 16px; }
    .kb__mob { display: block; }
    .kb-cards { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
    .kb-h { font-size: 18px; }
    .kb-center { margin-top: 4vh; }
}

/* ---- уважение к prefers-reduced-motion ---- */
@media (prefers-reduced-motion: reduce) {
    .kb *, .kb__win, .kb__backdrop { transition: none !important; animation: none !important; }
    .kb-card:hover, .kb-pick:hover, .kb-cta:hover { transform: none; }
}
