*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --purple: #534AB7;
  --purple-light: #EEEDFE;
  --text: #1a1a1a;
  --text2: #6b6b6b;
  --text3: #aaa;
  --bg: #f8f8f6;
  --bg2: #ffffff;
  --border: rgba(0,0,0,0.1);
  --border2: rgba(0,0,0,0.18);
  --radius: 10px;
  --radius-sm: 6px;
  --green: #639922; --green-bg: #EAF3DE;
  --amber: #BA7517; --amber-bg: #FAEEDA;
  --gray2: #888780; --gray-bg: #F1EFE8;
  --red: #A32D2D; --red-bg: #FCEBEB;
  --shadow: 0 1px 4px rgba(0,0,0,0.07);
}

@media (prefers-color-scheme: dark) {
  :root {
    --text: #e8e6de; --text2: #9c9a92; --text3: #6b6b6b;
    --bg: #1a1a18; --bg2: #242422;
    --border: rgba(255,255,255,0.1); --border2: rgba(255,255,255,0.18);
    --purple-light: #2a2660;
    --green-bg: #1a2e0a; --amber-bg: #2e1f0a; --gray-bg: #242320; --red-bg: #2e1010;
    --shadow: 0 1px 4px rgba(0,0,0,0.3);
  }
}

body { font-family: system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }
.hidden { display: none !important; }

/* LOGIN */
#login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.login-card { background: var(--bg2); border: 0.5px solid var(--border); border-radius: 16px; padding: 48px 40px; text-align: center; max-width: 360px; width: 90%; box-shadow: var(--shadow); }
.login-logo { margin-bottom: 16px; display: flex; justify-content: center; }
.login-card h1 { font-size: 22px; font-weight: 500; margin-bottom: 6px; }
.login-card p { color: var(--text2); margin-bottom: 28px; }
.btn-google { display: flex; align-items: center; gap: 10px; justify-content: center; width: 100%; padding: 10px 20px; border: 0.5px solid var(--border2); border-radius: var(--radius-sm); background: var(--bg2); color: var(--text); font-size: 14px; cursor: pointer; transition: background .15s; }
.btn-google:hover { background: var(--bg); }

/* LAYOUT */
#app { display: flex; height: 100vh; overflow: hidden; }

/* SIDEBAR */
.sidebar { width: 210px; min-width: 210px; background: var(--bg2); border-right: 0.5px solid var(--border); display: flex; flex-direction: column; overflow-y: auto; }
.sidebar-header { padding: 16px; border-bottom: 0.5px solid var(--border); }
.app-brand { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 500; }
.sidebar-nav, .sidebar-filters { padding: 10px 8px 4px; }
.nav-label { font-size: 10px; color: var(--text3); text-transform: uppercase; letter-spacing: .07em; padding: 0 8px; display: block; margin-bottom: 2px; }
.nav-item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px; border-radius: var(--radius-sm); border: none; background: transparent; color: var(--text2); font-size: 13px; cursor: pointer; text-align: left; transition: background .12s; }
.nav-item:hover { background: var(--bg); }
.nav-item.active { background: var(--purple-light); color: var(--purple); font-weight: 500; }
.filter-btn { display: flex; align-items: center; gap: 6px; width: 100%; padding: 6px 10px; border-radius: var(--radius-sm); border: none; background: transparent; color: var(--text2); font-size: 12px; cursor: pointer; text-align: left; margin-top: 2px; }
.filter-btn:hover { background: var(--bg); }
.filter-btn.active { color: var(--text); font-weight: 500; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.dot-green { background: var(--green); }
.dot-amber { background: var(--amber); }
.dot-gray { background: var(--gray2); }

/* GRUPOS SIDEBAR */
.sidebar-groups { padding: 10px 8px 4px; border-top: 0.5px solid var(--border); margin-top: 4px; }
.sidebar-groups-header { display: flex; align-items: center; justify-content: space-between; padding: 0 8px; margin-bottom: 2px; }
.btn-new-group { font-size: 16px; line-height: 1; color: var(--text3); background: none; border: none; cursor: pointer; padding: 0 2px; border-radius: 4px; }
.btn-new-group:hover { color: var(--purple); background: var(--purple-light); }
.active-group { color: var(--text); font-weight: 500; }
.group-nav-item { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 6px 10px; border-radius: var(--radius-sm); border: none; background: transparent; color: var(--text2); font-size: 12px; cursor: pointer; text-align: left; margin-top: 2px; }
.group-nav-item:hover { background: var(--bg); }
.group-nav-item.active-group { color: var(--text); font-weight: 500; background: var(--bg); }
.group-nav-left { display: flex; align-items: center; gap: 6px; }
.group-nav-actions { display: flex; gap: 2px; opacity: 0; transition: opacity .15s; }
.group-nav-item:hover .group-nav-actions { opacity: 1; }
.btn-group-action { background: none; border: none; cursor: pointer; color: var(--text3); font-size: 11px; padding: 1px 4px; border-radius: 3px; }
.btn-group-action:hover { color: var(--red); background: var(--red-bg); }

.sidebar-footer { margin-top: auto; padding: 12px; border-top: 0.5px solid var(--border); display: flex; align-items: center; gap: 8px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--purple-light); color: var(--purple); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 500; flex-shrink: 0; }
.user-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
#user-name { font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; }
.btn-logout { font-size: 11px; color: var(--text3); background: none; border: none; cursor: pointer; text-align: left; padding: 0; }
.btn-logout:hover { color: var(--red); }

/* MAIN */
.main { flex: 1; overflow-y: auto; display: flex; flex-direction: column; }
.view { display: flex; flex-direction: column; flex: 1; }
.topbar { padding: 16px 20px; border-bottom: 0.5px solid var(--border); display: flex; align-items: center; justify-content: space-between; background: var(--bg2); flex-shrink: 0; }
.topbar h2 { font-size: 16px; font-weight: 500; }
.topbar-left { display: flex; align-items: center; gap: 10px; }
.topbar-count { font-size: 12px; color: var(--text3); background: var(--bg); border: 0.5px solid var(--border); border-radius: 10px; padding: 1px 8px; }

/* GRID */
.pages-grid { padding: 20px; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; align-content: start; flex: 1; }
.empty-state { grid-column: 1/-1; padding: 40px 20px; text-align: center; color: var(--text3); font-size: 13px; }

/* CARD */
.page-card { background: var(--bg2); border: 0.5px solid var(--border); border-radius: var(--radius); overflow: hidden; transition: border-color .15s, box-shadow .15s; }
.page-card:hover { border-color: var(--border2); box-shadow: var(--shadow); }

/* PREVIEW */
.card-preview { height: 110px; background: var(--bg); cursor: pointer; position: relative; overflow: hidden; }
.card-preview:hover .preview-overlay { opacity: 1; }
.preview-overlay { position: absolute; inset: 0; background: rgba(83,74,183,0.08); opacity: 0; transition: opacity .2s; display: flex; align-items: center; justify-content: center; }
.preview-overlay svg { color: var(--purple); }
.preview-iframe-wrap { position: absolute; inset: 0; pointer-events: none; }
.preview-iframe-wrap iframe { width: 900px; height: 600px; border: none; transform: scale(0.245); transform-origin: top left; }
.preview-pattern-fallback { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 6px; width: 100%; padding: 12px; justify-content: center; }
.pp-bar { height: 5px; border-radius: 3px; background: var(--border2); }
.pp-bar.accent { background: #AFA9EC; }
.pp-bar.short { width: 55%; }
.pp-bar.med { width: 78%; }
.status-badge { position: absolute; top: 7px; right: 8px; font-size: 10px; font-weight: 500; padding: 2px 7px; border-radius: 10px; z-index: 2; }
.status-badge.dot-green { background: var(--green-bg); color: var(--green); }
.status-badge.dot-amber { background: var(--amber-bg); color: var(--amber); }
.status-badge.dot-gray { background: var(--gray-bg); color: var(--gray2); }

.card-info { padding: 10px 12px; }
.card-name { font-size: 13px; font-weight: 500; color: var(--text); }
.card-url { font-size: 11px; color: var(--text3); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-notes { font-size: 11px; color: var(--text2); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-meta { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; flex-wrap: wrap; gap: 4px; }
.tag { font-size: 10px; padding: 2px 7px; border-radius: 4px; background: var(--bg); border: 0.5px solid var(--border); color: var(--text2); }
.tag-alt { background: var(--purple-light); color: var(--purple); border-color: transparent; }
.tag-group { background: var(--bg); color: var(--text2); border-color: var(--border); font-size: 10px; }
.card-actions { display: flex; gap: 2px; }
.btn-icon-sm { width: 26px; height: 26px; border-radius: 5px; border: none; background: transparent; cursor: pointer; color: var(--text3); display: flex; align-items: center; justify-content: center; }
.btn-icon-sm:hover { background: var(--bg); color: var(--text); }
.btn-icon-sm.btn-danger:hover { color: var(--red); }

/* VISOR */
.viewer-wrap { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.viewer-bar { padding: 10px 16px; border-bottom: 0.5px solid var(--border); display: flex; align-items: center; gap: 8px; background: var(--bg2); }
.viewer-bar select { flex: 1; padding: 6px 10px; border: 0.5px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); color: var(--text); font-size: 13px; }
.iframe-container { flex: 1; position: relative; }
.iframe-placeholder { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--text3); font-size: 13px; text-align: center; padding: 20px; }
.iframe-placeholder small { font-size: 11px; }
#viewer-iframe { width: 100%; height: 100%; border: none; display: block; }

/* ARCHIVOS — barra de grupos */
.files-group-bar {
  padding: 10px 20px;
  border-bottom: 0.5px solid var(--border);
  background: var(--bg2);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.filter-chip {
  padding: 4px 12px;
  border-radius: 20px;
  border: 0.5px solid var(--border);
  background: var(--bg);
  color: var(--text2);
  font-size: 12px;
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
  white-space: nowrap;
}
.filter-chip:hover { background: var(--purple-light); color: var(--purple); border-color: var(--purple); }
.filter-chip.active { background: var(--purple); color: white; border-color: var(--purple); font-weight: 500; }

/* ARCHIVOS — sección */
.files-section { padding: 20px; flex: 1; overflow-y: auto; }
.select-inline { padding: 6px 10px; border: 0.5px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); color: var(--text); font-size: 13px; }

/* DROP ZONE */
.drop-zone {
  border: 1.5px dashed var(--border2);
  border-radius: var(--radius);
  padding: 28px 20px;
  margin-bottom: 16px;
  text-align: center;
  transition: background .15s, border-color .15s;
  cursor: default;
}
.drop-zone.drag-over {
  background: var(--purple-light);
  border-color: var(--purple);
}
.drop-zone-inner { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--text3); pointer-events: none; }
.drop-zone-inner svg { color: var(--text3); }
.drop-zone.drag-over .drop-zone-inner { color: var(--purple); }
.drop-zone.drag-over .drop-zone-inner svg { color: var(--purple); }
.drop-zone-inner p { font-size: 13px; font-weight: 500; }
.drop-zone-inner span { font-size: 11px; }

/* CARPETAS */
.folder-section { margin-bottom: 20px; }
.folder-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text2);
  padding: 6px 0 8px;
  border-bottom: 0.5px solid var(--border);
  margin-bottom: 10px;
}
.folder-count {
  font-size: 10px;
  background: var(--bg);
  border: 0.5px solid var(--border);
  border-radius: 8px;
  padding: 0px 6px;
  color: var(--text3);
  margin-left: auto;
}

/* ARCHIVOS GRID */
.files-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.file-card { background: var(--bg2); border: 0.5px solid var(--border); border-radius: var(--radius-sm); padding: 14px; display: flex; flex-direction: column; gap: 8px; transition: border-color .15s; }
.file-card:hover { border-color: var(--border2); }
.file-icon { font-size: 22px; }
.file-card-name { font-size: 12px; font-weight: 500; word-break: break-all; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.file-card-size { font-size: 11px; color: var(--text3); }
.file-card-actions { display: flex; gap: 6px; margin-top: auto; }
.file-upload-info { font-size: 12px; color: var(--text3); background: var(--bg2); border: 0.5px solid var(--border); border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 16px; display: flex; align-items: center; gap: 6px; }

/* API KEYS */
.keys-list { padding: 20px; display: flex; flex-direction: column; gap: 8px; }
.key-item { background: var(--bg2); border: 0.5px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.key-item-info { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; }
.key-item-name { font-size: 13px; font-weight: 500; }
.key-item-actions { display: flex; gap: 6px; align-items: center; }
.key-revealed { width: 100%; font-family: monospace; font-size: 12px; color: var(--text2); background: var(--bg); border: 0.5px solid var(--border); border-radius: 4px; padding: 6px 10px; word-break: break-all; margin-top: 4px; }
.keys-note { margin: 0 20px 20px; font-size: 12px; color: var(--text3); display: flex; align-items: center; gap: 6px; padding: 10px 14px; background: var(--bg2); border: 0.5px solid var(--border); border-radius: var(--radius-sm); }
.key-input-wrap { position: relative; display: flex; align-items: center; }
.key-input-wrap input { flex: 1; padding-right: 38px; }
.key-input-wrap .btn-icon { position: absolute; right: 6px; background: transparent; border: none; cursor: pointer; color: var(--text3); }

/* BOTONES */
.btn-primary { padding: 7px 16px; background: var(--purple); color: white; border: none; border-radius: var(--radius-sm); font-size: 13px; cursor: pointer; font-weight: 500; transition: opacity .15s; }
.btn-primary:hover { opacity: .88; }
.btn-secondary { padding: 6px 14px; background: transparent; color: var(--text2); border: 0.5px solid var(--border); border-radius: var(--radius-sm); font-size: 13px; cursor: pointer; transition: background .12s; }
.btn-secondary:hover { background: var(--bg); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-icon { background: transparent; border: 0.5px solid var(--border); border-radius: var(--radius-sm); padding: 5px 8px; cursor: pointer; color: var(--text2); display: flex; align-items: center; gap: 4px; font-size: 12px; }
.btn-icon:hover { color: var(--text); }

/* MODAL */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal { background: var(--bg2); border-radius: var(--radius); width: 90%; max-width: 420px; box-shadow: 0 8px 32px rgba(0,0,0,.18); max-height: 90vh; overflow-y: auto; }
.modal-sm { max-width: 340px; }
.modal-wide { max-width: 680px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 0.5px solid var(--border); position: sticky; top: 0; background: var(--bg2); z-index: 1; }
.modal-header h3 { font-size: 15px; font-weight: 500; }
.modal-body { padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.modal-body label { font-size: 12px; color: var(--text2); margin-bottom: -6px; }
.modal-body input, .modal-body select, .modal-body textarea { width: 100%; padding: 8px 10px; border: 0.5px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); color: var(--text); font-size: 13px; }
.modal-body input:focus, .modal-body select:focus, .modal-body textarea:focus { outline: 2px solid var(--purple); outline-offset: 1px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 0.5px solid var(--border); position: sticky; bottom: 0; background: var(--bg2); }

/* EMOJI PICKER */
.emoji-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.emoji-opt { font-size: 20px; background: var(--bg); border: 1.5px solid transparent; border-radius: var(--radius-sm); padding: 6px 8px; cursor: pointer; transition: border-color .12s; line-height: 1; }
.emoji-opt:hover { border-color: var(--border2); }
.emoji-opt.selected { border-color: var(--purple); background: var(--purple-light); }

/* FILE UPLOAD */
.file-upload-alt { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--text3); }
.file-pick-label { cursor: pointer; display: inline-block; }

/* TOAST */
.toast { position: fixed; bottom: 24px; right: 24px; padding: 10px 18px; border-radius: var(--radius-sm); font-size: 13px; color: white; z-index: 200; animation: fadein .2s; }
.toast.success { background: #3B6D11; }
.toast.error { background: var(--red); }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ═══════════════════════════════════════════
   ASISTENTE IA
═══════════════════════════════════════════ */

/* Badge del modelo en topbar */
.ai-model-badge {
  font-size: 11px;
  color: var(--purple);
  background: var(--purple-light);
  border-radius: 10px;
  padding: 2px 10px;
  font-weight: 500;
}

/* Barra de contexto activo */
.ai-context-bar {
  padding: 8px 20px;
  border-bottom: 0.5px solid var(--border);
  background: var(--purple-light);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--purple);
  flex-shrink: 0;
}
.ai-context-bar svg { flex-shrink: 0; }
.ai-ctx-count {
  font-size: 11px;
  opacity: 0.75;
}
.ai-ctx-clear {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--purple);
  font-size: 14px;
  opacity: 0.6;
  line-height: 1;
  padding: 0 2px;
}
.ai-ctx-clear:hover { opacity: 1; }

/* Área de mensajes */
.ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Pantalla de bienvenida */
.ai-welcome {
  margin: auto;
  max-width: 480px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 20px 0;
}
.ai-welcome-icon { margin-bottom: 4px; }
.ai-welcome h3 { font-size: 16px; font-weight: 500; }
.ai-welcome p { font-size: 13px; color: var(--text2); line-height: 1.6; }
.ai-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 8px;
}
.ai-suggestion-chip {
  padding: 6px 14px;
  border-radius: 20px;
  border: 0.5px solid var(--border2);
  background: var(--bg2);
  color: var(--text2);
  font-size: 12px;
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
}
.ai-suggestion-chip:hover {
  background: var(--purple-light);
  color: var(--purple);
  border-color: var(--purple);
}

/* Burbujas de mensaje */
.ai-msg {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  max-width: 100%;
}
.ai-msg.user { flex-direction: row-reverse; }

.ai-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 600;
}
.ai-msg.assistant .ai-msg-avatar {
  background: var(--purple-light);
  color: var(--purple);
}
.ai-msg.user .ai-msg-avatar {
  background: var(--bg);
  border: 0.5px solid var(--border);
  color: var(--text2);
}

.ai-msg-bubble {
  max-width: calc(100% - 80px);
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13.5px;
  line-height: 1.65;
}
.ai-msg.assistant .ai-msg-bubble {
  background: var(--bg2);
  border: 0.5px solid var(--border);
  border-top-left-radius: 4px;
}
.ai-msg.user .ai-msg-bubble {
  background: var(--purple);
  color: white;
  border-top-right-radius: 4px;
}

/* Código dentro de burbujas */
.ai-msg-bubble pre {
  background: var(--bg);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  overflow-x: auto;
  margin: 8px 0;
  font-size: 12px;
  line-height: 1.5;
}
.ai-msg.user .ai-msg-bubble pre {
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.2);
}
.ai-msg-bubble code {
  font-family: 'Courier New', monospace;
  font-size: 12px;
}
.ai-msg-bubble p { margin-bottom: 6px; }
.ai-msg-bubble p:last-child { margin-bottom: 0; }
.ai-msg-bubble ul, .ai-msg-bubble ol { padding-left: 18px; margin: 6px 0; }
.ai-msg-bubble li { margin-bottom: 3px; }
.ai-msg-bubble strong { font-weight: 600; }

/* Indicador de escritura */
.ai-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  background: var(--bg2);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  border-top-left-radius: 4px;
  width: fit-content;
}
.ai-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text3);
  animation: aiDotBounce 1.2s infinite;
}
.ai-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.ai-typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes aiDotBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* Área de input */
.ai-input-area {
  padding: 12px 20px 16px;
  border-top: 0.5px solid var(--border);
  background: var(--bg2);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ai-input-wrap {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.ai-textarea {
  flex: 1;
  padding: 9px 13px;
  border: 0.5px solid var(--border2);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-size: 13.5px;
  font-family: inherit;
  resize: none;
  line-height: 1.5;
  max-height: 160px;
  overflow-y: auto;
  transition: border-color .15s;
}
.ai-textarea:focus {
  outline: none;
  border-color: var(--purple);
}
.ai-textarea::placeholder { color: var(--text3); }
.ai-send-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--purple);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity .15s;
}
.ai-send-btn:hover { opacity: 0.88; }
.ai-send-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.ai-input-hint {
  font-size: 11px;
  color: var(--text3);
}

/* Copy button on code blocks */
.ai-code-wrap {
  position: relative;
  margin: 8px 0;
}
.ai-code-copy {
  position: absolute;
  top: 7px;
  right: 8px;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  border: 0.5px solid var(--border);
  background: var(--bg2);
  color: var(--text2);
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s;
}
.ai-code-wrap:hover .ai-code-copy { opacity: 1; }
.ai-code-copy:hover { background: var(--bg); color: var(--text); }