/* IAutonomy Chat — style.css v2.0.0 */
/* Palette : #04080F bg · #0D1929 sidebar · #00CCF7 cyan · #FFB432 ambre · #FF4757 rouge */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #04080F;
  --sidebar-bg:  #0D1929;
  --surface:     #111B2B;
  --surface2:    #172438;
  --border:      #1E3050;
  --border2:     #243A5E;
  --cyan:        #00CCF7;
  --cyan-dim:    rgba(0,204,247,.12);
  --ambre:       #FFB432;
  --ambre-dim:   rgba(255,180,50,.1);
  --rouge:       #FF4757;
  --rouge-dim:   rgba(255,71,87,.1);
  --text:        #E8EEF6;
  --text-muted:  #94A3B8;
  --text-dim:    #64748B;
  --radius:      10px;
  --radius-sm:   6px;
  --font:        'Inter', system-ui, -apple-system, sans-serif;
  --sidebar-w:   252px;
  --topbar-h:    52px;
  --context-h:   3px;
}

html, body { height: 100%; height: 100dvh; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; overflow: hidden; overscroll-behavior: none; }

/* ── Layout ────────────────────────────────────────────────────────────────── */

.app { display: flex; height: 100dvh; height: 100vh; overflow: hidden; position: fixed; inset: 0; padding-top: env(safe-area-inset-top); }

@supports (height: 100dvh) {
  .app { height: 100dvh; }
}

/* ── Sidebar ───────────────────────────────────────────────────────────────── */

.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform .25s ease;
}

.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 14px 12px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo { display: flex; align-items: center; gap: 8px; }

.sidebar-brand { font-size: 13px; font-weight: 600; color: var(--text); letter-spacing: .3px; white-space: nowrap; }

.sidebar-close-btn { display: none; background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 15px; padding: 4px; line-height: 1; }

/* ── Bento 2×2 ─────────────────────────────────────────────────────────────── */

/* ── Sidebar actions ──────────────────────────────────────────────────────── */

.sidebar-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px 6px;
  border-bottom: 1px solid var(--border);
}
.sidebar-action-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  color: var(--text);
  font-family: var(--font);
  font-size: 12px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  text-align: left;
  overflow: hidden;
}
.sidebar-action-btn:hover:not(:disabled) { border-color: var(--cyan); background: var(--cyan-dim); }
.sidebar-action-btn:disabled { opacity: .4; cursor: not-allowed; }
.sidebar-action-btn.active { border-color: var(--cyan); background: var(--cyan-dim); }
.sa-icon { font-size: 18px; flex-shrink: 0; }
.sa-label { font-weight: 600; font-size: 13px; flex-shrink: 0; }
.sa-sub { font-size: 10px; color: var(--text-muted); margin-left: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.sidebar-action-btn.active .sa-sub { color: var(--cyan); }

.go-btn { border-color: rgba(0,204,247,.25); background: rgba(0,204,247,.06); }
.go-btn:hover { border-color: var(--cyan); background: var(--cyan-dim); }

.bilan-btn { border-color: rgba(255,71,87,.15); background: rgba(255,71,87,.04); }
.bilan-btn:hover:not(:disabled) { border-color: var(--rouge); background: var(--rouge-dim); }

/* sidebar-counters removed */

/* ── GO report ────────────────────────────────────────────────────────────── */

.go-report {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  max-width: 640px;
}
.go-report-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: -16px -16px 0;
  padding: 12px 16px;
  border-radius: 12px 12px 0 0;
  background: #FFFFFF;
  border-bottom: 1px solid #E5E7EB;
}
.go-report-title {
  font-size: 16px;
  font-weight: 700;
  color: #0A0A0A;
}
.go-report-sub {
  font-size: 14px;
  font-weight: 600;
  color: #1F2937;
  margin-top: 2px;
}
.go-section {
  margin-bottom: 10px;
}
.go-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 8px;
}
.go-cards {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.go-card {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  background: var(--bg-chat);
  border: 1px solid var(--border);
  transition: border-color .15s;
}
.go-card:hover {
  border-color: var(--cyan);
}
.go-card-conv { cursor: pointer; }
.go-card-icon {
  flex-shrink: 0;
  font-size: 14px;
  margin-top: 1px;
}
.go-card-body {
  min-width: 0;
}
.go-card-title {
  font-size: 12px;
  color: var(--text);
  line-height: 1.3;
  word-break: break-word;
}
.go-card-meta {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
}
.go-empty {
  font-size: 12px;
  color: var(--text-dim);
  padding: 6px 0;
  font-style: italic;
}
.go-rules-content {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  padding: 8px 10px;
  background: var(--bg-chat);
  border-radius: 8px;
  border: 1px solid var(--border);
  white-space: pre-wrap;
  word-break: break-word;
}
.go-report-footer {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
}

/* ── Dashboard GO ─────────────────────────────────────────────────────────── */

.go-dashboard {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}
.go-dash-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}
.go-dash-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--cyan);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.go-dash-item {
  font-size: 13px;
  color: var(--text);
  padding: 4px 0;
  line-height: 1.4;
  border-bottom: 1px solid var(--border);
}
.go-dash-item:last-child { border-bottom: none; }
.go-dash-item-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}
.go-dash-empty {
  font-size: 12px;
  color: var(--text-dim);
  font-style: italic;
}
.go-dash-expand {
  font-size: 11px;
  color: var(--cyan);
  cursor: pointer;
  padding-top: 4px;
  user-select: none;
}
.go-dash-expand:hover { text-decoration: underline; }
@media (max-width: 700px) {
  .go-dashboard { grid-template-columns: 1fr; }
}

/* ── Conversation list ─────────────────────────────────────────────────────── */

.conv-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 6px;
}

.conv-header-label { font-size: 11px; font-weight: 600; color: var(--text-muted); letter-spacing: .5px; text-transform: uppercase; white-space: nowrap; }

.new-chat-icon {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.new-chat-icon:hover { background: var(--cyan-dim); border-color: var(--cyan); color: var(--cyan); }

.conv-pinned { padding: 0 8px; display: flex; flex-direction: column; gap: 2px; flex-shrink: 0; }

.conv-list { flex: 1; overflow-y: auto; padding: 4px 8px; display: flex; flex-direction: column; gap: 2px; }

.conv-list::-webkit-scrollbar { width: 4px; }
.conv-list::-webkit-scrollbar-track { background: transparent; }
.conv-list::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

.conv-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .12s, border-color .12s;
  position: relative;
}

.conv-item:hover { background: var(--surface); border-color: var(--border); }
.conv-item.active { background: var(--cyan-dim); border-color: var(--border); }

.conv-icon { font-size: 13px; flex-shrink: 0; }

.conv-text { flex: 1; min-width: 0; }

.conv-title { font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }

.conv-date { font-size: 10px; color: var(--text-muted); margin-top: 1px; }

.conv-del {
  opacity: 0;
  background: none;
  border: none;
  color: var(--rouge);
  cursor: pointer;
  font-size: 11px;
  padding: 2px 4px;
  border-radius: 3px;
  transition: opacity .12s, background .12s;
  flex-shrink: 0;
}

.conv-item:hover .conv-del { opacity: 1; }
.conv-del:hover { background: var(--rouge-dim); }

.conv-export, .conv-share {
  opacity: 0;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 11px;
  padding: 2px 4px;
  border-radius: 3px;
  transition: opacity .12s, background .12s;
  flex-shrink: 0;
}
.conv-item:hover .conv-export, .conv-item:hover .conv-share { opacity: 1; }
.conv-export:hover, .conv-share:hover { background: var(--cyan-dim); color: var(--cyan); }

/* ── Share modal ─────────────────────────────────────────────────────────────── */
.share-modal-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center;
}
.share-modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; width: 90%; max-width: 480px;
}
.share-modal h3 { font-size: 16px; font-weight: 600; }
.share-url-row { display: flex; gap: 6px; }
.share-url-input {
  flex: 1; background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 10px; color: var(--text);
  font-size: 12px; font-family: var(--font);
}
.share-copy-btn {
  background: var(--cyan-dim); border: 1px solid var(--cyan);
  border-radius: var(--radius-sm); padding: 6px 10px; cursor: pointer;
  font-size: 14px; color: var(--cyan);
}
.share-copy-btn:hover { background: var(--cyan); color: var(--bg); }
.share-revoke-btn {
  background: var(--rouge-dim); border: 1px solid var(--rouge);
  border-radius: var(--radius-sm); padding: 6px 14px; cursor: pointer;
  color: var(--rouge); font-size: 12px; font-family: var(--font);
}
.share-revoke-btn:hover { background: var(--rouge); color: #fff; }
.share-close-btn {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 6px 14px; cursor: pointer;
  color: var(--text); font-size: 12px; font-family: var(--font);
}
.share-close-btn:hover { background: var(--border); }

/* ── Pinned section ───────────────────────────────────────────────────────── */

.conv-section-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: .4px;
  text-transform: uppercase;
  padding: 8px 12px 4px;
}

.conv-pin-btn {
  opacity: 0;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 11px;
  padding: 2px 4px;
  border-radius: 3px;
  transition: opacity .12s, color .12s;
  flex-shrink: 0;
}
.conv-item:hover .conv-pin-btn { opacity: 1; }
.conv-pin-btn:hover { color: var(--ambre); }
.conv-pin-btn.pinned { opacity: 1; color: var(--ambre); }

/* ── Status dots ──────────────────────────────────────────────────────────── */

.sidebar-status {
  display: flex;
  gap: 12px;
  padding: 6px 14px;
  border-top: 1px solid var(--border);
}
.status-dot {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  color: var(--text-dim);
}
.dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot.grey  { background: var(--text-dim); }
.dot.green { background: #00E676; box-shadow: 0 0 4px rgba(0,230,118,.4); }

/* ── Sidebar footer ────────────────────────────────────────────────────────── */

.sidebar-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
}

.client-badge { font-size: 11px; font-weight: 600; color: var(--ambre); background: var(--ambre-dim); border: 1px solid rgba(255,180,50,.2); border-radius: var(--radius-sm); padding: 3px 8px; }

.settings-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 16px; padding: 4px; border-radius: 4px; transition: color .12s, background .12s; }
.settings-btn:hover { color: var(--text); background: var(--surface); }

/* ── Main ──────────────────────────────────────────────────────────────────── */

.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; background: var(--bg); }

/* ── Topbar ────────────────────────────────────────────────────────────────── */

.topbar {
  height: var(--topbar-h);
  min-height: var(--topbar-h);
  background: var(--sidebar-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
}

.hamburger { display: none; background: none; border: none; color: var(--text-muted); font-size: 20px; cursor: pointer; padding: 4px; line-height: 1; }

.topbar-center { flex: 1; }

.topbar-title { font-size: 14px; font-weight: 600; color: var(--text); letter-spacing: .3px; }

.topbar-right { display: flex; align-items: center; gap: 8px; }

.model-select {
  background: var(--surface);
  border: 1px solid var(--border);
  color: #FFFFFF;
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 11px;
  font-family: var(--font);
  cursor: pointer;
  outline: none;
  opacity: .6;
  transition: border-color .12s, opacity .15s;
  min-width: 170px;
}

.model-select:hover, .model-select:focus { border-color: var(--cyan); opacity: 1; color: var(--text); }
.model-select option { background: var(--surface2); color: var(--text); }

.effort-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px 10px;
  opacity: .7;
  transition: border-color .12s, opacity .15s;
}
.effort-wrap:hover { border-color: var(--cyan); opacity: 1; }
.effort-label-edge { font-size: 10px; color: var(--text-muted); white-space: nowrap; user-select: none; }
.effort-slider {
  -webkit-appearance: none; appearance: none;
  width: 80px; height: 4px;
  background: var(--border2);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
.effort-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 14px; height: 14px;
  background: var(--cyan);
  border-radius: 50%;
  border: 2px solid var(--bg);
  cursor: pointer;
  transition: transform .1s;
}
.effort-slider::-webkit-slider-thumb:hover { transform: scale(1.2); }
.effort-slider::-moz-range-thumb {
  width: 14px; height: 14px;
  background: var(--cyan);
  border-radius: 50%;
  border: 2px solid var(--bg);
  cursor: pointer;
}
.effort-slider::-moz-range-track { background: var(--border2); height: 4px; border-radius: 2px; }

/* ── Context bar ───────────────────────────────────────────────────────────── */

.context-bar { height: var(--context-h); background: var(--surface); position: relative; overflow: visible; }

.context-bar-fill { height: 100%; background: linear-gradient(90deg, var(--cyan), var(--ambre)); transition: width .4s ease; border-radius: 0 2px 2px 0; }

.context-bar-label { position: absolute; right: 8px; top: 4px; font-size: 10px; color: var(--text-muted); white-space: nowrap; pointer-events: none; }

.context-bar.warn .context-bar-fill { background: linear-gradient(90deg, var(--ambre), var(--rouge)); }

/* ── Messages ──────────────────────────────────────────────────────────────── */

.messages-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 24px 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.messages-wrap::-webkit-scrollbar { width: 4px; }
.messages-wrap::-webkit-scrollbar-track { background: transparent; }
.messages-wrap::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

.welcome {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  gap: 12px;
}

.welcome-glyph {
  width: 64px; height: 64px;
  border-radius: 18px;
  background: var(--cyan-dim);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 700; color: var(--cyan); letter-spacing: -1px;
}

.welcome h2 { font-size: 22px; font-weight: 600; color: var(--text); }
.welcome p  { font-size: 13px; color: var(--text-muted); max-width: 320px; line-height: 1.7; }

/* Layout Claude Desktop : colonne centrée, messages empilés verticalement */
.message {
  display: flex;
  flex-direction: column;
  padding: 12px 32px;
  max-width: 820px;
  width: 100%;
  margin: 0 auto;
}

.message.user {
  flex-direction: column;
  align-items: flex-end;
}

.msg-avatar { display: none; }

.msg-sender {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 4px;
  letter-spacing: .2px;
}
.message.ai .msg-sender { color: var(--cyan); }
.message.user .msg-sender { color: var(--ambre); }

.msg-body {
  background: none;
  border: none;
  border-radius: 0;
  padding: 0;
  max-width: 100%;
  font-size: 15px;
  line-height: 1.4;
  word-break: break-word;
  color: var(--text);
}

.message.user .msg-body {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 8px 14px;
  max-width: 80%;
  text-align: left;
}

.msg-body h1, .msg-body h2, .msg-body h3 { margin: 8px 0 3px; font-size: 15px; color: var(--cyan); font-weight: 600; }
.msg-body p  { margin: 0 0 4px; }
.msg-body p:last-child { margin-bottom: 0; }
.msg-body ul, .msg-body ol { padding-left: 20px; margin: 4px 0; line-height: 1.35; }
.msg-body li { margin: 1px 0; }
.msg-body li p { margin: 0; display: inline; }
.msg-body ul br, .msg-body ol br { display: none; }
.msg-body code { background: var(--bg); border: 1px solid var(--border2); border-radius: 3px; padding: 1px 5px; font-size: 13px; font-family: 'JetBrains Mono','Fira Code',monospace; color: var(--ambre); }
.msg-body pre { background: var(--bg); border: 1px solid var(--border2); border-radius: var(--radius-sm); padding: 14px; overflow-x: auto; margin: 10px 0; }
.msg-body pre code { background: none; border: none; padding: 0; color: var(--text); font-size: 13px; }
.msg-body blockquote { border-left: 3px solid var(--cyan); padding-left: 12px; margin: 8px 0; color: var(--text-muted); }
.msg-body a { color: var(--cyan); text-decoration: none; }
.msg-body a:hover { text-decoration: underline; }
.msg-body strong { color: var(--text); font-weight: 600; }

.msg-time { font-size: 10px; color: var(--text-dim); margin-top: 6px; }

.typing-cursor::after { content: '▍'; color: var(--cyan); animation: blink .7s infinite; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

/* ── Input bar ─────────────────────────────────────────────────────────────── */

.input-bar { padding: 12px 32px 14px; border-top: 1px solid var(--border); background: var(--sidebar-bg); }
.input-bar > * { max-width: 820px; margin-left: auto; margin-right: auto; }

.file-preview-area { display: flex; flex-direction: column; gap: 4px; margin-bottom: 6px; }

.file-preview { display: inline-flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--border2); border-radius: var(--radius-sm); padding: 5px 10px; font-size: 12px; color: var(--text); }

.file-preview-name { font-weight: 500; }

.file-preview-remove { background: none; border: none; color: var(--rouge); cursor: pointer; font-size: 12px; padding: 0 2px; }

.input-wrap {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--surface);
  border: 1px solid rgba(0, 204, 247, .2);
  border-radius: var(--radius);
  padding: 10px 14px;
  transition: border-color .15s, box-shadow .2s;
  box-shadow: 0 0 12px rgba(0, 204, 247, .08), 0 0 4px rgba(0, 204, 247, .05);
}

.input-wrap:focus-within {
  border-color: var(--cyan);
  box-shadow: 0 0 20px rgba(0, 204, 247, .15), 0 0 6px rgba(0, 204, 247, .1);
}

.upload-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 16px; padding: 2px; flex-shrink: 0; transition: color .12s; }
.upload-btn:hover { color: var(--cyan); }

#chat-input { flex: 1; background: none; border: none; outline: none; color: var(--text); font-family: var(--font); font-size: 16px; line-height: 1.5; resize: none; min-height: 48px; max-height: 120px; overflow-y: auto; }
#chat-input::placeholder { color: var(--text-dim); }

.mic-btn {
  background: none; border: 1px solid var(--border); color: var(--text-muted);
  cursor: pointer; width: 32px; height: 32px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  transition: color .15s, border-color .15s, background .15s;
}
.mic-btn:hover { color: var(--text); border-color: var(--border2); }
.mic-btn.recording {
  color: var(--rouge); border-color: var(--rouge);
  background: var(--rouge-dim);
  animation: mic-pulse 1.2s ease-in-out infinite;
}
@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,71,87,.3); }
  50% { box-shadow: 0 0 0 6px rgba(255,71,87,0); }
}

.send-btn { background: var(--cyan); border: none; color: var(--bg); cursor: pointer; font-size: 14px; width: 44px; height: 44px; min-width: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: background .12s, opacity .12s; }
.send-btn:hover { background: #1ADEFF; }
.send-btn:disabled { opacity: .4; cursor: not-allowed; }

.input-hint { font-size: 10px; color: var(--text-dim); margin-top: 5px; text-align: center; }

/* ── Toast ─────────────────────────────────────────────────────────────────── */

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 12px 18px;
  font-size: 13px;
  color: var(--text);
  z-index: 9999;
  display: none;
  max-width: 320px;
  box-shadow: 0 8px 32px rgba(0,0,0,.4);
  animation: toast-in .2s ease;
}

.toast.visible { display: block; }
.toast.success { border-color: var(--cyan); color: var(--cyan); }
.toast.error   { border-color: var(--rouge); color: var(--rouge); }

@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ── Modal ─────────────────────────────────────────────────────────────────── */

.modal-overlay { position: fixed; inset: 0; background: rgba(4,8,15,.75); display: none; align-items: center; justify-content: center; z-index: 1000; }
.modal-overlay.open { display: flex; }

.modal { background: var(--sidebar-bg); border: 1px solid var(--border2); border-radius: 14px; width: 360px; max-width: 90vw; box-shadow: 0 24px 64px rgba(0,0,0,.5); }

.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 14px; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 15px; font-weight: 600; }

.modal-close { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 16px; padding: 4px; border-radius: 4px; transition: color .12s, background .12s; }
.modal-close:hover { color: var(--text); background: var(--surface); }

.modal-body { padding: 16px 20px; display: flex; flex-direction: column; gap: 14px; }

.field { display: flex; flex-direction: column; gap: 5px; }
.field-label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .4px; }

.field input { background: var(--surface); border: 1px solid var(--border2); border-radius: var(--radius-sm); color: var(--text); font-family: var(--font); font-size: 13px; padding: 8px 12px; outline: none; transition: border-color .12s; }
.field input:focus { border-color: var(--cyan); }
.field input::placeholder { color: var(--text-dim); }

.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px 18px; border-top: 1px solid var(--border); }

.btn-ghost { background: none; border: 1px solid var(--border2); color: var(--text-muted); border-radius: var(--radius-sm); padding: 7px 16px; font-size: 13px; font-family: var(--font); cursor: pointer; transition: border-color .12s, color .12s; }
.btn-ghost:hover { border-color: var(--text-muted); color: var(--text); }

.btn-primary { background: var(--cyan); border: none; color: var(--bg); border-radius: var(--radius-sm); padding: 7px 18px; font-size: 13px; font-weight: 600; font-family: var(--font); cursor: pointer; transition: background .12s; }
.btn-primary:hover { background: #1ADEFF; }

/* ── Sidebar overlay ───────────────────────────────────────────────────────── */

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 499;
}
.sidebar-overlay.visible { display: block; }

/* ── Mobile ────────────────────────────────────────────────────────────────── */

@media (max-width: 700px) {
  .sidebar {
    position: fixed;
    top: 0; left: 0;
    height: 100%;
    height: 100dvh;
    z-index: 500;
    transform: translateX(-100%);
    width: 80vw;
    max-width: 320px;
  }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,.5); }
  .sidebar-close-btn { display: flex; }
  .hamburger { display: flex; }
  .msg-body { max-width: 88%; }
  .topbar { padding: 0 12px; }

  .messages-wrap {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    scroll-padding-bottom: 80px;
  }

  .input-bar {
    padding: 8px 12px 8px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
  }
  .input-hint { display: none; }
  .input-wrap { padding: 8px 10px; }

  .message { padding: 10px 16px; }

  .topbar-right { gap: 4px; }
  .reload-btn { display: flex; }
  .model-select { min-width: 100px; font-size: 10px; padding: 3px 4px; }
  .effort-wrap { display: none; }
  .temp-wrap { display: none; }

  .welcome { padding: 32px 16px; }
}

/* ── Thème clair ──────────────────────────────────────────────────────────────── */

[data-theme="light"] {
  --bg:         #F0F4FA;
  --sidebar-bg: #FFFFFF;
  --surface:    #E8EDF5;
  --surface2:   #DDE4F0;
  --border:     #C8D4E8;
  --border2:    #B5C4DC;
  --text:       #0D1929;
  --text-muted: #4A6680;
  --text-dim:   #8099B5;
  --cyan-dim:   rgba(0,204,247,.13);
  --ambre-dim:  rgba(255,180,50,.13);
  --rouge-dim:  rgba(255,71,87,.1);
}

[data-theme="light"] .modal-overlay    { background: rgba(100,130,165,.5); }
[data-theme="light"] .toast            { box-shadow: 0 8px 32px rgba(0,0,0,.12); }
[data-theme="light"] .msg-body code    { background: var(--surface2); }
[data-theme="light"] .msg-body pre     { background: var(--surface2); }
[data-theme="light"] .sidebar          { box-shadow: 2px 0 12px rgba(0,0,0,.06); }

/* ── Boutons icônes (topbar) ─────────────────────────────────────────────────── */

.icon-btn {
  background: none;
  border: 1px solid var(--border);
  color: #FFFFFF;
  border-radius: var(--radius-sm);
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: color .12s, border-color .12s, background .12s;
  flex-shrink: 0;
}
.icon-btn:hover   { color: var(--text); border-color: var(--border2); background: var(--surface); }

.reload-btn { display: none; font-size: 16px; font-weight: 700; }
.icon-btn.active  { color: var(--cyan); border-color: rgba(0,204,247,.4); background: var(--cyan-dim); }

/* Visibilité des icônes soleil/lune selon le thème actif */
[data-theme="dark"]  .icon-sun  { display: block; }
[data-theme="dark"]  .icon-moon { display: none;  }
[data-theme="light"] .icon-sun  { display: none;  }
[data-theme="light"] .icon-moon { display: block; }

/* ── Modal connecteurs ───────────────────────────────────────────────────────── */

.conn-modal { width: 600px; max-width: 96vw; }

.conn-modal-body {
  max-height: 70vh;
  overflow-y: auto;
}
.conn-modal-body::-webkit-scrollbar { width: 4px; }
.conn-modal-body::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

.conn-section { padding: 14px 20px; border-bottom: 1px solid var(--border); }
.conn-section:last-child { border-bottom: none; }

.conn-section-title { font-size: 10px; font-weight: 700; color: var(--text-muted); letter-spacing: .6px; text-transform: uppercase; margin-bottom: 10px; }

/* Cartes actives */
.conn-card {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1px solid rgba(0,204,247,.25); background: var(--cyan-dim);
  margin-bottom: 6px;
}
.conn-card:last-child { margin-bottom: 0; }
.conn-card-icon { font-size: 20px; flex-shrink: 0; }
.conn-card-info { flex: 1; min-width: 0; }
.conn-card-name { font-size: 13px; font-weight: 600; color: var(--text); }
.conn-card-desc { font-size: 11px; color: var(--text-muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Badges */
.conn-badge { font-size: 10px; font-weight: 600; border-radius: 4px; padding: 2px 8px; flex-shrink: 0; }
.conn-badge-on   { background: rgba(0,204,247,.12); color: var(--cyan);  border: 1px solid rgba(0,204,247,.3); }


/* Catalogue grid */
.conn-grid { display: grid; grid-template-columns: 1fr; gap: 8px; }

.conn-catalog-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface);
  transition: border-color .12s, background .12s; min-width: 0;
}
.conn-catalog-item:hover { border-color: var(--border2); }
.conn-catalog-item.connected { border-color: rgba(0,204,247,.3); background: var(--cyan-dim); }

.conn-catalog-item-icon { font-size: 18px; flex-shrink: 0; }
.conn-catalog-item-body { flex: 1; min-width: 0; }
.conn-catalog-item-name { font-size: 12px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conn-catalog-item-desc { font-size: 10px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conn-catalog-item-actions { flex-shrink: 0; }

.conn-btn-connect {
  font-size: 10px; font-weight: 600; padding: 4px 10px; border-radius: 4px;
  border: 1px solid var(--border2); background: var(--surface2); color: var(--text-muted);
  cursor: pointer; transition: all .12s; flex-shrink: 0; white-space: nowrap;
}
.conn-btn-connect:hover { border-color: var(--cyan); color: var(--cyan); background: var(--cyan-dim); }
.conn-btn-disconnect {
  font-size: 10px; font-weight: 600; padding: 4px 10px; border-radius: 4px;
  border: 1px solid rgba(255,71,87,.3); background: var(--rouge-dim); color: var(--rouge);
  cursor: pointer; transition: all .12s; flex-shrink: 0; white-space: nowrap;
}
.conn-btn-disconnect:hover { border-color: var(--rouge); }

/* Rangée token */
.conn-token-row {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 10px; margin-top: -4px;
  border: 1px solid var(--border); border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  background: var(--surface);
}
.conn-token-input { flex: 1; min-width: 0; font-size: 11px; padding: 5px 8px; }
.conn-btn-confirm {
  font-size: 10px; font-weight: 700; padding: 5px 12px; border-radius: 4px;
  border: 1px solid var(--cyan); background: var(--cyan-dim); color: var(--cyan);
  cursor: pointer; transition: all .12s; white-space: nowrap;
}
.conn-btn-confirm:hover { background: var(--cyan); color: var(--bg); }

/* Formulaire serveur personnalisé */
.conn-custom-form { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }

.conn-text-input {
  flex: 1; min-width: 110px;
  background: var(--surface); border: 1px solid var(--border2);
  border-radius: var(--radius-sm); color: var(--text);
  font-family: var(--font); font-size: 12px; padding: 7px 10px;
  outline: none; transition: border-color .12s;
}
.conn-text-input:focus { border-color: var(--cyan); }
.conn-text-input::placeholder { color: var(--text-dim); }
.conn-url-input { flex: 2; }

.conn-custom-list { display: flex; flex-direction: column; gap: 6px; }

.conn-custom-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  border: 1px solid rgba(0,204,247,.25); background: var(--cyan-dim);
}
.conn-custom-item-name { font-size: 12px; font-weight: 600; color: var(--text); white-space: nowrap; }
.conn-custom-item-url  { flex: 1; font-size: 10px; color: var(--text-muted); min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conn-custom-item-del  { background: none; border: none; color: var(--text-dim); cursor: pointer; font-size: 11px; padding: 2px 4px; transition: color .12s; flex-shrink: 0; }
.conn-custom-item-del:hover { color: var(--rouge); }

.claude-redirect-section {
  margin-top: 16px; padding: 16px 20px; border-radius: var(--radius-sm);
  background: rgba(0,204,247,.05); border-top: 1px solid rgba(0,204,247,.15);
}
.claude-redirect-section p { font-size: 12px; color: #888; line-height: 1.6; margin: 0 0 8px; }
.claude-redirect-section p:last-of-type { margin-bottom: 12px; }
.claude-redirect-section a {
  display: inline-block; font-size: 12px; font-weight: 600; color: #00CCF7;
  text-decoration: none; transition: opacity .15s;
}
.claude-redirect-section a:hover { opacity: .8; }

@media (max-width: 540px) {
  .conn-custom-form { flex-direction: column; }
}

/* ── Panneau artefact ──────────────────────────────────────────────────────── */

.artifact-panel {
  width: 0;
  min-width: 0;
  overflow: hidden;
  background: var(--sidebar-bg);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: width .25s ease, min-width .25s ease;
}
.artifact-panel.open {
  width: 45%;
  min-width: 400px;
}
.artifact-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.artifact-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.artifact-actions {
  display: flex;
  gap: 6px;
}
.artifact-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 13px;
  transition: color .12s, border-color .12s;
}
.artifact-btn:hover { color: var(--text); border-color: var(--border2); }
.artifact-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  flex-shrink: 0;
}
.artifact-tab {
  padding: 6px 14px;
  font-size: 11px;
  color: var(--text-muted);
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  font-family: var(--font);
}
.artifact-tab.active {
  color: var(--cyan);
  border-bottom-color: var(--cyan);
}
.artifact-body {
  flex: 1;
  overflow: hidden;
}
.artifact-panel.fullscreen {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100% !important;
  min-width: 0 !important;
  z-index: 1000;
  border-left: none;
}
@media (max-width: 700px) {
  .artifact-panel.open {
    position: fixed;
    top: 0; right: 0; bottom: 0;
    width: 100% !important;
    min-width: 0 !important;
    z-index: 900;
  }
}

/* ── Markdown tables ─────────────────────────────────────────────────────────── */
.md-table-wrap {
  overflow-x: auto;
  margin: 10px 0;
}
.md-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
}
.md-table th, .md-table td {
  border: 1px solid var(--border2);
  padding: 8px 12px;
  text-align: left;
}
.md-table th {
  background: var(--surface2);
  font-weight: 600;
  color: var(--cyan);
  white-space: nowrap;
}
.md-table td {
  background: var(--surface);
}
.md-table tr:hover td {
  background: var(--cyan-dim);
}

/* ── Artifact cards (clickable, opens side panel) ────────────────────────────── */
.artifact-card {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 12px 0;
  padding: 14px 16px;
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.artifact-card:hover {
  border-color: var(--cyan);
  background: var(--cyan-dim);
}
.artifact-card-icon {
  font-size: 24px;
  flex-shrink: 0;
}
.artifact-card-body { flex: 1; min-width: 0; }
.artifact-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.artifact-card-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
.artifact-card-arrow {
  font-size: 18px;
  color: var(--text-dim);
  flex-shrink: 0;
  transition: color .15s;
}
.artifact-card:hover .artifact-card-arrow { color: var(--cyan); }
.artifact-card-loading {
  cursor: default;
  border-color: var(--border);
  opacity: .8;
}
.artifact-card-loading:hover {
  border-color: var(--border);
  background: var(--surface);
}

/* ── Mermaid diagrams ────────────────────────────────────────────────────────── */
.mermaid-container {
  margin: 12px 0;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  text-align: center;
}
.mermaid-container .mermaid-loading {
  color: var(--text-muted);
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px 0;
}
.mermaid-container.mermaid-rendered svg {
  max-width: 100%;
  height: auto;
}

/* ── Retry buttons ───────────────────────────────────────────────────────────── */
.retry-btn {
  display: inline-block;
  margin-top: 10px;
  padding: 6px 14px;
  background: var(--surface2);
  color: var(--cyan);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  transition: background .15s;
}
.retry-btn:hover { background: var(--cyan-dim); }
.msg-actions {
  opacity: 0;
  transition: opacity .15s;
  margin-top: 4px;
  display: flex;
  gap: 4px;
  align-items: center;
}
.message.ai:hover .msg-actions { opacity: 1; }
.retry-btn-subtle {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: var(--radius-sm);
  padding: 2px 8px;
  cursor: pointer;
  font-size: 14px;
  transition: color .15s, border-color .15s;
}
.retry-btn-subtle:hover { color: var(--cyan); border-color: var(--cyan); }

.msg-action-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: var(--radius-sm);
  padding: 4px 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color .15s, border-color .15s;
}
.msg-action-btn:hover { color: var(--cyan); border-color: var(--cyan); }

/* ── Stop button ─────────────────────────────────────────────────────────────── */
.send-btn.stop-mode {
  background: var(--rouge);
  color: #fff;
  font-size: 10px;
  line-height: 1;
  border-radius: 50%;
}
.send-btn.stop-mode:hover { background: #e63946; }

/* ── Thinking blocks ─────────────────────────────────────────────────────────── */
.msg-thinking {
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow: hidden;
}
.thinking-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  user-select: none;
}
.thinking-label {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
  flex: 1;
}
.thinking-toggle {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 14px;
  cursor: pointer;
  padding: 0 4px;
}
.thinking-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--border2);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: think-spin .8s linear infinite;
}
@keyframes think-spin { to { transform: rotate(360deg); } }
.thinking-body {
  padding: 0 12px 10px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-dim);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 200px;
  overflow-y: auto;
}
.msg-thinking.collapsed .thinking-body { display: none; }
.msg-thinking.collapsed { border-color: transparent; background: transparent; }
.msg-thinking.collapsed .thinking-header { padding: 4px 0; }

/* ── Conversation search ────────────────────────────────────────────────────── */
.conv-search-wrap { padding: 4px 12px 6px; }
.conv-search-input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 11px;
  padding: 6px 10px;
  outline: none;
  transition: border-color .12s;
}
.conv-search-input:focus { border-color: var(--cyan); }
.conv-search-input::placeholder { color: var(--text-dim); }

/* ── Temperature control ────────────────────────────────────────────────────── */
.temp-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  opacity: .7;
  transition: border-color .12s, opacity .15s;
}
.temp-wrap:hover { border-color: var(--cyan); opacity: 1; }
.temp-label { font-size: 10px; color: var(--text-muted); white-space: nowrap; user-select: none; }
.temp-input {
  width: 38px;
  background: none;
  border: none;
  color: var(--text);
  font-family: var(--font);
  font-size: 11px;
  text-align: center;
  outline: none;
  -moz-appearance: textfield;
}
.temp-input::-webkit-inner-spin-button,
.temp-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* ── Drag & drop overlay ────────────────────────────────────────────────────── */
.drop-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,204,247,.08);
  border: 2px dashed var(--cyan);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  pointer-events: none;
}
.drop-overlay-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--cyan);
  background: var(--surface);
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--cyan);
}
.main { position: relative; }

/* ── Image thumbnail in file preview ────────────────────────────────────────── */
.file-preview-thumb {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--border);
}

/* ── Conversation rename input ──────────────────────────────────────────────── */
.conv-rename-input {
  background: var(--surface);
  border: 1px solid var(--cyan);
  border-radius: 3px;
  color: var(--text);
  font-family: var(--font);
  font-size: 12px;
  padding: 1px 4px;
  outline: none;
  width: 100%;
}

/* ── Highlight.js overrides ─────────────────────────────────────────────────── */
.msg-body pre code.hljs {
  background: none;
  padding: 0;
  border: none;
  font-size: 13px;
}
[data-theme="light"] .msg-body pre code.hljs { color: var(--text); }

/* ── Mobile typography (lisibilité iPhone) ────────────────────────────────── */
@media (max-width: 768px) {
  .message.ai .msg-body { font-size: 18px; line-height: 1.7; }
  .message.user .msg-body { font-size: 17px; line-height: 1.6; }
  .msg-body h2 { font-size: 17px; }
  .msg-body h3 { font-size: 17px; }
  .msg-body p { margin-bottom: 1.4em; }
  .msg-body p:last-child { margin-bottom: 0; }
  .md-table th, .md-table td { padding: 10px 12px; }
}

/* ── Token gauge (sidebar) ────────────────────────────────────────────────── */
.token-gauge {
  padding: 8px 16px 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.token-gauge-track {
  height: 6px;
  background: var(--bg-secondary);
  border-radius: 3px;
  overflow: hidden;
}
.token-gauge-fill {
  height: 100%;
  border-radius: 3px;
  transition: width .4s ease, background .3s;
  background: var(--text-dim);
}
.token-gauge-fill[data-level="blue"]   { background: var(--cyan); }
.token-gauge-fill[data-level="orange"] { background: var(--ambre); }
.token-gauge-fill[data-level="red"]    { background: #ef4444; }
.token-gauge-fill[data-level="blink"]  { background: #ef4444; animation: gauge-blink 1s ease-in-out infinite; }
@keyframes gauge-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: .4; }
}
.token-gauge-label {
  font-size: 11px;
  color: var(--text-dim);
  text-align: right;
}

/* ── Document library (settings modal) ───────────────────────────────────── */
.doc-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: var(--bg-secondary);
  border-radius: 6px;
}
.doc-row .doc-name {
  flex: 1;
  word-break: break-word;
  font-size: 13px;
}
.doc-row .doc-tokens {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
}
.doc-row .doc-del-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 14px;
  flex-shrink: 0;
}
.doc-row .doc-del-btn:hover { color: #ef4444; }

/* ── Copy button on code blocks ──────────────────────────────────────────── */
.copy-code-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(255,255,255,0.08);
  border: none;
  border-radius: 4px;
  padding: 4px 6px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 13px;
  opacity: 0;
  transition: opacity .15s, background .15s;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
pre:hover .copy-code-btn { opacity: 1; }
.copy-code-btn:hover { background: rgba(255,255,255,0.15); }
.copy-code-btn.copied { color: #00E676; }

/* ── Tool indicator ──────────────────────────────────────────────────────── */
.tool-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  padding: 6px 0;
  margin-bottom: 4px;
}
.tool-spinner {
  width: 10px; height: 10px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: tool-spin 0.6s linear infinite;
  flex-shrink: 0;
}
@keyframes tool-spin { to { transform: rotate(360deg); } }

/* ── Message edit ────────────────────────────────────────────────────────── */
.msg-edit-area {
  width: 100%;
  min-height: 60px;
  background: var(--bg);
  border: 1px solid var(--cyan);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  padding: 8px 12px;
  resize: vertical;
  outline: none;
}
.msg-edit-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  justify-content: flex-end;
}
.msg-edit-actions button {
  padding: 5px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: var(--font);
  cursor: pointer;
  border: 1px solid var(--border);
}
.msg-edit-cancel {
  background: none;
  color: var(--text-muted);
}
.msg-edit-cancel:hover { color: var(--text); border-color: var(--text-muted); }
.msg-edit-submit {
  background: var(--cyan);
  color: var(--bg);
  border-color: var(--cyan) !important;
  font-weight: 600;
}
.msg-edit-submit:hover { background: #1ADEFF; }

.message.user:hover .msg-actions { opacity: 1; }
.msg-edit-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: var(--radius-sm);
  padding: 4px 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color .15s, border-color .15s;
}
.msg-edit-btn:hover { color: var(--cyan); border-color: var(--cyan); }

/* ── Mobile overrides (must be last to win cascade) ───────────────────────── */
@media (max-width: 700px) {
  .temp-wrap { display: none; }
  .effort-wrap { display: none; }
}
