/* Цвета: синий госвеб-сайта техникума + персиковый фон + оранжевый логотипа САМТ */
:root {
  color-scheme: light;
  --blue: #0d4cd3;
  --blue-hover: #0b3fae;
  --blue-soft: #e8effd;
  --orange: #be622e;
  --peach: #fbd9c8;
  --peach-2: #fde8dc;
  --ink: #0b1f33;
  --ink-2: #3b4a5a;
  --muted: #66727f;
  --line: #e3e7ee;
  --panel: #ffffff;
  --bg: #fffaf7;
  --radius: 22px;
  --shadow: 0 10px 40px -12px rgba(11, 31, 51, .18), 0 2px 6px rgba(11, 31, 51, .06);
  --font-head: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font: 15px/1.55 var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(60vw 50vh at 52% 38%, rgba(251, 217, 200, .75), transparent 70%),
    radial-gradient(45vw 45vh at 72% 70%, rgba(214, 228, 253, .7), transparent 70%),
    radial-gradient(40vw 40vh at 30% 80%, rgba(253, 232, 220, .8), transparent 70%),
    var(--bg);
  background-attachment: fixed;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

.layout { display: flex; height: 100%; }

/* ---------- Боковая панель ---------- */
.sidebar {
  width: 264px;
  flex: none;
  display: flex;
  flex-direction: column;
  padding: 22px 16px 18px;
  gap: 22px;
  background: rgba(255, 255, 255, .55);
  backdrop-filter: blur(14px);
  border-right: 1px solid rgba(227, 231, 238, .8);
}
.brand { display: flex; flex-direction: column; gap: 2px; padding: 0 10px; text-decoration: none !important; }
.brand-logo { width: 116px; height: auto; display: block; }
.brand-sub {
  font: 700 11px/1 var(--font-head);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink);
  padding-left: 2px;
}
.nav { display: flex; flex-direction: column; gap: 4px; min-height: 0; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px; border-radius: 12px;
  font: 600 15px/1.2 var(--font-head);
  text-align: left; color: var(--ink);
}
button.nav-item:hover { background: rgba(13, 76, 211, .07); }
.nav-item--static { color: var(--muted); font-weight: 500; cursor: default; margin-top: 6px; }
.nav-ico { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; }
.nav-ico svg { width: 20px; height: 20px; }
.nav-ico--fill { background: var(--ink); color: #fff; }
.nav-ico--fill svg { width: 16px; height: 16px; stroke-width: 2.6; }

.chat-list { list-style: none; margin: 0; padding: 0 0 0 4px; overflow-y: auto; min-height: 0; }
.chat-list li { position: relative; }
.chat-list .chat-link {
  display: block; width: 100%;
  padding: 7px 34px 7px 34px;
  border-radius: 10px;
  font-size: 14px; color: var(--ink-2);
  text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-list .chat-link:hover { background: rgba(13, 76, 211, .06); }
.chat-list li.active .chat-link { background: var(--blue-soft); color: var(--blue); font-weight: 500; }
.chat-del {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 26px; height: 26px; border-radius: 8px; color: var(--muted);
  display: grid; place-items: center; opacity: 0;
}
.chat-list li:hover .chat-del, .chat-del:focus-visible { opacity: 1; }
.chat-del:hover { background: rgba(190, 98, 46, .12); color: var(--orange); }
.chat-del svg { width: 15px; height: 15px; }
.chat-empty { padding: 4px 10px 4px 38px; font-size: 13px; color: var(--muted); }

.contacts {
  font-size: 12.5px; line-height: 1.45; color: var(--ink-2);
  padding: 14px 12px; border-radius: 14px;
  background: linear-gradient(135deg, rgba(251, 217, 200, .55), rgba(253, 232, 220, .35));
}
.contacts p { margin: 0 0 3px; overflow-wrap: anywhere; }
.contacts-title { font: 700 12px/1.3 var(--font-head); color: var(--orange); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px !important; }
.contacts .muted { color: var(--muted); }

.scrim { display: none; }

/* ---------- Основная часть ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; height: 100%; }
.topbar { display: none; }
.scroll { flex: 1; overflow-y: auto; padding: 0 16px; }

.hero {
  min-height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 40px 0 60px;
  text-align: center;
}
.hero h1 {
  margin: 0 0 10px;
  font: 700 clamp(26px, 3.4vw, 36px)/1.15 var(--font-head);
  color: #6d8ba0;
  letter-spacing: -.01em;
}
.hero-sub { margin: 0 0 26px; max-width: 560px; color: var(--muted); font-size: 14.5px; }
.hero .composer-slot { width: 100%; max-width: 760px; }
.suggest { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 22px; max-width: 760px; }
.pill {
  padding: 10px 16px; border-radius: 999px;
  background: rgba(255, 255, 255, .9);
  box-shadow: 0 1px 2px rgba(11, 31, 51, .06), 0 0 0 1px rgba(227, 231, 238, .7);
  font-size: 13.5px; font-weight: 500; color: var(--ink);
}
.pill:hover { box-shadow: 0 0 0 1px var(--blue); color: var(--blue); }

/* Композер */
.composer {
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 14px 10px 20px;
  text-align: left;
  border: 1px solid rgba(227, 231, 238, .7);
}
.composer:focus-within { border-color: rgba(13, 76, 211, .35); }
.composer textarea {
  width: 100%; border: 0; outline: 0; resize: none;
  font: 16px/1.5 var(--font-body); color: var(--ink);
  background: transparent; padding: 6px 0 10px;
  max-height: 200px;
}
.composer textarea::placeholder { color: #9aa5b1; }
.composer-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.segmented {
  display: flex; gap: 2px; padding: 3px;
  background: #f1f3f7; border-radius: 999px;
  overflow-x: auto; scrollbar-width: none;
}
.segmented::-webkit-scrollbar { display: none; }
.segmented button {
  padding: 6px 12px; border-radius: 999px;
  font-size: 13px; font-weight: 500; color: var(--ink-2); white-space: nowrap;
}
.segmented button:hover { color: var(--ink); }
.segmented button[aria-checked="true"] { background: #fff; color: var(--blue); box-shadow: 0 1px 3px rgba(11, 31, 51, .12); }
.send {
  flex: none; width: 42px; height: 42px; border-radius: 50%;
  background: var(--blue); color: #fff;
  display: grid; place-items: center;
  transition: background .15s, transform .15s;
}
.send:hover { background: var(--blue-hover); }
.send:active { transform: scale(.95); }
.send:disabled { background: #b8c4d6; cursor: default; }
.send .ico-stop { display: none; fill: currentColor; stroke: none; }
.send.is-busy .ico-send { display: none; }
.send.is-busy .ico-stop { display: block; }
.send.is-busy { background: var(--ink); }

.dock { padding: 0 16px 10px; }
.dock .composer-slot { max-width: 800px; margin: 0 auto; }
.note { text-align: center; font-size: 12px; color: var(--muted); margin: 8px 0 0; }
body.is-empty .dock .note { visibility: hidden; }

/* ---------- Диалог ---------- */
.thread { max-width: 800px; margin: 0 auto; padding: 28px 0 24px; display: flex; flex-direction: column; gap: 22px; }
body.is-empty .thread { display: none; }
body:not(.is-empty) .hero { display: none; }

.msg-user {
  align-self: flex-end; max-width: 85%;
  background: var(--blue-soft); color: var(--ink);
  padding: 11px 16px; border-radius: 20px 20px 6px 20px;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.msg-bot { display: flex; gap: 12px; align-items: flex-start; }
.avatar {
  flex: none; width: 34px; height: 34px; border-radius: 50%;
  background: #fff; box-shadow: 0 0 0 1px var(--line);
  display: grid; place-items: center;
}
.avatar img { width: 24px; height: 24px; }
.bot-body { flex: 1; min-width: 0; padding-top: 5px; }
.answer { overflow-wrap: anywhere; }
.answer p { margin: 0 0 10px; }
.answer p:last-child, .answer ul:last-child, .answer ol:last-child { margin-bottom: 0; }
.answer ul, .answer ol { margin: 0 0 10px; padding-left: 22px; }
.answer li { margin-bottom: 4px; }
.answer h3 { font: 700 16px/1.3 var(--font-head); margin: 14px 0 6px; }
.answer strong { font-weight: 600; }
.answer .ref { color: var(--orange); font-size: 13px; }
.cite {
  display: inline-grid; place-items: center;
  min-width: 17px; height: 17px; padding: 0 4px; margin: 0 1px;
  border-radius: 6px; background: rgba(190, 98, 46, .12); color: var(--orange);
  font: 600 10.5px/1 var(--font-body); vertical-align: 3px;
}
.answer.error { color: #b42318; }
.typing::after { content: ""; display: inline-block; width: 8px; height: 16px; margin-left: 2px; vertical-align: -2px; background: var(--blue); animation: blink 1s steps(1) infinite; border-radius: 2px; }
.thinking { display: inline-flex; gap: 4px; padding: 8px 0; }
.thinking i { width: 7px; height: 7px; border-radius: 50%; background: var(--orange); opacity: .35; animation: pulse 1.2s infinite; }
.thinking i:nth-child(2) { animation-delay: .2s; }
.thinking i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 50% { opacity: 0; } }
@keyframes pulse { 0%, 100% { opacity: .25; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-3px); } }

.sources { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.sources-title { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.sources-list { display: flex; flex-wrap: wrap; gap: 8px; }
.source {
  display: inline-flex; align-items: flex-start; gap: 10px; max-width: 100%;
  padding: 9px 14px 9px 11px; border-radius: 14px;
  background: rgba(255, 255, 255, .85);
  box-shadow: 0 0 0 1px var(--line);
  font-size: 13px; color: var(--ink-2);
}
.source svg { width: 18px; height: 18px; color: var(--orange); flex: none; margin-top: 1px; }
.source span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.source b { font-weight: 600; color: var(--ink); }
.source small { font-size: 12.5px; color: var(--muted); line-height: 1.4; display: flex; gap: 6px; align-items: baseline; }
.source small .cite { vertical-align: 0; flex: none; }

.actions { display: flex; gap: 4px; margin-top: 8px; }
.act {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 9px; border-radius: 8px;
  font-size: 12.5px; color: var(--muted);
}
.act:hover { background: rgba(11, 31, 51, .05); color: var(--ink); }
.act svg { width: 15px; height: 15px; }

/* ---------- Телефон ---------- */
@media (max-width: 860px) {
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 30;
    background: #fffaf7; transform: translateX(-102%);
    transition: transform .22s ease; box-shadow: var(--shadow);
  }
  body.menu-open .sidebar { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 20; background: rgba(11, 31, 51, .3); }
  .scrim[hidden] { display: none; }
  .topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 12px; flex: none;
  }
  .topbar-logo { height: 26px; }
  .icon-btn { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--ink); }
  .icon-btn:hover { background: rgba(11, 31, 51, .06); }
  .hero { justify-content: flex-start; padding-top: 6vh; }
  .composer { padding: 12px 10px 8px 14px; border-radius: 18px; }
  .send { width: 38px; height: 38px; }
  .msg-user { max-width: 92%; }
  .avatar { width: 30px; height: 30px; }
  .avatar img { width: 20px; height: 20px; }
}
