/* Корзина Keyra — «док»: поднимается снизу по центру экрана, сверху полка
   с иконками-приложениями того, что в корзине. На телефоне — на весь экран. */

.cart-overlay { position: fixed; inset: 0; z-index: 200; background: rgba(5, 6, 7, 0.72); opacity: 0; transition: opacity var(--t); }
.cart-overlay.is-open { opacity: 1; }
.cart {
  position: fixed; left: 0; right: 0; bottom: 16px; z-index: 210;
  width: min(620px, 100vw - 32px); max-height: min(82svh, 780px); margin-inline: auto;
  display: flex; flex-direction: column;
  border: 1px solid var(--line-strong); border-radius: 30px; background: var(--surface); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  clip-path: inset(100% 0 0 0 round 30px); transition: clip-path 460ms var(--ease-out);
  outline: none;
}
.cart.is-open { clip-path: inset(0 0 0 0 round 30px); }
.cart.is-dragging { transition: none; }

/* полка дока */
.cart-dock { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin: 0 18px 10px; padding: 12px; border-radius: 22px; background: var(--bg-2); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05); }
.cart-dock:empty { display: none; }
.cart-dock__app { position: relative; }
.cart-orb--dock { width: 52px; height: 52px; border-radius: 14px; }
.cart-dock__qty { position: absolute; top: -5px; right: -5px; display: grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 700; box-shadow: 0 0 0 2px var(--bg-2); }
.cart__handle { display: none; }
.cart__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 22px 22px 14px; }
.cart__head h2 { font-size: var(--fs-xl); }
.cart__count { color: var(--muted); font-size: var(--fs-sm); }
.cart__scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 14px 14px; }
.cart__list { display: grid; gap: 8px; }

.cart-orb {
  position: relative; flex: none; display: grid; place-items: center;
  width: 56px; height: 56px; border-radius: 16px; background: var(--accent, var(--surface-2)); overflow: hidden;
}
.cart-orb::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), transparent 45%); }
.cart-orb img { width: 46%; height: 46%; object-fit: contain; filter: brightness(0) invert(1); }
.cart-orb.is-light img { filter: brightness(0); }
.cart-orb--sm { width: 40px; height: 40px; border-radius: 12px; }
.cart-orb--bundle { background: var(--surface-3); }
.cart-orb__mini { position: absolute; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--accent); left: calc(6px + var(--i) * 11px); top: calc(6px + var(--i) * 6px); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4); }
.cart-orb__mini img { width: 60%; height: 60%; }

.cart-item {
  display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 6px 14px; align-items: center;
  padding: 14px; border-radius: var(--r-md); background: var(--bg-2);
  animation: slide-up var(--t) var(--ease-out);
}
.cart-item__main { display: grid; gap: 6px; min-width: 0; }
.cart-item__name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cart-item__tags { display: flex; flex-wrap: wrap; gap: 6px; }
.cart-tag { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; padding: 3px 8px; border-radius: 8px; background: var(--surface-2); color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cart-tag svg { width: 12px; height: 12px; flex: none; }
.cart-item__side { display: grid; justify-items: end; gap: 2px; }
.cart-item__price { font-weight: 600; white-space: nowrap; }
.cart-item__unit { color: var(--faint); font-size: 11px; }
.cart-item__controls { grid-column: 2 / -1; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stepper { display: inline-flex; align-items: center; gap: 4px; padding: 3px; border-radius: 11px; background: var(--surface-2); }
.stepper button { display: grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 8px; background: transparent; color: var(--text); }
.stepper button:hover:not(:disabled) { background: var(--surface-3); }
.stepper button:disabled { opacity: 0.35; }
.stepper button svg { width: 14px; height: 14px; }
.stepper span { min-width: 22px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.cart-item__remove { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; color: var(--faint); font-size: var(--fs-xs); }
.cart-item__remove:hover { color: var(--bad); }
.cart-item__remove svg { width: 13px; height: 13px; }

.cart__summary { display: grid; gap: 12px; padding: 16px 22px 22px; border-top: 1px solid var(--line); }
.cart__summary:empty { display: none; }
.cart-sum { display: grid; gap: 10px; }
.cart-sum__row { display: flex; justify-content: space-between; align-items: center; gap: 12px; color: var(--muted); font-size: var(--fs-sm); }
.cart-sum__row span { display: inline-flex; align-items: center; gap: 8px; }
.cart-sum__row svg { width: 16px; height: 16px; }
.cart-sum__row--total { color: var(--text); font-size: var(--fs-md); }
.cart-sum__row--total strong { font-size: 1.6rem; font-weight: 600; letter-spacing: -0.02em; }
.cart-sum__balance { color: var(--text); font-weight: 600; }
.cart-gauge { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.cart-gauge span { display: block; height: 100%; border-radius: inherit; background: var(--warn); transition: width var(--t) var(--ease-out); }
.cart-gauge.is-ok span { background: var(--accent); }
.cart-sum__note { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: var(--fs-xs); }
.cart-sum__note svg { width: 15px; height: 15px; flex: none; }
.cart-sum__note.is-ok { color: var(--accent); }
.cart-sum__note.is-short { color: var(--warn); }
.cart-sum__actions { display: grid; gap: 8px; }

.cart__empty { display: grid; justify-items: center; gap: 14px; padding: 28px 10px 10px; text-align: center; }
.cart-empty__art { width: 120px; height: 120px; animation: float-y 5s ease-in-out infinite; }
.cart__empty h3 { font-size: var(--fs-xl); }
.cart-picks { width: 100%; display: grid; gap: 6px; margin-top: 14px; text-align: left; }
.cart-picks__title { color: var(--faint); font-size: var(--fs-xs); padding-left: 4px; }
.cart-pick { display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center; padding: 10px; border-radius: var(--r-sm); background: var(--bg-2); transition: background var(--t-fast); }
.cart-pick:hover { background: var(--surface-2); }
.cart-pick__name { font-weight: 600; font-size: var(--fs-sm); }
.cart-pick__price { color: var(--muted); font-size: var(--fs-xs); white-space: nowrap; }

@keyframes float-y { 50% { transform: translateY(-8px) rotate(-3deg); } }

@media (max-width: 760px) {
  /* на телефоне док — отдельный экран */
  .cart { top: 0; bottom: 0; width: 100%; max-height: none; border: 0; border-radius: 0; clip-path: inset(100% 0 0 0); padding-bottom: env(safe-area-inset-bottom); padding-top: env(safe-area-inset-top); }
  .cart.is-open { clip-path: inset(0 0 0 0); }
  .cart-dock { margin-inline: 14px; }
  .cart__handle { display: grid; place-items: center; padding-top: 10px; touch-action: none; }
  .cart__handle span { width: 42px; height: 5px; border-radius: 999px; background: var(--surface-3); }
  .cart__head { padding-top: 10px; }
}
