/* Snipe Messenger — правки 02.12.2026: тема в окнах/меню, единые значки, тумблеры, быстрые анимации.
   Подключается ПОСЛЕДНИМ (после theme13.css). */

/* 1. Токены поверхностей: раньше var(--surface) нигде не задавался -> у листов звонков/групповых звонков и части окон
      фон брался из запасного ТЁМНОГО цвета, а цвет текста (--text) переключался по теме => тёмный текст на тёмном. */
:root,[data-theme="light"]{--surface:#FFFFFF;--surface-2:#F2F2F6;--sw-on:#34C759;--sw-off:#D1D1D6;--sw-knob:#FFFFFF;--r-card:20px;--r-ctl:12px;--dur:.16s;--dur-slow:.22s;--dur-fast:.12s}
[data-theme="dark"]{--surface:#1C1C1F;--surface-2:#26262A;--sw-off:#48484A}
@media (prefers-color-scheme:dark){:root:not([data-theme="light"]){--surface:#1C1C1F;--surface-2:#26262A;--sw-off:#48484A}}
.cs-card,#gcBar{background:var(--surface)!important;color:var(--text-1,#111114)!important}
.cs-card small,.cs-card .cs-p{color:var(--text-2,#3A3A40)}
.cs-sec{color:var(--text-3,#5C5C66);opacity:1}
.cs-card{border-radius:var(--r-card) var(--r-card) 0 0}
@media(min-width:700px){.cs-card{border-radius:var(--r-card)}}
.call-sheet{background:rgba(0,0,0,.45)}
.cs-opt{border-radius:var(--r-ctl)}
.cs-opt:hover{background:var(--surface-2)}
.cs-act button{border-radius:var(--r-ctl);background:var(--accent,#D9360C)}
.cs-act button.ghost,.cs-tabs button{background:var(--surface-2);color:var(--text-1,#111114)}
.cs-tabs button.on{background:var(--accent,#D9360C);color:#fff}
.cs-row{border-bottom:1px solid var(--divider,rgba(127,127,127,.15))}

/* Нативные select/option и поля ввода следуют теме */
select,option,optgroup{background-color:var(--surface);color:var(--text-1,#111114)}
:root,[data-theme="light"]{color-scheme:light}[data-theme="dark"]{color-scheme:dark}
@media (prefers-color-scheme:dark){:root:not([data-theme="light"]){color-scheme:dark}}
input,textarea,select{caret-color:var(--accent,#D9360C)}
::placeholder{color:var(--text-3,#5C5C66);opacity:.8}

/* 2. Единые значки: линейные, сетка 24, stroke 2, скруглённые концы, цвет = currentColor */
svg.ico,svg.si-svg,.x13-ic svg,.ic svg,.row2 svg,.it svg,.dh-chev svg{stroke-linecap:round;stroke-linejoin:round}
svg.ico:not(.fillico),svg.si-svg{stroke-width:2}
.x13-ic svg,.x13-row .ic svg{stroke-width:2}
.si{display:inline-flex;align-items:center;justify-content:center;width:1.2em;height:1.2em;vertical-align:-.22em;line-height:1;flex:none}
.si svg{width:100%;height:100%;fill:none;stroke:currentColor}
.ch,.x13-row .ch{display:inline-flex;align-items:center;font-size:0!important;color:var(--text-3,#5C5C66);opacity:.75}
.ch .si,.x13-row .ch .si{width:20px;height:20px}
.x13-x,.x13-back{display:inline-flex;align-items:center;justify-content:center;font-size:0}
.x13-x .si,.x13-back svg{width:20px;height:20px}
.av .si{width:1.1em;height:1.1em}
button .si:only-child{width:20px;height:20px}
.sheet12 .card .row2 svg.ico,.row2 .ico{width:22px;height:22px;flex:none}

/* 3. Тумблеры как в iOS: зелёный во включённом, серый в выключенном */
input[type=checkbox].x13-sw,input[type=checkbox].sw,input[type=checkbox]:not([value]):not(.keep-check){
  -webkit-appearance:none;appearance:none;position:relative;display:inline-block;flex:none;width:50px;height:30px;min-width:50px;margin:0;border:0;border-radius:15px;
  background:var(--sw-off)!important;cursor:pointer;transition:background var(--dur) ease;vertical-align:middle;outline:0;accent-color:var(--sw-on)}
input[type=checkbox].x13-sw::after,input[type=checkbox].sw::after,input[type=checkbox]:not([value]):not(.keep-check)::after{
  content:"";position:absolute;top:2px;left:2px;width:26px;height:26px;border-radius:50%;background:var(--sw-knob);box-shadow:0 1px 3px rgba(0,0,0,.28);transition:transform var(--dur) ease}
input[type=checkbox].x13-sw:checked,input[type=checkbox].sw:checked,input[type=checkbox]:not([value]):not(.keep-check):checked{background:var(--sw-on)!important}
input[type=checkbox].x13-sw:checked::after,input[type=checkbox].sw:checked::after,input[type=checkbox]:not([value]):not(.keep-check):checked::after{transform:translateX(20px)}
input[type=checkbox].x13-sw:focus-visible,input[type=checkbox].sw:focus-visible,input[type=checkbox]:not([value]):focus-visible{box-shadow:0 0 0 3px color-mix(in srgb,var(--sw-on) 35%,transparent)}
button.sw,span.sw,div.sw{position:relative;width:50px;height:30px;min-width:50px;border-radius:15px;background:var(--sw-off)!important;border:0;flex:none;transition:background var(--dur) ease;cursor:pointer}
button.sw.on,span.sw.on,div.sw.on{background:var(--sw-on)!important}
.sw i{top:2px!important;left:2px!important;width:26px!important;height:26px!important;background:var(--sw-knob)!important;box-shadow:0 1px 3px rgba(0,0,0,.28)!important;transition:transform var(--dur) ease!important}
.sw.on i{transform:translateX(20px)!important}
/* выбор строк в списках (контакты, пересылка): круглая отметка той же системы */
input[type=checkbox][value]{-webkit-appearance:none;appearance:none;position:relative;flex:none;width:24px;height:24px;margin:0;border-radius:50%;border:2px solid var(--sw-off);background:transparent;cursor:pointer;transition:background var(--dur),border-color var(--dur)}
input[type=checkbox][value]:checked{background:var(--sw-on);border-color:var(--sw-on)}
input[type=checkbox][value]:checked::after{content:"";position:absolute;left:6px;top:2px;width:6px;height:11px;border:solid #fff;border-width:0 2.5px 2.5px 0;transform:rotate(45deg)}

/* 4. Быстрые переходы 150–250 мс, без «пружин» и долгих появлений */
body.s12 .modal>.card,.sheet12 .card{animation-duration:.22s!important}
body.s12 .modal.closing>.card{animation-duration:.16s!important}
.s12-xrow{animation-duration:.18s!important}
.x13-page{animation-duration:.2s!important}
.x13-dot.on{animation-duration:.2s!important}
.x13-sheet{animation-duration:.16s!important}
.gift-card .e{animation-duration:.22s!important}
.ripple{animation-duration:.25s!important}
.shake{animation-duration:.24s!important}
.in-fwd,.in-back,.in-item,.msg.in-msg{animation-duration:.2s!important}
@media (prefers-reduced-motion:reduce){*{animation-duration:.01ms!important;transition-duration:.01ms!important}}

/* 5. Нижнее меню: форма/расположение прежние, материал — лёгкое «стекло» iOS (фон ~88%, blur 8px, тонкая светлая обводка, мягкая тень) */
html:root:root:root body .s12-nav{border-radius:32px!important;-webkit-backdrop-filter:blur(8px) saturate(1.4)!important;backdrop-filter:blur(8px) saturate(1.4)!important;
  padding-bottom:0;transition:none}
html:root:root:root[data-theme="light"] body .s12-nav,html:root:root:root:not([data-theme]) body .s12-nav{background:rgba(255,255,255,.88)!important;border:1px solid rgba(0,0,0,.09)!important;box-shadow:0 8px 24px rgba(0,0,0,.14),0 1px 3px rgba(0,0,0,.08)!important}
html:root:root:root[data-theme="dark"] body .s12-nav{background:rgba(44,44,48,.88)!important;border:1px solid rgba(255,255,255,.18)!important;box-shadow:0 8px 24px rgba(0,0,0,.5),0 1px 3px rgba(0,0,0,.4)!important}
@media (prefers-color-scheme:dark){html:root:root:root:not([data-theme]) body .s12-nav{background:rgba(44,44,48,.88)!important;border:1px solid rgba(255,255,255,.18)!important;box-shadow:0 8px 24px rgba(0,0,0,.5),0 1px 3px rgba(0,0,0,.4)!important}
  html:root:root:root:not([data-theme]) body .s12-nav button{color:#F4F4F6!important}html:root:root:root:not([data-theme]) body .s12-nav button.on{color:#FFB099!important}}
@supports not ((backdrop-filter:blur(1px)) or (-webkit-backdrop-filter:blur(1px))){
  html:root:root:root[data-theme="light"] body .s12-nav,html:root:root:root:not([data-theme]) body .s12-nav{background:rgba(255,255,255,.97)!important}
  html:root:root:root[data-theme="dark"] body .s12-nav{background:rgba(28,28,30,.97)!important}}
@media (prefers-reduced-transparency:reduce){html:root:root:root body .s12-nav{-webkit-backdrop-filter:none!important;backdrop-filter:none!important}
  html:root:root:root[data-theme="light"] body .s12-nav{background:rgba(255,255,255,.97)!important}html:root:root:root[data-theme="dark"] body .s12-nav{background:rgba(28,28,30,.97)!important}}
html:root:root:root body.x14-navsolid .s12-nav,html:root:root:root.lowfx .s12-nav,html:root:root:root.low .s12-nav{-webkit-backdrop-filter:none!important;backdrop-filter:none!important}
.s12-nav button svg{stroke-width:2!important;width:24px;height:24px}
.s12-nav button{gap:4px}
.s12-nav button span{font-size:11px;line-height:13px;font-weight:600}

/* 6. «Избранное» в списке чатов: линейная закладка на мягком круглом фоне акцента */
.av.av-saved{background:var(--accent-soft,rgba(217,54,12,.12))!important;color:var(--accent-text,var(--accent,#D9360C))!important;display:flex;align-items:center;justify-content:center}
.av.av-saved .si{width:52%;height:52%}

/* 7. Ползунки — акцентный цвет темы (заполненная часть), единый вид везде */
input[type=range]{-webkit-appearance:none;appearance:none;height:4px;border-radius:2px;outline:0;margin:12px 0;cursor:pointer;
  background:linear-gradient(to right,var(--accent,#D9360C) 0,var(--accent,#D9360C) var(--pct,50%),rgba(127,127,127,.30) var(--pct,50%),rgba(127,127,127,.30) 100%)!important;accent-color:var(--accent,#D9360C)}
input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;width:24px;height:24px;border-radius:50%;background:#fff;border:0;box-shadow:0 1px 4px rgba(0,0,0,.35)}
input[type=range]::-moz-range-thumb{width:24px;height:24px;border-radius:50%;background:#fff;border:0;box-shadow:0 1px 4px rgba(0,0,0,.35)}
input[type=range]::-moz-range-track{background:transparent}
.x13-slr{align-items:flex-start}
.x13-slr .tt{display:flex;flex-direction:column;min-width:0;flex:1}
.x13-slr .slh{display:flex;justify-content:space-between;gap:10px;align-items:baseline}
.x13-slr .slh small{margin:0;color:var(--text-3,#5C5C66);font-variant-numeric:tabular-nums}
.x13-slr .x13-sval,.x13-page small.x13-sval{position:static!important;inset:auto!important;z-index:auto!important;background:transparent!important;display:inline!important;width:auto!important;height:auto!important;color:var(--text-3,#5C5C66);flex:none;touch-action:auto}
.x13-slr input[type=range]{width:100%;margin:10px 0 4px}
/* размер текста сообщений следует единой настройке «Размер текста» */
html body #msgs .msg{font-size:calc(15px*var(--look-fs,1))}

/* 8. Шторки: зона жеста (хендл + шапка ~48px), без уезда за пределы, скролл внутри не ломаем */
.sh-grip{position:absolute;top:0;left:0;right:0;width:auto;height:48px;z-index:6;touch-action:none;cursor:grab;-webkit-tap-highlight-color:transparent;background:none;margin:0;padding:0;border:0}
.sh-grip:active{cursor:grabbing}
/* Ручка: строго по центру (left 50% + translateX(-50%), margin сброшен), отступ сверху 10px как раньше */
.modal>.card,.sheet12 .card,.x13-sheet .sc,.call-sheet .cs-card{position:relative}
.modal>.card::before,.sheet12 .card::before,.x13-sheet .sc::before,.call-sheet .cs-card::before{
  content:""!important;display:block!important;position:absolute!important;
  top:10px!important;left:calc(50% - 19px)!important;right:auto!important;bottom:auto!important;
  width:38px!important;height:5px!important;margin:0!important;padding:0!important;
  transform:none!important;border-radius:3px!important;
  background:rgba(127,127,127,.45)!important;pointer-events:none!important;z-index:5!important;
  box-sizing:border-box!important}
.x13-sheet .sc{padding-top:24px}
.sh-full{height:100vh!important;max-height:100vh!important;border-radius:0!important}
.sh-dismissing{transform:translateY(110%)!important;pointer-events:none!important;transition:transform .22s ease-in!important;animation:none!important}

/* 9. Кнопка «назад» и закрытия: зона касания ≥48×48 (иконка прежнего размера) */
.x13-ib,#chat .bar #back{min-width:44px;min-height:44px;position:relative}
.x13-back,.x13-mback,.x13-x,.x13-ib,#chat .bar #back,[data-x13=back]{position:relative}
.x13-sheet .x13-back,.x13-mback{position:absolute}
.x13-back::after,.x13-mback::after,.x13-x::after,.x13-ib::after,#chat .bar #back::after{content:"";position:absolute;inset:-6px;border-radius:50%}
/* слабые устройства (класс s12-low из anim.js): без blur, фон плотнее */
html:root:root:root.s12-low body .s12-nav{-webkit-backdrop-filter:none!important;backdrop-filter:none!important}
html:root:root:root.s12-low[data-theme="light"] body .s12-nav{background:rgba(255,255,255,.97)!important}
html:root:root:root.s12-low[data-theme="dark"] body .s12-nav{background:rgba(28,28,30,.97)!important}

/* 10. Десктоп: страницы настроек не растягиваются на весь экран */
@media (min-width:768px){
  .x13-page>.x13-hd,.x13-page>.x13-body{width:100%;max-width:680px;margin-left:auto;margin-right:auto;box-sizing:border-box}
}
/* тёмная «премиум»-страница в светлой теме: читаемые подписи */
html[data-theme="light"] .x13-page.dark :is(small,p,.m),html:not([data-theme]) .x13-page.dark :is(small,p,.m){color:rgba(255,255,255,.8)!important}
