/* ─────────────────────── DESIGN TOKENS ─────────────────────── */
:root {
  --bg: #0b0b18;
  --bg-2: #11111f;
  --panel: #16162a;
  --panel-2: #1a1a30;
  --panel-3: #20203a;
  --border: #2a2a48;
  --border-soft: #1f1f3a;

  --text: #e8e8f5;
  --text-dim: #8a8aaa;
  --text-faint: #b0b0d0;

  --primary: #6366f1;
  --primary-hi: #818cf8;
  --primary-grad: linear-gradient(135deg, #4f46e5, #7c3aed);
  --primary-grad-hi: linear-gradient(135deg, #6366f1, #8b5cf6);

  --good: #34d399;
  --good-soft: rgba(52, 211, 153, 0.12);
  --warn: #fbbf24;
  --danger: #f87171;
  --voice: #ef4444;
  --voice-grad: linear-gradient(135deg, #ef4444, #dc2626);

  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 0 2px rgba(99, 102, 241, 0.25);

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
}

/* ─────────────────────── RESET ─────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
[hidden] { display: none !important; }

html, body {
  height: 100%;
  width: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}
body {
  display: flex;
  flex-direction: column;
}
button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
}
input, button { font: inherit; }

/* Custom scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #3a3a5a; }

/* ─────────────────────── TOP BAR ─────────────────────── */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: rgba(22, 22, 42, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-soft);
  flex-shrink: 0;
  z-index: 10;
}
.title {
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.2px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.title::before {
  content: "🛍";
  font-size: 19px;
}
.top-right {
  display: flex;
  align-items: center;
  gap: 14px;
}
.status {
  font-size: 12px;
  color: var(--text-dim);
  padding: 5px 12px;
  background: var(--panel-2);
  border-radius: 999px;
  border: 1px solid var(--border-soft);
}
.user-info {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-faint);
  padding: 5px 12px;
  background: var(--panel-2);
  border-radius: 999px;
  border: 1px solid var(--border-soft);
}
.btn-logout, .btn-icon {
  height: 30px;
  padding: 0 14px;
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.15s ease;
  cursor: pointer;
}
.btn-icon:hover {
  color: #fff;
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.1);
}
.btn-logout:hover {
  color: #fff;
  border-color: var(--danger);
  background: rgba(248, 113, 113, 0.1);
}

/* ─────────────────────── CHAT VIEW ─────────────────────── */
.chat-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 0%, rgba(99, 102, 241, 0.08), transparent 50%),
    radial-gradient(circle at 80% 100%, rgba(124, 58, 237, 0.06), transparent 50%),
    var(--bg);
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 32px 0 16px;
  scroll-behavior: smooth;
}

/* ─── Welcome ─── */
.welcome {
  max-width: 720px;
  margin: 0 auto;
  padding: 60px 24px 40px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.welcome-icon {
  font-size: 64px;
  line-height: 1;
  margin-bottom: 18px;
  filter: drop-shadow(0 6px 20px rgba(99, 102, 241, 0.3));
  animation: float 3s ease-in-out infinite;
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.welcome-title {
  font-size: 32px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.6px;
  margin-bottom: 12px;
  background: linear-gradient(135deg, #fff, #b0b0d0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.welcome-text {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-faint);
  max-width: 520px;
  margin-bottom: 28px;
}
.welcome-examples {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}
.example-chip {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text-faint);
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.18s ease;
  cursor: pointer;
}
.example-chip:hover {
  background: var(--panel-3);
  color: #fff;
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

/* ─── Messages ─── */
.msg {
  max-width: 920px;
  margin: 12px auto;
  padding: 0 28px;
  display: flex;
  animation: slideIn 0.3s ease;
}
@keyframes slideIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.msg.user { justify-content: flex-end; }
.msg.assistant, .msg.system { justify-content: flex-start; }

.bubble {
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
  box-shadow: var(--shadow-sm);
}
.msg.user .bubble {
  background: var(--primary-grad);
  color: #fff;
  border-bottom-right-radius: 6px;
  font-weight: 500;
  max-width: 70%;
}
.msg.assistant .bubble {
  background: var(--panel-2);
  border: 1px solid var(--border-soft);
  color: var(--text);
  border-bottom-left-radius: 6px;
  width: 100%;
  max-width: 100%;
}
.msg.system .bubble {
  background: transparent;
  color: var(--text-dim);
  font-size: 12px;
  font-style: italic;
  padding: 4px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.msg.system .bubble::before {
  content: "";
  width: 12px; height: 12px;
  border: 2px solid var(--text-dim);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.msg-title {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 6px;
  letter-spacing: -0.2px;
}
.msg-sub {
  color: var(--text-dim);
  font-size: 12.5px;
  margin-bottom: 14px;
}

/* ─── Clarification ─── */
.clarify-question {
  font-size: 17px;
  color: #fff;
  font-weight: 600;
  margin-bottom: 14px;
  letter-spacing: -0.2px;
}
.clarify-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.clarify-chip {
  background: var(--panel-3);
  border: 1.5px solid var(--primary);
  color: #fff;
  border-radius: 999px;
  padding: 11px 22px;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.15s ease;
  cursor: pointer;
}
.clarify-chip:hover {
  background: var(--primary);
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
}

/* ─── Recipe ingredient block ─── */
.ingredient-block {
  margin: 14px 0;
  padding: 14px 0 12px;
  border-top: 1px solid var(--border-soft);
}
.ingredient-block:first-of-type {
  border-top: none;
  padding-top: 4px;
  margin-top: 8px;
}
.ingredient-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.ingredient-name {
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.1px;
}
.ingredient-zone {
  font-size: 11px;
  color: var(--text-dim);
  background: var(--panel-3);
  padding: 3px 10px;
  border-radius: 999px;
  flex-shrink: 0;
}
.ingredient-chosen {
  color: var(--good);
  font-size: 12.5px;
  margin-top: 10px;
  padding-left: 4px;
}
.ingredient-chosen.empty {
  color: var(--text-dim);
  font-style: italic;
}

/* ─── Gallery / Product cards ─── */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 12px;
  margin-top: 8px;
}
.product-card {
  background: var(--panel);
  border: 1.5px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 12px;
  cursor: pointer;
  transition: all 0.18s ease;
  display: flex;
  flex-direction: column;
  min-height: 232px;
  position: relative;
  overflow: hidden;
}
.product-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent, rgba(99, 102, 241, 0.06));
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}
.product-card:hover {
  border-color: var(--primary);
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(99, 102, 241, 0.18);
}
.product-card:hover::before { opacity: 1; }
.product-card.out { opacity: 0.5; }
.product-image {
  width: 100%;
  height: 130px;
  object-fit: contain;
  /* Белая подложка под все фото: часть изображений каталога идёт с
     прозрачным фоном, и на тёмной карточке они выглядели бы разнородно. */
  background: #fff;
  padding: 6px;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
}
.product-image-placeholder {
  width: 100%;
  height: 130px;
  background: var(--bg-2);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #4a4a6a;
  font-size: 11px;
  letter-spacing: 0.3px;
}
.product-name {
  color: #f0f0ff;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 4px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  letter-spacing: -0.1px;
}
.product-brand {
  color: var(--text-dim);
  font-size: 10.5px;
  margin-bottom: 8px;
  font-weight: 500;
}
.product-meta {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  padding-top: 6px;
  border-top: 1px solid var(--border-soft);
}
.product-price {
  color: #6cd4ff;
  font-weight: 700;
  font-size: 13px;
}
.product-stock {
  color: var(--good);
  font-size: 11px;
  font-weight: 600;
}
.product-stock.out { color: var(--danger); }

/* ─── Basket bar ─── */
.basket-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: rgba(22, 22, 42, 0.92);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-soft);
  flex-shrink: 0;
  animation: slideUp 0.25s ease;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.basket-info {
  color: var(--text-faint);
  font-size: 13.5px;
}
#basketSummary {
  font-weight: 600;
  color: #fff;
}

/* ─────────────────────── MAP VIEW (full-screen overlay) ─────────────────────── */
.map-view {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #11111f;
  overflow: hidden;
  cursor: grab;
  display: flex;
  flex-direction: column;
}
.map-view.dragging #map { cursor: grabbing; }
#map { flex: 1; width: 100%; display: block; }
.map-hint {
  position: absolute;
  bottom: 14px; right: 18px;
  font-size: 11px;
  color: var(--text-dim);
  background: rgba(11, 11, 24, 0.85);
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  pointer-events: none;
  backdrop-filter: blur(8px);
  z-index: 5;
}
.back-btn {
  position: absolute;
  top: 18px; left: 18px;
  z-index: 12;
  height: 42px;
  padding: 0 22px;
  background: rgba(22, 22, 42, 0.92);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius);
  transition: all 0.15s ease;
  cursor: pointer;
  box-shadow: var(--shadow-md);
}
.back-btn:hover {
  background: var(--panel-3);
  transform: translateX(-2px);
}

/* Inside map view: floating results panel (collapsible) */
.map-view .results {
  position: absolute;
  bottom: 18px; left: 18px;
  width: 460px;
  max-width: calc(100vw - 36px);
  max-height: 50vh;
  background: rgba(22, 22, 42, 0.94);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 8;
  margin: 0;
  padding: 14px 18px;
}

/* ─────────────────────── RESULTS PANEL ─────────────────────── */
.results {
  padding: 12px 24px;
  background: var(--panel);
  border-top: 1px solid var(--border-soft);
  max-height: 240px;
  min-height: 56px;
  overflow-y: auto;
  font-size: 12.5px;
  line-height: 1.7;
  flex-shrink: 0;
}
.result-header {
  font-weight: 700;
  color: #fff;
  margin-bottom: 8px;
  font-size: 13.5px;
  letter-spacing: -0.1px;
}
.result-item {
  padding: 2px 0;
  color: var(--text-faint);
  font-family: 'JetBrains Mono', ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
}
.result-item.ok { color: var(--good); }
.result-item.out { color: var(--warn); }
.result-item.none { color: var(--danger); }
.result-item .price { color: #6cd4ff; font-weight: 700; }
.result-item .stock { color: var(--text-dim); }
.beacon-chain {
  margin-top: 10px;
  color: #818cf8;
  font-size: 11.5px;
  word-break: break-word;
  padding: 8px 12px;
  background: var(--bg-2);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--primary);
}

/* ─────────────────────── SEARCH BAR ─────────────────────── */
.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 24px;
  background: rgba(22, 22, 42, 0.92);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-soft);
  flex-shrink: 0;
}
#searchInput {
  flex: 1;
  height: 50px;
  padding: 0 20px;
  background: var(--panel-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: #fff;
  font-size: 15px;
  outline: none;
  transition: all 0.15s ease;
}
#searchInput:focus {
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
  background: var(--panel-3);
}
#searchInput::placeholder { color: #5a5a7a; }

.btn-primary,
.basket-bar .btn-primary {
  height: 50px;
  padding: 0 26px;
  background: var(--primary-grad);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--radius);
  min-width: 120px;
  transition: all 0.15s ease;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}
.btn-primary:hover:not(:disabled),
.basket-bar .btn-primary:hover:not(:disabled) {
  background: var(--primary-grad-hi);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
}
.btn-primary:disabled,
.basket-bar .btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}
.basket-bar .btn-primary {
  height: 42px;
  font-size: 14px;
  min-width: auto;
  padding: 0 22px;
}

.btn-voice {
  height: 50px;
  padding: 0 22px;
  background: var(--voice-grad);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius);
  min-width: 110px;
  transition: all 0.15s ease;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}
.btn-voice:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(239, 68, 68, 0.4);
}
.btn-voice.listening {
  animation: pulseRed 1.2s infinite;
}
@keyframes pulseRed {
  0%, 100% { box-shadow: 0 4px 12px rgba(239, 68, 68, 0.5), 0 0 0 0 rgba(239, 68, 68, 0.6); }
  50% { box-shadow: 0 4px 12px rgba(239, 68, 68, 0.5), 0 0 0 16px rgba(239, 68, 68, 0); }
}

.btn-secondary {
  height: 50px;
  padding: 0 22px;
  background: var(--panel-3);
  color: var(--text-faint);
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius);
  min-width: 100px;
  border: 1px solid var(--border);
  transition: all 0.15s ease;
}
.btn-secondary:hover {
  background: var(--border);
  color: #fff;
}

/* ─────────────────────── SVG MAP ─────────────────────── */
.grid-line { stroke: #1f1f3a; stroke-width: 0.5; }
.wall { fill: #2a2a4a; }
.zone-rect { stroke-width: 1.5; }
.zone-label {
  fill: rgba(255, 255, 255, 0.85);
  font-size: 12px; font-weight: 700;
  text-anchor: middle; pointer-events: none; user-select: none;
}
.zone-sublabel {
  fill: rgba(255, 255, 255, 0.5); font-size: 9px;
  text-anchor: middle; pointer-events: none; user-select: none;
}
.shelf-rect { stroke-width: 1; }
.shelf-label {
  fill: rgba(255, 255, 255, 0.55); font-size: 8px;
  text-anchor: middle; pointer-events: none; user-select: none;
}
.beacon-pole { stroke: rgba(255, 255, 255, 0.55); stroke-width: 2; }
.beacon-flag-num {
  fill: #fff; font-size: 8px; font-weight: 700;
  text-anchor: middle; pointer-events: none; user-select: none;
}
.entrance-rect { fill: var(--primary); }
.entrance-label {
  fill: #fff; font-size: 14px; font-weight: 700;
  text-anchor: middle; user-select: none;
}
.player-glow { fill: var(--primary); opacity: 0.25; }
.player-dot {
  fill: url(#playerGrad);
  stroke: #fff; stroke-width: 3;
  filter: drop-shadow(0 0 8px rgba(99, 102, 241, 0.6));
}
.player-label {
  fill: #fff; font-size: 11px; font-weight: 700;
  text-anchor: middle; user-select: none;
}
.route-shadow {
  fill: none; stroke: rgba(0, 0, 0, 0.4); stroke-width: 11;
  stroke-linecap: round; stroke-linejoin: round;
}
.route-main {
  fill: none; stroke-width: 6;
  stroke-linecap: round; stroke-linejoin: round;
}
.route-dash {
  fill: none; stroke: #fff; stroke-width: 2;
  stroke-dasharray: 10 6; stroke-linecap: round;
}
.stop-flag-bg { stroke: #fff; stroke-width: 3; }
.stop-flag-num {
  fill: #fff; font-size: 13px; font-weight: 700;
  text-anchor: middle; dominant-baseline: central; user-select: none;
}
.zone-highlight { fill-opacity: 0.25; stroke-width: 4; }

/* ─────────────────────── RESPONSIVE ─────────────────────── */
@media (max-width: 720px) {
  .top-bar { padding: 12px 16px; }
  .status { display: none; }
  .msg { padding: 0 16px; }
  .welcome { padding: 40px 20px 30px; }
  .welcome-icon { font-size: 52px; }
  .welcome-title { font-size: 26px; }
  .search-bar { padding: 12px 16px; gap: 8px; }
  .btn-primary, .btn-voice, .btn-secondary { min-width: auto; padding: 0 14px; font-size: 13px; }
  .basket-bar { padding: 12px 16px; }
}

/* ─────────────── ПАНЕЛЬ ФИЛЬТРОВ (ТЗ B5, B6, B9) ─────────────── */
.filter-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 12px 0 16px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
}

.filter-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.filter-label {
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim);
  min-width: 118px;
  flex-shrink: 0;
}

.filter-chip {
  font: inherit;
  font-size: 12.5px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1.5px solid var(--border-soft);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.filter-chip:hover {
  border-color: var(--primary-hi);
  background: rgba(99, 102, 241, 0.12);
}

.filter-chip.active {
  background: var(--primary-grad);
  border-color: transparent;
  color: #fff;
  font-weight: 600;
}

/* ─────────────── АКЦИИ, РЕЙТИНГ, ЗАМЕНА (ТЗ A5, A6, D2, D3) ─────────────── */
.promo-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 3px 8px;
  border-radius: 6px;
  background: linear-gradient(135deg, #dc2626, #f43f5e);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.4);
}

.product-rating {
  font-size: 12px;
  color: #fbbf24;
  margin-top: 2px;
}

.product-price-old {
  font-size: 12px;
  color: var(--text-dim);
  text-decoration: line-through;
  margin-left: 6px;
}

.alt-btn {
  font: inherit;
  font-size: 11.5px;
  margin-top: 8px;
  padding: 6px 10px;
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1.5px solid rgba(244, 63, 94, 0.45);
  background: rgba(244, 63, 94, 0.12);
  color: #fda4af;
  cursor: pointer;
  transition: all 0.15s ease;
}

.alt-btn:hover {
  background: rgba(244, 63, 94, 0.22);
  border-color: #f43f5e;
}

.filter-toggle {
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  align-self: flex-start;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1.5px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s ease;
}

.filter-toggle:hover {
  border-color: var(--primary-hi);
  background: rgba(99, 102, 241, 0.14);
}

.filter-groups {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
  max-height: 300px;
  overflow-y: auto;
}

/* ─────────────── ДИАЛОГ СУЖЕНИЯ ВЫБОРА (ТЗ B6–B9) ─────────────── */
.dialog-step { display: flex; flex-direction: column; gap: 12px; }

.dialog-context {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.context-chip {
  font-size: 11.5px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.18);
  border: 1px solid rgba(129, 140, 248, 0.45);
  color: var(--primary-hi);
  white-space: nowrap;
}

.dialog-counter {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.02em;
}

.dialog-question {
  font-size: 17px;
  font-weight: 650;
  line-height: 1.35;
  color: var(--text);
}

.dialog-options {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.dialog-option {
  font: inherit;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius);
  border: 1.5px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s ease;
}

.dialog-option:hover {
  background: var(--primary-grad);
  border-color: transparent;
  color: #fff;
  transform: translateY(-1px);
}

.opt-count {
  font-size: 11px;
  opacity: 0.65;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.dialog-controls {
  display: flex;
  gap: 8px;
  margin-top: 2px;
}

.dialog-ctl {
  font: inherit;
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.15s ease;
}

.dialog-ctl:hover {
  color: var(--text);
  border-color: var(--primary-hi);
}

/* Компактная галерея для товаров-примеров по ходу диалога */
.gallery-grid.compact { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.gallery-grid.compact .product-card { min-height: 190px; }
.gallery-grid.compact .product-image,
.gallery-grid.compact .product-image-placeholder { height: 96px; }

/* ─────────────── КНОПКИ НА КАРТОЧКЕ ТОВАРА ─────────────── */
.card-actions {
  display: flex;
  gap: 6px;
  margin-top: 9px;
}

.card-btn {
  flex: 1;
  font: inherit;
  font-size: 11.5px;
  font-weight: 600;
  padding: 7px 8px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-faint);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.card-btn:hover {
  color: #fff;
  border-color: var(--primary-hi);
  background: rgba(99, 102, 241, 0.16);
}

.card-btn.primary {
  background: var(--primary-grad);
  border-color: transparent;
  color: #fff;
}

.card-btn.primary:hover { background: var(--primary-grad-hi); }

.card-btn.added {
  background: var(--good-soft);
  border-color: var(--good);
  color: var(--good);
}

/* ─────────────── КАРТОЧКА ТОВАРА (окно) ─────────────── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 4, 12, 0.72);
  backdrop-filter: blur(6px);
}

.modal-card {
  position: relative;
  width: min(760px, 100%);
  max-height: 86vh;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 24px;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
}

.modal-close:hover { color: #fff; border-color: var(--danger); }

.modal-loading { color: var(--text-dim); padding: 20px; text-align: center; }

.modal-body { display: flex; gap: 22px; flex-wrap: wrap; }

.modal-image {
  width: 240px;
  height: 240px;
  flex-shrink: 0;
  background: #fff;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
  font-size: 12px;
  padding: 10px;
}

.modal-image img { max-width: 100%; max-height: 100%; object-fit: contain; }

.modal-info { flex: 1; min-width: 260px; display: flex; flex-direction: column; gap: 9px; }
.modal-name { font-size: 19px; font-weight: 700; color: #fff; line-height: 1.3; }
.modal-brand { font-size: 13px; color: var(--text-dim); }
.modal-price { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.modal-price-now { font-size: 24px; font-weight: 700; color: var(--primary-hi); }
.modal-where { font-size: 12.5px; color: var(--text-faint); }

.modal-props {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  margin-top: 4px;
}

.modal-props td { padding: 5px 8px; border-bottom: 1px solid var(--border-soft); }
.modal-props td:first-child { color: var(--text-dim); width: 45%; }

.modal-desc {
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-faint);
  max-height: 150px;
  overflow-y: auto;
}

.modal-add { flex: none; align-self: flex-start; padding: 9px 20px; font-size: 13px; }
