/* «Кімната Каті», фаза 4: «Шафа» (сцена-шкаф, лист места, сумки за кольором, фильтры,
   выбор нескольких, «Уся шафа», приховані речі). Подключается после styles.css и кладёт
   правила в те же пласты: сырые значения только в tokens, внешний вид в components,
   каркас в layouts, раскладка экранов в screens. Геометрия сцены: поле 366 × 540
   (penpot-mcp/kimnata-lib.js drawWardrobe), размеры внутри неё в cqw, чтобы росли вместе с шириной. */

/* ========================================================================== tokens */
@layer tokens {
  :root {
    /* дерево сцены (kimnata-lib.js drawWardrobe) */
    --sc-skirting: #E4CCAE;
    --sc-door-l0: #E2BF97;
    --sc-door-l1: #D0A77C;
    --sc-door-r0: #D3AC82;
    --sc-door-r1: #BE9368;
    --sc-brass0: #D6B375;
    --sc-brass1: #94702F;
    --sc-body0: #CD9F70;
    --sc-body1: #B38358;
    --sc-crown0: #B98A5D;
    --sc-crown1: #9A6E47;
    --sc-crown-light: #DDBA91;
    --sc-in0: #F3E7D6;
    --sc-in1: #E2CBAE;
    --sc-plank0: #E6C7A1;
    --sc-plank-light: #F5E3CB;
    --sc-plinth0: #B7875A;
    --sc-plinth-light: #CFA274;
    --sc-case0: #A0604F;
    --sc-case1: #7B3F33;
    --sc-cap-a0: #EED5CA;
    --sc-cap-a1: #DDB9AB;
    --sc-cap-b0: #D4DDCC;
    --sc-cap-b1: #BAC6AF;
    --sc-box0: #DECBAE;
    --sc-box1: #CBB08B;
    --sc-lid0: #D6BC98;
    --sc-lid1: #C3A37B;
    --sc-drawer0: #ECDAC2;
    --sc-drawer1: #DBC3A3;
    --sc-tag-line: #EADFD3;
    --sc-tag-dash: #F8F0E4;
    --sc-oak-rgb: 168 122 78;     /* --oak-deep для линий с прозрачностью */
    --sc-light-rgb: 255 255 255;
    --sc-lit: rgb(255 253 251 / .62);
    --sc-halo: rgb(255 253 251 / .95);
    --sc-halo-0: rgb(255 253 251 / 0);
    /* полки «За кольором» (m-v-bagcolor) */
    --sc-side-l0: #D2A677;
    --sc-side-l1: #C39365;
    --sc-side-r0: #C39365;
    --sc-side-r1: #B5875A;
    --sc-niche0: #EADBC5;
    --sc-niche1: #F4EADC;
    /* размеры */
    --sh-scene-max: 420px;        /* сцена на широком телефоне и планшете не растёт бесконечно */
    --sh-col-desk: 366px;         /* колонка сцены на компьютере (d-shafa) */
    --pl-pane-top: 284px;         /* панель места: окно минус шапка и меню (d-shafa: 616 из 900) */
    --pl-side-w: 527px;           /* фильтры справа на компьютере (d2-filters) */
    --ms-foot-h: 94px;            /* панель действий выбора без безопасной зоны */
    --pl-niche-h: 114px;          /* ниша полки цвета */
    --pl-bag-body: 70px;          /* тело сумки на полке */
    --pl-bag-max: 86px;
    --pl-more: 46px;
  }
}

/* ========================================================================== components */
@layer components {
  /* ---------- сцена-шкаф ---------- */
  .sc {
    position: relative;
    width: 100%;
    aspect-ratio: 366 / 540;
    overflow: hidden;
    border-radius: var(--r-hero);
    background: var(--surface-2);
    container-type: inline-size;
    touch-action: pan-y;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
  }
  .sc-room, .sc-dyn, .sc-items, .sc-zones, .sc-tags { position: absolute; inset: 0; }
  .sc-room, .sc-dyn, .sc-items, .sc-tags { pointer-events: none; }
  .sc-p { position: absolute; }

  .sc-light { background: radial-gradient(closest-side, rgb(var(--sc-light-rgb) / .55), rgb(var(--sc-light-rgb) / 0)); }
  .sc-floor {
    background:
      linear-gradient(transparent 36%, rgb(var(--sc-oak-rgb) / .16) 36% 39%, transparent 39% 69%, rgb(var(--sc-oak-rgb) / .16) 69% 72%, transparent 72%),
      var(--oak-lighter);
  }
  .sc-skirting { background: var(--sc-skirting); }
  .sc-floor-shadow { background: radial-gradient(closest-side, rgb(var(--shadow-rgb) / .42), rgb(var(--shadow-rgb) / 0)); }
  .sc-door { border-radius: 1.64cqw; }
  .sc-door--l { background: repeating-linear-gradient(90deg, rgb(var(--sc-oak-rgb) / 0) 0 22%, rgb(var(--sc-oak-rgb) / .35) 22% 25%), linear-gradient(var(--sc-door-l0), var(--sc-door-l1)); }
  .sc-door--r { background: repeating-linear-gradient(90deg, rgb(var(--sc-oak-rgb) / 0) 0 22%, rgb(var(--sc-oak-rgb) / .35) 22% 25%), linear-gradient(var(--sc-door-r0), var(--sc-door-r1)); }
  .sc-panel { border-radius: 1.1cqw; box-shadow: inset 0 0 0 1px rgb(var(--sc-oak-rgb) / .45); }
  .sc-knob { border-radius: .82cqw; background: linear-gradient(var(--sc-brass0), var(--sc-brass1)); }
  .sc-cast { background: linear-gradient(90deg, rgb(var(--shadow-rgb) / .1), rgb(var(--shadow-rgb) / 0)); }
  .sc-body { border-radius: 1.64cqw; background: linear-gradient(90deg, var(--sc-body0), var(--sc-body1)); }
  .sc-crown { border-radius: 1.64cqw; background: linear-gradient(var(--sc-crown0), var(--sc-crown1)); box-shadow: inset 0 1.5px 0 var(--sc-crown-light); }
  .sc-crown-shadow { background: linear-gradient(rgb(var(--shadow-rgb) / .2), rgb(var(--shadow-rgb) / 0)); }
  .sc-inside {
    border-radius: 1.1cqw;
    background: repeating-linear-gradient(90deg, rgb(var(--sc-oak-rgb) / 0) 0 16.4%, rgb(var(--sc-oak-rgb) / .13) 16.4% 16.7%), linear-gradient(135deg, var(--sc-in0), var(--sc-in1));
  }
  .sc-shade-top { background: linear-gradient(rgb(var(--shadow-rgb) / .22), rgb(var(--shadow-rgb) / 0)); }
  .sc-wall-l { background: linear-gradient(90deg, rgb(var(--shadow-rgb) / .2), rgb(var(--shadow-rgb) / 0)); }
  .sc-wall-r { background: linear-gradient(270deg, rgb(var(--sc-light-rgb) / .4), rgb(var(--sc-light-rgb) / 0)); }
  .sc-plank {
    border-radius: .55cqw;
    background: linear-gradient(var(--sc-plank0), var(--oak-light));
    box-shadow: inset 0 1px 0 var(--sc-plank-light), inset 0 -1px 0 rgb(var(--sc-oak-rgb) / .5);
  }
  .sc-plank-shadow { background: linear-gradient(rgb(var(--shadow-rgb) / .18), rgb(var(--shadow-rgb) / 0)); }
  .sc-bracket { border-radius: .55cqw; background: var(--oak-deep); }
  .sc-rail { border-radius: var(--r-pill); background: linear-gradient(var(--sc-brass0), var(--sc-brass1)); }
  .sc-rail-shadow { background: linear-gradient(rgb(var(--shadow-rgb) / .12), rgb(var(--shadow-rgb) / 0)); }
  .sc-plinth { border-radius: .82cqw; background: linear-gradient(var(--sc-plinth0), var(--oak-deep)); box-shadow: inset 0 1px 0 var(--sc-plinth-light); }
  .sc-case-handle { border-radius: 1.37cqw; box-shadow: inset 0 0 0 .82cqw var(--oak-deep); }
  .sc-case {
    border-radius: 2.73cqw;
    background: linear-gradient(135deg, var(--sc-case0), var(--sc-case1));
    box-shadow: .55cqw .82cqw 1.4cqw rgb(var(--shadow-rgb) / .2), inset 0 .55cqw 0 rgb(var(--sc-light-rgb) / .12);
  }
  .sc-case-band { background: rgb(var(--ink-rgb) / .14); }
  .sc-case-rib { border-radius: 1px; background: rgb(var(--ink-rgb) / .1); }
  .sc-case-label { border-radius: .82cqw; background: var(--surface); }
  .sc-capsule { border-radius: 2.2cqw; box-shadow: .55cqw .82cqw 1.4cqw rgb(var(--shadow-rgb) / .2); }
  .sc-capsule--a { background: linear-gradient(var(--sc-cap-a0), var(--sc-cap-a1)); }
  .sc-capsule--b { background: linear-gradient(var(--sc-cap-b0), var(--sc-cap-b1)); }
  .sc-capsule-label { border-radius: .55cqw; background: var(--surface); opacity: .85; }
  .sc-capsule-lid { border-radius: 1.37cqw; background: var(--surface); box-shadow: inset 0 -1.5px 0 rgb(var(--shadow-rgb) / .1); }
  .sc-box { border-radius: 1.37cqw; background: linear-gradient(var(--sc-box0), var(--sc-box1)); box-shadow: .55cqw .82cqw 1.4cqw rgb(var(--shadow-rgb) / .2); }
  .sc-box-grip { border-radius: .82cqw; background: rgb(var(--shadow-rgb) / .25); }
  .sc-box-lid { border-radius: 1.1cqw; background: linear-gradient(var(--sc-lid0), var(--sc-lid1)); }
  .sc-drawer { border-radius: 1.37cqw; background: linear-gradient(var(--sc-drawer0), var(--sc-drawer1)); box-shadow: inset 0 0 0 1px var(--oak-light); }
  .sc-drawer--dash { background: rgb(var(--sc-light-rgb) / .35); box-shadow: none; border: 1px dashed var(--oak-deep); }
  .sc-drawer-handle { position: absolute; left: calc(50% - 1.64cqw); top: 42%; width: 3.28cqw; height: 1.1cqw; border-radius: .55cqw; background: var(--oak-deep); }
  .sc-shoes {
    display: grid;
    place-items: center;
    border: 1px dashed var(--oak-deep);
    border-radius: 2.2cqw;
    background: rgb(var(--sc-light-rgb) / .3);
    color: var(--inner);
    font: 600 max(var(--fs-label), 3.55cqw)/1 var(--font-ui);
    white-space: nowrap;
  }

  /* вещи: вырезка висит на крючке целиком; пока её нет, фото целиком на прищепке */
  .sc-it { position: absolute; translate: -50% 0; transform-origin: var(--hx, 50%) 0; }
  img.sc-it { width: auto; max-width: none; -webkit-user-drag: none; }
  .sc-photo {
    aspect-ratio: 3 / 4;
    padding: .8cqw;
    border-radius: 1.37cqw;
    background: var(--surface);
    box-shadow: 0 .55cqw 1.64cqw rgb(var(--shadow-rgb) / .22);
  }
  .sc-photo > img { display: block; width: 100%; height: 100%; object-fit: contain; border-radius: .82cqw; background: var(--surface-2); }
  .sc-clip { position: absolute; left: 50%; bottom: 100%; width: .82cqw; height: 2.6cqw; translate: -50% 0; border-radius: .41cqw; background: linear-gradient(var(--sc-brass0), var(--sc-brass1)); }
  .sc-it[data-row="hooks"] .sc-clip { height: 1.8cqw; }
  .sc-it--stand .sc-clip { display: none; }
  .sc-halo { position: absolute; opacity: 0; pointer-events: none; background: radial-gradient(closest-side, var(--sc-halo), var(--sc-halo-0)); }

  /* зоны: вся зона нажимается; подсветка «полка горит», из неё растёт лист */
  .sc-zone {
    position: absolute;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: none;
    color: inherit;
    cursor: pointer;
  }
  .sc-lit { position: absolute; inset: 0; border-radius: inherit; background: var(--sc-lit); opacity: 0; pointer-events: none; }
  .sc-zone.is-lit .sc-lit { opacity: 1; }
  .sc-zone.is-fading .sc-lit { transition: opacity var(--dur-state) var(--ease-fade); }
  .sc-zone:focus-visible { outline: 2px solid var(--acc); outline-offset: -2px; }

  /* ярлыки мест: «Сумки · 142»; пустая мебель пунктиром «+ аксесуари» */
  .sc-tag {
    position: absolute;
    translate: -50% 0;
    display: flex;
    align-items: center;
    height: 7.1cqw;
    padding: 0 3cqw;
    border-radius: 3.55cqw;
    background: var(--surface);
    box-shadow: inset 0 0 0 1px var(--sc-tag-line), .55cqw 1.64cqw 1.64cqw -1.1cqw rgb(var(--shadow-rgb) / .2);
    color: var(--ink);
    font: 600 max(var(--fs-label), 3.55cqw)/1 var(--font-ui);
    white-space: nowrap;
    pointer-events: auto;
    cursor: pointer;
  }
  .sc-tag--dash { background: var(--sc-tag-dash); box-shadow: none; border: 1px dashed var(--oak-deep); color: var(--inner); }
  .sc-tag--trip { display: block; max-width: 40cqw; overflow: hidden; text-overflow: ellipsis; line-height: 7.1cqw; }

  /* ---------- сетка вещей: выбор, призраки, приглушённые ---------- */
  .ig { position: relative; }
  .ig-check {
    position: absolute;
    top: 8px;
    right: 8px;
    display: none;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--surface);
    box-shadow: inset 0 0 0 1.5px var(--line-2);
    color: var(--acc-ink);
    pointer-events: none;
    transition: background-color var(--dur-state) var(--ease-fade);
  }
  .ig-check > .k-icon { width: 16px; height: 16px; --icon-stroke: 2.6px; opacity: 0; }
  .is-selecting .ig-check { display: grid; }
  .is-selecting .ig .k-heart,
  .is-selecting .ig .k-tile__badge { display: none; }
  .ig .k-tile.is-picked .k-tile__ph { background: var(--acc-soft); box-shadow: inset 0 0 0 2.5px var(--acc); }
  .ig .k-tile.is-picked .ig-check { background: var(--acc); box-shadow: none; }
  .ig .k-tile.is-picked .ig-check > .k-icon { opacity: 1; }
  .ig-ghost { z-index: 2; pointer-events: none; }
  .k-tile--dim .k-tile__s { color: var(--ink-2); }

  /* ---------- лист места ---------- */
  .pl-sheet > .k-sheet__body { position: relative; padding-inline: var(--gutter); }
  .pl-sheet .k-sheet__head { padding-bottom: 0; }
  .pl-tabs {
    position: relative;
    flex: none;
    display: flex;
    gap: 20px;
    padding: 4px var(--target) 0 var(--inset);
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
    scrollbar-width: none;
    scroll-snap-type: x proximity;
    scroll-padding-inline: var(--inset);
  }
  .pl-tabs::-webkit-scrollbar { display: none; }
  .pl-tab {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: var(--target);
    padding: 0;
    border: 0;
    background: none;
    color: var(--ink-2);
    font: 500 var(--fs-body-s)/1 var(--font-ui);
    white-space: nowrap;
    scroll-snap-align: start;
    --tr-x: color var(--dur-state) var(--ease-fade);
  }
  .pl-tab[aria-selected="true"] { color: var(--ink); font-weight: 700; }
  .pl-ind {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100px;
    height: 3px;
    border-radius: 2px;
    background: var(--acc);
    transform-origin: 0 50%;
    pointer-events: none;
    transition: translate var(--dur-move) var(--ease-move), scale var(--dur-move) var(--ease-move);
  }
  .pl-view { position: relative; }
  .pl-leaving { position: absolute; left: 0; right: 0; top: 0; pointer-events: none; }
  .pl-controls { display: flex; flex-direction: column; gap: var(--sp-3); padding: 14px 0 var(--sp-4); }
  .pl-chips { margin-inline: calc(-1 * var(--gutter)); padding-inline: var(--gutter) var(--target); scroll-padding-inline: var(--gutter); }
  .pl-buttons { display: flex; align-items: center; gap: var(--sp-2); }
  .pl-pill { gap: 6px; padding-inline: 12px 14px; }
  .pl-pill > .k-icon { width: 18px; height: 18px; margin-left: 0; color: var(--ink); }
  .pl-pill.is-on { background: var(--ink); color: var(--bg); box-shadow: inset 0 0 0 1px var(--ink); }
  .pl-pill.is-on > .k-icon { color: var(--bg); }
  .pl-pick { margin-left: auto; }
  .pl-sort { position: relative; cursor: pointer; }
  .pl-sort__sel {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    opacity: 0;
    font-size: var(--fs-body);
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
  }
  .pl-sort:focus-within { outline: 2px solid var(--acc); outline-offset: 2px; }
  .pl-empty { display: flex; flex-direction: column; align-items: center; gap: var(--sp-2); padding: var(--sp-6) 0; text-align: center; }

  /* форма, из которой растёт лист (MOTION-SPEC #4): общая, .k-sheet__shape в styles.css (sheet-grow.js) */

  /* ---------- сумки за кольором: полки ---------- */
  .pl-shelves {
    position: relative;
    margin-inline: calc(-1 * var(--gutter));
    padding: 0 12px var(--sp-4);
    background:
      linear-gradient(var(--sc-side-l0), var(--sc-side-l1)) left top / 6px 100% no-repeat,
      linear-gradient(var(--sc-side-r0), var(--sc-side-r1)) right top / 6px 100% no-repeat;
  }
  .pl-shelf { position: relative; scroll-margin-top: var(--sp-2); }
  .pl-plank {
    height: 12px;
    margin-inline: -6px;
    background: linear-gradient(var(--sc-plank0), var(--oak-light));
    box-shadow: inset 0 1px 0 var(--sc-plank-light), inset 0 -1px 0 rgb(var(--sc-oak-rgb) / .5);
  }
  .pl-shelftag {
    position: absolute;
    left: 8px;
    top: -16px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: var(--target);
    padding: 0 8px 0 10px;
    border: 9px solid transparent;
    border-inline-width: 0;
    border-radius: 22px;
    background: var(--surface);
    background-clip: padding-box;
    box-shadow: inset 0 0 0 1px var(--sc-tag-line), 0 2px 6px rgb(var(--shadow-rgb) / .14);
    color: var(--ink);
    font: 600 var(--fs-caption)/1 var(--font-ui);
    white-space: nowrap;
  }
  .pl-shelftag .k-chip__dot { width: 12px; height: 12px; margin: 0; }
  .pl-shelftag > .k-icon { width: 12px; height: 12px; color: var(--ink-3); --icon-stroke: 2.2px; }
  .pl-niche {
    position: relative;
    display: flex;
    align-items: flex-end;
    gap: 12px;
    height: var(--pl-niche-h);
    padding: 0 14px 10px;
    overflow: hidden;
    background:
      linear-gradient(rgb(var(--shadow-rgb) / .22), rgb(var(--shadow-rgb) / 0) 18px),
      linear-gradient(90deg, rgb(var(--shadow-rgb) / .12), rgb(var(--shadow-rgb) / 0) 12px),
      linear-gradient(270deg, rgb(var(--sc-light-rgb) / .35), rgb(var(--sc-light-rgb) / 0) 12px),
      linear-gradient(var(--sc-niche0), var(--sc-niche1));
  }
  .pl-bag {
    position: relative;
    flex: none;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    height: 92px;
    max-width: var(--pl-bag-max);
    aspect-ratio: 3 / 4;
    padding: 3px;
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 2px 6px rgb(var(--shadow-rgb) / .2);
  }
  .pl-bag > img { display: block; width: 100%; height: 100%; object-fit: contain; border-radius: 6px; background: var(--surface-2); }
  .pl-bag--cut { aspect-ratio: auto; width: var(--pl-bag-max); height: calc(var(--pl-bag-body) / (1 - var(--body, .25))); padding: 0; background: none; box-shadow: none; }
  .pl-bag--cut > img { background: none; object-position: 50% 100%; }
  .pl-more {
    flex: none;
    align-self: center;
    width: var(--pl-more);
    height: var(--pl-more);
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--surface);
    box-shadow: inset 0 0 0 1px var(--line-2), 0 2px 6px rgb(var(--shadow-rgb) / .12);
    color: var(--ink-2);
    font: 600 var(--fs-hint)/1 var(--font-ui);
  }

  /* ---------- фильтры ---------- */
  .fl-group > .k-caps { margin: var(--sp-3) var(--sp-1) var(--sp-2); }
  .fl-group:first-child > .k-caps { margin-top: var(--sp-1); }
  .fl-chips { gap: 6px; }
  .fl-toggles { margin-top: var(--sp-2); }
  .fl-hidden { margin: var(--sp-3) 0 var(--sp-1); }
  .fl-foot { border-top: 1px solid var(--line); }
  .fl-foot > .k-btn--ghost { flex: 0 0 auto; padding-inline: var(--sp-5); }
  .fl-foot > .k-btn--primary { flex: 1 1 auto; }

  /* ---------- приховані речі (m-x-hidden) ---------- */
  .hd-row {
    display: flex;
    gap: 14px;
    padding: 10px;
    border-radius: var(--r-card-l);
    background: var(--surface);
    box-shadow: inset 0 0 0 1px var(--line);
  }
  .hd-thumb { position: relative; flex: none; width: 92px; height: 92px; overflow: hidden; border-radius: 16px; background: var(--surface-2); }
  .hd-thumb > img { position: absolute; inset: 6px; width: calc(100% - 12px); height: calc(100% - 12px); object-fit: contain; }
  .hd-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
  .hd-title { margin: 2px 0 0; font: 600 var(--fs-body)/1.3 var(--font-ui); overflow-wrap: anywhere; }
  .hd-when { margin: 3px 0 0; font: 400 var(--fs-caption)/1.3 var(--font-ui); color: var(--ink-2); }
  .hd-text > .k-btn { margin-top: auto; max-width: none; }
  .hd-foot, .hd-empty { font-size: var(--fs-caption); }

  /* ---------- выбор нескольких (m-select) ---------- */
  .ms-bar { display: flex; align-items: center; gap: 2px; padding: 8px 10px 8px 8px; }
  .ms-count { flex: 1 1 auto; min-width: 0; margin: 0 0 0 6px; font: 600 var(--fs-section)/1.2 var(--font-ui); white-space: nowrap; }
  .ms-all {
    flex: none;
    min-height: var(--target);
    padding: 0 10px;
    border: 0;
    border-radius: 18px;
    background: none;
    color: var(--acc);
    font: 600 var(--fs-body-s)/1 var(--font-ui);
  }
  .ms-trash { color: var(--danger); }
  .ms-trash:disabled { color: var(--ink-3); opacity: 1; }
  .ms-foot {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: 12px 15px calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: var(--surface);
    box-shadow: 0 -2px 12px rgb(var(--shadow-rgb) / .1);
  }
  .ms-foot--one { grid-template-columns: minmax(0, 1fr); }
  .ms-act {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 70px;
    border: 0;
    border-radius: var(--r-btn);
    background: none;
    color: var(--ink);
    font: 500 var(--fs-caption)/1.2 var(--font-ui);
  }
  .ms-act > .k-icon { width: 24px; height: 24px; }
  .ms-act:disabled { opacity: .45; cursor: default; }

  /* ---------- «Уся шафа» ---------- */
  .al-top { display: flex; flex-direction: column; gap: var(--sp-3); padding: var(--sp-2) 0 var(--sp-3); }
  .al-chips { margin-inline: calc(-1 * var(--gutter)); padding-inline: var(--gutter) var(--target); }
  .al-line { margin: 0 var(--sp-1); font-size: var(--fs-caption); }

  /* ---------- панель места на компьютере (d-shafa) ---------- */
  .pl-pane {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    border-radius: var(--r-hero);
    background: var(--surface);
    box-shadow: inset 0 0 0 1px var(--line);
  }
  .pl-pane__head { flex: none; display: flex; align-items: center; gap: var(--sp-3); min-height: 86px; padding: 18px 28px 4px; }
  .pl-pane__head > .pl-seg { flex: 0 0 280px; }
  .pl-pane__title { flex: 1 1 auto; min-width: 0; margin: 0; font: 600 var(--fs-display-l)/var(--lh-display) var(--font-display); }
  .pl-pane__count { margin-left: 12px; font: 500 var(--fs-body-s)/1 var(--font-ui); color: var(--ink-2); }
  .pl-pane__body { position: relative; flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 28px 28px; }
  .pl-pane .pl-controls { position: sticky; top: 0; z-index: 3; background: var(--surface); }
  .pl-pane .pl-chips { margin-inline: 0; padding-inline: 0 var(--target); }
  .pl-pane .pl-shelves { margin-inline: 0; }
  .pl-pane > .ms-bar { padding: 14px 18px 6px; }
  .pl-pane > .ms-foot { padding-bottom: 12px; box-shadow: none; }
}

/* ========================================================================== layouts */
@layer layouts {
  /* шкаф отступает за листом места до .96 (MOTION-SPEC #4) */
  .k-pane[data-tab="wardrobe"] { transition: scale var(--dur-sheet-out) var(--ease-sheet); }
  .k-pane[data-tab="wardrobe"].pl-behind { scale: var(--scale-backdrop); transition-duration: var(--dur-sheet-in); }

  /* выбор нескольких: лист на весь экран, меню прячется (сосредоточенный шаг) */
  .k-sheet.pl-sheet.is-selecting { height: 100dvh; max-height: 100dvh; border-radius: 0; }
  .pl-sheet.is-selecting > .k-sheet__grab,
  .pl-sheet.is-selecting > .k-sheet__head,
  .pl-sheet.is-selecting > .pl-tabs,
  .pl-sheet.is-selecting .pl-controls { display: none; }
  .pl-sheet > .ms-bar { flex: none; padding-top: calc(env(safe-area-inset-top) + 8px); }
  .pl-sheet > .ms-foot { flex: none; }
  html[data-selecting] .k-nav { display: none; }
  html[data-selecting] .k-strip { bottom: calc(var(--ms-foot-h) + env(safe-area-inset-bottom) + 8px); }
  .al.is-selecting > .k-phead,
  .al.is-selecting .al-top { display: none; }
  .al > .ms-bar { position: sticky; top: 0; z-index: var(--z-header); padding-top: calc(env(safe-area-inset-top) + 8px); background: var(--bg); }
  .al > .ms-foot { position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-nav); }
  .al.is-selecting { padding-bottom: calc(var(--ms-foot-h) + env(safe-area-inset-bottom) + var(--sp-6)); }
  .pl-pane.is-selecting > .pl-pane__head,
  .pl-pane.is-selecting .pl-controls { display: none; }

  @media (min-width: 1100px) {
    /* фильтры и выбор места плавающей панелью справа, сцена и сетка за ней видны (d2-filters) */
    .k-sheet.pl-side {
      inset: 130px 80px auto auto;
      width: min(var(--pl-side-w), calc(100% - 160px));
      max-height: calc(100dvh - var(--desk-panel-top) - var(--desk-panel-bottom)); /* фаза 9: над меню */
      margin: 0;
      border-radius: var(--r-sheet);
    }
    .k-sheet.pl-side::backdrop { background: transparent; }
    .k-sheet.pl-side .k-sheet__grab { display: none; }
    .k-sheet.pl-sheet.is-selecting { height: calc(100dvh - var(--sheet-top)); border-radius: var(--r-sheet); }
    html[data-selecting] .k-nav { display: grid; }
  }
}

/* ========================================================================== screens: только раскладка */
@layer screens {
  .sh { display: flex; flex-direction: column; }
  .sh-body { display: flex; flex-direction: column; gap: 18px; }
  .sh-col { display: flex; flex-direction: column; gap: 18px; width: 100%; max-width: var(--sh-scene-max); margin-inline: auto; }
  .sh-scene { margin-inline: calc(-1 * var(--sp-1)); }
  .sh-buttons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-2); }
  .sh-buttons > .k-btn { width: 100%; max-width: none; padding-inline: var(--sp-3); gap: 6px; }
  /* узкий телефон: «Мої образи · 16» важнее значка */
  @media (max-width: 389px) {
    .sh-buttons > .k-btn > .k-icon { display: none; }
  }
  .sh-side { display: none; }
  .hd { display: flex; flex-direction: column; gap: var(--sp-3); padding-bottom: var(--sp-4); }
  .hd-list { display: flex; flex-direction: column; gap: var(--sp-3); }

  @media (min-width: 760px) {
    .ig { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .al .ig { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  }

  /* компьютер (d-shafa): сцена слева, место справа */
  @media (min-width: 1100px) {
    /* d-shafa: поля 80, содержимое до 1280 (заголовок и сцена с x 80 на 1440) */
    .k-pane[data-tab="wardrobe"].app { width: 100%; max-width: calc(var(--desk-max) + 160px); padding-inline: 80px; }
    .sh-body { flex-direction: row; align-items: flex-start; gap: 34px; }
    .sh-col { flex: 0 0 var(--sh-col-desk); max-width: var(--sh-col-desk); margin: 0; }
    .sh-scene { margin-inline: 0; }
    .sh-side { display: block; flex: 1 1 auto; min-width: 0; }
    .sh-side > .pl-pane { height: max(460px, calc(100dvh - var(--pl-pane-top))); }
    .pl-pane .pl-controls { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: var(--sp-3); padding-top: var(--sp-2); }
    .pl-pane .pl-buttons { grid-column: 2; }
    .pl-pane .pl-chips { grid-column: 1; }
    .pl-pane.is-selecting .pl-controls { display: none; }
    .pl-pane .ig .k-tile__ph { aspect-ratio: 264 / 180; }
    .pl-pane .pl-shelves { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 12px; }
    .al .ig { grid-template-columns: repeat(5, minmax(0, 1fr)); }
    .k-screen.al { width: min(100%, var(--desk-max)); padding-inline: 64px; }
  }
}
