/* Чат «Задать вопрос» (14.11.2026, templates/_support_chat.html, static/js/support_chat.js).
   Только токены tokens.css (светлая/тёмная тема). Кнопки - с префиксом #supportChat: глобальное правило кнопок
   public.css (button:not(.btn):not(...) - специфичность 0,14,1) иначе перебивает фон и рамку. Иконки - только из
   урезанного шрифта сайта (static/fonts/material-symbols-public.txt). Кнопка - в правом нижнем углу НАД баннером cookies и липкой панелью
   поиска на телефоне: отступ снизу (--scw-bottom) считает support_chat.js. z-index ниже баннера cookies (1000). */
.scw{--scw-bottom:20px;--scw-ink:var(--navy-900,#0f2747);font-family:var(--font-sans)}
.scw .sr-only{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}

#supportChat .scw-launcher{position:fixed;right:max(20px,env(safe-area-inset-right));bottom:calc(var(--scw-bottom) + env(safe-area-inset-bottom,0px));
  z-index:950;display:inline-flex;align-items:center;gap:8px;min-height:48px;padding:0 20px 0 16px;
  border:0;border-radius:var(--radius-pill);background:var(--scw-ink);color:#fff;
  font:inherit;font-size:15px;font-weight:600;line-height:1;cursor:pointer;box-shadow:var(--shadow-lg);
  transition:bottom var(--dur-base) var(--ease-out)}
#supportChat .scw-launcher .material-symbols-outlined{font-size:22px;color:var(--orange-400,#ff9a4d)}
#supportChat .scw-launcher:hover{background:var(--navy-700,#1b3d6b)}
#supportChat .scw-launcher:focus-visible,#supportChat button:focus-visible,#supportChat a:focus-visible,#supportChat .scw-log:focus-visible{outline:3px solid var(--color-focus);outline-offset:2px}
#supportChat .scw-launcher[aria-expanded="true"]{display:none}
.scw-badge{position:absolute;top:-2px;right:-2px;width:14px;height:14px;border-radius:50%;
  background:var(--color-accent);border:2px solid var(--color-surface)}
.scw-badge[hidden]{display:none}

.scw-panel{position:fixed;right:max(20px,env(safe-area-inset-right));bottom:calc(var(--scw-bottom) + env(safe-area-inset-bottom,0px));
  z-index:960;width:min(380px,calc(100vw - 32px));height:min(580px,calc(100vh - 120px));height:min(580px,calc(100dvh - 120px));
  display:flex;flex-direction:column;background:var(--color-surface);color:var(--color-text);
  border:1px solid var(--color-border-strong);border-radius:var(--radius-xl);box-shadow:var(--shadow-lg);overflow:hidden}
.scw-panel[hidden]{display:none}
@media (prefers-reduced-motion:no-preference){
  .scw-panel:not([hidden]){animation:scw-in var(--dur-slow) var(--ease-out)}
  @keyframes scw-in{from{opacity:0;transform:translateY(12px)}to{opacity:1;transform:none}}
}

.scw-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;padding:14px 12px 12px 18px;
  background:var(--scw-ink);color:#fff}
.scw-title{margin:0;font-size:17px;line-height:1.3;font-weight:700;color:#fff}
.scw-sub{margin:2px 0 0;font-size:13px;line-height:1.4;color:rgba(255,255,255,.78)}
#supportChat button.scw-close{flex:none;display:inline-flex;align-items:center;justify-content:center;width:40px;height:40px;
  border:0;border-radius:var(--radius-md);background:transparent;color:#fff;cursor:pointer;padding:0;box-shadow:none}
#supportChat button.scw-close:hover{background:rgba(255,255,255,.12)}

.scw-log{flex:1 1 auto;overflow-y:auto;overscroll-behavior:contain;padding:16px 14px;display:flex;flex-direction:column;gap:10px;
  background:var(--color-bg)}
.scw-msg{max-width:86%;display:flex;flex-direction:column;gap:3px}
.scw-msg p{margin:0;padding:9px 12px;border-radius:14px;font-size:14.5px;line-height:1.45;white-space:pre-wrap;overflow-wrap:anywhere}
.scw-msg time{font-size:11.5px;color:var(--color-text-subtle);padding:0 4px}
.scw-msg.is-operator{align-self:flex-start}
.scw-msg.is-operator p{background:var(--color-surface);border:1px solid var(--color-border);border-bottom-left-radius:4px;color:var(--color-text)}
.scw-msg.is-user{align-self:flex-end;align-items:flex-end}
.scw-msg.is-user p{background:var(--scw-ink);color:#fff;border-bottom-right-radius:4px}
.scw-msg.is-hello p{color:var(--color-text-2,var(--color-text))}
.scw-note{align-self:center;font-size:12.5px;color:var(--color-text-muted);text-align:center;margin:2px 0}

.scw-stub{flex:none;max-height:62%;overflow-y:auto;padding:12px 14px 14px;border-top:1px solid var(--color-border);
  background:var(--color-surface)}
.scw-stub[hidden]{display:none}
.scw-stub-text{margin:0 0 10px;padding:10px 12px;border-left:3px solid var(--color-accent);background:var(--color-accent-soft);
  border-radius:0 var(--radius-md) var(--radius-md) 0;font-size:14px;line-height:1.45;color:var(--color-text)}
.scw-contact{display:grid;gap:10px}
.scw-field{display:grid;gap:4px}
.scw-field label{font-size:13px;font-weight:600;color:var(--color-heading)}
.scw-opt{font-weight:400;color:var(--color-text-muted)}
.scw input[type=text],.scw input[type=tel],.scw input[type=email],.scw textarea{width:100%;box-sizing:border-box;margin:0;
  min-height:42px;padding:9px 12px;border:1px solid var(--color-border-input);border-radius:var(--radius-md);
  background:var(--color-surface);color:var(--color-text);font:inherit;font-size:15px;line-height:1.4;box-shadow:none}
.scw input:focus-visible,.scw textarea:focus-visible{outline:3px solid var(--color-focus);outline-offset:0;border-color:var(--color-focus)}
.scw [aria-invalid="true"]{border-color:var(--color-danger)}
.scw-consent{display:grid;grid-template-columns:auto 1fr;gap:4px 8px;align-items:start;font-size:13px;line-height:1.4;color:var(--color-text-2,var(--color-text))}
.scw-consent input{width:18px;height:18px;margin:1px 0 0;accent-color:var(--color-action)}
.scw-consent a{color:var(--color-link);text-decoration:underline}
.scw-consent .scw-err{grid-column:1/-1}
#supportChat button.scw-btn{min-height:44px;padding:0 18px;border:0;border-radius:var(--radius-md);background:var(--color-action);
  color:var(--color-on-action);font:inherit;font-size:15px;font-weight:600;cursor:pointer;box-shadow:none}
#supportChat button.scw-btn:hover{background:var(--color-action-hover)}
#supportChat button[disabled]{opacity:.6;cursor:progress}
.scw-thanks{margin:0;padding:10px 12px;border-radius:var(--radius-md);background:var(--color-success-bg);color:var(--color-success);
  border:1px solid var(--color-success-border);font-size:14px}

.scw-form{flex:none;padding:10px 12px 12px;border-top:1px solid var(--color-border);background:var(--color-surface);display:grid;gap:8px}
.scw-compose{display:flex;gap:8px;align-items:flex-end}
.scw textarea{resize:none;min-height:44px;max-height:132px}
#supportChat button.scw-send{flex:none;display:inline-flex;align-items:center;justify-content:center;width:44px;height:44px;padding:0;
  border:0;border-radius:50%;background:var(--color-action);color:var(--color-on-action);cursor:pointer;box-shadow:none}
#supportChat button.scw-send:hover{background:var(--color-action-hover)}
.scw-captcha{display:flex;align-items:center;gap:8px;font-size:13.5px;color:var(--color-text)}
.scw-captcha[hidden]{display:none}
.scw-captcha input[type=text]{width:72px;min-height:36px;padding:6px 10px}
.scw-hp{position:absolute;left:-10000px;width:1px;height:1px;overflow:hidden}
.scw-err{margin:0;font-size:13px;line-height:1.4;color:var(--color-danger)}
.scw-err[hidden]{display:none}

/* Телефон: окно - лист у нижнего края на всю ширину, кнопка компактнее */
@media (max-width:480px){
  #supportChat .scw-launcher{right:12px;min-height:44px;padding:0 16px 0 12px;font-size:14px}
  .scw-panel{left:8px;right:8px;width:auto;bottom:calc(8px + env(safe-area-inset-bottom,0px));
    height:calc(100vh - 72px);height:calc(100dvh - 72px);border-radius:var(--radius-lg)}
  .scw-msg{max-width:92%}
}
/* 16.11.2026: запас под кнопкой чата в конце подвала - в самом низу страницы кнопка не закрывает последние строки. */
body:has(#supportChat) .site-footer::after{content:"";display:block;height:64px}
@media print{.scw{display:none}}
