:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --bg-dark: #0f172a;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --danger: #dc2626;
    --warning: #d97706;
    --success: #16a34a;
    --glass: rgba(255, 255, 255, 0.95);
    --border-soft: #e2e8f0;
    --bg-soft: #f8fafc;
}

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

body {
    font-family: 'Inter', sans-serif;
    color: var(--text-main);
    background-color: var(--bg-dark);
    overflow-x: hidden;
}

/* ── Background ─────────────────────────────────────────
   Mesmo visual original (navy + gradiente azul no topo-direito,
   slate no canto-inferior-esquerdo), só que respirando devagar.
   Animação via transform nos pseudo-elementos = GPU-only, 60fps.
*/
.glass-bg {
    position: fixed;
    inset: 0;
    z-index: -1;
    background: #0f172a;
    overflow: hidden;
}

.glass-bg::before, .glass-bg::after {
    content: "";
    position: absolute;
    inset: -10%;            /* sobra fora da viewport pra esconder bordas durante o transform */
    pointer-events: none;
    will-change: transform;
}

.glass-bg::before {
    background: radial-gradient(circle at 100% 0%, #1e3a8a 0%, transparent 55%);
    animation: bgDrift1 22s ease-in-out infinite alternate;
}

.glass-bg::after {
    background: radial-gradient(circle at 0% 100%, #1e293b 0%, transparent 55%);
    animation: bgDrift2 28s ease-in-out infinite alternate;
}

@keyframes bgDrift1 {
    0%   { transform: translate(0, 0) scale(1); }
    100% { transform: translate(-3%, 3%) scale(1.12); }
}

@keyframes bgDrift2 {
    0%   { transform: translate(0, 0) scale(1); }
    100% { transform: translate(4%, -4%) scale(1.08); }
}

@media (prefers-reduced-motion: reduce) {
    .glass-bg::before, .glass-bg::after { animation: none; }
}

.app-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.glass-card {
    width: 100%;
    max-width: 1080px;
    background: var(--glass);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 28px;
    padding: 32px 36px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.header { text-align: center; margin-bottom: 24px; }
.logo-wrapper { display: flex; align-items: center; justify-content: center; gap: 12px; }
.logo-icon { color: var(--primary); width: 36px; height: 36px; }
.logo-text { font-size: 30px; font-weight: 700; letter-spacing: -1.4px; color: #0f172a; }
.logo-text span { color: var(--primary); }
.subtitle { color: var(--text-muted); font-size: 0.82rem; margin: 8px 6px 0; line-height: 1.5; max-width: 540px; margin-left: auto; margin-right: auto; }

/* ── File upload ────────────────────────────────────────── */
.file-upload { display: flex; align-items: center; gap: 8px; margin: 8px 0 14px; flex-wrap: wrap; }
.file-upload-btn {
    display: inline-flex; align-items: center; gap: 6px;
    background: white; border: 1px dashed var(--border-soft);
    padding: 6px 12px; border-radius: 999px;
    font-size: 12px; color: var(--text-muted); cursor: pointer;
    transition: all 0.15s;
}
.file-upload-btn:hover { border-color: var(--primary); color: var(--primary); }
.file-upload-btn i { width: 13px; height: 13px; }
.file-chip {
    display: inline-flex; align-items: center; gap: 6px;
    background: #eef2ff; color: #4338ca;
    padding: 4px 10px; border-radius: 999px;
    font-size: 11px; font-weight: 500;
}
.file-chip i { width: 12px; height: 12px; }
.file-chip button {
    background: transparent; border: none; cursor: pointer;
    color: #4338ca; padding: 0 0 0 4px; font-size: 14px; line-height: 1;
}

/* ── Admin link no chip do usuário ──────────────────────── */
.user-chip .admin-link {
    display: inline-flex; align-items: center; padding: 0 4px;
    color: var(--primary); text-decoration: none;
}
.user-chip .admin-link:hover { color: var(--primary-hover); }
.user-chip .admin-link i { width: 14px; height: 14px; }

/* ── Toast de alerta global ─────────────────────────────── */
.alert-toast {
    position: fixed; bottom: 20px; right: 20px;
    background: #7f1d1d; color: white;
    padding: 12px 18px; border-radius: 12px;
    font-size: 13px; font-weight: 500;
    display: inline-flex; align-items: center; gap: 8px;
    box-shadow: 0 10px 30px -5px rgba(0,0,0,0.5);
    z-index: 100;
    animation: toastIn 0.3s ease-out;
    max-width: 380px;
}
.alert-toast i { width: 16px; height: 16px; flex: 0 0 16px; }
@keyframes toastIn {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ═════════════════════════════════════════════════════════
   Admin panel
   ═════════════════════════════════════════════════════════ */
.admin-card { max-width: 1200px; }
.admin-header { flex-direction: row; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.admin-header .logo-wrapper { justify-content: flex-start; }

.btn-back {
    display: inline-flex; align-items: center; gap: 4px;
    text-decoration: none; color: var(--text-muted);
    font-size: 12px; padding: 6px 12px;
    border: 1px solid var(--border-soft); border-radius: 8px;
    transition: all 0.15s;
}
.btn-back:hover { color: var(--primary); border-color: var(--primary); }
.btn-back i { width: 13px; height: 13px; }

.admin-tabs {
    display: flex; gap: 4px; margin: 18px 0 16px;
    border-bottom: 1px solid var(--border-soft);
}
.admin-tab {
    background: none; border: none; cursor: pointer;
    padding: 10px 16px; font-size: 13px; font-weight: 500;
    color: var(--text-muted);
    border-bottom: 2px solid transparent; margin-bottom: -1px;
    display: inline-flex; align-items: center; gap: 6px;
    position: relative;
}
.admin-tab i { width: 14px; height: 14px; }
.admin-tab:hover { color: var(--text-main); }
.admin-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.alerts-badge {
    position: absolute; top: 4px; right: 6px;
    background: var(--danger); color: white;
    font-size: 9px; font-weight: 700;
    padding: 1px 5px; border-radius: 999px;
    min-width: 16px; text-align: center;
}

.admin-pane { display: none; }
.admin-pane.active { display: block; }

.admin-toolbar {
    display: flex; gap: 10px; align-items: center;
    margin-bottom: 14px; flex-wrap: wrap;
}
.admin-toolbar select,
.admin-search {
    padding: 6px 10px; border-radius: 8px;
    border: 1px solid var(--border-soft); background: white;
    font-family: inherit; font-size: 13px;
}
.admin-search { min-width: 240px; flex: 1; max-width: 360px; }
.admin-search:focus { outline: none; border-color: var(--primary); }
.btn-refresh, .btn-create {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 12px; border-radius: 8px;
    border: 1px solid var(--border-soft); background: white;
    font-size: 13px; cursor: pointer; transition: all 0.15s;
}
.btn-refresh:hover { background: var(--bg-soft); }
.btn-create { background: var(--primary); color: white; border-color: var(--primary); padding: 8px 14px; font-weight: 600; width: auto; }
.btn-create:hover { background: var(--primary-hover); }
.btn-refresh i, .btn-create i { width: 13px; height: 13px; }

.admin-section-title {
    font-size: 14px; font-weight: 600;
    color: var(--text-main); margin: 22px 0 10px;
}

/* ════════ Dashboard novo (hero + donut + área) ════════ */

/* Hero KPI: número grande + delta */
.dash-hero {
    display: flex; align-items: baseline; gap: 24px; flex-wrap: wrap;
    margin-bottom: 22px;
    padding: 22px 24px;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    border-radius: 18px;
    color: white;
    box-shadow: 0 8px 24px -8px rgba(37, 99, 235, 0.4);
}
.dash-hero-main { display: flex; align-items: baseline; gap: 14px; }
.dash-hero-num {
    font-size: 56px; font-weight: 800;
    line-height: 1; letter-spacing: -2px;
    font-variant-numeric: tabular-nums;
}
.dash-hero-label { font-size: 13px; opacity: 0.9; }
.dash-hero-delta {
    margin-left: auto;
    display: inline-flex; align-items: center; gap: 6px;
    background: rgba(255,255,255,0.18); backdrop-filter: blur(4px);
    padding: 8px 14px; border-radius: 999px;
    font-size: 13px; font-weight: 600;
}
.dash-hero-delta.up    { background: rgba(220, 252, 231, 0.25); }
.dash-hero-delta.down  { background: rgba(254, 226, 226, 0.25); }
.dash-hero-delta i { width: 14px; height: 14px; }
.dash-hero-delta-prev { font-weight: 400; opacity: 0.75; font-size: 11px; }

/* Linha de 2 cards: donut + área */
.dash-charts-row {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(320px, 2fr);
    gap: 14px;
    margin-bottom: 18px;
}
@media (max-width: 760px) {
    .dash-charts-row { grid-template-columns: 1fr; }
}
.dash-chart-card {
    background: white; border: 1px solid var(--border-soft);
    border-radius: 14px; padding: 16px 18px;
}
.dash-chart-title {
    font-size: 12px; font-weight: 700;
    color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px;
    margin-bottom: 14px;
}

/* ── Donut chart (CSS conic-gradient) ───────────── */
.dash-donut-wrap { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.dash-donut {
    width: 140px; height: 140px;
    border-radius: 50%;
    position: relative;
    flex: 0 0 140px;
}
.dash-donut-hole {
    position: absolute; inset: 18%;
    background: white;
    border-radius: 50%;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
}
.dash-donut-num {
    font-size: 28px; font-weight: 800;
    color: var(--text-main);
    font-variant-numeric: tabular-nums;
    line-height: 1;
}
.dash-donut-sub {
    font-size: 10px; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.5px;
    margin-top: 2px;
}
.dash-donut-legend {
    flex: 1; min-width: 130px;
    display: flex; flex-direction: column; gap: 6px;
}
.dash-donut-legend-row {
    display: flex; align-items: center; gap: 8px;
    font-size: 12px;
}
.dash-donut-dot {
    width: 10px; height: 10px; border-radius: 50%; flex: 0 0 10px;
}
.dash-donut-legend-label { color: var(--text-main); flex: 1; }
.dash-donut-legend-val {
    font-weight: 700; color: var(--text-main);
    font-variant-numeric: tabular-nums;
}
.dash-donut-legend-val em { font-style: normal; font-weight: 500; color: var(--text-muted); }

/* ── Área chart (SVG inline) ────────────────────── */
.dash-area-wrap { width: 100%; }
.dash-area-svg { width: 100%; height: auto; display: block; }
.dash-area-svg .axis-label {
    font-size: 10px;
    fill: var(--text-muted);
    font-family: inherit;
}
.dash-area-svg circle {
    transition: r 0.15s;
    cursor: pointer;
}
.dash-area-svg circle:hover { r: 5; }

/* ── KPI mini row ─────────────────────────────────── */
.dash-kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 10px;
    margin-bottom: 22px;
}
.dash-kpi-mini {
    background: white; border: 1px solid var(--border-soft);
    border-radius: 12px; padding: 12px 14px;
    display: flex; align-items: center; gap: 10px;
}
.dash-kpi-mini-dot {
    width: 10px; height: 10px; border-radius: 50%;
    flex: 0 0 10px;
}
.dash-kpi-mini-num {
    font-size: 22px; font-weight: 700;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}
.dash-kpi-mini-lbl {
    font-size: 10px; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.4px;
    margin-top: 3px;
}

/* Top topics bars */
.dash-topics-list { display: flex; flex-direction: column; gap: 8px; }
.topic-row { position: relative; padding: 4px 0; }
.topic-bar-bg {
    position: absolute; inset: 0;
    background: var(--bg-soft); border-radius: 8px;
}
.topic-bar-fill {
    position: absolute; top: 0; left: 0; height: 100%;
    background: linear-gradient(90deg, #fee2e2, #fecaca);
    border-radius: 8px;
    transition: width 0.4s ease-out;
}
.topic-row-text {
    position: relative; z-index: 1;
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 12px;
    font-size: 13px; color: var(--text-main);
}
.topic-name { font-weight: 500; }
.topic-count { font-weight: 700; color: var(--danger); }

/* Recent items */
.dash-recent-list { display: flex; flex-direction: column; gap: 8px; }
.recent-item {
    background: white; border: 1px solid var(--border-soft);
    border-radius: 10px; padding: 10px 12px;
    font-size: 12px;
}
.recent-item-meta { display: flex; gap: 10px; align-items: center; margin-bottom: 4px; font-size: 11px; }
.recent-verdict { color: white; padding: 2px 8px; border-radius: 999px; font-size: 10px; font-weight: 600; text-transform: uppercase; }
.recent-time { color: var(--text-muted); }
.recent-input { color: #334155; }
.recent-canonical { font-size: 11px; color: var(--primary); margin-top: 4px; font-style: italic; }

.muted-note { color: var(--text-muted); font-size: 13px; padding: 16px; text-align: center; background: var(--bg-soft); border-radius: 10px; }

/* Users table */
.users-table { overflow-x: auto; }
.users-table table { width: 100%; border-collapse: collapse; font-size: 13px; }
.users-table th, .users-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border-soft); }
.users-table th { background: var(--bg-soft); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--text-muted); }
.users-table tr.inactive { opacity: 0.5; }
.users-table .role-tag {
    display: inline-block; padding: 2px 8px; border-radius: 999px;
    font-size: 10px; font-weight: 700; text-transform: uppercase;
    background: #e2e8f0; color: var(--text-muted);
}
.users-table .role-tag.admin { background: var(--primary); color: white; }
.self-tag { background: #fef3c7; color: #a16207; padding: 1px 6px; border-radius: 4px; font-size: 9px; font-weight: 600; margin-left: 4px; }

.row-action {
    background: none; border: 1px solid var(--border-soft);
    padding: 5px 7px; border-radius: 6px;
    cursor: pointer; color: var(--text-muted); margin-right: 4px;
}
.row-action:hover { color: var(--primary); border-color: var(--primary); }
.row-action.danger:hover { color: var(--danger); border-color: var(--danger); }
.row-action i { width: 13px; height: 13px; display: block; }

/* Alerts list */
.alerts-list { display: flex; flex-direction: column; gap: 10px; }
.alert-item-card {
    display: flex; align-items: center; gap: 12px;
    background: #fef2f2; border: 1px solid #fecaca;
    border-radius: 12px; padding: 12px 14px;
}
.alert-item-card.ack { background: var(--bg-soft); border-color: var(--border-soft); opacity: 0.7; }
.alert-icon { color: var(--danger); }
.alert-icon i { width: 20px; height: 20px; }
.alert-item-card.ack .alert-icon { color: var(--success); }
.alert-body { flex: 1; }
.alert-topic { font-weight: 600; color: #7f1d1d; font-size: 14px; }
.alert-item-card.ack .alert-topic { color: var(--text-main); }
.alert-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.btn-ack {
    background: white; border: 1px solid var(--danger); color: var(--danger);
    padding: 5px 10px; border-radius: 6px; font-size: 11px; font-weight: 500;
    cursor: pointer; transition: all 0.15s;
}
.btn-ack:hover { background: var(--danger); color: white; }

.admin-help { font-size: 12px; color: var(--text-muted); margin-bottom: 12px; }

/* Audit table */
.audit-table { overflow-x: auto; }
.audit-table table { width: 100%; border-collapse: collapse; font-size: 12px; }
.audit-table th, .audit-table td {
    padding: 8px 10px; text-align: left;
    border-bottom: 1px solid var(--border-soft);
    vertical-align: top;
}
.audit-table th {
    background: var(--bg-soft);
    font-weight: 600; font-size: 10px;
    text-transform: uppercase; letter-spacing: 0.4px; color: var(--text-muted);
}
.audit-action {
    display: inline-block; color: white;
    padding: 2px 8px; border-radius: 999px;
    font-size: 10px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.3px;
    white-space: nowrap;
}
.audit-details {
    font-family: monospace; font-size: 11px; color: var(--text-muted);
    word-break: break-all; display: inline-block; max-width: 320px;
}

/* Modal */
.modal { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.5); }
.modal-card {
    position: relative; background: white;
    border-radius: 16px; padding: 24px;
    width: 100%; max-width: 420px;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
}
.modal-card h3 { margin-bottom: 16px; font-size: 18px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.modal-actions button { width: auto; padding: 8px 16px; }

/* ── Login ──────────────────────────────────────────────── */
.login-card { max-width: 420px; }
.login-form { display: flex; flex-direction: column; gap: 14px; margin-top: 8px; }
.login-field { display: flex; flex-direction: column; gap: 6px; }
.login-field > span {
    font-size: 11px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.5px;
    color: var(--text-muted);
}
.login-field input {
    padding: 12px 14px; border-radius: 12px;
    border: 1px solid var(--border-soft); background: white;
    font-family: inherit; font-size: 14px;
    transition: all 0.2s;
}
.login-field input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* User chip + logout no canto superior direito */
.user-chip {
    position: absolute; top: 18px; right: 22px;
    display: inline-flex; align-items: center; gap: 6px;
    background: white; border: 1px solid var(--border-soft);
    padding: 5px 6px 5px 14px; border-radius: 999px;
    font-size: 12px; color: var(--text-muted);
    z-index: 5;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.user-chip strong { color: var(--text-main); font-weight: 600; }
.user-chip .role-tag {
    background: var(--primary); color: white;
    font-size: 9px; font-weight: 700;
    padding: 3px 8px; border-radius: 999px;
    text-transform: uppercase; letter-spacing: 0.4px;
    margin-left: 2px;
}

/* Separador vertical sutil entre o nome e os botões */
.user-chip .chip-divider {
    width: 1px; height: 18px;
    background: var(--border-soft);
    margin: 0 4px;
}

/* Botões de ação: forma redonda, contraste claro, hover com background */
.user-chip .chip-btn {
    width: 28px; height: 28px;
    display: inline-flex; align-items: center; justify-content: center;
    background: transparent; border: none; cursor: pointer;
    color: var(--text-muted);
    border-radius: 50%;
    transition: background 0.15s, color 0.15s;
    padding: 0;
    text-decoration: none;
}
.user-chip .chip-btn:hover { background: #f1f5f9; color: var(--text-main); }
.user-chip .chip-btn.danger:hover { background: #fef2f2; color: var(--danger); }
.user-chip .chip-btn.primary:hover { background: #eef2ff; color: var(--primary); }
.user-chip .chip-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.user-chip .chip-btn i { width: 15px; height: 15px; }

@media (max-width: 600px) {
    .user-chip { position: static; margin-bottom: 12px; align-self: flex-end; }
}

/* ── Two-column split ──────────────────────────────────── */
.split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 28px;
    /* default align-items: stretch — colunas com mesma altura */
}

.input-section, .result-section {
    min-width: 0;
}

/* Sticky na coluna esquerda — só em desktop. align-self: start mantém input
   no topo enquanto a coluna direita pode crescer sem afetar o sticky. */
@media (min-width: 901px) {
    .input-section {
        position: sticky;
        top: 20px;
        align-self: start;
        max-height: calc(100vh - 40px);
        overflow-y: auto;
        scrollbar-width: thin;
        padding-right: 4px;
    }
    .input-section::-webkit-scrollbar { width: 6px; }
    .input-section::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

    /* Coluna direita estica até a altura da esquerda quando vazia (empty state)
       ou cresce naturalmente quando tem resultado. */
    .result-section {
        display: flex;
        flex-direction: column;
        min-height: 100%;
    }
}

.result-section {
    background: var(--bg-soft);
    border-radius: 20px;
    padding: 22px;
    min-height: 360px;
    border: 1px solid var(--border-soft);
    position: relative;
}

/* ── Input ─────────────────────────────────────────────── */
.textarea-wrapper { position: relative; margin-bottom: 14px; }

textarea {
    width: 100%;
    height: 160px;
    padding: 18px;
    border-radius: 18px;
    border: 1px solid var(--border-soft);
    background: white;
    font-family: inherit;
    font-size: 15px;
    transition: all 0.3s ease;
    resize: none;
}
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.textarea-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    flex-wrap: wrap;
}
.char-count { font-size: 11px; color: var(--text-muted); }
.url-pill {
    display: inline-flex; align-items: center; gap: 6px;
    background: #dbeafe; color: #1e40af;
    border-radius: 999px; padding: 4px 10px;
    font-size: 11px; font-weight: 500;
}
.url-pill i { width: 12px; height: 12px; }

/* Examples */
.examples { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 18px; }
.examples-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-right: 4px; }
.example-chip {
    background: white; border: 1px solid var(--border-soft);
    padding: 6px 12px; border-radius: 999px;
    font-size: 12px; color: var(--text-main); cursor: pointer;
    transition: all 0.15s;
}
.example-chip:hover { background: var(--primary); color: white; border-color: var(--primary); transform: translateY(-1px); }
.example-chip:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Button */
.btn-primary {
    width: 100%; padding: 16px; border-radius: 14px;
    border: none; background: var(--primary); color: white;
    font-weight: 600; font-size: 16px; cursor: pointer;
    transition: all 0.2s; position: relative;
}
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.3); }
.btn-primary:focus-visible { outline: 3px solid #93c5fd; outline-offset: 2px; }
.btn-primary:disabled { opacity: 0.85; cursor: not-allowed; transform: none; }
.btn-primary .btn-content-default,
.btn-primary .btn-content-loading {
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
}
.btn-primary .btn-content-loading { display: none; }
.btn-primary[data-loading="true"] .btn-content-default { display: none; }
.btn-primary[data-loading="true"] .btn-content-loading { display: inline-flex; }
.btn-spinner {
    width: 16px; height: 16px; border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.4); border-top-color: white;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Info cards (coluna esquerda, abaixo do botão) ─────── */
.info-cards {
    display: flex; flex-direction: column; gap: 12px;
    margin-top: 18px;
}
.info-card {
    background: white; border: 1px solid var(--border-soft);
    border-radius: 14px; padding: 14px 16px;
}
.info-card-title {
    display: flex; align-items: center; gap: 8px;
    font-size: 12px; font-weight: 700;
    color: var(--text-main);
    text-transform: uppercase; letter-spacing: 0.5px;
    margin-bottom: 10px;
}
.info-card-title i {
    width: 15px; height: 15px;
    color: var(--primary);
}
.info-card-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.info-card-list li {
    font-size: 12px; color: #475569; line-height: 1.45;
    padding-left: 14px; position: relative;
}
.info-card-list li::before {
    content: "•"; position: absolute; left: 0; color: var(--danger); font-weight: 700;
}
.info-card-links { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.info-card-links li a {
    font-size: 12px; color: var(--primary); text-decoration: none;
    display: inline-flex; align-items: center; gap: 4px;
}
.info-card-links li a::before {
    content: "→"; color: var(--text-muted); font-weight: 600;
}
.info-card-links li a:hover { text-decoration: underline; }

/* ── Botão secundário (notícias) ───────────────────────── */
.related-news-cta { margin-top: 18px; }
.btn-secondary {
    width: 100%; padding: 12px 16px;
    background: white; border: 1px solid var(--primary); color: var(--primary);
    border-radius: 12px; font-weight: 600; font-size: 13px;
    cursor: pointer; transition: all 0.15s;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-secondary:hover { background: var(--primary); color: white; transform: translateY(-1px); }
.btn-secondary:focus-visible { outline: 3px solid #93c5fd; outline-offset: 2px; }
.btn-secondary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.btn-secondary i { width: 14px; height: 14px; }
.btn-secondary[data-loading="true"]::after {
    content: ""; width: 12px; height: 12px; margin-left: 4px;
    border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Seção de notícias relacionadas */
.related-news-section {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px dashed var(--border-soft);
}

.btn-news-retry {
    display: inline-block; margin-top: 10px;
    background: white; border: 1px solid var(--primary); color: var(--primary);
    padding: 6px 12px; border-radius: 8px;
    font-size: 12px; font-weight: 500; cursor: pointer;
    transition: all 0.15s;
}
.btn-news-retry:hover { background: var(--primary); color: white; }

/* News cards */
.news-list { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.news-card {
    display: block; text-decoration: none;
    background: white; border: 1px solid var(--border-soft);
    border-radius: 12px; padding: 12px 14px;
    transition: all 0.15s;
    color: inherit;
}
.news-card:hover {
    border-color: var(--primary); transform: translateY(-1px);
    box-shadow: 0 4px 12px -2px rgba(37, 99, 235, 0.1);
}
.news-card-source {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 11px; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.4px; font-weight: 600;
    margin-bottom: 6px;
}
.news-card-source i { width: 11px; height: 11px; }
.news-verified { color: var(--success); margin-left: 4px; font-weight: 700; }
.news-card-title {
    font-size: 13px; font-weight: 600; color: var(--text-main);
    line-height: 1.4; margin-bottom: 4px;
}
.news-card-summary {
    font-size: 12px; color: var(--text-muted); line-height: 1.5;
}
.news-skeleton { padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.news-empty {
    background: var(--bg-soft); border: 1px dashed var(--border-soft);
    border-radius: 10px; padding: 12px 14px; margin-top: 14px;
    font-size: 12px; color: var(--text-muted); text-align: center;
}

/* ── Skeleton loader ────────────────────────────────────── */
.skeleton-wrap {
    display: flex; flex-direction: column; gap: 10px;
}
.skeleton-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.skeleton {
    background: linear-gradient(90deg, #e2e8f0 0%, #f1f5f9 50%, #e2e8f0 100%);
    background-size: 200% 100%;
    animation: shimmer 1.4s ease-in-out infinite;
    border-radius: 8px;
}
.skeleton-badge { height: 36px; width: 60%; border-radius: 12px; }
.skeleton-card  { height: 56px; border-radius: 12px; }
.skeleton-line  { height: 12px; }
.skeleton-line.short { width: 70%; }
.skeleton-block { height: 60px; border-radius: 12px; margin-top: 6px; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ── Empty state ────────────────────────────────────────── */
.empty-state {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center; padding: 32px 24px;
    flex: 1;   /* ocupa toda a altura disponível na coluna direita */
    color: var(--text-muted);
}

.empty-illustration {
    position: relative;
    width: 88px; height: 88px;
    display: inline-flex; align-items: center; justify-content: center;
    margin-bottom: 20px;
}
.empty-halo {
    position: absolute; inset: 0;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(37,99,235,0.18) 0%, rgba(37,99,235,0) 70%);
    animation: haloPulse 3s ease-in-out infinite;
}
@keyframes haloPulse {
    0%, 100% { transform: scale(1); opacity: 0.9; }
    50%      { transform: scale(1.15); opacity: 0.5; }
}
.empty-icon {
    position: relative; z-index: 1;
    width: 42px; height: 42px;
    color: var(--primary);
    stroke-width: 1.6;
}

.empty-title {
    font-size: 16px; font-weight: 700; color: #1e293b;
    margin-bottom: 6px;
}
.empty-sub {
    font-size: 13px; max-width: 280px; line-height: 1.55;
    color: var(--text-muted);
}

.empty-formats {
    list-style: none; padding: 0;
    margin-top: 24px;
    display: flex; flex-direction: column; gap: 10px;
    width: 100%; max-width: 320px;
}
.empty-formats li {
    display: flex; align-items: flex-start; gap: 10px;
    background: white;
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    padding: 10px 12px;
    text-align: left;
    transition: border-color 0.15s, transform 0.15s;
}
.empty-formats li:hover {
    border-color: var(--primary);
    transform: translateY(-1px);
}
.empty-formats li > i {
    width: 18px; height: 18px;
    color: var(--primary);
    flex: 0 0 18px;
    margin-top: 2px;
}
.empty-formats li > div { display: flex; flex-direction: column; gap: 2px; }
.empty-formats li strong {
    font-size: 12px; font-weight: 600; color: #334155;
}
.empty-formats li span {
    font-size: 11px; color: var(--text-muted); line-height: 1.4;
}

.result-section.has-result .empty-state,
.result-section.is-loading .empty-state { display: none; }
.result-section:not(.has-result):not(.is-loading) #resultado { display: none; }
.result-section:not(.is-loading) #loading { display: none; }

/* ── Result ─────────────────────────────────────────────── */
.result-container { animation: slideUp 0.4s ease-out; }
@keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* Aviso de cache (resposta vinda do localStorage) */
.cache-notice {
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px; margin-bottom: 12px;
    padding: 8px 12px; border-radius: 10px;
    background: #f1f5f9; border: 1px solid var(--border-soft);
    font-size: 11px; color: var(--text-muted);
}
.cache-notice > span { display: inline-flex; align-items: center; gap: 6px; }
.cache-notice i { width: 12px; height: 12px; }
.btn-cache-refresh {
    background: white; border: 1px solid var(--border-soft); color: var(--primary);
    padding: 4px 10px; border-radius: 8px;
    font-size: 11px; font-weight: 500; cursor: pointer;
    display: inline-flex; align-items: center; gap: 4px;
    transition: all 0.15s;
}
.btn-cache-refresh:hover { background: var(--primary); color: white; border-color: var(--primary); }
.btn-cache-refresh i { width: 12px; height: 12px; }

/* Top action bar */
.result-actions {
    display: flex; gap: 6px; margin-bottom: 12px; justify-content: flex-end;
}
.result-action-btn {
    background: white; border: 1px solid var(--border-soft);
    width: 32px; height: 32px; border-radius: 8px;
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer; color: var(--text-muted); transition: all 0.15s;
}
.result-action-btn:hover { color: var(--primary); border-color: var(--primary); transform: translateY(-1px); }
.result-action-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.result-action-btn i { width: 14px; height: 14px; }
.result-action-btn.copied { color: var(--success); border-color: var(--success); }

.status-badge {
    display: flex; align-items: center; gap: 8px;
    padding: 12px 16px; border-radius: 12px;
    font-weight: 600; font-size: 14px; margin-bottom: 14px;
}
/* Status badge — agora maior e mais expressivo */
.status-badge {
    font-size: 16px;
    padding: 14px 18px;
    font-weight: 700;
}
.status-badge i { width: 20px; height: 20px; flex: 0 0 20px; }

/* 5 tiers de risco + 2 especiais */
.tier-critical    { background: #7f1d1d; color: #fff;        border: 1px solid #991b1b; }
.tier-fake        { background: #fef2f2; color: var(--danger);   border: 1px solid #fecaca; }
.tier-suspicious  { background: #fff7ed; color: #c2410c;     border: 1px solid #fed7aa; }
.tier-caution     { background: #fefce8; color: #a16207;     border: 1px solid #fef08a; }
.tier-trustworthy { background: #f0fdf4; color: var(--success);  border: 1px solid #bbf7d0; }
.tier-off-topic   { background: #f1f5f9; color: var(--text-muted);border: 1px solid #e2e8f0; }
.tier-unavailable { background: #f5f3ff; color: #6d28d9;     border: 1px solid #ddd6fe; }

/* Source notice (link / youtube extraído) */
.source-notice {
    display: inline-flex; align-items: center; gap: 6px;
    background: #f1f5f9; color: var(--text-muted);
    padding: 6px 12px; border-radius: 8px;
    font-size: 12px; margin-bottom: 14px;
}
.source-notice i { width: 13px; height: 13px; }

/* Explicação principal — tipografia clara */
.result-explanation {
    font-size: 14px;
    color: #334155;
    line-height: 1.6;
    margin: 14px 0 6px;
}

/* Detalhes técnicos — grupo de menor destaque */
.result-details {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px dashed var(--border-soft);
}
.result-details .section-title { margin-top: 14px; }
.result-details .section-title:first-child { margin-top: 0; }

/* Critical alerts banner (above gauge) */
.critical-alerts {
    background: #fef2f2; border: 1px solid #fecaca;
    border-radius: 12px; padding: 12px 14px; margin-bottom: 14px;
}
.critical-alerts-title {
    font-size: 11px; font-weight: 700; color: var(--danger);
    text-transform: uppercase; letter-spacing: 0.6px;
    display: flex; align-items: center; gap: 6px; margin-bottom: 8px;
}
.critical-alerts-title i { width: 14px; height: 14px; }
.critical-alerts ul { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.critical-alerts li {
    display: flex; align-items: center; gap: 8px;
    font-size: 13px; color: #7f1d1d;
}
.critical-alerts li i { width: 14px; height: 14px; flex: 0 0 14px; color: var(--danger); }

/* Gauge */
.gauge { margin-bottom: 16px; }
.gauge-track {
    position: relative; height: 10px; border-radius: 999px;
    background: linear-gradient(90deg,
        #16a34a 0%, #16a34a 28%,
        #d97706 32%, #d97706 58%,
        #dc2626 62%, #dc2626 100%);
    overflow: visible;
}
.gauge-marker {
    position: absolute; top: -5px;
    width: 4px; height: 20px; background: #0f172a;
    border-radius: 2px;
    box-shadow: 0 0 0 3px rgba(255,255,255,0.9);
    will-change: left;
}
.gauge-scale {
    display: flex; justify-content: space-between;
    font-size: 11px; color: var(--text-muted); margin-top: 8px;
    text-transform: uppercase; letter-spacing: 0.4px; font-weight: 500;
}
.gauge-scale span:nth-child(2) { color: #c2410c; }
.gauge-scale span:nth-child(3) { color: var(--danger); font-weight: 600; }
.gauge-scale span:nth-child(1) { color: var(--success); font-weight: 600; }

/* Section titles */
.section-title {
    font-size: 11px; font-weight: 600; text-transform: uppercase;
    color: var(--text-muted); letter-spacing: 0.6px;
    margin: 16px 0 8px;
    display: flex; align-items: center; gap: 6px;
}

/* Keyword chips */
.chip-group { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
    background: #eef2ff; color: #4338ca;
    padding: 4px 10px; border-radius: 999px;
    font-size: 11px; font-weight: 500;
}

/* Lists */
.alert-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.alert-item {
    background: white; border-left: 3px solid var(--primary);
    border-radius: 8px; padding: 10px 12px;
    font-size: 13px; color: #334155;
    border-top: 1px solid var(--border-soft);
    border-right: 1px solid var(--border-soft);
    border-bottom: 1px solid var(--border-soft);
}
.alert-item.severity-high   { border-left-color: var(--danger); }
.alert-item.severity-medium { border-left-color: var(--warning); }
.alert-item.severity-low    { border-left-color: var(--success); }
.alert-source {
    display: block; font-size: 10px; color: var(--text-muted); margin-top: 4px;
}
.alert-source a { color: var(--primary); text-decoration: none; }
.alert-source a:hover { text-decoration: underline; }

/* Visa rules tabs */
.visa-tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 8px; border-bottom: 1px solid var(--border-soft); }
.visa-tab {
    background: none; border: none; padding: 8px 12px;
    font-size: 12px; font-weight: 500; color: var(--text-muted);
    cursor: pointer; border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}
.visa-tab:hover { color: var(--text-main); }
.visa-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.visa-tab .visa-tab-count {
    display: inline-block; margin-left: 4px;
    background: var(--bg-soft); padding: 1px 6px; border-radius: 999px;
    font-size: 10px; font-weight: 600;
}
.visa-tab-panel { display: none; }
.visa-tab-panel.active { display: block; }

/* Gemini card */
.gemini-card {
    background: linear-gradient(135deg, #eef2ff 0%, #fdf4ff 100%);
    border: 1px solid #e0e7ff;
    border-radius: 14px; padding: 16px; margin-top: 14px;
}
.gemini-header {
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px; margin-bottom: 10px;
}
.gemini-title {
    display: flex; align-items: center; gap: 6px;
    font-size: 12px; font-weight: 600; color: #4338ca;
    text-transform: uppercase; letter-spacing: 0.5px;
}
.gemini-confidence {
    font-size: 11px; color: var(--text-muted);
    background: white; padding: 3px 8px; border-radius: 999px;
}
.gemini-reason {
    font-size: 13px; line-height: 1.5;
    color: #334155; margin-bottom: 10px;
}

/* Contraponto verificado — bloco interno do card de IA */
.counter-text {
    background: white;
    border-radius: 10px;
    padding: 12px 14px;
    margin: 10px 0;
    border-left: 3px solid var(--success);
}
.counter-text.is-correction { border-left-color: var(--success); background: #f0fdf4; }
.counter-text.is-confirmation { border-left-color: var(--success); background: #f0fdf4; }
.counter-text-title {
    display: flex; align-items: center; gap: 6px;
    font-size: 11px; font-weight: 700;
    color: var(--success);
    text-transform: uppercase; letter-spacing: 0.5px;
    margin-bottom: 6px;
}
.counter-text-title i { width: 14px; height: 14px; flex: 0 0 14px; }
.counter-text-body {
    font-size: 13px; line-height: 1.55;
    color: #166534;
}
.citations { display: flex; flex-wrap: wrap; gap: 6px; }
.citation {
    font-size: 11px; color: var(--primary);
    text-decoration: none; background: white;
    padding: 4px 8px; border-radius: 6px;
    border: 1px solid #e0e7ff;
    max-width: 100%; overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap;
}
.citation:hover { background: var(--primary); color: white; }

/* AI notice */
.ai-notice {
    margin-top: 12px; padding: 10px 14px;
    border-radius: 12px; background: #f8fafc;
    border: 1px dashed #cbd5e1;
    font-size: 12px; color: var(--text-muted);
    display: flex; align-items: center; gap: 8px;
}
.ai-notice .ai-notice-icon { width: 14px; height: 14px; flex: 0 0 14px; }

/* ── History ────────────────────────────────────────────── */
.history-bar {
    margin-top: 22px; padding-top: 18px;
    border-top: 1px solid var(--border-soft);
}
.history-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 10px;
    font-size: 11px; font-weight: 600;
    color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.6px;
}
.history-header > span { display: inline-flex; align-items: center; gap: 6px; }
.history-icon { width: 13px; height: 13px; }
.history-clear {
    background: none; border: none; color: var(--text-muted);
    padding: 4px; border-radius: 6px; cursor: pointer;
    transition: all 0.15s;
}
.history-clear:hover { color: var(--danger); background: #fef2f2; }
.history-clear i { width: 14px; height: 14px; }

.history-list {
    display: flex; gap: 8px; overflow-x: auto;
    padding-bottom: 6px;
    scrollbar-width: thin;
}
.history-list::-webkit-scrollbar { height: 6px; }
.history-list::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

.history-pill {
    flex: 0 0 auto; max-width: 240px;
    background: white; border: 1px solid var(--border-soft);
    border-radius: 12px; padding: 8px 12px;
    cursor: pointer; transition: all 0.15s;
    display: inline-flex; align-items: center; gap: 8px;
    text-align: left;
    font-family: inherit;
}
.history-pill:hover { border-color: var(--primary); transform: translateY(-1px); }
.history-pill:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.history-pill .history-dot {
    width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px;
}
.history-pill .history-dot.dot-critical    { background: #7f1d1d; }
.history-pill .history-dot.dot-fake        { background: var(--danger); }
.history-pill .history-dot.dot-suspicious  { background: #c2410c; }
.history-pill .history-dot.dot-caution     { background: #a16207; }
.history-pill .history-dot.dot-trustworthy { background: var(--success); }
.history-pill .history-dot.dot-off_topic,
.history-pill .history-dot.dot-ai_unavailable { background: var(--text-muted); }
.history-pill .history-text {
    font-size: 12px; color: var(--text-main);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    max-width: 200px;
}

/* Tactics fallback (small chips for completeness; main display moved to critical-alerts) */
.tactics-list { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tactic-chip {
    background: #fef2f2; color: var(--danger);
    border: 1px solid #fee2e2;
    padding: 4px 10px; border-radius: 999px;
    font-size: 11px; font-weight: 500;
}

/* Errors */
.error-message {
    color: var(--danger); background: #fef2f2; border: 1px solid #fee2e2;
    border-radius: 12px; padding: 12px 16px; font-size: 13px;
}

.hidden { display: none !important; }
.visually-hidden {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); border: 0;
}

/* ── Mobile ────────────────────────────────────────────── */
@media (max-width: 900px) {
    .glass-card { padding: 24px; border-radius: 22px; }
    .split { grid-template-columns: 1fr; gap: 18px; }
    .result-section { min-height: auto; }
    .logo-text { font-size: 26px; }
    .metrics-grid { grid-template-columns: 1fr; }
    .examples { gap: 6px; }
    .example-chip { font-size: 11px; padding: 5px 10px; }
    .history-pill .history-text { max-width: 140px; }
}
