* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #0b1120; --panel: #111827; --panel-alt: #1e293b; --border: #283548;
  --text: #e2e8f0; --muted: #94a3b8; --accent: #10b981; --accent-dark: #052e16;
}
body { height: 100vh; background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; font-size: 14px; }
.app-layout { display: flex; height: 100vh; overflow: hidden; }
.sidebar { width: 272px; background: var(--panel); border-right: 1px solid var(--border); padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo { font-size: 24px; }
.brand h1 { font-size: 16px; font-weight: 700; }
.badge-ram { font-size: 11px; color: var(--accent); font-weight: 600; }
.conv-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.conv-item { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; border-radius: 8px; background: transparent; border: 1px solid transparent; color: var(--text); cursor: pointer; text-align: left; font-size: 13px; }
.conv-item:hover, .conv-item.active { background: var(--panel-alt); border-color: var(--border); }
.conv-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.sidebar-footer { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--border); padding-top: 10px; }
.ext-link { display: block; text-align: center; color: var(--accent); text-decoration: none; font-size: 12px; font-weight: 600; padding: 6px; }
.chat-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.chat-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 18px; border-bottom: 1px solid var(--border); background: var(--panel); gap: 10px; }
.header-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
select, input, textarea { background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-family: inherit; font-size: 13px; }
.pii-pill { padding: 5px 10px; border-radius: 999px; background: rgba(16, 185, 129, 0.14); border: 1px solid rgba(16, 185, 129, 0.45); color: #34d399; font-size: 12px; font-weight: 600; }
.config-panel { padding: 14px 18px; background: #0f172a; border-bottom: 1px solid var(--border); }
.hidden { display: none !important; }
.config-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.checkbox-field { display: flex; align-items: center; gap: 8px; font-size: 12.5px; padding-top: 18px; }
.config-actions { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.config-status { font-size: 12px; color: var(--accent); }
.messages-area { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.msg-bubble { max-width: 82%; padding: 12px 15px; border-radius: 12px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.msg-user { align-self: flex-end; background: #1d4ed8; color: #f8fafc; }
.msg-assistant { align-self: flex-start; background: var(--panel-alt); border: 1px solid var(--border); }
.msg-meta { margin-top: 8px; font-size: 11px; color: var(--muted); }
.ancilia-shield-badge { display: inline-flex; align-items: center; padding: 1px 6px; margin: 0 2px; border-radius: 6px; background: rgba(16, 185, 129, 0.18); border: 1px solid rgba(16, 185, 129, 0.5); font-weight: 600; cursor: pointer; }
.composer-area { padding: 12px 18px; border-top: 1px solid var(--border); background: var(--panel); }
.composer-row { display: flex; gap: 8px; align-items: flex-end; }
.composer-row textarea { flex: 1; resize: none; min-height: 44px; max-height: 140px; }
.doc-chip { margin-bottom: 8px; padding: 6px 10px; border-radius: 8px; background: rgba(16, 185, 129, 0.14); border: 1px solid rgba(16, 185, 129, 0.45); font-size: 12px; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
button { border: none; border-radius: 8px; padding: 9px 14px; font-weight: 600; font-size: 13px; cursor: pointer; }
.btn-primary { background: var(--accent); color: var(--accent-dark); }
.btn-secondary { background: var(--panel-alt); color: var(--text); border: 1px solid var(--border); }
.btn-danger { background: rgba(220, 38, 38, 0.18); color: #fca5a5; border: 1px solid rgba(220, 38, 38, 0.45); }
.btn-icon { background: var(--panel-alt); color: var(--text); border: 1px solid var(--border); padding: 10px 12px; }
.full-width { width: 100%; }
@media (max-width: 768px) {
  .sidebar { display: none; }
  .msg-bubble { max-width: 95%; }
}
