/* ═══════════════════════════════════════════════════════════
   RedLexi — AI Interface
   Smooth crimson red theme · Inter · Pixel-perfect layout
═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,300..800;1,14..32,300..800&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  /* ── Surfaces (warm near-white) ── */
  --bg:        #faf9f8;
  --surface-0: #ffffff;
  --surface-1: #f5f3f2;
  --surface-2: #ede9e7;
  --surface-3: #e4dfdc;
  --border:    #ddd8d5;
  --border-hi: #ccc5c0;

  /* ── Sidebar (deep charcoal) ── */
  --sb-bg:      #1a1412;
  --sb-surface: #231d1a;
  --sb-hover:   #2e2622;
  --sb-active:  #3a2f2a;
  --sb-text:    #c8bfb8;
  --sb-text-dim:#6e6560;
  --sb-text-hi: #f0ebe8;

  /* ── Red accent palette ── */
  --accent:       #c0392b;
  --accent-2:     #a93226;
  --accent-3:     #e74c3c;
  --accent-light: #f5b7b1;
  --accent-dim:   #fdf2f1;
  --accent-glow:  rgba(192, 57, 43, 0.15);
  --accent-glow2: rgba(192, 57, 43, 0.08);

  /* ── Status ── */
  --green:     #27ae60;
  --green-dim: #eafaf1;
  --amber:     #e67e22;
  --amber-dim: #fef9f0;
  --red:       #c0392b;
  --red-dim:   #fdf2f1;
  --blue:      #2980b9;
  --cyan:      #17a589;

  /* ── Text ── */
  --text:   #1a1412;
  --text-2: #6b6560;
  --text-3: #aaa49f;

  /* ── Type ── */
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --mono: 'IBM Plex Mono', 'Fira Code', ui-monospace, monospace;

  /* ── Shape ── */
  --r-xs: 4px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;

  --sidebar-w: 258px;
  --topbar-h:  52px;
}

/* ── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.6;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
button { cursor: pointer; border: none; background: none; font: inherit; color: inherit; }
input, select, textarea { font: inherit; color: inherit; background: none; border: none; outline: none; }
textarea { resize: none; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hi); }

/* ═══ SHELL ═════════════════════════════════════════════ */
.shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

/* ═══ SIDEBAR ═══════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--sb-bg);
  display: flex;
  flex-direction: column;
  transition: width .22s cubic-bezier(.4,0,.2,1),
              min-width .22s cubic-bezier(.4,0,.2,1),
              opacity .18s;
  overflow: hidden;
  z-index: 20;
  flex-shrink: 0;
}
.sidebar.collapsed {
  width: 0; min-width: 0; opacity: 0; pointer-events: none;
}

/* ── Header ── */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 14px 6px;
  flex-shrink: 0;
}
.brand {
  display: flex; align-items: center; gap: 9px;
  text-decoration: none;
}
.brand-logo {
  width: 28px; height: 28px; flex-shrink: 0; display: block;
}
.brand-name {
  font-size: 15px; font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--sb-text-hi);
}
.brand-name span { color: var(--accent-3); }

.sidebar-collapse-btn {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm);
  color: var(--sb-text-dim);
  transition: background .12s, color .12s;
  flex-shrink: 0;
}
.sidebar-collapse-btn:hover { background: var(--sb-hover); color: var(--sb-text); }

/* ── New chat ── */
.sidebar-new-chat { padding: 8px 10px 4px; flex-shrink: 0; }
.new-chat-btn {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--r-md);
  font-size: 13px; font-weight: 500;
  color: var(--sb-text);
  border: 1px solid rgba(255,255,255,0.07);
  background: rgba(255,255,255,0.04);
  transition: background .12s, border-color .12s, color .12s;
  white-space: nowrap;
}
.new-chat-btn:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(192,57,43,0.35);
  color: var(--sb-text-hi);
}
.new-chat-btn svg { flex-shrink: 0; opacity: 0.7; }

/* ── Nav ── */
.sidebar-nav {
  padding: 6px 8px 2px;
  flex-shrink: 0;
  display: flex; flex-direction: column; gap: 1px;
}
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 10px;
  border-radius: var(--r-sm);
  font-size: 13px; font-weight: 450;
  color: var(--sb-text);
  transition: background .1s, color .1s;
  text-align: left; width: 100%; white-space: nowrap;
}
.nav-item:hover { background: var(--sb-hover); color: var(--sb-text-hi); }
.nav-item.active {
  background: var(--sb-active);
  color: var(--sb-text-hi);
  position: relative;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 2.5px;
  background: var(--accent-3);
  border-radius: 0 2px 2px 0;
}
.nav-item svg { flex-shrink: 0; opacity: 0.6; }
.nav-item.active svg, .nav-item:hover svg { opacity: 1; }
.nav-divider { height: 1px; background: rgba(255,255,255,0.06); margin: 5px 10px; }

/* ── Chat history ── */
.chat-history {
  flex: 1; overflow-y: auto;
  padding: 4px 8px; min-height: 0;
}
.chat-history-label {
  font-size: 10.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--sb-text-dim);
  padding: 8px 10px 4px;
}
.chat-history-list { display: flex; flex-direction: column; gap: 1px; }
.chat-history-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px;
  border-radius: var(--r-sm);
  font-size: 12.5px; color: var(--sb-text);
  cursor: pointer;
  transition: background .1s, color .1s;
}
.chat-history-item:hover { background: var(--sb-hover); color: var(--sb-text-hi); }
.chat-history-item.active { background: var(--sb-active); color: var(--sb-text-hi); }
.chat-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-close {
  opacity: 0; font-size: 11px; color: var(--sb-text-dim);
  flex-shrink: 0; padding: 2px 4px; border-radius: 3px;
  transition: opacity .1s, color .1s, background .1s;
}
.chat-history-item:hover .chat-close { opacity: 1; }
.chat-close:hover { color: var(--accent-3); background: rgba(231,76,60,.12); }

/* ── Profile / bottom ── */
.sidebar-profile {
  padding: 6px 8px 10px;
  border-top: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0; position: relative;
}
.profile-btn {
  display: flex; align-items: center; gap: 9px;
  width: 100%; padding: 8px 10px;
  border-radius: var(--r-sm);
  transition: background .12s;
}
.profile-btn:hover { background: var(--sb-hover); }
.profile-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-2), var(--accent-3));
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.profile-name {
  font-size: 13px; font-weight: 500; color: var(--sb-text-hi);
  flex: 1; text-align: left;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.profile-chevron { opacity: 0.4; transition: transform .2s; flex-shrink: 0; }

/* Profile dropdown */
.profile-dropdown {
  display: none; position: absolute;
  bottom: calc(100% + 4px); left: 8px; right: 8px;
  background: #1e1916;
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: var(--r-md);
  padding: 5px; z-index: 100;
  box-shadow: 0 -16px 48px rgba(0,0,0,.55);
}
.profile-dropdown.open { display: block; }
.dropdown-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 8px 10px;
  border-radius: var(--r-xs);
  font-size: 13px; color: var(--sb-text);
  text-align: left; transition: background .1s, color .1s;
}
.dropdown-item:hover { background: var(--sb-hover); color: var(--sb-text-hi); }
.dropdown-item svg { opacity: 0.5; flex-shrink: 0; }
.dropdown-item:hover svg { opacity: 0.85; }
.dropdown-item.upgrade { color: var(--accent-3); font-weight: 500; }
.dropdown-item.upgrade svg { opacity: 0.8; color: var(--accent-3); }
.dropdown-item.danger { color: #e74c3c; }
.dropdown-item.danger:hover { background: rgba(231,76,60,.1); }
.dropdown-divider { height: 1px; background: rgba(255,255,255,.06); margin: 4px 0; }

/* ── Sidebar open tab ── */
.sidebar-open-tab {
  position: fixed; left: 0; top: 0; bottom: 0; width: 32px;
  background: transparent; border-right: 1px solid var(--border);
  z-index: 10; opacity: 0; pointer-events: none;
  transition: opacity .2s;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2);
}
.sidebar.collapsed ~ .sidebar-open-tab { opacity: 1; pointer-events: all; }
.sidebar-open-tab:hover { background: var(--surface-1); color: var(--text); }

/* ═══ MAIN ═══════════════════════════════════════════════ */
.main-content {
  flex: 1; display: flex; flex-direction: column;
  overflow: hidden; background: var(--surface-0); min-width: 0;
}
.view-panel { display: none; flex: 1; flex-direction: column; overflow: hidden; }
.view-panel.active { display: flex; }

/* ── Page view (non-chat) ── */
.page-view {
  flex: 1; overflow-y: auto;
  padding: 40px 44px 60px;
  max-width: 920px; margin: 0 auto; width: 100%;
}
.page-header { margin-bottom: 32px; }
.page-header h1 {
  font-size: 26px; font-weight: 700;
  letter-spacing: -0.03em; color: var(--text); margin-bottom: 6px;
}
.page-header p { font-size: 14px; color: var(--text-2); line-height: 1.5; }

.page-empty-state {
  display: flex; flex-direction: column;
  align-items: center; text-align: center;
  padding: 64px 20px; gap: 12px;
}
.empty-icon { opacity: 0.2; margin-bottom: 4px; }
.page-empty-state h3 { font-size: 16px; font-weight: 600; color: var(--text); }
.page-empty-state p {
  font-size: 13.5px; color: var(--text-2);
  max-width: 380px; line-height: 1.6;
}

/* ── Buttons ── */
.primary-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px; border-radius: var(--r-md);
  background: var(--accent);
  color: #fff; font-size: 13.5px; font-weight: 500;
  transition: background .12s, transform .1s, box-shadow .12s;
  border: none;
}
.primary-btn:hover { background: var(--accent-2); box-shadow: 0 4px 16px var(--accent-glow); }
.primary-btn:active { transform: scale(.98); }
.primary-btn.small { padding: 7px 14px; font-size: 12.5px; }

.ghost-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: var(--r-sm);
  border: 1px solid var(--border); color: var(--text-2);
  font-size: 13px; font-weight: 450;
  transition: background .12s, border-color .12s, color .12s;
}
.ghost-btn:hover { background: var(--surface-1); border-color: var(--border-hi); color: var(--text); }
.ghost-btn.accent { color: var(--accent); border-color: var(--accent-light); }
.ghost-btn.accent:hover { background: var(--accent-dim); border-color: var(--accent); }
.ghost-btn.danger { color: var(--red); border-color: var(--accent-light); }
.ghost-btn.danger:hover { background: var(--red-dim); border-color: var(--red); }
.ghost-btn.small { padding: 5px 10px; font-size: 12px; }

.icon-btn {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm); color: var(--text-2);
  transition: background .1s, color .1s;
  flex-shrink: 0;
}
.icon-btn:hover { background: var(--surface-1); color: var(--text); }
.icon-btn.active { color: var(--accent); background: var(--accent-dim); }

/* ── Toggle ── */
.toggle {
  position: relative; display: inline-block;
  width: 38px; height: 22px; flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-track {
  position: absolute; inset: 0;
  background: var(--surface-3);
  border-radius: 11px; border: 1.5px solid var(--border);
  transition: background .2s, border-color .2s;
  cursor: pointer;
}
.toggle-track::after {
  content: '';
  position: absolute; left: 2px; top: 2px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--text-3);
  transition: transform .2s, background .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle input:checked + .toggle-track { background: var(--accent); border-color: var(--accent-2); }
.toggle input:checked + .toggle-track::after { transform: translateX(16px); background: #fff; }
.toggle.sm { width: 30px; height: 18px; }
.toggle.sm .toggle-track::after { width: 11px; height: 11px; }
.toggle.sm input:checked + .toggle-track::after { transform: translateX(12px); }

/* ═══ CHAT VIEW ══════════════════════════════════════════ */

/* ── Topbar ── */
.chat-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; height: var(--topbar-h);
  border-bottom: 1px solid var(--border);
  background: var(--surface-0);
  flex-shrink: 0; gap: 12px;
}
.topbar-left { display: flex; align-items: center; gap: 8px; }
.topbar-center { display: flex; align-items: center; }
.topbar-right { display: flex; align-items: center; gap: 4px; }

.sidebar-open-btn { display: none; }
.sidebar.collapsed ~ .main-content .sidebar-open-btn { display: flex; }

/* ── Model picker ── */
.model-picker { position: relative; }
.model-current {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border-radius: var(--r-md);
  font-size: 13.5px; font-weight: 500;
  color: var(--text);
  border: 1px solid var(--border);
  background: var(--surface-0);
  transition: background .1s, border-color .1s, box-shadow .1s;
  white-space: nowrap;
}
.model-current:hover { background: var(--surface-1); border-color: var(--border-hi); box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.model-current svg { opacity: 0.45; }

.model-dropdown {
  display: none; position: absolute;
  top: calc(100% + 5px); left: 0; width: 310px;
  background: var(--surface-0);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: 0 8px 32px rgba(0,0,0,.12);
  z-index: 200; padding: 8px; overflow: hidden;
}
.model-dropdown.open { display: block; }
.model-group-label {
  font-size: 10.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-3); padding: 6px 10px 4px;
}
.model-opt {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 8px 10px;
  border-radius: var(--r-sm);
  transition: background .1s; text-align: left;
}
.model-opt:hover { background: var(--surface-1); }
.model-opt.selected { background: var(--accent-dim); }
.model-opt > div { flex: 1; min-width: 0; }
.model-opt strong { display: block; font-size: 13px; font-weight: 500; color: var(--text); }
.model-opt small { font-size: 11.5px; color: var(--text-2); }
.model-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.model-dot.green { background: var(--green); }
.model-dot.amber { background: var(--amber); }
.model-dot.blue  { background: var(--blue); }
.model-dot.cyan  { background: var(--cyan); }
.model-dot.red   { background: var(--accent-3); }
.model-badge {
  font-size: 10px; font-weight: 600;
  font-family: var(--mono);
  padding: 2px 6px; border-radius: 4px;
  flex-shrink: 0; text-transform: uppercase; letter-spacing: .04em;
}
.model-badge.free { background: var(--green-dim); color: var(--green); }
.model-badge.sp   { background: var(--amber-dim); color: var(--amber); }
.model-badge.pro  { background: var(--accent-dim); color: var(--accent); }

.model-toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px; font-size: 13px; color: var(--text-2);
}
.agent-config {
  max-height: 0; overflow: hidden;
  transition: max-height .2s ease; padding: 0 10px;
}
.agent-config.visible { max-height: 200px; padding: 0 10px 4px; }
.config-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 5px 0; font-size: 12.5px; color: var(--text-2); gap: 10px;
}
.num-input {
  width: 54px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--r-xs);
  padding: 3px 7px; font-size: 12.5px; font-family: var(--mono);
  text-align: right; color: var(--text);
}
.mini-select {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-xs); padding: 3px 7px;
  font-size: 12px; color: var(--text);
}

/* ── System prompt drawer ── */
.sys-drawer {
  max-height: 0; overflow: hidden;
  transition: max-height .22s ease;
  border-bottom: 0 solid var(--border);
  background: var(--surface-0);
}
.sys-drawer.open { max-height: 220px; border-bottom-width: 1px; }
.sys-drawer-inner { padding: 12px 20px 14px; display: flex; flex-direction: column; gap: 8px; }
.sys-label {
  font-size: 10.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-3);
}
.sys-textarea {
  background: var(--surface-1); border: 1.5px solid var(--border);
  border-radius: var(--r-sm); padding: 10px 12px;
  font-size: 13px; color: var(--text); line-height: 1.5;
  min-height: 70px; transition: border-color .15s;
}
.sys-textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-glow); }
.sys-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ── Messages ── */
.messages {
  flex: 1; overflow-y: auto;
  padding: 0; display: flex; flex-direction: column;
  scroll-behavior: smooth;
}

.msg-row {
  display: flex; gap: 12px;
  padding: 16px 24px;
  animation: msgIn .18s ease;
  align-items: flex-start;
  border-bottom: 1px solid transparent;
  transition: background .1s;
}
.msg-row:hover { background: rgba(0,0,0,.018); }
.msg-row.user { flex-direction: row-reverse; }
.msg-row.user .msg-bubble { align-items: flex-end; }
.msg-row.user .msg-meta { flex-direction: row-reverse; }

@keyframes msgIn {
  from { opacity: 0; transform: translateY(6px); }
}

.msg-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  flex-shrink: 0; margin-top: 2px;
}
.msg-row.ai .msg-avatar {
  background: linear-gradient(135deg, var(--accent-2), var(--accent-3));
  color: #fff; letter-spacing: -0.02em;
}
.msg-row.user .msg-avatar {
  background: linear-gradient(135deg, #2c3e50, #3d566e);
  color: #fff;
}

.msg-bubble {
  display: flex; flex-direction: column; gap: 4px;
  max-width: min(680px, calc(100% - 52px));
}
.msg-meta {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.msg-role { font-size: 12.5px; font-weight: 600; color: var(--text); }
.msg-time { font-size: 11px; color: var(--text-3); font-family: var(--mono); }
.msg-backend {
  font-size: 10.5px; font-family: var(--mono);
  color: var(--accent); background: var(--accent-dim);
  padding: 1px 6px; border-radius: 4px; font-weight: 500;
}

.msg-content {
  font-size: 14px; line-height: 1.7; color: var(--text);
  word-break: break-word;
}
.msg-content pre {
  background: var(--sb-bg); color: #d4c9c2;
  padding: 14px 16px; border-radius: var(--r-md);
  overflow-x: auto; font-family: var(--mono);
  font-size: 12.5px; line-height: 1.65;
  margin: 8px 0; position: relative;
  border: 1px solid rgba(255,255,255,0.06);
}
.msg-content code {
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 1px 5px; border-radius: var(--r-xs);
  font-family: var(--mono); font-size: 12.5px; color: var(--accent-2);
}
.msg-content pre code { background: none; border: none; padding: 0; color: inherit; }
.msg-content ul, .msg-content ol { padding-left: 22px; margin: 6px 0; }
.msg-content li { margin: 4px 0; }
.msg-content h1 { font-size: 20px; font-weight: 700; margin: 14px 0 7px; letter-spacing: -.02em; }
.msg-content h2 { font-size: 17px; font-weight: 700; margin: 12px 0 6px; letter-spacing: -.02em; }
.msg-content h3 { font-size: 15px; font-weight: 600; margin: 10px 0 5px; }
.msg-content blockquote {
  border-left: 3px solid var(--accent-light); padding-left: 14px;
  color: var(--text-2); margin: 8px 0;
}
.msg-content strong { font-weight: 600; }
.msg-content em { font-style: italic; }
.msg-content a { color: var(--accent); }
.msg-content hr { border: none; border-top: 1px solid var(--border); margin: 12px 0; }
.msg-content table { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 13.5px; }
.msg-content th { background: var(--surface-2); font-weight: 600; text-align: left; }
.msg-content th, .msg-content td { padding: 8px 12px; border: 1px solid var(--border); }
.msg-content tr:nth-child(even) td { background: var(--surface-1); }

/* Code copy button */
.code-block-wrap { position: relative; }
.code-copy-btn {
  position: absolute; top: 8px; right: 8px;
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.15);
  border-radius: var(--r-sm); padding: 4px 8px;
  font-size: 11px; color: #c4bdb4; cursor: pointer;
  transition: background .15s, color .15s; font-family: var(--sans);
  display: flex; align-items: center; gap: 4px;
}
.code-copy-btn:hover { background: rgba(255,255,255,.18); color: #fff; }
.code-copy-btn.copied { color: #4ade80; border-color: rgba(74,222,128,.3); }

/* Message actions */
.msg-actions {
  display: flex; gap: 2px; margin-top: 4px;
  opacity: 0; transition: opacity .15s;
}
.msg-row:hover .msg-actions { opacity: 1; }
.msg-action-btn {
  display: flex; align-items: center; gap: 4px;
  padding: 4px 8px; border-radius: var(--r-sm);
  font-size: 11.5px; color: var(--text-3);
  transition: background .1s, color .1s;
}
.msg-action-btn:hover { background: var(--surface-2); color: var(--text-2); }
.msg-action-btn.copied { color: var(--green); }

/* Thinking dots */
.thinking { display: flex; gap: 5px; padding: 8px 0; align-items: center; }
.thinking span {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); animation: pulse 1.3s ease-in-out infinite;
}
.thinking span:nth-child(2) { animation-delay: .22s; }
.thinking span:nth-child(3) { animation-delay: .44s; }
@keyframes pulse {
  0%,80%,100% { opacity: .25; transform: scale(.75); }
  40% { opacity: 1; transform: scale(1); }
}

/* Agent thinking */
.agent-thinking { display: flex; flex-direction: column; gap: 6px; padding: 4px 0; }
.agent-step {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--text-2); transition: opacity .3s;
}
.agent-step-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); flex-shrink: 0;
}

/* Agent trace */
.agent-trace {
  margin-top: 12px; border: 1px solid var(--border);
  border-radius: var(--r-md); overflow: hidden;
}
.agent-trace-label {
  font-size: 10.5px; font-family: var(--mono); font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-3); padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-1);
}
.agent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1px; background: var(--border);
}
.agent-card { background: var(--surface-0); padding: 10px 12px; }
.agent-card-hd {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 500; color: var(--text);
}
.agent-status-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.agent-status-dot.ok  { background: var(--green); }
.agent-status-dot.err { background: var(--red); }
.agent-status-dot.run { background: var(--amber); }
.agent-role { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-latency { font-size: 10.5px; color: var(--text-3); font-family: var(--mono); }
.agent-model { font-size: 11px; color: var(--text-2); font-family: var(--mono); }

/* Agent bar */
.agent-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px; margin-bottom: 8px;
  background: linear-gradient(135deg, #fff0ef, #fde8e6);
  border: 1px solid var(--accent-light);
  border-radius: var(--r-md);
  font-size: 12.5px; color: var(--accent-2);
}
.agent-bar-close {
  margin-left: auto; font-size: 12px; color: var(--accent);
  padding: 2px 5px; border-radius: 4px; transition: background .1s;
}
.agent-bar-close:hover { background: rgba(192,57,43,.12); }

/* ── Welcome ── */
.welcome {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 40px 20px; gap: 10px; text-align: center;
}
.welcome-logo { width: 56px; height: 56px; margin-bottom: 8px; }
.welcome h2 {
  font-size: 24px; font-weight: 700;
  letter-spacing: -.04em; color: var(--text);
}
.welcome > p { font-size: 14px; color: var(--text-2); margin-bottom: 8px; }

.chip-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px; margin-top: 8px; max-width: 540px; width: 100%;
}
.chip {
  display: flex; align-items: center; gap: 9px;
  padding: 12px 14px; border-radius: var(--r-md);
  border: 1px solid var(--border); background: var(--surface-0);
  font-size: 13px; color: var(--text); text-align: left;
  transition: background .1s, border-color .12s, transform .1s, box-shadow .1s;
  line-height: 1.4;
}
.chip:hover {
  background: var(--surface-1); border-color: var(--accent-light);
  transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,.07);
}
.chip-icon { font-size: 16px; flex-shrink: 0; }

/* ── Input area ── */
.input-area {
  padding: 12px 20px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface-0); flex-shrink: 0;
}
.input-row {
  display: flex; align-items: flex-end; gap: 8px;
  background: var(--surface-0);
  border: 1.5px solid var(--border);
  border-radius: var(--r-xl);
  padding: 8px 10px 8px 16px;
  transition: border-color .15s, box-shadow .15s;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.input-row:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow2), 0 2px 8px rgba(0,0,0,.06);
}
.user-textarea {
  flex: 1; background: none; border: none; outline: none;
  font-size: 14px; line-height: 1.55; color: var(--text);
  max-height: 180px; padding: 2px 0;
}
.user-textarea::placeholder { color: var(--text-3); }
.input-btns { display: flex; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.attach-btn { width: 30px; height: 30px; color: var(--text-3); }
.attach-btn:hover { color: var(--text-2); background: var(--surface-2); }
.send-btn {
  width: 34px; height: 34px; border-radius: var(--r-md);
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  transition: background .12s, opacity .15s, transform .1s, box-shadow .12s;
}
.send-btn:hover { background: var(--accent-2); box-shadow: 0 4px 14px var(--accent-glow); }
.send-btn:active { transform: scale(.95); }
.send-btn:disabled { opacity: .38; cursor: not-allowed; transform: none; box-shadow: none; }

.input-footer {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 4px 0; flex-wrap: wrap;
}
.resolved-back {
  font-size: 11px; font-family: var(--mono);
  color: var(--text-3); flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.resolved-back.active { color: var(--text-2); }
.header-pills { display: flex; gap: 5px; flex-wrap: wrap; }
.input-hint { font-size: 11px; color: var(--text-3); white-space: nowrap; }

/* Status lights */
.status-light {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--surface-3); flex-shrink: 0;
}
.status-light.ok      { background: var(--green); }
.status-light.error   { background: var(--red); }
.status-light.pinging { background: var(--amber); animation: blink 1s infinite; }
@keyframes blink { 0%,100%{ opacity:1 } 50%{ opacity:.3 } }

/* ═══ PROJECTS ═══════════════════════════════════════════ */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px; margin-top: 8px;
}
.project-card {
  background: var(--surface-0); border: 1.5px solid var(--border);
  border-radius: var(--r-lg); padding: 20px;
  cursor: pointer;
  transition: border-color .12s, box-shadow .12s, transform .1s;
}
.project-card:hover {
  border-color: var(--accent-light);
  box-shadow: 0 4px 20px rgba(192,57,43,.1);
  transform: translateY(-1px);
}
.project-card.add-card {
  border-style: dashed; display: flex;
  flex-direction: column; align-items: center;
  justify-content: center; text-align: center;
  gap: 8px; color: var(--text-2); min-height: 120px;
}
.project-card.add-card:hover { border-color: var(--accent); color: var(--accent); }
.project-card-icon { font-size: 24px; margin-bottom: 6px; }
.project-card h4 { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.project-card p { font-size: 12.5px; color: var(--text-2); line-height: 1.5; }
.project-card-meta { font-size: 11px; color: var(--text-3); margin-top: 10px; font-family: var(--mono); }
.project-card-tag {
  display: inline-flex; align-items: center;
  font-size: 10.5px; font-weight: 500;
  padding: 2px 8px; border-radius: 100px;
  margin-top: 8px;
}
.project-card-tag.active { background: var(--accent-dim); color: var(--accent); }

/* ═══ ARTIFACTS ══════════════════════════════════════════ */
.artifacts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px; margin-top: 8px;
}
.artifact-card {
  background: var(--surface-0); border: 1.5px solid var(--border);
  border-radius: var(--r-lg); overflow: hidden;
  cursor: pointer;
  transition: border-color .12s, box-shadow .12s, transform .1s;
}
.artifact-card:hover {
  border-color: var(--border-hi);
  box-shadow: 0 4px 16px rgba(0,0,0,.08);
  transform: translateY(-1px);
}
.artifact-preview {
  height: 120px; background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 36px; border-bottom: 1px solid var(--border);
}
.artifact-body { padding: 14px 16px; }
.artifact-body h4 { font-size: 13.5px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.artifact-body p { font-size: 12px; color: var(--text-2); }
.artifact-meta { font-size: 11px; color: var(--text-3); margin-top: 6px; font-family: var(--mono); }
.artifact-type-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px; font-weight: 600; font-family: var(--mono);
  padding: 2px 7px; border-radius: 4px;
  margin-top: 6px;
}
.artifact-type-badge.code { background: #eef2ff; color: #4c6ef5; }
.artifact-type-badge.doc  { background: var(--green-dim); color: var(--green); }
.artifact-type-badge.viz  { background: var(--amber-dim); color: var(--amber); }

/* ═══ CUSTOMIZE ══════════════════════════════════════════ */
.customize-cards { display: flex; flex-direction: column; gap: 16px; margin-top: 4px; }
.customize-card {
  background: var(--surface-0); border: 1.5px solid var(--border);
  border-radius: var(--r-lg); padding: 22px 24px;
  transition: border-color .15s;
}
.customize-card:focus-within { border-color: var(--accent-light); }
.customize-card-icon {
  width: 38px; height: 38px; border-radius: var(--r-md);
  background: var(--accent-dim); display: flex;
  align-items: center; justify-content: center;
  color: var(--accent); margin-bottom: 12px;
}
.customize-card h3 { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.customize-card > p { font-size: 13px; color: var(--text-2); margin-bottom: 14px; line-height: 1.5; }
.customize-textarea {
  width: 100%; background: var(--surface-1);
  border: 1.5px solid var(--border); border-radius: var(--r-sm);
  padding: 10px 12px; font-size: 13px; color: var(--text);
  line-height: 1.5; min-height: 88px;
  transition: border-color .15s;
}
.customize-textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-glow); }
.style-options { display: flex; gap: 8px; flex-wrap: wrap; }
.style-option {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 14px; border-radius: var(--r-md);
  border: 1.5px solid var(--border); cursor: pointer;
  font-size: 13px; color: var(--text);
  transition: border-color .12s, background .12s;
}
.style-option:hover { border-color: var(--border-hi); background: var(--surface-1); }
.style-option input { accent-color: var(--accent); }
.style-option:has(input:checked) {
  border-color: var(--accent); background: var(--accent-dim);
  color: var(--accent-2);
}
.customize-save-row {
  display: flex; justify-content: flex-end; margin-top: 12px;
}

/* ═══ FEATURE HERO (code/cowork/design) ══════════════════ */
.feature-hero {
  display: flex; flex-direction: column;
  align-items: center; text-align: center;
  padding: 48px 20px 40px; gap: 14px;
}
.feature-hero-icon {
  width: 64px; height: 64px; border-radius: var(--r-xl);
  background: var(--accent-dim);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent); margin-bottom: 4px;
  box-shadow: 0 8px 24px var(--accent-glow);
}
.feature-hero h2 {
  font-size: 28px; font-weight: 700;
  letter-spacing: -.04em; color: var(--text);
}
.feature-hero p {
  font-size: 15px; color: var(--text-2);
  max-width: 440px; line-height: 1.65;
}
.feature-pills { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 4px; }
.feature-pill {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 13px; border-radius: 100px;
  border: 1px solid var(--border); background: var(--surface-0);
  font-size: 12.5px; color: var(--text-2);
}
.feature-pill-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); flex-shrink: 0; }

/* ═══ SETTINGS ═══════════════════════════════════════════ */
.settings-layout { display: flex; flex: 1; overflow: hidden; }
.settings-sidebar {
  width: 220px; min-width: 220px;
  border-right: 1px solid var(--border);
  background: var(--surface-0);
  overflow-y: auto; flex-shrink: 0;
}
.settings-back { padding: 14px 12px 8px; border-bottom: 1px solid var(--border); }
.settings-back-btn {
  display: flex; align-items: center; gap: 7px;
  font-size: 13px; font-weight: 500; color: var(--text-2);
  padding: 6px 10px; border-radius: var(--r-sm);
  transition: background .1s, color .1s;
}
.settings-back-btn:hover { background: var(--surface-1); color: var(--text); }
.settings-nav { padding: 10px 10px; }
.settings-nav-group { margin-bottom: 16px; }
.settings-nav-label {
  font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-3); padding: 4px 10px 6px;
}
.settings-nav-item {
  display: block; width: 100%; text-align: left;
  padding: 7px 10px; border-radius: var(--r-sm);
  font-size: 13.5px; font-weight: 450; color: var(--text-2);
  transition: background .1s, color .1s;
}
.settings-nav-item:hover { background: var(--surface-1); color: var(--text); }
.settings-nav-item.active {
  background: var(--accent-dim); color: var(--accent-2); font-weight: 500;
}

/* API Keys sidebar */
.settings-keys-section {
  border-top: 1px solid var(--border); padding: 12px 10px;
}
.add-key-compact { display: flex; gap: 6px; margin-bottom: 8px; }
.key-input-sm {
  flex: 1; background: var(--surface-1);
  border: 1.5px solid var(--border); border-radius: var(--r-sm);
  padding: 6px 9px; font-size: 12px; font-family: var(--mono);
  color: var(--text); transition: border-color .15s;
}
.key-input-sm:focus { border-color: var(--accent); outline: none; }
.key-input-sm::placeholder { color: var(--text-3); }
.add-key-sm-btn {
  width: 28px; height: 28px; border-radius: var(--r-sm);
  background: var(--accent); color: #fff; font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: background .12s; margin-top: 1px;
}
.add-key-sm-btn:hover { background: var(--accent-2); }
.key-list-compact { display: flex; flex-direction: column; gap: 3px; }
.key-card-sm {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 9px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--surface-0);
  cursor: pointer; transition: border-color .1s, background .1s;
}
.key-card-sm:hover { background: var(--surface-1); border-color: var(--border-hi); }
.key-card-sm.active { border-color: var(--accent); background: var(--accent-dim); }
.key-card-sm-label {
  flex: 1; font-size: 11.5px; font-family: var(--mono);
  color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.key-card-sm-menu {
  opacity: 0; font-size: 12px; color: var(--text-3);
  transition: opacity .1s; padding: 1px 4px; border-radius: 3px;
}
.key-card-sm:hover .key-card-sm-menu { opacity: 1; }
.key-card-sm-menu:hover { color: var(--text); background: var(--surface-2); }

/* Settings content */
.settings-content { flex: 1; overflow-y: auto; padding: 36px 44px; min-width: 0; }
.settings-page { display: none; max-width: 600px; }
.settings-page.active { display: block; }
.settings-page > h2 {
  font-size: 22px; font-weight: 700;
  letter-spacing: -.03em; color: var(--text); margin-bottom: 24px;
}
.settings-page h3 { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 10px; }
.settings-section {
  margin-bottom: 28px; padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}
.settings-section:last-child { border-bottom: none; }
.settings-field { margin-bottom: 14px; }
.settings-field label {
  display: block; font-size: 12.5px; font-weight: 500;
  color: var(--text-2); margin-bottom: 6px;
}
.settings-input {
  width: 100%; max-width: 380px;
  background: var(--surface-0); border: 1.5px solid var(--border);
  border-radius: var(--r-sm); padding: 9px 12px;
  font-size: 13.5px; color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.settings-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); outline: none; }
.settings-select {
  background: var(--surface-0); border: 1.5px solid var(--border);
  border-radius: var(--r-sm); padding: 9px 12px;
  font-size: 13px; color: var(--text); min-width: 200px;
  transition: border-color .15s; cursor: pointer;
}
.settings-select:focus { border-color: var(--accent); outline: none; }
.settings-select option { background: var(--surface-0); }

.settings-toggle-row {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 20px; padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.settings-toggle-row:last-child { border-bottom: none; }
.settings-toggle-row strong {
  display: block; font-size: 13.5px; font-weight: 500;
  color: var(--text); margin-bottom: 3px;
}
.settings-toggle-row p { font-size: 12.5px; color: var(--text-2); line-height: 1.5; }

.text-muted { font-size: 13px; color: var(--text-2); line-height: 1.6; }
.connected-account {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; background: var(--surface-1);
  border: 1px solid var(--border); border-radius: var(--r-sm);
  color: var(--text-2); font-size: 13.5px;
}
.connected-badge {
  margin-left: auto; font-size: 11px; font-family: var(--mono);
  font-weight: 600; color: var(--green); background: var(--green-dim);
  padding: 2px 8px; border-radius: 4px;
}
.danger-zone { border-top: 1px solid var(--accent-light); padding-top: 22px; }

.plan-card {
  background: var(--surface-0); border: 1.5px solid var(--border);
  border-radius: var(--r-lg); overflow: hidden;
}
.plan-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px; border-bottom: 1px solid var(--border);
  background: var(--surface-1);
}
.plan-card-header h3 { margin-bottom: 2px; font-size: 15px; }
.plan-card-header p { font-size: 12.5px; color: var(--text-2); margin: 0; }
.plan-details { padding: 2px 0; }
.plan-detail-row {
  display: flex; justify-content: space-between;
  padding: 11px 20px; font-size: 13px; color: var(--text-2);
  border-bottom: 1px solid var(--border);
}
.plan-detail-row:last-child { border-bottom: none; }
.plan-value { color: var(--text); font-family: var(--mono); font-weight: 500; }
.plan-pro-banner {
  background: linear-gradient(135deg, var(--accent-2), var(--accent-3));
  color: #fff; padding: 18px 20px; border-radius: var(--r-lg);
  margin-bottom: 16px;
}
.plan-pro-banner h3 { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.plan-pro-banner p { font-size: 13px; opacity: .85; }

.usage-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.usage-stat {
  background: var(--surface-0); border: 1.5px solid var(--border);
  border-radius: var(--r-lg); padding: 18px 20px;
  display: flex; flex-direction: column; gap: 4px;
  transition: border-color .15s;
}
.usage-stat:hover { border-color: var(--accent-light); }
.usage-stat-value {
  font-family: var(--mono); font-size: 26px; font-weight: 600;
  color: var(--text); letter-spacing: -.02em;
}
.usage-stat-label { font-size: 12px; color: var(--text-2); }
.usage-bar { height: 4px; background: var(--surface-3); border-radius: 2px; margin-top: 8px; overflow: hidden; }
.usage-bar-fill { height: 100%; background: var(--accent); border-radius: 2px; transition: width .4s ease; }

.skills-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.skill-card {
  background: var(--surface-0); border: 1.5px solid var(--border);
  border-radius: var(--r-lg); padding: 18px;
  transition: border-color .15s, box-shadow .15s; cursor: pointer;
}
.skill-card:hover { border-color: var(--accent-light); box-shadow: 0 4px 16px rgba(192,57,43,.08); }
.skill-card.add-skill {
  border-style: dashed; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; gap: 6px;
}
.skill-card.add-skill:hover { border-color: var(--accent); }
.skill-card-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.skill-icon { font-size: 18px; }
.skill-card h4 { font-size: 13.5px; font-weight: 600; flex: 1; color: var(--text); }
.skill-badge {
  font-size: 9.5px; font-family: var(--mono); font-weight: 600;
  color: var(--accent); background: var(--accent-dim);
  padding: 2px 6px; border-radius: 4px;
  text-transform: uppercase; letter-spacing: .04em;
}
.skill-card p { font-size: 12px; color: var(--text-2); line-height: 1.5; }

/* ═══ MODAL ══════════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(20,16,14,.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 300; backdrop-filter: blur(5px);
}
.modal-overlay[hidden] { display: none; }
.modal {
  background: var(--surface-0); border: 1px solid var(--border);
  border-radius: var(--r-xl); width: 420px; max-width: 92vw;
  box-shadow: 0 24px 72px rgba(0,0,0,.2);
  animation: modalIn .18s ease;
}
@keyframes modalIn { from { opacity:0; transform: scale(.96) translateY(4px); } }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 14px; border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 15px; font-weight: 600; color: var(--text); }
.modal-body { padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.field-label {
  font-size: 10.5px; font-weight: 600; font-family: var(--mono);
  text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); margin-bottom: 4px;
}
.modal-input {
  width: 100%; background: var(--surface-1);
  border: 1.5px solid var(--border); border-radius: var(--r-sm);
  padding: 9px 11px; font-family: var(--mono);
  font-size: 13px; color: var(--text); transition: border-color .15s;
}
.modal-input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-glow); }
.modal-stats {
  font-family: var(--mono); font-size: 11.5px; color: var(--text-2);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 10px 12px; line-height: 1.9;
}
.modal-footer {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 20px 18px; border-top: 1px solid var(--border);
}

/* ── Project / New modal ── */
.project-modal-form { display: flex; flex-direction: column; gap: 14px; }
.project-color-row { display: flex; gap: 8px; flex-wrap: wrap; }
.project-color-swatch {
  width: 26px; height: 26px; border-radius: 50%; cursor: pointer;
  border: 2.5px solid transparent; transition: border-color .15s, transform .1s;
}
.project-color-swatch.selected, .project-color-swatch:hover {
  border-color: var(--text); transform: scale(1.1);
}

/* ═══ TOAST ══════════════════════════════════════════════ */
.toast-area {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px;
  z-index: 999; pointer-events: none;
}
.toast {
  font-size: 13px; font-weight: 450;
  padding: 10px 18px; border-radius: var(--r-md); border: 1px solid;
  animation: toast-in .2s ease, toast-out .3s ease 3.7s forwards;
  pointer-events: auto; white-space: nowrap;
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 20px rgba(0,0,0,.12);
}
.toast.info    { background: rgba(255,255,255,.95); border-color: var(--border-hi); color: var(--text-2); }
.toast.success { background: rgba(234,250,241,.95); border-color: #a9dfbf; color: var(--green); }
.toast.error   { background: rgba(253,242,241,.95); border-color: var(--accent-light); color: var(--accent-2); }
@keyframes toast-in  { from { opacity:0; transform: translateY(8px); } }
@keyframes toast-out { to   { opacity:0; transform: translateY(8px); } }

/* ═══ SEARCH BAR ══════════════════════════════════════════ */
.search-overlay {
  position: fixed; inset: 0;
  background: rgba(20,16,14,.5);
  z-index: 400; backdrop-filter: blur(5px);
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 15vh;
}
.search-overlay[hidden] { display: none; }
.search-box {
  background: var(--surface-0); border: 1.5px solid var(--border);
  border-radius: var(--r-xl); width: 560px; max-width: 92vw;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  animation: modalIn .18s ease; overflow: hidden;
}
.search-input-row {
  display: flex; align-items: center; gap: 12px; padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.search-input-row svg { flex-shrink: 0; color: var(--text-3); }
.search-input {
  flex: 1; font-size: 16px; color: var(--text);
  background: none; border: none; outline: none;
}
.search-input::placeholder { color: var(--text-3); }
.search-results { padding: 8px; max-height: 360px; overflow-y: auto; }
.search-result-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--r-sm);
  cursor: pointer; transition: background .1s;
}
.search-result-item:hover, .search-result-item.selected { background: var(--surface-1); }
.search-result-icon { width: 32px; height: 32px; border-radius: var(--r-sm); background: var(--surface-2); display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--text-2); }
.search-result-title { font-size: 13.5px; font-weight: 500; color: var(--text); }
.search-result-sub { font-size: 12px; color: var(--text-3); }
.search-empty { padding: 24px; text-align: center; color: var(--text-3); font-size: 13px; }
.search-footer {
  padding: 10px 16px; border-top: 1px solid var(--border);
  display: flex; gap: 12px;
  font-size: 11.5px; color: var(--text-3);
}
.search-hint { display: flex; align-items: center; gap: 5px; }
.search-hint kbd {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 4px; padding: 1px 5px; font-family: var(--mono); font-size: 10.5px;
}

/* ═══ RESPONSIVE ══════════════════════════════════════════ */
@media (max-width: 768px) {
  .sidebar {
    position: fixed; height: 100%; z-index: 30;
    box-shadow: 4px 0 24px rgba(0,0,0,.2);
  }
  .settings-layout { flex-direction: column; }
  .settings-sidebar { width: 100%; min-width: unset; border-right: none; border-bottom: 1px solid var(--border); max-height: 200px; }
  .settings-content { padding: 24px 20px; }
  .usage-grid { grid-template-columns: 1fr; }
  .skills-grid { grid-template-columns: 1fr; }
  .chip-grid { grid-template-columns: 1fr; }
  .msg-row { padding: 12px 14px; }
  .input-area { padding: 10px 14px 14px; }
  .page-view { padding: 24px 20px 40px; }
  .sidebar-open-btn { display: flex !important; }
  .projects-grid, .artifacts-grid { grid-template-columns: 1fr; }
}
