/* ===== Агентум Чат · атомпанк UI (T4) =====
   Стили темы закреплены за темой (4.8): все цвета — CSS-переменные,
   внешка меняется через [data-theme] без переделки вёрстки. */

/* ── темы ─────────────────────────────────────────────── */
:root,
:root[data-theme="atompunk"] {
  --bg: #171512;
  --bg-panel: #221f19;
  --bg-panel-2: #2a261e;
  --bg-input: #0d0c0a;
  --line: #3a362c;
  --line-soft: #2a261e;
  --text: #f6f0e1;
  --text-dim: #b9af9a;
  --text-mute: #a49c78;
  --accent: #ff5c1f; /* neon */
  --accent-2: #57c7e8; /* atomic */
  --term: #8cff5a;
  --butter: #f7d774;
  --mint: #9ed8c4;
  --pink: #f5b9c1;
  --rust: #a34a21;
  --user-bubble: #3a362c;
  --user-bubble-text: #f6f0e1;
  --agent-bubble: #221f19;
  --danger: #ff5c5c;
  --shadow-hard: #0d0c0a;
  --halftone: rgba(246, 240, 225, 0.05);
  --scrollbar: #3a362c;
}

:root[data-theme="terminal"] {
  --bg: #0a0f0a;
  --bg-panel: #0f160f;
  --bg-panel-2: #141d14;
  --bg-input: #060a06;
  --line: #1f331f;
  --line-soft: #162416;
  --text: #d8ffc9;
  --text-dim: #8fb88a;
  --text-mute: #82ab7c;
  --accent: #8cff5a;
  --accent-2: #4dd8ff;
  --term: #8cff5a;
  --butter: #f7d774;
  --mint: #9ed8c4;
  --pink: #f5b9c1;
  --rust: #8cff5a;
  --user-bubble: #12240f;
  --user-bubble-text: #d8ffc9;
  --agent-bubble: #0f160f;
  --danger: #ff5c5c;
  --shadow-hard: #040604;
  --halftone: rgba(140, 255, 90, 0.05);
  --scrollbar: #1f331f;
}

:root[data-theme="atomic-blue"] {
  --bg: #0e1418;
  --bg-panel: #16202a;
  --bg-panel-2: #1c2936;
  --bg-input: #0a1014;
  --line: #2c4354;
  --line-soft: #22333f;
  --text: #e8f4fb;
  --text-dim: #a9c4d4;
  --text-mute: #8aaac0;
  --accent: #57c7e8;
  --accent-2: #8cff5a;
  --term: #8cff5a;
  --butter: #f7d774;
  --mint: #9ed8c4;
  --pink: #f5b9c1;
  --rust: #57c7e8;
  --user-bubble: #1b3142;
  --user-bubble-text: #e8f4fb;
  --agent-bubble: #16202a;
  --danger: #ff6b6b;
  --shadow-hard: #060b0e;
  --halftone: rgba(87, 199, 232, 0.06);
  --scrollbar: #2c4354;
}

:root[data-theme="cream"] {
  --bg: #f6f0e1;
  --bg-panel: #fcf7ea;
  --bg-panel-2: #f1e9d6;
  --bg-input: #ffffff;
  --line: #cfc5b0;
  --line-soft: #e2d9c4;
  --text: #241c12;
  --text-dim: #4a4033;
  --text-mute: #635b41;
  --accent: #ff5c1f;
  --accent-2: #1d8fa8;
  --term: #1e7d34;
  --butter: #f7d774;
  --mint: #9ed8c4;
  --pink: #f5b9c1;
  --rust: #a34a21;
  --user-bubble: #241c12;
  --user-bubble-text: #f6f0e1;
  --agent-bubble: #fcf7ea;
  --danger: #d43d3d;
  --shadow-hard: #cfc5b0;
  --halftone: rgba(163, 74, 33, 0.05);
  --scrollbar: #cfc5b0;
}

/* ── базовое ──────────────────────────────────────────── */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
[hidden] {
  display: none !important;
}
html,
body {
  height: 100%;
}
body {
  font-family: "Inter", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
h1,
h2,
h3 {
  font-family: "Russo One", system-ui, sans-serif;
  font-weight: 400;
}
.mono,
.stamp,
.chat-meta,
.composer-hint,
.foot-label,
.overlay-stamp,
.msg-role,
.msg-time,
.chip,
.attachment-name,
.model-current {
  font-family: "IBM Plex Mono", monospace;
}
button {
  font-family: inherit;
  cursor: pointer;
}
::selection {
  background: var(--accent);
  color: var(--bg);
}

@font-face {
  font-family: "Russo One";
  font-weight: 400;
  font-style: normal;
  src: url("../fonts/RussoOne-400.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-weight: 400 700;
  font-style: normal;
  src: url("../fonts/Inter-400700.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-weight: 400;
  font-style: normal;
  src: url("../fonts/IBMPlexMono-400.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-weight: 500;
  font-style: normal;
  src: url("../fonts/IBMPlexMono-500.woff2") format("woff2");
}

/* скроллбары */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-thumb {
  background: var(--scrollbar);
  border-radius: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}

/* ── каркас ───────────────────────────────────────────── */
.app {
  display: grid;
  grid-template-columns: 300px 1fr;
  grid-template-rows: auto 1fr;
  grid-template-areas: "banner banner" "sidebar main";
  height: 100dvh;
}
.backend-banner {
  grid-area: banner;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: var(--accent);
  color: var(--bg);
  font-family: "IBM Plex Mono", monospace;
  font-size: 12.5px;
  border-bottom: 3px solid var(--shadow-hard);
}
.backend-banner-text {
  flex: 1;
}
.sidebar {
  grid-area: sidebar;
  display: flex;
  flex-direction: column;
  background: var(--bg-panel);
  border-right: 3px solid var(--shadow-hard);
  min-height: 0;
}
.main {
  grid-area: main;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  position: relative;
}

/* ── сайдбар ──────────────────────────────────────────── */
.sidebar-head {
  position: relative;
  padding: 14px 14px 10px;
  border-bottom: 2px solid var(--line-soft);
}
.sidebar-close {
  position: absolute;
  top: 8px;
  right: 8px;
}
@media (min-width: 821px) {
  .sidebar-close {
    display: none;
  }
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.brand-atom {
  color: var(--accent);
  flex: none;
}
.brand-name {
  font-family: "Russo One", system-ui, sans-serif;
  letter-spacing: 0.12em;
  font-size: 14px;
}
.topic-list-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  min-height: 0;
}
.topic-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.topic {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 2px solid transparent;
  border-radius: 10px;
  color: var(--text-dim);
  padding: 8px 10px;
  font-size: 13.5px;
}
.topic:hover {
  background: var(--bg-panel-2);
}
.topic.active {
  background: var(--bg-panel-2);
  border-color: var(--accent);
  color: var(--text);
}
.topic-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topic-count {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  color: var(--text-mute);
}
.topic-del {
  background: none;
  border: 0;
  color: var(--text-mute);
  font-size: 14px;
  padding: 2px 6px;
  border-radius: 6px;
  visibility: hidden;
}
.topic:hover .topic-del,
.topic.active .topic-del {
  visibility: visible;
}
.topic-del:hover {
  color: var(--danger);
  background: var(--bg-input);
}
.topic-empty {
  padding: 20px 10px;
  text-align: center;
  color: var(--text-mute);
  font-size: 13px;
}
.topic-empty p {
  margin-top: 10px;
}
.sidebar-foot {
  padding: 10px 14px 14px;
  border-top: 2px solid var(--line-soft);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.foot-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.foot-label {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-mute);
  width: 92px;
  flex: none;
}
.foot-static {
  font-size: 13px;
  color: var(--text-dim);
}
.select-mini {
  flex: 1;
  min-width: 0;
  background: var(--bg-input);
  color: var(--text);
  border: 2px solid var(--line);
  border-radius: 8px;
  padding: 5px 8px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
}
.foot-logout {
  margin-top: 4px;
}

/* ── кнопки ───────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: "Russo One", system-ui, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: 3px solid var(--shadow-hard);
  border-radius: 12px;
  padding: 10px 18px;
  font-size: 13px;
  box-shadow: 0 4px 0 var(--shadow-hard);
  transition:
    transform 0.08s ease,
    box-shadow 0.08s ease,
    filter 0.12s ease;
  background: var(--accent);
  color: var(--bg);
}
.btn:hover {
  filter: brightness(1.07);
}
.btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--shadow-hard);
}
.btn:disabled {
  opacity: 0.5;
  cursor: wait;
}
.btn-sm {
  padding: 7px 12px;
  font-size: 12px;
  border-radius: 10px;
}
.btn-square {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 10px;
  font-size: 16px;
}
.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border-color: var(--line);
  box-shadow: 0 4px 0 var(--line);
}
.btn-ghost:hover {
  color: var(--text);
}
.btn-send {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 10px;
  font-size: 15px;
}
/* btn-stop — отдельная кнопка «Стоп» (⏹) рядом с btn-send: красный акцент */
.btn-danger {
  background: var(--danger);
  border-color: var(--shadow-hard);
  color: #fff;
}
.btn-danger:hover {
  filter: brightness(1.12);
}
.btn-danger:disabled {
  opacity: 0.6;
  cursor: wait;
}
#btn-stop {
  margin-left: 4px;
}

/* ── шапка чата ───────────────────────────────────────── */
.chat-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 2px solid var(--line-soft);
  background: var(--bg-panel);
}
#btn-menu {
  display: none;
}
.chat-title-wrap {
  flex: 1;
  min-width: 0;
}
.chat-title {
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-meta {
  font-size: 11px;
  color: var(--text-mute);
  letter-spacing: 0.06em;
}
.head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}

.model-picker {
  position: relative;
}
.btn-model {
  font-family: "IBM Plex Mono", monospace;
  text-transform: none;
  font-size: 12px;
  padding: 6px 10px;
  max-width: 260px;
}
.model-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--term);
  flex: none;
}
.model-caret {
  color: var(--text-mute);
  font-size: 10px;
}
.model-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 50;
  width: 340px;
  max-height: 60vh;
  overflow-y: auto;
  background: var(--bg-panel-2);
  border: 3px solid var(--shadow-hard);
  border-radius: 12px;
  box-shadow: 0 8px 0 var(--shadow-hard);
  padding: 8px;
}
.model-group-label {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-mute);
  padding: 10px 8px 4px;
}
.model-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: var(--text-dim);
  padding: 7px 8px;
  font-size: 12.5px;
}
.model-opt:hover {
  background: var(--bg-panel);
  color: var(--text);
}
.model-opt.current {
  color: var(--text);
}
.model-opt .check {
  color: var(--term);
  flex: none;
  visibility: hidden;
}
.model-opt.current .check {
  visibility: visible;
}
.model-opt-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.model-opt-provider {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  color: var(--text-mute);
  flex: none;
}
.conn-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-mute);
  flex: none;
}
.conn-dot.online {
  background: var(--term);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--term) 25%, transparent);
}
.conn-dot.busy {
  background: var(--butter);
}
.conn-dot.offline {
  background: var(--danger);
}

/* ── сообщения ────────────────────────────────────────── */
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background:
    radial-gradient(
      circle at 20% 10%,
      var(--halftone) 1.2px,
      transparent 1.2px
    ),
    radial-gradient(
      circle at 80% 30%,
      var(--halftone) 1.2px,
      transparent 1.2px
    ),
    var(--bg);
  background-size:
    18px 18px,
    24px 24px,
    auto;
}
.msg {
  display: flex;
  flex-direction: column;
  max-width: min(760px, 88%);
}
.msg.user {
  align-self: flex-end;
  align-items: flex-end;
}
.msg.agent {
  align-self: flex-start;
  align-items: flex-start;
}
.msg.system {
  align-self: center;
  align-items: center;
  max-width: 90%;
}
.msg-row-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.msg-role {
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-mute);
}
.msg-time {
  font-size: 10.5px;
  color: var(--text-mute);
}
.bubble {
  padding: 10px 14px;
  border-radius: 14px;
  border: 2px solid var(--shadow-hard);
  font-size: 14.5px;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.msg.user .bubble {
  background: var(--user-bubble);
  color: var(--user-bubble-text);
  border-bottom-right-radius: 4px;
}
.msg.agent .bubble {
  background: var(--agent-bubble);
  border-bottom-left-radius: 4px;
  border-color: var(--line);
}
.msg.system .bubble {
  background: var(--bg-panel-2);
  border-style: dashed;
  border-color: var(--line);
  color: var(--text-dim);
  font-size: 13px;
  font-family: "IBM Plex Mono", monospace;
}
.msg.agent .bubble.streaming::after {
  content: "▍";
  color: var(--accent);
  animation: blink 1s steps(2) infinite;
}
@keyframes blink {
  50% {
    opacity: 0;
  }
}
.bubble pre {
  background: var(--bg-input);
  border: 2px solid var(--line-soft);
  border-radius: 8px;
  padding: 8px 10px;
  overflow-x: auto;
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  margin: 8px 0;
}
.bubble code {
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  background: var(--bg-input);
  padding: 1px 5px;
  border-radius: 5px;
}
.bubble pre code {
  background: none;
  padding: 0;
}
.bubble p {
  margin: 4px 0;
}
.bubble ul,
.bubble ol {
  margin: 4px 0 4px 20px;
}
.bubble a {
  color: var(--accent-2);
  text-decoration: underline;
}
.bubble blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 10px;
  color: var(--text-dim);
  margin: 6px 0;
}

/* маркдаун-подсветка бейджей */
.badge {
  display: inline-block;
  background: var(--bg-panel-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 6px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
}

/* ── тул-чипы и прогресс ──────────────────────────────── */
.tool-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11.5px;
  color: var(--text-dim);
  background: var(--bg-panel-2);
  border: 2px solid var(--line-soft);
  border-radius: 999px;
  padding: 4px 10px;
  margin-top: 6px;
}
.tool-chip .spin {
  display: inline-block;
  animation: spin 1.2s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.tool-chip.done {
  color: var(--text-mute);
}
.tool-chip.error {
  color: var(--danger);
  border-color: var(--danger);
}

/* ── вложения в сообщении ─────────────────────────────── */
.attachment {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  background: var(--bg-panel-2);
  border: 2px solid var(--line);
  border-radius: 10px;
  padding: 6px 10px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  color: var(--text-dim);
}
.attachment a {
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.attachment a:hover {
  color: var(--accent-2);
}
.attachment .att-icon {
  flex: none;
  font-size: 15px;
}
.attachment .att-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.attachment .att-size {
  color: var(--text-mute);
  flex: none;
  font-size: 11px;
}
.attachment .att-dl {
  flex: none;
  font-size: 11px;
  color: var(--text-mute);
}

/* аудио-пузырь */
.voice-bubble {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  background: var(--bg-panel-2);
  border: 2px solid var(--line);
  border-radius: 10px;
  padding: 6px 10px;
}
.voice-bubble audio {
  height: 30px;
  max-width: 220px;
}
.tts-btn {
  background: none;
  border: 0;
  font-size: 15px;
  color: var(--text-mute);
  padding: 2px;
  border-radius: 6px;
}
.tts-btn:hover {
  color: var(--accent-2);
  background: var(--bg-input);
}
.tts-btn.busy {
  animation: pulse 1s infinite;
}
@keyframes pulse {
  50% {
    opacity: 0.4;
  }
}

/* ── композер ─────────────────────────────────────────── */
.composer-wrap {
  padding: 10px 16px calc(12px + env(safe-area-inset-bottom));
  border-top: 2px solid var(--line-soft);
  background: var(--bg-panel);
}
.sidebar {
  padding-top: env(safe-area-inset-top);
}
.chat-head {
  padding-top: calc(10px + env(safe-area-inset-top));
}
.attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
/* Бейдж «N в очереди» (steer недоступен / run занят): сообщения ждут
   авто-отправки после finishRun. */
.queue-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-panel-2);
  border: 2px dashed var(--accent);
  border-radius: 999px;
  padding: 3px 12px;
  margin-bottom: 8px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11.5px;
  color: var(--accent);
}
.att-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-panel-2);
  border: 2px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11.5px;
  color: var(--text-dim);
}
.att-chip .att-x {
  background: none;
  border: 0;
  color: var(--text-mute);
  font-size: 12px;
  padding: 0 2px;
}
.att-chip .att-x:hover {
  color: var(--danger);
}
.composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.composer-input {
  flex: 1;
  resize: none;
  background: var(--bg-input);
  color: var(--text);
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14.5px;
  font-family: inherit;
  max-height: 160px;
  min-height: 40px;
  outline: none;
}
.composer-input:focus {
  border-color: var(--accent);
}
.composer-input::placeholder {
  color: var(--text-mute);
}
.composer-hint {
  margin-top: 8px;
  font-size: 10.5px;
  color: var(--text-mute);
  letter-spacing: 0.04em;
}
.rec-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  color: var(--danger);
  background: var(--bg-input);
  border: 2px solid var(--danger);
  border-radius: 12px;
  padding: 10px 12px;
  margin-top: 8px;
  animation: pulse 1.4s infinite;
}
.rec-indicator #rec-timer {
  flex: 1;
}
.rec-indicator.off {
  animation: none;
}

/* ── карточки-оверлеи (approval / clarify) ────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(0, 0, 0, 0.55);
}
.card-overlay {
  position: fixed;
  z-index: 91;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(520px, calc(100vw - 32px));
  background: var(--bg-panel);
  border: 3px solid var(--shadow-hard);
  border-radius: 16px;
  box-shadow: 0 10px 0 var(--shadow-hard);
  padding: 20px;
}
.overlay-stamp {
  display: table;
  margin: 0 0 14px;
  font-size: 11.5px;
}
.overlay-title {
  font-size: 17px;
  margin-bottom: 10px;
}
.overlay-detail {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12.5px;
  background: var(--bg-input);
  border: 2px solid var(--line-soft);
  border-radius: 10px;
  padding: 10px;
  color: var(--text-dim);
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 14px;
  max-height: 140px;
  overflow-y: auto;
}
.overlay-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.clarify-choices {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}
.clarify-choice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--bg-panel-2);
  border: 2px solid var(--line);
  border-radius: 10px;
  padding: 9px 12px;
  cursor: pointer;
  font-size: 13.5px;
}
.clarify-choice:hover {
  border-color: var(--accent-2);
}
.clarify-choice.selected {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--bg-panel-2));
}
.clarify-choice input {
  margin-top: 3px;
  accent-color: var(--accent);
}
.clarify-choice .rec-badge {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--term);
  border: 1px solid var(--term);
  border-radius: 999px;
  padding: 1px 8px;
  margin-left: 8px;
  flex: none;
}
.clarify-other input {
  width: 100%;
  background: var(--bg-input);
  color: var(--text);
  border: 2px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13.5px;
}
.clarify-other input:focus {
  outline: none;
  border-color: var(--accent-2);
}

/* ── тосты ────────────────────────────────────────────── */
.toasts {
  position: fixed;
  z-index: 95;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-panel-2);
  border: 3px solid var(--shadow-hard);
  border-radius: 12px;
  box-shadow: 0 5px 0 var(--shadow-hard);
  padding: 10px 14px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12.5px;
  color: var(--text);
  animation: toast-in 0.18s ease;
}
.toast .toast-text {
  white-space: nowrap;
}
.toast .toast-undo {
  font-family: "Russo One", system-ui, sans-serif;
  font-size: 11px;
  text-transform: uppercase;
  background: var(--accent);
  color: var(--bg);
  border: 2px solid var(--shadow-hard);
  border-radius: 8px;
  padding: 4px 10px;
}
.toast .toast-close {
  background: none;
  border: 0;
  color: var(--text-mute);
  font-size: 14px;
  padding: 2px 4px;
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* ── нет доступа ──────────────────────────────────────── */
.access-panel {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: var(--bg);
  text-align: center;
  padding: 24px;
}
.access-panel p {
  color: var(--text-dim);
  max-width: 420px;
  font-size: 14px;
}

/* ── штампы ───────────────────────────────────────────── */
.stamp {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  padding: 6px 16px;
  transform: rotate(-3deg);
  border-radius: 6px;
  position: relative;
  color: var(--rust);
  border: 3px solid var(--rust);
  background: color-mix(in srgb, var(--rust) 7%, transparent);
}
.stamp-term {
  color: var(--term);
  border-color: var(--term);
  transform: rotate(2deg);
}
.stamp-rust {
  color: var(--rust);
  border-color: var(--rust);
}

/* ── адаптив ──────────────────────────────────────────── */
@media (max-width: 820px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-areas: "banner" "main";
  }
  .sidebar {
    position: fixed;
    z-index: 80;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(320px, 86vw);
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    box-shadow: 0 0 0 100vmax transparent;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.5);
  }
  #btn-menu {
    display: inline-flex;
  }
  .msg {
    max-width: 94%;
  }
  .model-menu {
    width: min(340px, calc(100vw - 32px));
  }
  .chat-head {
    padding: 8px 10px;
    padding-top: calc(8px + env(safe-area-inset-top));
  }
  .messages {
    padding: 14px 10px;
  }
  .composer-wrap {
    padding: 8px 10px 10px;
  }
  .btn-model {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .brand-name {
    font-size: 12px;
  }
  .toast .toast-text {
    white-space: normal;
    max-width: 70vw;
  }
}
