/* ═══════════════════════════════════════════════════════════════
   SC Enhance — дизайн-система
   Токены перенесены из макета .docs/layouts/studio.html один в один.

   Правило тем: светлая живёт на голом :root, тёмная переопределяет
   ТОЛЬКО значения токенов. Ни один цвет компонента не объявляется
   внутри [data-theme] — иначе страница отрисует текст одной темы
   на фоне другой.
   ═══════════════════════════════════════════════════════════════ */

:root{
  /* поверхности — тёплая нейтраль из утверждённого макета «Мастерская».
     Прежний холодный серый читался как незакрашенный фон. */
  --ground:#F4F4F1;
  --surface:#FFFFFF;
  --surface-2:#F7F7F4;
  --sunken:#EDEDE8;
  --line:#DEDED7;
  --line-soft:#EAEAE4;
  /* текст */
  --ink:#111410;
  --ink-2:#4C5247;
  --ink-3:#7F857A;
  --ink-4:#A7ACA1;
  /* акцент */
  --accent:#C96A10;
  --accent-hi:#E07B1E;
  --accent-ink:#FFFFFF;
  --accent-soft:rgba(201,106,16,.10);
  --accent-line:rgba(201,106,16,.34);
  --rec:#C7291D;
  /* модальности — цветовой код навигации */
  --m-voice:#C96A10;
  --m-image:#C92D5F;
  --m-video:#6A38D4;
  --m-music:#08808F;
  --m-text:#218A4F;
  /* семантика */
  --ok:#218A4F;   --ok-soft:rgba(33,138,79,.12);
  --warn:#B57608; --warn-soft:rgba(181,118,8,.12);
  --crit:#C7291D; --crit-soft:rgba(199,41,29,.10);
  --info:#1B6EA8; --info-soft:rgba(27,110,168,.12);
  /* тени */
  --shadow-1:0 1px 2px rgba(12,19,17,.05), 0 4px 14px rgba(12,19,17,.05);
  --shadow-2:0 2px 6px rgba(12,19,17,.07), 0 18px 46px rgba(12,19,17,.10);
  --glow:none;
  /* геометрия */
  --r-s:6px; --r-m:10px; --r-l:16px;
  --rail-w:74px; --side-w:238px;
  --font-ui:"Golos Text","Segoe UI",system-ui,sans-serif;
  --font-display:"Unbounded",var(--font-ui);
  --font-mono:"JetBrains Mono",ui-monospace,"Cascadia Mono",monospace;
}

html[data-theme="dark"]{
  --ground:#0A0C09;
  --surface:#131711;
  --surface-2:#191E17;
  --sunken:#0E1109;
  --line:#272D24;
  --line-soft:#1C2119;
  --ink:#EFF2EA;
  --ink-2:#A6AD9C;
  --ink-3:#7B8273;
  --ink-4:#606755;
  --accent:#FFA62B;
  --accent-hi:#FFBB5C;
  --accent-ink:#1B1205;
  --accent-soft:rgba(255,166,43,.13);
  --accent-line:rgba(255,166,43,.34);
  --rec:#FF4D40;
  --m-voice:#FFA62B;
  --m-image:#FF5C8A;
  --m-video:#A77CFF;
  --m-music:#3DD3EA;
  --m-text:#5FD98C;
  --ok:#5FD98C;   --ok-soft:rgba(95,217,140,.14);
  --warn:#FFC44D; --warn-soft:rgba(255,196,77,.14);
  --crit:#FF4D40; --crit-soft:rgba(255,77,64,.14);
  --info:#5BB8F5; --info-soft:rgba(91,184,245,.14);
  --shadow-1:0 1px 2px rgba(0,0,0,.4), 0 4px 14px rgba(0,0,0,.3);
  --shadow-2:0 2px 8px rgba(0,0,0,.45), 0 22px 54px rgba(0,0,0,.5);
  --glow:0 0 0 1px rgba(255,166,43,.16), 0 0 32px -6px rgba(255,166,43,.30);
}

/* ─── база ─────────────────────────────────────────────────── */
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  background:var(--ground);
  color:var(--ink);
  font-family:var(--font-ui);
  font-size:14px;
  line-height:1.5;
  -webkit-font-smoothing:antialiased;
}
button,input,textarea,select{font:inherit;color:inherit}
button{background:none;border:0;cursor:pointer}
a{color:var(--accent);text-decoration:none}
a:hover{text-decoration:underline}
:focus-visible{outline:2px solid var(--accent);outline-offset:2px;border-radius:4px}
img{max-width:100%;display:block}

/* ─── полосы прокрутки ──────────────────────────────────────
   Системные выглядят чужеродно и в тёмной теме светятся белым.
   Тонкая пилюля на прозрачной дорожке: видна, когда нужна,
   и не разрезает макет, когда не нужна.
   Firefox понимает только scrollbar-width/color, остальное — WebKit. */
*{scrollbar-width:thin;scrollbar-color:var(--line) transparent}
::-webkit-scrollbar{width:11px;height:11px}
::-webkit-scrollbar-track{background:transparent}
::-webkit-scrollbar-corner{background:transparent}
::-webkit-scrollbar-thumb{
  /* Прозрачная рамка + background-clip дают отступ от края,
     иначе пилюля прилипает к содержимому. */
  background:var(--line);border-radius:999px;
  border:3px solid transparent;background-clip:content-box;
}
::-webkit-scrollbar-thumb:hover{background:var(--ink-4);background-clip:content-box}
::-webkit-scrollbar-thumb:active{background:var(--ink-3);background-clip:content-box}

/* На тёмных панелях (пульт витрины) дорожка своя, посветлее фона. */
.deck,.deck *{scrollbar-color:rgba(255,255,255,.18) transparent}
.deck ::-webkit-scrollbar-thumb{background:rgba(255,255,255,.18);background-clip:content-box}
.deck ::-webkit-scrollbar-thumb:hover{background:rgba(255,255,255,.32);background-clip:content-box}

h1,h2,h3,h4{margin:0;text-wrap:balance}

.mono{font-family:var(--font-mono);font-variant-numeric:tabular-nums}
.num{font-variant-numeric:tabular-nums}
.lbl{
  font-family:var(--font-mono);font-size:10px;letter-spacing:.13em;
  text-transform:uppercase;color:var(--ink-3);font-weight:500;
}
.muted{color:var(--ink-3)}
.dim{color:var(--ink-4)}
.tiny{font-size:12px}
.center{text-align:center}
.right{text-align:right}
.nowrap{white-space:nowrap}
.grow{flex:1}
.hidden{display:none !important}
/* Атрибут hidden обязан скрывать всегда. Правило вроде .pitem{display:flex}
   перебивает его по специфичности, и элемент остаётся на экране —
   на этом фильтр в выборе модели молча переставал работать. */
[hidden]{display:none !important}

/* ─── оболочка кабинета ────────────────────────────────────── */
.app{display:grid;grid-template-columns:var(--rail-w) var(--side-w) minmax(0,1fr);height:100dvh;min-height:600px}
.app.no-side{grid-template-columns:var(--rail-w) minmax(0,1fr)}

/* рельс модальностей */
.rail{
  /* z-index поднимает весь рельс над главной колонкой: без него
     всплывашка с подписью уходит под содержимое — особенно под
     прилипающие блоки вроде панели сохранения в конфигах. */
  position:relative;z-index:30;
  display:flex;flex-direction:column;align-items:center;
  padding:14px 0 12px;gap:2px;background:var(--surface);border-right:1px solid var(--line);
}
.rail::after{
  content:"";position:absolute;right:-1px;top:96px;bottom:120px;width:2px;
  background:linear-gradient(180deg,var(--m-voice),var(--m-image) 27%,var(--m-video) 52%,var(--m-music) 76%,var(--m-text));
  opacity:.55;
}
/* Знак — готовый SVG, поэтому у контейнера ни фона, ни буквы. */
.mark{
  width:38px;height:38px;display:grid;place-items:center;margin-bottom:16px;
  text-decoration:none;flex:none;
}
.mark:hover{text-decoration:none}
.mark-svg{width:100%;height:100%;display:block;transition:transform .22s cubic-bezier(.2,.8,.3,1)}
.mark:hover .mark-svg{transform:translateY(-1px) scale(1.04)}
.rail-group{display:flex;flex-direction:column;gap:3px;width:100%;align-items:center}
.rail-sep{width:26px;height:1px;background:var(--line);margin:11px 0}
.rail-foot{margin-top:auto;display:flex;flex-direction:column;align-items:center;gap:6px}

.mod{
  position:relative;width:50px;height:46px;border-radius:12px;display:grid;place-items:center;
  color:var(--ink-3);transition:background .16s,color .16s,transform .16s;
}
.mod:hover{background:var(--surface-2);color:var(--mod,var(--ink-2));transform:translateY(-1px);text-decoration:none}
.mod svg{width:20px;height:20px;stroke-width:1.6;fill:none;stroke:currentColor}
.mod.on{color:var(--mod,var(--accent));background:color-mix(in srgb,var(--mod,var(--accent)) 12%,transparent)}
/* Выключенный модуль: гаснет, но остаётся на месте — иначе кажется, что пропал. */
.mod.off{opacity:.34}
span.mod.off{cursor:default}
span.mod.off:hover{background:none;transform:none;color:var(--ink-3)}
.mod.on::before{
  content:"";position:absolute;left:-14px;top:50%;transform:translateY(-50%);
  width:3px;height:22px;border-radius:0 3px 3px 0;background:var(--mod,var(--accent));
}
.tip{
  position:absolute;left:calc(100% + 12px);top:50%;transform:translate(-6px,-50%);
  background:var(--ink);color:var(--ground);padding:5px 9px;border-radius:7px;
  white-space:nowrap;font-size:12px;font-weight:500;opacity:0;pointer-events:none;
  transition:opacity .15s,transform .15s;z-index:60;box-shadow:var(--shadow-2);
}
.tip b{font-weight:600}
.tip span{opacity:.55;margin-left:7px;font-family:var(--font-mono);font-size:10px}
.mod:hover .tip{opacity:1;transform:translate(0,-50%)}

.ava{
  width:32px;height:32px;border-radius:10px;display:grid;place-items:center;
  background:linear-gradient(150deg,var(--m-image),var(--m-video));
  color:#fff;font-weight:700;font-size:12px;border:1px solid var(--line);
  text-decoration:none;
}
.ava:hover{text-decoration:none}
.ava.lg{width:44px;height:44px;border-radius:13px;font-size:15px}

/* контекстное меню модуля */
.side{position:relative;z-index:20;background:var(--surface);border-right:1px solid var(--line);display:flex;flex-direction:column;overflow:hidden}
.side-head{padding:16px 16px 12px;border-bottom:1px solid var(--line-soft)}
.side-title{font-family:var(--font-display);font-weight:500;font-size:17px;letter-spacing:-.035em;display:flex;align-items:center;gap:8px}
.side-title i{width:7px;height:7px;border-radius:50%;background:var(--mod,var(--accent));display:block;flex:none}
.side-sub{color:var(--ink-3);font-size:12px;margin-top:3px}
.side-scroll{overflow-y:auto;padding:12px 10px 16px;flex:1}
.nav-h{padding:12px 8px 6px}
.nav{display:flex;flex-direction:column;gap:1px}
.nav a{
  display:flex;align-items:center;gap:10px;padding:8px 10px;border-radius:8px;
  color:var(--ink-2);font-size:13.5px;font-weight:500;text-decoration:none;
  transition:background .14s,color .14s;
}
.nav a svg{width:16px;height:16px;stroke-width:1.7;fill:none;stroke:currentColor;color:var(--ink-4);flex:none;transition:color .14s}
.nav a:hover{background:var(--surface-2);color:var(--ink);text-decoration:none}
.nav a:hover svg{color:var(--ink-2)}
.nav a.on{background:var(--accent-soft);color:var(--ink);font-weight:600}
.nav a.on svg{color:var(--accent)}
.nav .cnt{margin-left:auto;font-family:var(--font-mono);font-size:10.5px;color:var(--ink-4)}
.nav .new{
  margin-left:auto;font-family:var(--font-mono);font-size:9px;letter-spacing:.08em;
  color:var(--m-video);background:color-mix(in srgb,var(--m-video) 14%,transparent);
  padding:2px 5px;border-radius:4px;
}

/* главная колонка */
.main{display:flex;flex-direction:column;min-width:0;background:var(--ground);overflow:hidden}
.topbar{display:flex;align-items:center;gap:14px;padding:12px 18px;border-bottom:1px solid var(--line);background:var(--surface);flex:none}
.top-right{margin-left:auto;display:flex;align-items:center;gap:8px}
.work{flex:1;overflow-y:auto;padding:20px 22px 40px}
.work-narrow{max-width:900px}
.work-wide{max-width:1400px}

.omni{
  flex:1;max-width:520px;display:flex;align-items:center;gap:10px;height:38px;padding:0 12px;
  background:var(--surface-2);border:1px solid var(--line);border-radius:11px;
  transition:border-color .18s,box-shadow .18s,background .18s;
}
.omni:focus-within{border-color:var(--accent-line);box-shadow:var(--glow);background:var(--surface)}
.omni svg{width:16px;height:16px;color:var(--ink-3);flex:none;stroke-width:1.8;fill:none;stroke:currentColor}
.omni input{flex:1;background:none;border:0;outline:none;font-size:13.5px;min-width:0}
.omni input::placeholder{color:var(--ink-4)}
.kbd{font-family:var(--font-mono);font-size:10px;color:var(--ink-3);border:1px solid var(--line);border-radius:5px;padding:2px 6px;background:var(--surface)}

/* индикатор баланса */
.balance{
  display:flex;align-items:center;gap:8px;height:34px;padding:0 12px;
  border:1px solid var(--line);border-radius:10px;background:var(--surface-2);
  text-decoration:none;color:var(--ink);transition:border-color .15s,background .15s;
}
.balance:hover{border-color:var(--accent-line);background:var(--surface);text-decoration:none}
.balance b{font-family:var(--font-mono);font-size:12.5px;font-weight:600}
.balance .plus{
  width:18px;height:18px;border-radius:6px;background:var(--accent);color:var(--accent-ink);
  display:grid;place-items:center;font-size:13px;font-weight:700;line-height:1;
}

/* переключатель темы */
.theme-sw{display:flex;align-items:center;gap:2px;height:34px;padding:3px;background:var(--surface-2);border:1px solid var(--line);border-radius:10px}
.theme-sw button{
  display:flex;align-items:center;gap:6px;height:26px;padding:0 10px;border-radius:7px;
  font-size:12px;font-weight:500;color:var(--ink-3);transition:background .18s,color .18s;
}
.theme-sw button svg{width:14px;height:14px;stroke-width:1.8;fill:none;stroke:currentColor}
.theme-sw button:hover{color:var(--ink)}
.theme-sw button[aria-pressed="true"]{background:var(--surface);color:var(--ink);font-weight:600;box-shadow:var(--shadow-1)}
.theme-sw button[aria-pressed="true"] svg{color:var(--accent)}

/* ─── компактный переключатель темы (витрина) ──────────────
   Видна всегда одна кнопка — значок следующего режима.
   Стамп по умолчанию отсутствует, поэтому :not([data-theme])
   тоже считаем светлой темой. */
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
.theme-cycle{display:flex;flex:none}
.theme-cycle button{
  width:36px;height:36px;border-radius:10px;display:none;place-items:center;
  border:1px solid var(--line);background:var(--surface-2);color:var(--ink-2);
  transition:background .16s,color .16s,border-color .16s,transform .16s;
}
.theme-cycle button:hover{background:var(--surface);color:var(--ink);border-color:var(--ink-4);transform:translateY(-1px)}
.theme-cycle button svg{width:16px;height:16px}
html:not([data-theme]) .theme-cycle [data-theme-set="dark"],
html[data-theme="light"] .theme-cycle [data-theme-set="dark"],
html[data-theme="dark"] .theme-cycle [data-theme-set="light"]{display:grid}

/* ─── вход и регистрация одним элементом ───────────────────── */
.auth{
  display:inline-flex;align-items:stretch;flex:none;height:36px;
  border:1px solid var(--line);border-radius:999px;background:var(--surface);
  overflow:hidden;box-shadow:var(--shadow-1);
}
.auth a{
  display:inline-flex;align-items:center;gap:8px;padding:0 15px;
  font-size:13px;font-weight:500;color:var(--ink-2);text-decoration:none;
  transition:background .2s,color .2s;
}
.auth a:hover{text-decoration:none}
.auth-in:hover{background:var(--surface-2);color:var(--ink)}
.auth-up{
  position:relative;border-left:1px solid var(--line);
  color:var(--ink);font-weight:600;padding-right:16px;
}
.auth-up:hover{background:var(--ink);color:var(--ground)}
/* Спектр из знака: в покое подчёркивает подпись,
   при наведении разворачивается во всю ширину половины. */
.auth-up::after{
  content:"";position:absolute;left:15px;right:16px;bottom:7px;height:2px;border-radius:2px;
  background:linear-gradient(90deg,var(--m-voice),var(--m-image) 25%,var(--m-video) 50%,var(--m-music) 75%,var(--m-text));
  transform:scaleX(.42);transform-origin:left;transition:transform .32s cubic-bezier(.2,.8,.3,1);
}
.auth-up:hover::after{transform:scaleX(1)}
.auth-up .bars{display:inline-flex;align-items:center;gap:2px;height:14px;flex:none}
.auth-up .bars i{width:2px;border-radius:1px;transition:height .28s cubic-bezier(.2,.8,.3,1)}
.auth-up .bars i:nth-child(1){height:5px;background:var(--m-voice)}
.auth-up .bars i:nth-child(2){height:9px;background:var(--m-image)}
.auth-up .bars i:nth-child(3){height:13px;background:var(--m-video)}
.auth-up .bars i:nth-child(4){height:8px;background:var(--m-music)}
.auth-up .bars i:nth-child(5){height:4px;background:var(--m-text)}
.auth-up:hover .bars i:nth-child(1){height:11px}
.auth-up:hover .bars i:nth-child(2){height:5px}
.auth-up:hover .bars i:nth-child(3){height:9px}
.auth-up:hover .bars i:nth-child(4){height:13px}
.auth-up:hover .bars i:nth-child(5){height:7px}

@media(max-width:560px){
  .auth-up .t{display:none}
  .auth-up{padding:0 14px}
  .auth-up::after{left:12px;right:12px}
}

.icon-btn{
  width:34px;height:34px;border-radius:10px;display:grid;place-items:center;flex:none;
  border:1px solid var(--line);background:var(--surface-2);color:var(--ink-2);
  transition:background .15s,color .15s,border-color .15s;text-decoration:none;
}
.icon-btn:hover{background:var(--surface);color:var(--ink);border-color:var(--ink-4);text-decoration:none}
.icon-btn svg{width:16px;height:16px;stroke-width:1.7;fill:none;stroke:currentColor}

/* быстрые маршруты */
.routes{display:flex;align-items:center;gap:7px;padding:10px 18px;border-bottom:1px solid var(--line);background:var(--surface);overflow-x:auto;scrollbar-width:none;flex:none}
.routes::-webkit-scrollbar{display:none}
.route{
  display:flex;align-items:center;gap:7px;flex:none;height:29px;padding:0 11px 0 8px;border-radius:8px;
  border:1px solid var(--line);background:var(--surface-2);font-size:12.5px;font-weight:500;
  color:var(--ink-2);white-space:nowrap;text-decoration:none;
  transition:transform .15s,border-color .15s,color .15s,background .15s;
}
.route i{width:6px;height:6px;border-radius:2px;display:block;background:var(--mod,var(--accent))}
.route .eng{font-family:var(--font-mono);font-size:10px;color:var(--ink-4)}
.route:hover{transform:translateY(-1px);border-color:var(--mod,var(--accent));color:var(--ink);background:var(--surface);text-decoration:none}

/* ─── типографика страниц ──────────────────────────────────── */
.crumb{display:flex;align-items:center;gap:8px;color:var(--ink-3);font-size:12px;margin-bottom:6px;flex-wrap:wrap}
.crumb a{color:var(--ink-3);text-decoration:none}
.crumb a:hover{color:var(--ink)}
.crumb b{color:var(--ink);font-weight:600}
.crumb .sl{opacity:.4}
.h1{font-family:var(--font-display);font-weight:500;font-size:27px;letter-spacing:-.045em;line-height:1.12}
.h1 em{font-style:normal;color:var(--accent)}
.h2{font-family:var(--font-display);font-weight:500;font-size:19px;letter-spacing:-.035em}
.h3{font-size:15px;font-weight:600}
.page-head{display:flex;align-items:flex-start;gap:16px;margin-bottom:18px;flex-wrap:wrap}
.page-head .actions{margin-left:auto;display:flex;gap:8px;align-items:center;flex-wrap:wrap}

/* ─── карточки и сетки ─────────────────────────────────────── */
.card{background:var(--surface);border:1px solid var(--line);border-radius:var(--r-l);box-shadow:var(--shadow-1)}
.card-pad{padding:18px}
.card-head{display:flex;align-items:center;gap:10px;padding:14px 18px;border-bottom:1px solid var(--line-soft)}
.card-head .h3{flex:1}
.card-body{padding:18px}
.card-foot{padding:14px 18px;border-top:1px solid var(--line-soft);display:flex;align-items:center;gap:10px}

.grid{display:grid;gap:14px}
.g2{grid-template-columns:repeat(auto-fit,minmax(280px,1fr))}
.g3{grid-template-columns:repeat(auto-fit,minmax(230px,1fr))}
.g4{grid-template-columns:repeat(auto-fit,minmax(190px,1fr))}
.row{display:flex;gap:10px;align-items:center;flex-wrap:wrap}
.col{display:flex;flex-direction:column;gap:10px}
.stack{display:flex;flex-direction:column;gap:14px}
.split{display:grid;grid-template-columns:minmax(0,1fr) 300px;gap:16px;align-items:start}

/* плитка показателя */
.tile{background:var(--surface);border:1px solid var(--line);border-radius:var(--r-l);padding:15px 16px;box-shadow:var(--shadow-1);display:flex;flex-direction:column;gap:5px}
.tile .v{font-family:var(--font-mono);font-size:23px;font-weight:700;letter-spacing:-.02em;font-variant-numeric:tabular-nums}
.tile .d{display:flex;align-items:center;gap:6px;font-size:12px;color:var(--ink-3)}
.tile.accent .v{color:var(--accent)}
.tile.ok .v{color:var(--ok)}
.tile.crit .v{color:var(--crit)}

/* ─── кнопки ───────────────────────────────────────────────── */
.btn{
  display:inline-flex;align-items:center;justify-content:center;gap:8px;
  height:38px;padding:0 16px;border-radius:10px;font-size:13.5px;font-weight:600;
  border:1px solid transparent;text-decoration:none;white-space:nowrap;
  transition:transform .15s cubic-bezier(.3,1.4,.5,1),background .15s,border-color .15s,color .15s,opacity .15s;
}
.btn:hover{text-decoration:none;transform:translateY(-1px)}
.btn:active{transform:translateY(0) scale(.99)}
.btn svg{width:16px;height:16px;stroke-width:1.9;fill:none;stroke:currentColor;flex:none}
.btn-primary{background:var(--ink);color:var(--ground)}
.btn-accent{background:var(--accent);color:var(--accent-ink)}
.btn-ghost{background:var(--surface-2);border-color:var(--line);color:var(--ink-2)}
.btn-ghost:hover{background:var(--surface);color:var(--ink);border-color:var(--ink-4)}
.btn-danger{background:var(--crit-soft);color:var(--crit);border-color:color-mix(in srgb,var(--crit) 30%,transparent)}
.btn-danger:hover{background:var(--crit);color:#fff}
.btn-sm{height:30px;padding:0 11px;font-size:12.5px;border-radius:8px}
.btn-sm svg{width:14px;height:14px}
.btn-lg{height:46px;padding:0 22px;font-size:15px;border-radius:12px}
.btn-block{width:100%}
.btn[disabled],.btn.is-disabled{opacity:.5;pointer-events:none}

/* ─── формы ────────────────────────────────────────────────── */
.field{display:flex;flex-direction:column;gap:6px;min-width:0}
.field > label{font-size:12.5px;font-weight:600;color:var(--ink-2)}
.field .hint{font-size:11.5px;color:var(--ink-4)}
.field .err{font-size:11.5px;color:var(--crit);font-weight:500}
.input,.select,.textarea{
  width:100%;background:var(--surface);border:1px solid var(--line);border-radius:10px;
  padding:9px 12px;font-size:13.5px;color:var(--ink);outline:none;
  transition:border-color .16s,box-shadow .16s;
}
.input::placeholder,.textarea::placeholder{color:var(--ink-4)}
.input:focus,.select:focus,.textarea:focus{border-color:var(--accent-line);box-shadow:var(--glow)}
.input.err,.select.err,.textarea.err{border-color:var(--crit)}
.textarea{min-height:110px;resize:vertical;line-height:1.6}
.select{appearance:none;padding-right:32px;cursor:pointer;
  background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2377857F' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat:no-repeat;background-position:right 10px center;background-size:15px;
}
html[data-theme="dark"] .select{
  background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2371807A' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}
.check{display:flex;align-items:flex-start;gap:9px;cursor:pointer;font-size:13px;color:var(--ink-2);line-height:1.5}
.check input{width:16px;height:16px;accent-color:var(--accent);margin-top:2px;flex:none;cursor:pointer}

input[type=range]{
  -webkit-appearance:none;appearance:none;width:100%;height:4px;border-radius:3px;
  background:var(--sunken);outline:none;cursor:pointer;
}
input[type=range]::-webkit-slider-thumb{
  -webkit-appearance:none;width:14px;height:14px;border-radius:50%;background:var(--surface);
  border:2px solid var(--accent);cursor:grab;box-shadow:var(--shadow-1);transition:transform .14s;
}
input[type=range]::-webkit-slider-thumb:hover{transform:scale(1.18)}
input[type=range]::-moz-range-thumb{width:14px;height:14px;border-radius:50%;background:var(--surface);border:2px solid var(--accent);cursor:grab}
.slider{display:flex;flex-direction:column;gap:6px}
.sl-top{display:flex;justify-content:space-between;align-items:baseline}
.sl-top .v{font-family:var(--font-mono);font-size:11.5px;color:var(--ink);font-weight:600}

/* сегментный переключатель */
.seg{display:flex;background:var(--surface-2);border:1px solid var(--line);border-radius:9px;padding:2px;gap:2px;flex-wrap:wrap}
.seg button,.seg a,.seg label{
  padding:4px 10px;border-radius:6px;font-size:12px;color:var(--ink-3);font-weight:500;
  transition:background .14s,color .14s;text-decoration:none;cursor:pointer;
}
.seg button:hover,.seg a:hover,.seg label:hover{color:var(--ink);text-decoration:none}
.seg .on{background:var(--surface);color:var(--ink);font-weight:600;box-shadow:var(--shadow-1)}
.seg input{position:absolute;opacity:0;pointer-events:none}

/* карточки-опции (выбор модели) */
.opts{display:grid;gap:8px}
.opt{
  display:block;padding:11px 12px;border-radius:11px;text-align:left;cursor:pointer;
  border:1px solid var(--line);background:var(--surface-2);
  transition:border-color .15s,background .15s,transform .15s;
}
.opt:hover{transform:translateY(-1px);border-color:var(--ink-4)}
.opt.on{border-color:var(--accent);background:var(--accent-soft)}
.opt .t{font-size:13px;font-weight:600;display:flex;align-items:center;gap:7px}
.opt .s{font-family:var(--font-mono);font-size:10px;color:var(--ink-3);display:block;margin-top:3px}
.opt.on .s{color:var(--accent)}
.opt input{position:absolute;opacity:0;pointer-events:none}

/* эмоции / пилюли выбора */
.pills{display:flex;gap:5px;flex-wrap:wrap}
.pills label,.pills button{
  padding:5px 11px;border-radius:20px;font-size:12px;font-weight:500;cursor:pointer;
  border:1px solid var(--line);background:var(--surface-2);color:var(--ink-2);
  transition:background .15s,border-color .15s,color .15s;
}
.pills label:hover,.pills button:hover{border-color:var(--ink-4);color:var(--ink)}
.pills .on{background:var(--ink);border-color:var(--ink);color:var(--ground);font-weight:600}
.pills input{position:absolute;opacity:0;pointer-events:none}

/* ─── значки состояния ─────────────────────────────────────── */
.badge{
  display:inline-flex;align-items:center;gap:5px;font-family:var(--font-mono);
  font-size:9.5px;letter-spacing:.07em;text-transform:uppercase;font-weight:600;
  padding:3px 7px;border-radius:5px;white-space:nowrap;
}
.b-ok{background:var(--ok-soft);color:var(--ok)}
.b-warn{background:var(--warn-soft);color:var(--warn)}
.b-crit{background:var(--crit-soft);color:var(--crit)}
.b-info{background:var(--info-soft);color:var(--info)}
.b-accent{background:var(--accent-soft);color:var(--accent)}
.b-mute{background:var(--sunken);color:var(--ink-4)}
.badge.dot::before{content:"";width:5px;height:5px;border-radius:50%;background:currentColor;display:block}

.chip-mod{
  display:inline-flex;align-items:center;gap:6px;font-size:12px;font-weight:500;
  padding:3px 9px;border-radius:7px;
  background:color-mix(in srgb,var(--mod,var(--accent)) 13%,transparent);
  color:var(--mod,var(--accent));white-space:nowrap;
}
.chip-mod i{width:5px;height:5px;border-radius:50%;background:currentColor;display:block;flex:none}

/* ─── таблицы ──────────────────────────────────────────────── */
.tbl-wrap{overflow-x:auto;border:1px solid var(--line);border-radius:var(--r-l);background:var(--surface);box-shadow:var(--shadow-1)}
table.tbl{border-collapse:collapse;width:100%;font-size:13px}
table.tbl th{
  text-align:left;padding:10px 14px;background:var(--surface-2);border-bottom:1px solid var(--line);
  font-family:var(--font-mono);font-size:10px;letter-spacing:.1em;text-transform:uppercase;
  color:var(--ink-3);font-weight:500;white-space:nowrap;
}
table.tbl td{padding:11px 14px;border-bottom:1px solid var(--line-soft);color:var(--ink-2);vertical-align:middle}
table.tbl tbody tr:last-child td{border-bottom:0}
table.tbl tbody tr:hover{background:var(--surface-2)}
table.tbl td.mono,table.tbl th.mono{font-family:var(--font-mono);font-variant-numeric:tabular-nums;font-size:12px;white-space:nowrap}
table.tbl td.strong{color:var(--ink);font-weight:600}
table.tbl .pos{color:var(--ok);font-weight:600}
table.tbl .neg{color:var(--crit);font-weight:600}

/* ─── уведомления ──────────────────────────────────────────── */
.alert{display:flex;align-items:flex-start;gap:11px;padding:13px 15px;border-radius:var(--r-m);border:1px solid var(--line);background:var(--surface-2);font-size:13.5px;color:var(--ink-2)}
/* display:flex перебивает браузерный [hidden] — возвращаем его обратно. */
.alert[hidden]{display:none}
.alert svg{width:17px;height:17px;stroke-width:1.9;fill:none;stroke:currentColor;flex:none;margin-top:1px}
.alert b{color:var(--ink)}
.alert-ok{background:var(--ok-soft);border-color:color-mix(in srgb,var(--ok) 26%,transparent);color:var(--ok)}
.alert-ok b{color:var(--ok)}
.alert-warn{background:var(--warn-soft);border-color:color-mix(in srgb,var(--warn) 26%,transparent);color:var(--warn)}
.alert-warn b{color:var(--warn)}
.alert-crit{background:var(--crit-soft);border-color:color-mix(in srgb,var(--crit) 26%,transparent);color:var(--crit)}
.alert-crit b{color:var(--crit)}
.alert-info{background:var(--info-soft);border-color:color-mix(in srgb,var(--info) 26%,transparent);color:var(--info)}
.alert-info b{color:var(--info)}

.toast-wrap{position:fixed;bottom:22px;left:50%;transform:translateX(-50%);display:flex;flex-direction:column;gap:8px;z-index:260;align-items:center}
.toast{
  display:flex;align-items:center;gap:10px;padding:11px 15px;border-radius:12px;
  background:var(--ink);color:var(--ground);box-shadow:var(--shadow-2);
  font-size:13px;font-weight:500;opacity:0;transform:translateY(12px);
  transition:opacity .25s,transform .25s cubic-bezier(.2,1,.4,1);
}
.toast.show{opacity:1;transform:none}
.toast i{width:7px;height:7px;border-radius:50%;background:var(--ok);display:block;flex:none}
.toast.err i{background:var(--crit)}

/* ─── пустое состояние ─────────────────────────────────────── */
.empty{display:flex;flex-direction:column;align-items:center;gap:10px;padding:52px 20px;text-align:center;color:var(--ink-3)}
.empty svg{width:38px;height:38px;stroke-width:1.3;fill:none;stroke:currentColor;color:var(--ink-4)}
.empty .t{font-size:15px;font-weight:600;color:var(--ink-2)}
.empty .s{font-size:13px;max-width:44ch}

/* ─── прогресс ─────────────────────────────────────────────── */
.bar{height:5px;border-radius:3px;background:var(--sunken);overflow:hidden;display:flex}
.bar i{display:block;height:100%;transition:width .5s ease;background:var(--accent)}
.bar.thin{height:3px}
.spin{width:15px;height:15px;border:2px solid var(--line);border-top-color:var(--accent);border-radius:50%;animation:spin .7s linear infinite;flex:none}
@keyframes spin{to{transform:rotate(360deg)}}

/* ─── очередь задач ────────────────────────────────────────── */
.job{border:1px solid var(--line);border-radius:var(--r-m);padding:12px;background:var(--surface);transition:border-color .16s,transform .16s}
.job:hover{border-color:var(--ink-4);transform:translateY(-1px)}
.job-top{display:flex;align-items:center;gap:8px;margin-bottom:7px}
.job-ico{width:24px;height:24px;border-radius:7px;flex:none;display:grid;place-items:center;background:color-mix(in srgb,var(--mod,var(--accent)) 15%,transparent);color:var(--mod,var(--accent))}
.job-ico svg{width:13px;height:13px;stroke-width:1.9;fill:none;stroke:currentColor}
.job-eng{font-family:var(--font-mono);font-size:10px;color:var(--mod,var(--accent));font-weight:500}
.job-time{margin-left:auto;font-family:var(--font-mono);font-size:10px;color:var(--ink-4)}
.job-name{font-size:13px;font-weight:500;line-height:1.4;color:var(--ink);display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.job-foot{display:flex;align-items:center;gap:8px;margin-top:9px}

/* ─── медиа-плитки ─────────────────────────────────────────── */
.media-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(210px,1fr));gap:12px}
.media{border:1px solid var(--line);border-radius:var(--r-m);overflow:hidden;background:var(--surface);transition:transform .16s,border-color .16s,box-shadow .16s}
.media:hover{transform:translateY(-2px);border-color:var(--ink-4);box-shadow:var(--shadow-2)}
.media-thumb{aspect-ratio:1;background:var(--sunken);position:relative;display:grid;place-items:center;overflow:hidden}
.media-thumb img,.media-thumb video{width:100%;height:100%;object-fit:cover}
.media-thumb .ph{color:var(--ink-4)}
.media-thumb .ph svg{width:32px;height:32px;stroke-width:1.3;fill:none;stroke:currentColor}
.media-body{padding:10px 11px;display:flex;flex-direction:column;gap:5px}
.media-name{font-size:12.5px;font-weight:500;color:var(--ink);line-height:1.35;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.media-meta{display:flex;align-items:center;gap:8px;font-family:var(--font-mono);font-size:10px;color:var(--ink-4)}
.media-ttl{position:absolute;top:7px;right:7px;font-family:var(--font-mono);font-size:9.5px;padding:2px 6px;border-radius:5px;background:rgba(0,0,0,.62);color:#fff;backdrop-filter:blur(4px)}

/* ─── аудиоплеер ───────────────────────────────────────────── */
.player{border:1px solid var(--line);border-radius:var(--r-l);background:var(--surface);overflow:hidden;box-shadow:var(--shadow-1)}
.player-wave{position:relative;height:82px;background:var(--sunken)}
.player-wave canvas{display:block;width:100%;height:100%}
.player-ctl{display:flex;align-items:center;gap:12px;padding:11px 14px;border-top:1px solid var(--line-soft);flex-wrap:wrap}
.play-btn{width:38px;height:38px;border-radius:50%;display:grid;place-items:center;flex:none;background:var(--accent);color:var(--accent-ink);transition:transform .16s cubic-bezier(.3,1.4,.5,1)}
.play-btn:hover{transform:scale(1.07)}
.play-btn svg{width:16px;height:16px;fill:currentColor;stroke:none}
.tc{font-family:var(--font-mono);font-size:12.5px;color:var(--ink-2)}
.tc b{color:var(--ink);font-weight:600}

/* ─── счётчик стоимости ────────────────────────────────────── */
.meter{background:var(--surface-2);border:1px solid var(--line);border-radius:var(--r-m);padding:12px;display:flex;flex-direction:column;gap:7px}
.m-row{display:flex;justify-content:space-between;align-items:baseline;font-size:12.5px;gap:10px}
.m-row span{color:var(--ink-3)}
.m-row b{font-family:var(--font-mono);font-weight:600;font-size:12.5px;font-variant-numeric:tabular-nums}
.m-row.total{border-top:1px dashed var(--line);padding-top:8px;margin-top:1px}
.m-row.total b{color:var(--accent);font-size:15px}
.m-row .ok{color:var(--ok)}
.m-row .crit{color:var(--crit)}

/* ─── гостевые страницы ────────────────────────────────────── */
.guest{min-height:100dvh;display:flex;flex-direction:column;background:var(--ground)}
.guest-nav{display:flex;align-items:center;gap:12px;padding:16px 24px;max-width:1180px;margin:0 auto;width:100%}
/* У .mark отступ снизу — он для вертикального рельса кабинета.
   В горизонтальной шапке он смещает квадрат вверх, и название
   рядом выглядит съехавшим вниз. */
.guest-nav .mark{margin:0;flex:none}
.guest-brand{
  font-family:var(--font-display);font-weight:500;font-size:16.5px;
  letter-spacing:-.04em;color:var(--ink);text-decoration:none;line-height:1;
}
.guest-brand:hover{text-decoration:none;color:var(--accent)}
.guest-body{flex:1;display:grid;place-items:center;padding:20px 20px 60px}
.auth-card{width:100%;max-width:410px;background:var(--surface);border:1px solid var(--line);border-radius:var(--r-l);padding:28px;box-shadow:var(--shadow-2)}
.auth-head{margin-bottom:20px}
.auth-head .h1{font-size:23px}
.auth-head p{color:var(--ink-3);font-size:13.5px;margin:7px 0 0}
.auth-form{display:flex;flex-direction:column;gap:14px}
.auth-foot{margin-top:18px;padding-top:16px;border-top:1px solid var(--line-soft);font-size:13px;color:var(--ink-3);text-align:center}
/* ─── подвал витрины ────────────────────────────────────────
   Четыре колонки: кто мы, что есть, куда писать, документы.
   Поддержка вынесена отдельным блоком — путь через кабинет
   первым, почта запасным. */
.foot{border-top:1px solid var(--line);background:var(--surface);margin-top:auto}
.foot-in{
  max-width:1180px;margin:0 auto;padding:44px 26px 34px;
  display:grid;grid-template-columns:1.5fr 1fr 1.4fr 1fr;gap:38px;
}

.foot-mark{display:block;width:34px;height:34px;margin-bottom:12px}
.foot-name{
  font-family:var(--font-display);font-weight:500;font-size:16px;
  letter-spacing:-.035em;color:var(--ink);margin-bottom:10px;
}
.foot-about{margin:0;font-size:13px;line-height:1.65;color:var(--ink-3);max-width:34ch}

.foot-col{display:flex;flex-direction:column;gap:9px;align-items:flex-start}
.foot-h{
  font-family:var(--font-mono);font-size:9.5px;letter-spacing:.12em;
  text-transform:uppercase;color:var(--ink-4);margin-bottom:3px;
}
.foot-col a{
  font-size:13.5px;color:var(--ink-2);text-decoration:none;
  transition:color .15s,transform .15s;
}
.foot-col a:hover{color:var(--accent);text-decoration:none;transform:translateX(2px)}

/* Обращение в кабинете — основной путь, поэтому это карточка,
   а не строчка в общем списке ссылок. */
.foot-cta{
  display:flex;align-items:flex-start;gap:11px;width:100%;padding:12px 14px;
  border-radius:13px;background:var(--surface-2);border:1px solid var(--line);
  transition:border-color .18s,background .18s,transform .18s;
}
.foot-cta:hover{border-color:var(--accent-line);background:var(--surface);transform:translateY(-2px)}
.foot-cta .ic{
  width:32px;height:32px;border-radius:10px;display:grid;place-items:center;flex:none;
  background:var(--accent-soft);color:var(--accent);
}
.foot-cta .ic svg{width:17px;height:17px}
.foot-cta b{display:block;font-size:13.5px;color:var(--ink);font-weight:600;margin-bottom:3px}
.foot-cta small{display:block;font-size:11.5px;line-height:1.5;color:var(--ink-3)}
.foot-alt{font-size:12.5px;color:var(--ink-4);line-height:1.6}
.foot-alt a{color:var(--ink-3);text-decoration:underline;text-underline-offset:2px}
.foot-alt a:hover{color:var(--accent)}

.foot-bottom{
  max-width:1180px;margin:0 auto;padding:16px 26px 24px;
  display:flex;align-items:center;gap:18px;flex-wrap:wrap;
  border-top:1px solid var(--line-soft);font-size:12.5px;color:var(--ink-4);
}
/* Спектр из знака — тонкой подписью между строками подвала. */
.foot-spectrum{
  flex:1;min-width:60px;height:2px;border-radius:2px;opacity:.5;
  background:linear-gradient(90deg,var(--m-voice),var(--m-image) 25%,var(--m-video) 50%,var(--m-music) 75%,var(--m-text));
}

@media(max-width:900px){
  .foot-in{grid-template-columns:1fr 1fr;gap:30px}
  .foot-brand{grid-column:1 / -1}
}
@media(max-width:560px){
  .foot-in{grid-template-columns:1fr;padding:32px 16px 26px}
  .foot-bottom{padding:14px 16px 20px}
  .foot-spectrum{display:none}
}

/* ─── правовые документы ───────────────────────────────────── */
.legal{max-width:74ch;margin:0 auto;padding:36px 24px 80px}
.legal h1{font-family:var(--font-display);font-weight:500;font-size:29px;letter-spacing:-.045em;margin-bottom:8px}
.legal .date{font-family:var(--font-mono);font-size:11.5px;color:var(--ink-4);margin-bottom:28px}
.legal h2{font-family:var(--font-display);font-weight:500;font-size:19px;letter-spacing:-.035em;margin:34px 0 10px}
.legal h3{font-size:15.5px;font-weight:600;margin:22px 0 8px}
.legal p{margin:0 0 13px;color:var(--ink-2);line-height:1.7}
.legal ul,.legal ol{margin:0 0 15px;padding-left:22px;color:var(--ink-2);line-height:1.7}
.legal li{margin-bottom:6px}
.legal strong{color:var(--ink);font-weight:600}
.legal table{border-collapse:collapse;width:100%;margin:0 0 18px;font-size:13.5px;border:1px solid var(--line);border-radius:10px;overflow:hidden}
.legal th{text-align:left;padding:9px 12px;background:var(--surface-2);border-bottom:1px solid var(--line);font-weight:600;font-size:12.5px;color:var(--ink-2)}
.legal td{padding:9px 12px;border-bottom:1px solid var(--line-soft);color:var(--ink-2)}
.legal tr:last-child td{border-bottom:0}

/* ─── инструменты: посадочные страницы ─────────────────────── */
/* Плитка — ссылка целиком, поэтому подчёркивание снимаем явно. */
.ins-tile{display:block;text-decoration:none;color:inherit;transition:transform .15s,border-color .15s}
.ins-tile:hover{transform:translateY(-2px);border-color:var(--mod,var(--accent));text-decoration:none}
.ins-tile b{color:var(--ink)}

/* Текст под формой набран той же типографикой, что и правовые документы. */
.prose{max-width:70ch}
.prose h2{font-family:var(--font-display);font-weight:500;font-size:19px;letter-spacing:-.035em;margin:30px 0 10px}
.prose h3{font-size:15.5px;font-weight:600;margin:20px 0 8px}
.prose p{margin:0 0 13px;color:var(--ink-2);line-height:1.7}
.prose ul,.prose ol{margin:0 0 15px;padding-left:22px;color:var(--ink-2);line-height:1.7}
.prose li{margin-bottom:6px}
.prose strong{color:var(--ink);font-weight:600}
.prose a{color:var(--accent)}

/* ─── баннер cookies ───────────────────────────────────────── */
.cookie-bar{
  position:fixed;left:16px;right:16px;bottom:16px;z-index:150;max-width:640px;margin:0 auto;
  display:flex;align-items:center;gap:14px;padding:14px 16px;border-radius:var(--r-l);
  background:var(--surface);border:1px solid var(--line);box-shadow:var(--shadow-2);
  font-size:13px;color:var(--ink-2);flex-wrap:wrap;
}
.cookie-bar p{margin:0;flex:1;min-width:200px}

/* ─── админка ──────────────────────────────────────────────── */
.admin-tabs{display:flex;gap:4px;padding:0 18px;border-bottom:1px solid var(--line);background:var(--surface);overflow-x:auto;scrollbar-width:none;flex:none}
.admin-tabs::-webkit-scrollbar{display:none}
.admin-tabs a{
  padding:11px 12px;font-size:13px;font-weight:500;color:var(--ink-3);white-space:nowrap;
  border-bottom:2px solid transparent;margin-bottom:-1px;text-decoration:none;transition:color .15s,border-color .15s;
}
.admin-tabs a:hover{color:var(--ink);text-decoration:none}
.admin-tabs a.on{color:var(--accent);border-bottom-color:var(--accent);font-weight:600}
/* Метка непрочитанного на вкладке: обращения не должны ждать
   обнаружения в списке. */
.admin-tabs a{display:inline-flex;align-items:center;gap:6px}
.tab-badge{
  min-width:17px;height:17px;padding:0 5px;border-radius:5px;
  display:grid;place-items:center;background:var(--crit);color:#fff;
  font-family:var(--font-mono);font-size:10px;font-weight:700;line-height:1;
}

/* ─── постраничная навигация ───────────────────────────────── */
.pager{display:flex;gap:5px;align-items:center;justify-content:center;margin-top:18px;flex-wrap:wrap}
.pager a,.pager span{
  min-width:32px;height:32px;padding:0 9px;border-radius:8px;display:grid;place-items:center;
  font-family:var(--font-mono);font-size:12px;border:1px solid var(--line);background:var(--surface);
  color:var(--ink-2);text-decoration:none;
}
.pager a:hover{border-color:var(--ink-4);color:var(--ink);text-decoration:none}
.pager .on{background:var(--ink);border-color:var(--ink);color:var(--ground);font-weight:600}
.pager .gap{border:0;background:none;color:var(--ink-4)}

/* ─── модальное окно ───────────────────────────────────────── */
.modal-back{position:fixed;inset:0;background:rgba(6,10,9,.55);backdrop-filter:blur(3px);z-index:180;display:grid;place-items:center;padding:20px}
.modal{width:100%;max-width:460px;background:var(--surface);border:1px solid var(--line);border-radius:var(--r-l);box-shadow:var(--shadow-2);overflow:hidden}
.modal-head{padding:16px 18px;border-bottom:1px solid var(--line-soft);display:flex;align-items:center;gap:10px}
.modal-body{padding:18px;display:flex;flex-direction:column;gap:14px;max-height:64vh;overflow-y:auto}
.modal-foot{padding:14px 18px;border-top:1px solid var(--line-soft);display:flex;gap:9px;justify-content:flex-end}

/* ─── анимации ─────────────────────────────────────────────── */
@keyframes rise{from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:none}}
.rise{animation:rise .45s cubic-bezier(.2,.8,.3,1) both}
@keyframes pulse{0%,100%{opacity:1}50%{opacity:.45}}
.pulse{animation:pulse 1.6s ease-in-out infinite}

@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{animation-duration:.001ms !important;transition-duration:.001ms !important}
}

/* ─── адаптив ──────────────────────────────────────────────── */
@media (max-width:1180px){
  .app{grid-template-columns:var(--rail-w) minmax(0,1fr)}
  .side{display:none}
  .split{grid-template-columns:minmax(0,1fr)}
}
@media (max-width:860px){
  .theme-sw button span{display:none}
  .theme-sw button{padding:0 8px}
  .omni{max-width:none}
}
@media (max-width:640px){
  .app{grid-template-columns:minmax(0,1fr);height:auto;min-height:100dvh}
  .rail{
    flex-direction:row;height:56px;width:100%;padding:0 10px;gap:2px;
    border-right:0;border-bottom:1px solid var(--line);overflow-x:auto;
  }
  .rail::after{display:none}
  .rail .mark{margin:0 8px 0 0;flex:none}
  .rail-group{flex-direction:row;width:auto}
  .rail-sep{width:1px;height:24px;margin:0 8px}
  .rail-foot{margin-top:0;margin-left:auto;flex-direction:row}
  .mod{width:44px;height:44px}
  .mod.on::before{left:50%;top:auto;bottom:-1px;transform:translateX(-50%);width:20px;height:3px;border-radius:3px 3px 0 0}
  .tip{display:none}
  .main{overflow:visible}
  .work{padding:16px 14px 40px}
  .topbar{flex-wrap:wrap}
  .omni{order:3;width:100%;flex-basis:100%}
}

/* ═══════════════════════════════════════════════════════════════
   ФОРМЫ ГЕНЕРАЦИИ — единые компоненты для всех модулей
   Схема «Студия»: слева работа, справа панель параметров с итогом.
   ═══════════════════════════════════════════════════════════════ */

/* ─── карточка модели ──────────────────────────────────────── */
.mcards{display:grid;gap:8px}
.mcard{
  position:relative;display:block;text-align:left;cursor:pointer;
  padding:12px 34px 12px 13px;border-radius:13px;
  border:1.5px solid var(--line);background:var(--surface-2);
  transition:border-color .16s,background .16s,transform .16s;
}
.mcard:hover{transform:translateY(-1px);border-color:var(--ink-4)}
.mcard.on{border-color:var(--accent);background:var(--accent-soft)}
.mcard input{position:absolute;opacity:0;pointer-events:none}
.mcard .nm{font-size:13.5px;font-weight:600;display:flex;align-items:center;gap:7px;margin-bottom:3px;line-height:1.3}
.mcard .ds{display:block;font-size:11.5px;color:var(--ink-3);line-height:1.45;margin-bottom:8px}
.mcard .pr{font-family:var(--font-mono);font-size:15px;font-weight:700;letter-spacing:-.01em;font-variant-numeric:tabular-nums}
.mcard.on .pr{color:var(--accent)}
.mcard .unit{font-family:var(--font-mono);font-size:10px;color:var(--ink-4);margin-left:4px;font-weight:400}
.mcard .tick{
  position:absolute;top:12px;right:12px;width:16px;height:16px;border-radius:50%;
  border:1.5px solid var(--line);display:grid;place-items:center;
}
.mcard.on .tick{background:var(--accent);border-color:var(--accent)}
.mcard.on .tick::after{
  content:"";width:4px;height:8px;border:solid var(--accent-ink);
  border-width:0 2px 2px 0;transform:rotate(45deg) translate(-1px,-1px);
}
.mcard.free .pr{color:var(--ok)}

/* ─── формат кадра: показываем форму, а не описываем словами ─ */
.ratios{display:flex;gap:7px;flex-wrap:wrap;align-items:flex-start}
.ratio{
  display:flex;flex-direction:column;align-items:center;justify-content:flex-end;gap:6px;
  padding:9px 10px 8px;border-radius:11px;cursor:pointer;min-width:48px;
  border:1.5px solid var(--line);background:var(--surface-2);
  transition:border-color .15s,background .15s;
}
.ratio:hover{border-color:var(--ink-4)}
.ratio.on{border-color:var(--accent);background:var(--accent-soft)}
.ratio input{position:absolute;opacity:0;pointer-events:none}
.ratio .sh{border:1.5px solid var(--ink-3);border-radius:3px;background:transparent;display:block;flex:none}
.ratio.on .sh{border-color:var(--accent);background:color-mix(in srgb,var(--accent) 18%,transparent)}
.ratio .cap{font-family:var(--font-mono);font-size:10px;color:var(--ink-3);line-height:1}
.ratio.on .cap{color:var(--accent);font-weight:600}
.ratio.auto .sh{border-style:dashed}
/* Форматов больше десятка — редкие прячем за кнопкой. */
.ratio.extra{display:none}
.ratios.expanded .ratio.extra{display:flex}
.ratio-more{
  align-self:stretch;display:flex;align-items:center;gap:5px;padding:0 11px;
  border-radius:11px;border:1.5px dashed var(--line);background:transparent;
  font-size:11.5px;font-weight:500;color:var(--ink-3);min-height:52px;
  transition:border-color .15s,color .15s;
}
.ratio-more:hover{border-color:var(--accent-line);color:var(--ink)}
.ratio-more svg{width:12px;height:12px;stroke-width:2.2;transition:transform .18s}
.ratios.expanded .ratio-more svg{transform:rotate(180deg)}

/* ─── зона загрузки вместо системной кнопки «Обзор» ────────── */
.drop{
  position:relative;display:flex;align-items:center;gap:11px;padding:12px 14px;
  border:1.5px dashed var(--line);border-radius:12px;background:var(--surface-2);
  cursor:pointer;transition:border-color .15s,background .15s;
}
.drop:hover,.drop.over{border-color:var(--accent-line);background:var(--surface)}
.drop input[type=file]{position:absolute;inset:0;opacity:0;cursor:pointer}
.drop .ic{width:34px;height:34px;border-radius:10px;background:var(--sunken);display:grid;place-items:center;flex:none;overflow:hidden}
.drop .ic svg{width:17px;height:17px;color:var(--ink-3)}
.drop .ic img{width:100%;height:100%;object-fit:cover}
.drop .t{font-size:13px;font-weight:500;display:block}
.drop .s{font-size:11.5px;color:var(--ink-4);display:block;margin-top:1px}
.drop .clear{
  margin-left:auto;position:relative;z-index:2;width:26px;height:26px;border-radius:8px;
  display:grid;place-items:center;color:var(--ink-4);flex:none;
}
.drop .clear:hover{background:var(--sunken);color:var(--crit)}
.drop .clear svg{width:13px;height:13px;stroke-width:2}

/* ─── блок итога: сумма, состав, остаток ───────────────────── */
.total{
  display:flex;align-items:center;gap:14px;padding:13px 15px;border-radius:13px;
  background:var(--surface-2);border:1px solid var(--line);flex-wrap:wrap;
}
.total .sum{
  font-family:var(--font-mono);font-size:22px;font-weight:700;
  letter-spacing:-.02em;color:var(--accent);font-variant-numeric:tabular-nums;line-height:1.1;
}
.total .sum.free{color:var(--ok)}
.total .bd{font-family:var(--font-mono);font-size:10.5px;color:var(--ink-4);line-height:1.55}
.total .side{margin-left:auto;text-align:right}
.total.low{border-color:color-mix(in srgb,var(--crit) 34%,transparent);background:var(--crit-soft)}
.total.low .sum{color:var(--crit)}

/* ─── строка «что можно сделать» ───────────────────────────── */
.rowlist{display:flex;flex-direction:column;gap:2px}
.rowitem{
  display:flex;align-items:center;gap:12px;padding:11px 13px;border-radius:11px;
  text-decoration:none;color:inherit;transition:background .14s;
}
.rowitem:hover{background:var(--surface-2);text-decoration:none}
.rowitem .ic{
  width:34px;height:34px;border-radius:10px;flex:none;display:grid;place-items:center;
  background:color-mix(in srgb,var(--mod,var(--accent)) 13%,transparent);color:var(--mod,var(--accent));
}
.rowitem .ic svg{width:17px;height:17px}
.rowitem .nm{font-size:13.5px;font-weight:600;display:block}
.rowitem .ds{font-size:12px;color:var(--ink-3);display:block;margin-top:1px}
.rowitem .pr{
  margin-left:auto;font-family:var(--font-mono);font-size:12px;color:var(--ink-2);
  text-align:right;white-space:nowrap;font-variant-numeric:tabular-nums;
}
.rowitem .pr small{display:block;font-size:9.5px;color:var(--ink-4)}
.rowitem .pr.free{color:var(--ok);font-weight:600}
.rowitem .go{color:var(--ink-4);flex:none;display:grid;place-items:center}
.rowitem .go svg{width:15px;height:15px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}

/* ─── действия на карточке результата ──────────────────────── */
.res-actions{display:flex;align-items:center;gap:7px;flex-wrap:wrap;margin-top:9px}
.res-actions .spacer{margin-left:auto}

/* ─── панель параметров ────────────────────────────────────── */
.panel{display:flex;flex-direction:column;gap:16px}
.panel-group{display:flex;flex-direction:column;gap:9px}
.panel-group > .lbl{margin-bottom:-1px}

@media(max-width:1180px){
  .mcards{grid-template-columns:repeat(auto-fit,minmax(220px,1fr))}
}
@media(max-width:640px){
  .mcards{grid-template-columns:1fr}
  .total .side{margin-left:0;text-align:left;width:100%}
}

/* ─── окно выбора модели ────────────────────────────────────
   Общее для витрины и кабинета. Каталог почти на двести моделей
   одним списком не выбирается, поэтому он разложен по вкладкам
   разработчиков с логотипами. */
.picker{
  position:fixed;inset:0;z-index:220;display:none;place-items:center;padding:20px;
  background:rgba(9,12,10,.58);backdrop-filter:blur(3px) saturate(115%);
}
.picker.open{display:grid;animation:pkFade .2s ease both}
@keyframes pkFade{from{opacity:0}to{opacity:1}}
.picker-box{
  display:flex;flex-direction:column;width:min(100%,720px);max-height:min(86vh,680px);
  background:var(--surface);border:1px solid var(--line);border-radius:20px;overflow:hidden;
  box-shadow:0 30px 80px -20px rgba(0,0,0,.45);
  animation:pkLift .28s cubic-bezier(.2,.8,.3,1) both;
}
@keyframes pkLift{from{opacity:0;transform:translateY(14px) scale(.98)}to{opacity:1;transform:none}}

.picker-head{
  display:flex;align-items:center;gap:12px;padding:18px 20px;flex:none;
  border-bottom:1px solid var(--line-soft);
}
.picker-title{font-family:var(--font-display);font-weight:500;font-size:18px;letter-spacing:-.035em}
.picker-count{font-family:var(--font-mono);font-size:11px;color:var(--ink-4)}
.picker-x{
  margin-left:auto;width:30px;height:30px;border-radius:9px;display:grid;place-items:center;
  color:var(--ink-4);background:none;border:0;cursor:pointer;transition:background .15s,color .15s;
}
.picker-x:hover{background:var(--surface-2);color:var(--ink)}
.picker-x svg{width:15px;height:15px}

/* Две колонки: разработчиков три десятка, полосой сверху они уезжали
   за край и не прокручивались. Слева список, справа модели. */
.picker-body{display:grid;grid-template-columns:216px minmax(0,1fr);flex:1;min-height:0}
.picker-side{
  display:flex;flex-direction:column;gap:2px;padding:12px 10px;
  border-right:1px solid var(--line-soft);background:var(--surface-2);
  overflow-y:auto;min-height:0;
}
.picker-sep{height:1px;background:var(--line-soft);margin:8px 6px}
.ptab{
  display:flex;align-items:center;gap:10px;padding:8px 10px;flex:none;width:100%;
  border-radius:10px;background:none;border:1px solid transparent;
  color:var(--ink-2);font-size:13px;cursor:pointer;text-align:left;
  transition:background .15s,color .15s,border-color .15s;
}
.ptab:hover{background:var(--surface);color:var(--ink)}
.ptab.on{background:var(--surface);border-color:var(--line);color:var(--ink);font-weight:600;box-shadow:var(--shadow-1)}
.ptab .pn{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.ptab .pc{font-family:var(--font-mono);font-size:10.5px;color:var(--ink-4);flex:none}
.ptab.on .pc{color:var(--accent)}

.picker-main{display:flex;flex-direction:column;min-height:0;min-width:0}

/* Знак разработчика: логотип или буква в его цвете. */
.pmark{
  width:26px;height:26px;border-radius:8px;display:grid;place-items:center;flex:none;
  background:color-mix(in srgb,var(--vc,var(--ink-4)) 14%,transparent);
  color:var(--vc,var(--ink-4));
  font-family:var(--font-display);font-weight:600;font-size:11px;overflow:hidden;
}
.pmark img{width:17px;height:17px;object-fit:contain;display:block}
.pmark.all{background:var(--sunken);color:var(--ink-3)}
.pmark.all svg{width:14px;height:14px}

.picker-search{position:relative;flex:none;padding:14px 16px 10px}
.picker-search svg{
  position:absolute;left:28px;top:50%;transform:translateY(-50%);
  width:16px;height:16px;color:var(--ink-4);pointer-events:none;
}
.picker-search input{
  width:100%;height:38px;padding:0 14px 0 34px;border-radius:11px;
  background:var(--surface-2);border:1px solid var(--line);color:var(--ink);font-size:14px;
  transition:border-color .16s;
}
.picker-search input:focus{outline:none;border-color:var(--ink-4)}
.picker-search input::placeholder{color:var(--ink-4)}

/* Список моделей */
.picker-list{
  flex:1;min-height:0;overflow-y:auto;padding:0 10px 14px;
  display:flex;flex-direction:column;gap:2px;
}
.pitem{
  display:flex;align-items:center;gap:12px;padding:11px 12px;border-radius:12px;
  background:none;border:1px solid transparent;cursor:pointer;text-align:left;width:100%;
  transition:background .14s,border-color .14s;
}
.pitem:hover{background:var(--surface-2)}
.pitem.on{
  background:color-mix(in srgb,var(--accent) 9%,transparent);
  border-color:color-mix(in srgb,var(--accent) 32%,transparent);
}
.pitem .pmark{width:32px;height:32px;border-radius:9px;font-size:13px}
.pitem .pmark img{width:20px;height:20px}
.pinfo{display:flex;flex-direction:column;gap:2px;min-width:0;flex:1}
.pname{font-size:14px;font-weight:500;color:var(--ink);line-height:1.3;
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.pmeta{font-family:var(--font-mono);font-size:10.5px;color:var(--ink-4)}
.pfree{
  flex:none;font-family:var(--font-mono);font-size:9.5px;letter-spacing:.07em;text-transform:uppercase;
  color:var(--ok);background:var(--ok-soft);padding:4px 8px;border-radius:6px;
}
.pprice{
  flex:none;text-align:right;font-family:var(--font-mono);font-size:12.5px;
  font-weight:600;color:var(--ink-2);line-height:1.2;
}
.pprice small{display:block;font-size:9.5px;font-weight:400;color:var(--ink-4);margin-top:2px}
.ptick{flex:none;width:18px;color:var(--accent);opacity:0;transition:opacity .14s}
.ptick svg{width:16px;height:16px}
.pitem.on .ptick{opacity:1}

.picker-empty{padding:30px 12px;text-align:center;color:var(--ink-4);font-size:13.5px}

/* Кнопка, открывающая окно: показывает выбранное. */
.pick-btn{
  display:flex;align-items:center;gap:10px;width:100%;padding:10px 12px;border-radius:12px;
  background:var(--surface-2);border:1px solid var(--line);color:var(--ink);
  cursor:pointer;text-align:left;transition:border-color .16s,background .16s;
}
.pick-btn:hover{border-color:var(--ink-4)}
.pick-btn .pmark{width:28px;height:28px;border-radius:8px}
.pick-btn .pmark img{width:18px;height:18px}
.pick-btn .nm{flex:1;min-width:0;font-size:13.5px;font-weight:500;
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.pick-btn .chev{color:var(--ink-4);flex:none;display:grid;place-items:center}
.pick-btn .chev svg{width:15px;height:15px;fill:none;stroke:currentColor;stroke-width:2;
  stroke-linecap:round;stroke-linejoin:round}

@media(max-width:820px){
  /* На узком экране колонка слева съедает половину: разработчики
     превращаются в полосу над списком, она листается пальцем. */
  .picker-body{grid-template-columns:1fr;grid-template-rows:auto minmax(0,1fr)}
  .picker-side{
    flex-direction:row;overflow-x:auto;overflow-y:hidden;
    border-right:0;border-bottom:1px solid var(--line-soft);padding:10px;
  }
  .ptab{width:auto;flex:none;border-radius:999px}
  .ptab .pn{max-width:120px}
  .picker-sep{display:none}
}
@media(max-width:640px){
  .picker{padding:0;place-items:stretch}
  .picker-box{width:100%;max-height:100%;border-radius:0;border:0}
  .pitem .pmark{width:28px;height:28px}
}
@media(prefers-reduced-motion:reduce){
  .picker.open,.picker-box{animation:none}
}

/* ─── окно системной инструкции ─────────────────────────────
   Задают её редко, поэтому в форме она занимает одну строку,
   а текст правится здесь. */
.pbox{
  position:fixed;inset:0;z-index:230;display:none;place-items:center;padding:20px;
  background:rgba(9,12,10,.58);backdrop-filter:blur(3px) saturate(115%);
}
.pbox.open{display:grid;animation:pkFade .2s ease both}
.pbox-box{
  position:relative;width:min(100%,560px);background:var(--surface);
  border:1px solid var(--line);border-radius:20px;padding:26px;
  box-shadow:0 30px 80px -20px rgba(0,0,0,.45);
  animation:pkLift .28s cubic-bezier(.2,.8,.3,1) both;
}
.pbox h3{
  font-family:var(--font-display);font-weight:500;font-size:19px;letter-spacing:-.035em;
  margin:0 0 8px;padding-right:34px;
}
.pbox-lead{margin:0 0 18px;font-size:13.5px;line-height:1.6;color:var(--ink-3);max-width:52ch}
.pbox-l{
  display:flex;align-items:center;gap:8px;margin-bottom:8px;
  font-family:var(--font-mono);font-size:9.5px;letter-spacing:.11em;
  text-transform:uppercase;color:var(--ink-4);
}
.pbox-l .cnt{margin-left:auto;letter-spacing:0}
.pbox textarea{
  width:100%;min-height:132px;padding:13px 14px;border-radius:12px;resize:vertical;
  background:var(--surface-2);border:1px solid var(--line);color:var(--ink);
  font-size:14px;line-height:1.55;transition:border-color .16s;
}
.pbox textarea:focus{outline:none;border-color:var(--ink-4)}
.pbox textarea::placeholder{color:var(--ink-4)}

.pbox-presets{display:flex;flex-wrap:wrap;gap:6px;margin:12px 0 20px}
.pbox-presets button{
  height:30px;padding:0 12px;border-radius:999px;font-size:12.5px;cursor:pointer;
  background:var(--surface-2);border:1px solid var(--line);color:var(--ink-2);
  transition:background .16s,color .16s,border-color .16s;
}
.pbox-presets button:hover{background:var(--ink);border-color:var(--ink);color:var(--ground)}
.pbox-go{display:flex;gap:8px}

/* Строка «Инструкция» в форме: состояние видно, места почти не занимает. */
.prompt-row{
  display:flex;align-items:center;gap:10px;width:100%;padding:9px 12px;border-radius:11px;
  background:var(--surface-2);border:1px solid var(--line);color:var(--ink-2);
  cursor:pointer;text-align:left;font-size:13px;transition:border-color .16s,background .16s;
}
.prompt-row:hover{border-color:var(--ink-4);color:var(--ink)}
.prompt-row svg{width:15px;height:15px;fill:none;stroke:currentColor;stroke-width:1.7;
  stroke-linecap:round;stroke-linejoin:round;flex:none;color:var(--ink-4)}
.prompt-row .st{
  margin-left:auto;font-family:var(--font-mono);font-size:10px;letter-spacing:.06em;
  text-transform:uppercase;color:var(--ink-4);flex:none;
}
.prompt-row.set{border-color:color-mix(in srgb,var(--accent) 34%,transparent)}
.prompt-row.set .st{color:var(--accent)}

/* Ссылки в шапке витрины. */
.guest-links{display:flex;align-items:center;gap:2px;margin-left:8px}
.guest-links a{
  padding:7px 11px;border-radius:9px;font-size:13.5px;color:var(--ink-3);
  text-decoration:none;transition:background .16s,color .16s;
}
.guest-links a:hover{background:var(--surface-2);color:var(--ink);text-decoration:none}
.guest-links a.on{color:var(--ink);font-weight:600;background:var(--surface-2)}

/* Блок с примером запроса. */
.code-block{
  background:var(--sunken);border:1px solid var(--line);border-radius:13px;
  overflow-x:auto;
}
.code-block pre{
  margin:0;padding:16px 18px;font-family:var(--font-mono);font-size:12.5px;
  line-height:1.75;color:var(--ink-2);white-space:pre;
}

@media(max-width:820px){
  .guest-links{display:none}
}

/* ─── переписка обращения ───────────────────────────────────
   Свои сообщения справа, ответы поддержки слева — как в любой
   переписке, чтобы чей ход было видно без чтения подписей. */
.thread{display:flex;flex-direction:column;gap:12px;max-width:860px}
.tmsg{
  max-width:82%;padding:13px 16px;border-radius:16px;
  background:var(--surface);border:1px solid var(--line);box-shadow:var(--shadow-1);
}
.tmsg.own{align-self:flex-end;border-bottom-right-radius:6px}
.tmsg.staff{
  align-self:flex-start;border-bottom-left-radius:6px;
  background:color-mix(in srgb,var(--accent) 7%,var(--surface));
  border-color:color-mix(in srgb,var(--accent) 26%,transparent);
}
.tmsg-head{display:flex;align-items:center;gap:10px;margin-bottom:7px}
.tmsg-head .who{font-size:12.5px;font-weight:600;color:var(--ink-2)}
.tmsg.staff .tmsg-head .who{color:var(--accent)}
.tmsg-head .when{
  margin-left:auto;font-family:var(--font-mono);font-size:10px;color:var(--ink-4);
}
.tmsg-body{font-size:14px;line-height:1.65;color:var(--ink);white-space:pre-wrap;word-break:break-word}
.tmsg-files{display:flex;flex-wrap:wrap;gap:8px;margin-top:11px}
.tmsg-files a{display:block;width:92px;height:92px;border-radius:10px;overflow:hidden;border:1px solid var(--line)}
.tmsg-files img{width:100%;height:100%;object-fit:cover;transition:transform .2s}
.tmsg-files a:hover img{transform:scale(1.05)}

/* Отметка о событии — не сообщение, поэтому идёт по центру и тише. */
.tmsg-sys{
  align-self:center;display:flex;align-items:center;gap:10px;
  padding:7px 14px;border-radius:999px;background:var(--surface-2);
  border:1px solid var(--line-soft);font-size:12.5px;color:var(--ink-3);
}

/* ─── шапка чата ─────────────────────────────────────────────
   Модель и инструкция стоят рядом с названием: их видно всегда, но
   строкой, а не двумя кнопками во всю ширину под полем ввода. */
.chat-head{display:flex;align-items:flex-end;gap:14px;flex-wrap:wrap;margin-bottom:16px}
.chat-title{flex:1;min-width:0}
.chat-tools{display:flex;align-items:center;gap:7px;flex-wrap:wrap}
.chat-stat{white-space:nowrap}

.chip{
  display:inline-flex;align-items:center;gap:7px;flex:none;
  height:32px;padding:0 10px;max-width:250px;
  border-radius:9px;background:var(--surface-2);border:1px solid var(--line);
  color:var(--ink-2);font-size:12.5px;font-weight:500;cursor:pointer;
  transition:border-color .16s,color .16s,background .16s;
}
.chip:hover{border-color:var(--ink-4);color:var(--ink)}
.chip > svg{width:14px;height:14px;flex:none;color:var(--ink-4)}
.chip .nm{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}
.chip .pmark{width:20px;height:20px;border-radius:6px;font-size:9.5px;flex:none}
.chip .pmark img{width:14px;height:14px}
.chip .chev{display:grid;place-items:center;color:var(--ink-4);flex:none}
.chip .chev svg{width:13px;height:13px;fill:none;stroke:currentColor;stroke-width:2;
  stroke-linecap:round;stroke-linejoin:round}
.chip .st{
  font-family:var(--font-mono);font-size:9.5px;letter-spacing:.06em;
  text-transform:uppercase;color:var(--accent);flex:none;
}
.chip .st:empty{display:none}
.chip.set{border-color:color-mix(in srgb,var(--accent) 34%,transparent)}
.chip.danger{padding:0 9px}
.chip.danger:hover{border-color:var(--crit);color:var(--crit)}
.chip.danger:hover > svg{color:var(--crit)}

/* Ожидание ответа: точки на месте будущего пузыря. */
.chat-typing{
  display:inline-flex;align-items:center;gap:5px;width:fit-content;
  padding:15px 17px;border-radius:14px 14px 14px 4px;
  background:var(--surface-2);border:1px solid var(--line);
}
.chat-typing i{
  width:6px;height:6px;border-radius:50%;background:var(--ink-4);
  animation:chat-dot 1.1s ease-in-out infinite;
}
.chat-typing i:nth-child(2){animation-delay:.15s}
.chat-typing i:nth-child(3){animation-delay:.3s}
@keyframes chat-dot{
  0%,60%,100%{opacity:.3;transform:translateY(0)}
  30%{opacity:1;transform:translateY(-3px)}
}

/* ─── переписка в чате ───────────────────────────────────────
   Обе стороны устроены одинаково: пузырь по ширине текста и не шире
   80% колонки. Растягивается он только когда содержимого правда много,
   иначе короткое «Привет» занимало бы всю строку. */
.chat-line{display:flex;flex-direction:column;align-items:flex-start;gap:5px}
.chat-line.me{align-items:flex-end}

.chat-bubble{
  width:fit-content;max-width:80%;
  padding:12px 15px;font-size:14.5px;line-height:1.7;white-space:pre-wrap;
  background:var(--surface-2);border:1px solid var(--line);
  border-radius:14px 14px 14px 4px;
}
.chat-bubble.me{
  background:var(--accent-soft);border-color:var(--accent-line);
  border-radius:14px 14px 4px 14px;line-height:1.6;
}

/* Сбой занимает место ответа: тот же пузырь, только приглушённый. */
.chat-fail{
  display:inline-flex;align-items:flex-start;gap:9px;
  width:fit-content;max-width:80%;
  background:var(--surface-2);border:1px solid var(--line);
  border-left:2px solid var(--crit);
  border-radius:14px 14px 14px 4px;padding:11px 14px;
  font-size:13.5px;line-height:1.55;color:var(--ink-3);
}
.chat-fail svg{width:15px;height:15px;flex:none;margin-top:1px;color:var(--crit);opacity:.8}

@media(max-width:760px){
  .chat-bubble,.chat-fail{max-width:92%}
}

/* ─── заготовки ответов ─────────────────────────────────────── */
.qa .pinfo{gap:4px}
.qa-text{
  font-size:12px;line-height:1.5;color:var(--ink-4);
  display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;
}
.qa-edit{
  border:1px solid var(--line);border-radius:12px;padding:12px 14px;margin-bottom:8px;
  background:var(--surface-2);
}
.qa-edit summary{
  display:flex;align-items:center;gap:10px;cursor:pointer;font-size:14px;
  list-style:none;
}
.qa-edit summary::-webkit-details-marker{display:none}
.qa-edit summary::after{
  content:"";margin-left:auto;width:8px;height:8px;flex:none;
  border-right:1.6px solid var(--ink-4);border-bottom:1.6px solid var(--ink-4);
  transform:rotate(45deg);transition:transform .2s;
}
.qa-edit[open] summary::after{transform:rotate(-135deg)}
.qa-edit[open]{background:var(--surface);box-shadow:var(--shadow-1)}

/* Точка «есть непрочитанное» на значке рельса. */
.mod-dot{
  position:absolute;top:7px;right:9px;width:7px;height:7px;border-radius:50%;
  background:var(--ok);border:2px solid var(--surface);
}

/* ─── прокси ─────────────────────────────────────────────────
   Прокси заводят пачками, поэтому список — строки в одну линию:
   состояние, адрес, итоги последней проверки. Настройки лежат
   под строкой и раскрываются только у той, что правят. */
.px-list{display:flex;flex-direction:column;gap:6px}

.px{
  border:1px solid var(--line);border-radius:12px;background:var(--surface);
  transition:box-shadow .2s,border-color .2s,opacity .2s,transform .2s;
}
.px[open]{box-shadow:var(--shadow-1);border-color:var(--line-soft)}
.px:hover{border-color:var(--accent-line)}

.px summary{
  display:flex;align-items:center;gap:10px;cursor:pointer;list-style:none;
  padding:9px 12px;min-height:44px;
}
.px summary::-webkit-details-marker{display:none}
.px summary::after{
  content:"";width:7px;height:7px;flex:none;margin-left:2px;
  border-right:1.6px solid var(--ink-4);border-bottom:1.6px solid var(--ink-4);
  transform:rotate(45deg);transition:transform .2s;
}
.px[open] summary::after{transform:rotate(-135deg)}

.px-host{font-size:13.5px;letter-spacing:-.01em;white-space:nowrap}
.px-host .dim{font-weight:400}

.px-tag{
  font-size:10.5px;font-weight:700;letter-spacing:.04em;text-transform:uppercase;
  color:var(--ink-3);background:var(--surface-2);border:1px solid var(--line-soft);
  border-radius:6px;padding:2px 6px;flex:none;
}
.px-label{font-size:12.5px;color:var(--ink-2);white-space:nowrap}

/* Итоги проверки: занимают остаток строки и сжимаются первыми. */
.px-meta{
  margin-left:auto;font-size:11.5px;color:var(--ink-4);
  font-family:var(--font-mono,monospace);
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0;
}
.px-meta:empty{display:none}

.px summary .badge{flex:none}
.px-act{flex:none}
.px-act svg{width:13px;height:13px}

.px-body{padding:0 12px 12px;border-top:1px solid var(--line-soft);margin-top:2px;padding-top:12px}
.px-err{
  font-size:12px;line-height:1.5;color:var(--crit);background:var(--crit-soft);
  border-radius:9px;padding:8px 10px;margin-bottom:12px;
}
.px-del:hover{border-color:var(--crit);color:var(--crit)}

/* Удаление: строка уезжает сама, без перерисовки всего списка. */
.px-gone{opacity:0;transform:translateX(-10px)}

.px-empty{
  border:1px dashed var(--line);border-radius:12px;padding:18px;text-align:center;
  font-size:13px;color:var(--ink-4);
}

.px-add summary{color:var(--ink-2);font-size:13.5px}
.px-plus{
  width:20px;height:20px;border-radius:6px;flex:none;
  display:grid;place-items:center;font-weight:700;
  background:var(--accent-soft);color:var(--accent);
}

/* Назначение: строки плотнее обычной таблицы — их всего пять-шесть. */
.px-assign td,.px-assign th{padding:8px 14px}
.px-assign .select{max-width:340px;font-size:12.5px;height:32px}

.is-busy{opacity:.55;pointer-events:none}

@media(max-width:760px){
  .px summary{flex-wrap:wrap;gap:7px}
  .px-meta{margin-left:0;flex-basis:100%;white-space:normal}
}

/* ─── окно технических деталей задачи ───────────────────────
   Ответы поставщиков бывают на тысячи строк, поэтому они живут
   в отдельном окне со скроллом, а не на странице. */
.dbg{position:fixed;inset:0;z-index:240;display:grid;place-items:center;padding:20px}
.dbg[hidden]{display:none}
.dbg-back{
  position:absolute;inset:0;
  background:rgba(9,12,10,.58);backdrop-filter:blur(3px) saturate(115%);
  animation:pkFade .2s ease both;
}
.dbg-win{
  position:relative;display:flex;flex-direction:column;
  width:min(100%,940px);max-height:min(88vh,760px);
  background:var(--surface);border:1px solid var(--line);border-radius:20px;overflow:hidden;
  box-shadow:0 30px 80px -20px rgba(0,0,0,.45);
  animation:pkLift .28s cubic-bezier(.2,.8,.3,1) both;
}
.dbg-head{
  display:flex;align-items:center;gap:12px;padding:16px 20px;flex:none;
  border-bottom:1px solid var(--line-soft);
}
.dbg-title{font-family:var(--font-display);font-weight:500;font-size:17px;letter-spacing:-.035em}
.dbg-head .row{margin-left:auto}

.dbg-body{padding:16px 20px 20px;overflow-y:auto;min-height:0;flex:1}

/* Сводка: коды и время в две колонки, без таблицы. */
.dbg-facts{
  display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:2px 18px;
  margin-bottom:16px;
}
.dbg-fact{display:flex;gap:10px;padding:5px 0;border-bottom:1px solid var(--line-soft);font-size:12.5px}
.dbg-fact span{color:var(--ink-4);flex:none}
.dbg-fact b{margin-left:auto;text-align:right;font-family:var(--font-mono);font-size:11.5px;word-break:break-all}

.dbg-sec{margin-top:14px}
.dbg-sec summary{
  display:flex;align-items:center;gap:10px;cursor:pointer;padding:9px 12px;
  background:var(--surface-2);border:1px solid var(--line);border-radius:10px;
  font-family:var(--font-mono);font-size:11.5px;color:var(--ink-2);
}
.dbg-sec summary::-webkit-details-marker{display:none}
.dbg-sec[open] summary{border-bottom-left-radius:0;border-bottom-right-radius:0}
.dbg-sec .note{margin-left:auto;color:var(--ink-4);font-size:11px;text-align:right}
.dbg-sec pre{
  margin:0;padding:12px;max-height:420px;overflow:auto;
  background:var(--surface-2);border:1px solid var(--line);border-top:0;
  border-radius:0 0 10px 10px;
  font-family:var(--font-mono);font-size:11.5px;line-height:1.6;color:var(--ink-2);
  white-space:pre;
}
.dbg-prompt{
  white-space:pre-wrap;font-size:13px;line-height:1.6;color:var(--ink-2);
  padding:10px 12px;background:var(--surface-2);border:1px solid var(--line);border-radius:10px;
}

@media(max-width:760px){
  .dbg{padding:0}
  .dbg-win{width:100%;max-height:100vh;border-radius:0;border:0}
  .dbg-head{flex-wrap:wrap}
  .dbg-head .row{margin-left:0;flex-basis:100%}
}

/* ─── компактное окно подтверждения ─────────────────────────
   Для действий, которые стоят денег: цена и остаток видны до
   нажатия, а не в протоколе после. */
.mdl{position:fixed;inset:0;z-index:240;display:grid;place-items:center;padding:20px}
.mdl[hidden]{display:none}
.mdl-back{
  position:absolute;inset:0;
  background:rgba(9,12,10,.58);backdrop-filter:blur(3px) saturate(115%);
  animation:pkFade .2s ease both;
}
.mdl-win{
  position:relative;display:flex;flex-direction:column;
  width:min(100%,440px);max-height:min(88vh,720px);
  background:var(--surface);border:1px solid var(--line);border-radius:18px;overflow:hidden;
  box-shadow:0 30px 80px -20px rgba(0,0,0,.45);
  animation:pkLift .28s cubic-bezier(.2,.8,.3,1) both;
}
.mdl-head{display:flex;align-items:center;gap:12px;padding:16px 18px 12px;flex:none}
.mdl-title{font-family:var(--font-display);font-weight:500;font-size:18px;letter-spacing:-.035em}
.mdl-x{
  margin-left:auto;width:28px;height:28px;border-radius:8px;display:grid;place-items:center;
  color:var(--ink-4);background:none;border:0;cursor:pointer;transition:background .15s,color .15s;
}
.mdl-x:hover{background:var(--surface-2);color:var(--ink)}
.mdl-x svg{width:14px;height:14px}

.mdl-body{padding:0 18px;overflow-y:auto;min-height:0;flex:1}
.mdl-lead{font-size:13px;line-height:1.6;color:var(--ink-3);margin:0 0 14px}

/* Промпт бывает и на страницу: держим пять строк, остальное по кнопке. */
.mdl-prompt{
  font-size:13px;line-height:1.6;color:var(--ink-2);white-space:pre-wrap;word-break:break-word;
  padding:10px 12px;background:var(--surface-2);border:1px solid var(--line);border-radius:10px;
}
.mdl-prompt.clamp{display:-webkit-box;-webkit-line-clamp:5;-webkit-box-orient:vertical;overflow:hidden}
.mdl-more{
  margin-top:6px;padding:0;background:none;border:0;cursor:pointer;
  font-size:12px;color:var(--accent);
}
.mdl-more:hover{text-decoration:underline}

.mdl-rows{margin-top:14px}
.mdl-row{
  display:flex;align-items:center;gap:12px;padding:7px 0;
  border-bottom:1px solid var(--line-soft);font-size:13px;
}
.mdl-row span{color:var(--ink-4)}
.mdl-row b{margin-left:auto;text-align:right;font-weight:500}

.mdl-total{margin-top:14px;padding:12px 14px;border-radius:12px;background:var(--surface-2);border:1px solid var(--line)}
.mdl-total .sum{display:flex;align-items:baseline;gap:10px}
.mdl-total .sum span{font-size:13px;color:var(--ink-3)}
.mdl-total .sum b{margin-left:auto;font-family:var(--font-display);font-size:20px;letter-spacing:-.03em}
.mdl-total .after{margin-top:6px;font-family:var(--font-mono);font-size:11px;color:var(--ink-4)}
.mdl-warn{margin-top:12px}

.mdl-foot{display:flex;gap:10px;padding:14px 18px 16px;flex:none}
.mdl-foot .btn{flex:1;justify-content:center}

/* Копирование промпта прямо с превью: слева, чтобы не спорить со сроком
   хранения в правом углу. */
.media-copy{
  position:absolute;top:7px;left:7px;width:26px;height:26px;border-radius:7px;
  display:grid;place-items:center;border:0;cursor:pointer;
  background:rgba(0,0,0,.62);color:#fff;backdrop-filter:blur(4px);
  opacity:0;transition:opacity .16s,background .16s;
}
.media-copy svg{width:13px;height:13px;fill:none;stroke:currentColor;stroke-width:1.9}
.media-copy:hover{background:rgba(0,0,0,.8)}
.media:hover .media-copy,.media-copy:focus-visible{opacity:1}

/* На тач-экранах наведения нет — иконка видна всегда. */
@media(hover:none){
  .media-copy{opacity:1}
}
@media(max-width:560px){
  .mdl{padding:0;place-items:end center}
  .mdl-win{width:100%;max-height:92vh;border-radius:18px 18px 0 0}
}

/* ═══════════════════════════════════════════════════════════════
   МОБИЛЬНАЯ НАВИГАЦИЯ КАБИНЕТА
   Рельс на 12 значков в строку 56px не помещался: элементы наезжали
   друг на друга, а горизонтальная прокрутка прятала половину. Модули
   переехали в нижний бар — туда дотягивается большой палец, — всё
   остальное в шторку «Ещё».
   ═══════════════════════════════════════════════════════════════ */
.mtop,.tabbar,.sheet{display:none}

@media(max-width:640px){
  /* Десктопная навигация уходит целиком, вместе со своими проблемами. */
  .has-mnav > .rail{display:none}
  .has-mnav .topbar{display:none}
  .has-mnav .side{display:none}

  .has-mnav{grid-template-columns:minmax(0,1fr);height:auto;min-height:100dvh}
  .has-mnav .main{overflow:visible}
  /* Прокрутка уезжает на документ: иначе липкая шапка не липнет. */
  .has-mnav .work{
    overflow:visible;
    padding:14px 13px calc(78px + env(safe-area-inset-bottom));
  }

  /* ─── верхняя полоса ─────────────────────────────────────── */
  .mtop{
    position:sticky;top:0;z-index:40;
    display:flex;align-items:center;gap:12px;height:54px;padding:0 13px;
    background:color-mix(in srgb,var(--surface) 88%,transparent);
    backdrop-filter:blur(12px) saturate(140%);
    border-bottom:1px solid var(--line);
  }
  .mtop-mark{width:30px;height:30px;flex:none;display:grid;place-items:center}
  .mtop-mark .mark-svg{width:100%;height:100%}
  .mtop-title{
    flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
    font-family:var(--font-display);font-weight:500;font-size:16px;letter-spacing:-.035em;
  }
  .mtop-balance{
    flex:none;display:flex;align-items:center;gap:7px;height:32px;padding:0 6px 0 11px;
    border:1px solid var(--line);border-radius:10px;background:var(--surface-2);
    font-family:var(--font-mono);font-size:12px;font-weight:500;color:var(--ink);
    text-decoration:none;
  }
  .mtop-balance span{
    width:20px;height:20px;border-radius:6px;display:grid;place-items:center;
    background:var(--accent);color:#fff;font-family:var(--font-ui);font-weight:700;line-height:1;
  }
  .mtop-balance:active{transform:scale(.97)}

  /* ─── нижний бар ─────────────────────────────────────────── */
  .tabbar{
    position:fixed;left:0;right:0;bottom:0;z-index:50;
    display:flex;align-items:stretch;
    padding:6px 4px calc(6px + env(safe-area-inset-bottom));
    background:color-mix(in srgb,var(--surface) 90%,transparent);
    backdrop-filter:blur(14px) saturate(140%);
    border-top:1px solid var(--line);
  }
  .tab{
    position:relative;flex:1;min-width:0;
    display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;
    padding:5px 2px 4px;border:0;background:none;cursor:pointer;
    color:var(--ink-4);text-decoration:none;
    font-family:var(--font-ui);font-size:10px;font-weight:500;letter-spacing:-.01em;
    -webkit-tap-highlight-color:transparent;
  }
  .tab i{
    display:grid;place-items:center;width:38px;height:26px;border-radius:9px;
    transition:background .2s cubic-bezier(.2,.8,.3,1),transform .2s cubic-bezier(.2,.8,.3,1);
  }
  .tab svg{width:19px;height:19px;stroke-width:1.7;fill:none;stroke:currentColor;display:block}
  .tab span{
    max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
    transition:color .2s;
  }
  .tab.on{color:var(--mod,var(--accent))}
  .tab.on i{background:color-mix(in srgb,var(--mod,var(--accent)) 14%,transparent);transform:translateY(-1px)}
  .tab:active i{transform:scale(.9)}
  .tab.off{opacity:.34}
  span.tab.off{cursor:default}

  /* Непрочитанное в поддержке видно, не открывая шторку. */
  .tab-dot{
    position:absolute;top:3px;right:6px;width:7px;height:7px;border-radius:50%;
    background:var(--crit);border:1.5px solid var(--surface);
  }

  /* ─── шторка «Ещё» ───────────────────────────────────────── */
  .sheet{position:fixed;inset:0;z-index:120;display:block}
  .sheet[hidden]{display:none}
  .sheet-back{
    position:absolute;inset:0;background:rgba(9,12,10,.5);
    backdrop-filter:blur(2px);animation:pkFade .2s ease both;
  }
  .sheet-win{
    position:absolute;left:0;right:0;bottom:0;
    padding:8px 14px calc(16px + env(safe-area-inset-bottom));
    background:var(--surface);border-top:1px solid var(--line);
    border-radius:20px 20px 0 0;box-shadow:0 -20px 60px -18px rgba(0,0,0,.4);
    animation:sheetUp .3s cubic-bezier(.2,.85,.3,1) both;
    max-height:86vh;overflow-y:auto;
  }
  @keyframes sheetUp{from{transform:translateY(100%)}to{transform:none}}

  .sheet-grip{
    display:block;width:38px;height:4px;margin:2px auto 12px;
    border:0;border-radius:3px;background:var(--line);padding:0;cursor:pointer;
  }
  .sheet-me{
    display:flex;align-items:center;gap:12px;padding:10px 12px;margin-bottom:12px;
    border:1px solid var(--line);border-radius:14px;background:var(--surface-2);
    text-decoration:none;color:var(--ink);
  }
  .sheet-me-txt{display:flex;flex-direction:column;min-width:0}
  .sheet-me-txt b{font-size:14px;font-weight:600}
  .sheet-me-txt i{
    font-style:normal;font-family:var(--font-mono);font-size:11px;color:var(--ink-4);
    overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
  }

  .sheet-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px}
  .sheet-item{
    position:relative;display:flex;align-items:center;gap:10px;
    padding:13px 12px;border:1px solid var(--line);border-radius:13px;
    background:var(--surface-2);color:var(--ink-2);text-decoration:none;
    font-size:13.5px;font-weight:500;
    transition:border-color .16s,color .16s,transform .16s;
  }
  .sheet-item svg{width:18px;height:18px;stroke-width:1.7;fill:none;stroke:currentColor;flex:none}
  .sheet-item:active{transform:scale(.98)}
  .sheet-item.on{border-color:var(--accent);color:var(--accent);background:var(--accent-soft)}
  .sheet-badge{
    margin-left:auto;min-width:19px;height:19px;padding:0 5px;border-radius:6px;
    display:grid;place-items:center;background:var(--crit);color:#fff;
    font-family:var(--font-mono);font-size:10.5px;font-weight:700;
  }

  .sheet-row{
    display:flex;align-items:center;gap:12px;margin-top:14px;padding:10px 12px;
    border:1px solid var(--line);border-radius:13px;background:var(--surface-2);
  }
  .sheet-row .theme-sw{margin-left:auto}
  /* В шапке подписи прячутся из-за тесноты, в шторке место есть. */
  .sheet-row .theme-sw button span{display:inline}
  .sheet-row .theme-sw button{padding:0 12px}
  .sheet-out{margin-top:10px}

  /* ─── порядок студии ─────────────────────────────────────
     На узком экране колонки складываются в одну, и панель с кнопкой
     «Создать» оказывалась в самом низу — под всеми результатами.
     display:contents поднимает содержимое левой колонки на уровень
     сетки, и панель встаёт сразу после поля запроса. */
  .has-mnav .split{display:flex;flex-direction:column;gap:14px}
  .has-mnav .split > .stack{display:contents}
  .has-mnav .split > .stack > *{order:3}
  .has-mnav .split > .stack > *:first-child{order:1}
  .has-mnav .split > .panel{order:2}

  /* ─── мелочи, которые ломали узкий экран ─────────────────── */
  .has-mnav .page-head{flex-direction:column;align-items:stretch;gap:12px}
  .has-mnav .page-head .actions{flex-wrap:wrap}
  .has-mnav .h1{font-size:24px}
  .has-mnav .card-head{flex-wrap:wrap;gap:8px}
  .has-mnav .routes{padding:9px 13px}

  /* Плавающие окна не должны нырять под нижний бар. */
  .mdl,.dbg{z-index:240}
  .toast-wrap{bottom:calc(84px + env(safe-area-inset-bottom))}

  /* Нижний бар перекрывал последнюю строку окна. */
  .mdl-foot{padding-bottom:calc(16px + env(safe-area-inset-bottom))}
}

/* ═══════════════════════════════════════════════════════════════
   ЧАТБОКС ОБРАЩЕНИЯ
   Лента и поле ввода в одной рамке: раньше это были две карточки,
   и поле ответа приходилось искать под всей историей переписки.
   ═══════════════════════════════════════════════════════════════ */
.chatbox{
  display:flex;flex-direction:column;max-width:860px;
  background:var(--surface);border:1px solid var(--line);
  border-radius:var(--r-l);box-shadow:var(--shadow-1);overflow:hidden;
}
.chatbox-log{
  display:flex;flex-direction:column;gap:12px;
  padding:18px;overflow-y:auto;
  /* Верхняя граница, а не высота: короткая переписка не растягивает
     блок, длинная прокручивается внутри и не уносит поле ввода вниз. */
  max-height:min(58vh,560px);
  background:var(--ground);
}
.chatbox-log .tmsg{max-width:86%}
.chatbox-note{
  display:flex;align-items:center;gap:9px;padding:10px 16px;
  border-top:1px solid var(--line);background:var(--surface-2);
  font-size:12.5px;color:var(--ink-3);
}
.chatbox-note svg{width:15px;height:15px;flex:none;fill:none;stroke:currentColor;color:var(--ok)}

/* ─── поле ввода ─────────────────────────────────────────────── */
.composer{padding:12px 14px 11px;border-top:1px solid var(--line);background:var(--surface)}
.cmp-row{display:flex;align-items:flex-end;gap:9px}

.cmp-clip{
  position:relative;flex:none;width:38px;height:38px;border-radius:11px;display:grid;place-items:center;
  border:1px solid var(--line);background:var(--surface-2);color:var(--ink-3);cursor:pointer;
  transition:border-color .16s,color .16s,background .16s;
}
.cmp-clip:hover{border-color:var(--accent);color:var(--accent)}
.cmp-clip svg{width:17px;height:17px;fill:none;stroke:currentColor}
.cmp-clip input{position:absolute;width:1px;height:1px;opacity:0;pointer-events:none}
.cmp-clip.set{border-color:var(--accent);color:var(--accent);background:var(--accent-soft)}

.cmp-input{
  flex:1;min-width:0;resize:none;overflow-y:auto;
  min-height:38px;max-height:190px;padding:9px 13px;
  border:1px solid var(--line);border-radius:12px;background:var(--surface-2);
  color:var(--ink);font-family:var(--font-ui);font-size:14px;line-height:1.5;
  transition:border-color .16s,background .16s,box-shadow .16s;
}
.cmp-input:focus{
  outline:0;background:var(--surface);border-color:var(--accent);
  box-shadow:0 0 0 3px var(--accent-soft);
}
.cmp-input::placeholder{color:var(--ink-4)}

.cmp-send{
  flex:none;width:38px;height:38px;border-radius:11px;display:grid;place-items:center;
  border:0;background:var(--accent);color:#fff;cursor:pointer;
  transition:transform .16s,opacity .16s;
}
.cmp-send svg{width:18px;height:18px;fill:none;stroke:currentColor}
.cmp-send:hover{transform:translateY(-1px)}
.cmp-send:disabled{opacity:.45;cursor:default;transform:none}

.cmp-foot{
  display:flex;align-items:center;gap:10px;flex-wrap:wrap;
  margin-top:9px;padding-left:47px;
}
.cmp-hint{font-size:11.5px;color:var(--ink-4);line-height:1.45}
.cmp-foot .check{margin-left:auto}
.cmp-foot .btn{margin-left:auto}
.cmp-foot .btn + .check{margin-left:0}
.cmp-err{margin-top:8px;padding-left:47px;font-size:12.5px;color:var(--crit)}

/* Выбранные файлы — до отправки, иначе непонятно, прикрепилось ли что-то. */
.cmp-files{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:10px;padding-left:47px}
.cmp-files[hidden]{display:none}
.cmp-file{
  position:relative;width:64px;height:64px;border-radius:10px;overflow:hidden;
  border:1px solid var(--line);background:var(--surface-2);
}
.cmp-file img{width:100%;height:100%;object-fit:cover;display:block}
.cmp-file b{
  position:absolute;left:0;right:0;bottom:0;padding:2px 4px;
  background:rgba(0,0,0,.6);color:#fff;
  font-family:var(--font-mono);font-size:8.5px;font-weight:500;text-align:center;
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}

@media(max-width:640px){
  .chatbox-log{padding:14px 12px;max-height:none}
  .chatbox-log .tmsg{max-width:94%}
  .composer{padding:10px 11px}
  .cmp-foot,.cmp-files,.cmp-err{padding-left:0}
  .cmp-foot .btn,.cmp-foot .check{margin-left:0}
}

/* Подпись только для скринридера: у кнопки-скрепки виден лишь значок. */
.sr-only{
  position:absolute;width:1px;height:1px;padding:0;margin:-1px;
  overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;
}
