/* Цвета, скругления и шрифты взяты с objctv.ru */
@font-face { font-family: Manrope; src: url(fonts/manrope-cyrillic-wght-normal.woff2) format('woff2'); font-weight: 200 800; font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: Manrope; src: url(fonts/manrope-latin-wght-normal.woff2) format('woff2'); font-weight: 200 800; font-display: swap;
  unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122; }
@font-face { font-family: Unbounded; src: url(fonts/unbounded-cyrillic-wght-normal.woff2) format('woff2'); font-weight: 200 900; font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: Unbounded; src: url(fonts/unbounded-latin-wght-normal.woff2) format('woff2'); font-weight: 200 900; font-display: swap;
  unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122; }

:root {
  --blue: #1d17d2; --blue-dark: #1612a8; --violet: #5a40ed; --periwinkle: #6c6ee0; --lilac: #e9e7fc; --lilac-soft: #f7f6ff;
  --ink: #1c1b33; --muted: #6d6f80; --line: #dcdcf5; --bg: #f7f7fa; --pink: #dc3b75; --white: #fff;
  --head: HeadingNow, Unbounded, Manrope, sans-serif; --text: Manrope, Inter, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --r-s: 12px; --r-m: 24px; --r-l: 30px; --r-pill: 51px;
  --shadow: 0 8px 24px rgba(84, 87, 223, .10);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { min-height: 100vh; background: var(--bg); color: var(--ink); font: 400 15px/1.55 var(--text); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; }
a { color: var(--blue); }
h1 { margin: 0; font: 300 clamp(24px, 3.6vw, 38px)/1.2 var(--head); color: var(--blue); letter-spacing: -.01em; }

.top { position: sticky; top: 0; z-index: 5; background: var(--white); box-shadow: var(--shadow); }
.top-in { max-width: 1120px; margin: auto; padding: 16px 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: block; line-height: 0; }
.tabs { display: flex; gap: 4px; }
.tabs a { padding: 8px 18px; border-radius: var(--r-pill); color: var(--blue); text-decoration: none; font: 300 14px/1.3 var(--head); white-space: nowrap; }
.tabs a:hover { background: var(--lilac-soft); }
.tabs a.on { background: var(--blue); color: var(--white); }

/* Вопросы */
.ask { max-width: 820px; margin: auto; padding: 40px 24px 0; min-height: calc(100vh - 62px); display: flex; flex-direction: column; }
.hello p { margin: 16px 0 28px; max-width: 560px; color: var(--ink); font-weight: 300; font-size: 16px; }
.suggest { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.suggest button { padding: 18px 22px; min-height: 84px; text-align: left; font: 400 14px/1.4 var(--text); color: var(--ink); cursor: pointer;
  background: var(--lilac); border: 1.5px solid transparent; border-radius: var(--r-m); transition: border-color .15s, background .15s; }
.suggest button:nth-child(even) { background: var(--white); border-color: var(--blue); }
.suggest button:hover { border-color: var(--blue); background: var(--lilac-soft); }

.log { flex: 1; display: flex; flex-direction: column; gap: 16px; padding-bottom: 20px; }
.msg { max-width: 100%; }
.msg.user { align-self: flex-end; max-width: 80%; padding: 12px 20px; background: var(--blue); color: var(--white); border-radius: var(--r-m) var(--r-m) 6px var(--r-m); white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.bot { align-self: stretch; padding: 20px 24px; background: var(--white); border-radius: 6px var(--r-m) var(--r-m) var(--r-m); box-shadow: var(--shadow); }
.msg.bot .text > :first-child { margin-top: 0; }
.msg.bot .text > :last-child { margin-bottom: 0; }
.dots { display: inline-flex; gap: 5px; padding: 6px 0; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--periwinkle); animation: blink 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .2s; } .dots i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .dots i { animation: none; opacity: .6; } }

.cite { display: inline-flex; align-items: center; justify-content: center; min-width: 19px; height: 19px; padding: 0 5px; margin: 0 1px; vertical-align: 1px;
  border: 0; border-radius: 10px; background: var(--lilac); color: var(--blue); font: 600 11px/1 var(--text); cursor: pointer; }
.cite:hover { background: var(--blue); color: var(--white); }

.notice { margin-top: 14px; padding: 10px 14px; border-radius: var(--r-s); font-size: 13px; line-height: 1.4; border: 1px solid; }
.notice.draft { color: #a8255a; border-color: var(--pink); background: #fdf1f6; }
.notice.outside { color: var(--muted); border-color: var(--line); background: var(--bg); }
.notice.err { color: #a8255a; border-color: var(--pink); background: #fdf1f6; }
.sources { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--lilac); display: flex; flex-direction: column; gap: 6px; }
.sources > span { font-size: 12px; color: var(--muted); }
.src { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; width: 100%; padding: 8px 12px; text-align: left; cursor: pointer; font: 400 13px/1.35 var(--text); color: var(--ink);
  background: var(--lilac-soft); border: 1px solid transparent; border-radius: var(--r-s); }
.src:hover { border-color: var(--blue); }
.src b { font-weight: 600; color: var(--blue); }
.pill { display: inline-block; padding: 1px 9px; border-radius: var(--r-pill); font: 500 11px/1.6 var(--text); white-space: nowrap; border: 1px solid currentColor; }
.pill.проект, .pill.заметки { color: var(--pink); }
.pill.инструкция, .pill.ответ { color: var(--blue); }
.pill.наш { color: var(--muted); }
.pill.публичный { color: var(--violet); }

.composer { position: sticky; bottom: 16px; display: flex; align-items: flex-end; gap: 8px; padding: 8px 8px 8px 22px; background: var(--white);
  border: 1.5px solid var(--blue); border-radius: 30px; box-shadow: var(--shadow); }
.composer textarea { flex: 1; min-height: 40px; max-height: 180px; padding: 9px 0; border: 0; outline: 0; resize: none; background: transparent; color: var(--ink); font: 400 15px/22px var(--text); }
.composer textarea::placeholder { color: var(--muted); }
.round { flex: none; display: grid; place-items: center; width: 42px; height: 42px; border: 0; border-radius: 50%; background: var(--blue); color: var(--white); cursor: pointer; }
.round:hover { background: var(--blue-dark); }
.round.stop::before { content: ''; width: 13px; height: 13px; border-radius: 3px; background: var(--white); }
.round.stop svg { display: none; }
.round.ghost { background: var(--lilac); color: var(--blue); }
.round.ghost:hover { background: var(--line); }
.foot { min-height: 40px; padding: 26px 0 14px; text-align: center; }
.link { border: 0; background: none; padding: 0; color: var(--blue); font: 400 13px/1.3 var(--text); cursor: pointer; }
.link:hover { text-decoration: underline; }

/* Текст из базы и ответы */
.md h2, .md h3, .md h4 { margin: 1.5em 0 .5em; font: 300 17px/1.3 var(--head); color: var(--blue); }
.md h3, .md h4 { font-size: 15px; }
.md p { margin: .6em 0; }
.md ul, .md ol { margin: .5em 0; padding-left: 1.3em; }
.md li { margin: .25em 0; }
.md code { padding: 1px 5px; border-radius: 5px; background: var(--lilac-soft); font: 12.5px/1.4 ui-monospace, Menlo, Consolas, monospace; overflow-wrap: anywhere; }
.md .tbl { margin: .8em 0; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-s); }
.md table { width: 100%; border-collapse: collapse; font-size: 13px; line-height: 1.4; }
.md th { background: var(--lilac-soft); color: var(--blue); font-weight: 600; text-align: left; }
.md th, .md td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; min-width: 110px; }
.md tr:last-child td { border-bottom: 0; }

/* Страница базы */
.kb { max-width: 1120px; margin: auto; padding: 40px 24px 60px; }
.tiles { display: grid; grid-template-columns: 180px 180px minmax(0, 1fr); gap: 12px; margin: 24px 0; }
.tile { padding: 18px 22px; border-radius: var(--r-m); background: var(--lilac); }
.tile.line { background: var(--white); outline: 1.5px solid var(--blue); outline-offset: -1.5px; }
.tile b { display: block; font: 300 28px/1.2 var(--head); color: var(--blue); }
.tile span { font-size: 12px; line-height: 1.3; display: block; margin-top: 4px; }
.tile.legend { display: flex; flex-wrap: wrap; gap: 6px 10px; align-content: center; background: var(--white); font-size: 12px; color: var(--muted); }
.tile.legend div { display: flex; align-items: center; gap: 6px; }
.search input { width: 100%; height: 50px; padding: 0 24px; border: 1.5px solid var(--blue); border-radius: var(--r-pill); background: var(--white); color: var(--ink); font: 400 15px var(--text); }
.search input:focus { outline: 2px solid var(--violet); outline-offset: 1px; }
#kb-results { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.hit { display: block; width: 100%; padding: 14px 18px; text-align: left; border: 1px solid transparent; border-radius: var(--r-m); background: var(--white); cursor: pointer; font: 400 13px/1.45 var(--text); color: var(--ink); box-shadow: var(--shadow); }
.hit:hover { border-color: var(--blue); }
.hit b { display: block; margin-bottom: 2px; color: var(--blue); font-weight: 600; font-size: 14px; }
.hit small { display: block; margin-bottom: 6px; color: var(--muted); font-size: 12px; }
.group { margin-top: 32px; }
.group h2 { margin: 0 0 14px; font: 300 20px/1.2 var(--head); color: var(--blue); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.card { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; min-height: 104px; padding: 18px 22px; text-align: left; cursor: pointer; border: 1.5px solid transparent; border-radius: var(--r-m); background: var(--white); color: var(--ink); font: 500 14px/1.35 var(--text); box-shadow: var(--shadow); }
.card:hover { border-color: var(--blue); }
.card small { margin-top: auto; color: var(--muted); font-weight: 400; font-size: 12px; }

/* Документ сбоку */
.scrim { position: fixed; inset: 0; z-index: 9; background: rgba(28, 27, 51, .35); }
.panel { position: fixed; top: 0; right: 0; bottom: 0; z-index: 10; width: min(680px, 100%); overflow-y: auto; padding: 28px 32px 48px; background: var(--white); box-shadow: -8px 0 32px rgba(28, 27, 51, .15); border-radius: var(--r-l) 0 0 var(--r-l); }
#panel-close { position: sticky; top: 0; float: right; margin-left: 12px; }
.panel h1 { font-size: 22px; padding-right: 8px; }
.meta { margin: 12px 0 18px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 12px; color: var(--muted); }
.origin { margin: 0 0 18px; padding: 10px 14px; border-radius: var(--r-s); background: var(--bg); color: var(--muted); font-size: 12.5px; line-height: 1.4; }
.sec { scroll-margin-top: 16px; border-radius: var(--r-s); transition: background .6s; }
.sec.mark { background: var(--lilac); box-shadow: 0 0 0 8px var(--lilac); }

@media (max-width: 720px) {
  .top-in { padding: 12px 16px; }
  .brand img { width: 108px; height: auto; }
  .tabs a { padding: 7px 12px; font-size: 12px; }
  .ask { padding: 24px 16px 0; min-height: calc(100vh - 54px); }
  .suggest { grid-template-columns: 1fr; }
  .suggest button { min-height: 0; padding: 14px 18px; }
  .msg.user { max-width: 92%; }
  .msg.bot { padding: 16px 18px; }
  .kb { padding: 24px 16px 40px; }
  .tiles { grid-template-columns: 1fr 1fr; }
  .tile.legend { grid-column: 1 / -1; }
  .panel { padding: 20px 16px 40px; border-radius: 0; }
}
.hint { margin-top: 10px; color: var(--muted); font-size: 14px; }
.login-page { display: grid; place-items: center; padding: 16px; }
.login { width: min(100%, 400px); padding: 32px; background: var(--white); border-radius: var(--r-l); box-shadow: var(--shadow); }
.login h1 { margin: 24px 0 20px; }
.login label { display: block; margin-bottom: 8px; font-weight: 500; }
.login input { width: 100%; padding: 12px 18px; border: 1px solid var(--blue); border-radius: var(--r-pill); font: inherit; font-size: 16px; color: var(--ink); background: var(--white); }
.login button { width: 100%; margin-top: 16px; padding: 12px 18px; border: 0; border-radius: var(--r-pill); background: var(--blue); color: var(--white); font: 500 15px/1.4 var(--text); cursor: pointer; }
.login button:hover { background: var(--blue-dark); }
.login-error { margin: 10px 0 0; color: var(--pink); }
