/* ============================================================================
   uiux.css — Phase 23: чат-UX уровня Claude на светлой Kimi-палитре.

   Грузится ПОСЛЕДНИМ (после app.css → minimal.css → kimi-light.css → spaces.css)
   и добирает то, что токен-флип не мог: структуру сайдбара (новый чат, «Ещё»,
   карточка юзера), welcome-приветствие, композер с кнопкой режимов, карточки
   кода, панель Артефактов. Палитра — токены из kimi-light.css (#1783FF).
   Откат = снять <link>. `!important` — только против дублей app.css.
   ============================================================================ */

/* ── 1. Сайдбар ──────────────────────────────────────────────────────────── */

#sidebar { background: var(--bg-nav); }

.sidebar-header { padding: 14px 14px 6px; }
.sidebar-brand .brand-logo {
  background: var(--accent); color: #fff; border-radius: 9px;
  font-weight: 700; box-shadow: none;
}

/* Главное действие — как у Claude: заметная кнопка сверху */
.new-chat-main {
  display: flex; align-items: center; gap: 8px;
  margin: 8px 12px 10px; padding: 9px 13px; width: calc(100% - 24px);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
  border-radius: 11px; background: var(--accent-soft);
  color: var(--accent-text); font-size: 13.5px; font-weight: 600; cursor: pointer;
  transition: background .12s ease, border-color .12s ease;
}
.new-chat-main:hover { background: color-mix(in srgb, var(--accent) 16%, transparent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.new-chat-main svg { flex: none; }

.sidebar-nav { padding: 0 8px; gap: 1px; }
.nav-item {
  border-radius: 9px; padding: 8px 10px; font-size: 13.5px;
  color: var(--text-secondary);
}
.nav-item .nav-icon { color: var(--text-muted); }
.nav-item.active { background: var(--bg-active); color: var(--text); font-weight: 600; }
.nav-item.active .nav-icon { color: var(--accent); }

/* «Ещё»-группа */
.nav-more-toggle { position: relative; }
.nav-more-toggle .nav-more-chevron {
  margin-left: auto; transition: transform .15s ease; color: var(--text-dim);
}
.nav-more-toggle.open .nav-more-chevron { transform: rotate(180deg); }
.nav-more-group { display: flex; flex-direction: column; gap: 1px; }
.nav-more-group[hidden] { display: none; }
.nav-more-group .nav-item { padding-left: 14px; }

/* Секции: живые Пространства + список чатов */
.sidebar-spaces { padding: 2px 8px 0; }
#sessions-section { padding: 4px 8px 0; }
.sessions-header { padding: 8px 6px 4px; }
.sessions-title {
  font-size: 11px; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: var(--text-dim);
}
.sessions-search input {
  border-radius: 9px; background: var(--bg-input); border: 1px solid transparent;
  font-size: 13px;
}
.sessions-search input:focus { border-color: color-mix(in srgb, var(--accent) 40%, transparent); background: var(--bg-card); }

/* Футер: тема/язык/выход + карточка юзера */
.sidebar-footer {
  padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 8px;
  border-top: 1px solid var(--border);
}
.sidebar-footer .sidebar-controls { display: flex; align-items: center; gap: 6px; }
.logout-icon-btn {
  margin-left: auto; width: 28px; height: 28px; display: grid; place-items: center;
  border: none; background: transparent; color: var(--text-muted);
  border-radius: 8px; cursor: pointer;
}
.logout-icon-btn:hover { background: var(--bg-hover); color: var(--red); }

.user-card {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 7px 8px; border: none; border-radius: 10px; background: transparent;
  cursor: pointer; text-align: left; transition: background .12s ease;
}
.user-card:hover { background: var(--bg-hover); }
.user-card-avatar {
  width: 30px; height: 30px; flex: none; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 12.5px; font-weight: 700;
  display: grid; place-items: center; letter-spacing: .02em;
}
.user-card-info { display: flex; flex-direction: column; min-width: 0; }
.user-card-name {
  font-size: 13px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-card-tier { font-size: 11px; color: var(--text-muted); text-transform: capitalize; }

/* ── 2. Топбар ───────────────────────────────────────────────────────────── */

#topbar { border-bottom: 1px solid var(--border); background: var(--bg); }
#tab-title { font-size: 14.5px; font-weight: 600; }
#session-name { color: var(--text-muted); font-size: 13px; }

.quota-wrap { position: relative; }
.quota-chip {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--bg-card); color: var(--text-muted);
  font-size: 12px; font-variant-numeric: tabular-nums; font-weight: 500;
  padding: 4px 10px 4px 6px; cursor: pointer; max-width: 220px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.quota-chip:hover, .quota-chip[aria-expanded="true"] {
  border-color: var(--border-light); background: var(--bg-hover); color: var(--text);
}
.quota-chip.warn { color: #d49100; border-color: color-mix(in srgb, #d49100 40%, var(--border)); }
.quota-chip.danger { color: #c0392b; border-color: color-mix(in srgb, #c0392b 40%, var(--border)); }
.quota-chip-ring { flex: none; display: grid; place-items: center; width: 16px; height: 16px; }
.quota-chip-ring .q-track { stroke: var(--border-light, #d8dbe2); }
.quota-chip-ring .q-fill { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset .35s ease; }
.quota-chip.warn .q-fill { stroke: #d49100; }
.quota-chip.danger .q-fill { stroke: #c0392b; }
#usage-bar { display: none !important; }
#quota-chip-text { overflow: hidden; text-overflow: ellipsis; }
.quota-pop {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 80;
  width: 260px; padding: 12px 12px 10px;
  background: var(--bg-card); color: var(--text);
  border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 12px 32px -12px rgba(0,0,0,.35);
}
.quota-pop.hidden { display: none; }
.qp-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
#qp-tier { font-size: 13px; font-weight: 650; text-transform: capitalize; }
.qp-sub { font-size: 11px; color: var(--text-dim); letter-spacing: .04em; text-transform: uppercase; }
.qp-rows { display: flex; flex-direction: column; gap: 9px; }
.qp-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; align-items: center; }
.qp-label { font-size: 12px; color: var(--text-secondary); }
.qp-num { font-size: 12px; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text); }
.qp-bar { grid-column: 1 / -1; height: 5px; border-radius: 99px; background: var(--bg-hover); overflow: hidden; }
.qp-bar > i { display: block; height: 100%; border-radius: inherit; background: var(--accent); min-width: 0; }
.qp-row.warn .qp-bar > i { background: #d49100; }
.qp-row.danger .qp-bar > i { background: #c0392b; }
.qp-row.locked .qp-num { color: var(--text-dim); font-weight: 500; }
.qp-rpm { margin-top: 8px; font-size: 11.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.qp-more {
  display: block; width: 100%; margin-top: 10px; padding: 6px 0;
  border: none; background: none; color: var(--accent);
  font-size: 12.5px; font-weight: 600; cursor: pointer; text-align: center;
}
.qp-more:hover { text-decoration: underline; }
@media (max-width: 640px) {
  .quota-chip { max-width: 112px; padding: 4px 8px 4px 5px; }
  .quota-pop { width: min(260px, calc(100vw - 24px)); right: -8px; }
}
.model-picker-trigger {
  border: 1px solid var(--border); border-radius: 999px; background: var(--bg-card);
  font-size: 13px; padding: 6px 12px;
}
.model-picker-trigger:hover { border-color: var(--border-light); background: var(--bg-hover); }
.mp-hint {
  margin: 8px 4px 0; padding: 8px 10px;
  font-size: 12.5px; line-height: 1.45; color: var(--text-muted);
  background: var(--bg-nav); border-radius: 8px;
}

/* ── 3. Welcome ──────────────────────────────────────────────────────────── */

#welcome { padding-top: 16vh !important; gap: 10px; }
#welcome .welcome-icon {
  width: 46px !important; height: 46px !important; border-radius: 50% !important;
  background: var(--accent-soft) !important; color: var(--accent) !important;
  box-shadow: none !important; display: grid; place-items: center;
}
#welcome h2 {
  font-size: 30px !important; font-weight: 600; letter-spacing: -0.02em; color: var(--text);
}
#welcome .welcome-hint { display: block; font-size: 14px; } /* app.css:4361 прятал все #welcome p */
#welcome .welcome-hint code {
  background: var(--bg-code); border: 1px solid var(--border);
  border-radius: 5px; padding: 1px 5px; font-size: 12.5px;
}
#welcome .welcome-chips { margin-top: 14px; max-width: 620px; }
#welcome .welcome-chip { color: var(--text-secondary); }
#welcome .welcome-chip:hover { color: var(--text); background: var(--accent-soft) !important; }
#welcome .welcome-chip-icon { display: inline-flex; }
#welcome .welcome-chip-icon svg { display: block; }

/* ── 4. Композер ─────────────────────────────────────────────────────────── */

#input-area { max-width: 780px; }
#input-wrapper {
  border-radius: 22px !important;
  box-shadow: 0 1px 2px rgba(15,23,42,.04), 0 8px 28px -18px rgba(15,23,42,.28) !important;
}
#message-input { caret-color: var(--accent); }
#attach-btn, .modes-btn { color: var(--text-muted); }
#attach-btn:hover { color: var(--text); }

.modes-btn {
  order: 2; display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 11px; border: 1px solid var(--border);
  border-radius: 999px; background: transparent; font-size: 12.5px; cursor: pointer;
  transition: border-color .12s ease, background .12s ease;
}
.modes-btn:hover { background: var(--bg-hover); border-color: var(--border-light); }
.modes-btn.non-default { border-color: color-mix(in srgb, var(--accent) 45%, transparent); color: var(--accent-text); background: var(--accent-soft); }

/* Пилюли режимов: из вечной строки — в попап над композером */
/* Composer mode pills removed from product — Chat vs Agent is sidebar. */
#focus-mode-pills { display: none !important; }
#modes-btn { display: none !important; }
#input-area { position: relative; }

/* Agent surface toolbar (Kimi OK Computer / GPT agent — separate chrome) */
.agent-toolbar {
  display: none;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  max-width: 780px;
  margin: 0 auto 8px;
  padding: 0 4px;
}
body.surface-agent .agent-toolbar,
#app.surface-agent .agent-toolbar {
  display: flex;
}
.agent-toolbar[hidden] { display: none !important; }
body.surface-agent .agent-toolbar[hidden],
#app.surface-agent .agent-toolbar:not([hidden]) {
  /* unhide when surface applies and hidden attr cleared */
}
body.surface-agent #agent-toolbar:not([hidden]) {
  display: flex !important;
}
.agent-toolbar-badge {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--accent-text);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
  border-radius: 999px;
  padding: 4px 10px;
}
.agent-toolbar-hint {
  font-size: 12.5px;
  color: var(--text-muted);
  flex: 1;
  min-width: 12ch;
}
.agent-toolbar .fmp-pill {
  border-radius: 999px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text-secondary);
  padding: 6px 12px; font-size: 12.5px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  margin-left: auto;
}
.agent-toolbar .fmp-pill:hover { background: var(--bg-hover); }
.agent-toolbar .fmp-pill.active {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  color: var(--accent-text); font-weight: 600;
}

/* Soft accent on agent surface composer */
body.surface-agent #input-wrapper,
#app.surface-agent #input-wrapper {
  border-color: color-mix(in srgb, var(--accent) 28%, var(--border)) !important;
}

/* ── 5. Сообщения ────────────────────────────────────────────────────────── */

#messages { background: var(--bg); }
.msg-row { max-width: 780px; }
.msg-row.user .msg-content {
  background: var(--accent-soft) !important;
  border: 1px solid color-mix(in srgb, var(--accent) 16%, transparent) !important;
  border-radius: 16px 16px 4px 16px !important;
  color: var(--text) !important;
}
.msg-row.assistant .msg-content { font-size: 15.5px; }

.msg-content h1, .msg-content h2, .msg-content h3 { letter-spacing: -0.01em; }
.msg-content a { color: var(--accent-text); text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.msg-content table {
  border-collapse: separate; border-spacing: 0; width: 100%;
  border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
  font-size: 14px;
}
.msg-content table th {
  background: var(--bg-nav); font-weight: 600; text-align: left;
  padding: 8px 12px; border-bottom: 1px solid var(--border);
}
.msg-content table td { padding: 8px 12px; border-bottom: 1px solid var(--border); }
.msg-content table tr:last-child td { border-bottom: none; }
.msg-content blockquote {
  border-left: 3px solid color-mix(in srgb, var(--accent) 55%, transparent);
  background: var(--accent-soft); border-radius: 0 10px 10px 0;
  padding: 8px 14px; color: var(--text-secondary);
}

/* Карточка кода: спокойный header, скругление, разделитель */
.code-block-wrapper {
  border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
  margin: 10px 0; background: var(--bg-code);
}
.code-block-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 12px; background: var(--bg-nav) !important;
  border-bottom: 1px solid var(--border); border-radius: 0 !important;
}
.code-block-lang {
  font-family: ui-monospace, 'SF Mono', Consolas, monospace;
  font-size: 11.5px; color: var(--text-muted); text-transform: lowercase;
}
.code-block-copy, .code-block-artifact {
  border: none; background: transparent; color: var(--text-muted);
  font-size: 12px; cursor: pointer; padding: 3px 8px; border-radius: 6px;
}
.code-block-copy:hover, .code-block-artifact:hover { background: var(--bg-hover); color: var(--text); }
.code-block-copy.copied { color: var(--green); }
.code-block-artifact { color: var(--accent-text); font-weight: 600; }
.code-block-header-actions { display: flex; align-items: center; gap: 2px; }
.code-block-wrapper pre {
  margin: 0 !important; border: none !important; border-radius: 0 !important;
  background: var(--bg-code) !important; padding: 13px 15px !important;
  font-size: 13.5px; line-height: 1.6;
  overflow-x: auto; max-width: 100%;
}

/* Тумблеры темы/языка в футере — спокойный вид, активный = синий */
.sidebar-footer .theme-switcher, .sidebar-footer .lang-switcher {
  background: var(--bg-input); border-radius: 9px; padding: 2px; display: flex; gap: 1px;
}
.sidebar-footer .theme-btn, .sidebar-footer .lang-btn {
  border: none; background: transparent; color: var(--text-muted);
  width: 26px; height: 24px; border-radius: 7px; font-size: 12px; cursor: pointer;
  display: grid; place-items: center;
}
.sidebar-footer .theme-btn svg { display: block; }
.sidebar-footer .lang-btn { width: auto; padding: 0 7px; font-weight: 600; font-size: 11px; }
.sidebar-footer .theme-btn:hover, .sidebar-footer .lang-btn:hover { color: var(--text); background: var(--bg-hover); }
.sidebar-footer .theme-btn.active, .sidebar-footer .lang-btn.active {
  background: var(--bg-card); color: var(--accent-text) !important;
  box-shadow: 0 1px 2px rgba(15,23,42,.10);
}

/* ── 6. Панель Артефактов (Claude-style) ─────────────────────────────────── */

.artifact-panel {
  flex: 0 0 46%; max-width: 860px; min-width: 380px;
  display: flex; flex-direction: column;
  border-left: 1px solid var(--border); background: var(--bg);
  animation: artifact-in .18s ease;
}
.artifact-panel[hidden] { display: none; }
@keyframes artifact-in { from { opacity: .4; transform: translateX(14px); } to { opacity: 1; transform: none; } }

.artifact-head {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-bottom: 1px solid var(--border); background: var(--bg-nav);
  min-height: 47px;
}
.artifact-title-wrap { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.artifact-icon { color: var(--accent); display: grid; place-items: center; }
.artifact-title {
  font-size: 13.5px; font-weight: 600; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.artifact-type-badge {
  flex: none; font-size: 10.5px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--accent-text);
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  border-radius: 6px; padding: 2px 7px;
}
/* AH-125: номер версии стал кнопкой — из него открывается история. */
.artifact-version-btn {
  flex: none; font-size: 10.5px; font-weight: 700; letter-spacing: .03em;
  color: var(--text-dim); background: transparent;
  border: 1px solid var(--border); border-radius: 6px; padding: 2px 7px;
  cursor: pointer; transition: color .12s, border-color .12s;
}
.artifact-version-btn:hover { color: var(--text); border-color: var(--text-dim); }
.artifact-version-btn.viewing {
  color: var(--accent-text); background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
}
.artifact-versions {
  position: absolute; z-index: 30; right: 12px; margin-top: 4px;
  min-width: 190px; max-height: 260px; overflow-y: auto;
  background: var(--surface, var(--bg)); border: 1px solid var(--border);
  border-radius: 10px; padding: 4px; box-shadow: 0 10px 28px rgba(0, 0, 0, .22);
}
.artifact-version-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; padding: 6px 9px; border: 0; border-radius: 7px;
  background: transparent; color: var(--text); font-size: 12px; cursor: pointer;
}
.artifact-version-row:hover { background: var(--hover, var(--accent-soft)); }
.artifact-version-row.active { background: var(--accent-soft); color: var(--accent-text); }
.artifact-version-row .av-num { font-weight: 700; }
.artifact-version-row .av-size { color: var(--text-dim); font-size: 11px; }
.artifact-version-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 6px 12px; font-size: 11.5px; color: var(--accent-text);
  background: var(--accent-soft);
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
}
.artifact-version-bar-actions { display: flex; gap: 10px; flex: none; }
.artifact-text-btn {
  background: none; border: 0; padding: 0; cursor: pointer;
  font-size: 11.5px; font-weight: 600; color: inherit; text-decoration: underline;
}
.artifact-save-status {
  flex: none; font-size: 11px; color: var(--text-dim); margin-left: 4px;
}
.artifact-save-status[data-kind="ok"] { color: var(--green); }
.artifact-save-status[data-kind="err"] { color: var(--red); }
.artifact-save-status[data-kind="pending"] { color: var(--text-muted); }
.art-chip-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
  flex: none;
}
.artifact-tabs {
  display: flex; gap: 2px; background: var(--bg-input);
  border-radius: 999px; padding: 3px;
}
.artifact-tab {
  border: none; background: transparent; color: var(--text-muted);
  font-size: 12.5px; padding: 4px 12px; border-radius: 999px; cursor: pointer;
}
.artifact-tab.active { background: var(--bg-card); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(15,23,42,.08); }
.artifact-actions { display: flex; align-items: center; gap: 2px; }
.artifact-action-btn {
  width: 30px; height: 30px; display: grid; place-items: center;
  border: none; background: transparent; color: var(--text-muted);
  border-radius: 8px; cursor: pointer;
}
.artifact-action-btn:hover { background: var(--bg-hover); color: var(--text); }

.artifact-body { flex: 1; min-height: 0; display: flex; }
.artifact-frame { flex: 1; border: none; background: #fff; }
.artifact-code {
  flex: 1; margin: 0; padding: 16px 18px; overflow: auto;
  background: var(--bg-code); font-size: 13px; line-height: 1.6;
}
.artifact-md {
  flex: 1; overflow: auto; padding: 22px 24px 40px;
  font-size: 15px; line-height: 1.7; color: var(--text);
  background: var(--bg-card);
}
.artifact-md h1, .artifact-md h2, .artifact-md h3 { letter-spacing: -.02em; margin: 1.1em 0 .45em; }
.artifact-md h1 { font-size: 1.45em; } .artifact-md h2 { font-size: 1.2em; }
.artifact-md p { margin: .55em 0; }
.artifact-md pre {
  background: var(--bg-code); border-radius: 10px; padding: 12px 14px; overflow: auto;
  font-size: 13px; border: 1px solid var(--border);
}
.artifact-md code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; }
.artifact-md table { border-collapse: collapse; width: 100%; margin: 12px 0; font-size: 13.5px; }
.artifact-md th, .artifact-md td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; }
.artifact-code[hidden], .artifact-frame[hidden], .artifact-md[hidden] { display: none; }

/* Session artifact chips */
.artifact-list {
  display: flex; gap: 6px; flex-wrap: wrap;
  padding: 10px 12px 0; border-bottom: 1px solid transparent;
}
.artifact-list:not([hidden]) { border-bottom-color: var(--border); padding-bottom: 10px; }
.art-chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  border: 1px solid var(--border); background: var(--bg-card);
  border-radius: 999px; padding: 5px 10px; cursor: pointer;
  font-size: 12px; color: var(--text-secondary); transition: border-color .12s, background .12s;
}
.art-chip:hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); background: var(--accent-soft); }
.art-chip.active {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  background: var(--accent-soft); color: var(--accent-text); font-weight: 600;
}
.art-chip-type {
  font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-dim);
}
.art-chip.active .art-chip-type { color: var(--accent-text); opacity: .8; }
.art-chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 140px; }
.art-chip-ver { font-size: 10px; color: var(--text-dim); font-weight: 700; }

.artifact-empty {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 32px 28px; color: var(--text-muted);
}
.artifact-empty[hidden] { display: none; }
.artifact-empty-icon {
  width: 52px; height: 52px; border-radius: 14px; margin-bottom: 12px;
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center;
}
.artifact-empty h3 { margin: 0 0 6px; font-size: 16px; font-weight: 650; color: var(--text); letter-spacing: -.02em; }
.artifact-empty p { margin: 0; max-width: 32ch; font-size: 13.5px; line-height: 1.5; }

.artifact-subhead {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 9px 12px; border-bottom: 1px solid var(--border); background: var(--bg-nav);
  min-height: 47px;
}
.artifact-subhead[hidden] { display: none; }

/* In-chat Claude-like artifact card */
.artifact-card {
  display: flex; align-items: center; gap: 12px; width: 100%;
  margin: 10px 0 6px; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: 14px;
  background: var(--bg-card); cursor: pointer; text-align: left;
  transition: border-color .14s ease, box-shadow .14s ease, transform .12s ease;
  color: inherit; font: inherit;
}
.artifact-card:hover {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
  box-shadow: 0 8px 24px -16px rgba(15,23,42,.28);
  transform: translateY(-1px);
}
.artifact-card-ico {
  flex: none; width: 36px; height: 36px; border-radius: 10px;
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center;
}
.artifact-card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.artifact-card-title {
  font-size: 14px; font-weight: 650; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.artifact-card-meta { font-size: 12px; color: var(--text-muted); }
.artifact-card-go {
  flex: none; font-size: 12.5px; font-weight: 600; color: var(--accent-text);
}
.artifact-source {
  margin: 0 0 12px; border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
}
.artifact-source > summary {
  cursor: pointer; padding: 8px 12px; font-size: 12.5px; color: var(--text-muted);
  background: var(--bg-nav); list-style: none;
}
.artifact-source > summary::-webkit-details-marker { display: none; }
.artifact-source[open] > summary { border-bottom: 1px solid var(--border); }
.artifact-source .code-block-wrapper { margin: 0; border: none; border-radius: 0; }

/* Чат сжимается, когда открыт артефакт */
#app.artifact-open #main { min-width: 320px; }
#app.artifact-open .msg-row, #app.artifact-open #input-area { max-width: 680px; }

@media (max-width: 900px) {
  .artifact-panel { position: fixed; inset: 0; z-index: 300; min-width: 0; max-width: none; flex: none; width: 100%; }
}

/* ── 7. Мелочи ───────────────────────────────────────────────────────────── */

/* «Печатает…» индикатор и токен-метка */
.msg-tokens, .msg-meta-sub { color: var(--text-dim); font-size: 11.5px; }

/* Session items */
.conv-item { border-radius: 9px; font-size: 13px; }
.conv-item.active { background: var(--accent-soft); color: var(--accent-text); }

/* Спокойный скроллбар */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { border-radius: 6px; border: 2px solid transparent; background-clip: content-box; }

/* Кнопка «Стоп» в композере — красная только рамкой */
#send-btn.btn-stop { background: var(--red) !important; }

/* ── 8. Свёрнутый сайдбар: новые элементы тоже сворачиваются ─────────────── */
#sidebar.collapsed .nav-section-label,
#sidebar.collapsed .nav-item > span:not(.nav-icon) { display: none !important; }
#sidebar.collapsed .new-chat-main {
  width: auto; margin: 8px auto 10px; padding: 9px;
}
#sidebar.collapsed .new-chat-main span { display: none; }
#sidebar.collapsed .nav-more-toggle .nav-more-chevron,
#sidebar.collapsed .nav-more-toggle span:not(.nav-icon),
#sidebar.collapsed .sidebar-spaces,
#sidebar.collapsed #sessions-section,
#sidebar.collapsed .sessions-search,
#sidebar.collapsed .user-card-info,
#sidebar.collapsed .sidebar-footer .theme-switcher,
#sidebar.collapsed .sidebar-footer .lang-switcher { display: none; }
#sidebar.collapsed .sidebar-footer { align-items: center; padding: 8px 4px 10px; }
#sidebar.collapsed .sidebar-footer .sidebar-controls { flex-direction: column; justify-content: center; }
#sidebar.collapsed .logout-icon-btn { margin-left: 0; }
#sidebar.collapsed .user-card { justify-content: center; padding: 6px; width: auto; }
#sidebar.collapsed .sidebar-header { padding: 12px 4px 4px; }
#sidebar.collapsed .status-dot,
#sidebar.collapsed .brand-logo { display: none; }
#sidebar.collapsed .sidebar-collapse-btn { transform: rotate(180deg); }

/* ═══════════════════════════════════════════════════════════════════════════
   9. Chat empty-state — Grok / Kimi / Perplexity pattern
   ───────────────────────────────────────────────────────────────────────────
   Problem: welcome floated in the middle of #messages while the composer sat
   at the bottom, leaving a dead void. The #input-area::before fade gradient
   sat mid-page and looked like a “reflection” band.
   Fix: when .chat-empty, stack hero + composer as one centered unit.
   ═══════════════════════════════════════════════════════════════════════════ */

#tab-chat.chat-empty {
  justify-content: center;
  /* optical center slightly above geometric center, like Grok/Perplexity */
  padding-bottom: min(6vh, 48px);
}

#tab-chat.chat-empty #messages {
  flex: 0 0 auto;
  overflow: visible;
  min-height: 0;
  background: transparent;
}

#tab-chat.chat-empty #welcome {
  flex: none;
  padding: 0 20px 18px !important;
  max-width: 720px;
  margin: 0 auto;
  gap: 12px;
  animation: chat-home-in .42s var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1)) both;
}

#tab-chat.chat-empty #welcome .welcome-icon {
  width: 52px !important;
  height: 52px !important;
  border-radius: 14px !important;
  background: var(--accent) !important;
  color: #fff !important;
  box-shadow: 0 10px 28px -10px color-mix(in srgb, var(--accent) 55%, transparent) !important;
  margin-bottom: 4px;
}

#tab-chat.chat-empty #welcome h2 {
  font-size: clamp(26px, 3.2vw, 34px) !important;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin: 0;
}

#tab-chat.chat-empty #welcome .welcome-hint {
  display: block;
  font-size: 14.5px;
  color: var(--text-muted);
  max-width: 42ch;
  margin: 0 auto;
  line-height: 1.5;
}

#tab-chat.chat-empty #welcome .welcome-chips {
  margin-top: 10px;
  max-width: 640px;
  gap: 8px;
  justify-content: center;
}

#tab-chat.chat-empty #welcome .welcome-chip {
  border-radius: 999px !important;
  border: 1px solid var(--border) !important;
  background: var(--bg-card) !important;
  padding: 9px 15px !important;
  font-size: 13px;
  color: var(--text-secondary);
  transition:
    border-color .15s ease,
    background .15s ease,
    color .15s ease,
    transform .15s var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1)),
    box-shadow .15s ease;
  animation: chat-chip-in .4s var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1)) both;
}
#tab-chat.chat-empty #welcome .welcome-chip:nth-child(1) { animation-delay: .04s; }
#tab-chat.chat-empty #welcome .welcome-chip:nth-child(2) { animation-delay: .08s; }
#tab-chat.chat-empty #welcome .welcome-chip:nth-child(3) { animation-delay: .12s; }
#tab-chat.chat-empty #welcome .welcome-chip:nth-child(4) { animation-delay: .16s; }
#tab-chat.chat-empty #welcome .welcome-chip:nth-child(5) { animation-delay: .20s; }
#tab-chat.chat-empty #welcome .welcome-chip:nth-child(6) { animation-delay: .24s; }

#tab-chat.chat-empty #welcome .welcome-chip:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border)) !important;
  background: var(--accent-soft) !important;
  color: var(--accent-text);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px -10px color-mix(in srgb, var(--accent) 40%, transparent);
}
#tab-chat.chat-empty #welcome .welcome-chip:active {
  transform: translateY(0) scale(.98);
}

/* Composer sits directly under hero — no mid-page void, no fade “reflection” */
#tab-chat.chat-empty #input-area {
  flex: 0 0 auto;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 4px 16px 0;
  border-top: none !important;
  background: transparent !important;
  animation: chat-home-in .48s var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1)) .06s both;
}
#tab-chat.chat-empty #input-area::before {
  display: none !important; /* kills the mid-page gradient band */
}

#tab-chat.chat-empty #input-wrapper {
  border-radius: 26px !important;
  box-shadow:
    0 1px 2px rgba(15, 23, 42, .04),
    0 12px 40px -16px rgba(15, 23, 42, .22) !important;
  transition:
    border-color .18s ease,
    box-shadow .22s var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1)),
    transform .18s ease;
}
#tab-chat.chat-empty #input-wrapper:focus-within {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border)) !important;
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent),
    0 14px 44px -14px rgba(15, 23, 42, .28) !important;
}

/* Modes popup still anchors above composer when empty */
#tab-chat.chat-empty #input-area.modes-open #focus-mode-pills {
  bottom: calc(100% + 10px);
}

/* Hidden chrome must not take flex space in empty layout */
#tab-chat.chat-empty #message-search-bar.hidden,
#tab-chat.chat-empty #drop-overlay.hidden {
  display: none !important;
}

/* ── Active chat (not empty): calm bottom composer ───────────────────────── */
#tab-chat:not(.chat-empty) #input-area {
  border-top: 1px solid var(--border);
  background: var(--bg);
  padding: 10px 16px 14px;
  transition: padding .2s ease, border-color .2s ease;
}
#tab-chat:not(.chat-empty) #input-area::before {
  /* soft scroll fade only when there is conversation content */
  content: '';
  position: absolute;
  top: -48px; left: 0; right: 0; height: 48px;
  background: linear-gradient(to bottom, transparent, var(--bg));
  pointer-events: none;
  z-index: 1;
}

/* ── Motion primitives ───────────────────────────────────────────────────── */
@keyframes chat-home-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}
@keyframes chat-chip-in {
  from { opacity: 0; transform: translateY(8px) scale(.97); }
  to   { opacity: 1; transform: none; }
}

/* Message enter: keep short, no janky bounce (Grok-style) */
.msg-row {
  animation: msg-enter .28s var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1)) both;
}
@keyframes msg-enter {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* ── Active chat: pin short threads to the BOTTOM (above composer) ────────
   margin-top:auto inside overflow:auto flex often fails → free space is 0.
   Real #chat-scroll-spacer with flex-grow is reliable: short history sits
   just above the input; long history collapses the spacer to 0 and scrolls. */
#tab-chat:not(.chat-empty) {
  /* force messages pane to a definite height so spacer can grow */
}
#tab-chat:not(.chat-empty) #messages {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 1 0 !important;
  min-height: 0 !important;
  overflow-x: hidden;
  overflow-y: auto;
  justify-content: flex-start !important; /* spacer does the bottom-pin */
}
#tab-chat:not(.chat-empty) #welcome {
  display: none !important; /* never leave hero in the flow while chatting */
}
.chat-scroll-spacer {
  display: none;
  flex: 0 0 0;
  min-height: 0;
  pointer-events: none;
}
#tab-chat:not(.chat-empty) .chat-scroll-spacer {
  display: block;
  flex: 1 1 auto;
  /* allow full collapse when history is long; grow when short */
  min-height: 0;
  height: auto;
  pointer-events: none;
}
#tab-chat.chat-empty .chat-scroll-spacer {
  display: none !important;
  flex: 0 0 0 !important;
  min-height: 0 !important;
  height: 0 !important;
  overflow: hidden;
}
#tab-chat:not(.chat-empty) #message-list {
  display: flex !important;
  flex: 0 0 auto !important;
  margin: 0 auto !important; /* no margin-top:auto — spacer handles it */
  width: 100%;
  max-width: 780px;
  padding: 8px 20px 14px !important;
  box-sizing: border-box;
  gap: 10px;
}
.msg-row.user .msg-meta { display: none; }
.msg-action-btn svg { display: block; }
.thinking-summary-icon { display: inline-flex; vertical-align: -2px; margin-right: 4px; }
.thinking-summary-icon svg { display: block; }
/* First-turn status/thinking rows: keep left-aligned inside the column,
   never text-align center (looked “mid-pane floating”). */
#tab-chat:not(.chat-empty) #message-list .msg-row {
  width: 100%;
  align-self: stretch;
}
#tab-chat:not(.chat-empty) #message-list .plg-status,
#tab-chat:not(.chat-empty) #message-list .msg-thinking,
#tab-chat:not(.chat-empty) #message-list .typing-indicator {
  justify-content: flex-start;
  text-align: left;
  margin-left: 0;
  margin-right: auto;
}

/* Streaming: no pulsing bubble border. Calm prose + soft caret. */
.msg-row.assistant.streaming .msg-content {
  border: none !important;
  background: transparent !important;
  padding: 0 !important;
  animation: none !important;
  box-shadow: none !important;
}
.msg-row.assistant.streaming .msg-content:not(:empty)::after {
  content: '';
  display: inline-block;
  width: 7px; height: 1.05em;
  margin-left: 2px;
  vertical-align: text-bottom;
  border-radius: 1px;
  background: var(--accent);
  animation: stream-caret .9s steps(1) infinite;
}
@keyframes stream-caret {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

/* ── Processing status (Claude/Grok-style) ─────────────────────────────────
   Compact left-aligned status line: soft orb + shimmer label.
   Replaces floating mid-pane dots and harsh spinners. */
.plg-status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 2px 0;
  margin: 2px 0 4px;
  min-height: 28px;
  text-align: left;
  animation: plg-status-in .28s var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1)) both;
}
@keyframes plg-status-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}

.plg-status-orb {
  position: relative;
  width: 14px;
  height: 14px;
  flex: none;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 30%, transparent);
  animation: plg-orb-pulse 1.6s ease-in-out infinite;
}
.plg-status-orb::after {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--accent);
  animation: plg-orb-core 1.6s ease-in-out infinite;
}
@keyframes plg-orb-pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 28%, transparent); transform: scale(1); }
  50%      { box-shadow: 0 0 0 6px transparent; transform: scale(1.05); }
}
@keyframes plg-orb-core {
  0%, 100% { opacity: .55; transform: scale(.85); }
  50%      { opacity: 1; transform: scale(1); }
}

.plg-status-label {
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: .01em;
  color: var(--text-muted);
  background: linear-gradient(
    90deg,
    var(--text-muted) 0%,
    var(--text-muted) 35%,
    var(--text) 50%,
    var(--text-muted) 65%,
    var(--text-muted) 100%
  );
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  animation: plg-shimmer 2s linear infinite;
}
@keyframes plg-shimmer {
  0%   { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

/* Thinking skeleton (assistant row while waiting for first token) */
.msg-thinking.plg-status,
.msg-skeleton.msg-thinking {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0 6px;
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  max-width: max-content;
}
.msg-thinking .msg-thinking-dot { display: none; } /* legacy dots */

/* Typing row (pre-assistant placeholder) */
.typing-indicator.plg-status,
.msg-typing.plg-status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
}
.typing-indicator:not(.plg-status) span {
  /* legacy three-dot fallback */
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-dim);
  animation: typing-dot 1.2s ease-in-out infinite;
}
@keyframes typing-dot {
  0%, 80%, 100% { opacity: .35; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

/* Agent step: active thinking / tool prep */
.agent-step.step-thinking-active,
.agent-step.step-tool-call.partial {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 6px 0 !important;
  max-height: none;
  align-items: center;
}
.agent-step.step-thinking-active .step-icon,
.agent-step.step-tool-call.partial .step-icon {
  width: 18px; height: 18px;
  background: transparent !important;
  display: grid; place-items: center;
}
.agent-step.step-thinking-active .step-icon .plg-status-orb,
.agent-step.step-tool-call.partial .step-icon .plg-status-orb {
  width: 12px; height: 12px;
}
.agent-step.step-thinking-active .step-icon .plg-status-orb::after,
.agent-step.step-tool-call.partial .step-icon .plg-status-orb::after {
  inset: 2.5px;
}
.agent-step.step-thinking-active .step-label,
.agent-step.step-tool-call.partial .step-label.plg-status-label {
  font-weight: 500;
}
.agent-step .thinking-text {
  margin-top: 4px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-dim);
  max-height: 4.5em;
  overflow: hidden;
}

/* Live reasoning panel — quieter, Grok/Claude style */
.live-thinking {
  margin: 2px 0 10px !important;
  background: var(--bg-nav) !important;
  border: 1px solid var(--border) !important;
  border-radius: 12px !important;
}
.live-thinking > summary {
  gap: 10px !important;
  padding: 8px 12px !important;
}
.live-thinking .lt-icon.plg-status-orb {
  width: 12px; height: 12px;
  animation: plg-orb-pulse 1.6s ease-in-out infinite;
}
.live-thinking .lt-icon.plg-status-orb::after {
  inset: 2.5px;
}
.live-thinking.streaming .lt-icon {
  animation: none !important; /* use orb pulse, not emoji scale */
}
.live-thinking.streaming .lt-label {
  /* keep shimmer while open */
  font-weight: 500;
}
.live-thinking.done .lt-label,
.live-thinking.done .lt-label.plg-status-label {
  -webkit-text-fill-color: var(--text-secondary) !important;
  color: var(--text-secondary) !important;
  background: none !important;
  animation: none !important;
}
.live-thinking.done .lt-icon.plg-status-orb {
  animation: none !important;
  background: color-mix(in srgb, var(--text-dim) 35%, transparent);
  box-shadow: none;
}
.live-thinking.done .lt-icon.plg-status-orb::after {
  animation: none !important;
  background: var(--text-dim);
  opacity: .7;
}
.live-thinking .lt-body {
  max-height: 200px !important;
  font-size: 12.5px !important;
  color: var(--text-muted) !important;
  border-top-color: var(--border) !important;
}

/* Tool steps: running = status line; done = quiet card */
.agent-step.step-tool-call.running {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 6px 0 !important;
  max-height: none;
  align-items: flex-start;
}
.agent-step.step-tool-call.running .step-icon {
  width: 18px; height: 18px; background: transparent !important;
  display: grid; place-items: center;
}
.agent-step.step-tool-call.running .tool-run-orb {
  width: 12px; height: 12px;
}
.agent-step.step-tool-call.running .tool-run-orb::after { inset: 2.5px; }
.agent-step.step-tool-call.done,
.agent-step.step-tool-call.error,
.agent-step.step-tool-call:not(.partial):not(.running) {
  border-radius: 12px !important;
  border: 1px solid var(--border) !important;
  background: var(--bg-nav) !important;
  padding: 9px 12px !important;
  max-height: none;
}
.agent-step.step-tool-call.done .step-icon,
.agent-step.step-tool-call.error .step-icon {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent-text);
  border-radius: 8px;
  width: 26px; height: 26px;
  font-size: 13px;
}
.agent-step.step-tool-call.error {
  border-color: color-mix(in srgb, var(--red) 28%, transparent) !important;
}
.agent-step.step-tool-call .step-args {
  color: var(--text-dim);
  font-size: 11.5px;
  margin-top: 2px;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.agent-step.step-tool-call .step-result {
  margin-top: 6px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  overflow: hidden;
}
.agent-step.step-tool-call .step-result summary {
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  list-style: none;
  display: flex; align-items: center; gap: 6px;
}
.agent-step.step-tool-call .step-result summary::-webkit-details-marker { display: none; }
.agent-step.step-tool-call .step-result-ok summary { color: var(--green); }
.agent-step.step-tool-call .step-result-error summary { color: var(--red); }

/* Research progress — status + soft bar */
.agent-step.research-progress {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 8px 0 !important;
  max-height: none !important;
  align-items: flex-start;
  animation: plg-status-in .28s var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1)) both;
}
.agent-step.research-progress .step-icon {
  width: 18px; height: 18px; background: transparent !important;
  display: grid; place-items: center; margin-top: 2px;
}
.agent-step.research-progress .plg-status-orb { width: 12px; height: 12px; }
.agent-step.research-progress .plg-status-orb::after { inset: 2.5px; }
.research-status-row {
  display: flex; align-items: center; gap: 10px; min-width: 0;
}
.research-status-row .step-label { flex: 1; min-width: 0; }
.research-pct {
  flex: none;
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--accent-text);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 2px 8px;
  font-weight: 600;
}
.research-bar {
  width: 100%;
  max-width: 360px;
  height: 3px !important;
  background: var(--bg-hover) !important;
  border-radius: 999px !important;
  margin-top: 8px !important;
  overflow: hidden;
}
.research-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-bright)) !important;
  border-radius: 999px;
  box-shadow: none !important;
  transition: width .35s var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1)) !important;
  position: relative;
}
.research-bar-fill::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.35), transparent);
  animation: research-sheen 1.4s linear infinite;
}
@keyframes research-sheen {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
.research-phase-tag {
  display: inline-block;
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: .02em;
}

/* Council cards + synth */
.council-info {
  background: transparent !important;
  border: none !important;
  padding: 4px 0 8px !important;
  max-height: none !important;
}
.council-info .step-icon { background: transparent !important; width: 18px; height: 18px; }
.council-grid {
  gap: 8px !important;
  margin-bottom: 10px !important;
}
.council-card {
  border-radius: 12px !important;
  border: 1px solid var(--border) !important;
  background: var(--bg-nav) !important;
  backdrop-filter: none !important;
  padding: 10px 12px !important;
  min-height: 72px;
  transition: border-color .18s ease, background .18s ease, opacity .18s ease;
  animation: plg-status-in .32s var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1)) both;
}
.council-card.loading { border-color: color-mix(in srgb, var(--accent) 22%, var(--border)) !important; }
.council-card.success { border-color: color-mix(in srgb, var(--green) 35%, var(--border)) !important; }
.council-card.error { border-color: color-mix(in srgb, var(--red) 35%, var(--border)) !important; opacity: .85; }
.council-card-header {
  display: flex; align-items: center; gap: 8px; margin-bottom: 6px;
}
.council-model-name {
  font-size: 12.5px; font-weight: 600; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.council-model-status {
  width: 8px; height: 8px; border-radius: 50%; margin-left: auto; flex: none;
  background: var(--text-dim);
}
.council-model-status.loading {
  background: var(--accent);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 40%, transparent);
  animation: plg-dot-ping 1.4s ease-out infinite;
}
.council-model-status.success { background: var(--green); animation: none; box-shadow: none; }
.council-model-status.error { background: var(--red); animation: none; box-shadow: none; }
@keyframes plg-dot-ping {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 40%, transparent); }
  70% { box-shadow: 0 0 0 6px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.council-card-body {
  font-size: 12.5px; color: var(--text-secondary); line-height: 1.45;
  max-height: 4.5em; overflow: hidden;
}
.council-card-body.expanded { max-height: none; }
.council-card .council-wait { min-height: 22px; padding: 2px 0; margin: 0; }
.council-card .council-wait .plg-status-orb { width: 10px; height: 10px; }
.council-card .council-wait .plg-status-orb::after { inset: 2px; }
.council-card .council-wait .plg-status-label { font-size: 12.5px; }
.council-toggle-btn {
  margin-top: 6px;
  border: none; background: transparent;
  color: var(--accent-text); font-size: 12px; font-weight: 600;
  cursor: pointer; padding: 0;
}
.council-toggle-btn:hover { text-decoration: underline; }

.council-synth-bar.plg-status,
.council-synth-bar {
  display: inline-flex !important;
  align-items: center;
  gap: 10px;
  margin: 8px 0 4px;
  padding: 6px 0 !important;
  background: transparent !important;
  border: none !important;
  font-size: 13.5px;
  color: var(--text-muted);
}

.council-progress {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-nav);
  padding: 14px 16px;
  margin: 4px 0 12px;
  animation: plg-status-in .3s var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1)) both;
}
.council-progress-head { margin-bottom: 10px; }
.council-progress-roles {
  display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px;
}
.cp-role {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; color: var(--text-secondary);
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 999px; padding: 4px 10px;
}
.cp-dot, .cp-role .cp-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  animation: plg-dot-ping 1.6s ease-out infinite;
}
.cp-role:nth-child(2) .cp-dot { animation-delay: .15s; }
.cp-role:nth-child(3) .cp-dot { animation-delay: .3s; }
.cp-role:nth-child(4) .cp-dot { animation-delay: .45s; }
.cp-role:nth-child(5) .cp-dot { animation-delay: .6s; }
.council-progress-hint { font-size: 12px; color: var(--text-dim); }

/* Plan card + agent-steps summary */
.agent-plan-card {
  border: 1px solid var(--border) !important;
  border-left: 3px solid var(--accent) !important;
  border-radius: 12px !important;
  background: var(--bg-nav) !important;
  padding: 12px 14px !important;
  margin: 4px 0 12px;
  animation: plg-status-in .3s var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1)) both;
}
.agent-plan-item.plan-item-running .agent-plan-bullet {
  display: grid; place-items: center;
  background: var(--accent-soft) !important;
  color: transparent !important;
}
.agent-plan-item.plan-item-running .agent-plan-bullet .plg-status-orb {
  width: 10px; height: 10px;
}
.agent-plan-item.plan-item-running .agent-plan-bullet .plg-status-orb::after { inset: 2px; }

.agent-steps-summary {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  margin-bottom: 8px;
}
.agent-steps-summary .summary-chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11.5px; color: var(--text-secondary);
  background: var(--bg-nav); border: 1px solid var(--border);
  border-radius: 999px; padding: 3px 9px;
}
.agent-steps-toggle {
  border: none; background: transparent;
  color: var(--text-dim); font-size: 12px; cursor: pointer;
  padding: 2px 6px; border-radius: 6px;
}
.agent-steps-toggle:hover { color: var(--text); background: var(--bg-hover); }

/* Orchestrator tree — calm status */
.orch-tree {
  border: 1px solid var(--border) !important;
  border-radius: 14px !important;
  background: var(--bg-nav) !important;
  backdrop-filter: none !important;
  overflow: hidden;
  margin: 4px 0 12px;
  animation: plg-status-in .32s var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1)) both;
}
.orch-tree-header {
  padding: 12px 14px !important;
  border-bottom: 1px solid var(--border);
  gap: 10px !important;
}
.orch-tree-icon {
  width: 28px !important; height: 28px !important;
  border-radius: 9px !important;
  background: var(--accent-soft) !important;
  display: grid !important; place-items: center;
  font-size: 0 !important;
}
.orch-tree-icon .plg-status-orb { width: 12px; height: 12px; }
.orch-tree-icon .plg-status-orb::after { inset: 2.5px; }
.orch-tree-status.running {
  background: transparent !important;
  display: grid; place-items: center;
}
.orch-tree-status .plg-status-orb { width: 12px; height: 12px; }
.orch-tree-status .plg-status-orb::after { inset: 2.5px; }
.orch-step.running .orch-step-card {
  border-color: color-mix(in srgb, var(--accent) 30%, var(--border)) !important;
}
.orch-step.running .orch-step-num {
  background: var(--accent) !important; color: #fff !important;
}
.orch-step-status .plg-status-orb { width: 11px; height: 11px; }
.orch-step-status .plg-status-orb::after { inset: 2.5px; }

.orch-info {
  background: transparent !important;
  border: none !important;
  padding: 4px 0 !important;
  max-height: none !important;
}
.orch-info .step-icon { background: transparent !important; width: 18px; height: 18px; }

/* Follow-ups — quieter chips */
.follow-ups {
  border-top: 1px solid var(--border) !important;
  gap: 7px !important;
  padding-top: 12px !important;
}
.follow-up-btn {
  border-radius: 999px !important;
  border: 1px solid var(--border) !important;
  background: var(--bg-card) !important;
  box-shadow: none !important;
  padding: 7px 13px !important;
  font-size: 12.5px !important;
  transition: border-color .12s ease, background .12s ease, color .12s ease, transform .12s ease !important;
}
.follow-up-btn:hover {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border)) !important;
  background: var(--accent-soft) !important;
  color: var(--accent-text) !important;
  box-shadow: none !important;
  transform: translateY(-1px);
}

/* Done orb (static) */
.plg-orb-done {
  animation: none !important;
  background: color-mix(in srgb, var(--text-dim) 30%, transparent) !important;
  box-shadow: none !important;
}
.plg-orb-done::after {
  animation: none !important;
  background: var(--text-dim) !important;
  opacity: .65;
}

/* Send button micro-interaction */
#send-btn {
  transition:
    background .14s ease,
    transform .14s var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1)),
    box-shadow .14s ease !important;
}
#send-btn:hover:not(:disabled) {
  transform: scale(1.04);
  box-shadow: 0 4px 14px -4px color-mix(in srgb, var(--accent) 55%, transparent);
}
#send-btn:active:not(:disabled) { transform: scale(.94); }
#send-btn:disabled {
  transform: none !important;
  box-shadow: none !important;
}

/* ── Conversation list (sidebar) ─────────────────────────────────────────── */
#conversations-list {
  padding: 2px 6px 8px !important;
  gap: 1px;
  display: flex;
  flex-direction: column;
}
.conv-day-header {
  padding: 12px 10px 4px !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  letter-spacing: .06em !important;
  color: var(--text-dim) !important;
  text-transform: uppercase;
}
.conv-item {
  display: flex !important;
  align-items: center;
  gap: 6px;
  padding: 8px 8px 8px 6px !important;
  margin: 0 !important;
  border-radius: 10px !important;
  border: 1px solid transparent !important;
  color: var(--text-secondary) !important;
  font-size: 13px !important;
  min-height: 36px;
  overflow: hidden;
  transition: background .12s ease, color .12s ease, border-color .12s ease;
}
.conv-item:hover {
  background: var(--bg-hover) !important;
  color: var(--text) !important;
  border-color: transparent !important;
}
.conv-item.active {
  background: var(--accent-soft) !important;
  color: var(--accent-text) !important;
  border-color: color-mix(in srgb, var(--accent) 18%, transparent) !important;
  box-shadow: none !important;
  font-weight: 550;
}
.conv-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.conv-item .conv-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.35;
}
.conv-item .conv-time {
  flex: none;
  font-size: 10.5px !important;
  color: var(--text-dim) !important;
  opacity: .85;
  margin-left: 0 !important;
  transition: opacity .12s ease;
}
.conv-item:hover .conv-time,
.conv-item.active .conv-time { opacity: 0; width: 0; overflow: hidden; margin: 0; padding: 0; }

.conv-item .conv-check {
  width: 14px; height: 14px;
  margin: 0;
  opacity: 0;
  flex: none;
  accent-color: var(--accent);
  transition: opacity .12s ease;
}
.conv-item:hover .conv-check,
.conv-item .conv-check:checked,
.conv-item:focus-within .conv-check { opacity: 1; }

.conv-actions {
  display: flex !important;
  align-items: center;
  gap: 1px;
  flex: none;
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s ease;
}
.conv-item:hover .conv-actions,
.conv-item:focus-within .conv-actions {
  opacity: 1;
  pointer-events: auto;
}
.conv-actions button {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border: none !important;
  background: transparent !important;
  color: var(--text-dim) !important;
  border-radius: 7px !important;
  cursor: pointer;
  padding: 0 !important;
  font-size: 0 !important; /* hide emoji if any left */
}
.conv-actions button svg {
  display: block;
  width: 13px; height: 13px;
}
.conv-actions button:hover {
  background: var(--bg-active) !important;
  color: var(--text) !important;
}
.conv-actions .conv-delete:hover {
  color: var(--red) !important;
  background: var(--red-soft) !important;
}
.conv-actions .conv-share,
.conv-actions .conv-move,
.conv-actions .conv-delete {
  display: grid !important; /* override app.css display:none until hover on item */
}

.bulk-bar {
  padding: 4px 6px 6px !important;
  margin-bottom: 2px;
}
.bulk-delete-btn {
  border-radius: 8px !important;
  font-size: 12px !important;
  padding: 5px 10px !important;
}

/* Sessions search quiet */
.sessions-search {
  padding: 2px 6px 8px !important;
}
.sessions-search input {
  border-radius: 9px !important;
  border: 1px solid transparent !important;
  background: var(--bg-input) !important;
  font-size: 12.5px !important;
  padding: 7px 10px !important;
}
.sessions-search input:focus {
  border-color: color-mix(in srgb, var(--accent) 35%, transparent) !important;
  background: var(--bg-card) !important;
  outline: none;
}

/* Reduced motion: no decorative motion, keep layout */
@media (prefers-reduced-motion: reduce) {
  #tab-chat.chat-empty #welcome,
  #tab-chat.chat-empty #input-area,
  #tab-chat.chat-empty #welcome .welcome-chip,
  .msg-row,
  .msg-row.assistant.streaming .msg-content:not(:empty)::after,
  .plg-status,
  .plg-status-orb,
  .plg-status-orb::after,
  .plg-status-label,
  .live-thinking .lt-icon.plg-status-orb,
  .research-bar-fill::after,
  .council-model-status.loading,
  .cp-dot,
  .cp-role .cp-dot {
    animation: none !important;
  }
  .plg-status-label {
    -webkit-text-fill-color: var(--text-muted);
    color: var(--text-muted);
    background: none;
  }
  #send-btn:hover:not(:disabled),
  #tab-chat.chat-empty #welcome .welcome-chip:hover {
    transform: none;
  }
}

/* Mobile empty-state: less vertical padding, full-width composer */
@media (max-width: 640px) {
  #tab-chat.chat-empty {
    padding-bottom: 12px;
    justify-content: flex-start;
    padding-top: 8vh;
  }
  #tab-chat.chat-empty #welcome {
    padding: 0 14px 14px !important;
  }
  #tab-chat.chat-empty #welcome h2 {
    font-size: 24px !important;
  }
  #tab-chat.chat-empty #input-area {
    max-width: none;
    padding: 0 10px;
  }
  #tab-chat.chat-empty #welcome .welcome-chips {
    gap: 6px;
  }
  #tab-chat.chat-empty #welcome .welcome-chip {
    padding: 8px 12px !important;
    font-size: 12.5px;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Phase 25 — Install CTA, research banner, agent trace, citations polish
   ═══════════════════════════════════════════════════════════════════════════ */

/* PWA install — quiet footer link (not a primary CTA next to Chat/Agent) */
.install-pwa-link {
  display: flex; align-items: center; gap: 7px;
  width: 100%; margin: 0 0 6px; padding: 6px 8px;
  border: none; background: transparent;
  color: var(--text-dim); font-size: 12px; font-weight: 500; cursor: pointer;
  border-radius: 8px; text-align: left;
  transition: color .12s ease, background .12s ease;
}
.install-pwa-link:hover { color: var(--text-muted); background: var(--bg-hover); }
.install-pwa-link.install-available { color: var(--accent-text); }
.install-pwa-link svg { flex: none; opacity: .75; }
#sidebar.collapsed .install-pwa-link { justify-content: center; padding: 6px; }
#sidebar.collapsed .install-pwa-link span { display: none; }

/* Welcome: agent chips hidden on chat surface */
body.surface-chat .welcome-chips-agent,
#app.surface-chat .welcome-chips-agent { display: none !important; }
body.surface-agent .welcome-chips-chat,
#app.surface-agent .welcome-chips-chat { display: none !important; }
body.surface-agent .welcome-chips-agent:not([hidden]),
#app.surface-agent #welcome-chips-agent:not([hidden]) {
  display: flex !important;
}

/* Research pre-send banner */
.research-banner {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  max-width: 780px; margin: 0 auto 8px; padding: 8px 12px;
  background: color-mix(in srgb, var(--accent) 8%, var(--bg-nav));
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--border));
  border-radius: 12px; font-size: 12.5px;
}
.research-banner[hidden] { display: none !important; }
.research-banner-badge {
  font-weight: 700; font-size: 11px; letter-spacing: .04em; text-transform: uppercase;
  color: var(--accent-text); background: var(--accent-soft);
  border-radius: 999px; padding: 3px 9px;
}
.research-banner-hint { color: var(--text-muted); flex: 1; min-width: 12ch; }
.research-banner-clear {
  border: 1px solid var(--border); background: var(--bg-card); color: var(--text-secondary);
  border-radius: 8px; padding: 4px 10px; font-size: 12px; font-weight: 600; cursor: pointer;
}
.research-banner-clear:hover { color: var(--text); background: var(--bg-hover); }

/* ── Unified side panel (Steps | Artifact | Files) ───────────────────────── */
#app {
  display: flex;
  flex-direction: row;
  min-height: 100vh;
  min-height: 100dvh;
}
#app > #main { flex: 1; min-width: 0; }
.side-panel {
  flex: 0 0 42%;
  max-width: 820px;
  min-width: 340px;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border);
  background: var(--bg);
  animation: side-panel-in .2s var(--ease-out, cubic-bezier(0.16,1,0.3,1));
}
.side-panel[hidden] { display: none !important; }
@keyframes side-panel-in {
  from { opacity: .45; transform: translateX(12px); }
  to { opacity: 1; transform: none; }
}
.side-panel-head {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-bottom: 1px solid var(--border);
  background: var(--bg-nav); min-height: 48px;
}
.side-panel-modes {
  display: flex; gap: 2px; flex: 1; min-width: 0;
  background: var(--bg-input); border-radius: 999px; padding: 3px;
}
.side-panel-mode {
  border: none; background: transparent; color: var(--text-muted);
  font-size: 12.5px; font-weight: 600; padding: 5px 12px;
  border-radius: 999px; cursor: pointer;
}
.side-panel-mode:hover { color: var(--text); }
.side-panel-mode.active {
  background: var(--bg-card); color: var(--text);
  box-shadow: 0 1px 2px rgba(15,23,42,.08);
}
.side-panel-close {
  width: 30px; height: 30px; border: none; background: transparent;
  color: var(--text-muted); border-radius: 8px; cursor: pointer; font-size: 18px; flex: none;
}
.side-panel-close:hover { background: var(--bg-hover); color: var(--text); }
.side-panel-pane {
  flex: 1; min-height: 0; display: flex; flex-direction: column;
}
.side-panel-pane[hidden] { display: none !important; }

.artifact-subhead {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 12px; border-bottom: 1px solid var(--border);
}
.side-panel .artifact-body { flex: 1; min-height: 0; display: flex; }
.side-panel .artifact-frame { flex: 1; border: none; background: #fff; }
.side-panel .artifact-code {
  flex: 1; margin: 0; padding: 14px 16px; overflow: auto;
  background: var(--bg-code); font-size: 13px; line-height: 1.6;
}

.agent-trace-body { flex: 1; overflow: auto; padding: 12px 14px; }
.agent-trace-empty { color: var(--text-muted); font-size: 13px; line-height: 1.5; margin: 8px 0; }
.agent-trace-section { margin-bottom: 16px; }
.agent-trace-sec-title {
  font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-dim); margin-bottom: 8px;
}
.agent-trace-step {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 7px 0; font-size: 13px; color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}
.agent-trace-step .ats-dot {
  width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex: none;
  background: var(--text-dim);
}
.agent-trace-step.st-run .ats-dot {
  background: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}
.agent-trace-step.st-done .ats-dot { background: var(--green); }
.agent-trace-step.st-error .ats-dot { background: var(--red); }
.agent-trace-line { font-size: 13px; color: var(--text-secondary); }

.sp-files-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-bottom: 1px solid var(--border); background: var(--bg-nav);
}
.sp-files-btn {
  width: 28px; height: 28px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg-card); cursor: pointer; color: var(--text-secondary);
}
.sp-files-btn:hover { background: var(--bg-hover); color: var(--text); }
.sp-files-path {
  font-size: 12px; font-family: var(--font-mono, ui-monospace, monospace);
  color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sp-files-list { flex: 1; overflow: auto; padding: 6px; }
.sp-file-row {
  display: flex; align-items: center; gap: 8px; width: 100%;
  border: none; background: transparent; text-align: left;
  padding: 8px 10px; border-radius: 9px; cursor: pointer;
  font-size: 13px; color: var(--text-secondary);
}
.sp-file-row:hover { background: var(--bg-hover); color: var(--text); }
.sp-file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-file-preview {
  font-size: 12px; line-height: 1.5; white-space: pre-wrap; word-break: break-word;
  margin: 0; padding: 12px; background: var(--bg-code); border-radius: 10px;
}

#app.artifact-open .msg-row,
#app.side-panel-open .msg-row,
#app.artifact-open #input-area,
#app.side-panel-open #input-area { max-width: 680px; }

@media (max-width: 900px) {
  .side-panel {
    position: fixed; inset: 0; z-index: 300;
    min-width: 0; max-width: none; flex: none; width: 100%;
  }
}

/* legacy artifact-panel rules still apply via classes */

/* Install modal */
.install-modal {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(15,23,42,.45); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.install-modal.hidden { display: none !important; }
.install-modal-card {
  position: relative; width: min(720px, 100%);
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 18px; padding: 24px 22px 20px;
  box-shadow: 0 24px 64px -20px rgba(15,23,42,.4);
  max-height: 90vh; overflow: auto;
}
.install-modal-card-narrow { width: min(420px, 100%); }
.install-modal-cli-hint {
  margin: 14px 0 0; font-size: 12.5px; color: var(--text-muted); line-height: 1.45;
}
.install-modal-x {
  position: absolute; top: 12px; right: 12px;
  width: 32px; height: 32px; border: none; background: transparent;
  color: var(--text-muted); font-size: 20px; border-radius: 8px; cursor: pointer;
}
.install-modal-x:hover { background: var(--bg-hover); color: var(--text); }
.install-modal-card h2 { margin: 0 0 8px; font-size: 22px; font-weight: 650; letter-spacing: -.02em; }
.install-modal-lead { margin: 0 0 18px; color: var(--text-muted); font-size: 14px; line-height: 1.5; }
.install-modal-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
}
@media (max-width: 640px) {
  .install-modal-grid { grid-template-columns: 1fr; }
}
.install-modal-block {
  border: 1px solid var(--border); border-radius: 14px;
  padding: 14px 14px 12px; background: var(--bg-nav);
}
.install-modal-block h3 { margin: 0 0 6px; font-size: 14.5px; font-weight: 700; }
.install-modal-block > p { margin: 0 0 12px; font-size: 12.5px; color: var(--text-muted); line-height: 1.45; }
.install-modal-cta {
  width: 100%; border: none; border-radius: 10px; padding: 10px 14px;
  background: var(--accent); color: #fff; font-weight: 650; font-size: 13.5px; cursor: pointer;
}
.install-modal-cta:hover { background: var(--accent-hover); }
.install-modal-note { margin: 8px 0 0; font-size: 11.5px; color: var(--text-dim); line-height: 1.4; }
.install-os-label {
  display: block; font-size: 11px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--text-dim); margin: 8px 0 4px;
}
.install-code-row {
  display: flex; align-items: stretch; gap: 4px;
  background: var(--bg-code); border: 1px solid var(--border); border-radius: 9px;
  overflow: hidden;
}
.install-code-row code {
  flex: 1; padding: 8px 10px; font-size: 11.5px; overflow-x: auto;
  white-space: nowrap; color: var(--text);
}
.install-steps {
  margin: 12px 0 0; padding-left: 18px; font-size: 12.5px; color: var(--text-secondary); line-height: 1.55;
}
.install-steps code { font-size: 11.5px; background: var(--bg-code); padding: 1px 5px; border-radius: 4px; }
.linkish {
  border: none; background: none; color: var(--accent-text); font-weight: 650;
  cursor: pointer; padding: 0; font-size: inherit; text-decoration: underline;
}

/* Source / citation cards — quieter Perplexity-like */
.source-cards {
  margin: 12px 0 4px !important;
  padding: 10px 0 4px !important;
  border-top: 1px solid var(--border);
}
.source-cards-header { margin-bottom: 4px; }
.source-cards-count {
  font-size: 12px !important;
  font-weight: 650 !important;
  color: var(--text-muted) !important;
  letter-spacing: .01em;
}
.source-cards-expand {
  border-radius: 999px !important;
  font-weight: 600 !important;
}
.source-card {
  border-radius: 12px !important;
  background: var(--bg-nav) !important;
  backdrop-filter: none !important;
  border: 1px solid var(--border) !important;
  box-shadow: none !important;
  transition: border-color .12s ease, background .12s ease !important;
}
.source-card:hover {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border)) !important;
  background: var(--accent-soft) !important;
  box-shadow: none !important;
}
.source-card.highlight {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 22%, transparent) !important;
  animation: none !important;
}
.source-idx {
  background: var(--accent-soft) !important;
  color: var(--accent-text) !important;
  font-weight: 700 !important;
}
.citation-ref {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.15em;
  padding: 0 4px;
  margin: 0 1px;
  border-radius: 5px;
  background: var(--accent-soft);
  color: var(--accent-text) !important;
  font-size: 0.72em !important;
  font-weight: 700 !important;
  text-decoration: none !important;
  vertical-align: super;
  line-height: 1.4;
}
.citation-ref:hover {
  background: color-mix(in srgb, var(--accent) 22%, transparent);
}
.citation-popover {
  z-index: 400;
  max-width: 320px;
  padding: 10px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 32px -12px rgba(15,23,42,.28);
  font-size: 12.5px;
}
.citation-popover .cp-title { font-weight: 650; color: var(--text); }
.citation-popover .cp-domain { color: var(--text-dim); font-size: 11px; margin-top: 2px; }
.citation-popover .cp-snippet { color: var(--text-secondary); margin-top: 6px; line-height: 1.45; }
.follow-up-btn {
  border-radius: 999px !important;
}

/* Research progress in-thread — calmer */
.agent-step.research-progress .research-bar {
  max-width: 100% !important;
}
.msg-row.assistant .research-progress {
  margin-bottom: 6px;
}

/* Agent toolbar: allow wrap + steps button */
.agent-toolbar .agent-toolbar-hint { flex: 1 1 auto; }
.agent-toolbar .fmp-pill { margin-left: 0; }
