@font-face { font-family: "Golos"; font-weight: 400; font-display: swap; src: url(fonts/golos-text-cyrillic-400-normal.woff2) format("woff2"); unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Golos"; font-weight: 400; font-display: swap; src: url(fonts/golos-text-latin-400-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+20BD; }
@font-face { font-family: "Golos"; font-weight: 500; font-display: swap; src: url(fonts/golos-text-cyrillic-500-normal.woff2) format("woff2"); unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Golos"; font-weight: 500; font-display: swap; src: url(fonts/golos-text-latin-500-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+20BD; }
@font-face { font-family: "Golos"; font-weight: 600; font-display: swap; src: url(fonts/golos-text-cyrillic-600-normal.woff2) format("woff2"); unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Golos"; font-weight: 600; font-display: swap; src: url(fonts/golos-text-latin-600-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+20BD; }
@font-face { font-family: "Unbounded"; font-weight: 700; font-display: swap; src: url(fonts/unbounded-cyrillic-700-normal.woff2) format("woff2"); unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Unbounded"; font-weight: 700; font-display: swap; src: url(fonts/unbounded-latin-700-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+20BD; }

:root {
  --paper: #f6f7f9; --white: #fff; --ink: #1c2230; --muted: #5d6578; --line: #dde1e8;
  --cobalt: #2440d8; --cobalt-soft: #e8ecfc; --green: #127a4a; --green-soft: #e3f4ea;
  --amber: #8a5a00; --amber-soft: #fbf0d9; --red: #b42318; --red-soft: #fdecea;
  --radius: 10px; --display: "Unbounded", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.5 "Golos", system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--cobalt); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-family: var(--display); font-size: 24px; letter-spacing: -0.01em; }
h2 { font-size: 18px; font-weight: 600; }
h3 { font-size: 15px; font-weight: 600; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }

.top { background: var(--white); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top .wrap { display: flex; align-items: center; gap: 20px; min-height: 58px; }
.mark { font-family: var(--display); font-size: 17px; color: var(--ink); text-decoration: none; }
.mark span { color: var(--cobalt); }
.mark small { font-family: "Golos", sans-serif; font-weight: 500; font-size: 13px; color: var(--muted); margin-left: 8px; }
.top nav { display: flex; gap: 16px; margin-left: auto; align-items: center; }
.top nav a { color: var(--ink); text-decoration: none; font-weight: 500; }

main { padding: 28px 0 60px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--white); color: var(--ink); font: inherit; font-weight: 500; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--ink); }
.btn--primary { background: var(--cobalt); border-color: var(--cobalt); color: #fff; }
.btn--primary:hover { background: #1b33b8; border-color: #1b33b8; }
.btn--danger { color: var(--red); border-color: #f2c4c0; }
.btn--small { min-height: 32px; padding: 0 12px; font-size: 13px; }
.btn--link { border: 0; background: none; padding: 0; min-height: 0; color: var(--cobalt); }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid var(--cobalt-soft); outline-offset: 1px; }
form.inline { display: inline; }

.card { background: var(--white); border: 1px solid var(--line); border-radius: 14px; padding: 20px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.stack { display: grid; gap: 16px; align-content: start; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spacer { flex: 1; }

label { display: grid; gap: 6px; font-weight: 500; font-size: 14px; }
label .hint { font-weight: 400; color: var(--muted); font-size: 13px; }
input[type=text], input[type=password], input[type=url], input[type=time], input[type=number], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--white); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; }
textarea { min-height: 110px; resize: vertical; line-height: 1.45; }
textarea.big { min-height: 320px; font-size: 14px; }
.checks { display: flex; gap: 6px; flex-wrap: wrap; }
.checks label { display: flex; align-items: center; gap: 4px; font-weight: 400; border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; background: var(--white); }

.badge { display: inline-flex; align-items: center; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--cobalt-soft); color: var(--cobalt); }
.badge--project { background: var(--green-soft); color: var(--green); }
.badge--archived { background: #eceef2; color: var(--muted); }
.badge--handoff { background: var(--amber-soft); color: var(--amber); }

.notice { padding: 12px 14px; border-radius: 10px; background: var(--cobalt-soft); color: #1b2f9e; font-size: 14px; }
.notice--warn { background: var(--amber-soft); color: var(--amber); }
.notice--ok { background: var(--green-soft); color: var(--green); }

/* Список агентов */
.agents { display: grid; gap: 10px; }
.agent-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 16px 18px;
  background: var(--white); border: 1px solid var(--line); border-radius: 14px; }
.agent-row h2 a { color: var(--ink); text-decoration: none; }
.agent-row h2 a:hover { color: var(--cobalt); }
.agent-row .meta { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 13px; margin-top: 4px; }
.empty { text-align: center; padding: 48px 20px; }

/* Вкладки */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 22px 0 20px; overflow-x: auto; }
.tabs a { padding: 10px 14px; color: var(--muted); text-decoration: none; font-weight: 500; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.on { color: var(--ink); border-color: var(--cobalt); }

table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
table.list th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.list td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }

/* Чат */
.chat { display: flex; flex-direction: column; background: var(--white); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.chat__log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; min-height: 360px; max-height: 60vh; background: #fafbfc; }
.msg { max-width: 82%; padding: 9px 13px; border-radius: 16px; white-space: pre-wrap; word-wrap: break-word; font-size: 15px; }
.msg--user { align-self: flex-end; background: var(--cobalt); color: #fff; border-bottom-right-radius: 6px; }
.msg--assistant { align-self: flex-start; background: var(--white); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.msg--event { align-self: center; max-width: 92%; font-size: 12px; color: var(--amber); background: var(--amber-soft); border-radius: 8px; padding: 5px 10px; }
.msg--typing { color: var(--muted); font-style: italic; }
.chat__form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); background: var(--white); }
.chat__form textarea { min-height: 44px; height: 44px; max-height: 140px; border-radius: 22px; padding: 11px 16px; resize: none; }
.chat__form .btn { min-height: 44px; }

.dialogs { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; }
.conv-list { display: grid; gap: 6px; align-content: start; max-height: 70vh; overflow-y: auto; }
.conv-list a { display: block; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--white); color: var(--ink); text-decoration: none; font-size: 14px; }
.conv-list a.on { border-color: var(--cobalt); box-shadow: inset 3px 0 0 var(--cobalt); }
.conv-list .first { color: var(--muted); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.slots { display: grid; gap: 8px; }
.slots .day { display: grid; grid-template-columns: 120px 1fr; gap: 8px; align-items: start; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { font-size: 12px; padding: 2px 8px; border-radius: 6px; background: var(--paper); border: 1px solid var(--line); }
.chip--busy { background: var(--cobalt); color: #fff; border-color: var(--cobalt); }

.show { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 24px; align-items: start; }
.qr { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
.qr img { width: 100%; display: block; }
.copy { display: flex; gap: 8px; }
.copy input { font-size: 14px; }

/* Шкала прогресса «Заполнить с сайта» */
.progress { display: grid; gap: 6px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--white); }
.progress__bar { height: 8px; border-radius: 999px; background: var(--cobalt-soft); overflow: hidden; }
.progress__bar span { display: block; height: 100%; width: 0; background: var(--cobalt); border-radius: inherit; transition: width .5s ease-out; }
.progress__row { display: flex; justify-content: space-between; gap: 12px; color: var(--ink); font-weight: 500; }
.progress__pct { font-variant-numeric: tabular-nums; color: var(--cobalt); }
.progress__sub { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Бриф внедрения */
.brief { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.brief #planCard { position: sticky; top: 74px; max-height: calc(100vh - 90px); overflow-y: auto; }
.q { display: grid; gap: 6px; padding-top: 12px; border-top: 1px solid var(--line); }
.q:first-of-type { border-top: 0; padding-top: 0; }
.q__title { font-weight: 600; }
.q__hint { color: var(--muted); font-size: 13px; }
.brief__actions { position: sticky; bottom: 0; background: var(--paper); padding: 12px 0; }
.plan { white-space: pre-wrap; font-size: 14px; line-height: 1.55; }
.plan--rules { background: var(--paper); border-radius: 8px; padding: 10px 12px; }
@media (max-width: 1000px) { .brief { grid-template-columns: 1fr; } .brief #planCard { position: static; max-height: none; } }
kbd { font: 12px/1 "Golos", sans-serif; padding: 2px 5px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; background: var(--white); }
.paste { border: 2px dashed var(--line); border-radius: 12px; padding: 14px 16px; display: grid; gap: 6px; background: #fbfcfd; }
.paste p { line-height: 1.7; }
.paste__pick { display: inline-flex; font-weight: 500; }
.paste.is-over { border-color: var(--cobalt); background: var(--cobalt-soft); }
.paste.is-busy { border-color: var(--cobalt); }
.paste.is-busy #pasteStatus { color: var(--cobalt); }
.paste.is-done { border-style: solid; border-color: #9fd8b8; }
textarea.flash { box-shadow: 0 0 0 3px #b9e7cc; transition: box-shadow .3s; }
details.versions summary { cursor: pointer; font-weight: 600; }

@media (max-width: 860px) {
  .grid2, .dialogs, .show { grid-template-columns: 1fr; }
  .agent-row { grid-template-columns: 1fr; }
}

/* Публичный чат клиента */
.client { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; max-width: 640px; margin: 0 auto; background: var(--white); }
.client__head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--white); z-index: 2; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--cobalt); color: #fff; display: grid; place-items: center; font-weight: 600; flex: none; }
.client__head p { font-size: 13px; color: var(--green); }
.client .chat { border: 0; border-radius: 0; flex: 1; }
.client .chat__log { max-height: none; min-height: 0; }
.client__foot { text-align: center; font-size: 12px; color: var(--muted); padding: 6px 0 10px; }
