/* ============================================================
   demo-shop · ТехноДім
   Акцентний колір проєкту — оранжевий #e5731f
   ============================================================ */

:root {
  --accent: #e5731f;
  --accent-dark: #c85f13;
  --accent-soft: rgba(229, 115, 31, .12);

  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #fbfbfc;
  --text: #23262b;
  --text-dim: #6b7280;
  --text-mute: #9aa1ab;
  --border: #e6e8ec;
  --border-strong: #d6d9df;

  --green: #12a06a;
  --red: #d64545;
  --blue: #3b6ef6;

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 4px 16px rgba(16, 24, 40, .07);
  --shadow-lg: 0 16px 48px rgba(16, 24, 40, .16);

  --r: 12px;
  --r-sm: 10px;
  --header-h: 64px;
}

[data-theme="dark"] {
  --bg: #14161a;
  --surface: #1c1f24;
  --surface-2: #22262c;
  --text: #e8eaed;
  --text-dim: #a2a9b4;
  --text-mute: #79808b;
  --border: #2c3038;
  --border-strong: #3a3f49;
  --accent-soft: rgba(229, 115, 31, .18);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow: 0 4px 16px rgba(0, 0, 0, .38);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, .55);
}

* { box-sizing: border-box; }

/* Атрибут hidden має перемагати будь-який display із макета,
   інакше приховані підкладки перехоплюють кліки по всій сторінці. */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  transition: background .2s, color .2s;
}

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }

button, input, select, textarea { font: inherit; color: inherit; }

.container { max-width: 1240px; margin: 0 auto; padding: 0 20px; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--accent); color: #fff; padding: 10px 16px; border-radius: 0 0 var(--r-sm) 0;
}
.skip-link:focus { left: 0; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ---------------- Шапка ---------------- */

.header {
  position: sticky; top: 0; z-index: 60;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid var(--border);
}
.header__inner {
  height: var(--header-h);
  display: flex; align-items: center; gap: 16px;
}

.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--accent); flex-shrink: 0; }
.logo__mark { display: flex; }
.logo__text { font-size: 17px; font-weight: 700; color: var(--text); letter-spacing: -.02em; }

.search { position: relative; flex: 1; max-width: 520px; }
.search__icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-mute); pointer-events: none;
}
.search input {
  width: 100%; height: 40px; padding: 0 36px 0 38px;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--surface-2); transition: border-color .15s, box-shadow .15s;
}
.search input::-webkit-search-cancel-button { display: none; }
.search input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.search__clear {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 24px; height: 24px; display: grid; place-items: center;
  border: 0; background: none; color: var(--text-mute); cursor: pointer; border-radius: 6px;
}
.search__clear:hover { color: var(--text); background: var(--bg); }

.suggest {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 70;
  margin: 0; padding: 6px; list-style: none;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); box-shadow: var(--shadow-lg);
  max-height: 380px; overflow-y: auto;
}
.suggest__item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border-radius: var(--r-sm); cursor: pointer;
}
.suggest__item:hover, .suggest__item[aria-selected="true"] { background: var(--accent-soft); }
.suggest__thumb { width: 34px; height: 34px; border-radius: 8px; flex-shrink: 0; }
.suggest__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.suggest__price { font-size: 13px; font-weight: 650; color: var(--text-dim); white-space: nowrap; }
.suggest__empty { padding: 14px 10px; text-align: center; color: var(--text-dim); font-size: 14px; overflow-wrap: anywhere; }

.header__actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }

.icon-btn {
  position: relative; width: 40px; height: 40px;
  display: grid; place-items: center;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--surface); cursor: pointer; color: var(--text);
  transition: background .15s, border-color .15s, transform .1s;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.icon-btn:active { transform: scale(.95); }
.icon-btn--filters { display: none; }

.icon-sun { display: none; }
.icon-moon { display: block; }
[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }

.badge-count {
  position: absolute; top: -6px; right: -6px; min-width: 19px; height: 19px;
  padding: 0 5px; border-radius: 10px; background: var(--accent); color: #fff;
  font-size: 11px; font-weight: 700; display: grid; place-items: center;
  border: 2px solid var(--surface);
}

/* ---------------- Hero ---------------- */

.hero {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 24px;
  padding: 32px 20px 20px; flex-wrap: wrap;
}
.hero__title { font-size: 30px; letter-spacing: -.025em; }
.hero__sub { margin: 6px 0 0; color: var(--text-dim); max-width: 560px; }
.hero__chips { display: flex; gap: 8px; flex-wrap: wrap; }

.chip {
  padding: 7px 14px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); cursor: pointer; font-size: 13.5px; color: var(--text-dim);
  transition: all .15s; white-space: nowrap;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 550; }

/* ---------------- Розкладка ---------------- */

.layout {
  display: grid; grid-template-columns: 258px 1fr; gap: 24px;
  align-items: start; padding-bottom: 56px;
}

.sidebar {
  position: sticky; top: calc(var(--header-h) + 16px);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 4px 18px 18px;
  box-shadow: var(--shadow-sm);
  max-height: calc(100vh - var(--header-h) - 32px); overflow-y: auto;
}
.sidebar__head { display: flex; align-items: center; justify-content: space-between; padding: 14px 0 0; }
.sidebar__head h2 { font-size: 16px; }
.sidebar__close { display: none; }
.sidebar__backdrop { display: none; }

.fgroup { padding: 16px 0; border-bottom: 1px solid var(--border); }
.fgroup:last-of-type { border-bottom: 0; }
.fgroup__title { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-mute); margin-bottom: 12px; font-weight: 650; }
.fgroup__body { display: flex; flex-direction: column; gap: 2px; }
.fgroup__body--scroll { max-height: 232px; overflow-y: auto; padding-right: 4px; }

.check {
  display: flex; align-items: center; gap: 9px; padding: 6px 6px;
  border-radius: 8px; cursor: pointer; font-size: 14px; user-select: none;
}
.check:hover { background: var(--surface-2); }
.check input { position: absolute; opacity: 0; width: 0; height: 0; }
.check__box {
  width: 17px; height: 17px; border: 1.6px solid var(--border-strong); border-radius: 5px;
  flex-shrink: 0; display: grid; place-items: center; transition: all .15s; background: var(--surface);
}
.check__box::after {
  content: ""; width: 9px; height: 5px; border: 2px solid #fff; border-top: 0; border-right: 0;
  transform: rotate(-45deg) scale(0); transition: transform .15s; margin-top: -2px;
}
.check input:checked + .check__box { background: var(--accent); border-color: var(--accent); }
.check input:checked + .check__box::after { transform: rotate(-45deg) scale(1); }
.check input:focus-visible + .check__box { box-shadow: 0 0 0 3px var(--accent-soft); }
.check__name { flex: 1; }
.check__count { color: var(--text-mute); font-size: 12.5px; font-variant-numeric: tabular-nums; }

.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch__ui {
  width: 36px; height: 21px; border-radius: 999px; background: var(--border-strong);
  position: relative; transition: background .18s; flex-shrink: 0;
}
.switch__ui::after {
  content: ""; position: absolute; top: 2.5px; left: 2.5px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; transition: transform .18s; box-shadow: var(--shadow-sm);
}
.switch input:checked + .switch__ui { background: var(--accent); }
.switch input:checked + .switch__ui::after { transform: translateX(15px); }
.switch input:focus-visible + .switch__ui { box-shadow: 0 0 0 3px var(--accent-soft); }

/* Два повзунки ціни */
.range { position: relative; height: 26px; margin: 4px 0 10px; }
.range__track {
  position: absolute; top: 11px; left: 0; right: 0; height: 4px;
  background: var(--border-strong); border-radius: 2px;
}
.range__fill { position: absolute; height: 100%; background: var(--accent); border-radius: 2px; }
.range input[type="range"] {
  position: absolute; top: 0; left: 0; width: 100%; height: 26px; z-index: 3;
  margin: 0; background: none; pointer-events: none; -webkit-appearance: none; appearance: none;
}
.range input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; pointer-events: auto; width: 17px; height: 17px; border-radius: 50%;
  background: var(--surface); border: 2.5px solid var(--accent); cursor: grab; box-shadow: var(--shadow-sm);
}
.range input[type="range"]::-webkit-slider-thumb:active { cursor: grabbing; transform: scale(1.12); }
.range input[type="range"]::-moz-range-thumb {
  pointer-events: auto; width: 15px; height: 15px; border-radius: 50%;
  background: var(--surface); border: 2.5px solid var(--accent); cursor: grab;
}
.range input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px var(--accent-soft); }

.range__values { display: flex; align-items: center; gap: 8px; }
.range__dash { color: var(--text-mute); }
.range__num {
  flex: 1; width: 100%; min-width: 0; height: 34px; padding: 0 8px; text-align: center;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2);
  font-size: 13.5px; font-variant-numeric: tabular-nums;
}
.range__num:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------------- Панель інструментів ---------------- */

/* Колонка сітки — grid-елемент: без min-width:0 довгий вміст розпирає сторінку. */
.content { min-width: 0; }

.toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin-bottom: 14px; flex-wrap: wrap;
}
.toolbar__count { margin: 0; color: var(--text-dim); font-size: 14px; }
.select { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.select__label { color: var(--text-dim); }
.select select {
  height: 36px; padding: 0 30px 0 10px; border: 1px solid var(--border);
  border-radius: var(--r-sm); background: var(--surface); cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6' fill='none' stroke='%239aa1ab' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; background-size: 16px;
}
.select select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.active-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.active-chips:empty { display: none; }
.tag {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px 5px 11px;
  border-radius: 999px; background: var(--accent-soft); color: var(--accent-dark);
  font-size: 13px; font-weight: 550; border: 1px solid transparent;
  max-width: 100%; min-width: 0;
}
/* Довгий запит обрізаємо в тексті, щоб хрестик зняття фільтра лишався на екрані. */
.tag__text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag button { flex-shrink: 0; }
[data-theme="dark"] .tag { color: #f7a05c; }
.tag button { border: 0; background: none; cursor: pointer; color: inherit; display: grid; place-items: center; padding: 2px; border-radius: 50%; }
.tag button:hover { background: rgba(0, 0, 0, .1); }

/* ---------------- Сітка товарів ---------------- */

.grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(228px, 1fr)); gap: 18px;
}

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  overflow: hidden; display: flex; flex-direction: column;
  box-shadow: var(--shadow-sm); transition: transform .16s, box-shadow .16s, border-color .16s;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--border-strong); }

.card__media {
  position: relative; aspect-ratio: 4 / 3; cursor: pointer;
  display: grid; place-items: center; padding: 14px; text-align: center;
  border: 0; width: 100%; font: inherit;
}
.card__media-text {
  color: #fff; font-weight: 650; font-size: 14px; line-height: 1.3;
  text-shadow: 0 1px 8px rgba(0, 0, 0, .3); max-width: 90%;
}
.card__badges { position: absolute; top: 10px; left: 10px; display: flex; gap: 5px; flex-wrap: wrap; }
.badge {
  padding: 3px 8px; border-radius: 6px; font-size: 11px; font-weight: 700;
  letter-spacing: .02em; color: #fff; backdrop-filter: blur(4px);
}
.badge--hit { background: rgba(214, 69, 69, .92); }
.badge--new { background: rgba(18, 160, 106, .92); }
.badge--sale { background: rgba(35, 38, 43, .82); }
.card__out {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(255, 255, 255, .74); color: #23262b;
  font-weight: 650; font-size: 13px; letter-spacing: .02em;
}
[data-theme="dark"] .card__out { background: rgba(20, 22, 26, .72); color: #e8eaed; }

.card__body { padding: 13px 14px 14px; display: flex; flex-direction: column; flex: 1; gap: 8px; }
.card__brand { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-mute); font-weight: 600; }
.card__name {
  font-size: 14.5px; font-weight: 600; line-height: 1.35; cursor: pointer;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  background: none; border: 0; padding: 0; text-align: left; font-family: inherit; color: inherit;
}
.card__name:hover { color: var(--accent); }
.card__rating { display: flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--text-dim); }
.card__stars { color: #f0a132; letter-spacing: -1px; }
.card__prices { display: flex; align-items: baseline; gap: 8px; margin-top: auto; flex-wrap: wrap; }
.card__price { font-size: 18px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.card__old { font-size: 13px; color: var(--text-mute); text-decoration: line-through; font-variant-numeric: tabular-nums; }
.card__save { font-size: 12px; font-weight: 650; color: var(--red); }

.card__actions { display: flex; gap: 8px; }

/* ---------------- Кнопки ---------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 15px; border-radius: var(--r-sm); border: 1px solid transparent;
  font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, transform .1s, opacity .15s;
}
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover:not(:disabled) { background: var(--accent-dark); }
.btn--ghost { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn--ghost:hover:not(:disabled) { border-color: var(--border-strong); background: var(--surface-2); }
.btn--full { width: 100%; }
.btn--lg { height: 46px; font-size: 15px; }
.btn--sm { height: 32px; padding: 0 11px; font-size: 13px; }
.btn--icon { width: 38px; padding: 0; flex-shrink: 0; }

/* ---------------- Порожній стан ---------------- */

.empty {
  padding: 64px 20px; text-align: center; color: var(--text-dim);
  border: 1px dashed var(--border-strong); border-radius: var(--r); background: var(--surface);
}
.empty svg { color: var(--text-mute); margin-bottom: 10px; }
.empty h3 { font-size: 17px; color: var(--text); margin-bottom: 6px; }
.empty p { margin: 0 0 18px; }

/* ---------------- Картка товару ---------------- */

.product { padding: 24px 20px 64px; }
.crumbs { display: flex; align-items: center; gap: 7px; font-size: 13.5px; color: var(--text-dim); margin-bottom: 18px; flex-wrap: wrap; }
.crumbs button { background: none; border: 0; color: var(--text-dim); cursor: pointer; padding: 0; font-size: inherit; }
.crumbs button:hover { color: var(--accent); text-decoration: underline; }

.pd { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 34px; align-items: start; }

.gallery__main { aspect-ratio: 4 / 3; border-radius: var(--r); display: grid; place-items: center; padding: 26px; text-align: center; }
.gallery__main-text { color: #fff; font-weight: 700; font-size: 21px; text-shadow: 0 2px 14px rgba(0, 0, 0, .32); }
.gallery__thumbs { display: flex; gap: 10px; margin-top: 12px; }
.gallery__thumb {
  width: 74px; height: 58px; border-radius: var(--r-sm); border: 2px solid transparent;
  cursor: pointer; padding: 0; transition: border-color .15s, transform .1s;
}
.gallery__thumb:hover { transform: translateY(-2px); }
.gallery__thumb[aria-current="true"] { border-color: var(--accent); }

.pd__brand { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-mute); font-weight: 650; }
.pd__title { font-size: 25px; margin: 6px 0 10px; line-height: 1.25; }
.pd__meta { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 13.5px; color: var(--text-dim); margin-bottom: 18px; }
.pd__stock { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.pd__stock--in { color: var(--green); }
.pd__stock--out { color: var(--red); }
.pd__dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.pd__pricebox {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  padding: 16px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); margin-bottom: 18px;
}
.pd__price { font-size: 29px; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.pd__old { font-size: 16px; color: var(--text-mute); text-decoration: line-through; }
.pd__save { font-size: 13px; font-weight: 650; color: #fff; background: var(--red); padding: 3px 8px; border-radius: 6px; }

.pd__desc { color: var(--text-dim); line-height: 1.65; margin-bottom: 20px; }

.pd__variants { margin-bottom: 20px; }
.pd__label { font-size: 13px; font-weight: 650; margin-bottom: 9px; display: block; }
.variants { display: flex; gap: 8px; flex-wrap: wrap; }
.variant {
  padding: 8px 14px; border: 1.5px solid var(--border); border-radius: var(--r-sm);
  background: var(--surface); cursor: pointer; font-size: 14px; transition: all .15s;
}
.variant:hover { border-color: var(--border-strong); }
.variant[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-dark); font-weight: 600; }
[data-theme="dark"] .variant[aria-pressed="true"] { color: #f7a05c; }

.pd__buy { display: flex; gap: 10px; align-items: center; margin-bottom: 26px; flex-wrap: wrap; }

.qty { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface); overflow: hidden; }
.qty button {
  width: 34px; height: 36px; border: 0; background: none; cursor: pointer;
  color: var(--text-dim); font-size: 17px; display: grid; place-items: center;
}
.qty button:hover:not(:disabled) { background: var(--surface-2); color: var(--accent); }
.qty button:disabled { opacity: .35; cursor: not-allowed; }
.qty__val { min-width: 34px; text-align: center; font-weight: 650; font-variant-numeric: tabular-nums; font-size: 14px; }

.specs { width: 100%; border-collapse: collapse; font-size: 14px; }
.specs th, .specs td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.specs th { color: var(--text-dim); font-weight: 500; width: 46%; }
.specs td { font-weight: 550; }
.specs tr:last-child th, .specs tr:last-child td { border-bottom: 0; }
.specs__wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }

.section-title { font-size: 19px; margin: 40px 0 16px; }

/* ---------------- Кошик (drawer) ---------------- */

.drawer__backdrop, .modal__backdrop, .sidebar__backdrop {
  position: fixed; inset: 0; background: rgba(16, 18, 22, .45); z-index: 90;
  animation: fade .18s ease;
}
@keyframes fade { from { opacity: 0; } }

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 420px; max-width: 100%;
  background: var(--bg); z-index: 100; display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg); transform: translateX(100%);
  transition: transform .26s cubic-bezier(.32, .72, 0, 1); visibility: hidden;
}
.drawer.is-open { transform: translateX(0); visibility: visible; }

.drawer__head, .modal__head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 18px; border-bottom: 1px solid var(--border); background: var(--surface); flex-shrink: 0;
}
.drawer__head h2, .modal__head h2 { font-size: 17px; }
.drawer__body { flex: 1; overflow-y: auto; padding: 14px 18px; }
.drawer__foot { padding: 16px 18px; border-top: 1px solid var(--border); background: var(--surface); flex-shrink: 0; }

.cline { display: flex; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--border); }
.cline:last-child { border-bottom: 0; }
.cline__img { width: 62px; height: 62px; border-radius: var(--r-sm); flex-shrink: 0; }
.cline__main { flex: 1; min-width: 0; }
.cline__name { font-size: 14px; font-weight: 600; line-height: 1.35; margin-bottom: 2px; cursor: pointer; background: none; border: 0; padding: 0; text-align: left; color: inherit; font-family: inherit; }
.cline__name:hover { color: var(--accent); }
.cline__variant { font-size: 12.5px; color: var(--text-mute); margin-bottom: 8px; }
.cline__row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cline__sum { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cline__del { border: 0; background: none; cursor: pointer; color: var(--text-mute); padding: 5px; border-radius: 6px; display: grid; place-items: center; }
.cline__del:hover { color: var(--red); background: var(--surface-2); }

.promo { display: flex; gap: 8px; margin-bottom: 14px; }
.promo input {
  flex: 1; min-width: 0; height: 38px; padding: 0 12px; border: 1px solid var(--border);
  border-radius: var(--r-sm); background: var(--surface-2); text-transform: uppercase;
}
.promo input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.promo__msg { font-size: 13px; margin: -8px 0 12px; }
.promo__msg--ok { color: var(--green); }
.promo__msg--err { color: var(--red); }
.promo__hint { font-size: 12.5px; color: var(--text-mute); margin: -6px 0 12px; }

.sum { display: flex; flex-direction: column; gap: 7px; margin-bottom: 14px; font-size: 14px; }
.sum__row { display: flex; justify-content: space-between; gap: 12px; color: var(--text-dim); }
.sum__row span:last-child { font-variant-numeric: tabular-nums; color: var(--text); font-weight: 550; }
.sum__row--discount span:last-child { color: var(--green); }
.sum__row--total { font-size: 18px; font-weight: 700; color: var(--text); padding-top: 10px; border-top: 1px solid var(--border); }
.sum__row--total span:last-child { font-size: 20px; font-weight: 750; }

/* ---------------- Модалка оформлення ---------------- */

.modal {
  position: fixed; z-index: 100; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 620px; max-width: calc(100% - 32px); max-height: calc(100vh - 48px);
  background: var(--bg); border-radius: var(--r); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; overflow: hidden;
  animation: pop .2s cubic-bezier(.32, .72, 0, 1);
}
@keyframes pop { from { opacity: 0; transform: translate(-50%, -46%) scale(.97); } }

.modal__body { flex: 1; overflow-y: auto; padding: 20px; }
.modal__foot {
  padding: 16px 20px; border-top: 1px solid var(--border); background: var(--surface);
  display: flex; gap: 10px; justify-content: space-between; align-items: center; flex-shrink: 0;
}

.steps { display: flex; gap: 6px; padding: 14px 20px; background: var(--surface); border-bottom: 1px solid var(--border); flex-shrink: 0; }
.steps__item {
  flex: 1; display: flex; align-items: center; gap: 8px; font-size: 13.5px;
  color: var(--text-mute); font-weight: 550;
}
.steps__num {
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-2); border: 1.5px solid var(--border); font-size: 12px; flex-shrink: 0;
  transition: all .18s;
}
.steps__item.is-active { color: var(--text); }
.steps__item.is-active .steps__num { background: var(--accent); border-color: var(--accent); color: #fff; }
.steps__item.is-done { color: var(--green); }
.steps__item.is-done .steps__num { background: var(--green); border-color: var(--green); color: #fff; }

.field { margin-bottom: 15px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field input, .field textarea {
  width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--border);
  border-radius: var(--r-sm); background: var(--surface);
}
.field textarea { height: 76px; padding: 10px 12px; resize: vertical; font-family: inherit; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field.has-error input, .field.has-error textarea { border-color: var(--red); }
.field__err { color: var(--red); font-size: 12.5px; margin-top: 5px; display: none; }
.field.has-error .field__err { display: block; }
.field__hint { color: var(--text-mute); font-size: 12.5px; margin-top: 5px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.option {
  display: flex; align-items: flex-start; gap: 11px; padding: 13px 14px;
  border: 1.5px solid var(--border); border-radius: var(--r); background: var(--surface);
  cursor: pointer; margin-bottom: 10px; transition: border-color .15s, background .15s;
}
.option:hover { border-color: var(--border-strong); }
.option.is-active { border-color: var(--accent); background: var(--accent-soft); }
.option input { position: absolute; opacity: 0; width: 0; height: 0; }
.option__radio {
  width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border-strong);
  flex-shrink: 0; margin-top: 2px; display: grid; place-items: center; transition: border-color .15s; background: var(--surface);
}
.option__radio::after { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); transform: scale(0); transition: transform .15s; }
.option.is-active .option__radio { border-color: var(--accent); }
.option.is-active .option__radio::after { transform: scale(1); }
.option__main { flex: 1; min-width: 0; display: block; }
.option__name { display: block; font-weight: 600; font-size: 14.5px; }
.option__desc { display: block; font-size: 13px; color: var(--text-dim); margin-top: 2px; }
.option__price { font-weight: 650; white-space: nowrap; font-variant-numeric: tabular-nums; }
.option__price--free { color: var(--green); }

.review { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 14px 16px; margin-bottom: 16px; }
.review__row { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; font-size: 14px; }
.review__row dt { color: var(--text-dim); margin: 0; }
.review__row dd { margin: 0; font-weight: 550; text-align: right; }

.success { text-align: center; padding: 26px 10px; }
.success__icon {
  width: 62px; height: 62px; border-radius: 50%; background: var(--green); color: #fff;
  display: grid; place-items: center; margin: 0 auto 18px;
  animation: pop-in .35s cubic-bezier(.34, 1.56, .64, 1);
}
@keyframes pop-in { from { transform: scale(0); } }
.success h3 { font-size: 21px; margin-bottom: 8px; }
.success p { color: var(--text-dim); margin: 0 0 18px; }
.success__num {
  display: inline-block; font-size: 22px; font-weight: 750; letter-spacing: .04em;
  padding: 11px 22px; background: var(--surface); border: 1px dashed var(--accent);
  border-radius: var(--r); color: var(--accent); margin-bottom: 18px;
}
.success__details { text-align: left; max-width: 400px; margin: 0 auto; }

/* ---------------- Плашка демо + тост ---------------- */

.demo-badge {
  position: fixed; left: 14px; bottom: 14px; z-index: 80;
  display: flex; align-items: center; gap: 7px;
  padding: 7px 13px; border-radius: 999px; font-size: 12.5px; font-weight: 550;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  color: var(--text-dim); border: 1px solid var(--border); box-shadow: var(--shadow);
  backdrop-filter: blur(8px); pointer-events: none;
}
.demo-badge__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 12px); z-index: 130;
  padding: 12px 20px; border-radius: var(--r); background: #23262b; color: #fff;
  font-size: 14px; font-weight: 550; box-shadow: var(--shadow-lg);
  opacity: 0; transition: opacity .2s, transform .2s; max-width: calc(100% - 32px); text-align: center;
  pointer-events: none; /* сповіщення не має перекривати кнопки під ним */
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
[data-theme="dark"] .toast { background: #f2f3f5; color: #14161a; }

/* ---------------- Підвал ---------------- */

.footer { border-top: 1px solid var(--border); background: var(--surface); padding: 26px 0; margin-top: auto; }
.footer__inner { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; color: var(--text-dim); font-size: 13.5px; }
.footer p { margin: 0; }

/* ---------------- Адаптив ---------------- */

@media (max-width: 1000px) {
  .layout { grid-template-columns: 1fr; }
  .icon-btn--filters { display: grid; }

  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: 300px; max-width: 86%;
    z-index: 100; border-radius: 0; border: 0; border-right: 1px solid var(--border);
    max-height: none; transform: translateX(-100%); visibility: hidden;
    transition: transform .26s cubic-bezier(.32, .72, 0, 1); box-shadow: var(--shadow-lg);
    padding: 4px 18px 24px;
  }
  .sidebar.is-open { transform: translateX(0); visibility: visible; }
  .sidebar__close { display: grid; }
  .sidebar__backdrop { display: block; }

  .pd { grid-template-columns: 1fr; gap: 26px; }
  .hero { padding-top: 24px; }
}

@media (max-width: 720px) {
  .header__inner { flex-wrap: wrap; height: auto; padding-top: 10px; padding-bottom: 10px; gap: 10px; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .header__actions { margin-left: auto; }
  .header { position: static; }
  .sidebar { top: 0; }

  .hero { padding: 20px 20px 14px; }
  .hero__title { font-size: 24px; }
  .hero__sub { font-size: 14px; }
  .hero__chips { width: 100%; overflow-x: auto; padding-bottom: 4px; flex-wrap: nowrap; }

  .grid { grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 12px; }
  .card__body { padding: 11px 12px 12px; gap: 6px; }
  .card__rating { white-space: nowrap; overflow: hidden; }
  .card__name { font-size: 13.5px; }
  .card__price { font-size: 16px; }
  .card__actions .btn { flex: 1; padding: 0 8px; font-size: 13px; }

  .toolbar { gap: 10px; }
  .select__label { display: none; }

  .pd__title { font-size: 21px; }
  .pd__price { font-size: 25px; }
  .gallery__thumb { width: 60px; height: 48px; }

  .modal { top: auto; bottom: 0; left: 0; transform: none; width: 100%; max-width: 100%;
    max-height: 92vh; border-radius: var(--r) var(--r) 0 0; animation: slide-up .24s cubic-bezier(.32, .72, 0, 1); }
  @keyframes slide-up { from { transform: translateY(100%); } }
  .steps { padding: 12px 14px; }
  .steps__text { display: none; }
  .steps__item { flex: 0 0 auto; }
  .modal__body, .modal__foot { padding: 16px 14px; }
  .field-row { grid-template-columns: 1fr; }

  .demo-badge { left: 10px; bottom: 10px; font-size: 11.5px; padding: 6px 11px; }
  .footer__inner { flex-direction: column; gap: 6px; }
}

@media (max-width: 400px) {
  .logo__text { display: none; }
  .grid { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}
