    /* CSS Styles */
    :root {
      --bg-body: #ffffff;
      --bg-sidebar: #f8fafc;
      --bg-surface: #ffffff;
      --border-color: #e2e8f0;
      --text-primary: #1e293b;
      --text-secondary: #64748b;
      --accent-primary: #4f46e5;
      --accent-light: #e0e7ff;
      --accent-hover: #4338ca;
      --user-bubble: #f1f5f9;
      --ai-bubble: #ffffff;
      --hover-bg: #e2e8f0;
      --scrollbar-thumb: #cbd5e1;
      --font-family: 'Inter', sans-serif;
      --font-mono: 'JetBrains Mono', monospace;
      --sidebar-width: 280px;
      --logo-bg: #ffffff;
      --msg-avatar-user-bg: #e2e8f0;
      --msg-avatar-user-text: #64748b;
      --code-bg: #1e293b;
      --code-text: #f1f5f9;
      --menu-bg: #ffffff;
      --menu-border: #e2e8f0;
      --menu-shadow: rgba(0, 0, 0, 0.1);
    }

    [data-theme="dark"] {
      --bg-body: #020617;
      --bg-sidebar: #0f172a;
      --bg-surface: #1e293b;
      --border-color: #1e293b;
      --text-primary: #f8fafc;
      --text-secondary: #94a3b8;
      --accent-primary: #6366f1;
      --accent-light: #1e1b4b;
      --accent-hover: #818cf8;
      --user-bubble: #1e293b;
      --ai-bubble: #0f172a;
      --hover-bg: #334155;
      --scrollbar-thumb: #475569;
      --logo-bg: #1e293b;
      --msg-avatar-user-bg: #334155;
      --msg-avatar-user-text: #cbd5e1;
      --code-bg: #0d1117;
      --menu-bg: #1e293b;
      --menu-border: #334155;
      --menu-shadow: rgba(0, 0, 0, 0.3);
    }

    * { box-sizing: border-box; outline: none; -webkit-tap-highlight-color: transparent; }
    body { margin: 0; font-family: var(--font-family); background-color: var(--bg-body); color: var(--text-primary); height: 100vh; overflow: hidden; display: flex; transition: background-color 0.3s ease, color 0.3s ease; }

    /* Sidebar */
    .sidebar { width: var(--sidebar-width); min-width: 0; background-color: var(--bg-sidebar); display: flex; flex-direction: column; transition: width 0.3s ease, padding 0.3s ease, opacity 0.2s ease, background-color 0.3s; z-index: 20; overflow: hidden; position: relative; }
    .sidebar.collapsed { width: 0 !important; padding: 0 !important; opacity: 0; pointer-events: none; }
    .sidebar-header { padding: 1rem; display: flex; align-items: center; gap: 0.75rem; height: 64px; }
    .logo-container { width: 40px; height: 40px; min-width: 40px; background: transparent; border: none; border-radius: 0; display: flex; align-items: center; justify-content: center; overflow: visible; }
    .logo-container svg { width: 100%; height: 100%; }
    .brand-name { font-weight: 700; font-size: 0.9rem; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .new-chat-wrapper { padding: 0 1rem 1rem; }
    .btn-new-chat { width: 100%; display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem; background-color: var(--accent-light); color: var(--accent-primary); border: 1px solid var(--border-color); border-radius: 999px; font-size: 0.9rem; font-weight: 500; cursor: pointer; transition: all 0.2s; white-space: nowrap; overflow: hidden; }
    .btn-new-chat:hover { filter: brightness(0.95); }
    .history-label { padding: 0.5rem 1.5rem; font-size: 0.75rem; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .sessions-list { flex: 1; overflow-y: auto; padding: 0 0.5rem; }
    .session-item { padding: 0.75rem 1rem; margin-bottom: 2px; border-radius: 8px; cursor: pointer; color: var(--text-secondary); font-size: 0.9rem; display: flex; flex-direction: column; gap: 2px; transition: background 0.2s, border-color 0.2s; overflow: hidden; border: 1px solid transparent; }
    .session-item:hover { background-color: var(--hover-bg); color: var(--text-primary); }
    .session-item.active { background-color: rgba(79, 70, 229, 0.12); border: 1px solid var(--accent-primary); color: var(--accent-primary); box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
    [data-theme="dark"] .session-item.active { background-color: rgba(99, 102, 241, 0.15); border-color: var(--accent-primary); color: var(--accent-primary); }
    .session-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-weight: 500; width: 100%; line-height: 1.3; }
    .session-date { font-size: 0.7rem; color: var(--text-secondary); opacity: 0.8; }
    .session-title.loading { color: var(--text-secondary); font-style: italic; }

    .user-footer { padding: 1rem; border-top: 1px solid var(--border-color); display: flex; align-items: center; gap: 0.75rem; background: var(--bg-sidebar); overflow: hidden; position: relative; }
    .avatar-circle { width: 32px; height: 32px; border-radius: 50%; background-color: var(--accent-primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 700; flex-shrink: 0; letter-spacing: -0.5px; }
    .user-info { display: flex; flex-direction: column; overflow: hidden; min-width: 0; flex: 1; }
    .user-name { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .user-status { font-size: 0.7rem; color: var(--text-secondary); display: flex; align-items: center; gap: 4px; white-space: nowrap; }
    .status-dot { width: 6px; height: 6px; border-radius: 50%; background-color: #22c55e; flex-shrink: 0; }

    /* Configuração e Versão */
    .footer-actions { display: flex; flex-direction: column; align-items: center; gap: 2px; }
    .app-version { font-size: 0.65rem; color: var(--text-secondary); opacity: 0.6; }

    .resizer { width: 4px; background-color: transparent; border-left: 1px solid var(--border-color); cursor: col-resize; transition: background-color 0.2s; z-index: 25; flex-shrink: 0; }
    .resizer:hover, .resizer.resizing { background-color: var(--scrollbar-thumb); border-left-color: var(--text-secondary); }

    /* Main Content */
    .main-content { flex: 1; display: flex; flex-direction: column; position: relative; background: var(--bg-body); min-width: 0; transition: background-color 0.3s; }
    .main-content.is-new-chat { justify-content: center; }
    .main-content.is-new-chat .model-badge { display: none; }
    .main-content.is-new-chat header { position: absolute; top: 0; left: 0; width: 100%; justify-content: flex-start; }
    .main-content.is-new-chat #output { flex: 0 0 auto; padding: 0; margin-bottom: 1.5rem; display: flex; justify-content: center; margin-top: 64px; }
    .main-content.is-new-chat .input-container { background: transparent; padding: 0; flex: 0 0 auto; display: flex; justify-content: center; flex-direction: column; align-items: center; }
    .welcome-container { width: 100%; max-width: 800px; padding: 0 1rem; text-align: left; opacity: 0; animation: fadeIn 0.5s forwards; }
    .welcome-header { display: flex; align-items: center; gap: 1.25rem; margin-bottom: 0.5rem; }
    .welcome-logo { width: 64px; height: 64px; flex-shrink: 0; }
    .welcome-title { color: var(--text-primary); font-size: 2.5rem; font-weight: 500; margin: 0; background: -webkit-linear-gradient(0deg, var(--accent-primary), #818cf8); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
    .welcome-subtitle { color: var(--text-secondary); font-size: 1.5rem; opacity: 0.8; }
    .main-content.is-new-chat .input-box { width: 100%; max-width: 800px; margin: 0 1rem; }
    .main-content.is-new-chat .input-footer-text { margin-bottom: 2rem; }

    header { height: 64px; padding: 0 1.5rem; display: flex; align-items: center; gap: 1rem; border-bottom: 1px solid transparent; }
    .menu-btn { background: none; border: none; cursor: pointer; color: var(--text-secondary); padding: 8px; border-radius: 50%; display: flex; align-items: center; justify-content: center; transition: background-color 0.2s; }
    .menu-btn:hover { background-color: var(--hover-bg); color: var(--text-primary); }
    .mobile-close-btn { display: none; margin-left: auto; background: none; border: none; cursor: pointer; color: var(--text-secondary); }
    .model-badge { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; color: var(--text-secondary); background: var(--bg-sidebar); padding: 0.4rem 0.8rem; border-radius: 999px; margin-left: auto; margin-right: auto; border: 1px solid var(--border-color); }

    #output { flex: 1; overflow-y: auto; padding: 2rem 10%; scroll-behavior: smooth; }
    @media (max-width: 768px) { .sidebar { position: absolute; height: 100%; width: 280px !important; transform: translateX(-100%); box-shadow: 2px 0 10px rgba(0,0,0,0.25); border-right: 1px solid var(--border-color); } .sidebar.open { transform: translateX(0); opacity: 1; pointer-events: auto; } .resizer { display: none; } #output { padding: 1rem 1rem; } .mobile-close-btn { display: block; } .menu-btn { display: block; } .model-badge { margin-right: 0; } }

    /* Messages */
    .message { display: flex; gap: 1rem; margin-bottom: 2rem; animation: fadeIn 0.3s ease-out; }
    @keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
    .message.user { flex-direction: row-reverse; }
    .msg-avatar { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 4px; }
    .message.user .msg-avatar { background-color: var(--msg-avatar-user-bg); color: var(--msg-avatar-user-text); font-size: 0.75rem; font-weight: 700; letter-spacing: -0.5px; }
    .message.assistant .msg-avatar { background: linear-gradient(135deg, #4f46e5, #818cf8); color: white; }
    .msg-content-wrapper { max-width: 85%; display: flex; flex-direction: column; min-width: 0; }
    .message.user .msg-content-wrapper { align-items: flex-end; }
    .msg-role-label { font-size: 0.7rem; color: var(--text-secondary); margin-bottom: 4px; font-weight: 600; text-transform: uppercase; }
    .msg-bubble { padding: 1rem 1.5rem; border-radius: 18px; line-height: 1.6; font-size: 0.95rem; position: relative; overflow-wrap: break-word; max-width: 100%; }
    .message.user .msg-bubble { background-color: var(--user-bubble); color: var(--text-primary); border-top-right-radius: 4px; }
    .message.assistant .msg-bubble { background-color: var(--ai-bubble); color: var(--text-primary); border: 1px solid var(--border-color); border-top-left-radius: 4px; box-shadow: 0 1px 2px rgba(0,0,0,0.05); }

    /* Message Actions (Copy etc) */
    .msg-actions { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.5rem; opacity: 1; transition: opacity 0.2s; }
    .msg-action-btn { background: transparent; border: none; color: var(--text-secondary); cursor: pointer; padding: 4px; border-radius: 4px; display: flex; align-items: center; gap: 4px; font-size: 0.75rem; transition: all 0.2s; }
    .msg-action-btn:hover { background-color: var(--hover-bg); color: var(--text-primary); }

    /* Markdown Styles */
    .msg-bubble p { margin-bottom: 1em; }
    .msg-bubble p:last-child { margin-bottom: 0; }
    .msg-bubble h1, .msg-bubble h2, .msg-bubble h3 { font-weight: 600; color: var(--text-primary); margin-top: 1em; margin-bottom: 0.5em; }
    .msg-bubble h1 { font-size: 1.4em; border-bottom: 1px solid var(--border-color); padding-bottom: 0.3em; }
    .msg-bubble h2 { font-size: 1.2em; }
    .msg-bubble strong { font-weight: 600; color: var(--text-primary); }
    .msg-bubble :not(pre) > code { background: var(--hover-bg); padding: 0.2em 0.4em; border-radius: 4px; font-family: var(--font-mono); font-size: 0.85em; color: #db2777; }
    .msg-bubble pre { margin: 0; padding: 0; background: transparent; overflow: visible; }
    .code-block-wrapper { margin: 1em 0; border-radius: 8px; overflow: hidden; border: 1px solid var(--border-color); background: var(--code-bg); }
    .code-header { display: flex; justify-content: space-between; align-items: center; padding: 0.5rem 1rem; background: rgba(255, 255, 255, 0.05); border-bottom: 1px solid rgba(255, 255, 255, 0.1); font-family: var(--font-family); font-size: 0.75rem; color: #94a3b8; }
    .code-content { padding: 1rem; overflow-x: auto; margin: 0; }
    .code-content code { background: transparent !important; padding: 0 !important; font-family: var(--font-mono); font-size: 0.9em; color: var(--code-text); }
    .msg-bubble table { width: 100%; border-collapse: collapse; margin: 1em 0; font-size: 0.9em; }
    .msg-bubble th, .msg-bubble td { padding: 0.5rem 0.75rem; border: 1px solid var(--border-color); text-align: left; }
    .msg-bubble th { background-color: var(--hover-bg); font-weight: 600; }
    .msg-bubble ul, .msg-bubble ol { padding-left: 1.5rem; margin: 0.5em 0; }
    .msg-bubble li { margin-bottom: 0.25rem; }
    .msg-bubble a { color: var(--accent-primary); text-decoration: none; }
    .msg-bubble a:hover { text-decoration: underline; }
    .copy-btn { background: transparent; border: none; color: inherit; cursor: pointer; display: flex; align-items: center; gap: 4px; opacity: 0.7; transition: opacity 0.2s; }
    .copy-btn:hover { opacity: 1; color: #fff; }

    /* Input Area */
    .input-container { padding: 1.5rem 10%; background: var(--bg-body); transition: background-color 0.3s; }
    @media (max-width: 768px) { .input-container { padding: 1rem; } }
    .input-box { background: var(--bg-sidebar); border: 1px solid var(--border-color); border-radius: 24px; padding: 0.5rem; display: flex; flex-direction: column; box-shadow: 0 2px 6px rgba(0,0,0,0.02); transition: border-color 0.2s, box-shadow 0.2s, background-color 0.3s; position: relative; }
    .input-box:focus-within { border-color: var(--accent-primary); box-shadow: 0 4px 12px rgba(79, 70, 229, 0.1); }
    .textarea-wrapper { width: 100%; padding: 0.25rem 0; }
    textarea { width: 100%; border: none; background: transparent; padding: 0.5rem 0.75rem; max-height: 150px; resize: none; font-family: inherit; font-size: 1rem; color: var(--text-primary); outline: none; }
    textarea::placeholder { color: var(--text-secondary); }
    .input-actions { display: flex; justify-content: space-between; align-items: center; padding: 0.25rem 0.25rem 0 0.25rem; margin-top: 0.25rem; }
    .actions-left { display: flex; align-items: center; gap: 0.5rem; position: relative; }
    .actions-right { display: flex; align-items: center; gap: 0.5rem; }
    .input-btn { width: 36px; height: 36px; border-radius: 50%; border: none; background: transparent; color: var(--text-secondary); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s; }
    .input-btn:hover { background: var(--hover-bg); color: var(--text-primary); }
    .input-btn.primary { background: var(--accent-primary); color: white; border-radius: 50%; }
    .input-btn.primary:hover { background: var(--accent-hover); }
    .input-btn.primary:disabled { background: var(--hover-bg); color: var(--text-secondary); cursor: not-allowed; }

    .attachments-area { display: flex; gap: 0.5rem; padding: 0 1rem; margin-bottom: 0.5rem; overflow-x: auto; }
    .file-chip { display: flex; align-items: center; gap: 0.5rem; background: var(--accent-light); color: var(--accent-primary); padding: 0.25rem 0.75rem; border-radius: 8px; font-size: 0.8rem; border: 1px solid var(--border-color); }
    .file-chip button { background: none; border: none; cursor: pointer; color: var(--accent-primary); padding: 0; margin-left: 4px; font-weight: bold; }

    /* Tool call indicators */
    .tool-calls { display: flex; flex-direction: column; gap: 4px; margin-bottom: 0.75rem; }
    .tool-call-item { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; font-size: 0.78rem; color: var(--text-secondary); max-width: 100%; overflow: hidden; box-sizing: border-box; }
    .tool-call-reason { font-family: var(--font-family); font-weight: 600; line-height: 1.4; background: var(--hover-bg); padding: 6px 10px; border-radius: 6px; border: 1px solid var(--border-color); width: 100%; box-sizing: border-box; }
    .tool-call-action { display: flex; align-items: flex-start; gap: 6px; font-family: var(--font-mono); min-width: 0; width: 100%; background: var(--hover-bg); padding: 6px 10px; border-radius: 6px; border: 1px solid var(--border-color); box-sizing: border-box; }
    .tool-call-action i { flex-shrink: 0; margin-top: 2px; width: 12px; height: 12px; }
    .tool-call-action i svg { width: 12px !important; height: 12px !important; }
    .tool-call-action span { word-break: break-all; white-space: pre-wrap; min-width: 0; }
    .tool-calls-response { margin-top: 0; }

    ::-webkit-scrollbar { width: 8px; height: 8px; } ::-webkit-scrollbar-track { background: transparent; } ::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 4px; } ::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

    .action-menu { position: absolute; bottom: 100%; left: 0; margin-bottom: 10px; background: var(--menu-bg); border: 1px solid var(--menu-border); border-radius: 12px; padding: 0.5rem; box-shadow: 0 4px 12px var(--menu-shadow); display: flex; flex-direction: column; gap: 0.25rem; min-width: 150px; opacity: 0; visibility: hidden; transform: translateY(10px); transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1); z-index: 50; top: auto; margin-top: 0; }
    .action-menu.active { opacity: 1; visibility: visible; transform: translateY(0); }
    .main-content.is-new-chat .action-menu { bottom: auto; top: 100%; margin-bottom: 0; margin-top: 10px; transform: translateY(-10px); }
    .main-content.is-new-chat .action-menu.active { transform: translateY(0); }
    .menu-item { display: flex; align-items: center; gap: 0.75rem; width: 100%; padding: 0.6rem 0.75rem; border: none; background: transparent; color: var(--text-primary); font-size: 0.9rem; text-align: left; cursor: pointer; border-radius: 8px; transition: background-color 0.15s; }
    .menu-item:hover { background-color: var(--hover-bg); }
    .menu-item i { width: 18px; height: 18px; color: var(--text-secondary); }

    .aws-accounts-container { position: relative; }
    .filter-btn { display: flex; align-items: center; gap: 0.4rem; padding: 0.4rem 0.8rem; border-radius: 999px; border: 1px solid var(--border-color); background: transparent; color: var(--text-secondary); font-size: 0.85rem; font-weight: 500; cursor: pointer; transition: all 0.2s; height: 36px; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .filter-btn:hover { background: var(--hover-bg); color: var(--text-primary); }
    .filter-summary { color: var(--text-primary); font-weight: 600; }
    .aws-accounts-menu { position: absolute; bottom: 100%; left: 0; margin-bottom: 10px; background: var(--menu-bg); border: 1px solid var(--menu-border); border-radius: 12px; padding: 0.5rem; box-shadow: 0 4px 12px var(--menu-shadow); min-width: 240px; display: none; flex-direction: column; gap: 0.25rem; z-index: 60; }
    .aws-accounts-menu.active { display: flex; }
    .aws-account-item { display: flex; flex-direction: column; gap: 2px; width: 100%; padding: 0.5rem 0.6rem; border: 1px solid transparent; background: transparent; color: var(--text-primary); text-align: left; cursor: pointer; border-radius: 8px; transition: background-color 0.15s, border-color 0.15s; }
    .aws-account-item:hover { background: var(--hover-bg); border-color: var(--border-color); }
    .aws-account-item.active { border-color: var(--accent-primary); background: rgba(79, 70, 229, 0.12); color: var(--accent-primary); }
    .aws-account-name { font-size: 0.85rem; font-weight: 600; }
    .aws-account-id { font-size: 0.7rem; color: var(--text-secondary); }
    .aws-accounts-empty { padding: 0.6rem 0.5rem; font-size: 0.8rem; color: var(--text-secondary); text-align: center; }

    .modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.5); z-index: 100; display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity 0.2s ease; backdrop-filter: blur(2px); }
    .modal-overlay.open { opacity: 1; pointer-events: auto; }
    .modal-content { background: var(--bg-surface); width: 90%; max-width: 400px; border-radius: 16px; border: 1px solid var(--border-color); box-shadow: 0 10px 25px rgba(0,0,0,0.2); transform: scale(0.95); transition: transform 0.2s ease; overflow: hidden; }
    .modal-overlay.open .modal-content { transform: scale(1); }
    .modal-header { padding: 1rem 1.5rem; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; }
    .modal-header h3 { margin: 0; font-size: 1.1rem; color: var(--text-primary); font-weight: 600; }
    .close-modal-btn { background: none; border: none; color: var(--text-secondary); cursor: pointer; padding: 4px; border-radius: 50%; transition: background 0.2s; }
    .close-modal-btn:hover { background: var(--hover-bg); color: var(--text-primary); }
    .modal-body { padding: 1.5rem; }
    .theme-group { display: flex; flex-direction: column; gap: 0.5rem; }
    .theme-label { font-size: 0.85rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 0.5rem; text-transform: uppercase; letter-spacing: 0.05em; }
    .theme-option { display: flex; align-items: center; gap: 1rem; padding: 0.75rem 1rem; border-radius: 12px; border: 1px solid var(--border-color); background: var(--bg-body); color: var(--text-primary); cursor: pointer; transition: all 0.2s; font-size: 0.95rem; }
    .theme-option:hover { background: var(--hover-bg); }
    .theme-option.active { border-color: var(--accent-primary); background: var(--accent-light); color: var(--accent-primary); font-weight: 500; }
    .theme-option i { width: 18px; height: 18px; }

    /* CSP compliance: substituição de inline styles e onclick handlers */
    .input-footer-text { text-align: center; margin-top: 0.5rem; font-size: 0.7rem; color: var(--text-secondary); opacity: 0.7; }
    .btn-icon-sm { width: 32px !important; height: 32px !important; }
    .accent-icon { color: var(--accent-primary); }
    .header-spacer { width: 40px; }
    #menu-attach { display: none; }
    #stop-btn { display: none; color: #ef4444; }
    .file-attachment-badge { font-size: 0.75rem; background: var(--accent-light); color: var(--accent-primary); padding: 2px 8px; border-radius: 4px; display: flex; align-items: center; gap: 4px; }
    .empty-state-msg { text-align: center; padding: 2rem; color: var(--text-secondary); }
    .sessions-empty-msg { padding: 1rem; text-align: center; color: var(--text-secondary); font-size: 0.8rem; }

