/* Помощник X-BIO – окно как у обычного чата. Шрифт Onest (OFL 1.1, локально). Цвета – тема «ТюмГУ» сайтов X-BIO. */
@font-face{font-family:'Onest';font-style:normal;font-display:swap;font-weight:400;src:url(fonts/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-style:normal;font-display:swap;font-weight:400;src:url(fonts/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+0304,U+0308,U+0329,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-style:normal;font-display:swap;font-weight:500;src:url(fonts/onest-cyrillic-500-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-style:normal;font-display:swap;font-weight:500;src:url(fonts/onest-latin-500-normal.woff2) format('woff2');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,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-style:normal;font-display:swap;font-weight:600;src:url(fonts/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-style:normal;font-display:swap;font-weight:600;src:url(fonts/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+0304,U+0308,U+0329,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-style:normal;font-display:swap;font-weight:700;src:url(fonts/onest-cyrillic-700-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-style:normal;font-display:swap;font-weight:700;src:url(fonts/onest-latin-700-normal.woff2) format('woff2');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}

:root {
  --bg: #f3f8fc; --paper: #ffffff; --ink: #1b2733; --muted: #5f7082; --line: #d9e7f1; --soft: #e8f3fb;
  --blue: #0b6fb8; --blue-d: #08588f; --lime: #b6e27a; --ok: #1f8a55; --ok-bg: #e3f6ea;
  --amber: #b7791f; --warn-bg: #fff3dc; --warn-line: #f0d29a; --red: #c2412f;
  --r: 18px; --w: 880px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 18px/1.55 Onest, "Segoe UI", system-ui, sans-serif; }
button, input, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
a { color: var(--blue); }
kbd { font: 600 14px/1 Onest, sans-serif; background: var(--paper); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; padding: 3px 7px; }

/* кнопки */
.btn-main { background: var(--blue); color: #fff; border: 0; border-radius: 14px; padding: 14px 26px; font-weight: 600; font-size: 19px; cursor: pointer; }
.btn-main:hover { background: var(--blue-d); }
.btn-main:disabled { opacity: .55; cursor: default; }
.btn-ghost { background: transparent; border: 1px solid var(--line); border-radius: 12px; padding: 8px 14px; font-size: 16px; font-weight: 500; cursor: pointer; text-decoration: none; color: var(--ink); white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.btn-ghost:hover { background: var(--soft); border-color: #bcd5e8; }
.btn-small { background: var(--soft); border: 1px solid #c8def0; border-radius: 10px; padding: 7px 14px; font-size: 16px; font-weight: 600; cursor: pointer; color: var(--blue-d); }
.btn-small:hover { background: #d9ebf8; }
.btn-small.ok { background: var(--ok-bg); border-color: #b5e2c6; color: var(--ok); }
.btn-small.warn { background: var(--warn-bg); border-color: var(--warn-line); color: #8a5a12; }
:focus-visible { outline: 3px solid #7cc0f0; outline-offset: 2px; }

/* вход */
.login { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 620px; background: var(--paper); border: 1px solid var(--line); border-radius: 26px; padding: 34px 32px 26px; box-shadow: 0 18px 50px rgba(11,111,184,.08); }
.brand-row { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.logo-x { height: 44px; } .logo-t { height: 34px; } .sep { width: 1px; height: 34px; background: var(--line); }
.login h1 { font-size: 34px; line-height: 1.15; margin: 0 0 6px; font-weight: 700; }
.lead { margin: 0 0 18px; color: var(--muted); font-size: 19px; }
.roles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.role { text-align: left; background: var(--bg); border: 2px solid var(--line); border-radius: 14px; padding: 14px 16px; cursor: pointer; font-size: 18px; font-weight: 500; line-height: 1.3; }
.role:hover { border-color: #a9cbe6; }
.role[aria-checked="true"] { border-color: var(--blue); background: var(--soft); box-shadow: inset 0 0 0 1px var(--blue); }
.pw-label { display: block; font-weight: 600; margin: 4px 0 6px; font-size: 17px; }
#pw, #appr-title { width: 100%; padding: 14px 16px; border: 2px solid var(--line); border-radius: 14px; font-size: 19px; background: #fff; margin-bottom: 16px; }
#pw:focus, #appr-title:focus { border-color: var(--blue); outline: 0; }
#login-btn { width: 100%; }
.err { color: var(--red); min-height: 1.4em; margin: 12px 0 0; font-weight: 500; }
.foot { color: var(--muted); font-size: 14px; text-align: center; margin: 14px 0 0; line-height: 1.4; }

/* окно */
.app { height: 100%; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; background: var(--paper); border-bottom: 1px solid var(--line); }
.top-l { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ico { width: 40px; height: 40px; flex: none; }
.names { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.names b { font-size: 20px; }
.who { color: var(--muted); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-r { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.badge { background: var(--red); color: #fff; border-radius: 999px; font-size: 13px; font-weight: 700; padding: 1px 8px; }

.feed { flex: 1; overflow-y: auto; padding: 26px 16px 18px; scroll-behavior: smooth; }
.feed > * { max-width: var(--w); margin-left: auto; margin-right: auto; }
.hello { text-align: center; padding: 6vh 8px 10px; }
.hello h2 { font-size: 34px; margin: 0 0 10px; }
.hello p { color: var(--muted); max-width: 640px; margin: 0 auto 18px; font-size: 19px; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-bottom: 22px; }
.chip { background: var(--paper); border: 1px solid var(--line); border-radius: 999px; padding: 10px 18px; cursor: pointer; font-size: 17px; }
.chip:hover { border-color: var(--blue); color: var(--blue-d); }
.tip { font-size: 16px !important; }

.msg { margin: 0 auto 18px; display: flex; }
.msg.me { justify-content: flex-end; }
.bubble { background: var(--blue); color: #fff; border-radius: var(--r) var(--r) 6px var(--r); padding: 12px 18px; max-width: 78%; white-space: pre-wrap; word-wrap: break-word; }
.bubble img { display: block; max-width: 260px; max-height: 180px; border-radius: 10px; margin: 2px 0 8px auto; border: 2px solid rgba(255,255,255,.6); }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r) var(--r) var(--r) 6px; padding: 20px 22px 16px; width: 100%; box-shadow: 0 6px 24px rgba(27,39,51,.05); }
.blk { margin-bottom: 16px; }
.blk:last-child { margin-bottom: 0; }
.blk h4 { margin: 0 0 6px; font-size: 14px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.answer { font-size: 19px; white-space: pre-wrap; }
.answer sup a, .letter-n { text-decoration: none; font-weight: 700; font-size: 13px; background: var(--soft); border-radius: 6px; padding: 0 5px; margin-left: 2px; }
.srcs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.src { border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; background: #fbfdff; }
.src.hl { border-color: var(--blue); box-shadow: 0 0 0 2px #cfe6f8; }
.src-top { display: flex; gap: 10px; align-items: baseline; }
.src-n { flex: none; font-weight: 700; color: var(--blue-d); font-size: 15px; }
.src-ref { font-weight: 600; font-size: 17px; line-height: 1.35; }
.src-meta { color: var(--muted); font-size: 15px; margin: 4px 0 0 26px; display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; }
.src-quote { margin: 8px 0 0 26px; color: #34485a; font-size: 16px; border-left: 3px solid var(--line); padding-left: 12px; white-space: pre-wrap; }
.linkbtn { background: none; border: 0; color: var(--blue); cursor: pointer; padding: 0; font-size: 15px; text-decoration: underline; }
.letter { background: #fbfdff; border: 1px dashed #b9d3e7; border-radius: 12px; padding: 14px 16px; white-space: pre-wrap; font-size: 17px; }
.row-btns { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.card-foot { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 14px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.no-ans { background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: 14px; padding: 14px 18px; }
.no-ans b { display: block; font-size: 20px; color: #7a4d0b; margin-bottom: 4px; }
.found { background: var(--soft); border: 1px solid #c8def0; border-radius: 14px; padding: 12px 16px; }
.ocr { color: var(--muted); font-size: 15px; }
.ocr pre { white-space: pre-wrap; font: 400 14px/1.45 Onest, sans-serif; background: var(--bg); border-radius: 10px; padding: 10px 12px; max-height: 240px; overflow: auto; color: var(--ink); }
.thinking { color: var(--muted); display: flex; align-items: center; gap: 12px; }
.dots { display: inline-flex; gap: 5px; }
.dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--blue); opacity: .3; animation: d 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .2s; } .dots i:nth-child(3) { animation-delay: .4s; }
@keyframes d { 40% { opacity: 1; transform: translateY(-3px); } }
.fail { background: #fdecea; border: 1px solid #f3c2bb; border-radius: 14px; padding: 12px 16px; color: #7c2418; }

/* полоска согласования: Автор → Ответственный → Директор */
.steps { display: flex; align-items: stretch; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.step { flex: 1 1 160px; border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; background: var(--bg); font-size: 15px; line-height: 1.35; }
.step b { display: block; font-size: 15px; }
.step.done { background: var(--ok-bg); border-color: #b5e2c6; }
.step.wait { background: var(--soft); border-color: #bcd5e8; }
.step.back { background: var(--warn-bg); border-color: var(--warn-line); }
.step .st { color: var(--muted); }
.arrow { align-self: center; color: var(--muted); font-size: 18px; }

/* поле ввода */
.composer-wrap { padding: 10px 16px 12px; background: linear-gradient(to top, var(--bg) 70%, rgba(243,248,252,0)); position: relative; }
.composer-wrap > * { max-width: var(--w); margin-left: auto; margin-right: auto; }
.composer { display: flex; align-items: flex-end; gap: 10px; background: var(--paper); border: 2px solid var(--line); border-radius: 22px; padding: 10px 10px 10px 12px; box-shadow: 0 10px 30px rgba(11,111,184,.08); }
.composer:focus-within { border-color: var(--blue); }
#q { flex: 1; border: 0; outline: 0; resize: none; font-size: 19px; line-height: 1.45; padding: 9px 4px; max-height: 260px; min-height: 46px; background: transparent; }
.btn-icon { flex: none; width: 48px; height: 48px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg); font-size: 22px; cursor: pointer; }
.btn-icon:hover { background: var(--soft); }
.btn-send { flex: none; height: 48px; border-radius: 14px; border: 0; background: var(--blue); color: #fff; font-size: 18px; font-weight: 600; padding: 0 18px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.btn-send:hover { background: var(--blue-d); }
.btn-send:disabled { opacity: .5; cursor: default; }
.thumb { position: relative; display: inline-block; margin: 0 0 10px 2px; }
.composer-wrap > .thumb { display: block; width: max-content; margin-left: max(0px, calc((100% - var(--w)) / 2)); }
.thumb img { display: block; max-height: 120px; max-width: 220px; border-radius: 12px; border: 2px solid var(--line); background: #fff; }
.thumb-x { position: absolute; top: -10px; right: -10px; width: 30px; height: 30px; border-radius: 50%; border: 0; background: var(--ink); color: #fff; font-size: 18px; line-height: 1; cursor: pointer; }
.drop { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; background: rgba(11,111,184,.12); border: 4px dashed var(--blue); font-size: 28px; font-weight: 700; color: var(--blue-d); max-width: none !important; }
.demo { display: block; font-size: 14px; color: var(--muted); margin-top: 6px; }

/* панель согласований */
.panel { position: fixed; inset: 0; z-index: 20; background: rgba(27,39,51,.35); display: flex; justify-content: flex-end; }
.panel-in { width: min(640px, 100%); height: 100%; overflow-y: auto; background: var(--paper); padding: 20px 22px; }
.panel-h { display: flex; justify-content: space-between; align-items: center; }
.panel h2 { margin: 0; font-size: 26px; }
.panel h3 { font-size: 16px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 22px 0 10px; }
.appr-list { display: flex; flex-direction: column; gap: 12px; }
.appr { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.appr-t { font-weight: 600; }
.appr-m { color: var(--muted); font-size: 15px; }
.appr textarea { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: 16px; margin-top: 8px; }
.empty { color: var(--muted); font-size: 16px; }
.dlg { border: 0; border-radius: 20px; padding: 22px 24px; width: min(520px, calc(100% - 24px)); box-shadow: 0 30px 80px rgba(0,0,0,.25); }
.dlg::backdrop { background: rgba(27,39,51,.35); }
.dlg h2 { margin: 0 0 6px; }
.resp-list { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 14px; }
.resp-list label { border: 2px solid var(--line); border-radius: 12px; padding: 10px 14px; cursor: pointer; display: flex; gap: 10px; align-items: center; }
.resp-list label:has(input:checked) { border-color: var(--blue); background: var(--soft); }
.dlg-btns { display: flex; justify-content: flex-end; gap: 10px; }
.toast { position: fixed; left: 50%; bottom: 120px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 12px; z-index: 40; font-size: 16px; }

@media (max-width: 640px) {
  body { font-size: 17px; }
  .top { padding: 10px 12px; flex-wrap: wrap; }
  .top-r .btn-ghost { padding: 6px 10px; font-size: 14px; }
  .roles { grid-template-columns: 1fr; }
  .login-card { padding: 24px 18px; }
  .send-t { display: none; }
  .bubble { max-width: 92%; }
  .card { padding: 16px; }
  .src-meta, .src-quote { margin-left: 0; }
}
