/* TrustAgent — UI moderne, palette TrustalAI (#10b981 vert + indigo accents) */
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
       background: #f8fafc; color: #0f172a; }

/* === LOGIN === */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center;
              background: linear-gradient(135deg, #10b981 0%, #6366f1 100%); padding: 20px; }
.login-card { background: #fff; border-radius: 20px; padding: 36px;
              box-shadow: 0 20px 60px rgba(0,0,0,0.15); width: 100%; max-width: 420px; }
.login-card .brand { text-align: center; margin-bottom: 28px; }
.login-card .logo-circle { width: 64px; height: 64px; border-radius: 16px; margin: 0 auto 14px;
                          background: linear-gradient(135deg, #10b981, #6366f1); color: #fff;
                          display: flex; align-items: center; justify-content: center; font-size: 1.6rem;
                          box-shadow: 0 8px 24px rgba(16,185,129,0.3); }
.login-card h1 { margin: 0; font-size: 1.6rem; font-weight: 700; }
.login-card .tagline { color: #64748b; font-size: 0.85rem; margin-top: 4px; }
.login-form label { display: block; margin-bottom: 14px; font-size: 0.85rem; color: #475569; font-weight: 500; }
.login-form input { width: 100%; padding: 10px 14px; border: 1.5px solid #e2e8f0; border-radius: 10px;
                    font-size: 0.95rem; margin-top: 4px; transition: border .15s; }
.login-form input:focus { outline: none; border-color: #10b981; box-shadow: 0 0 0 3px rgba(16,185,129,0.1); }
.login-form button { padding: 11px 20px; border-radius: 10px; border: 0; background: #10b981; color: #fff;
                     font-weight: 600; font-size: 0.95rem; cursor: pointer; transition: .15s; }
.login-form button:hover { background: #059669; }
.ms-btn { display: flex; align-items: center; justify-content: center; gap: 12px;
          width: 100%; padding: 12px; background: #fff; border: 1.5px solid #e2e8f0;
          border-radius: 12px; color: #0f172a; font-weight: 600; font-size: 0.95rem;
          text-decoration: none; transition: .15s; margin-top: 8px; }
.ms-btn:hover { border-color: #10b981; background: #ecfdf5; box-shadow: 0 4px 12px rgba(16,185,129,0.1); }
.footer-note { text-align: center; color: #94a3b8; font-size: 0.75rem; margin-top: 20px; }

/* === LAYOUT === */
.ta-layout { display: flex; height: 100vh; overflow: hidden; }

/* === SIDEBAR === */
.ta-sidebar { width: 280px; background: #fff; border-right: 1px solid #e2e8f0;
              display: flex; flex-direction: column; flex-shrink: 0; }
.ta-brand { padding: 16px; display: flex; gap: 12px; align-items: center; border-bottom: 1px solid #f1f5f9; }
.ta-brand .logo-circle { width: 38px; height: 38px; border-radius: 10px;
                         background: linear-gradient(135deg, #10b981, #6366f1); color: #fff;
                         display: flex; align-items: center; justify-content: center; font-size: 1rem;
                         flex-shrink: 0; }
.ta-brand-name { font-weight: 700; font-size: 1rem; }
.ta-brand-sub { color: #64748b; font-size: 0.7rem; }
.ta-section-label { padding: 16px 16px 8px; font-size: 0.65rem; text-transform: uppercase;
                    letter-spacing: 0.6px; color: #94a3b8; font-weight: 700;
                    display: flex; justify-content: space-between; align-items: center; }
.ta-new-conv { background: transparent; border: 0; color: #6366f1; cursor: pointer; padding: 2px 6px;
               border-radius: 6px; font-size: 0.85rem; }
.ta-new-conv:hover { background: #eef2ff; }

.ta-agents { padding: 0 8px; }
.ta-agent-link { display: flex; gap: 10px; padding: 10px; border-radius: 10px; text-decoration: none;
                 color: #475569; font-size: 0.85rem; align-items: flex-start; transition: .15s;
                 border-left: 3px solid transparent; margin-bottom: 4px; }
.ta-agent-link:hover { background: #f8fafc; color: #0f172a; }
.ta-agent-link.active { background: #ecfdf5; border-left-color: var(--accent); color: #0f172a; }
.ta-agent-link i { font-size: 1rem; color: var(--accent); flex-shrink: 0; margin-top: 2px; }
.ta-agent-name { font-weight: 600; font-size: 0.85rem; }
.ta-agent-desc { font-size: 0.7rem; color: #94a3b8; margin-top: 2px; line-height: 1.3; }

.ta-conversations { flex: 1; overflow-y: auto; padding: 0 8px 8px; }
.ta-conv-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px;
                cursor: pointer; font-size: 0.78rem; color: #64748b; transition: .15s; }
.ta-conv-item:hover { background: #f8fafc; color: #0f172a; }
.ta-conv-item.active { background: #f1f5f9; color: #0f172a; font-weight: 500; }
.ta-conv-item i.bi-chat-dots { color: #94a3b8; flex-shrink: 0; font-size: 0.85rem; }
.ta-conv-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ta-conv-del { color: #cbd5e1; font-size: 0.75rem; opacity: 0; transition: .15s; }
.ta-conv-item:hover .ta-conv-del { opacity: 1; }
.ta-conv-del:hover { color: #ef4444; }
.ta-empty { padding: 12px; font-size: 0.75rem; color: #94a3b8; text-align: center; }

.ta-footer { padding: 12px 16px; border-top: 1px solid #f1f5f9; font-size: 0.78rem; }
.ta-footer a { color: #64748b; text-decoration: none; }
.ta-footer a:hover { color: #ef4444; }

/* === MAIN CHAT === */
.ta-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.ta-chat-header { padding: 14px 24px; background: #fff; border-bottom: 1px solid #e2e8f0;
                  display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.ta-agent-badge { display: flex; gap: 12px; align-items: center; }
.ta-agent-badge i { width: 38px; height: 38px; border-radius: 10px;
                    background: var(--accent); color: #fff;
                    display: flex; align-items: center; justify-content: center; font-size: 1.1rem; }
.ta-agent-badge .title { font-weight: 700; font-size: 1rem; }
.ta-agent-badge .sub { color: #64748b; font-size: 0.78rem; }
.ta-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { background: #f1f5f9; color: #475569; padding: 3px 10px; border-radius: 12px;
       font-size: 0.7rem; font-weight: 500; }

/* === MESSAGES === */
.ta-messages { flex: 1; overflow-y: auto; padding: 24px; }

.ta-welcome { text-align: center; padding: 40px 20px; }
.ta-welcome .logo-circle.big { width: 72px; height: 72px; border-radius: 20px; margin: 0 auto 16px;
                                color: #fff; display: flex; align-items: center; justify-content: center;
                                font-size: 2rem; }
.ta-welcome h2 { font-size: 1.4rem; font-weight: 700; margin: 0 0 8px; }
.ta-welcome p { color: #64748b; margin: 0 0 24px; }
.ta-suggestions { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
                  gap: 10px; max-width: 820px; margin: 0 auto; }
.ta-suggestion { background: #fff; border: 1.5px solid #e2e8f0; padding: 12px 14px;
                 border-radius: 12px; font-size: 0.82rem; color: #334155; cursor: pointer;
                 text-align: left; transition: .15s; display: flex; align-items: center; gap: 8px; }
.ta-suggestion:hover { border-color: #10b981; background: #ecfdf5; }
.ta-suggestion i { color: #10b981; font-size: 1rem; }

.ta-msg { display: flex; gap: 12px; margin-bottom: 16px; max-width: 880px; margin-left: auto; margin-right: auto; }
.ta-msg-user { flex-direction: row-reverse; }
.ta-msg-avatar { width: 36px; height: 36px; border-radius: 10px;
                 background: linear-gradient(135deg, #10b981, #6366f1); color: #fff;
                 display: flex; align-items: center; justify-content: center; font-size: 0.95rem;
                 flex-shrink: 0; }
.ta-msg-body { flex: 1; min-width: 0; max-width: calc(100% - 50px); }
.ta-msg-user .ta-msg-body { display: flex; flex-direction: column; align-items: flex-end; }
.ta-msg-user .ta-msg-text { background: #10b981; color: #fff; padding: 10px 14px; border-radius: 14px;
                            border-bottom-right-radius: 4px; max-width: 75%;
                            white-space: pre-wrap; word-wrap: break-word; }
.ta-msg-assistant .ta-msg-text { background: #fff; padding: 14px 18px; border-radius: 14px;
                                  border-bottom-left-radius: 4px; border: 1px solid #e2e8f0;
                                  word-wrap: break-word; }
.ta-msg-text p:last-child { margin-bottom: 0; }
.ta-msg-text h1,h2,h3 { margin: 16px 0 8px; font-size: 1.05rem; font-weight: 700; }
.ta-msg-text h1 { font-size: 1.2rem; }
.ta-msg-text table { border-collapse: collapse; margin: 12px 0; font-size: 0.85rem; width: 100%; }
.ta-msg-text th, .ta-msg-text td { border: 1px solid #e2e8f0; padding: 6px 10px; text-align: left; }
.ta-msg-text th { background: #f8fafc; font-weight: 600; }
.ta-msg-text code { background: #f1f5f9; padding: 2px 6px; border-radius: 4px; font-size: 0.85em; }
.ta-msg-text pre { background: #0f172a; color: #e2e8f0; padding: 12px; border-radius: 8px; overflow-x: auto;
                   font-size: 0.8rem; }
.ta-msg-text pre code { background: transparent; color: inherit; }
.ta-msg-text ul, .ta-msg-text ol { padding-left: 24px; margin: 8px 0; }
.ta-msg-text li { margin-bottom: 4px; }
.ta-msg-text strong { font-weight: 600; }

.ta-tool-calls { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.ta-tool-chip { background: #eef2ff; color: #4338ca; padding: 3px 9px; border-radius: 10px;
                font-size: 0.68rem; font-weight: 500; cursor: help; }
.ta-tool-chip i { font-size: 0.7rem; margin-right: 3px; }

.ta-msg-att { background: #f1f5f9; padding: 6px 10px; border-radius: 8px; font-size: 0.78rem;
              margin-bottom: 8px; display: inline-block; }

/* Typing dots */
.ta-dots { display: inline-flex; gap: 4px; align-items: center; padding: 4px 0; }
.ta-dots span { width: 8px; height: 8px; border-radius: 50%; background: #94a3b8;
                animation: bounce 1.4s infinite ease-in-out both; }
.ta-dots span:nth-child(2) { animation-delay: -0.32s; }
.ta-dots span:nth-child(3) { animation-delay: -0.16s; }
@keyframes bounce { 0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; } 40% { transform: scale(1); opacity: 1; } }

/* === INPUT === */
.ta-input { padding: 16px 24px 20px; border-top: 1px solid #e2e8f0; background: #fff; }
.ta-attachment-preview { margin-bottom: 8px; min-height: 0; }
.ta-att-loading, .ta-att-chip { font-size: 0.78rem; color: #475569;
                                 background: #f1f5f9; padding: 6px 10px; border-radius: 8px;
                                 display: inline-flex; align-items: center; gap: 6px; }
.ta-att-chip i { color: #6366f1; }
.ta-input-row { display: flex; gap: 10px; align-items: flex-end;
                background: #f8fafc; border: 1.5px solid #e2e8f0; border-radius: 16px; padding: 8px; }
.ta-input-row:focus-within { border-color: #10b981; background: #fff; }
.ta-attach-btn, .ta-send-btn { background: transparent; border: 0; cursor: pointer; padding: 8px;
                                border-radius: 10px; color: #64748b; font-size: 1.1rem; flex-shrink: 0;
                                width: 38px; height: 38px; }
.ta-attach-btn:hover { background: #e2e8f0; color: #0f172a; }
.ta-send-btn { background: #10b981; color: #fff; }
.ta-send-btn:hover { background: #059669; }
.ta-send-btn:disabled { opacity: 0.6; cursor: not-allowed; }
#userInput { flex: 1; border: 0; background: transparent; padding: 8px 4px; resize: none;
             font-size: 0.92rem; font-family: inherit; outline: none; max-height: 200px;
             min-height: 24px; line-height: 1.5; }
.ta-input-hint { font-size: 0.7rem; color: #94a3b8; text-align: center; margin-top: 6px; }

/* Alert */
.alert { padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; font-size: 0.85rem; }
.alert-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.text-muted { color: #94a3b8; }
.text-danger { color: #ef4444; }

/* Bootstrap spinner */
.spinner-border { display: inline-block; width: 1rem; height: 1rem; vertical-align: -0.125em;
                  border: 0.15em solid currentColor; border-right-color: transparent; border-radius: 50%;
                  animation: .75s linear infinite spinner-border; }
.spinner-border-sm { width: 0.85rem; height: 0.85rem; border-width: 0.12em; }
@keyframes spinner-border { to { transform: rotate(360deg); } }
