* { box-sizing: border-box; }
:root {
  --accent: #4d6bfe;
  --accent-hover: #3f5bf0;
  --soft: #eef1ff;
  --bg: #ffffff;
  --side: #f7f8fa;
  --line: #e8eaee;
  --ink: #14161a;
  --mut: #878d97;
  --chip: #f1f3f6;
  --danger: #d64545;
  --font: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;
}
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { font: inherit; cursor: pointer; color: inherit; }
a { color: inherit; text-decoration: none; }
input, textarea { font: inherit; }
svg.i {
  width: 19px; height: 19px; stroke: currentColor; fill: none;
  stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
  display: block; flex: none;
}
.i-sm { width: 16px; height: 16px; }
.i-xs { width: 13px; height: 13px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.hidden { display: none !important; }

/* ================= КАРКАС ================= */
.app {
  position: relative; height: 100vh; overflow: hidden; background: var(--bg);
  display: grid; grid-template-columns: 280px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr);
  transition: grid-template-columns .26s cubic-bezier(.4, 0, .2, 1);
}
.app.side-closed { grid-template-columns: 62px minmax(0, 1fr); }
.side {
  position: relative; z-index: 20;
  width: auto; min-width: 0;
  background: var(--side);
  border-right: 1px solid var(--line);
  overflow: hidden;
}
.app.side-closed .side { overflow: visible; }
.side-in { position: relative; z-index: 1; width: 280px; height: 100%; display: flex; flex-direction: column; padding: 10px 10px 8px; }
.app.side-closed .side-in { display: none; }

/* Рейл: кнопки, которые остаются на виду */
.rail {
  display: none; width: 62px; height: 100%;
  flex-direction: column; align-items: center; gap: 5px;
  padding: 9px 0 10px;
  position: relative; z-index: 1;
}
.app.side-closed .rail { display: flex; }
.rail-btn {
  width: 40px; height: 40px; border: 0; border-radius: 12px;
  background: transparent; color: #5c626c;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  transition: background .16s, color .16s, transform .16s;
  position: relative;
}
.rail-btn:hover { background: #e9ebf0; color: var(--ink); }
.rail-btn:active { transform: scale(.93); }
.rail-btn.rail-new { background: var(--soft); color: var(--accent); }
.rail-btn.rail-new:hover { background: #e2e7ff; }
.rail-sp { flex: 1; }
.rail-ava {
  width: 34px; height: 34px; border: 0; border-radius: 50%;
  background: linear-gradient(145deg, #dfe4ff, #c7d0ff);
  color: #2c3f9e; display: grid; place-items: center;
  font-size: 11px; font-weight: 800;
  transition: transform .16s, box-shadow .16s;
  position: relative;
}
.rail-ava:hover { transform: scale(1.06); box-shadow: 0 6px 16px rgba(77, 107, 254, .22); }
.rail-logo {
  width: 30px; height: 30px; border-radius: 10px;
  background: var(--accent); color: #fff;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 800;
  box-shadow: 0 7px 16px rgba(77, 107, 254, .24);
}
.rail-btn::after, .rail-ava::after {
  content: attr(data-tip);
  position: absolute; left: calc(100% + 10px); top: 50%;
  transform: translateY(-50%) translateX(-4px);
  background: #14161a; color: #fff;
  font-size: 10px; font-weight: 600; line-height: 1;
  padding: 6px 9px; border-radius: 8px; white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: opacity .14s, transform .14s;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .18);
  z-index: 6;
}
.rail-btn:hover::after, .rail-ava:hover::after {
  opacity: 1; transform: translateY(-50%) translateX(0);
}

/* Верх панели */
.side-top { flex: none; display: flex; align-items: center; gap: 7px; padding: 2px 2px 10px; }
.brand {
  display: flex; align-items: center; gap: 8px; min-width: 0;
  flex: 1; border: 0; background: transparent; padding: 0; text-align: left;
}
.logo {
  width: 30px; height: 30px; border-radius: 10px;
  background: var(--accent); color: #fff;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 800;
  box-shadow: 0 7px 16px rgba(77, 107, 254, .24);
}
.brand .name { font-size: 12.5px; font-weight: 750; letter-spacing: -.03em; white-space: nowrap; }
.icon-btn {
  width: 32px; height: 32px; border: 0; border-radius: 9px;
  background: transparent; color: #737a86;
  display: grid; place-items: center;
  flex: none;
  transition: background .15s, color .15s, transform .15s;
}
.icon-btn:hover { background: #eceef3; color: var(--ink); }
.icon-btn:active { transform: scale(.92); }
.icon-btn:disabled { opacity: .4; cursor: default; }
.icon-btn:disabled:hover { background: transparent; color: #737a86; }

.new-chat {
  flex: none;
  display: flex; align-items: center; gap: 8px;
  width: 100%; height: 40px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 13px;
  background: #fff; color: var(--ink);
  font-size: 12px; font-weight: 650;
  box-shadow: 0 1px 2px rgba(20, 22, 26, .03);
  transition: border-color .15s, box-shadow .18s, transform .15s;
}
.new-chat:hover { border-color: #cfd5e2; transform: translateY(-1px); box-shadow: 0 7px 18px rgba(20, 22, 26, .07); }
.new-chat:active { transform: translateY(0) scale(.995); }
.new-chat .plus-circle { color: var(--accent); }

.nav-row {
  flex: none;
  display: flex; align-items: center; gap: 9px;
  width: 100%; height: 33px; padding: 0 10px; margin-top: 2px;
  border: 0; border-radius: 9px;
  background: transparent; color: #4d525b;
  font-size: 11.5px; font-weight: 600; text-align: left;
  transition: background .14s, color .14s;
}
.nav-row svg { color: #737a86; }
.nav-row:hover { background: #eceef3; color: var(--ink); }
.nav-row:hover svg { color: var(--ink); }

/* Скролл списка чатов: колесо работает всегда, полоса появляется при наведении */
.side-scroll {
  flex: 1; min-height: 0;
  margin-top: 10px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}
.side:hover .side-scroll { scrollbar-color: #d7dae2 transparent; }
.side-scroll::-webkit-scrollbar { width: 8px; }
.side-scroll::-webkit-scrollbar-track { background: transparent; }
.side-scroll::-webkit-scrollbar-thumb {
  background: transparent; border-radius: 99px;
  border: 2px solid transparent; background-clip: padding-box;
}
.side:hover .side-scroll::-webkit-scrollbar-thumb { background: #d7dae2; background-clip: padding-box; }
.side-scroll::-webkit-scrollbar-thumb:hover { background: #c3c8d3; background-clip: padding-box; }

.group-label {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 8px 5px;
  font-size: 8.5px; font-weight: 700; letter-spacing: .09em;
  text-transform: uppercase; color: #a0a6b0;
}
.group-label:first-child { padding-top: 4px; }
.side-empty { padding: 18px 10px; font-size: 10.5px; line-height: 1.5; color: #a0a6b0; text-align: center; }

.chat-row {
  position: relative;
  display: flex; align-items: center; gap: 4px;
  width: 100%; height: 33px; padding: 0 5px 0 9px;
  border: 0; border-radius: 9px; background: transparent;
  color: #4d525b; font-size: 11.5px; text-align: left;
  transition: background .14s, color .14s, padding-left .18s;
}
.chat-row::before {
  content: ""; position: absolute; left: 2px; top: 50%;
  width: 3px; height: 15px; margin-top: -7.5px; border-radius: 3px;
  background: var(--accent); opacity: 0; transform: scaleY(.4);
  transition: opacity .16s, transform .16s;
}
.chat-row.active::before { opacity: 1; transform: scaleY(1); }
.chat-row.active { padding-left: 12px; }
.chat-row .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-row:hover { background: #eceef3; color: var(--ink); }
.chat-row.active { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(20, 22, 26, .05); }
.chat-row .pin { color: #a0a6b0; flex: none; }
.chat-row .more {
  width: 24px; height: 24px; border: 0; border-radius: 6px; background: transparent;
  opacity: 0; color: #9aa0aa; display: grid; place-items: center;
  transition: opacity .12s, background .12s;
  flex: none;
}
.chat-row:hover .more, .chat-row.active .more { opacity: 1; }
.chat-row .more:hover { color: var(--ink); background: #e3e6ec; }

.side-foot { flex: none; padding-top: 8px; border-top: 1px solid var(--line); }
.side-links { display: flex; gap: 4px; padding: 0 2px 7px; }
.side-links a {
  display: inline-flex; align-items: center; gap: 5px;
  height: 26px; padding: 0 8px; border-radius: 8px;
  font-size: 10px; font-weight: 600; color: var(--mut);
}
.side-links a:hover { background: #eceef3; color: var(--ink); }
.side-logout {
  display: flex; align-items: center; gap: 6px;
  width: 100%; height: 28px; margin: 0 0 4px; padding: 0 8px;
  border: 0; border-radius: 8px; background: transparent;
  color: var(--mut); font-size: 10.5px; font-weight: 600; text-align: left;
  transition: background .15s, color .15s;
}
.side-logout:hover { background: #fdecec; color: var(--danger); }
.side-logout svg { flex: none; }
.account {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 4px 4px 4px 3px; border: 0; border-radius: 10px;
  background: transparent; text-align: left;
}
.account:hover { background: #eceef3; }
.ava {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(145deg, #dfe4ff, #c7d0ff);
  color: #2c3f9e; display: grid; place-items: center;
  font-size: 11px; font-weight: 800; flex: none;
}
.who { flex: 1; min-width: 0; }
.who b { display: block; font-size: 11px; font-weight: 650; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who small { display: block; margin-top: 1px; font-size: 9.5px; color: var(--mut); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account .icon-btn { width: 26px; height: 26px; }

/* ================= ОСНОВНАЯ ЧАСТЬ ================= */
.main {
  position: relative; min-width: 0; min-height: 0; overflow: hidden;
  display: flex; flex-direction: column;
}
.topbar {
  flex: none; height: 52px; display: none; align-items: center; gap: 10px;
  padding: 0 18px 0 16px;
}
.main.chatting .topbar { display: flex; }
.topbar .chat-title {
  flex: 1; min-width: 0; font-size: 12.5px; font-weight: 650;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar .icon-btn { display: none; }
.top-model-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 999px;
  background: #fff; color: #5c626c;
  font-size: 10.5px; font-weight: 600; white-space: nowrap;
  max-width: 240px;
}
.top-model-btn span:not(.dot) { overflow: hidden; text-overflow: ellipsis; }
.top-model-btn:hover { border-color: #cfd5e2; color: var(--ink); }
.top-model-btn .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); flex: none; }

.stage { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.thread-wrap {
  flex: 1; min-height: 0; overflow-y: auto;
  display: flex; flex-direction: column;
  scrollbar-width: thin; scrollbar-color: #d7dae2 transparent;
  overscroll-behavior: contain;
}
.thread-wrap::-webkit-scrollbar { width: 8px; }
.thread-wrap::-webkit-scrollbar-thumb { background: #d7dae2; border-radius: 99px; border: 2px solid transparent; background-clip: padding-box; }
.stage.is-empty .thread-wrap { flex: 0 0 auto; margin-top: auto; overflow: visible; }
.stage.is-empty .dock { margin-bottom: auto; }

/* Пустой экран */
.empty {
  position: relative; overflow: hidden;
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 26px 24px 8px;
  background: radial-gradient(circle at 50% 30%, rgba(77, 107, 254, .055), transparent 38%);
  animation: fadeUp .5s cubic-bezier(.2, .8, .2, 1) both;
}
.empty::before, .empty::after {
  content: ""; position: absolute; pointer-events: none; border-radius: 50%;
  width: 360px; height: 360px; opacity: .7;
  animation: floaty 10s ease-in-out infinite;
}
.empty::before {
  left: 50%; top: 6%; margin-left: -340px;
  background: radial-gradient(circle, rgba(77, 107, 254, .10), transparent 68%);
}
.empty::after {
  left: 50%; top: 22%; margin-left: 40px;
  background: radial-gradient(circle, rgba(139, 164, 255, .12), transparent 68%);
  animation-delay: -4.5s;
}
.empty > * { position: relative; z-index: 1; }
.stage.is-empty .empty { flex: none; padding: 10px 24px 0; background: none; }
.stage:not(.is-empty) .empty { display: none; }
.hello { text-align: center; }
.hello-mark {
  width: 46px; height: 46px; margin: 0 auto 14px;
  border-radius: 15px; background: var(--accent); color: #fff;
  display: grid; place-items: center;
  font-size: 20px; font-weight: 800;
  box-shadow: 0 12px 26px rgba(77, 107, 254, .24);
  animation: floaty 5.5s ease-in-out infinite, glow 3.6s ease-in-out infinite;
}
.hello h1 { margin: 0; font-size: clamp(28px, 3.1vw, 36px); letter-spacing: -.05em; font-weight: 750; }
.hello p { margin: 8px 0 0; font-size: 12.5px; color: var(--mut); }

/* Лента сообщений */
.thread {
  width: min(780px, 100%);
  margin: 0 auto;
  padding: 22px 24px 10px;
  display: flex; flex-direction: column; gap: 24px;
}
.msg { display: flex; gap: 10px; animation: fadeUp .22s cubic-bezier(.2, .8, .2, 1) both; }
.msg.user { justify-content: flex-end; }
.msg.user .bubble {
  max-width: 82%;
  background: #f4f5f8;
  border-radius: 18px 18px 6px 18px;
  padding: 10px 14px;
  font-size: 14px; line-height: 1.55;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.msg.user .bubble img {
  display: block; max-width: min(280px, 100%); max-height: 260px;
  border-radius: 12px; margin-bottom: 7px; object-fit: cover;
}
.msg.assistant { align-items: flex-start; }
.msg-ava {
  width: 28px; height: 28px; border-radius: 9px; flex: none;
  background: var(--accent); color: #fff;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 800;
  box-shadow: 0 5px 12px rgba(77, 107, 254, .22);
  margin-top: 1px;
}
.msg-body { flex: 1; min-width: 0; }
.msg-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 5px; }
.msg-head b { font-size: 11.5px; font-weight: 650; letter-spacing: -.01em; }
.msg-head span { font-size: 9.5px; color: #a0a6b0; }
.msg-head .badge { margin-left: auto; }

.msg-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 9px; }
.msg-meta span {
  display: inline-flex; align-items: center; gap: 4px;
  height: 20px; padding: 0 7px; border-radius: 999px;
  background: #f4f5f8; color: #878d97;
  font-size: 9px; font-weight: 600;
}
.msg-meta .good { background: var(--soft); color: var(--accent); }
.msg-actions {
  display: flex; align-items: center; gap: 2px; margin-top: 7px;
  opacity: 0; transition: opacity .14s;
}
.msg:hover .msg-actions, .msg:focus-within .msg-actions { opacity: 1; }
.msg-actions button {
  width: 28px; height: 28px; border: 0; border-radius: 7px;
  background: transparent; color: #9aa0aa; display: grid; place-items: center;
}
.msg-actions button:hover { background: #f1f3f6; color: var(--ink); }
.msg-actions button.on { background: var(--soft); color: var(--accent); }

/* Размышления */
.reason { margin-bottom: 9px; border-left: 2px solid #dfe3ea; }
.reason-head {
  display: flex; align-items: center; gap: 6px;
  padding: 2px 0 2px 9px; border: 0; background: transparent;
  color: #878d97; font-size: 10.5px; font-weight: 600;
}
.reason-head:hover { color: #5c626c; }
.reason-head svg { transition: transform .16s; }
.reason.open .reason-head svg { transform: rotate(90deg); }
.reason-body {
  display: none; padding: 4px 0 4px 11px;
  font-size: 12px; line-height: 1.55; color: #737a86;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.reason.open .reason-body { display: block; }
.reason-body .md { font-size: 12px; color: #737a86; }

/* Точки «печатает» */
.typing { display: inline-flex; gap: 4px; align-items: center; height: 18px; }
.typing i {
  width: 5px; height: 5px; border-radius: 50%; background: #b6bcc7;
  animation: blink 1.15s infinite ease-in-out;
}
.typing i:nth-child(2) { animation-delay: .16s; }
.typing i:nth-child(3) { animation-delay: .32s; }
.cursor {
  display: inline-block; width: 7px; height: 15px; margin-left: 2px;
  border-radius: 2px; background: var(--accent); vertical-align: -2px;
  animation: blink 1s steps(2, start) infinite;
}
.msg.error .md { color: var(--danger); }

/* Markdown */
.md { font-size: 14px; line-height: 1.62; overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 10px; }
.md h1, .md h2, .md h3, .md h4 {
  margin: 18px 0 8px; line-height: 1.3; letter-spacing: -.025em;
}
.md h1 { font-size: 21px; }
.md h2 { font-size: 18px; }
.md h3 { font-size: 15.5px; }
.md h4 { font-size: 14px; }
.md ul, .md ol { margin: 0 0 10px; padding-left: 22px; }
.md li { margin: 3px 0; }
.md li > p { margin: 0; }
.md code {
  background: #f1f3f6; padding: 1.5px 5px; border-radius: 5px;
  font-family: var(--mono); font-size: 12.5px;
}
.md pre {
  margin: 10px 0; background: #f7f8fa;
  border: 1px solid var(--line); border-radius: 12px;
  overflow: hidden;
}
.md pre .code-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 10px 6px 13px; border-bottom: 1px solid var(--line);
  font-size: 9.5px; font-weight: 600; color: #a0a6b0;
}
.md pre .code-head button {
  border: 0; background: transparent; color: #9aa0aa;
  font-size: 9.5px; font-weight: 600; padding: 3px 6px; border-radius: 5px;
}
.md pre .code-head button:hover { background: #eceef3; color: var(--ink); }
.md pre code {
  display: block; padding: 12px 14px; background: none;
  overflow-x: auto; font-size: 12.5px; line-height: 1.55;
  scrollbar-width: thin;
}
.md blockquote {
  margin: 10px 0; padding: 2px 0 2px 12px;
  border-left: 3px solid #dfe3ea; color: #5c626c;
}
.md a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.md table { border-collapse: collapse; margin: 10px 0; width: 100%; font-size: 12.5px; }
.md th, .md td { border: 1px solid var(--line); padding: 6px 9px; text-align: left; }
.md th { background: #f7f8fa; font-weight: 650; }
.md img { max-width: 100%; border-radius: 10px; }

/* ================= КОМПОЗЕР ================= */
.dock {
  flex: none; padding: 8px 24px 14px;
  background: linear-gradient(to top, #fff 72%, rgba(255, 255, 255, 0));
}
.composer-wrap {
  width: min(760px, 100%); margin: 0 auto;
  animation: fadeUp .55s cubic-bezier(.2, .8, .2, 1) .04s both;
}
.attach-strip { display: none; gap: 8px; padding: 0 2px 8px; }
.attach-strip.on { display: flex; }
.attach-thumb {
  position: relative; width: 58px; height: 58px; border-radius: 12px;
  border: 1px solid var(--line); overflow: hidden; background: var(--side);
}
.attach-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.attach-thumb button {
  position: absolute; top: 2px; right: 2px; width: 19px; height: 19px;
  border: 0; border-radius: 50%; background: rgba(20, 22, 26, .72); color: #fff;
  display: grid; place-items: center;
}
.composer {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: #fff;
  box-shadow: 0 14px 38px rgba(20, 22, 26, .075);
  transition: border-color .18s, box-shadow .18s;
}
.composer:focus-within {
  border-color: rgba(77, 107, 254, .5);
  box-shadow: 0 0 0 3px rgba(77, 107, 254, .09), 0 16px 40px rgba(20, 22, 26, .08);
}
.ta {
  display: block; width: 100%; min-height: 58px; max-height: 180px;
  padding: 17px 18px 4px; border: 0; outline: 0; resize: none;
  background: transparent; font-size: 14px; line-height: 1.55;
  color: var(--ink);
}
.ta::placeholder { color: #a3a9b3; }
.tools { display: flex; align-items: center; gap: 4px; padding: 5px 8px 8px 9px; flex-wrap: wrap; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 999px;
  background: #fff; color: #5c626c;
  font-size: 10.5px; font-weight: 600; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.pill:hover { border-color: #cfd5e2; color: var(--ink); }
.pill .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); flex: none; }
.pill.on { background: var(--soft); border-color: transparent; color: var(--accent); }
.pill .chev { color: #9aa0aa; font-size: 8px; margin-left: 1px; }
.pill:disabled { opacity: .45; cursor: default; }
.pill:disabled:hover { border-color: var(--line); color: #5c626c; }
.model-pill { max-width: 240px; }
.model-pill .m-name { overflow: hidden; text-overflow: ellipsis; }
.mode-wrap { position: relative; }
.mode-chip { padding: 0 9px; gap: 4px; }
.mode-chip .mv { font-weight: 650; color: #3f4550; }
.mode-chip.open { background: var(--soft); border-color: transparent; color: var(--accent); }
.mode-chip.open .mv { color: var(--accent); }
.mode-chip.disabled { opacity: .45; cursor: default; }
.mode-chip.disabled:hover { border-color: var(--line); color: #5c626c; }
.mode-menu {
  position: absolute; z-index: 46; bottom: calc(100% + 8px); left: 0;
  display: none; width: 240px; padding: 7px;
  background: #fff; border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 24px 60px rgba(20, 22, 26, .16);
}
.mode-menu.open { display: block; animation: popIn .16s cubic-bezier(.2, .8, .2, 1) both; }
.mm-head { padding: 6px 8px; font-size: 8.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: #a0a6b0; }
.mm-opt {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 8px; border: 0; border-radius: 9px; background: transparent; text-align: left;
  transition: background .13s;
}
.mm-opt:hover { background: #f6f7fa; }
.mm-opt > span { flex: 1; min-width: 0; }
.mm-opt b { display: block; font-size: 11.5px; font-weight: 600; }
.mm-opt small { display: block; margin-top: 1px; font-size: 9.5px; color: var(--mut); }
.mm-chk { color: var(--accent); opacity: 0; flex: none; }
.mm-opt.on .mm-chk { opacity: 1; }
.send {
  margin-left: auto;
  width: 34px; height: 34px; border: 0; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: grid; place-items: center;
  box-shadow: 0 6px 14px rgba(77, 107, 254, .28);
  transition: background .15s, transform .16s, box-shadow .16s;
}
.send:hover { background: var(--accent-hover); transform: scale(1.06); box-shadow: 0 9px 20px rgba(77, 107, 254, .34); }
.send:active { transform: scale(.96); }
.send:disabled { opacity: .45; cursor: default; box-shadow: none; transform: none; }
.send.stop { background: var(--ink); }
.send.stop:hover { background: #2a2d33; }
.dock-hint {
  margin-top: 8px; text-align: center;
  font-size: 9px; color: #a8aeb8;
}

/* ================= ВЫБОР МОДЕЛИ (M3) ================= */
.backdrop {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(16, 17, 20, .34);
  opacity: 0; pointer-events: none;
  transition: opacity .18s;
}
.backdrop.on { opacity: 1; pointer-events: auto; }
.modal {
  position: fixed; z-index: 60; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  display: none; flex-direction: column;
  width: min(760px, calc(100vw - 28px));
  height: min(78vh, 660px);
  background: #fff; border-radius: 24px;
  box-shadow: 0 40px 90px rgba(16, 17, 20, .3);
  overflow: hidden;
}
.modal.on { display: flex; animation: modalIn .22s cubic-bezier(.2, .9, .3, 1.1) both; }
.m-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px 10px; }
.m-head b { font-size: 15px; letter-spacing: -.02em; }
.m-head .icon-btn { margin-left: auto; }
.m-count { font-size: 9.5px; color: var(--mut); background: var(--chip); padding: 3px 7px; border-radius: 999px; }
.m-toolbar { display: flex; align-items: center; gap: 8px; padding: 0 18px 9px; }
.m-toolbar .p-search { flex: 1; min-width: 0; }
.p-search {
  display: flex; align-items: center; gap: 7px;
  height: 34px; padding: 0 10px; border-radius: 10px;
  background: var(--chip); color: var(--mut);
}
.p-search input { width: 100%; border: 0; outline: 0; background: transparent; font-size: 11.5px; color: var(--ink); }
.m-tabs { display: flex; gap: 2px; padding: 3px; border-radius: 999px; background: #f4f5f8; flex: none; }
.m-tabs button {
  height: 28px; padding: 0 10px; border: 0; border-radius: 999px;
  background: transparent; color: #737a86; font-size: 9.5px; font-weight: 600; white-space: nowrap;
}
.m-tabs button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(20, 22, 26, .08); }
.vchips { display: flex; gap: 5px; padding: 0 18px 10px; overflow-x: auto; scrollbar-width: none; }
.vchips::-webkit-scrollbar { display: none; }
.vchip {
  height: 26px; padding: 0 9px; border: 1px solid var(--line); border-radius: 999px;
  background: #fff; color: #6b7280; font-size: 9.5px; font-weight: 550;
  white-space: nowrap; flex: none;
  transition: background .13s, color .13s, border-color .13s;
}
.vchip:hover { border-color: #cfd5e2; color: var(--ink); }
.vchip.on { background: var(--soft); border-color: transparent; color: var(--accent); font-weight: 650; }
.m-body {
  flex: 1; min-height: 0; overflow-y: auto; padding: 12px 18px 18px;
  scrollbar-width: thin; scrollbar-color: #d7dae2 transparent;
}
.m-body::-webkit-scrollbar { width: 8px; }
.m-body::-webkit-scrollbar-thumb { background: #d7dae2; border-radius: 99px; border: 2px solid transparent; background-clip: padding-box; }
.m-group { margin: 2px 0 7px; font-size: 8.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: #a0a6b0; }
.m-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.mcard {
  padding: 11px 12px; border: 1px solid var(--line); border-radius: 14px;
  background: #fff; text-align: left;
  transition: border-color .15s, background .15s, transform .15s, box-shadow .15s;
}
.mcard:hover { border-color: #c9d1ea; background: #fbfcff; transform: translateY(-1px); box-shadow: 0 10px 22px rgba(20, 22, 26, .06); }
.mcard:active { transform: scale(.99); }
.mcard.sel { border-color: rgba(77, 107, 254, .5); background: var(--soft); }
.mcard b { display: block; font-size: 11.5px; letter-spacing: -.01em; }
.mcard small { display: block; margin-top: 2px; font-size: 9.5px; color: var(--mut); }
.mc-meta { display: flex; align-items: center; gap: 5px; margin-top: 7px; flex-wrap: wrap; }
.coef { font-size: 9px; font-weight: 700; color: var(--accent); background: var(--soft); padding: 3px 6px; border-radius: 999px; flex: none; }
.badge { display: inline-flex; align-items: center; padding: 3px 7px; border-radius: 999px; background: var(--soft); color: var(--accent); font-size: 8.5px; font-weight: 700; white-space: nowrap; }
.badge.paid { background: #fff2e8; color: #b4622a; }
.badge.muted { background: var(--chip); color: #878d97; }
.m-foot {
  flex: none; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 18px; border-top: 1px solid var(--line); font-size: 9px; color: #a0a6b0;
}
.m-empty { padding: 34px 10px; text-align: center; font-size: 11px; color: var(--mut); }

/* ================= ВХОД ================= */
.overlay {
  position: fixed; inset: 0; z-index: 80;
  display: none; align-items: center; justify-content: center;
  padding: 18px; background: rgba(16, 17, 20, .38);
}
.overlay.on { display: flex; }
body.auth-locked .app {
  filter: blur(7px) saturate(.92);
  pointer-events: none;
  user-select: none;
}
body.auth-locked #authOverlay {
  background: rgba(16, 17, 20, .46);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.sheet-card {
  width: min(420px, 100%); max-height: calc(100vh - 36px); overflow-y: auto;
  background: #fff; border-radius: 24px; padding: 24px;
  box-shadow: 0 40px 90px rgba(16, 17, 20, .3);
  animation: cardIn .2s cubic-bezier(.2, .9, .3, 1.05) both;
  scrollbar-width: thin;
}
.auth-logo {
  width: 54px; height: 54px; border-radius: 17px; margin-bottom: 14px;
  background: var(--accent); color: #fff;
  display: grid; place-items: center;
  font-size: 24px; font-weight: 800;
  box-shadow: 0 12px 28px rgba(77, 107, 254, .28);
}
.sheet-card h2 { margin: 0; font-size: 22px; letter-spacing: -.04em; }
.sheet-card .sub { margin: 7px 0 16px; font-size: 12px; line-height: 1.5; color: var(--mut); }
.steps { display: grid; gap: 9px; margin-bottom: 16px; }
.step { display: flex; gap: 9px; align-items: flex-start; font-size: 11.5px; line-height: 1.45; color: #5c626c; }
.step .n {
  width: 20px; height: 20px; border-radius: 50%; flex: none;
  background: var(--soft); color: var(--accent);
  display: grid; place-items: center; font-size: 9.5px; font-weight: 800;
}
.step b { color: var(--ink); font-weight: 650; }
.code-input {
  width: 100%; height: 54px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 15px;
  background: var(--side); color: var(--ink);
  font-size: 19px; font-weight: 650; letter-spacing: 3px; text-align: center;
  outline: 0; text-transform: uppercase;
  transition: border-color .15s, box-shadow .15s;
}
.code-input:focus { border-color: rgba(77, 107, 254, .55); box-shadow: 0 0 0 3px rgba(77, 107, 254, .09); }
.code-input.bad { border-color: var(--danger); }
.auth-error { min-height: 18px; padding-top: 7px; font-size: 11px; color: var(--danger); text-align: center; }
.btn-accent {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  width: 100%; height: 42px; border: 0; border-radius: 12px;
  background: var(--accent); color: #fff;
  font-size: 12px; font-weight: 650;
  box-shadow: 0 8px 18px rgba(77, 107, 254, .24);
  transition: background .15s, transform .15s;
}
.btn-accent:hover { background: var(--accent-hover); }
.btn-accent:active { transform: scale(.99); }
.btn-accent:disabled { opacity: .55; cursor: default; }
.btn-ghost {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  width: 100%; height: 38px; margin-top: 8px;
  border: 1px solid var(--line); border-radius: 11px;
  background: #fff; color: #5c626c;
  font-size: 11.5px; font-weight: 600;
  transition: border-color .15s, background .15s;
}
.btn-ghost:hover { border-color: #cfd5e2; background: var(--side); }
.link-btn {
  display: block; width: 100%; margin-top: 9px; padding: 5px;
  border: 0; background: transparent; color: var(--mut);
  font-size: 10.5px; font-weight: 550;
}
.link-btn:hover { color: var(--ink); }
.auth-foot { margin-top: 14px; text-align: center; font-size: 9px; color: #a8aeb8; }

/* ================= ПОИСК ================= */
.modal.search { width: min(640px, calc(100vw - 28px)); height: min(72vh, 580px); }
.search-body { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 14px 14px; scrollbar-width: thin; }
.search-body::-webkit-scrollbar { width: 8px; }
.search-body::-webkit-scrollbar-thumb { background: #d7dae2; border-radius: 99px; border: 2px solid transparent; background-clip: padding-box; }
.sr-group { margin: 10px 4px 5px; font-size: 8.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: #a0a6b0; }
.sr-item {
  display: flex; gap: 9px; align-items: flex-start; width: 100%;
  padding: 9px; border: 0; border-radius: 10px; background: transparent; text-align: left;
}
.sr-item:hover { background: #f6f7fa; }
.sr-item .sr-ico {
  width: 28px; height: 28px; border-radius: 8px; flex: none;
  background: var(--soft); color: var(--accent);
  display: grid; place-items: center;
}
.sr-item b { display: block; font-size: 11.5px; font-weight: 600; }
.sr-item small { display: block; margin-top: 2px; font-size: 9.5px; line-height: 1.4; color: var(--mut); }
.sr-item mark { background: #fff0b8; color: inherit; border-radius: 3px; padding: 0 1px; }

/* ================= ПРОФИЛЬ / СТАТИСТИКА ================= */
.modal.stats { width: min(660px, calc(100vw - 28px)); height: min(82vh, 680px); }
.stats-body { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 18px 18px; scrollbar-width: thin; }
.stats-body::-webkit-scrollbar { width: 8px; }
.stats-body::-webkit-scrollbar-thumb { background: #d7dae2; border-radius: 99px; border: 2px solid transparent; background-clip: padding-box; }
.profile-head { display: flex; align-items: center; gap: 12px; padding: 2px 0 14px; }
.profile-ava {
  width: 48px; height: 48px; border-radius: 15px; flex: none;
  background: linear-gradient(145deg, #dfe4ff, #c7d0ff);
  color: #2c3f9e; display: grid; place-items: center;
  font-size: 18px; font-weight: 800;
}
.profile-head b { display: block; font-size: 15px; letter-spacing: -.02em; }
.profile-head small { display: block; margin-top: 2px; font-size: 10px; color: var(--mut); }
.period-tabs { display: flex; gap: 2px; padding: 3px; border-radius: 999px; background: #f4f5f8; margin-bottom: 12px; }
.period-tabs button {
  flex: 1; height: 30px; border: 0; border-radius: 999px;
  background: transparent; color: #737a86; font-size: 10px; font-weight: 600;
}
.period-tabs button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(20, 22, 26, .08); }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat-card { padding: 11px 12px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.stat-card span { display: block; font-size: 8.5px; letter-spacing: .06em; text-transform: uppercase; color: #a0a6b0; }
.stat-card b { display: block; margin-top: 4px; font-size: 17px; letter-spacing: -.03em; }
.stat-card small { display: block; margin-top: 2px; font-size: 9px; color: var(--mut); }
.stat-card .up { color: #2f9e62; }
.stat-card .down { color: var(--danger); }
.chart-card { margin-top: 10px; padding: 13px 13px 9px; border: 1px solid var(--line); border-radius: 14px; }
.chart-card .ch-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; font-size: 10px; color: var(--mut); }
.chart-card .ch-head b { color: var(--ink); font-size: 11px; }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 110px; }
.bars .bar {
  flex: 1; min-width: 2px; border-radius: 4px 4px 2px 2px;
  background: linear-gradient(to top, #4d6bfe, #8fa4ff);
  min-height: 3px; opacity: .85;
  transition: opacity .12s, transform .12s;
  transform-origin: bottom;
}
.bars .bar:hover { opacity: 1; transform: scaleY(1.04); }
.bars .bar.zero { background: #e8eaee; }
.chart-axis { display: flex; justify-content: space-between; margin-top: 5px; font-size: 8px; color: #a8aeb8; }
.split { display: flex; gap: 8px; margin-top: 10px; }
.split div { flex: 1; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
.split span { display: block; font-size: 8.5px; text-transform: uppercase; letter-spacing: .06em; color: #a0a6b0; }
.split b { display: block; margin-top: 3px; font-size: 13px; }
.model-rows { margin-top: 10px; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.model-row { display: flex; align-items: center; gap: 9px; padding: 9px 12px; border-top: 1px solid var(--line); }
.model-row:first-child { border-top: 0; }
.model-row .mr-ava { width: 26px; height: 26px; border-radius: 8px; background: var(--soft); color: var(--accent); display: grid; place-items: center; font-size: 10px; font-weight: 800; flex: none; }
.model-row .mr-txt { flex: 1; min-width: 0; }
.model-row b { display: block; font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.model-row small { display: block; margin-top: 1px; font-size: 8.5px; color: var(--mut); }
.model-row .mr-val { font-size: 10px; font-weight: 650; color: #5c626c; flex: none; }
.stats-empty { padding: 26px 8px; text-align: center; font-size: 11px; color: var(--mut); }
.stats-foot { display: flex; gap: 8px; margin-top: 14px; }

/* ================= КОНТЕКСТНОЕ МЕНЮ / ТОСТ / ДИАЛОГ ================= */
.ctx {
  position: fixed; z-index: 95; display: none; min-width: 168px; padding: 5px;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 18px 44px rgba(20, 22, 26, .16);
}
.ctx.on { display: block; animation: popIn .14s cubic-bezier(.2, .8, .2, 1) both; }
.ctx button {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 8px 9px; border: 0; border-radius: 8px;
  background: transparent; color: #4d525b; font-size: 11px; text-align: left;
}
.ctx button:hover { background: #f4f5f8; color: var(--ink); }
.ctx button.danger { color: var(--danger); }
.ctx button.danger:hover { background: #fdf0f0; }
.toast {
  position: fixed; z-index: 120; left: 50%; bottom: 24px;
  transform: translateX(-50%) translateY(12px);
  max-width: min(440px, calc(100vw - 32px));
  padding: 10px 15px; border-radius: 12px;
  background: rgba(20, 22, 26, .94); color: #fff;
  font-size: 11.5px; font-weight: 550; line-height: 1.4; text-align: center;
  box-shadow: 0 14px 34px rgba(0, 0, 0, .24);
  opacity: 0; pointer-events: none;
  transition: opacity .18s, transform .18s;
}
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
.confirm-card { width: min(360px, 100%); }
.confirm-card h3 { margin: 0; font-size: 16px; letter-spacing: -.02em; }
.confirm-card p { margin: 8px 0 18px; font-size: 11.5px; line-height: 1.5; color: var(--mut); }
.confirm-actions { display: flex; gap: 8px; }
.confirm-actions .btn-ghost { margin-top: 0; height: 40px; }
.confirm-actions .btn-accent { height: 40px; background: var(--danger); box-shadow: 0 8px 18px rgba(214, 69, 69, .22); }
.confirm-actions .btn-accent:hover { background: #c33a3a; }

/* ================= ЖИВЫЕ ДЕТАЛИ ================= */
.composer.dragover {
  border-color: rgba(77, 107, 254, .7);
  box-shadow: 0 0 0 5px rgba(77, 107, 254, .12), 0 18px 44px rgba(77, 107, 254, .16);
  transform: scale(1.004);
}
.jump-bottom {
  position: absolute; z-index: 8; right: 26px; bottom: 118px;
  width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 50%;
  background: #fff; color: #5c626c;
  display: grid; place-items: center;
  box-shadow: 0 10px 26px rgba(20, 22, 26, .12);
  opacity: 0; pointer-events: none; transform: translateY(8px) scale(.94);
  transition: opacity .18s, transform .18s, color .15s, border-color .15s;
}
.jump-bottom.on { opacity: 1; pointer-events: auto; transform: none; }
.jump-bottom:hover { color: var(--accent); border-color: #c9d1ea; }
.msg.flash .bubble, .msg.flash .md {
  animation: flash 1.2s ease-out;
}
.msg.live .msg-ava { animation: pulseRing 1.7s ease-in-out infinite; }
.msg.assistant .msg-ava { transition: transform .2s; }
.msg.assistant:hover .msg-ava { transform: rotate(-4deg) scale(1.04); }
.mcard { animation: cardIn .28s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i, 0) * 18ms); }
.vchip { animation: popIn .2s cubic-bezier(.2, .8, .2, 1) both; }
.send.ready:not(.stop) { animation: sendGlow 2.4s ease-in-out infinite; }
.topbar { animation: fadeIn .22s ease both; }
.auth-logo { animation: floaty 4.5s ease-in-out infinite; }
.btn-accent:hover { transform: translateY(-1px); }
.btn-accent:active { transform: translateY(0) scale(.995); }
.stat-card { transition: border-color .15s, transform .15s, box-shadow .15s; }
.stat-card:hover { transform: translateY(-2px); border-color: #cfd5e2; box-shadow: 0 10px 24px rgba(20, 22, 26, .06); }
.model-row { transition: background .14s; }
.model-row:hover { background: #fbfcff; }
.reason.open .reason-body { animation: reasonOpen .2s ease both; }
.m-tabs button, .period-tabs button { transition: background .15s, color .15s, box-shadow .15s; }
.side-in { animation: fadeIn .2s ease both; }
.rail { animation: fadeIn .18s ease both; }
.account { transition: background .15s, transform .15s; }
.account:hover { transform: translateX(1px); }
.side-links a { transition: background .15s, color .15s, transform .15s; }
.side-links a:hover { transform: translateY(-1px); }
.m-head b { background: linear-gradient(90deg, var(--ink), #4d6bfe, var(--ink)); background-size: 220% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shimmer 6s linear infinite; }

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes floaty {
  0%, 100% { transform: translateY(0) translateX(0); }
  50% { transform: translateY(-7px) translateX(3px); }
}
@keyframes glow {
  0%, 100% { box-shadow: 0 12px 26px rgba(77, 107, 254, .24); }
  50% { box-shadow: 0 16px 38px rgba(77, 107, 254, .38); }
}
@keyframes pulseRing {
  0%, 100% { box-shadow: 0 5px 12px rgba(77, 107, 254, .22); transform: scale(1); }
  50% { box-shadow: 0 0 0 6px rgba(77, 107, 254, .10), 0 5px 12px rgba(77, 107, 254, .22); transform: scale(1.05); }
}
@keyframes flash {
  0% { background: rgba(77, 107, 254, .14); }
  100% { background: transparent; }
}
@keyframes reasonOpen {
  from { opacity: 0; transform: translateY(-3px); }
  to { opacity: 1; transform: none; }
}
@keyframes sendGlow {
  0%, 100% { box-shadow: 0 6px 14px rgba(77, 107, 254, .28); }
  50% { box-shadow: 0 8px 22px rgba(77, 107, 254, .44); }
}
@keyframes shimmer {
  0% { background-position: 120% 0; }
  100% { background-position: -120% 0; }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@keyframes popIn {
  from { opacity: 0; translate: 0 7px; scale: .985; }
  to { opacity: 1; translate: 0 0; scale: 1; }
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(10px) scale(.97); }
  to { opacity: 1; transform: none; }
}
@keyframes modalIn {
  from { opacity: 0; transform: translate(-50%, -50%) scale(.965); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: .25; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001s !important;
    animation-delay: 0s !important;
    transition-duration: .001s !important;
  }
}

/* ================= АДАПТИВ ================= */
@media (max-width: 1100px) {
  .model-pill { max-width: 190px; }
}
@media (max-width: 820px) {
  .app, .app.side-closed { grid-template-columns: minmax(0, 1fr); }
  .side {
    position: fixed; z-index: 90; top: 0; bottom: 0; left: 0;
    width: 86%; max-width: 330px;
    border-right: 1px solid var(--line);
    box-shadow: 0 20px 60px rgba(16, 17, 20, .18);
    transform: translateX(-100%);
    transition: transform .26s cubic-bezier(.4, 0, .2, 1);
  }
  .app.side-closed .side { width: 86%; overflow: hidden; }
  .app.side-closed .side-in { display: flex; }
  .app.side-closed .rail { display: none; }
  .app.mobile-open .side { transform: none; }
  .main { grid-column: 1; }
  .topbar .icon-btn { display: grid; }
  .topbar { padding-left: 10px; height: 50px; }
  .thread { padding: 14px 16px 8px; gap: 20px; }
  .dock { padding: 6px 14px 12px; }
  .msg.user .bubble { max-width: 88%; }
  .m-grid { grid-template-columns: 1fr; }
  .m-toolbar { flex-wrap: wrap; }
  .m-tabs { width: 100%; }
  .m-tabs button { flex: 1; }
  .modal { height: min(86vh, 660px); border-radius: 20px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .empty { padding: 18px 14px 6px; }
  .hello h1 { font-size: 27px; }
  .stage.is-empty .empty { padding: 4px 14px 0; }
  .ta { padding: 15px 15px 2px; font-size: 13.5px; }
  .mode-menu { position: fixed; left: 12px; right: 12px; bottom: 92px; width: auto; }
  .tools { gap: 3px; }
  .pill { font-size: 10px; padding: 0 8px; }
  .model-pill { max-width: 160px; }
}
@media (max-width: 560px) {
  .side-links a span { display: none; }
  .top-model-btn { display: inline-flex; max-width: 150px; }
  .tools { flex-wrap: nowrap; min-width: 0; }
  .tools .model-pill { display: none; }
  .tools .mlabel { display: none; }
  .model-pill { max-width: 130px; }
  .dock-hint { display: none; }
  .stat-grid { grid-template-columns: 1fr; }
  .profile-head { padding-bottom: 10px; }
}
