/* CODEXIANB components */

/* Base */
h2, h3, h4 { line-height: 1.3; margin: 0 0 var(--s2); }
h3 { font-size: var(--fs-md); }
a { color: var(--accent); }
::selection { background: var(--accent-soft); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  min-height: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: fixed;
  top: -60px;
  left: var(--s3);
  z-index: var(--z-toast);
  padding: var(--s2) var(--s3);
  background: var(--card);
}

.skip-link:focus { top: var(--s3); }
.noscript { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); }
.muted { color: var(--muted); font-size: var(--fs-sm); margin: var(--s1) 0; }
.icon { flex: none; }

/* Buttons */
.btn,
.icon-btn,
.chip,
.seg button,
.pane-tabs button {
  font: 500 var(--fs-sm) var(--font);
  color: var(--text);
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--card);
  transition: background var(--dur), border-color var(--dur), color var(--dur);
}

.btn:hover,
.icon-btn:hover,
.chip:hover { background: var(--card-hover); border-color: var(--line-strong); }
button:disabled { opacity: 0.45; cursor: not-allowed; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--touch);
  padding: 0 14px;
  border-radius: var(--r-sm);
  white-space: nowrap;
}

.btn-sm { min-height: 32px; padding: 0 10px; font-size: var(--fs-xs); }
.btn-primary,
.btn-primary:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn-primary:hover { filter: brightness(1.1); }
.danger { color: var(--danger); }

.icon-btn {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: var(--touch);
  height: var(--touch);
  padding: 0;
  border-radius: var(--r-sm);
  background: transparent;
  border-color: transparent;
}

.icon-btn[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); }

/* Forms */
input:not([type="checkbox"]):not([type="range"]):not([type="radio"]),
textarea,
select {
  width: 100%;
  min-width: 0;
  min-height: var(--touch);
  padding: 8px 12px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font: var(--fs-md) var(--font);
}

textarea { resize: vertical; line-height: var(--lh); }
input:focus, textarea:focus, select:focus { border-color: var(--accent); outline: none; }
input[type="range"] { width: 100%; accent-color: var(--accent); min-height: 28px; }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
label { color: var(--text-2); font-size: var(--fs-sm); font-weight: 500; }

@media (pointer: coarse) {
  input:not([type="checkbox"]):not([type="range"]), textarea, select { font-size: 16px !important; }
  .btn-sm { min-height: 40px; }
}

.switch { display: flex; align-items: center; gap: 10px; min-height: var(--touch); cursor: pointer; }
.input-group { display: flex; gap: var(--s2); }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }
.row.between { justify-content: space-between; }

.filters { display: flex; flex-wrap: wrap; gap: var(--s2); margin-bottom: var(--s4); }
.filters input { flex: 1 1 220px; width: auto !important; }
.filters select { flex: 0 1 220px; width: auto !important; }
.filters [aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }

/* Panels and cards */
.panel {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  min-width: 0;
  margin-bottom: var(--s4);
  padding: var(--s4);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: var(--s3);
}

.card {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  min-width: 0;
  padding: var(--s4);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}

.card:hover { border-color: var(--line-strong); }
.card p { margin: 0; color: var(--muted); font-size: var(--fs-sm); }
.card .clamp {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card .row { margin-top: auto; }

.tag {
  align-self: flex-start;
  padding: 2px 8px;
  border-radius: var(--r-full);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: var(--fs-xs);
}

/* Brand motion */
.cx-emblem { flex: none; overflow: visible; }
.cx-node, .cx-spark { transform-box: fill-box; transform-origin: center; }
body.generating .cx-emblem { animation: cx-glow 1.4s ease-in-out infinite; }
body.generating .cx-spark { animation: cx-spark 1.4s ease-in-out infinite; }
body.generating .cx-node { animation: cx-node 0.9s ease-in-out infinite alternate; }

@keyframes cx-glow {
  0%, 100% { filter: drop-shadow(0 0 2px var(--accent-glow)); }
  50% { filter: drop-shadow(0 0 12px var(--accent-glow)); }
}
@keyframes cx-spark { 50% { transform: scale(1.35) rotate(45deg); } }
@keyframes cx-node { to { transform: scale(1.4); } }

/* Navigation */
.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--touch);
  padding: 0 10px;
  border-radius: var(--r-sm);
  color: var(--text-2);
  text-decoration: none;
  font-size: var(--fs-sm);
  font-weight: 500;
}

.nav a:hover { background: var(--card); color: var(--text); }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--text); }
.nav a[aria-current="page"] svg { color: var(--accent); }

.sidebar > .btn { flex: none; }
.search-trigger { justify-content: flex-start; color: var(--muted); }
kbd {
  margin-left: auto;
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  font: var(--fs-xs) var(--mono);
  color: var(--muted);
}

.thread {
  display: flex;
  align-items: center;
  border-radius: var(--r-sm);
}
.thread:hover { background: var(--card); }
.thread.active { background: var(--card); box-shadow: inset 2px 0 0 var(--accent); }
.thread > button.thread-open {
  flex: 1;
  min-width: 0;
  min-height: var(--touch);
  padding: 0 10px;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-2);
  background: none;
  border: 0;
  font: var(--fs-sm) var(--font);
  cursor: pointer;
}
.thread .icon-btn { width: 30px; height: var(--touch); color: var(--muted); }
.thread .icon-btn.on { color: var(--warning); }

.provider-pill {
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-full);
  background: var(--card);
  color: var(--text-2);
  font: 500 var(--fs-xs) var(--font);
  cursor: pointer;
}
.provider-pill::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--success);
}
.provider-pill.demo::before { background: var(--warning); }

/* Welcome */
.welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 640px;
  margin: 0 auto;
  padding: 4vh 0 var(--s4);
  text-align: center;
}
.welcome h2 { margin-top: var(--s3); max-width: 100%; }
.welcome h2 svg { max-width: 80vw; height: auto; }
.welcome p { color: var(--muted); margin-top: 0; }
.suggestions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s2);
  width: 100%;
}
.suggestions button { text-align: left; cursor: pointer; font: var(--fs-sm) var(--font); color: var(--text-2); }
@media (max-width: 480px) { .suggestions { grid-template-columns: 1fr; } }

/* Messages */
.message { display: flex; flex-direction: column; gap: var(--s2); margin-bottom: var(--s5); min-width: 0; }
.message.user { align-items: flex-end; }
.message .bubble { max-width: 100%; min-width: 0; overflow-wrap: anywhere; }
.message.user .bubble {
  max-width: min(85%, 620px);
  padding: 10px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg) var(--r-lg) 4px var(--r-lg);
  white-space: pre-wrap;
}
.message.assistant .bubble { width: 100%; }
.msg-meta { display: flex; align-items: center; gap: var(--s2); color: var(--muted); font-size: var(--fs-xs); }
.msg-actions { display: flex; flex-wrap: wrap; gap: 2px; }
.msg-actions .icon-btn { color: var(--muted); }
.msg-images { display: flex; flex-wrap: wrap; gap: var(--s2); }
.msg-images img { max-width: 160px; max-height: 120px; border-radius: var(--r-sm); border: 1px solid var(--line); }

.notice {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--warning);
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-size: var(--fs-sm);
}

.typing::after {
  content: "";
  display: inline-block;
  width: 8px;
  height: 1em;
  margin-left: 3px;
  vertical-align: text-bottom;
  background: var(--accent);
  animation: blink 1s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* Reasoning accordion */
.reasoning {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--panel);
}
.reasoning summary {
  min-height: var(--touch);
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: 0 14px;
  cursor: pointer;
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: 600;
}
.reasoning summary::before { content: "▸"; color: var(--accent); }
.reasoning[open] summary::before { content: "▾"; }
.reasoning .md { padding: 0 14px 12px; color: var(--muted); font-size: var(--fs-sm); }

/* Composer */
.modes { display: flex; flex-wrap: wrap; gap: var(--s2); margin-bottom: var(--s2); }
.chip { min-height: 34px; padding: 0 12px; border-radius: var(--r-full); }
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
select.chip-select {
  width: auto !important;
  max-width: 100%;
  min-height: 34px !important;
  border-radius: var(--r-full) !important;
  font-size: var(--fs-sm) !important;
  padding-block: 4px !important;
}
.mode-note { margin: 0 0 var(--s2); color: var(--muted); font-size: var(--fs-xs); }
.composer {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  padding: 6px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}
.composer:focus-within { border-color: var(--accent); }
.composer textarea {
  flex: 1;
  max-height: 180px;
  resize: none;
  background: transparent !important;
  border: 0 !important;
  padding-inline: 6px !important;
}
.composer .send { background: var(--accent); color: var(--accent-ink); }

.attachments { display: flex; flex-wrap: wrap; gap: var(--s2); }
.attachments:not(:empty) { margin-bottom: var(--s2); }
.attachment {
  display: flex;
  align-items: center;
  gap: var(--s2);
  max-width: 220px;
  padding: 4px 4px 4px 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: var(--fs-xs);
}
.attachment img { width: 32px; height: 32px; object-fit: cover; border-radius: 4px; }
.attachment span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.attachment .icon-btn { width: 30px; height: 30px; }

/* Markdown */
.md { min-width: 0; overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md h1 { font-size: var(--fs-xl); line-height: 1.25; }
.md h2 { font-size: 1.25rem; margin-top: var(--s4); }
.md h3 { font-size: var(--fs-lg); margin-top: var(--s3); }
.md blockquote {
  margin: var(--s3) 0;
  padding: 2px 14px;
  border-left: 3px solid var(--accent);
  color: var(--text-2);
}
.md code {
  font: 0.88em var(--mono);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 5px;
}
.md ul, .md ol { padding-left: 1.4em; }
.md hr { border: 0; border-top: 1px solid var(--line); }
.table-wrap { max-width: 100%; overflow-x: auto; margin: var(--s3) 0; }
.md table { border-collapse: collapse; font-size: var(--fs-sm); }
.md th, .md td { border: 1px solid var(--line); padding: 6px 12px; text-align: left; }
.md th { background: var(--card); }

.code-block {
  margin: var(--s3) 0;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  background: #0a0c12;
}
.code-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--s2);
  padding: 4px 6px 4px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font: var(--fs-xs) var(--mono);
}
.code-head span { flex: 1; }
.code-block pre { margin: 0; padding: 12px; overflow-x: auto; max-height: 480px; }
.md .code-block code { background: none; border: 0; padding: 0; font: 13px/1.55 var(--mono); overflow-wrap: normal; }

.artifact-card {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s3);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--card);
}
.artifact-card div { flex: 1; min-width: 0; font-size: var(--fs-sm); }

/* Segmented controls and tabs */
.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.seg button, .pane-tabs button { border: 0; background: transparent; color: var(--muted); min-height: 32px; padding: 0 10px; font-size: var(--fs-xs); }
.seg button.active { background: var(--card-hover); color: var(--text); }
.editor .seg { align-self: flex-start; }
.pane-tabs { border-bottom: 1px solid var(--line); background: var(--panel); }
.pane-tabs button { flex: 1; min-height: var(--touch); font-size: var(--fs-sm); }
.pane-tabs button.active { color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }

.template-list { display: flex; flex-direction: column; gap: var(--s2); }
.template-list .btn { justify-content: flex-start; white-space: normal; text-align: left; }

.mini-list { list-style: none; margin: 0; padding: 0; }
.mini-list li {
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: 4px 0;
  border-bottom: 1px solid var(--line);
  font-size: var(--fs-sm);
}
.mini-list li > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Agent pipeline */
.pipeline { list-style: none; margin: 0 0 var(--s4); padding: 0; }
.step {
  position: relative;
  margin-bottom: var(--s3);
  padding: var(--s3) var(--s4);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.step-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }
.step-head strong { flex: 1; min-width: 140px; }
.step details { margin-top: var(--s2); }
.step summary { cursor: pointer; min-height: 32px; color: var(--text-2); font-size: var(--fs-sm); }
.step textarea { font: 13px/1.5 var(--mono); margin-bottom: var(--s2); }
.step[data-status="running"] { border-color: var(--accent); box-shadow: 0 0 24px var(--accent-soft); }
.badge {
  padding: 2px 10px;
  border-radius: var(--r-full);
  border: 1px solid var(--line-strong);
  color: var(--muted);
  font-size: var(--fs-xs);
}
.step[data-status="running"] .badge { color: var(--accent); border-color: var(--accent); }
.step[data-status="completed"] .badge { color: var(--success); border-color: var(--success); }
.step[data-status="error"] .badge { color: var(--danger); border-color: var(--danger); }

/* Image studio */
.dropzone {
  display: grid;
  place-items: center;
  min-height: 150px;
  padding: var(--s3);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-md);
  cursor: pointer;
  text-align: center;
}
.dropzone.over, #vision-file:focus-visible + .row { border-color: var(--accent); }
.dropzone img { max-width: 100%; max-height: 260px; border-radius: var(--r-sm); }
.output { max-height: 420px; overflow-y: auto; }
.output:not(:empty) { padding: var(--s3); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg); }

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(46%, 190px), 1fr));
  gap: var(--s3);
}
.tile {
  margin: 0;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.tile button.thumb { display: block; width: 100%; padding: 0; border: 0; background: var(--bg); cursor: zoom-in; }
.tile img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; }
.tile figcaption { display: flex; align-items: center; gap: 2px; padding: 2px 4px 2px 8px; font-size: var(--fs-xs); }
.tile figcaption span { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.tile .icon-btn { width: 34px; height: 36px; }
.tile .icon-btn.on { color: var(--warning); }
.lightbox img { display: block; max-width: 100%; max-height: 65vh; margin: 0 auto; border-radius: var(--r-sm); }

/* Quick tools */
.tool { margin-bottom: var(--s4); }
.tool-io { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); }
.tool-io textarea { height: 100%; min-height: 200px; font: 13px/1.55 var(--mono); }
.tool-io .output { min-height: 200px; padding: var(--s3); border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg); }
.tool select { width: auto !important; max-width: 100%; }
@media (max-width: 700px) { .tool-io { grid-template-columns: minmax(0, 1fr); } }

/* History */
.history-list { list-style: none; margin: 0; padding: 0; }
.history-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s3);
  margin-bottom: var(--s2);
  padding: var(--s3);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.history-item img { width: 52px; height: 52px; object-fit: cover; border-radius: var(--r-sm); }
.history-item .info { flex: 1 1 180px; min-width: 0; }
.history-item .info strong { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.empty { padding: var(--s5); color: var(--muted); text-align: center; border: 1px dashed var(--line); border-radius: var(--r-md); }

/* Settings and brand card */
#settings-form label, #provider-fields label { margin-top: var(--s2); }
#provider-fields { display: flex; flex-direction: column; gap: var(--s1); }
.brand-stage svg { display: block; width: 100%; max-width: 560px; height: auto; border: 1px solid var(--line); border-radius: var(--r-md); }
.brand-variants { display: flex; gap: var(--s5); flex-wrap: wrap; }
.brand-variants figure { margin: 0; text-align: center; color: var(--muted); font-size: var(--fs-xs); }
.swatches { display: flex; flex-wrap: wrap; gap: var(--s2); }
.swatch { display: flex; align-items: center; gap: var(--s2); }
.swatch i { width: 18px; height: 18px; border-radius: 5px; border: 1px solid var(--line-strong); }
.accent-picker { display: flex; flex-wrap: wrap; gap: var(--s2); }
.accent-picker [aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); }
.accent-picker i { width: 14px; height: 14px; border-radius: 50%; }
.meter { height: 8px; overflow: hidden; border-radius: var(--r-full); background: var(--card); }
.meter span { display: block; width: 0; height: 100%; background: var(--accent); }

/* Modal and command palette */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: grid;
  place-items: center;
  padding: var(--s4);
  background: rgba(2, 3, 6, 0.72);
  backdrop-filter: blur(4px);
}
.modal {
  display: flex;
  flex-direction: column;
  gap: var(--s3);
  width: min(520px, 100%);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  padding: var(--s4);
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  animation: pop var(--dur) var(--ease);
}
.modal.wide { width: min(900px, 100%); }
.modal p { margin: 0; overflow-wrap: anywhere; }
.modal .actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--s2); }
@keyframes pop { from { opacity: 0; transform: translateY(8px); } }

.palette { align-self: start; margin-top: 8vh; }
.palette ul { list-style: none; margin: 0; padding: 0; max-height: 50vh; overflow-y: auto; }
.palette li button {
  display: flex;
  justify-content: space-between;
  gap: var(--s3);
  width: 100%;
  min-height: var(--touch);
  align-items: center;
  padding: 0 10px;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: var(--text);
  font: var(--fs-sm) var(--font);
  text-align: left;
  cursor: pointer;
}
.palette li button span:first-child { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.palette li button small { color: var(--muted); }
.palette li button.selected { background: var(--accent-soft); }

/* Toasts */
.toasts {
  position: fixed;
  right: var(--s3);
  bottom: calc(var(--s3) + env(safe-area-inset-bottom));
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--s2);
  max-width: calc(100vw - 24px);
  pointer-events: none;
}
.toast {
  max-width: 360px;
  padding: 10px 14px;
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow);
  font-size: var(--fs-sm);
  overflow-wrap: anywhere;
  animation: pop var(--dur) var(--ease);
}
.toast.error { border-left-color: var(--danger); }
.toast.success { border-left-color: var(--success); }
@media (max-width: 480px) {
  .toasts { top: calc(var(--topbar-h) + var(--s2)); bottom: auto; }
  .chat-head .btn { padding: 0 8px; }
}

/* ---------- Composer toolbar (engine, persona, mode toggles) ---------- */
.composer-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); min-width: 0; }
.composer-toolbar .chip-select { min-width: 0; max-width: 100%; text-overflow: ellipsis; }
.composer-toolbar .engine-select { flex: 1 1 190px; max-width: 260px; }
.composer-toolbar #persona { flex: 1 1 150px; max-width: 220px; }
.composer-toolbar .chip { flex: 0 0 auto; }
@media (max-width: 430px) {
  .composer-toolbar .engine-select, .composer-toolbar #persona { flex: 1 1 100%; max-width: none; }
}

/* ---------- Response footer: engine attribution + actions ---------- */
.msg-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2); margin-top: var(--s2); min-width: 0; }
.msg-footer .msg-actions { margin-top: 0; }
.engine-badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border: 1px solid var(--line); border-radius: var(--r-full); color: var(--muted); font: 500 var(--fs-xs)/1.6 var(--mono); letter-spacing: 0.01em; }
.engine-badge i { width: 6px; height: 6px; border-radius: 50%; background: var(--success); flex: none; }
.engine-badge.demo { color: var(--warning); border-color: rgba(251, 191, 36, 0.3); }
.engine-badge.demo i { background: var(--warning); }
.engine-badge.empty { display: none; }

/* ---------- Settings: server status ---------- */
.server-status { display: flex; align-items: center; gap: var(--s2); margin: var(--s3) 0; padding: var(--s3); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--card); color: var(--text-2); font-size: var(--fs-sm); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.status-dot[data-state="ok"] { background: var(--success); }
.status-dot[data-state="warn"] { background: var(--warning); }
.status-dot[data-state="off"] { background: var(--danger); }

/* ---------- About / FAQ (visible, crawlable) ---------- */
.about { max-width: 640px; margin: var(--s6) auto 0; text-align: left; color: var(--text-2); font-size: var(--fs-sm); }
.about h3 { font-size: var(--fs-md); color: var(--text); margin: 0 0 var(--s2); }
.about details { border-top: 1px solid var(--line); padding: var(--s2) 0; }
.about summary { cursor: pointer; color: var(--text); }
.about details p { margin: var(--s2) 0 0; }

/* ---------- Retry select, token meter, shortcuts ---------- */
.retry-engine { background: transparent; color: var(--muted); border: 1px solid var(--line); border-radius: var(--r-full); font: inherit; font-size: var(--fs-xs); padding: 2px 8px; max-width: 120px; cursor: pointer; }
.retry-engine:hover { color: var(--text); border-color: var(--line-strong); }
.token-meter { margin-left: auto; color: var(--muted); font: 500 var(--fs-xs)/1 var(--mono); white-space: nowrap; }
.shortcuts h3 { margin: var(--s3) 0 var(--s2); }
.shortcuts p { margin: 4px 0; color: var(--text-2); }
.shortcuts kbd { display: inline-block; min-width: 9ch; padding: 1px 6px; margin-right: var(--s2); border: 1px solid var(--line-strong); border-radius: 6px; font: var(--fs-xs) var(--mono); color: var(--text); }

/* ---------- Custom personas ---------- */
.persona-list { display: grid; gap: var(--s2); margin-bottom: var(--s3); }
.persona-item { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); padding: 6px 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--card); min-width: 0; }
.persona-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
