@font-face { font-family: "Onest"; font-weight: 400; font-display: swap; src: url(onest-cyrillic-400-normal.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Onest"; font-weight: 400; font-display: swap; src: url(onest-cyrillic-ext-400-normal.woff2) format("woff2"); unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
@font-face { font-family: "Onest"; font-weight: 400; font-display: swap; src: url(onest-latin-400-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Onest"; font-weight: 600; font-display: swap; src: url(onest-cyrillic-600-normal.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Onest"; font-weight: 600; font-display: swap; src: url(onest-cyrillic-ext-600-normal.woff2) format("woff2"); unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
@font-face { font-family: "Onest"; font-weight: 600; font-display: swap; src: url(onest-latin-600-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --violet: #6d4aff; --violet-600: #5a36f0; --violet-50: #f2efff; --violet-100: #e6e0ff;
  --ink: #1b1a2e; --muted: #64637a; --line: #e7e5f0; --surface: #f7f6fb; --bg: #fff;
  --green: #15803d; --green-50: #e9f8ee; --orange: #c2410c; --orange-50: #fff1e8;
  --red: #b91c1c; --red-50: #fdecec; --blue: #2563eb; --blue-50: #eaf1ff;
  --r-chip: 4px; --r-ctl: 8px; --r-panel: 12px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font-family: "Onest", system-ui, sans-serif; font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--violet); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 26px; line-height: 1.25; font-weight: 600; }
h2 { font-size: 20px; line-height: 1.3; font-weight: 600; }
h3 { font-size: 17px; line-height: 1.35; font-weight: 600; }
.icon { flex-shrink: 0; vertical-align: middle; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
.row { display: flex; align-items: center; gap: var(--s3); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: var(--s4); }
.stack-lg { display: flex; flex-direction: column; gap: var(--s6); }
.stack-sm { display: flex; flex-direction: column; gap: var(--s2); }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: var(--s4); }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: var(--s4); }
.break { overflow-wrap: anywhere; }

/* Каркас */
.shell { display: flex; min-height: 100vh; }
.side { width: 260px; flex-shrink: 0; border-right: 1px solid var(--line); padding: var(--s5) var(--s3); display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: var(--s2); font-weight: 600; font-size: 18px; color: var(--violet); padding: 0 var(--s3) var(--s5); }
.side a { display: flex; align-items: center; gap: var(--s3); padding: 9px var(--s3); border-radius: var(--r-ctl); color: var(--ink); font-weight: 500; }
.side a:hover { background: var(--surface); text-decoration: none; }
.side a.active { background: var(--violet-50); color: var(--violet); }
.side a .icon { color: var(--violet); }
.side .count { margin-left: auto; background: var(--orange); color: #fff; border-radius: 10px; padding: 0 8px; font-size: 15px; line-height: 22px; }
.side .group { font-size: 15px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); padding: var(--s4) var(--s3) var(--s1); font-weight: 600; }
.side-foot { margin-top: auto; padding: var(--s3); border-top: 1px solid var(--line); }
.main { flex: 1; min-width: 0; padding: var(--s5) var(--s8) var(--s8); }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: var(--s4); margin-bottom: var(--s4); }
.topbar .lang-switch a { flex: none; padding: 6px 14px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s4); margin-bottom: var(--s6); flex-wrap: wrap; }
.crumbs { display: flex; gap: var(--s2); align-items: center; color: var(--muted); margin-bottom: var(--s2); flex-wrap: wrap; }
@media (max-width: 900px) {
  .shell { flex-direction: column; }
  .side { width: auto; height: auto; position: static; flex-direction: row; overflow-x: auto; padding: var(--s2); border-right: 0; border-bottom: 1px solid var(--line); }
  .side .group, .side-foot, .brand { display: none; }
  .side a { white-space: nowrap; }
  .main { padding: var(--s4); }
}

/* Кнопки */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); min-height: 40px; padding: 0 var(--s4); border-radius: var(--r-ctl); border: 1px solid transparent; font-weight: 600; cursor: pointer; white-space: nowrap; background: none; text-decoration: none !important; }
.btn-primary { background: var(--violet); color: #fff; }
.btn-primary:hover { background: var(--violet-600); }
.btn-secondary { background: var(--bg); color: var(--violet); border-color: var(--violet-100); }
.btn-secondary:hover { border-color: var(--violet); }
.btn-ghost { color: var(--violet); }
.btn-ghost:hover { background: var(--violet-50); }
.btn-danger { color: var(--red); }
.btn-danger:hover { background: var(--red-50); }
.btn-sm { min-height: 34px; padding: 0 var(--s3); }
.btn-icon { width: 36px; min-height: 36px; padding: 0; }
.btn-group { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: var(--s2); }
.btn:disabled { opacity: .5; cursor: default; }

/* Формы */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-weight: 500; }
.field .help { color: var(--muted); }
.input, .select, .textarea { width: 100%; min-height: 40px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--r-ctl); background: var(--bg); font-size: 15px; }
.textarea { min-height: 120px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: 2px solid var(--violet); outline-offset: -1px; }
.check { display: inline-flex; align-items: center; gap: var(--s2); cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--violet); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--s4); }

/* Панели */
.panel { border: 1px solid var(--line); border-radius: var(--r-panel); background: var(--bg); }
.panel-body { padding: var(--s5); }
.panel-head { padding: var(--s4) var(--s5); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; }
.panel-foot { padding: var(--s3) var(--s5); border-top: 1px solid var(--line); }
.stat { padding: var(--s5); }
.stat .val { font-size: 30px; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat .lbl { color: var(--muted); margin-top: 4px; }
.stat .icon { color: var(--violet); }

/* Таблицы */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; }
.t th { text-align: left; font-weight: 600; color: var(--muted); padding: 10px var(--s4); border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface); }
.t td { padding: 12px var(--s4); border-bottom: 1px solid var(--line); vertical-align: top; }
.t tr:last-child td { border-bottom: 0; }
.t .r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.t tbody tr:hover { background: #fcfbff; }

/* Чипы */
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: var(--r-chip); background: var(--surface); color: var(--muted); font-weight: 500; white-space: nowrap; }
.chip-violet { background: var(--violet-50); color: var(--violet); }
.chip-green { background: var(--green-50); color: var(--green); }
.chip-orange { background: var(--orange-50); color: var(--orange); }
.chip-red { background: var(--red-50); color: var(--red); }
.chip-blue { background: var(--blue-50); color: var(--blue); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }

.bar { height: 8px; background: var(--surface); border-radius: 4px; overflow: hidden; min-width: 80px; }
.bar > span { display: block; height: 100%; background: var(--violet); }

.msg { padding: var(--s3) var(--s4); border-radius: var(--r-ctl); background: var(--violet-50); margin-bottom: var(--s4); }
.msg.error { background: var(--red-50); color: var(--red); }
.empty { padding: var(--s8); text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: var(--s3); }

.list-row { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s5); border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.ibox { width: 36px; height: 36px; border-radius: var(--r-ctl); background: var(--violet-50); color: var(--violet); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ibox.err { background: var(--red-50); color: var(--red); }

/* Вопросы */
.q-card { border: 1px solid var(--line); border-radius: var(--r-panel); padding: var(--s4) var(--s5); }
.q-card.draft { border-color: var(--violet-100); background: #fcfbff; }
.q-choices { list-style: none; padding: 0; margin: var(--s2) 0 0; display: flex; flex-direction: column; gap: 4px; }
.q-choices li { display: flex; gap: var(--s2); align-items: flex-start; }
.q-choices li.ok { color: var(--green); font-weight: 500; }
.quote { font-family: Georgia, "Times New Roman", serif; background: #fffbea; border-left: 3px solid #f2c94c; padding: var(--s2) var(--s3); border-radius: 0 var(--r-ctl) var(--r-ctl) 0; }
.review-box { border-radius: var(--r-ctl); padding: var(--s3); background: var(--violet-50); }
.review-box.fix { background: var(--orange-50); }
.review-box.reject { background: var(--red-50); }
.choice-row { display: grid; grid-template-columns: auto 1fr auto; gap: var(--s2); align-items: center; }

/* Агенты */
.agent { display: inline-block; position: relative; flex-shrink: 0; }
.agent svg { display: block; overflow: visible; }
.agent .body { transform-origin: 50% 60%; transform-box: fill-box; }
.agent .eye { transform-origin: center; transform-box: fill-box; }
.agent .pupil { transition: transform .4s; transform-box: fill-box; }
.agent.s-waiting .body { animation: tq-breathe 3.2s ease-in-out infinite; }
.agent.s-waiting .eye { transform: scaleY(.35); }
.agent.s-listening .body { animation: tq-pulse 1.4s ease-in-out infinite; }
.agent.s-thinking .pupil { transform: translate(1.5px, -2px); }
.agent.s-thinking .think { animation: tq-dots 1.2s infinite; }
.agent.s-working .body { animation: tq-bounce .7s ease-in-out infinite; }
.agent.s-done .eye { transform: scaleY(.6); }
.agent.s-error .body { animation: tq-shake .5s ease-in-out 2; }
@keyframes tq-breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04); } }
@keyframes tq-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
@keyframes tq-bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8%); } }
@keyframes tq-shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6%); } 75% { transform: translateX(6%); } }
@keyframes tq-dots { 0% { opacity: .2; } 50% { opacity: 1; } 100% { opacity: .2; } }
@media (prefers-reduced-motion: reduce) { .agent * { animation: none !important; } }
.agent-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--s3); }
.agent-card { border: 1px solid var(--line); border-radius: var(--r-panel); padding: var(--s4); display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; }
.agent-card .name { font-weight: 600; }
.agent-card .what { color: var(--muted); min-height: 2.6em; overflow-wrap: anywhere; }

.radar text { font-size: 15px; fill: var(--muted); }
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: var(--s4); background: var(--surface); }
.login-card { width: 100%; max-width: 420px; }

/* Переключатель языка */
.lang-switch{display:flex;gap:4px;padding:4px;background:var(--surface);border-radius:var(--r-ctl,8px);flex-wrap:wrap}
.lang-switch a{flex:1;justify-content:center;text-align:center;color:var(--muted);font-size:15px;font-weight:600;padding:6px 8px;border-radius:6px;text-decoration:none;white-space:nowrap}
.lang-switch a.active{background:var(--bg,#fff);color:var(--violet);box-shadow:0 1px 3px rgba(27,26,46,.12)}

/* ---------- Чат с агентами ---------- */
.btn-block { width: 100%; justify-content: center; }
.small { font-size: 15px; }
.ac { display: grid; grid-template-columns: 250px minmax(0, 1fr) 290px; gap: var(--s5); height: calc(100vh - 96px); min-height: 520px; }
.ac-chats, .ac-team { display: flex; flex-direction: column; gap: var(--s3); min-height: 0; overflow-y: auto; }
.ac-chat-list { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.ac-chat-list a { display: flex; gap: var(--s2); align-items: flex-start; padding: 8px 10px; border-radius: var(--r-ctl); color: var(--ink); }
.ac-chat-list a:hover { background: var(--surface); }
.ac-chat-list a.active { background: var(--violet-50); color: var(--violet); }
.ac-usage { border-top: 1px solid var(--line); padding-top: var(--s3); }
.ac-main { display: flex; flex-direction: column; min-height: 0; border: 1px solid var(--line); border-radius: var(--r-panel); background: var(--surface); }
.ac-thread { flex: 1; overflow-y: auto; padding: var(--s6); display: flex; flex-direction: column; gap: var(--s5); }
.ac-hero[hidden] { display: none; }
.ac-hero { margin: auto; max-width: 760px; text-align: center; display: flex; flex-direction: column; gap: var(--s4); align-items: center; }
.ac-hero-team { display: flex; gap: var(--s3); flex-wrap: wrap; justify-content: center; }
.ac-suggest { display: flex; flex-wrap: wrap; gap: var(--s2); justify-content: center; }
.ac-chip { border: 1px solid var(--violet-100); background: var(--bg); color: var(--violet); border-radius: 999px; padding: 8px 14px; font: inherit; font-size: 15px; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.ac-chip:hover { background: var(--violet-50); }
.ac-msg { display: flex; flex-direction: column; gap: var(--s3); max-width: 100%; }
.ac-user { align-items: flex-end; }
.ac-bubble { background: var(--violet); color: #fff; padding: 10px 16px; border-radius: 16px 16px 4px 16px; max-width: min(720px, 85%); line-height: 1.5; }
.ac-bot { align-items: stretch; }
.ac-text { line-height: 1.6; max-width: 900px; }
.ac-text:empty { display: none; }
.ac-steps { display: flex; flex-direction: column; gap: var(--s2); }
.ac-steps:empty { display: none; }
.ac-step-line { display: flex; align-items: center; gap: var(--s3); background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-ctl); padding: 6px 12px; max-width: 900px; }
.ac-step[data-state="working"] .ac-step-line, .ac-step[data-state="thinking"] .ac-step-line { border-color: var(--violet-100); box-shadow: 0 0 0 3px var(--violet-50); }
.ac-step[data-state="error"] .ac-step-line { border-color: var(--red-50); background: var(--red-50); }
.ac-step-state { color: var(--muted); font-size: 15px; white-space: nowrap; }
.ac-step[data-state="working"] .ac-step-state::after, .ac-step[data-state="thinking"] .ac-step-state::after { content: "…"; animation: tq-dots 1.2s infinite; }
.ac-card:empty { display: none; }
.ac-card { margin-top: var(--s2); }
.ac-typing { display: inline-flex; gap: 6px; align-items: center; }
.ac-typing > span:not(.agent) { width: 7px; height: 7px; border-radius: 50%; background: var(--violet); animation: tq-dots 1.2s infinite; }
.ac-typing > span:nth-child(3) { animation-delay: .2s; } .ac-typing > span:nth-child(4) { animation-delay: .4s; }
.ac-composer { display: flex; gap: var(--s3); padding: var(--s3); border-top: 1px solid var(--line); background: var(--bg); border-radius: 0 0 var(--r-panel) var(--r-panel); align-items: flex-end; }
.ac-composer textarea { flex: 1; resize: none; border: 1px solid var(--line); border-radius: var(--r-ctl); padding: 10px 14px; font: inherit; min-height: 46px; max-height: 200px; }
.ac-composer textarea:focus { outline: 2px solid var(--violet-100); border-color: var(--violet); }
.ac.is-busy .ac-composer textarea { background: var(--surface); }
.ac-team h3 { margin: 0; }
.ac-member { display: flex; gap: var(--s3); padding: var(--s3); border: 1px solid var(--line); border-radius: var(--r-panel); transition: box-shadow .2s, border-color .2s; }
.ac-member.is-busy { border-color: var(--violet); box-shadow: 0 0 0 3px var(--violet-50); }
.ac-state { display: inline-block; margin-top: 4px; color: var(--violet); }
.ac-toast { position: fixed; right: 24px; bottom: 24px; z-index: 50; box-shadow: 0 6px 24px rgba(27, 26, 46, .18); }

/* Карточки, которые агенты кладут в разговор */
.gcard { background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-panel); overflow: hidden; max-width: 1100px; }
.gcard.is-dismissed { opacity: .5; pointer-events: none; }
.gcard-head { display: flex; align-items: center; gap: var(--s2); padding: 10px var(--s4); border-bottom: 1px solid var(--line); font-weight: 600; flex-wrap: wrap; }
.gcard-body { padding: var(--s3) var(--s4); }
.gcard-body.table-wrap { padding: 0; }
.gc-row { display: flex; align-items: center; gap: var(--s3); padding: 8px 0; border-bottom: 1px solid var(--line); color: var(--ink); flex-wrap: wrap; }
.gc-row:last-child { border-bottom: 0; }
.gc-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: var(--s5); }
.gc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--s3); }
.gc-topic, .gc-insight { border: 1px solid var(--line); border-radius: var(--r-ctl); padding: var(--s3); }
.gc-topic summary { cursor: pointer; }
.gc-insight p { margin: 6px 0 0; }
.gc-action { color: var(--violet); display: flex; gap: 6px; }
.gc-q { border: 1px solid var(--line); border-radius: var(--r-ctl); padding: var(--s3); display: flex; flex-direction: column; gap: var(--s2); }
.gc-q.is-approved { border-color: var(--green); background: var(--green-50); }
.gc-q.is-rejected { opacity: .55; }
.gc-q-text { margin: 0; font-weight: 600; }
.gc-choices { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 4px; }
.gc-choices.plain { list-style: none; padding-left: 0; }
.gc-choices li.ok { color: var(--green); font-weight: 600; }
.gc-big { font-size: 26px; font-weight: 700; }
.mini-bar { display: inline-block; width: 60px; height: 6px; background: var(--surface); border-radius: 3px; overflow: hidden; vertical-align: middle; margin-right: 6px; }
.mini-bar span { display: block; height: 100%; background: var(--violet); }
.cover-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--violet); flex-shrink: 0; }
@media (max-width: 1200px) { .ac { grid-template-columns: 220px minmax(0, 1fr); } .ac-team { display: none; } }
@media (max-width: 900px) { .ac { grid-template-columns: 1fr; height: calc(100vh - 150px); } .ac-chats { display: none; } .hide-sm { display: none; } }
.ask-agents { display: inline-flex; align-items: center; gap: 4px; padding: 6px 14px 6px 8px; border-radius: 999px; background: var(--violet-50); color: var(--violet); font-weight: 600; border: 1px solid var(--violet-100); }
.ask-agents:hover { background: var(--violet-100); text-decoration: none; }
.ask-agents .agent + .agent { margin-left: -10px; }
