/* Мобильный интерфейс: тёмный, крупный, под большой палец.
   Расчёт на чтение в дороге - контраст выше обычного, шрифт не мельче 15px. */

/* Тёмная тема - база (и «как в системе», когда система тёмная) */
:root {
  --bg: #191917;
  --panel: #21211f;
  --panel-2: #2a2a27;
  --line: #3a3a36;
  --text: #f0efea;
  --dim: #9c9a92;
  --accent: #d97757;
  --accent-dim: #7a4433;
  --ok: #6cae75;
  --danger: #d9605c;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

/* ── Codex Mobile 2026 visual system ─────────────────────────────────── */
:root {
  --bg: #080b14;
  --panel: rgba(18, 23, 39, .92);
  --panel-2: rgba(29, 36, 59, .82);
  --line: rgba(148, 163, 255, .16);
  --text: #f5f7ff;
  --dim: #9ba5c3;
  --accent: #55c7ff;
  --accent-2: #8b6cff;
  --accent-dim: rgba(71, 130, 255, .22);
  --ok: #45dfa1;
  --danger: #ff6584;
  --shadow: 0 18px 55px rgba(0, 0, 0, .34);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f5f7ff;
  --panel: rgba(255, 255, 255, .92);
  --panel-2: rgba(235, 239, 253, .88);
  --line: rgba(50, 68, 133, .14);
  --text: #10162b;
  --dim: #647091;
  --accent: #087fc4;
  --accent-2: #6848dd;
  --accent-dim: rgba(50, 114, 237, .13);
  --ok: #079966;
  --danger: #d93e62;
  --shadow: 0 18px 50px rgba(39, 58, 123, .12);
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root[data-theme="auto"] {
    --bg: #f5f7ff;
    --panel: rgba(255, 255, 255, .92);
    --panel-2: rgba(235, 239, 253, .88);
    --line: rgba(50, 68, 133, .14);
    --text: #10162b;
    --dim: #647091;
    --accent: #087fc4;
    --accent-2: #6848dd;
    --accent-dim: rgba(50, 114, 237, .13);
    --ok: #079966;
    --danger: #d93e62;
    --shadow: 0 18px 50px rgba(39, 58, 123, .12);
    color-scheme: light;
  }
}

html, body {
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  letter-spacing: -.01em;
  background:
    radial-gradient(circle at 88% -8%, rgba(95, 75, 255, .18), transparent 34%),
    radial-gradient(circle at -12% 32%, rgba(42, 194, 255, .12), transparent 30%),
    var(--bg);
}
.screen { background: transparent; }
.top {
  min-height: 64px;
  background: color-mix(in srgb, var(--panel) 90%, transparent);
  border-color: var(--line);
  box-shadow: 0 8px 30px rgba(0,0,0,.08);
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
}
.top .title { font-weight: 720; letter-spacing: -.025em; }
.sub { margin-top: 2px; }
.ghost, .eye {
  border-color: var(--line);
  background: var(--panel-2);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
}
.ghost:active, .eye:active { transform: scale(.96); }
.primary, .send {
  color: #fff;
  background: linear-gradient(135deg, #159fe0, #6d62f2 70%, #9d5cf4);
  box-shadow: 0 10px 28px rgba(80, 101, 244, .3), inset 0 1px 0 rgba(255,255,255,.28);
}
.primary { border-radius: 15px; }

.login::before {
  content: "";
  position: absolute; width: 360px; height: 360px; top: 7%; left: 50%; transform: translateX(-50%);
  background: radial-gradient(circle, rgba(85,199,255,.16), rgba(125,92,255,.08) 44%, transparent 70%);
  pointer-events: none;
}
.login-box {
  position: relative; padding: 26px; border: 1px solid var(--line); border-radius: 28px;
  background: var(--panel); box-shadow: var(--shadow);
  backdrop-filter: blur(28px); -webkit-backdrop-filter: blur(28px);
}
.brand { font-size: 24px; font-weight: 760; letter-spacing: -.035em; gap: 14px; }
.brand-icon { width: 62px; height: 62px; border-radius: 17px; box-shadow: 0 12px 34px rgba(58,85,255,.3); }
.brand span { display: flex; flex-direction: column; }
.brand small, .list-brand small { color: var(--dim); font-size: 12px; font-weight: 520; letter-spacing: .01em; }
.dot { background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.pw-row input, .searchbar input, .picker select, textarea {
  border-color: var(--line) !important; background: var(--panel-2) !important; color: var(--text) !important;
  outline: none; box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
}
.pw-row input:focus, .searchbar input:focus, textarea:focus { border-color: color-mix(in srgb, var(--accent) 65%, transparent) !important; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent); }

.list-brand { display: flex; align-items: center; gap: 10px; }
.list-brand img { width: 36px; height: 36px; border-radius: 11px; box-shadow: 0 7px 18px rgba(58,85,255,.22); }
.list-brand span { display: flex; flex-direction: column; line-height: 1.12; }
.tools, .searchbar, .picker, .ctxbar { background: var(--panel); border-color: var(--line); }
.sessions { padding: 10px 10px calc(10px + var(--safe-b)); }
.item { border: 0; border-radius: 16px; margin-bottom: 8px; box-shadow: inset 0 0 0 1px var(--line); }
.item-content { min-height: 72px; background: var(--panel); padding: 14px 15px; }
.item-content:active { background: var(--panel-2); }
.item .t { font-weight: 620; }
.badge { border-radius: 999px; box-shadow: inset 0 1px 0 rgba(255,255,255,.18); }
.badge-working { background: linear-gradient(135deg, #277dd9, #7865ef); }

.settings {
  margin: 8px 10px; border: 1px solid var(--line); border-radius: 20px;
  background: var(--panel); box-shadow: var(--shadow);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
}
.set-block { border-color: var(--line) !important; }
.set-label { color: var(--text); font-weight: 680; letter-spacing: -.015em; }
.seg, .modes { padding: 3px; border-radius: 13px; background: var(--panel-2); }
.seg button, .mode-btn { border: 0 !important; border-radius: 10px !important; color: var(--dim); background: transparent; }
.seg button.active, .mode-btn.active {
  color: #fff !important; background: linear-gradient(135deg, #168fd2, #7160e9) !important;
  box-shadow: 0 5px 14px rgba(68,83,213,.24);
}
#notif-btn { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); color: var(--text); }

.feed { padding: 18px 12px 24px; }
.msg { line-height: 1.55; }
.msg.user {
  background: linear-gradient(135deg, rgba(22,137,204,.26), rgba(106,84,226,.3));
  border: 1px solid rgba(114,132,255,.2); border-radius: 19px 19px 5px 19px; padding: 12px 14px;
}
.msg.assistant {
  background: var(--panel); border: 1px solid var(--line); border-radius: 19px 19px 19px 5px;
  padding: 13px 15px; box-shadow: 0 7px 22px rgba(0,0,0,.08);
}
.lastmsg { background: var(--panel-2); border-color: var(--line); }
.composer {
  background: color-mix(in srgb, var(--panel) 94%, transparent) !important;
  border-color: var(--line) !important;
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 -12px 36px rgba(0,0,0,.12);
}
.composer .row { gap: 7px; }
.icon-btn { border-color: var(--line) !important; background: var(--panel-2) !important; }
.send { border-radius: 13px !important; }
.perm { background: var(--panel) !important; border: 1px solid var(--line); border-radius: 18px !important; box-shadow: var(--shadow); }
.ctx-track { height: 7px; }
.ctx-fill.ok { background: linear-gradient(90deg, #2bb9dd, #6e68ec); }

@media (min-width: 821px) {
  .screen { left: 50%; right: auto; width: min(760px, 100%); transform: translateX(-50%); border-inline: 1px solid var(--line); box-shadow: 0 0 80px rgba(0,0,0,.16); }
}
/* Светлая тема - принудительно выбранная */
:root[data-theme="light"] {
  --bg: #f4f2ec;
  --panel: #ffffff;
  --panel-2: #eceadf;
  --line: #dcd7ca;
  --text: #2a2824;
  --dim: #6f6b61;
  --accent: #c2572f;
  --accent-dim: #f4ddd1;
  --ok: #3f8f4f;
  --danger: #c0433f;
}
/* «Как в системе» + система светлая -> светлые цвета */
@media (prefers-color-scheme: light) {
  :root[data-theme="auto"] {
    --bg: #f4f2ec;
    --panel: #ffffff;
    --panel-2: #eceadf;
    --line: #dcd7ca;
    --text: #2a2824;
    --dim: #6f6b61;
    --accent: #c2572f;
    --accent-dim: #f4ddd1;
    --ok: #3f8f4f;
    --danger: #c0433f;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* Кнопки - не выделяются как текст и не вызывают iOS-меню «Скопировать/Найти» при зажатии */
button, .icon-btn, .send, .eye, .mode-btn, .theme-btn, .ghost, .item, .seg button {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}

html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: var(--bg); color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior: none;
}

.hidden { display: none !important; }
.screen { position: fixed; inset: 0; display: flex; flex-direction: column; }

/* ── Вход ─────────────────────────────────────────── */
.login { align-items: center; justify-content: center; padding: 24px; }
.login-box { width: 100%; max-width: 380px; }
.brand { font-size: 20px; font-weight: 600; margin-bottom: 8px; display: flex; align-items: center; gap: 10px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
.hint { color: var(--dim); font-size: 14px; margin: 0 0 20px; }
.pw-row { display: flex; gap: 8px; margin-bottom: 12px; }
.pw-row input {
  flex: 1; padding: 15px 14px; font-size: 17px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--panel); color: var(--text);
}
.eye {
  width: 52px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--panel); font-size: 20px; cursor: pointer;
}
.primary {
  width: 100%; padding: 15px; font-size: 17px; font-weight: 600; border: 0;
  border-radius: 12px; background: var(--accent); color: #1a1008; cursor: pointer;
}
.primary:active { transform: scale(0.99); }
.err { color: var(--danger); font-size: 14px; margin-top: 12px; min-height: 20px; }

/* ── Шапка ────────────────────────────────────────── */
.top {
  display: flex; align-items: center; gap: 8px; padding: 12px 14px;
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
  border-bottom: 1px solid var(--line); background: var(--panel); flex: 0 0 auto;
}
.top .title { flex: 1; font-weight: 600; font-size: 17px; min-width: 0; }
.top .title > div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sub { font-size: 12px; color: var(--dim); font-weight: 400; }
.ghost {
  background: transparent; border: 1px solid var(--line); color: var(--text);
  padding: 9px 13px; border-radius: 10px; font-size: 15px; cursor: pointer;
}
.ghost.danger { border-color: var(--danger); color: var(--danger); }
#back-btn { font-size: 22px; line-height: 1; padding: 6px 14px; }

/* ── Панель «поиск + база»: скрыта, вызывается стрелкой или свайпом вниз ── */
.top .chev { font-size: 18px; line-height: 1; padding: 7px 12px; transition: transform 0.25s ease; }
.top .chev.open { transform: rotate(180deg); }
.tools {
  overflow: hidden; background: var(--panel);
  max-height: 320px; opacity: 1; border-bottom: 1px solid var(--line);
  transition: max-height 0.28s ease, opacity 0.2s ease;
}
.tools.collapsed {
  max-height: 0; opacity: 0; border-bottom-width: 0;
  transition: max-height 0.24s ease, opacity 0.12s ease;
}
.tools .grip {
  display: block; width: 40px; height: 4px; border-radius: 3px;
  background: var(--line); margin: 8px auto 0; cursor: pointer;
}

/* ── Индикатор контекста в чате ─────────────────────── */
.ctxbar {
  display: flex; align-items: center; gap: 8px; flex: 0 0 auto;
  padding: 6px 14px; background: var(--panel); border-bottom: 1px solid var(--line);
  cursor: pointer; user-select: none; -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  transition: background 0.12s ease;
}
.ctxbar:active { background: var(--panel-2); } /* отклик на нажатие: вся полоса - кнопка */
.ctx-name { font-size: 12px; color: var(--dim); white-space: nowrap; }
.ctx-track { flex: 1; height: 6px; border-radius: 4px; background: var(--panel-2); overflow: hidden; }
.ctx-fill { display: block; height: 100%; width: 0; border-radius: 4px; transition: width 0.35s ease, background 0.2s ease; }
.ctx-fill.ok { background: #2f9e5e; }
.ctx-fill.warn { background: #e0a52e; }
.ctx-fill.hot { background: #e5484d; }
.ctx-pct { font-size: 12px; font-weight: 600; min-width: 36px; text-align: right; color: var(--dim); }
.ctx-pct.warn { color: #e0a52e; }
.ctx-pct.hot { color: #e5484d; }
.ctx-compact {
  border: 1px solid var(--line); color: var(--dim); background: transparent;
  font-size: 12px; padding: 5px 9px; border-radius: 8px; white-space: nowrap; pointer-events: none;
}
/* Тег «% контекста» в списке диалогов */
.ctxtag.warn { color: #e0a52e; font-weight: 600; }
.ctxtag.hot { color: #e5484d; font-weight: 600; }

/* ── Поиск по диалогам ────────────────────────────── */
.searchbar { padding: 10px 14px 0; background: var(--panel); }
.searchbar input {
  width: 100%; padding: 11px 14px; font-size: 16px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  -webkit-appearance: none;
}

/* ── Выбор проекта ────────────────────────────────── */
.picker { padding: 10px 14px 12px; background: var(--panel); }
.picker select {
  width: 100%; padding: 12px; font-size: 16px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
}

/* ── Список диалогов (свайп вправо -> кнопки) ──────── */
.sessions { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: var(--safe-b); }
.item { position: relative; overflow: hidden; border-bottom: 1px solid var(--line); }
/* Кнопки под карточкой, слева - открываются свайпом вправо */
.item-actions { position: absolute; inset: 0; display: flex; align-items: stretch; }
.ia {
  width: 88px; border: 0; font-size: 13px; font-weight: 600; cursor: pointer;
  display: flex; align-items: center; justify-content: center; text-align: center; line-height: 1.2;
}
.ia-pin { background: var(--accent); color: #1a1008; }
.ia-del { background: var(--danger); color: #fff; }
.ia.confirm { background: #7a1f1c; color: #fff; }
/* Сама карточка - едет поверх кнопок */
.item-content {
  position: relative; background: var(--bg); padding: 15px 14px;
  transition: transform 0.2s ease; will-change: transform; touch-action: pan-y;
  display: flex; align-items: center; gap: 10px;
}
.item-content:active { background: var(--panel); }
.item-main { flex: 1; min-width: 0; }
.item .t { font-size: 15px; margin-bottom: 5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.item .m { font-size: 12px; color: var(--dim); }
.empty { padding: 40px 20px; text-align: center; color: var(--dim); }

/* Статус диалога справа: жду тебя / завис / думаю / готово */
.badge { flex: 0 0 auto; font-size: 11px; font-weight: 700; padding: 5px 10px; border-radius: 12px; white-space: nowrap; }
.badge-attention { background: var(--danger); color: #fff; animation: recpulse 1.2s ease-in-out infinite; }
.badge-working { background: #7c5cff; color: #fff; } /* яркий фиолетовый - «думаю» */
.badge-stalled { background: #e0a52e; color: #241a05; } /* жёлтый - «завис?» */
.badge-done { background: var(--ok); color: #0e1a10; }
/* Диалог, который ждёт твою кнопку - подсветка строки. ВАЖНО: фон непрозрачный
   (сплошная база + цветной слой поверх), иначе кнопки свайпа просвечивают сквозь карточку. */
.item.attn .item-content { background-color: var(--bg); background-image: linear-gradient(rgba(217, 96, 92, 0.14), rgba(217, 96, 92, 0.14)); }
.item.attn { border-left: 4px solid var(--danger); }
/* Возможное зависание - подсветка жёлтым, так же непрозрачно */
.item.stall .item-content { background-color: var(--bg); background-image: linear-gradient(rgba(224, 165, 46, 0.14), rgba(224, 165, 46, 0.14)); }
.item.stall { border-left: 4px solid #e0a52e; }

/* ── Закреплённое последнее сообщение владельца ────── */
.lastmsg {
  flex: 0 0 auto; background: var(--panel-2); border-bottom: 1px solid var(--line);
  padding: 9px 14px; font-size: 13px; line-height: 1.4; cursor: pointer;
}
.lastmsg b { color: var(--accent); font-weight: 600; }
.lastmsg .txt {
  color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.lastmsg.expanded .txt { -webkit-line-clamp: unset; }

/* ── Лента чата ───────────────────────────────────── */
.feed { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 14px; }
.msg { margin-bottom: 14px; max-width: 92%; }
.msg.user { margin-left: auto; background: var(--accent-dim); border-radius: 14px 14px 4px 14px; padding: 11px 13px; }
.msg.assistant { background: var(--panel); border-radius: 14px 14px 14px 4px; padding: 11px 13px; }
.msg.system { text-align: center; color: var(--dim); font-size: 12px; max-width: 100%; }
/* Кратко подсвечиваем сообщение, к которому прыгнули из закрепа */
.msg.flash { animation: flashmsg 1.4s ease; }
@keyframes flashmsg {
  0%, 100% { box-shadow: none; }
  25% { box-shadow: 0 0 0 3px var(--accent); }
}
/* Блоки кода всегда тёмные со светлым текстом - читаемы и в светлой теме */
.msg pre {
  background: #131311; color: #f0efea; border: 1px solid #3a3a36; border-radius: 8px;
  padding: 10px; overflow-x: auto; font-size: 13px; margin: 8px 0;
}
.msg code { background: #131311; color: #f0efea; padding: 1px 5px; border-radius: 4px; font-size: 13.5px; }
.msg pre code { background: none; padding: 0; }
.msg p { margin: 6px 0; }
.msg p:first-child { margin-top: 0; }
.msg p:last-child { margin-bottom: 0; }
/* Кнопка «копировать» под моим ответом (два листика) */
.copy-btn {
  display: inline-flex; align-items: center; gap: 5px;
  margin-top: 9px; padding: 5px 9px; border-radius: 8px; line-height: 1;
  border: 1px solid var(--line); background: transparent; color: var(--dim);
  font-size: 12px; cursor: pointer; -webkit-tap-highlight-color: transparent;
  user-select: none; -webkit-user-select: none; touch-action: manipulation;
}
.copy-btn svg { display: block; }
.copy-btn:active { background: var(--panel-2); }
.copy-btn.done { color: #2f9e5e; border-color: #2f9e5e; }

/* Вызов инструмента - служебная строка, не мешает читать разговор */
.tool {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px;
  color: var(--dim); padding: 7px 10px; margin-bottom: 8px;
  background: var(--panel); border-left: 2px solid var(--line); border-radius: 0 6px 6px 0;
  white-space: pre-wrap; word-break: break-all;
}
.tool b { color: var(--accent); font-weight: 600; }
/* ── Индикатор работы ─────────────────────────────
   Задача - доказать, что процесс жив: пульс и бегущие точки идут всё время,
   пока Claude работает. Статичный текст этого не доказывает. */
.act {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; margin-bottom: 10px;
  background: var(--panel); border-radius: 12px;
  border-left: 2px solid var(--accent);
}
.act .pulse {
  width: 9px; height: 9px; border-radius: 50%; background: var(--accent);
  flex: 0 0 auto; animation: pulse 1.3s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 0 0 rgba(217, 119, 87, 0.5); }
  50% { opacity: 0.65; transform: scale(0.82); box-shadow: 0 0 0 7px rgba(217, 119, 87, 0); }
}
.act .what { flex: 1; font-size: 14px; color: var(--text); min-width: 0; }
.act .dots::after { content: ""; animation: dots 1.4s steps(4, end) infinite; }
@keyframes dots {
  0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; }
}
.act .timer { font-size: 12px; color: var(--dim); font-variant-numeric: tabular-nums; flex: 0 0 auto; }
.act.long .timer { color: var(--accent); }

/* Отметка о завершении - чтобы «закончил» читалось однозначно */
.done { font-size: 12px; color: var(--dim); padding: 2px 2px 10px; }
.done b { color: var(--ok); }

/* ── Кнопки разрешений ────────────────────────────── */
.perms { flex: 0 0 auto; }
.perm {
  margin: 10px 14px; padding: 13px; background: var(--panel-2);
  border: 1px solid var(--accent); border-radius: 12px;
}
.perm .why { font-size: 14px; margin-bottom: 6px; }
.perm .cmd {
  font-family: ui-monospace, monospace; font-size: 12.5px; color: #c9c5bb;
  background: #131311; padding: 8px; border-radius: 6px; margin-bottom: 10px;
  overflow-x: auto; white-space: pre-wrap; word-break: break-all;
}
.perm .btns { display: flex; gap: 8px; }
.perm button { flex: 1; padding: 13px; border-radius: 10px; border: 0; font-size: 15px; font-weight: 600; cursor: pointer; }
.perm .yes { background: var(--ok); color: #0e1a10; }
.perm .no { background: var(--panel); color: var(--danger); border: 1px solid var(--danger); }

/* ── Ввод ─────────────────────────────────────────── */
.composer {
  flex: 0 0 auto; border-top: 1px solid var(--line); background: var(--panel);
  padding: 10px 10px calc(10px + var(--safe-b));
}
.composer .row { display: flex; gap: 8px; align-items: flex-end; }
/* Быстрая кнопка «Продолжай» ▶ - иконкой слева, рядом со скрепкой */
.icon-btn.cont { color: var(--accent); font-size: 15px; }
.icon-btn.cont:active { transform: scale(0.95); }
.icon-btn {
  width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 12px; font-size: 19px; cursor: pointer; flex: 0 0 auto;
}
#input {
  flex: 1; resize: none; max-height: 140px; padding: 12px;
  font: inherit; font-size: 16px; /* меньше 16px -> iOS зумит страницу при фокусе */
  border-radius: 12px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text);
}
.send {
  width: 44px; height: 44px; border: 0; border-radius: 12px; flex: 0 0 auto;
  background: var(--accent); color: #1a1008; font-size: 20px; font-weight: 700; cursor: pointer;
}
.send:disabled { opacity: 0.4; }

.attached { display: flex; gap: 8px; padding-bottom: 8px; overflow-x: auto; }
.attached .th { position: relative; flex: 0 0 auto; }
.attached img { height: 62px; border-radius: 8px; border: 1px solid var(--line); display: block; }
.attached .x {
  position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--danger); color: #fff; border: 0; font-size: 13px; line-height: 22px; cursor: pointer;
}

/* ── Подсказка слэш-команд ────────────────────────── */
.slash { max-height: 190px; overflow-y: auto; margin-top: 8px; border-top: 1px solid var(--line); }
.slash div { padding: 11px 8px; border-bottom: 1px solid var(--line); cursor: pointer; font-size: 14px; }
.slash div:active { background: var(--panel-2); }
.slash b { color: var(--accent); }
.slash span { color: var(--dim); font-size: 12.5px; }

/* ── Микрофон ──────────────────────────────────────── */
.mic { font-size: 20px; }
.mic.rec {
  background: var(--danger); border-color: var(--danger);
  animation: recpulse 1s ease-in-out infinite;
}
@keyframes recpulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(217, 96, 92, 0.6); }
  50% { box-shadow: 0 0 0 8px rgba(217, 96, 92, 0); }
}

/* ── Панель настроек (режим + уведомления) ─────────── */
.settings {
  flex: 0 0 auto; background: var(--panel); border-bottom: 1px solid var(--line);
  padding: 14px; display: flex; flex-direction: column; gap: 16px;
}
.set-block { display: flex; flex-direction: column; gap: 8px; }
.set-label { font-size: 13px; color: var(--dim); font-weight: 600; }
.set-hint { font-size: 12px; color: var(--dim); line-height: 1.4; }
.modes { display: flex; flex-direction: column; gap: 6px; }
.mode-btn {
  padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text); font-size: 15px; text-align: left; cursor: pointer;
}
.mode-btn.active { border-color: var(--accent); background: var(--accent-dim); font-weight: 600; }
.ghost.wide { width: 100%; text-align: center; padding: 13px; }

/* Сегментный переключатель (тема) */
.seg { display: flex; gap: 6px; }
.seg button {
  flex: 1; padding: 11px 6px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text); font-size: 13.5px; cursor: pointer;
}
.seg button.active { border-color: var(--accent); background: var(--accent-dim); font-weight: 600; }
#effort-seg button { font-size: 11px; padding: 10px 2px; } /* 5 кнопок силы - шрифт поменьше */
/* Ultracode - отдельная широкая кнопка под сегментом, тяжёлый режим -> фиолетовый акцент */
.effort-btn.ultra {
  width: 100%; margin-top: 8px; padding: 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  font-size: 14px; font-weight: 600; cursor: pointer;
}
.effort-btn.ultra.active {
  border-color: #7c5cff;
  background: linear-gradient(90deg, rgba(124, 92, 255, 0.24), rgba(124, 92, 255, 0.08));
}

/* ── Полоса записи голоса ───────────────────────────── */
.recbar {
  display: flex; align-items: center; gap: 8px; padding: 9px 12px; margin-bottom: 8px;
  background: var(--panel-2); border: 1px solid var(--danger); border-radius: 10px;
  font-size: 13px; color: var(--text);
}
.recbar .rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); flex: 0 0 auto; animation: recpulse 1s ease-in-out infinite; }
.recbar .rec-time { font-variant-numeric: tabular-nums; color: var(--danger); font-weight: 700; }
.recbar .rec-tip { color: var(--dim); font-size: 12px; margin-left: auto; text-align: right; }

/* ── Переименование диалога (клик по заголовку) ─────── */
#chat-title { cursor: text; }
#chat-title.editing { outline: 2px solid var(--accent); border-radius: 6px; padding: 2px 6px; background: var(--panel-2); white-space: nowrap; }
