/* Jandaia IA - tema escuro moderno */
:root {
    --bg: #0b0d12;
    --bg-card: #141720;
    --bg-elev: #1a1e28;
    --border: #2a2f3a;
    --text: #e6e8ee;
    --text-dim: #8b94a7;
    --accent: #ff8a3d;
    --accent-soft: #ffb27a;
    --ok: #4ade80;
    --erro: #f87171;
    --warn: #fbbf24;
    --mono: "JetBrains Mono", "Cascadia Code", Consolas, monospace;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

.hidden { display: none !important; }

button, input, textarea {
    font: inherit;
    color: inherit;
}

.btn-primary {
    background: var(--accent);
    color: #1a1208;
    border: 0;
    padding: 0.55em 1.2em;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.btn-primary:hover { background: var(--accent-soft); }

.btn-ghost {
    background: transparent;
    color: var(--text-dim);
    border: 1px solid var(--border);
    padding: 0.45em 0.9em;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}
.btn-ghost:hover { color: var(--text); border-color: var(--accent); }

.select-filial {
    background: var(--bg-elev);
    color: var(--text-dim);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 5px 10px;
    font-size: .82em;
    cursor: pointer;
}
.select-filial:hover, .select-filial:focus { border-color: var(--accent); outline: none; color: var(--text); }

.chart-hint { font-size: .75em; margin: -4px 0 6px; }

/* ---------- login ---------- */
.login-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: radial-gradient(circle at top left, #1a1f2e, var(--bg));
}
.login-card {
    background: var(--bg-card);
    padding: 2.5em 2.5em;
    border-radius: 12px;
    border: 1px solid var(--border);
    width: 360px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
.brand h1 {
    margin: 0 0 0.3em;
    font-size: 1.8em;
    letter-spacing: -0.5px;
}
.accent { color: var(--accent); }
.brand .sub {
    margin: 0 0 1.8em;
    color: var(--text-dim);
    font-size: 0.9em;
}
.login-card form label {
    display: block;
    margin-bottom: 1em;
}
.login-card form label span {
    display: block;
    font-size: 0.85em;
    color: var(--text-dim);
    margin-bottom: 0.4em;
}
.login-card input {
    width: 100%;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    padding: 0.7em 0.9em;
    border-radius: 6px;
}
.login-card input:focus {
    outline: none;
    border-color: var(--accent);
}
.login-card button {
    width: 100%;
    margin-top: 0.4em;
    padding: 0.8em;
}
.erro {
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.3);
    color: var(--erro);
    padding: 0.6em 0.8em;
    border-radius: 6px;
    margin-bottom: 1em;
    font-size: 0.9em;
}

/* ---------- topbar ---------- */
.topbar {
    background: rgba(20,23,32,0.95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255,138,61,0.12);
    padding: 0.7em 1.5em;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 50;
}
.brand-mini {
    font-size: 1.15em;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5em;
    letter-spacing: -.01em;
}
.badge {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    color: var(--text-dim);
    padding: 0.15em 0.5em;
    border-radius: 4px;
    font-size: 0.75em;
    font-family: var(--mono);
}
.topbar-right {
    display: flex;
    align-items: center;
    gap: 0.5em;
}
.user { color: var(--text-dim); font-size: 0.9em; }
.jd-avatar-header {
    width: 30px; height: 30px;
    background: linear-gradient(135deg, #ff8a3d, #ff5500);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: .75em; font-weight: 800; color: #fff;
    letter-spacing: -.02em;
    flex-shrink: 0;
}
.jd-icon {
    background: linear-gradient(135deg, #ff8a3d, #ff5500) !important;
    color: #fff !important;
    border-color: transparent !important;
    font-size: .72em !important;
    font-weight: 800 !important;
    letter-spacing: -.02em !important;
}
.jd-greeting .msg-bubble {
    border-left: 2px solid var(--accent);
    background: rgba(255,138,61,.06);
}
.user-chip {
    display: flex;
    align-items: center;
    gap: 0.5em;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 0.3em 0.8em 0.3em 0.35em;
    font-size: 0.85em;
}
.user-avatar {
    width: 24px; height: 24px;
    background: linear-gradient(135deg, #ff8a3d, #ff5500);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.75em; font-weight: 700; color: #fff;
}

/* ---------- welcome screen ---------- */
.welcome-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5em 1em 1em;
    transition: opacity .25s, transform .25s;
    width: 100%;
}
.welcome-hero {
    text-align: center;
    max-width: 480px;
    margin-bottom: 1.4em;
}
.welcome-avatar {
    width: 48px; height: 48px;
    background: radial-gradient(circle at 30% 30%, rgba(255,138,61,.2), rgba(255,85,0,.06));
    border: 1px solid rgba(255,138,61,.25);
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 0.9em;
    box-shadow: 0 0 24px rgba(255,138,61,.1);
}
.welcome-title {
    font-size: 1.35em;
    font-weight: 700;
    margin: 0 0 0.4em;
    letter-spacing: -.02em;
}
.welcome-sub {
    color: var(--text-dim);
    font-size: 0.88em;
    margin: 0;
    line-height: 1.6;
}
.suggest-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.7em;
    width: 100%;
    max-width: 820px;
}
.suggest-section { display: flex; flex-direction: column; gap: 0.35em; }
.suggest-label {
    font-size: 0.7em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-dim);
    padding: 0 0.2em;
    margin-bottom: 0.1em;
}
.suggest-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.55em 0.8em;
    cursor: pointer;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 0.5em;
    font-size: 0.83em;
    color: var(--text-dim);
    transition: all .15s;
    line-height: 1.3;
}
.suggest-card:hover {
    border-color: rgba(255,138,61,.45);
    background: rgba(255,138,61,.05);
    color: var(--text);
    transform: translateY(-1px);
    box-shadow: 0 3px 12px rgba(0,0,0,.2);
}
.suggest-icon { font-size: 1em; flex-shrink: 0; }

/* ---------- main ---------- */
.app {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5em;
    display: grid;
    gap: 1.2em;
}

section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.3em 1.5em;
}

section h2 {
    margin: 0 0 0.8em;
    font-size: 1.2em;
    font-weight: 600;
}
section h3 {
    margin: 0;
    font-size: 1em;
    font-weight: 600;
    color: var(--text-dim);
}

.ask textarea {
    width: 100%;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    padding: 0.9em 1em;
    border-radius: 8px;
    resize: vertical;
    font-size: 1em;
    line-height: 1.4;
}
.ask textarea:focus {
    outline: none;
    border-color: var(--accent);
}
.ask-actions {
    margin-top: 0.8em;
    display: flex;
    gap: 0.8em;
    align-items: center;
}
.status {
    color: var(--text-dim);
    font-size: 0.9em;
}

/* ---------- SQL panel ---------- */
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8em;
}
.panel-actions {
    display: flex;
    gap: 0.5em;
    align-items: center;
}
.explicacao {
    color: var(--text);
    margin-bottom: 0.6em;
    font-size: 0.95em;
}
.suposicoes {
    background: rgba(251, 191, 36, 0.08);
    border: 1px solid rgba(251, 191, 36, 0.25);
    color: var(--warn);
    padding: 0.6em 0.9em;
    border-radius: 6px;
    font-size: 0.9em;
    margin-bottom: 0.6em;
}
.suposicoes ul {
    margin: 0.3em 0 0 1.2em;
    padding: 0;
}
.sql-box {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    padding: 1em;
    border-radius: 8px;
    font-family: var(--mono);
    font-size: 0.9em;
    line-height: 1.5;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
    min-height: 4em;
}
.sql-box:focus {
    outline: none;
    border-color: var(--accent);
}
.meta {
    margin-top: 0.6em;
    display: flex;
    justify-content: space-between;
    gap: 1em;
    font-size: 0.8em;
}
.hint { color: var(--text-dim); font-family: var(--mono); }

/* ---------- resultado ---------- */
.tabela-wrap {
    overflow-x: auto;
    max-height: 65vh;
    border: 1px solid var(--border);
    border-radius: 6px;
}
table.resultado {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88em;
}
table.resultado thead {
    background: var(--bg-elev);
    position: sticky;
    top: 0;
}
table.resultado th, table.resultado td {
    padding: 0.6em 0.9em;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
table.resultado th {
    font-weight: 600;
    color: var(--accent);
    font-family: var(--mono);
    font-size: 0.85em;
}
table.resultado tr:hover td { background: var(--bg-elev); }
.nul { color: var(--text-dim); font-style: italic; font-size: 0.85em; }
.vazio { padding: 2em; text-align: center; color: var(--text-dim); }

/* ---------- erro panel ---------- */
.erro-panel {
    border-color: rgba(248, 113, 113, 0.3);
    background: rgba(248, 113, 113, 0.05);
}
.erro-panel h3 { color: var(--erro); }
.erro-panel pre {
    font-family: var(--mono);
    font-size: 0.85em;
    color: var(--erro);
    margin: 0.5em 0 0;
    white-space: pre-wrap;
}

/* ---------- drawer historico ---------- */
.drawer {
    position: fixed;
    top: 0; right: 0;
    height: 100vh;
    width: 420px;
    background: var(--bg-card);
    border-left: 1px solid var(--border);
    box-shadow: -8px 0 24px rgba(0,0,0,0.4);
    overflow-y: auto;
    z-index: 50;
    display: flex;
    flex-direction: column;
}
.drawer-header {
    padding: 1em 1.2em;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.drawer-filtros {
    padding: 0.7em 1.2em;
    border-bottom: 1px solid var(--border);
    font-size: 0.9em;
}
.lista-hist {
    list-style: none;
    margin: 0;
    padding: 0;
}
.lista-hist li {
    padding: 0.9em 1.2em;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
}
.lista-hist li:hover { background: var(--bg-elev); }
.lista-hist .ph { color: var(--text); margin-bottom: 0.3em; font-size: 0.92em; }
.lista-hist .meta { color: var(--text-dim); font-size: 0.78em; }
.lista-hist .snippet {
    margin: 0.4em 0 0;
    font-family: var(--mono);
    font-size: 0.78em;
    color: var(--text-dim);
    background: var(--bg-elev);
    padding: 0.5em 0.7em;
    border-radius: 4px;
    overflow: hidden;
    white-space: pre-wrap;
}
.ok { color: var(--ok); }
.ko { color: var(--erro); }

/* ---------- overlay/spinner ---------- */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 17, 21, 0.65);
    backdrop-filter: blur(4px);
    z-index: 100;
    display: grid;
    place-items: center;
}
.spinner {
    width: 48px; height: 48px;
    border: 4px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- sql colapsavel (admin) ---------- */
.sql-details {
    margin-top: 1.2em;
    border-top: 1px solid var(--border);
    padding-top: 0.8em;
}
.sql-details summary {
    cursor: pointer;
    color: var(--text-dim);
    font-size: 0.85em;
    user-select: none;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.4em;
}
.sql-details summary::before {
    content: "▶";
    font-size: 0.7em;
    transition: transform 0.15s;
}
.sql-details[open] summary::before { transform: rotate(90deg); }
.sql-details .sql-box {
    margin-top: 0.7em;
}
.atalho {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    padding: 0.15em 0.5em;
    border-radius: 4px;
    font-size: 0.75em;
}

/* ---------- role tag ---------- */
.role-tag {
    display: inline-block;
    padding: 0.15em 0.55em;
    border-radius: 10px;
    font-size: 0.72em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-left: 0.4em;
}
.role-administrador {
    background: rgba(255, 138, 61, 0.15);
    color: var(--accent);
    border: 1px solid rgba(255, 138, 61, 0.4);
}
.role-analista {
    background: rgba(74, 222, 128, 0.12);
    color: var(--ok);
    border: 1px solid rgba(74, 222, 128, 0.3);
}

/* ---------- panel analista (sem SQL) ---------- */
.analista-panel .explicacao {
    font-size: 1em;
    margin-bottom: 0.5em;
}
.erro-panel details {
    margin-top: 0.6em;
    font-size: 0.85em;
}
.erro-panel details summary {
    cursor: pointer;
    color: var(--text-dim);
}

/* ---------- usuarios table ---------- */
.acoes-col { white-space: nowrap; text-align: right; }
.btn-sm {
    padding: 0.25em 0.7em;
    font-size: 0.78em;
    margin-left: 0.3em;
}
.btn-perigo {
    color: var(--erro);
    border-color: rgba(248, 113, 113, 0.4);
}
.btn-perigo:hover {
    border-color: var(--erro);
    background: rgba(248, 113, 113, 0.1);
}
tr.inativo { opacity: 0.5; }

/* ---------- modal ---------- */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 17, 21, 0.7);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: grid;
    place-items: center;
}
.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5em 1.8em;
    width: 460px;
    max-width: calc(100vw - 2em);
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.2em;
}
.modal-header h3 { margin: 0; font-size: 1.1em; }
.modal-card form label {
    display: block;
    margin-bottom: 0.9em;
    font-size: 0.85em;
    color: var(--text-dim);
}
.modal-card form label small {
    color: var(--text-dim);
    font-weight: normal;
    font-size: 0.95em;
}
.modal-card input[type=text],
.modal-card input[type=email],
.modal-card input[type=password],
.modal-card select {
    width: 100%;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    padding: 0.6em 0.8em;
    border-radius: 6px;
    color: var(--text);
    margin-top: 0.35em;
    font: inherit;
}
.modal-card input:focus, .modal-card select:focus {
    outline: none;
    border-color: var(--accent);
}
.input-with-toggle {
    position: relative;
    margin-top: 0.35em;
}
.input-with-toggle input {
    width: 100%;
    margin-top: 0 !important;
    padding-right: 2.6em !important;
}
.btn-ver-senha {
    position: absolute;
    right: 0.5em;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    opacity: 0.5;
    font-size: 1rem;
    padding: 0;
    color: var(--text);
    line-height: 1;
}
.btn-ver-senha:hover { opacity: 1; }
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.6em;
    margin-top: 1em;
}

@media (max-width: 700px) {
    .app { padding: 1em; }
    .drawer { width: 100%; }
    .acoes-col { text-align: left; }
}

/* ===== CHAT LAYOUT ===== */
html, body { height: 100%; }

.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 53px);
    overflow: hidden;
}

.chat-area {
    flex: 1;
    overflow-y: auto;
    padding: 1.4em 1em;
    display: flex;
    flex-direction: column;
    gap: 1em;
    scroll-behavior: smooth;
}

.chat-input-area {
    border-top: 1px solid var(--border);
    background: var(--bg-card);
    padding: 0.85em 1.2em 0.7em;
}

.chat-input-wrap {
    display: flex;
    gap: 0.6em;
    align-items: flex-end;
    max-width: 820px;
    margin: 0 auto;
}

.chat-input-wrap textarea {
    flex: 1;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.75em 1em;
    font: inherit;
    resize: none;
    max-height: 150px;
    overflow-y: auto;
    line-height: 1.4;
}

.chat-input-wrap textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.btn-attach {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.1em;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.btn-attach:hover { background: var(--bg-elev); color: var(--accent); border-color: var(--accent); }
.btn-attach.has-file { color: var(--accent); border-color: var(--accent); background: var(--bg-elev); }

.attach-preview {
    display: flex;
    align-items: center;
    gap: 0.5em;
    background: var(--bg-elev);
    border: 1px solid var(--accent);
    border-radius: 8px;
    padding: 0.35em 0.75em;
    font-size: 0.82em;
    color: var(--accent);
    max-width: 820px;
    margin: 0.4em auto 0;
}
.attach-preview .attach-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-preview .attach-remove { cursor: pointer; color: var(--text-muted); font-size: 1.1em; line-height: 1; padding: 0 0.2em; }
.attach-preview .attach-remove:hover { color: var(--erro); }
.attach-loading { color: var(--text-muted); font-style: italic; }

.btn-send {
    background: var(--accent);
    color: #1a1208;
    border: none;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.05em;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
}
.btn-send:hover { background: var(--accent-soft); }
.btn-send:disabled { opacity: 0.45; cursor: not-allowed; }

.chat-input-footer {
    max-width: 820px;
    margin: 0.3em auto 0;
    display: flex;
    gap: 1em;
    align-items: center;
    font-size: 0.82em;
}

.btn-link {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 0;
    font: inherit;
    font-size: 1em;
    text-decoration: underline;
}
.btn-link:hover { color: var(--accent); }

/* ===== MESSAGES ===== */
.msg {
    display: flex;
    gap: 0.7em;
    max-width: 820px;
    margin: 0 auto;
    width: 100%;
    align-items: flex-start;
}

.msg-user { justify-content: flex-end; }

.msg-icon {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.82em;
    color: var(--accent);
    flex-shrink: 0;
    margin-top: 2px;
}

.msg-content { flex: 1; min-width: 0; }

.msg-bubble {
    display: inline-block;
    padding: 0.72em 1em;
    border-radius: 16px;
    font-size: 0.95em;
    line-height: 1.5;
    word-break: break-word;
}

.msg-user .msg-bubble {
    background: var(--accent);
    color: #1a1208;
    border-bottom-right-radius: 4px;
    max-width: 78%;
}

.msg-bot .msg-bubble {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}

.msg-bubble-pergunta {
    background: var(--bg-card);
    border: 1px dashed var(--accent);
    border-bottom-left-radius: 4px;
    color: var(--text);
}

.msg-bubble.erro-bubble {
    background: rgba(248,113,113,0.1);
    border: 1px solid rgba(248,113,113,0.3);
    color: var(--erro);
}

.suposicoes-inline {
    background: rgba(251,191,36,0.08);
    border: 1px solid rgba(251,191,36,0.25);
    color: var(--warn);
    padding: 0.5em 0.9em;
    border-radius: 8px;
    font-size: 0.88em;
    margin-top: 0.5em;
}
.suposicoes-inline ul { margin: 0.2em 0 0 1.2em; padding: 0; }

.resultado-inline {
    margin-top: 0.7em;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    background: var(--bg-card);
}

.resultado-header {
    padding: 0.45em 1em;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
}

.resultado-inline .tabela-wrap {
    max-height: 50vh;
    overflow-x: auto;
    overflow-y: auto;
}

.msg-actions {
    margin-top: 0.5em;
    display: flex;
    gap: 0.4em;
}

/* interpretacao automatica */
.interpretacao {
    margin-top: 0.6em;
    padding: 0.6em 0.9em;
    background: rgba(96,165,250,0.08);
    border-left: 3px solid #60a5fa;
    border-radius: 0 6px 6px 0;
    font-size: 0.88em;
    color: #93c5fd;
    line-height: 1.4;
}

/* botao de feedback */
.btn-feedback {
    font-size: 0.75em;
    color: var(--text-dim);
    opacity: 0.5;
    margin-top: 0.3em;
    display: block;
}
.btn-feedback:hover { opacity: 1; color: var(--erro); }

/* alertas do dashboard */
.alertas-banner {
    display: flex;
    flex-direction: column;
    gap: 0.4em;
    margin-bottom: 1em;
}

.alerta-item {
    padding: 0.6em 1em;
    border-radius: 6px;
    font-size: 0.88em;
    display: flex;
    align-items: center;
    gap: 0.5em;
}

.alerta-alerta {
    background: rgba(248,113,113,0.1);
    border: 1px solid rgba(248,113,113,0.3);
    color: var(--erro);
}

.alerta-aviso {
    background: rgba(251,191,36,0.08);
    border: 1px solid rgba(251,191,36,0.25);
    color: var(--warn);
}

.alerta-info {
    background: rgba(96,165,250,0.08);
    border: 1px solid rgba(96,165,250,0.2);
    color: #93c5fd;
}

/* grafico inline no chat */
.chart-inline-wrap {
    margin-top: 0.8em;
    height: 220px;
    position: relative;
}

/* follow-up chips */
.followup-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4em;
    margin-top: 0.8em;
}

.followup-chip {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    color: var(--text-dim);
    border-radius: 20px;
    padding: 0.3em 0.85em;
    font-size: 0.82em;
    cursor: pointer;
    transition: all 0.15s;
    font: inherit;
}

.followup-chip:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(255,138,61,0.08);
}

.entidade-chip {
    border-color: rgba(96,165,250,0.4);
    color: #93c5fd;
}
.entidade-chip:hover {
    border-color: #60a5fa;
    color: #60a5fa;
    background: rgba(96,165,250,0.08);
}

.cache-badge {
    display: inline-block;
    font-size: 0.7em;
    background: rgba(74,222,128,0.15);
    color: var(--ok);
    border: 1px solid rgba(74,222,128,0.3);
    border-radius: 4px;
    padding: 0.05em 0.45em;
    margin-left: 0.5em;
    vertical-align: middle;
    font-family: var(--mono);
}

/* ===== TYPING INDICATOR ===== */
.typing-indicator {
    display: inline-flex;
    gap: 4px;
    padding: 0.72em 1em;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    border-bottom-left-radius: 4px;
}

.typing-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--text-dim);
    animation: typingPulse 1.2s infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingPulse {
    0%,60%,100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-5px); opacity: 1; }
}

/* ===== DASHBOARD ===== */
.dash-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5em;
}

.dash-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.2em;
}
.dash-header h2 { margin: 0; font-size: 1.2em; }

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 1em;
    margin-bottom: 1.4em;
}

.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.1em 1.3em;
}

.kpi-label {
    font-size: 0.76em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-dim);
    margin-bottom: 0.35em;
}

.kpi-value {
    font-size: 1.75em;
    font-weight: 700;
    color: var(--accent);
    line-height: 1.1;
    margin-bottom: 0.2em;
}

.kpi-loading { color: var(--text-dim); font-size: 1.2em; }
.kpi-erro-val { color: var(--erro); font-size: 1em; font-weight: 400; }
.kpi-sub { font-size: 0.82em; color: var(--text-dim); }
.kpi-erro { color: var(--erro); font-size: 0.85em; padding: 0.5em 0; }

.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1em;
}

.chart-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.2em 1.4em;
}

.chart-container h3 {
    margin: 0 0 1em;
    font-size: 0.78em;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.chart-wrap { position: relative; height: 280px; }

@media (max-width: 800px) {
    .charts-grid { grid-template-columns: 1fr; }
    .kpi-grid { grid-template-columns: 1fr 1fr; }
}
