/* ============================================================
   PROSPECT INSTA — Stylesheet principal
   Cores da marca: #211843 (roxo) / #75EFFF (ciano)
   ============================================================ */

:root {
    --roxo:         #211843;
    --roxo-2:       #2d215a;
    --roxo-3:       #1a1230;
    --roxo-0:       #0f0a1f;
    --ciano:        #75EFFF;
    --ciano-esc:    #45d7ec;

    --bg:           #f6f5fb;
    --surface:      #ffffff;
    --border:       #e6e4ef;
    --border-2:     #d8d4e5;
    --text:         #1e1a35;
    --text-mute:    #6b6784;
    --text-mute-2:  #9c98b0;

    --ok:           #16a37a;
    --warn:         #d97706;
    --err:          #dc2626;
    --info:         #3b82f6;

    --radius:       10px;
    --radius-sm:    6px;
    --shadow-sm:    0 1px 2px rgba(33, 24, 67, 0.06);
    --shadow-md:    0 4px 20px rgba(33, 24, 67, 0.08);

    --sans:         'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --display:      'Space Grotesk', 'Inter', system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: var(--sans);
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
}

a { color: var(--roxo); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { font-family: var(--display); font-weight: 600; margin: 0; }

code {
    background: #efedf7;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
    color: var(--roxo);
}

/* ============================================================
   PÁGINAS DE AUTENTICAÇÃO (login, forgot, setup)
   ============================================================ */

.pg-auth {
    min-height: 100vh;
    background: radial-gradient(circle at 20% 20%, #2d215a 0%, #211843 40%, #0f0a1f 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.auth-wrap { width: 100%; max-width: 420px; }

.auth-card {
    background: var(--surface);
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
}

.auth-brand-mark {
    width: 48px; height: 48px;
    background: var(--roxo);
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
}

.auth-brand-name {
    font-family: var(--display);
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--roxo);
}

.auth-brand-tag {
    font-size: 0.78rem;
    color: var(--text-mute);
}

.auth-title {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: var(--roxo);
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    color: rgba(255,255,255,0.6);
    font-size: 0.8rem;
}

.auth-links {
    text-align: center;
    margin-top: 14px;
    font-size: 0.88rem;
}

/* ============================================================
   FORMULÁRIOS
   ============================================================ */

.form { display: flex; flex-direction: column; gap: 14px; }

.field { display: flex; flex-direction: column; gap: 6px; }

.field-label {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-mute);
}

.field input,
.field select,
.field textarea,
.filtros input,
.filtros select {
    font-family: inherit;
    font-size: 0.95rem;
    padding: 10px 12px;
    border: 1px solid var(--border-2);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    border-color: var(--roxo);
    box-shadow: 0 0 0 3px rgba(117, 239, 255, 0.25);
}

/* ============================================================
   BOTÕES
   ============================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-weight: 500;
    font-size: 0.92rem;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: transform .05s, background .15s, box-shadow .15s, border-color .15s;
    line-height: 1;
    white-space: nowrap;
}

.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary {
    background: var(--roxo);
    color: #fff;
}
.btn-primary:hover { background: var(--roxo-2); }

.btn-secondary {
    background: var(--surface);
    border-color: var(--border-2);
    color: var(--text);
}
.btn-secondary:hover { border-color: var(--roxo); }

.btn-ghost {
    background: transparent;
    color: var(--text);
    border-color: transparent;
}
.btn-ghost:hover { background: rgba(33,24,67,.06); }

.btn-block { display: flex; width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 0.82rem; }

/* ============================================================
   ALERTAS
   ============================================================ */

.alert {
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    margin-bottom: 14px;
    border: 1px solid transparent;
}

.alert-erro { background: #fef2f2; border-color: #fecaca; color: #7f1d1d; }
.alert-ok   { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.alert-info { background: #eff6ff; border-color: #bfdbfe; color: #1e3a8a; }

/* ============================================================
   LAYOUT PRINCIPAL (app shell)
   ============================================================ */

.pg-app {
    min-height: 100vh;
    background: var(--bg);
}

.app-shell {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: var(--roxo);
    color: #fff;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--display);
    font-weight: 700;
    font-size: 1rem;
    padding: 4px 6px;
}

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: rgba(255,255,255,.72);
    font-size: 0.93rem;
    transition: background .15s, color .15s;
}

.nav-item:hover {
    color: #fff;
    background: rgba(255,255,255,.06);
    text-decoration: none;
}

.nav-item.is-active {
    color: var(--roxo);
    background: var(--ciano);
    font-weight: 500;
}

.nav-ico {
    font-size: 1.05rem;
    width: 18px;
    display: inline-block;
    text-align: center;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border-radius: var(--radius-sm);
    background: rgba(0,0,0,.2);
    font-size: 0.85rem;
}

.sidebar-user-info { flex: 1; overflow: hidden; }
.sidebar-user-nome { font-weight: 500; color: #fff; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.sidebar-user-email { color: rgba(255,255,255,.55); font-size: 0.75rem; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }

.sidebar-user-sair {
    color: rgba(255,255,255,.7);
    font-size: 1.1rem;
    padding: 6px;
    border-radius: 4px;
    text-decoration: none;
}
.sidebar-user-sair:hover { background: rgba(255,255,255,.1); color: #fff; text-decoration: none; }

/* Content */
.content { padding: 32px 40px; max-width: 1280px; }

.content-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.content-title {
    font-size: 1.8rem;
    color: var(--roxo);
    margin: 0 0 4px;
}

.content-sub {
    color: var(--text-mute);
    margin: 0;
    font-size: 0.95rem;
}

/* ============================================================
   STATS CARDS
   ============================================================ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.stat-card--accent {
    background: linear-gradient(135deg, var(--roxo) 0%, var(--roxo-2) 100%);
    color: #fff;
    border: 0;
}
.stat-card--accent .stat-label { color: rgba(255,255,255,.7); }
.stat-card--accent .stat-value { color: var(--ciano); }

.stat-label {
    font-size: 0.82rem;
    color: var(--text-mute);
    font-weight: 500;
    letter-spacing: .02em;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.stat-value {
    font-family: var(--display);
    font-size: 2rem;
    font-weight: 700;
    color: var(--roxo);
    line-height: 1;
}

/* ============================================================
   PANEL (card genérico)
   ============================================================ */

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 12px;
}

.panel-title {
    font-size: 1.1rem;
    color: var(--roxo);
}

.link-arrow {
    font-size: 0.88rem;
    font-weight: 500;
}

/* ============================================================
   EMPTY STATES
   ============================================================ */

.empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-mute);
}
.empty p { margin: 6px 0; }
.empty-sub { color: var(--text-mute-2); font-size: 0.9rem; }
.empty .btn { margin-top: 16px; }

/* ============================================================
   TABELAS
   ============================================================ */

.tbl {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

.tbl th {
    text-align: left;
    padding: 10px 12px;
    font-weight: 500;
    color: var(--text-mute);
    border-bottom: 1px solid var(--border);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.tbl td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.tbl tr:last-child td { border-bottom: 0; }

.tbl-muted { color: var(--text-mute); font-size: 0.88rem; }

.tbl-leads .avatar { width: 36px; height: 36px; border-radius: 50%; display: block; }
.avatar-empty { background: #eee; border: 1px dashed var(--border-2); }

/* ============================================================
   FILTROS
   ============================================================ */

.filtros {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 20px;
}

.filtros input,
.filtros select { padding: 8px 12px; font-size: 0.9rem; }

.filtros-busca { flex: 1; min-width: 220px; }

/* ============================================================
   PILLS / CHIPS
   ============================================================ */

.pill {
    display: inline-block;
    padding: 3px 10px;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 999px;
    background: #eef;
    color: var(--roxo);
    line-height: 1.4;
}

.pill-running   { background: #fff8db; color: #92400e; }
.pill-paused    { background: #e4e4ff; color: #4338ca; }
.pill-finished  { background: #d1fae5; color: #065f46; }
.pill-error     { background: #fee2e2; color: #991b1b; }
.pill-cancelled { background: #f3f4f6; color: #6b7280; }

.pill-novo      { background: #eef; color: var(--roxo); }
.pill-na_fila   { background: #e4e4ff; color: #4338ca; }
.pill-enviando  { background: #fff8db; color: #92400e; }
.pill-enviado   { background: #d1fae5; color: #065f46; }
.pill-respondeu { background: var(--ciano); color: var(--roxo); }
.pill-falhou    { background: #fee2e2; color: #991b1b; }
.pill-bloqueou  { background: #ffe4e6; color: #9f1239; }
.pill-ignorado  { background: #f3f4f6; color: #6b7280; }

.chip {
    display: inline-block;
    padding: 2px 8px;
    font-size: 0.72rem;
    font-weight: 500;
    border-radius: 4px;
    background: #f0eef7;
    color: var(--roxo);
    margin-right: 4px;
}

.chip-cyan  { background: var(--ciano); color: var(--roxo); }
.chip-muted { background: #f3f4f6; color: #6b7280; }

.cell-sinais { white-space: nowrap; }

/* ============================================================
   PROGRESS BAR
   ============================================================ */

.bar {
    height: 6px;
    background: #eee;
    border-radius: 999px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--roxo) 0%, var(--ciano-esc) 100%);
    transition: width .3s;
}

/* ============================================================
   PAGINAÇÃO
   ============================================================ */

.paginacao {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 18px;
}

/* ============================================================
   INSTRUÇÕES / DICAS (página da extensão)
   ============================================================ */

.passos { padding-left: 20px; line-height: 1.7; }
.passos li { margin-bottom: 14px; }
.passos ol { margin-top: 8px; }

.dicas { padding-left: 20px; line-height: 1.7; }
.dicas li { margin-bottom: 10px; }

/* ============================================================
   RESPONSIVIDADE
   ============================================================ */

@media (max-width: 900px) {
    .app-shell { grid-template-columns: 1fr; }

    .sidebar {
        position: static;
        height: auto;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 12px;
        align-items: center;
    }

    .sidebar-nav { flex-direction: row; flex-wrap: wrap; flex: 1; }
    .sidebar-user { width: auto; }

    .content { padding: 20px 16px; }

    .content-head { flex-direction: column; align-items: flex-start; }

    .stat-value { font-size: 1.6rem; }
}
