/* AION v5.1 — Чистый эталонный дизайн Grok × ChatGPT (0 эмодзи, 0 фиолетовых пятен, 0 лишних рамок) */
:root, html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0E0E10;
  --sidebar: #141417;
  --surface: #1B1B1F;
  --surface-2: #242429;
  --surface-hover: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #ECECF1;
  --muted: #8E8E98;
  --accent: #FFFFFF;
  --accent-fg: #0E0E10;
  --emerald: #10B981;
  --emerald-soft: rgba(16, 185, 129, 0.14);
  --amber-bg: rgba(245, 158, 11, 0.14);
  --amber-tx: #FBBF24;
  --danger-bg: rgba(239, 68, 68, 0.16);
  --danger-tx: #F87171;
  --user-bubble: #232329;
  --pill-shadow: 0 8px 30px rgba(0, 0, 0, 0.36);
  --popover-shadow: 0 14px 44px rgba(0, 0, 0, 0.55);
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #FFFFFF;
  --sidebar: #F9F9FA;
  --surface: #FFFFFF;
  --surface-2: #F3F3F5;
  --surface-hover: rgba(0, 0, 0, 0.05);
  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.14);
  --text: #111114;
  --muted: #6E6E78;
  --accent: #111114;
  --accent-fg: #FFFFFF;
  --emerald: #059669;
  --emerald-soft: #ECFDF5;
  --amber-bg: #FEF3C7;
  --amber-tx: #92400E;
  --danger-bg: #FEE2E2;
  --danger-tx: #991B1B;
  --user-bubble: #F3F3F5;
  --pill-shadow: 0 4px 20px rgba(0, 0, 0, 0.07);
  --popover-shadow: 0 12px 36px rgba(0, 0, 0, 0.12);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* Тонкие скроллбары без системных Windows-стрелок (у сайдбара прячутся до наведения, как в ChatGPT) */
.sb-chats { scrollbar-width: none; }
.sb-chats::-webkit-scrollbar { width: 4px; }
.sb-chats::-webkit-scrollbar-thumb { background: transparent; border-radius: 999px; }
.sb-chats:hover::-webkit-scrollbar-thumb { background: var(--border-strong); }
.feed::-webkit-scrollbar, .sheet-body::-webkit-scrollbar { width: 5px; }
.feed::-webkit-scrollbar-track, .sheet-body::-webkit-scrollbar-track { background: transparent; }
.feed::-webkit-scrollbar-thumb, .sheet-body::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; }
::-webkit-scrollbar-button { display: none; width: 0; height: 0; }

/* В iOS/Android WebView (?embed=1) прячем ТОЛЬКО кнопку установки PWA — сайдбар и ☰ меню ДОЛЖНЫ работать как в нативном ChatGPT/Grok iOS! */
:is(html, body).embed-mode #installBtn { display: none !important; }
:is(html, body).embed-mode #menuBtn { display: inline-grid !important; }
:is(html, body).embed-mode .sidebar {
  position: fixed;
  left: -280px;
  top: 0;
  bottom: 0;
  width: 268px !important;
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
  transition: left .2s ease;
  box-shadow: var(--popover-shadow);
}
:is(html, body).embed-mode .sidebar.open { left: 0; }
:is(html, body).embed-mode .sidebar-backdrop.open {
  display: block;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 25;
}

.ic { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.agent-app { display: flex; height: 100vh; height: 100dvh; width: 100%; background: var(--bg); }

/* ---------- Collapsible Sidebar (260px ↔ 56px ChatGPT Icon Rail) ---------- */
.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 10px 8px;
  gap: 6px;
  z-index: 30;
  transition: width .18s ease;
}
.sidebar.collapsed { width: 56px; align-items: center; padding: 10px 6px; }
.sidebar.collapsed .sb-label,
.sidebar.collapsed .sb-count,
.sidebar.collapsed .sb-chats,
.sidebar.collapsed .sb-search-wrap,
.sidebar.collapsed .sb-user-select,
.sidebar.collapsed .role-locked-pill { display: none !important; }
.sidebar.collapsed .sb-head { flex-direction: column; gap: 6px; }
.sidebar.collapsed .sb-item { justify-content: center; width: 40px; height: 38px; padding: 0; }
.sidebar.collapsed .sb-footer-row { flex-direction: column; align-items: center; }

.sidebar-backdrop { display: none; }

.sb-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 4px 6px;
}
.sb-brand-btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border: none;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  padding: 5px 6px;
  border-radius: 9px;
}
.sb-brand-btn:hover { background: var(--surface-hover); }
.sb-wordmark { font-weight: 700; font-size: 15px; letter-spacing: 0.08em; }

.rail-icon-btn, .ghost-icon-btn {
  width: 34px;
  height: 34px;
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 9px;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.rail-icon-btn:hover, .ghost-icon-btn:hover { background: var(--surface-hover); color: var(--text); }

.sb-actions { display: flex; flex-direction: column; gap: 4px; }
.sb-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 450;
  cursor: pointer;
  text-align: left;
  transition: background .12s;
}
.sb-item:hover { background: var(--surface-hover); }
.sb-item.active { background: var(--surface-2); font-weight: 500; }
.sb-item .ic { color: var(--muted); }
.sb-item:hover .ic, .sb-item.active .ic { color: var(--text); }
.sb-count { margin-left: auto; font-size: 11px; color: var(--muted); }

.sb-search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  height: 34px;
  border-radius: 9px;
  background: transparent;
  transition: background .12s;
}
.sb-search-wrap:hover, .sb-search-wrap:focus-within { background: var(--surface-hover); }
.sb-search-ic { color: var(--muted); }
.sb-search {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  outline: none;
}
.sb-search::placeholder { color: var(--muted); }
.sb-search-clear {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 5px;
  line-height: 1;
}
.sb-search-clear:hover { color: var(--text); background: var(--surface-hover); }

.sb-nav { display: flex; flex-direction: column; gap: 1px; padding-top: 2px; }
.sb-tools-group { border-top: 1px solid var(--border); padding-top: 4px; margin-top: 2px; }
.sb-tools-summary {
  list-style: none;
  cursor: pointer;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}
.sb-tools-summary::-webkit-details-marker { display: none; }
.sb-tools-summary::after { content: '›'; font-size: 14px; transition: transform .15s; }
.sb-tools-group[open] .sb-tools-summary::after { transform: rotate(90deg); }
.sb-tools-summary:hover { background: var(--surface-hover); color: var(--text); }
.sb-section-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  padding: 10px 10px 3px;
}

.sb-chats {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-height: 50px;
}
.sb-chat-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 13.5px;
  line-height: 1.35;
  color: var(--text);
  opacity: 0.84;
  cursor: pointer;
  position: relative;
  transition: background .12s, opacity .12s;
}
.sb-chat-item:hover { background: var(--surface-hover); opacity: 1; }
.sb-chat-item.active { background: var(--surface-2); opacity: 1; font-weight: 500; }
.sb-chat-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.sb-chat-pin-dot { color: var(--muted); display: inline-flex; align-items: center; flex-shrink: 0; opacity: 0.75; }
.sb-chat-more {
  opacity: 0;
  width: 26px;
  height: 26px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  border-radius: 7px;
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  transition: opacity .12s, background .12s, color .12s;
}
.sb-chat-item:hover .sb-chat-more,
.sb-chat-item.active .sb-chat-more,
.sb-chat-more:focus { opacity: 1; }
.sb-chat-more:hover { background: var(--surface-hover); color: var(--text); }
@media (hover: none) {
  .sb-chat-more { opacity: 0.85; }
}
.chat-ctx-menu {
  position: fixed;
  z-index: 95;
  min-width: 176px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 5px;
  box-shadow: var(--popover-shadow);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.chat-ctx-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.chat-ctx-btn:hover { background: var(--surface-hover); }
.chat-ctx-btn.danger { color: var(--danger-tx); }
.search-hl {
  background: rgba(255, 255, 255, 0.18);
  color: var(--text);
  border-radius: 3px;
  padding: 0 2px;
}
html[data-theme="light"] .search-hl { background: rgba(245, 158, 11, 0.28); }

.sb-footer {
  border-top: 1px solid var(--border);
  padding-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.profile-menu-wrap { position: relative; }
.profile-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 8px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: background .12s;
}
.profile-trigger:hover { background: var(--surface-hover); }
.profile-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}
.profile-meta { min-width: 0; display: flex; flex-direction: column; }
.profile-meta strong { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-meta span { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-popover { bottom: calc(100% + 8px); left: 0; width: 250px; max-height: 320px; overflow-y: auto; }
.profile-group-lbl { font-size: 10.5px; font-weight: 600; color: var(--muted); padding: 6px 10px 2px; text-transform: uppercase; letter-spacing: 0.05em; }

.pop-sep { height: 1px; background: var(--border); margin: 4px 6px; }
.pop-style-section { padding: 4px 8px 6px; }
.pop-style-label { font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.style-pills { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px; }
.style-pill {
  padding: 5px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.style-pill:hover { background: var(--surface-hover); color: var(--text); }
.style-pill.active { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); font-weight: 600; }

.gallery-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.gallery-tile { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
.gallery-tile img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; display: block; background: #0B0B0D; }
.gallery-tile-foot { padding: 7px 8px; display: flex; justify-content: space-between; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); }

.role-locked-pill { font-size: 12px; padding: 6px 10px; border-radius: 8px; background: var(--emerald-soft); color: var(--emerald); }
.sb-footer-row { display: flex; align-items: center; gap: 2px; }
.sb-footer-row .sb-item { flex: 1; }

/* ---------- Main Stage (Pure Grok × ChatGPT Canvas) ---------- */
.stage {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
}

/* Header — прозрачный, БЕЗ border-bottom, с учётом iPhone Dynamic Island / Notch */
.stage-bar {
  min-height: 54px;
  flex-shrink: 0;
  padding: env(safe-area-inset-top, 0px) 16px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.stage-bar-left, .stage-bar-right { display: flex; align-items: center; gap: 6px; min-width: 0; }
.mobile-only { display: none; }

/* Кастомный селектор модели (как в ChatGPT / Grok) */
.mode-menu-wrap { position: relative; }
.mode-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s;
}
.mode-trigger:hover { background: var(--surface-hover); }
.mode-sub-badge { font-weight: 400; color: var(--muted); font-size: 13.5px; }

.stage-title-btn {
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  opacity: 0.88;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: min(420px, 48vw);
  padding: 5px 9px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .12s, opacity .12s;
}
.stage-title-btn:hover { background: var(--surface-hover); opacity: 1; }
.stage-title-btn:empty { display: none; }
.stage.is-empty .stage-title-btn { display: none; }
.stage.is-empty #exportChatBtn,
.stage.is-empty #shiftReportBtn { display: none !important; }

.status-dot-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 6px;
  font-size: 12px;
  color: var(--muted);
}
.stage.is-empty .status-dot-wrap { display: none; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--emerald); opacity: 0.85; }
.dot.offline { background: #F59E0B; }
.status-txt { display: none; }

.notif-banner {
  background: var(--emerald-soft);
  color: var(--emerald);
  padding: 7px 18px;
  font-size: 12.5px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.notif-banner button { border: none; background: transparent; color: inherit; cursor: pointer; font-weight: 700; }

/* ---------- Empty State: Composer Centered Vertically (EXACT Grok × ChatGPT!) ---------- */
.empty-heading { display: none; }
.stage.is-empty { justify-content: flex-start; }
.stage.is-empty .feed { display: none; }
.stage.is-empty .empty-heading {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: auto;
  padding: 0 20px 22px;
  text-align: center;
}
.empty-heading h1 {
  margin: 0;
  font-size: clamp(22px, 2.4vw, 27px);
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--text);
}
.stage.is-empty .composer-dock {
  margin-bottom: auto;
  padding-top: 0;
}
.stage:not(.is-empty) .quick-prompts { display: none; }

/* ---------- Messages Feed ---------- */
.feed {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}
.feed > * { width: 100%; max-width: 760px; }

.msg-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-radius: 14px;
  transition: background .35s ease, box-shadow .35s ease;
}
.msg-row.jump-highlight {
  background: var(--surface-hover);
  box-shadow: 0 0 0 1px var(--border-strong);
  padding: 8px 10px;
}
.load-older-btn {
  align-self: center;
  width: auto !important;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}
.load-older-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }
.msg-row.user { align-items: flex-end; }
.user-bubble-wrap { display: flex; align-items: center; justify-content: flex-end; gap: 6px; max-width: 84%; }
.user-msg-edit-btn {
  opacity: 0;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity .15s, background .12s, color .12s;
}
.msg-row.user:hover .user-msg-edit-btn, .user-msg-edit-btn:focus { opacity: 1; }
.user-msg-edit-btn:hover { background: var(--surface-hover); color: var(--text); }
.user-edit-box {
  width: 100%;
  max-width: 600px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.user-edit-box textarea {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 14.5px;
  line-height: 1.5;
  resize: vertical;
  outline: none;
}
.user-bubble {
  max-width: 100%;
  padding: 10px 16px;
  border-radius: 22px;
  background: var(--user-bubble);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
.file-chip-row { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.file-chip { font-size: 12px; padding: 4px 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--muted); }
.chat-thumb { width: 112px; height: 112px; object-fit: cover; border-radius: 14px; border: 1px solid var(--border); }

.agent-text {
  font-size: 16px;
  line-height: 1.72;
  letter-spacing: -0.005em;
  color: var(--text);
  word-break: break-word;
}
.agent-text strong { font-weight: 600; color: var(--accent); }
.agent-text p { margin: 0 0 12px; }
.agent-text p:last-child { margin-bottom: 0; }
.agent-text h1, .agent-text h2, .agent-text h3, .agent-text h4 {
  margin: 20px 0 8px;
  font-weight: 600;
  letter-spacing: -0.018em;
  line-height: 1.32;
}
.agent-text h1:first-child, .agent-text h2:first-child, .agent-text h3:first-child { margin-top: 2px; }
.agent-text h1 { font-size: 20.5px; }
.agent-text h2 { font-size: 18px; }
.agent-text h3, .agent-text h4 { font-size: 16px; }
.agent-text ul, .agent-text ol { margin: 8px 0 14px; padding-left: 22px; }
.agent-text li { margin-bottom: 6px; }
.agent-text hr.md-hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.md-table-scroll {
  width: 100%;
  overflow-x: auto;
  margin: 12px 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.md-table-scroll .artifact-table {
  margin: 0;
  border: none;
  font-variant-numeric: tabular-nums;
}
.md-table-scroll .artifact-table th,
.md-table-scroll .artifact-table td {
  border-top: none;
  border-left: none;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 8px 12px;
}
.md-table-scroll .artifact-table th:last-child,
.md-table-scroll .artifact-table td:last-child { border-right: none; }
.md-table-scroll .artifact-table tbody tr:last-child td { border-bottom: none; }
.agent-text blockquote {
  margin: 10px 0;
  padding: 6px 14px;
  border-left: 2px solid var(--border-strong);
  color: var(--muted);
}
.agent-text a { color: var(--text); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--muted); }
.agent-text a:hover { text-decoration-color: var(--text); }
.agent-text code.md-inline-code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 13px;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.md-code-wrap {
  margin: 12px 0;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  overflow: hidden;
}
.md-code-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 12px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--muted);
}
.md-code-copy {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
}
.md-code-copy:hover { background: var(--surface-hover); color: var(--text); }
.md-code-wrap pre {
  margin: 0;
  padding: 12px 14px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
  border: none;
  background: transparent;
}
.kb-filter-row { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }
.kb-filter-pill {
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  cursor: pointer;
}
.kb-filter-pill.active, .kb-filter-pill:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }

/* Hover actions under assistant replies (Copy / Speak / Regenerate — exact Grok & ChatGPT) */
.msg-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-top: 2px;
  opacity: 0.55;
  transition: opacity .15s;
}
.msg-row.assistant:hover .msg-actions { opacity: 1; }
.msg-act-btn {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
}
.msg-act-btn:hover { background: var(--surface-hover); color: var(--text); }

.trace-box {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px 12px;
  font-size: 12.5px;
  color: var(--muted);
  width: fit-content;
  max-width: 100%;
}
.trace-box summary { cursor: pointer; font-weight: 500; color: var(--muted); }
.trace-box[open] { width: 100%; background: var(--surface); }
.trace-list { margin-top: 7px; display: flex; flex-direction: column; gap: 4px; }
.trace-step { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; padding: 3px 0; border-top: 1px solid var(--border); }

.status-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--muted);
}
.pulse-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text); animation: pulse 1.1s infinite ease-in-out; }
@keyframes pulse { 0%, 100% { opacity: .25; transform: scale(.85); } 50% { opacity: 1; transform: scale(1.1); } }

/* Generated Image Card */
.gen-image-card {
  margin-top: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  max-width: 500px;
}
.gen-image-el { display: block; width: 100%; height: auto; max-height: 500px; object-fit: contain; background: #0B0B0D; }
.gen-image-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
}
.gen-image-cap { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Artifacts, Plans, Action Cards */
.artifact-card, .action-card, .plan-card, .inline-badge-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 16px;
}
.artifact-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.artifact-title { font-weight: 600; font-size: 14px; }
.artifact-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.artifact-body { font-size: 13.5px; line-height: 1.55; overflow-x: auto; }
.artifact-table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 6px 0; }
.artifact-table th, .artifact-table td { border: 1px solid var(--border); padding: 7px 10px; text-align: left; }
.artifact-table th { background: var(--surface-2); font-weight: 600; }
.artifact-tabs { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 2px; gap: 2px; }
.artifact-tab { background: transparent; border: none; color: var(--text-muted); font-size: 11.5px; padding: 3px 9px; border-radius: 6px; cursor: pointer; font-weight: 500; }
.artifact-tab.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.artifact-frame-wrap { width: 100%; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); background: #0E0E10; }
.artifact-iframe { width: 100%; height: 420px; border: none; display: block; background: #0E0E10; }
.artifact-code-pre { margin: 0; padding: 14px; background: var(--bg); border: 1px solid var(--border); border-radius: 12px; font-family: ui-monospace, Consolas, monospace; font-size: 12px; overflow-x: auto; max-height: 420px; white-space: pre; }
.artifact-fs-backdrop { position: fixed; inset: 0; z-index: 9999; background: rgba(0,0,0,.82); display: flex; flex-direction: column; padding: 16px; }
.artifact-fs-bar { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px 12px 0 0; }
.artifact-fs-frame { flex: 1; width: 100%; border: 1px solid var(--border); border-top: none; border-radius: 0 0 12px 12px; background: #0E0E10; }

.plan-item { display: flex; align-items: flex-start; gap: 10px; padding: 7px 0; border-top: 1px solid var(--border); font-size: 13.5px; cursor: pointer; }
.plan-item input { margin-top: 3px; accent-color: var(--emerald); }
.plan-item.done span { text-decoration: line-through; color: var(--muted); }

.action-tag { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.action-title { font-weight: 600; font-size: 14.5px; margin: 4px 0 6px; }
.action-body { font-size: 13.5px; color: var(--muted); white-space: pre-wrap; }
.action-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

.chips-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.chip-btn {
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}
.chip-btn:hover { background: var(--surface-hover); color: var(--text); border-color: var(--border-strong); }

.notice-box {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 11.5px;
  margin-bottom: 6px;
}

/* ---------- Single-Line Pill Composer (Exact Grok × ChatGPT) ---------- */
.composer-dock {
  flex-shrink: 0;
  padding: 8px 20px calc(18px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  position: relative;
}
.scroll-bottom-btn {
  position: absolute;
  top: -42px;
  left: 50%;
  transform: translateX(-50%);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  box-shadow: var(--pill-shadow);
  z-index: 20;
  transition: background .12s, transform .12s;
}
.scroll-bottom-btn:hover { background: var(--surface-2); transform: translateX(-50%) scale(1.06); }
.composer-box {
  width: 100%;
  max-width: 760px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 6px 8px;
  box-shadow: var(--pill-shadow);
  position: relative;
  transition: border-color .15s;
}
.composer-box:focus-within { border-color: var(--border-strong); }
.composer-box.dragover { border-color: var(--emerald); }

.composer-pill-row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
}

.composer-box textarea {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  line-height: 1.45;
  resize: none;
  outline: none;
  max-height: 180px;
  min-height: 40px;
  padding: 9px 6px;
}
.composer-box textarea::placeholder { color: var(--muted); }

.composer-right-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.pill-circle-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--muted);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .12s, color .12s;
}
.pill-circle-btn:hover { background: var(--surface-hover); color: var(--text); }
.pill-circle-btn.recording {
  background: var(--danger-bg);
  color: var(--danger-tx);
  animation: pulse 1s infinite ease-in-out;
}

.voice-circle-btn, .send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: var(--accent-fg);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform .1s, opacity .12s;
}
.voice-circle-btn:hover, .send-btn:hover { opacity: 0.88; transform: scale(1.03); }
.send-btn:disabled { opacity: 0.35; cursor: default; transform: none; }

.stop-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: var(--accent-fg);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
}

.attached-files { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 6px 8px; }
.attached-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
}
.attached-pill button { border: none; background: transparent; color: var(--muted); cursor: pointer; }

/* Бескрамочные лёгкие подсказки под композером (1-в-1 Grok) */
.quick-prompts {
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  margin-top: 12px;
}
.quick-prompt-btn {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 14px;
  border-radius: 12px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.quick-prompt-btn:hover { background: var(--surface-hover); color: var(--text); }
.settings-collapse { border-bottom: 1px solid var(--border); padding: 12px 0; }
.settings-collapse > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  user-select: none;
}
.settings-collapse > summary::-webkit-details-marker { display: none; }
.settings-collapse > summary::after { content: '›'; font-size: 16px; color: var(--muted); transition: transform .15s; }
.settings-collapse[open] > summary::after { transform: rotate(90deg); }
.settings-collapse-body { padding-top: 12px; display: flex; flex-direction: column; gap: 10px; }

.stage.is-empty .composer-footnote { display: none; }
.composer-footnote {
  margin-top: 8px;
  font-size: 11px;
  color: var(--muted);
  opacity: 0.6;
  text-align: center;
}

/* Popovers (Model Selector, Plus Menu, Slash Menu) */
.popover {
  display: none;
  position: absolute;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  padding: 6px;
  box-shadow: var(--popover-shadow);
  z-index: 60;
  min-width: 260px;
}
.popover.open { display: flex; flex-direction: column; gap: 2px; }
.mode-popover { top: calc(100% + 6px); left: 0; width: 224px; }
.plus-popover { bottom: calc(100% + 10px); left: 0; width: 210px; }

.pop-opt {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background .1s;
}
.pop-opt:hover { background: var(--surface-hover); }
.pop-opt.active { background: var(--surface-2); }
.pop-opt strong { display: block; font-size: 13.5px; font-weight: 500; }
.pop-opt span { display: block; font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.pop-opt .ic { color: var(--muted); }
.pop-opt:hover .ic { color: var(--text); }

.slash-menu {
  display: none;
  position: absolute;
  bottom: calc(100% + 10px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  padding: 6px;
  box-shadow: var(--popover-shadow);
  z-index: 55;
}
.slash-menu.open { display: flex; flex-direction: column; gap: 2px; }
.slash-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 11px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
}
.slash-item:hover { background: var(--surface-hover); }
.slash-item span { color: var(--muted); font-size: 12px; }

/* ---------- Full-Screen Live Voice Mode Overlay (Grok × ChatGPT Voice) ---------- */
.voice-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px 24px 40px;
}
.voice-top { display: flex; justify-content: space-between; align-items: center; }
.voice-brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; letter-spacing: 0.05em; }
.voice-center { display: flex; flex-direction: column; align-items: center; gap: 22px; text-align: center; padding: 0 16px; }
.voice-orb {
  width: 156px;
  height: 156px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform .25s ease, border-color .25s ease;
}
.voice-orb-core {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: var(--text);
  opacity: 0.9;
  transition: transform .25s ease, opacity .25s ease;
}
.voice-orb.listening { animation: orbListen 2.2s infinite ease-in-out; }
.voice-orb.speaking { animation: orbSpeak 0.9s infinite ease-in-out; border-color: var(--text); }
.voice-orb.thinking .voice-orb-core { opacity: 0.45; transform: scale(0.75); }
.voice-orb.muted .voice-orb-core { opacity: 0.2; transform: scale(0.65); }
@keyframes orbListen { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.07); } }
@keyframes orbSpeak { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.13); } }
.voice-status { font-size: 16px; font-weight: 500; color: var(--text); }
.voice-transcript { font-size: 14.5px; color: var(--muted); max-width: 520px; min-height: 44px; line-height: 1.5; }
.voice-controls-wrap { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.voice-picker-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; max-width: 440px; }
.voice-pill {
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}
.voice-pill:hover { background: var(--surface-hover); color: var(--text); }
.voice-pill.active { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); font-weight: 600; }
.mic-cancel-btn { color: var(--danger-tx); background: var(--danger-bg); }
.voice-controls { display: flex; justify-content: center; gap: 18px; }
.voice-ctrl-btn {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
}
.voice-ctrl-btn:hover { background: var(--surface-2); }
.voice-ctrl-btn.muted { background: var(--danger-bg); color: var(--danger-tx); border-color: transparent; }
.voice-end-btn { background: #DC2626; color: #FFFFFF; border-color: transparent; }
.voice-end-btn:hover { background: #B91C1C; }

/* ---------- Right Sheet (Drawer) ---------- */
.sheet {
  width: 0;
  overflow: hidden;
  background: var(--sidebar);
  border-left: 0 solid var(--border);
  display: flex;
  flex-direction: column;
  transition: width .18s ease;
}
.sheet.open { width: 390px; border-left-width: 1px; }
.sheet-head { height: 54px; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.sheet-title { font-weight: 600; font-size: 14.5px; }
.sheet-body { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; }

.panel-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 13px; }
.panel-card h4 { margin: 0 0 8px; font-size: 13.5px; font-weight: 600; }
.panel-card p { margin: 0 0 8px; font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.kpi-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.kpi-box { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 9px 10px; }
.kpi-val { font-size: 15px; font-weight: 600; color: var(--text); }
.kpi-lbl { font-size: 11px; color: var(--muted); margin-top: 2px; }

.btn-primary {
  padding: 8px 14px;
  border-radius: 10px;
  border: none;
  background: var(--accent);
  color: var(--accent-fg);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}
.btn-primary:hover { opacity: 0.88; }
.btn-ghost {
  padding: 6px 11px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-weight: 500;
  font-size: 12.5px;
  cursor: pointer;
}
.btn-ghost:hover { background: var(--surface-hover); border-color: var(--border-strong); }

.badge { display: inline-block; font-size: 11px; font-weight: 500; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; flex-shrink: 0; }
.badge.green { background: var(--emerald-soft); color: var(--emerald); }
.badge.amber { background: var(--amber-bg); color: var(--amber-tx); }

.thread-msg { padding: 9px 11px; border-radius: 11px; background: var(--bg); border: 1px solid var(--border); margin-bottom: 8px; font-size: 13px; }
.thread-msg.agent { border-color: var(--border-strong); background: var(--surface-2); }
.thread-msg-head { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); margin-bottom: 4px; }

.field-input, .fb-form input, .fb-form select, .fb-form textarea {
  width: 100%;
  padding: 8px 11px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-family: inherit;
  font-size: 13px;
  margin-bottom: 8px;
  background: var(--bg);
  color: var(--text);
  outline: none;
}
.fb-form input:focus, .fb-form textarea:focus { border-color: var(--border-strong); }
.diff-old { background: var(--danger-bg); color: var(--danger-tx); padding: 7px 10px; border-radius: 8px; font-size: 12.5px; margin: 5px 0; }
.diff-new { background: var(--emerald-soft); color: var(--emerald); padding: 7px 10px; border-radius: 8px; font-size: 12.5px; margin: 5px 0; }
.coach-hint-box { background: var(--surface-2); color: var(--text); padding: 8px 10px; border-radius: 9px; font-size: 12.5px; margin-top: 6px; }

.pin-modal-bg { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.65); display: grid; place-items: center; z-index: 99; }
.pin-modal { width: 92%; max-width: 360px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 18px; padding: 20px; box-shadow: var(--popover-shadow); }

.lightbox-bg {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 20px;
  z-index: 130;
}
.lightbox-img {
  max-width: 92vw;
  max-height: 82vh;
  border-radius: 14px;
  object-fit: contain;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
}
.lightbox-bar { display: flex; gap: 10px; align-items: center; }

/* ---------- ChatGPT-Style Centered Settings Modal (5 Tabs, Clean Rows, 0 Excess Text) ---------- */
.settings-backdrop {
  position: fixed;
  inset: 0;
  z-index: 110;
  background: rgba(0, 0, 0, 0.62);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.settings-modal {
  width: 100%;
  max-width: 720px;
  height: min(560px, 86vh);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  box-shadow: var(--popover-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.settings-head {
  height: 56px;
  padding: 0 18px 0 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.settings-head h2 { margin: 0; font-size: 16.5px; font-weight: 600; }
.settings-layout {
  flex: 1;
  min-height: 0;
  display: flex;
}
.settings-nav {
  width: 196px;
  flex-shrink: 0;
  padding: 12px 10px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--sidebar);
}
.settings-tab {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 450;
  cursor: pointer;
  text-align: left;
  transition: background .12s, color .12s;
}
.settings-tab:hover { background: var(--surface-hover); color: var(--text); }
.settings-tab.active { background: var(--surface-2); color: var(--text); font-weight: 500; }
.settings-content {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: 14px 22px 22px;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.settings-content::-webkit-scrollbar { width: 5px; }
.settings-content::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; }

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
}
.setting-row:last-child { border-bottom: none; }
.setting-row-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
}
.setting-row-col:last-child { border-bottom: none; }
.setting-lbl { font-size: 14px; font-weight: 500; color: var(--text); }
.setting-sub { font-size: 12px; color: var(--muted); }
.setting-seg {
  display: inline-flex;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 2px;
  gap: 2px;
}
.setting-seg button {
  padding: 5px 11px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.setting-seg button.active { background: var(--surface-2); color: var(--text); font-weight: 500; }
.toggle-pill {
  width: 40px;
  height: 22px;
  border-radius: 999px;
  border: none;
  background: var(--surface-2);
  position: relative;
  cursor: pointer;
  transition: background .15s;
  flex-shrink: 0;
}
.toggle-pill::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform .15s, background .15s;
}
.toggle-pill.on { background: var(--emerald); }
.toggle-pill.on::after { transform: translateX(18px); background: #FFFFFF; }

.settings-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 12.5px;
}
.settings-inline-form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.settings-inline-form input, .settings-inline-form select {
  padding: 7px 10px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  outline: none;
}
.settings-inline-form input:focus, .settings-inline-form select:focus { border-color: var(--border-strong); }
.settings-inline-form textarea {
  width: 100%;
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  outline: none;
}

.budget-bar { height: 6px; width: 100%; border-radius: 999px; background: var(--bg); overflow: hidden; border: 1px solid var(--border); }
.budget-bar-fill { height: 100%; background: var(--emerald); border-radius: 999px; }

.toast-host {
  position: fixed;
  top: 64px;
  right: 20px;
  left: auto;
  bottom: auto;
  transform: none;
  max-width: min(420px, calc(100vw - 32px));
  z-index: 150;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  pointer-events: none;
}
.toast-msg {
  padding: 10px 15px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-size: 13px;
  line-height: 1.4;
  max-width: 100%;
  word-break: break-word;
  box-shadow: var(--popover-shadow);
  animation: fadeToast .2s ease;
}
@keyframes fadeToast { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 720px) {
  .settings-backdrop { padding: 0; }
  .settings-modal { max-width: 100%; height: 100dvh; border-radius: 0; border: none; }
  .settings-layout { flex-direction: column; }
  .settings-nav {
    width: 100%;
    flex-direction: row;
    overflow-x: auto;
    scrollbar-width: none;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 8px 10px;
    gap: 4px;
  }
  .settings-nav::-webkit-scrollbar { display: none; }
  .settings-tab { width: auto; white-space: nowrap; padding: 7px 11px; font-size: 13px; }
  .settings-content { padding: 10px 16px 24px; }
}

/* iOS Safari / WKWebView fix (совместно с Mac Codex на реальном iPhone 15 Pro Max):
   16px на всех фокусируемых полях при сенсорном вводе предотвращает автозум iOS с сохранением pinch-zoom */
@media (pointer: coarse), (max-width: 900px) {
  .composer-box textarea {
    font-size: 16px !important;
    padding-block: 8px;
  }
  .sb-search,
  .field-input,
  .fb-form input,
  .fb-form select,
  .fb-form textarea,
  .settings-inline-form input,
  .settings-inline-form select,
  .settings-inline-form textarea,
  .user-edit-box textarea,
  .pin-modal input {
    font-size: 16px !important;
  }
}
.mem-updated-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  cursor: pointer;
  width: fit-content;
  margin-top: 2px;
}
.mem-updated-pill:hover { background: var(--surface-hover); color: var(--text); }

/* ---------- Responsive Mobile ---------- */
@media (max-width: 900px) {
  .mobile-only { display: inline-grid; }
  .sidebar {
    position: fixed;
    left: -280px;
    top: 0;
    bottom: 0;
    width: 260px !important;
    transition: left .2s ease;
    box-shadow: var(--popover-shadow);
  }
  .sidebar.open { left: 0; }
  .sidebar-backdrop.open { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.55); z-index: 25; }
  .sheet.open { position: fixed; right: 0; top: 0; bottom: 0; width: 100%; max-width: 400px; z-index: 35; box-shadow: var(--popover-shadow); }
  .stage-title-quiet { display: none; }
  .composer-dock { padding: 8px 12px calc(14px + env(safe-area-inset-bottom, 0px)); }
  .quick-prompts { gap: 5px; }
  .quick-prompt-btn { font-size: 12px; padding: 6px 10px; }
}

/* ASAR v11.2 — Всплывающая панель выделения фрагмента ответа (как в Cursor & ChatGPT Desktop) */
.sel-quote-bar {
  position: fixed;
  z-index: 95;
  display: none;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 10px;
  background: var(--surface-2, #1D1D22);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}
.sel-quote-bar.open { display: inline-flex; }
.sel-quote-bar button {
  border: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
}
.sel-quote-bar button:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* ASAR v14.5 — Инлайн-статус неотправленного вопроса и кнопка повтора (паритет со сборками iOS 12–17) */
.user-failure-bar {
  margin-top: 6px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  color: #FCA5A5;
}
.user-failure-reason {
  padding: 4px 10px;
  border-radius: 9px;
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.28);
  max-width: 520px;
}
.user-failure-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.user-failure-btn {
  height: 27px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2, #1D1D22);
  color: var(--text);
  font: inherit;
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
}
.user-failure-btn.primary {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

/* ASAR v14.6 — Индикатор живой синхронизации баз (1С · Банк · CRM · ПК) в шапке */
.vault-sync-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2, #1D1D22);
  color: var(--muted);
  font: inherit;
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
.vault-sync-pill:hover {
  color: var(--text);
  border-color: var(--text-dim, #52525B);
}
.vault-sync-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10B981;
  flex-shrink: 0;
}
.vault-sync-pill.has-alert .vault-sync-dot {
  background: #F59E0B;
}

/* ---------- ASAR v71.0: Эталонная полировка интерфейса data-aion-ui 7.2 (visual-refresh19 + размер текста + полный экран + панель ПК) ---------- */
:root {
  --reading-size: 15.5px;
}
html[data-text-size="compact"] { --reading-size: 14px; }
html[data-text-size="system"] { --reading-size: 15.5px; }
html[data-text-size="large"] { --reading-size: 17.5px; }

html[data-theme="dark"] {
  --bg: #0b0b0f;
  --sidebar: #141419;
  --surface: #1a1a21;
  --surface-2: #24242c;
  --toolbar-surface: #1a1a21;
  --text: #f2f2f7;
  --muted: #a6a6b5;
  --user-bubble: #252b46;
  --interactive: #aebfff;
  --accent: #aebfff;
  --accent-fg: #141a32;
  --border: #2c2c36;
  --border-strong: #41414d;
  --pill-shadow: none;
}

html[data-theme="light"] {
  --bg: #ffffff;
  --sidebar: #f8f8fa;
  --surface: #f6f6f8;
  --surface-2: #eeeef3;
  --toolbar-surface: #f6f6f8;
  --text: #15151a;
  --muted: #585864;
  --user-bubble: #e9edff;
  --interactive: #374e9c;
  --accent: #374e9c;
  --accent-fg: #ffffff;
  --border: #dedee6;
  --border-strong: #c5c6d0;
  --pill-shadow: none;
}

.stage-bar, .composer-dock, .stage, .feed { background-color: var(--bg); }
.library-links {
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-top: 1px solid var(--border);
  padding-top: 6px;
}
.sidebar.collapsed .library-links { display: none !important; }

.feed { gap: 18px; }
.feed .agent-text, .feed .user-bubble {
  font-size: var(--reading-size);
  line-height: 1.56;
}
.feed .agent-text p { margin: 0 0 0.65em; }
.feed .agent-text p:last-child { margin-bottom: 0; }
.feed .user-bubble {
  border-radius: 18px;
  padding: 10px 15px;
}

.composer-box {
  background: var(--toolbar-surface);
  border: 1px solid var(--border-strong);
  box-shadow: none;
  padding: 4px 6px;
  border-radius: 26px;
}
.composer-box:focus-within { border-color: var(--interactive); }
.composer-pill-row :is(#plusBtn, #micBtn, #sendBtn, #voiceModeBtn, #stopBtn) {
  width: 42px;
  height: 42px;
  min-width: 42px;
  min-height: 42px;
}

.empty-heading { gap: 10px; }
.empty-symbol svg { width: 32px; height: 32px; color: var(--interactive); opacity: 0.92; }

.stage.is-empty .quick-prompts {
  margin: 0 auto 12px;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  width: min(100%, 660px);
  max-width: 660px;
  gap: 8px;
}
.stage.is-empty .quick-prompt-btn {
  justify-content: center;
  min-height: 40px;
  padding: 8px 14px;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 450;
  white-space: nowrap;
}
.kb-filter-pill, .panel-card code { white-space: nowrap; }
.stage.is-empty .quick-prompt-btn:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
}
.quick-prompt-btn svg { color: var(--interactive); flex-shrink: 0; }

/* Регулятор размера текста в меню режима */
.reading-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 10px 8px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.reading-legend { font-size: 12px; color: var(--muted); font-weight: 500; }
.reading-size-group {
  display: inline-flex;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 2px;
  gap: 2px;
}
.reading-size-group button {
  width: 30px;
  height: 26px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
}
.reading-size-group button.active {
  background: var(--surface-2);
  color: var(--text);
}

/* Полноэкранный режим чтения разговора */
.fullscreen-actions[hidden] { display: none !important; }
.fullscreen-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  max-width: 780px;
  margin: 6px auto 0;
  padding: 4px 14px;
}
.fullscreen-actions button {
  min-height: 36px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
}
.fullscreen-actions button:hover { background: var(--surface-2); border-color: var(--border-strong); }
body.conversation-fullscreen .sidebar:not(.open),
body.conversation-fullscreen .stage-bar,
body.conversation-fullscreen #notifStrip { display: none !important; }
body.conversation-fullscreen:not(.fullscreen-writing) .composer-dock { display: none !important; }

/* Защитная СТОП-кнопка и карточки раздела «Компьютер» */
.pc-stop-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 13px;
  border-radius: 13px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
}
.pc-stop-banner.stopped {
  border-color: rgba(248, 113, 113, 0.45);
  background: var(--danger-bg);
}
.btn-danger {
  padding: 7px 13px;
  border-radius: 9px;
  border: none;
  background: #dc2626;
  color: #ffffff;
  font-weight: 600;
  font-size: 12.5px;
  cursor: pointer;
}
.btn-danger:hover { background: #b91c1c; }

@media (max-width: 560px) {
  .stage.is-empty .quick-prompts { grid-template-columns: 1fr; }
}


/* ---------- ASAR v144: 5-Tops UX (Claude Split-Screen Artifacts, Perplexity Sources, ChatGPT Code Cards, Cursor Ctrl+K, Jodi PC Status) ---------- */
.pc-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-left: auto;
  background: var(--border-strong);
  flex-shrink: 0;
  transition: background .2s, box-shadow .2s;
}
.pc-status-dot.online {
  background: var(--emerald);
  box-shadow: 0 0 0 3px var(--emerald-soft);
}
.pc-status-dot.warn {
  background: var(--amber-tx);
  box-shadow: 0 0 0 3px var(--amber-bg);
}
.pc-status-dot.stopped {
  background: var(--danger-tx);
  box-shadow: 0 0 0 3px var(--danger-bg);
}
.sidebar.collapsed .pc-status-dot { display: none; }

/* Perplexity-style Sources Strip */
.sources-strip {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 4px 0 12px;
}
.sources-label {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
}
.sources-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}
.source-card {
  flex: 0 0 210px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  transition: border-color .15s, background .15s, transform .15s;
}
.source-card:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
  transform: translateY(-1px);
}
.source-card-domain {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--muted);
}
.source-card-num {
  width: 17px;
  height: 17px;
  border-radius: 5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: inline-grid;
  place-items: center;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text);
}
.source-card-title {
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ChatGPT-style Code Execution Block */
.code-exec-card {
  margin: 8px 0 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  overflow: hidden;
}
.code-exec-card > summary {
  padding: 9px 13px;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  list-style: none;
  user-select: none;
}
.code-exec-card > summary::-webkit-details-marker { display: none; }
.code-exec-meta { font-size: 11.5px; font-weight: 500; color: var(--emerald); }
.code-exec-body {
  border-top: 1px solid var(--border);
  padding: 10px 13px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.code-exec-pre {
  margin: 0;
  padding: 9px 11px;
  border-radius: 9px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
  overflow-x: auto;
  max-height: 220px;
  white-space: pre-wrap;
}
.code-exec-out {
  padding: 8px 11px;
  border-radius: 9px;
  background: var(--emerald-soft);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Claude-style Split-Screen Artifact Canvas */
.artifact-pane {
  display: none;
  width: 46%;
  min-width: 420px;
  max-width: 780px;
  flex-shrink: 0;
  border-left: 1px solid var(--border);
  background: var(--sidebar);
  flex-direction: column;
  height: 100%;
  z-index: 20;
}
.artifact-pane.open { display: flex; }
.artifact-pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.artifact-pane-title {
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.artifact-pane-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.artifact-pane-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}
.artifact-pane-iframe {
  width: 100%;
  flex: 1;
  min-height: 480px;
  border: none;
  background: #ffffff;
}
.artifact-pane-code {
  margin: 0;
  padding: 16px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.artifact-pane-doc {
  padding: 20px 24px;
  max-width: 760px;
  line-height: 1.6;
}
@media (max-width: 1020px) {
  .artifact-pane.open {
    position: fixed;
    inset: 0;
    width: 100%;
    min-width: 0;
    max-width: none;
    z-index: 60;
  }
}

/* Cursor / Raycast Ctrl+K Command Palette */
.cmdk-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(0, 0, 0, 0.56);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: min(14vh, 110px);
}
.cmdk-box {
  width: min(580px, calc(100vw - 24px));
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  box-shadow: var(--popover-shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.cmdk-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.cmdk-input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 14.5px;
  outline: none;
}
.cmdk-kbd {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  color: var(--muted);
  font-family: inherit;
}
.cmdk-list {
  max-height: 360px;
  overflow-y: auto;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cmdk-group {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 8px 10px 4px;
}
.cmdk-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 11px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  font-size: 13.5px;
}
.cmdk-item:hover, .cmdk-item.active {
  background: var(--surface-hover);
}
.cmdk-item-hint {
  font-size: 11.5px;
  color: var(--muted);
}


/* ---------- ASAR v147: Projects Bar (Claude Projects) & Multi-Provider Pool UI ---------- */
.projects-bar {
  display: flex;
  align-items: center;
  gap: 5px;
  overflow-x: auto;
  padding: 2px 4px 6px;
  scrollbar-width: none;
}
.projects-bar::-webkit-scrollbar { display: none; }
.proj-chip {
  flex-shrink: 0;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, color .15s, border-color .15s;
}
.proj-chip:hover { background: var(--surface-hover); color: var(--text); }
.proj-chip.active { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }
.proj-chip.add { border-style: dashed; }

.policy-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
@media (max-width: 720px) { .policy-grid { grid-template-columns: 1fr; } }
.policy-card {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.policy-card.active {
  border-color: var(--emerald);
  background: var(--emerald-soft);
}
.policy-card strong { font-size: 12.5px; line-height: 1.3; }
.policy-card span { font-size: 11.5px; color: var(--muted); line-height: 1.35; overflow-wrap: anywhere; }
.prov-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--bg);
  flex-wrap: wrap;
}
.prov-meta { display: flex; flex-direction: column; gap: 3px; min-width: 180px; flex: 1; }
.prov-meta strong { font-size: 13px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.prov-meta span { font-size: 11.5px; color: var(--muted); }

/* ---------- ASAR v148: Clean Modals & Jodi-Style Header Live PC Pill ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 160;
  background: rgba(10, 14, 22, 0.48);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-card {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.28);
}
.header-pc-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.header-pc-pill:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.header-pc-pill .pc-dot-mini {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.22);
  flex-shrink: 0;
}
.header-pc-pill.stopped .pc-dot-mini { background: #ef4444; box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.22); }
@media (max-width: 640px) {
  .header-pc-pill { padding: 0 8px; font-size: 11.5px; height: 28px; }
}

/* ========== ChatGPT × Grok 2026 Upgrade: Model Picker, Search/Think Pills, Collapsible Reasoning, Sources & Clean Settings ========== */
.mode-popover {
  width: min(332px, calc(100vw - 24px)) !important;
  max-height: min(76dvh, 560px);
  overflow-y: auto;
  border-radius: 18px !important;
  padding: 8px !important;
}
.model-picker-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  padding: 6px 10px 4px;
}
.model-picker-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.model-choice-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 9px 11px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background .12s;
}
.model-choice-btn:hover { background: var(--surface-hover); }
.model-choice-btn.active { background: var(--surface-2); }
.model-choice-main { min-width: 0; flex: 1; }
.model-choice-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}
.model-choice-prov {
  font-size: 10.5px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  color: var(--muted);
}
.model-choice-sub {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.3;
}
.model-choice-check {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  color: var(--text);
  opacity: 0;
  flex-shrink: 0;
}
.model-choice-btn.active .model-choice-check { opacity: 1; }

/* Composer Search & Think Pills (1-to-1 ChatGPT × Grok) */
.composer-tools-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 2px 8px 5px;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}
.composer-tools-bar::-webkit-scrollbar { display: none; }
.composer-tools-left {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.composer-tool-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background .14s, color .14s, border-color .14s;
}
.composer-tool-pill:hover {
  background: var(--surface-hover);
  color: var(--text);
  border-color: var(--border-strong);
}
.composer-tool-pill svg { width: 14px; height: 14px; flex-shrink: 0; }
.composer-tool-pill.active[data-pill="search"] {
  background: rgba(56, 189, 248, 0.14);
  border-color: rgba(56, 189, 248, 0.45);
  color: #38bdf8;
}
html[data-theme="light"] .composer-tool-pill.active[data-pill="search"] {
  background: rgba(2, 132, 199, 0.11);
  border-color: rgba(2, 132, 199, 0.4);
  color: #0284c7;
}
.composer-tool-pill.active[data-pill="think"] {
  background: rgba(168, 85, 247, 0.14);
  border-color: rgba(168, 85, 247, 0.45);
  color: #c084fc;
}
html[data-theme="light"] .composer-tool-pill.active[data-pill="think"] {
  background: rgba(126, 34, 206, 0.1);
  border-color: rgba(126, 34, 206, 0.35);
  color: #7e22ce;
}
.composer-model-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
.composer-model-chip:hover { background: var(--surface-hover); color: var(--text); }

/* Collapsible Reasoning Block (ChatGPT o3 / Grok Think style) */
.thinking-card {
  margin: 0 0 10px;
  border-radius: 13px;
  border: 1px solid var(--border);
  background: var(--surface);
  overflow: hidden;
}
.thinking-card > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  user-select: none;
}
.thinking-card > summary::-webkit-details-marker { display: none; }
.thinking-card > summary::after {
  content: '▾';
  margin-left: auto;
  font-size: 12px;
  transition: transform .15s ease;
}
.thinking-card:not([open]) > summary::after { transform: rotate(-90deg); }
.thinking-card.is-streaming > summary { color: var(--text); }
.thinking-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
}
.thinking-card.is-streaming .thinking-dot {
  background: #c084fc;
  animation: pulse 1.1s infinite ease-in-out;
}
.thinking-body {
  padding: 2px 14px 12px;
  border-top: 1px solid var(--border);
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--muted);
  max-height: 280px;
  overflow-y: auto;
  white-space: pre-wrap;
}
.thinking-body p { margin: 6px 0; }

/* Clickable Internet Sources Strip (ChatGPT Search Pills) */
.sources-strip {
  margin: 10px 0 4px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sources-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.sources-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.source-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 260px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  text-decoration: none;
  transition: background .12s, border-color .12s;
}
.source-pill:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
}
.source-pill-domain {
  font-weight: 600;
  color: var(--text);
  flex-shrink: 0;
}
.source-pill-title {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Subtle Model Badge in Message Actions */
.msg-model-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: var(--muted);
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  margin-right: 4px;
}

/* 1-to-1 ChatGPT × Grok Clean Settings Modal */
.settings-modal {
  width: min(720px, calc(100vw - 20px)) !important;
  max-height: min(620px, calc(100dvh - 24px)) !important;
  border-radius: 22px !important;
  background: var(--surface) !important;
  border: 1px solid var(--border-strong) !important;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.settings-head {
  padding: 16px 20px !important;
  border-bottom: 1px solid var(--border) !important;
}
.settings-head h2 {
  font-size: 17px !important;
  font-weight: 600 !important;
  margin: 0;
}
.settings-layout {
  display: flex;
  flex: 1;
  min-height: 0;
}
.settings-nav {
  width: 204px;
  flex-shrink: 0;
  padding: 12px 10px !important;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow-y: auto;
}
.settings-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px !important;
  border-radius: 10px !important;
  font-size: 13.5px !important;
  font-weight: 500;
  color: var(--muted);
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
}
.settings-tab:hover { background: var(--surface-hover); color: var(--text); }
.settings-tab.active { background: var(--surface-2); color: var(--text); font-weight: 600; }
.settings-content {
  flex: 1;
  padding: 16px 22px 24px !important;
  overflow-y: auto;
}
.cg-section-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 14px 0 6px;
}
.cg-section-title:first-child { margin-top: 0; }
.cg-card-group {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg);
  overflow: hidden;
  margin-bottom: 14px;
}
.cg-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
}
.cg-row:last-child { border-bottom: 0; }
.cg-row-meta { min-width: 0; flex: 1; }
.cg-row-title { font-size: 14px; font-weight: 500; color: var(--text); }
.cg-row-desc { font-size: 12px; color: var(--muted); margin-top: 2px; line-height: 1.35; }
.cg-field-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
}
.cg-field-stack label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
}
.cg-field-stack input, .cg-field-stack textarea, .cg-field-stack select {
  width: 100%;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
}
.cg-field-stack textarea { resize: vertical; min-height: 74px; line-height: 1.45; }
.cg-model-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 12px 15px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background .12s;
}
.cg-model-card:last-child { border-bottom: 0; }
.cg-model-card:hover { background: var(--surface-hover); }
.cg-model-card.active { background: var(--surface-2); }
.cg-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--emerald);
  display: inline-block;
  margin-right: 5px;
}
@media (max-width: 700px) {
  .settings-modal {
    width: 100vw !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    border-radius: 0 !important;
    border: 0 !important;
  }
  .settings-layout { flex-direction: column; }
  .settings-nav {
    width: 100%;
    flex-direction: row;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    padding: 8px 12px !important;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .settings-nav::-webkit-scrollbar { display: none; }
  .settings-tab { white-space: nowrap; flex-shrink: 0; padding: 8px 12px !important; }
  .settings-content { padding: 14px 16px 28px !important; }
  .cg-row { flex-wrap: wrap; }
}

/* ASAR v154.0 — Second Opinion («Второе мнение») & Command Center («Командный пульт») */
.verify-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.verify-pill-btn:hover { background: var(--surface-2); border-color: var(--emerald); }
.verify-pill-btn:disabled { opacity: .6; cursor: wait; }

.regen-model-select {
  height: 26px;
  max-width: 148px;
  padding: 0 7px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 11.5px;
  cursor: pointer;
  outline: none;
}
.regen-model-select:hover, .regen-model-select:focus { color: var(--text); border-color: var(--border-strong); }

.verify-card {
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  font-size: 13px;
  line-height: 1.5;
}
.verify-card.verified { border-color: rgba(16, 185, 129, 0.45); background: linear-gradient(180deg, rgba(16, 185, 129, 0.08), var(--surface)); }
.verify-card.caution { border-color: rgba(245, 158, 11, 0.45); background: linear-gradient(180deg, rgba(245, 158, 11, 0.08), var(--surface)); }
.verify-card.error_found { border-color: rgba(239, 68, 68, 0.48); background: linear-gradient(180deg, rgba(239, 68, 68, 0.09), var(--surface)); }
.verify-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
  font-size: 12px;
}
.verify-verdict-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 11.5px;
}
.verify-card.verified .verify-verdict-badge { background: rgba(16, 185, 129, 0.16); color: #10B981; }
.verify-card.caution .verify-verdict-badge { background: rgba(245, 158, 11, 0.16); color: #F59E0B; }
.verify-card.error_found .verify-verdict-badge { background: rgba(239, 68, 68, 0.16); color: #EF4444; }
.verify-checks-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.verify-check-pill { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.verify-check-pill.fail { background: rgba(239, 68, 68, 0.16); color: #EF4444; }

.cmd-kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.cmd-kpi-box {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
}
.cmd-kpi-lbl { font-size: 11px; color: var(--muted); }
.cmd-kpi-val { font-size: 19px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.cmd-dept-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
}
.cmd-dept-row:last-child { border-bottom: 0; }
.cmd-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--text);
}
.cmd-pill.warn { background: rgba(245, 158, 11, 0.18); color: #F59E0B; }
.cmd-pill.ok { background: rgba(16, 185, 129, 0.18); color: #10B981; }
.cmd-pill.danger { background: rgba(239, 68, 68, 0.18); color: #EF4444; }

/* ASAR v157.0 — 1-to-1 ChatGPT Clean Simplicity + Commercial Billing Modal */
:root, html[data-theme="dark"] {
  --bg: #212121;
  --sidebar: #171717;
  --surface: #2F2F2F;
  --surface-2: #383838;
  --surface-hover: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.15);
}
html[data-theme="light"] {
  --bg: #FFFFFF;
  --sidebar: #F9F9F9;
  --surface: #F4F4F4;
  --surface-2: #ECECEC;
  --surface-hover: rgba(0, 0, 0, 0.045);
  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.14);
}
.cg-hidden-tech, #headerBridgesPill { display: none !important; }
.stage-bar {
  height: 52px;
  padding: 0 16px;
  border-bottom: none !important;
  background: transparent !important;
}
.mode-trigger {
  font-size: 16px !important;
  font-weight: 600 !important;
  padding: 7px 11px !important;
  border-radius: 10px !important;
  border: none !important;
  background: transparent !important;
}
.mode-trigger:hover { background: var(--surface-hover) !important; }
.cg-header-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 13px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background .14s;
}
.cg-header-pill:hover { background: var(--surface-hover); }
.sb-billing-cta {
  border: 1px solid var(--border-strong) !important;
  background: var(--surface-hover) !important;
  border-radius: 11px !important;
  padding: 9px 11px !important;
  margin-bottom: 4px;
}
.sb-billing-cta:hover { background: var(--surface-2) !important; }
.composer-box {
  border-radius: 26px !important;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.22);
  border: 1px solid var(--border-strong) !important;
}
.feed {
  max-width: 780px;
  width: 100%;
  margin: 0 auto;
}
.msg-actions {
  opacity: 0.68;
  transition: opacity .15s;
}
.msg-row:hover .msg-actions, .msg-actions:focus-within { opacity: 1; }
.user-bubble {
  border-radius: 20px !important;
  padding: 10px 16px !important;
  background: var(--surface) !important;
}

.billing-modal-card {
  width: min(760px, 100%);
  max-height: min(86dvh, 720px);
  display: flex;
  flex-direction: column;
  background: var(--sidebar);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
}
.billing-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.billing-tabs {
  display: flex;
  gap: 6px;
  padding: 10px 20px 0;
  border-bottom: 1px solid var(--border);
}
.bill-tab {
  padding: 8px 14px 10px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.bill-tab.active { color: var(--text); border-bottom-color: var(--text); }
.billing-modal-body {
  padding: 18px 20px 22px;
  overflow-y: auto;
}
.bill-balance-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  flex-wrap: wrap;
}
.bill-plans-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.bill-plan-card {
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}
.bill-plan-card.active { border-color: #10B981; }
@media (max-width: 620px) {
  .bill-plans-grid { grid-template-columns: 1fr; }
}

/* ASAR v158.0 — Team & Project Ecosystem Hub (Light & Dark parity) */
.phub-modal-card {
  width: min(980px, 96vw);
  max-height: min(88dvh, 780px);
  display: flex;
  flex-direction: column;
  background: var(--sidebar);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
}
.phub-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.phub-tabs {
  display: flex;
  gap: 6px;
  padding: 8px 20px 0;
  border-bottom: 1px solid var(--border);
}
.phub-body {
  padding: 16px 20px 22px;
  overflow-y: auto;
  flex: 1;
}
.phub-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  font-size: 13.5px;
}
.phub-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.phub-card {
  padding: 13px 15px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.phub-card-click {
  cursor: pointer;
  transition: border-color .14s, background .14s, transform .08s;
}
.phub-card-click:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
}
.phub-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--border);
}
.phub-pill.green { color: #10B981; border-color: rgba(16, 185, 129, 0.35); background: rgba(16, 185, 129, 0.12); }
.phub-pill.amber { color: #F59E0B; border-color: rgba(245, 158, 11, 0.35); background: rgba(245, 158, 11, 0.12); }
.phub-pill.red { color: #EF4444; border-color: rgba(239, 68, 68, 0.35); background: rgba(239, 68, 68, 0.12); }
.phub-progress {
  height: 6px;
  width: 100%;
  border-radius: 999px;
  background: var(--bg);
  overflow: hidden;
  border: 1px solid var(--border);
}
.phub-progress > div {
  height: 100%;
  background: #10B981;
  border-radius: 999px;
  transition: width .25s ease;
}
.phub-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.phub-sm-btn {
  height: 32px !important;
  padding: 0 12px !important;
  font-size: 12.5px !important;
  border-radius: 9px !important;
  white-space: nowrap;
}
.phub-inline-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.phub-inline-form input, .phub-inline-form select {
  height: 34px;
  padding: 0 10px;
  border-radius: 9px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
}
.phub-kanban {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.phub-col {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 10px;
  min-height: 220px;
}
.phub-col-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}
.phub-col-cnt {
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--bg);
  color: var(--muted);
  font-size: 11px;
}
.phub-col-list { display: flex; flex-direction: column; gap: 8px; }
.phub-task-card {
  padding: 9px 10px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
}
.phub-prio {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--muted);
}
.phub-prio.p0 { color: #EF4444; background: rgba(239, 68, 68, 0.14); }
.phub-prio.p1 { color: #F59E0B; background: rgba(245, 158, 11, 0.14); }
.phub-prio.p2 { color: #10B981; background: rgba(16, 185, 129, 0.14); }
.phub-icon-x {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 0 3px;
}
.phub-icon-x:hover { color: #EF4444; }
.phub-move-btn {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  border-radius: 7px;
  padding: 2px 7px;
  font-size: 11px;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
}
.phub-move-btn:hover { background: var(--surface-hover); }
@media (max-width: 860px) {
  .phub-kanban { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .phub-grid-2, .phub-kanban { grid-template-columns: 1fr; }
}

/* ASAR v159.0 — Active Project Strip in Chat */
.active-project-strip {
  max-width: 780px;
  width: calc(100% - 28px);
  margin: 8px auto 0;
  padding: 7px 12px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12.5px;
}
.aps-left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.aps-dot { width: 8px; height: 8px; border-radius: 50%; background: #10B981; flex-shrink: 0; }
.aps-meta { color: var(--muted); font-size: 11.5px; }
.aps-actions { display: flex; align-items: center; gap: 6px; }
.aps-btn {
  height: 26px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
}
.aps-btn:hover { background: var(--surface-hover); }

/* ASAR v164.0 — Prominent ASAR Studio & Free AI Pools (0 RUB) CTA */
.sb-cta-row {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
}
.sb-studio-cta {
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.16), rgba(14, 165, 233, 0.10)) !important;
  border: 1px solid rgba(99, 102, 241, 0.32) !important;
  font-weight: 600;
}
.sb-studio-cta:hover {
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.25), rgba(14, 165, 233, 0.16)) !important;
}
.sb-free-cta {
  background: rgba(16, 185, 129, 0.09) !important;
  border: 1px solid rgba(16, 185, 129, 0.26) !important;
}
.sb-free-cta:hover {
  background: rgba(16, 185, 129, 0.16) !important;
}
.sb-pill-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 999px;
  letter-spacing: 0.03em;
  flex-shrink: 0;
}
.sb-pill-badge.ide {
  background: rgba(99, 102, 241, 0.22);
  color: #818cf8;
}
.sb-pill-badge.free {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
}
html[data-theme="light"] .sb-pill-badge.ide {
  background: rgba(79, 70, 229, 0.14);
  color: #4338ca;
}
html[data-theme="light"] .sb-pill-badge.free {
  background: rgba(16, 185, 129, 0.15);
  color: #047857;
}
.cg-studio-pill {
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.16), rgba(14, 165, 233, 0.12)) !important;
  border-color: rgba(99, 102, 241, 0.42) !important;
  color: var(--text) !important;
  font-weight: 600 !important;
}
.cg-studio-pill:hover {
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.26), rgba(14, 165, 233, 0.18)) !important;
}
.model-choice-prov.is-free {
  background: rgba(16, 185, 129, 0.16);
  color: #10b981;
  padding: 1px 6px;
  border-radius: 999px;
  font-weight: 700;
}
.model-picker-free-cta {
  width: 100%;
  margin-top: 6px;
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px dashed rgba(16, 185, 129, 0.45);
  background: rgba(16, 185, 129, 0.08);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}
.model-picker-free-cta:hover {
  background: rgba(16, 185, 129, 0.16);
}

/* ASAR v167.0: Универсальная кнопка-крестик закрытия модальных окон */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  transition: background .12s, color .12s, border-color .12s;
}
.icon-btn:hover {
  background: var(--surface-2, rgba(255,255,255,.06));
  color: var(--text);
  border-color: var(--border-strong);
}

/* ============================================================================
   ASAR v168.0 — ChatGPT × Grok Pure Minimalism (Zero Clutter, Pure Signal)
   ============================================================================ */

/* 1. Чистый пустой экран как в ChatGPT — только спокойный заголовок без лишней иконки */
.empty-symbol {
  display: none !important;
}
.stage.is-empty .empty-heading {
  gap: 0;
  margin-bottom: 24px;
}
.stage.is-empty .empty-heading h1 {
  font-size: clamp(24px, 3vw, 30px);
  font-weight: 500;
  letter-spacing: -0.025em;
  color: var(--text);
}

/* 2. Спокойные капсулы подсказок под композером (как в ChatGPT) */
.stage.is-empty .quick-prompts {
  gap: 8px;
  margin-top: 14px;
  justify-content: center;
}
.quick-prompt-btn {
  border-radius: 999px !important;
  padding: 7px 14px !important;
  font-size: 13px !important;
  font-weight: 450 !important;
  background: transparent !important;
  border: 1px solid var(--border) !important;
  color: var(--muted) !important;
  transition: background .14s, color .14s, border-color .14s;
}
.quick-prompt-btn:hover {
  background: var(--surface) !important;
  border-color: var(--border-strong) !important;
  color: var(--text) !important;
}

/* 3. Чистая кнопка ASAR Studio в сайдбаре и шапке (без кричащих бейджей и градиентов) */
.sb-studio-clean {
  font-weight: 500;
}
.cg-studio-pill {
  background: transparent !important;
  border: 1px solid var(--border-strong) !important;
  color: var(--text) !important;
  font-size: 12.5px !important;
  font-weight: 500 !important;
  padding: 5px 12px !important;
  border-radius: 999px !important;
  box-shadow: none !important;
  transition: background .14s, border-color .14s;
}
.cg-studio-pill:hover {
  background: var(--surface) !important;
}

/* 4. Убираем дубль нижнего этажа сайдбара и даём воздуху дышать */
.sb-footer {
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.profile-popover {
  min-width: 248px;
  padding: 6px;
}
.profile-popover .pop-opt {
  padding: 8px 10px;
  border-radius: 9px;
}

/* 5. Чистый композер ChatGPT × Grok — без двойного выбора модели */
.composer-tools-bar {
  padding: 4px 10px 8px 12px;
  justify-content: flex-start;
}

/* 6. Компактная полоска действий под ответом ИИ + меню «···» (как у ChatGPT & Grok) */
.msg-actions {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-top: 6px;
  position: relative;
}
.msg-model-tiny {
  font-size: 11px;
  color: var(--muted);
  margin-left: 8px;
  opacity: 0.72;
  user-select: none;
}
.msg-more-wrap {
  position: relative;
  display: inline-flex;
}
.msg-more-btn {
  font-weight: 700;
  letter-spacing: 1px;
  font-size: 13px;
}
.msg-more-menu {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  min-width: 215px;
  padding: 6px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
  z-index: 60;
  flex-direction: column;
  gap: 2px;
}
.msg-more-menu.open {
  display: flex;
}
.msg-more-opt {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
  padding: 7px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .12s;
}
.msg-more-opt:hover {
  background: var(--surface-2, rgba(128, 128, 128, 0.14));
}
.msg-more-select {
  width: 100%;
  margin-top: 4px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 12px;
}

/* ASAR v169.0 — Встроенный Split-Screen «Чат + Код» (ChatGPT Canvas × Cursor) */
.inline-canvas-wrap {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}
.inline-canvas-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.inline-canvas-tabs {
  display: inline-flex;
  gap: 4px;
}
.inline-ctab {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  border-radius: 7px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
}
.inline-ctab.active {
  background: var(--surface-2, rgba(128,128,128,.16));
  color: var(--text);
  border-color: var(--border-strong);
  font-weight: 600;
}
.inline-canvas-actions {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}
.inline-canvas-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.inline-canvas-iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
  flex: 1;
}
.inline-canvas-files-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.inline-file-pill {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 11.5px;
  font-family: var(--mono, monospace);
  cursor: pointer;
}
.inline-file-pill.active {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--surface-2, rgba(128,128,128,.16));
}
.inline-canvas-code {
  flex: 1;
  margin: 0;
  padding: 12px;
  overflow: auto;
  font-size: 12px;
  line-height: 1.5;
  font-family: var(--mono, monospace);
  color: var(--text);
  background: var(--bg);
}
