/* ===== Painel Rastreio WhatsApp - Raio7 Digital =====
   Paleta e tipografia iguais as do Raio7 Hub e dos outros paineis. */

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

:root {
    --bg-primary: #0f1117;
    --bg-secondary: #1a1d27;
    --bg-card: #1e2130;
    --bg-hover: #252838;
    --border: #2a2d3e;
    --text-primary: #f1f3f9;
    --text-secondary: #8b8fa3;
    --text-muted: #5c6078;
    --accent-blue: #4f8cff;
    --accent-green: #34d399;
    --accent-purple: #a78bfa;
    --accent-orange: #fb923c;
    --accent-red: #f87171;
    --accent-gold: #FFD966;
    --accent: #25d366;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 20px;
    --shadow: 0 4px 24px rgba(0,0,0,0.3);
    --shadow-lg: 0 8px 40px rgba(0,0,0,0.4);
    --transition: 0.2s ease;
}

body.theme-light {
    --bg-primary: #f4f6fb;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-hover: #eef1f8;
    --border: #dfe3ee;
    --text-primary: #12141c;
    --text-secondary: #5c6078;
    --text-muted: #8b8fa3;
    --accent: #128c4a;
    --shadow: 0 4px 24px rgba(20,25,50,0.07);
    --shadow-lg: 0 8px 40px rgba(20,25,50,0.12);
}

html { font-size: 14px; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
}
.hidden { display: none !important; }

/* ===== LOGIN ===== */
.login-screen {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; padding: 20px;
    background: radial-gradient(circle at 20% 20%, rgba(37,211,102,0.12), transparent 45%), var(--bg-primary);
}
.login-card {
    width: 100%; max-width: 400px; background: var(--bg-card);
    border: 1px solid var(--border); border-radius: var(--radius-lg);
    padding: 40px 32px; box-shadow: var(--shadow-lg);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo-img { width: 56px; height: 56px; border-radius: 14px; margin-bottom: 14px; }
.login-logo h1 { font-size: 1.5rem; font-weight: 700; }
.login-logo h1 span { color: var(--accent); }
.login-subtitle { color: var(--text-secondary); font-size: 0.9rem; margin-top: 6px; }
.login-error { color: var(--accent-red); font-size: 0.85rem; min-height: 18px; margin-bottom: 6px; }
.login-footer { text-align: center; margin-top: 24px; color: var(--text-muted); font-size: 0.8rem; }

/* ===== FORMULARIOS ===== */
.form-group { margin-bottom: 12px; }
.form-group label {
    display: block; font-size: 0.74rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.04em; color: var(--text-secondary); margin-bottom: 5px;
}
input, select {
    width: 100%; padding: 9px 11px; font-family: inherit; font-size: 0.92rem;
    background: var(--bg-secondary); color: var(--text-primary);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    transition: border-color var(--transition);
}
input:focus, select:focus { outline: none; border-color: var(--accent); }
button { font-family: inherit; cursor: pointer; border: none; }

.btn-login {
    width: 100%; margin-top: 8px; background: var(--accent); color: #fff; font-weight: 600; font-size: 0.92rem;
    padding: 10px 18px; border-radius: var(--radius-sm); transition: opacity var(--transition);
}
.btn-login:hover { opacity: 0.88; }
.btn-ghost {
    background: transparent; color: var(--text-secondary); font-weight: 500; font-size: 0.88rem;
    padding: 9px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    transition: var(--transition);
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

/* ===== TOPBAR ===== */
.app { max-width: 1500px; margin: 0 auto; padding: 22px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.topbar-left { display: flex; align-items: center; gap: 14px; }
.topbar-logo { width: 42px; height: 42px; border-radius: 11px; display: block; }
.topbar h1 { font-size: 1.28rem; font-weight: 700; }
.topbar-sub { color: var(--text-muted); font-size: 0.83rem; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.user-chip { background: var(--bg-card); border: 1px solid var(--border); border-radius: 999px; padding: 6px 14px; font-size: 0.83rem; color: var(--text-secondary); }
.theme-switch { display: flex; gap: 4px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 999px; padding: 3px; }
.theme-btn { background: transparent; color: var(--text-muted); width: 28px; height: 26px; border-radius: 999px; font-size: 0.8rem; }
.theme-btn.active { background: var(--bg-hover); color: var(--accent); }

.aviso {
    background: rgba(251,146,60,0.1); border: 1px solid var(--accent-orange); color: var(--text-primary);
    border-radius: var(--radius); padding: 14px 16px; margin-bottom: 18px; font-size: 0.9rem; line-height: 1.5;
}

/* ===== FILTROS ===== */
.filtros { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; align-items: center; }
.filtros select { width: auto; min-width: 200px; padding: 7px 10px; font-size: 0.85rem; }
.filtros input[type=date] { width: auto; padding: 6px 9px; font-size: 0.85rem; }
.periodos { display: flex; gap: 4px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 999px; padding: 3px; flex-wrap: wrap; }
.per-btn { background: transparent; color: var(--text-muted); padding: 6px 13px; border-radius: 999px; font-size: 0.83rem; font-weight: 500; }
.per-btn.active { background: var(--bg-hover); color: var(--text-primary); }
.filtros .atualizado { color: var(--text-muted); font-size: 0.78rem; margin-left: auto; }

/* ===== KPIS ===== */
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.kpi-num { font-size: 1.7rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi-rot { font-size: 0.78rem; color: var(--text-secondary); margin-top: 2px; display: flex; align-items: center; gap: 6px; }
.kpi-sub { font-size: 0.74rem; color: var(--text-muted); margin-top: 6px; line-height: 1.35; }
.kpi.destaque { border-color: var(--accent); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--cor); flex: none; }

/* ===== BLOCOS ===== */
.blocos { display: grid; grid-template-columns: 1.3fr 1fr; gap: 14px; margin-bottom: 18px; }
.bloco { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.bloco-topo { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.bloco-topo h2 { font-size: 0.92rem; font-weight: 700; }
.bloco-topo p { font-size: 0.78rem; color: var(--text-muted); }
.bloco-corpo { overflow-x: auto; }
.vazio { color: var(--text-muted); font-size: 0.85rem; text-align: center; padding: 28px 16px; line-height: 1.5; }

table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
th { text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--bg-hover); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td .sub { color: var(--text-muted); font-size: 0.78rem; display: block; margin-top: 2px; }
tr.clicavel { cursor: pointer; }
tr.sel td { background: var(--bg-hover); }

.taxa { font-weight: 700; }
.taxa.boa { color: var(--accent-green); }
.taxa.media { color: var(--accent-orange); }
.taxa.ruim { color: var(--accent-red); }

.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 0.76rem; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.pill.anuncio { background: rgba(79,140,255,.14); color: var(--accent-blue); }
.pill.organico { background: rgba(139,143,163,.16); color: var(--text-secondary); }

.tel { color: var(--text-primary); text-decoration: none; font-weight: 600; white-space: nowrap; }
.tel:hover { color: var(--accent); }
.msg { color: var(--text-secondary); max-width: 340px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

.barra-lista { display: flex; gap: 10px; align-items: center; }
.barra-lista input { width: 260px; padding: 7px 10px; font-size: 0.84rem; }
.barra-lista .btn-ghost { padding: 7px 12px; font-size: 0.82rem; white-space: nowrap; }

.rodape { color: var(--text-muted); font-size: 0.78rem; line-height: 1.5; margin: 6px 2px 20px; }

@media (max-width: 1100px) {
    .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .blocos { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .app { padding: 16px; }
    .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .filtros select { min-width: 0; width: 100%; }
    .filtros .atualizado { margin-left: 0; }
    .bloco-topo { flex-wrap: wrap; }
    .barra-lista { width: 100%; flex-wrap: wrap; }
    .barra-lista input { width: 100%; }
}
