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

:root {
    --bg:     #f5f7fa;
    --bg2:    #ffffff;
    --bg3:    #eef1f6;
    --border: #dde2ea;
    --accent: #5b5bd6;
    --accent2:#4f46e5;
    --text:   #1a1d2e;
    --text2:  #64748b;
    --green:  #16a34a;
    --red:    #dc2626;
    --yellow: #d97706;
    --radius: 14px;
    --shadow: 0 1px 4px rgba(0,0,0,0.07), 0 4px 16px rgba(0,0,0,0.05);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    min-height: 100vh;
}

/* ── LOGIN ───────────────────────────────────────────────────────────── */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f0f4ff 0%, #faf5ff 50%, #f0f9ff 100%);
    padding: 24px;
}
.login-box {
    background: #fff;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    border: 1px solid var(--border);
}
.login-logo {
    text-align: center;
    margin-bottom: 32px;
}
.login-logo .logo-icon { font-size: 40px; display: block; margin-bottom: 8px; }
.login-logo h1 { font-size: 24px; font-weight: 800; color: var(--text); }
.login-logo p { font-size: 14px; color: var(--text2); margin-top: 4px; }
.login-form { display: flex; flex-direction: column; gap: 16px; }
.login-form label { font-size: 13px; font-weight: 600; color: var(--text2); margin-bottom: 4px; display: block; }
.login-form input {
    width: 100%;
    background: var(--bg3);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    padding: 13px 16px;
    font-size: 15px;
    color: var(--text);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.login-form input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(91,91,214,0.12);
}
.btn-login {
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    border: none;
    color: #fff;
    padding: 14px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 8px;
    letter-spacing: 0.3px;
}
.btn-login:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(91,91,214,0.4); }
.login-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: var(--red);
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 13px;
    text-align: center;
}

/* ── HEADER ──────────────────────────────────────────────────────────── */
header {
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding: 14px 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 8px rgba(0,0,0,0.06);
}
.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.logo { display: flex; align-items: center; gap: 12px; }
.logo-icon { font-size: 26px; }
.logo h1 { font-size: 20px; font-weight: 800; color: var(--text); }
.subtitle { font-size: 11px; color: var(--text2); font-weight: 500; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.btn-historico {
    background: var(--bg3);
    border: 1.5px solid var(--border);
    color: var(--text2);
    padding: 8px 16px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
}
.btn-historico:hover { border-color: var(--accent); color: var(--accent); background: rgba(91,91,214,0.06); }
.btn-sair {
    background: none;
    border: 1.5px solid var(--border);
    color: var(--text2);
    padding: 8px 14px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}
.btn-sair:hover { border-color: var(--red); color: var(--red); background: rgba(220,38,38,0.05); }

/* ── MAIN ────────────────────────────────────────────────────────────── */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

/* ── STEP BADGE ──────────────────────────────────────────────────────── */
.step-badge {
    display: inline-block;
    background: rgba(91,91,214,0.1);
    color: var(--accent);
    border: 1px solid rgba(91,91,214,0.25);
    border-radius: 20px;
    padding: 3px 12px;
    font-size: 11px;
    font-weight: 700;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ── SEARCH TABS ─────────────────────────────────────────────────────── */
.search-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0;
}
.search-tab {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text2);
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: -2px;
}
.search-tab:hover { color: var(--accent); }
.search-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.link-hint { font-size: 12px; color: var(--text2); margin-top: 10px; }

/* ── CARDS ───────────────────────────────────────────────────────────── */
.search-card {
    background: var(--bg2);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow);
}
.search-card h2 { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.search-desc { color: var(--text2); font-size: 14px; margin-bottom: 24px; line-height: 1.5; }

.search-form { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; }
.input-group { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 200px; }
.input-group label { font-size: 13px; color: var(--text2); font-weight: 600; }
.input-group input {
    background: var(--bg3);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    padding: 12px 16px;
    color: var(--text);
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.input-group input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(91,91,214,0.1);
}
.btn-buscar {
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    border: none;
    color: white;
    padding: 12px 28px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.btn-buscar:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(91,91,214,0.35); }
.btn-buscar:disabled { background: var(--bg3); color: var(--text2); cursor: not-allowed; transform: none; box-shadow: none; }

/* ── RESULTADOS ──────────────────────────────────────────────────────── */
.resultados-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 16px;
    flex-wrap: wrap;
}
.resultados-header h2 { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.btn-nova-busca {
    background: var(--bg2);
    border: 1.5px solid var(--border);
    color: var(--text2);
    padding: 8px 16px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
    white-space: nowrap;
}
.btn-nova-busca:hover { border-color: var(--accent); color: var(--accent); }

.resultados-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.empresa-card {
    background: var(--bg2);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: all 0.2s;
    box-shadow: var(--shadow);
}
.empresa-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.empresa-nome { font-size: 16px; font-weight: 700; color: var(--text); }
.empresa-endereco { font-size: 13px; color: var(--text2); display: flex; align-items: flex-start; gap: 6px; }
.empresa-meta { display: flex; gap: 12px; flex-wrap: wrap; }
.empresa-rating { font-size: 13px; color: var(--yellow); font-weight: 700; }
.empresa-tel { font-size: 13px; color: var(--text2); }
.btn-analisar {
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    border: none;
    color: white;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: auto;
}
.btn-analisar:hover { box-shadow: 0 4px 14px rgba(91,91,214,0.35); }

.loading-busca { text-align: center; padding: 60px 20px; color: var(--text2); font-size: 16px; }
.loading-busca .spinner-big {
    width: 40px; height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

/* ── AGENTES ─────────────────────────────────────────────────────────── */
.analise-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; gap: 16px; flex-wrap: wrap; }
.analise-header h2 { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.section-title { font-size: 12px; font-weight: 700; color: var(--text2); margin-bottom: 16px; text-transform: uppercase; letter-spacing: 1px; }
.agentes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }

.agente-card {
    background: var(--bg2);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: border-color 0.3s, box-shadow 0.3s;
    box-shadow: var(--shadow);
}
.agente-card.running { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(91,91,214,0.12), var(--shadow); animation: pulse 2s infinite; }
.agente-card.done   { border-color: #86efac; background: #f0fdf4; }
.agente-card.error  { border-color: #fca5a5; background: #fef2f2; }
.bruna-card { grid-column: 1 / -1; }

@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(91,91,214,0.2); } 50% { box-shadow: 0 0 0 8px rgba(91,91,214,0); } }

.agente-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.agente-avatar {
    width: 42px; height: 42px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 17px;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.agente-nome { font-weight: 700; font-size: 15px; color: var(--text); }
.agente-cargo { font-size: 12px; color: var(--text2); }
.agente-status { margin-left: auto; font-size: 20px; }
.agente-msg { font-size: 13px; color: var(--text2); margin-bottom: 10px; font-style: italic; line-height: 1.4; }
.agente-resultado { display: flex; flex-direction: column; gap: 4px; }
.tag-positivo { background: #dcfce7; color: #15803d; border-radius: 6px; padding: 5px 10px; font-size: 12px; line-height: 1.3; }
.tag-problema { background: #fee2e2; color: #b91c1c; border-radius: 6px; padding: 5px 10px; font-size: 12px; line-height: 1.3; }

/* ── RELATÓRIO ───────────────────────────────────────────────────────── */
.relatorio-card {
    background: var(--bg2);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 36px;
    box-shadow: var(--shadow);
}
.relatorio-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 24px; gap: 16px; }
.relatorio-header h2 { font-size: 22px; font-weight: 800; margin-bottom: 8px; }
.badge-nivel { display: inline-block; padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 700; }
.badge-critico { background: #fee2e2; color: var(--red); }
.badge-ruim    { background: #ffedd5; color: #c2410c; }
.badge-regular { background: #fef9c3; color: #854d0e; }
.badge-bom     { background: #dcfce7; color: var(--green); }

.score-circle {
    width: 90px; height: 90px;
    border-radius: 50%;
    border: 4px solid var(--accent);
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    flex-shrink: 0;
    background: rgba(91,91,214,0.06);
}
.score-circle span { font-size: 26px; font-weight: 800; line-height: 1; color: var(--accent); }
.score-circle small { font-size: 11px; color: var(--text2); }

.relatorio-resumo {
    background: linear-gradient(135deg, rgba(91,91,214,0.06), rgba(79,70,229,0.03));
    border-left: 3px solid var(--accent);
    padding: 16px;
    border-radius: 0 10px 10px 0;
    font-size: 14px;
    line-height: 1.7;
    margin-bottom: 24px;
    color: var(--text);
}
.relatorio-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 24px; }
@media (max-width: 700px) { .relatorio-grid { grid-template-columns: 1fr; } }
.relatorio-bloco h3 { font-size: 14px; font-weight: 700; margin-bottom: 12px; }
.relatorio-bloco ul { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.relatorio-bloco li {
    background: var(--bg3);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.4;
    border: 1px solid var(--border);
}

.tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.tab-btn {
    background: var(--bg3);
    border: 1.5px solid var(--border);
    color: var(--text2);
    padding: 10px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
}
.tab-btn.active { background: var(--accent); border-color: var(--accent); color: white; }
.script-box {
    background: var(--bg3);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    font-size: 14px;
    line-height: 1.8;
    white-space: pre-wrap;
    color: var(--text);
    margin-bottom: 12px;
    max-height: 400px;
    overflow-y: auto;
}
.btn-copiar {
    background: var(--bg3);
    border: 1.5px solid var(--border);
    color: var(--text2);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
}
.btn-copiar:hover { border-color: var(--accent); color: var(--accent); }

/* ── HISTÓRICO ───────────────────────────────────────────────────────── */
.historico-card {
    background: var(--bg2);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
}
.historico-card h2 { margin-bottom: 16px; font-size: 18px; font-weight: 700; }
.historico-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px;
    border-radius: 10px;
    border: 1.5px solid var(--border);
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--bg2);
}
.historico-item:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.historico-score {
    width: 50px; height: 50px;
    border-radius: 50%;
    border: 3px solid var(--accent);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 16px;
    flex-shrink: 0;
    color: var(--accent);
    background: rgba(91,91,214,0.06);
}
.historico-info { flex: 1; }
.historico-empresa { font-weight: 700; font-size: 15px; }
.historico-meta { font-size: 12px; color: var(--text2); margin-top: 2px; }
.historico-status { font-size: 12px; padding: 3px 10px; border-radius: 12px; background: #dcfce7; color: var(--green); font-weight: 600; }

/* ── TOAST ───────────────────────────────────────────────────────────── */
.toast {
    position: fixed;
    bottom: 24px; right: 24px;
    background: var(--text);
    color: var(--bg2);
    border-radius: 10px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    z-index: 999;
    box-shadow: var(--shadow-lg);
}
.toast.show { opacity: 1; }

/* ── SPINNER ─────────────────────────────────────────────────────────── */
.spinner {
    display: inline-block;
    width: 16px; height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── ACESSO RÁPIDO ───────────────────────────────────────────────────── */
.acesso-rapido {
    display: flex;
    align-items: center;
    gap: 16px;
    background: linear-gradient(135deg, rgba(91,91,214,0.06), rgba(91,91,214,0.02));
    border: 1.5px solid rgba(91,91,214,0.2);
    border-radius: 14px;
    padding: 14px 20px;
    margin-bottom: 24px;
    flex-wrap: wrap;
    animation: fadeInDown 0.4s ease;
}
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}
.acesso-titulo {
    font-size: 11px;
    font-weight: 700;
    color: var(--text2);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
}
.acesso-btns { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-acesso {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.22s cubic-bezier(.4,0,.2,1);
}
.btn-acesso:hover { transform: translateY(-2px); }

.btn-acesso.site      { background: linear-gradient(135deg,#1976d2,#1565c0); color: #fff; }
.btn-acesso.site:hover { box-shadow: 0 6px 20px rgba(25,118,210,0.4); }
.btn-acesso.instagram { background: linear-gradient(135deg,#c13584,#833ab4); color: #fff; }
.btn-acesso.instagram:hover { box-shadow: 0 6px 20px rgba(193,53,132,0.4); }
.btn-acesso.maps      { background: linear-gradient(135deg,#1a9948,#0f7a3a); color: #fff; }
.btn-acesso.maps:hover { box-shadow: 0 6px 20px rgba(26,153,72,0.4); }
.btn-acesso.whatsapp  { background: linear-gradient(135deg,#25d366,#128c7e); color: #fff; }
.btn-acesso.whatsapp:hover { box-shadow: 0 6px 20px rgba(37,211,102,0.4); }
.btn-acesso .btn-icon { font-size: 15px; }
