/* ── Reset básico ─────────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 15px;
    color: #1a1a2e;
    background: #f0f2f5;
    min-height: 100vh;
}

/* ── Utilitários ──────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ══════════════════════════════════════════════════════════════ */
/*  LOGIN PAGE                                                    */
/* ══════════════════════════════════════════════════════════════ */
.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 60%, #0f3460 100%);
}

.login-card {
    background: #fff;
    border-radius: 12px;
    padding: 40px 36px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.login-logo {
    text-align: center;
    margin-bottom: 28px;
}

.login-logo h1 {
    font-size: 26px;
    font-weight: 700;
    color: #0f3460;
    letter-spacing: -0.5px;
}

.login-logo span {
    color: #e94560;
}

.login-logo p {
    font-size: 13px;
    color: #888;
    margin-top: 4px;
}

/* Formulário */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #444;
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #dde1e7;
    border-radius: 8px;
    font-size: 14px;
    color: #1a1a2e;
    background: #fafafa;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus {
    border-color: #0f3460;
    background: #fff;
}

/* Botões */
.btn {
    display: inline-block;
    padding: 11px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
}

.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-primary {
    width: 100%;
    background: #0f3460;
    color: #fff;
    margin-top: 6px;
}

.btn-primary:hover:not(:disabled) { background: #0d2b52; }

.btn-secondary {
    background: #f0f2f5;
    color: #444;
}

.btn-secondary:hover { background: #e2e5ea; }

.btn-danger {
    background: #e94560;
    color: #fff;
}

.btn-danger:hover { background: #c73652; }

/* Alerta de erro */
.alert {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
}

.alert-error {
    background: #fef0f0;
    color: #c0392b;
    border: 1px solid #f5c6c6;
}

.alert-success {
    background: #f0fef4;
    color: #1e8449;
    border: 1px solid #b8f0c8;
}

/* ══════════════════════════════════════════════════════════════ */
/*  DASHBOARD                                                     */
/* ══════════════════════════════════════════════════════════════ */

/* Topbar */
.topbar {
    background: #fff;
    border-bottom: 1px solid #e5e8ef;
    padding: 0 28px;
    height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.topbar-brand {
    font-size: 18px;
    font-weight: 700;
    color: #0f3460;
}

.topbar-brand span { color: #e94560; }

.topbar-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.user-info {
    font-size: 13px;
    color: #555;
}

.user-info strong {
    color: #1a1a2e;
}

/* Main layout */
.dashboard-body {
    padding-top: 58px;
}

.main-content {
    max-width: 960px;
    margin: 0 auto;
    padding: 32px 24px;
}

/* Welcome card */
.welcome-card {
    background: linear-gradient(120deg, #0f3460, #16213e);
    color: #fff;
    border-radius: 12px;
    padding: 28px 32px;
    margin-bottom: 28px;
}

.welcome-card h2 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 6px;
}

.welcome-card p {
    font-size: 14px;
    opacity: 0.8;
}

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

.stat-card {
    background: #fff;
    border-radius: 10px;
    padding: 20px 22px;
    border: 1px solid #e8ecf2;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.stat-card .stat-label {
    font-size: 12px;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.stat-card .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #0f3460;
}

/* Seção genérica */
.section-card {
    background: #fff;
    border-radius: 10px;
    padding: 22px 24px;
    border: 1px solid #e8ecf2;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
    margin-bottom: 20px;
}

.section-card h3 {
    font-size: 15px;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f2f5;
}

/* Loading spinner */
.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid #ddd;
    border-top-color: #0f3460;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ══════════════════════════════════════════════════════════════ */
/*  NAVEGAÇÃO                                                     */
/* ══════════════════════════════════════════════════════════════ */

.topbar-nav {
    display: flex;
    gap: 4px;
}

.nav-link {
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #555;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.nav-link:hover  { background: #f0f2f5; color: #0f3460; }
.nav-link.active { background: #e8eef7; color: #0f3460; }

/* ══════════════════════════════════════════════════════════════ */
/*  SECTION HEADER (título + botão lado a lado)                  */
/* ══════════════════════════════════════════════════════════════ */

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f2f5;
}

.section-header h3 {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

/* ══════════════════════════════════════════════════════════════ */
/*  TABELA DE DADOS                                              */
/* ══════════════════════════════════════════════════════════════ */

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table th {
    text-align: left;
    padding: 8px 12px;
    font-size: 11px;
    font-weight: 700;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    background: #f8f9fb;
    border-bottom: 1px solid #eaecf0;
}

.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #f0f2f5;
    color: #333;
    vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td      { background: #fafbfd; }

/* ══════════════════════════════════════════════════════════════ */
/*  BADGES DE STATUS                                             */
/* ══════════════════════════════════════════════════════════════ */

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: capitalize;
    letter-spacing: 0.2px;
}

.badge-novo         { background: #e8f0fe; color: #1a56db; }
.badge-contato      { background: #fef3c7; color: #92400e; }
.badge-qualificado  { background: #d1fae5; color: #065f46; }
.badge-perdido      { background: #fee2e2; color: #991b1b; }
.badge-ganho        { background: #dcfce7; color: #166534; }

/* ══════════════════════════════════════════════════════════════ */
/*  FORMULÁRIO EM LINHA (leads)                                  */
/* ══════════════════════════════════════════════════════════════ */

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

.btn-save { width: auto; padding: 10px 28px; }

/* ══════════════════════════════════════════════════════════════ */
/*  TEXTOS DE ESTADO                                             */
/* ══════════════════════════════════════════════════════════════ */

.loading-text { color: #888; font-size: 13px; }
.empty-text   { color: #888; font-size: 13px; }
.error-text   { color: #c0392b; font-size: 13px; }

/* Badge de contagem */
.count-badge {
    display: inline-block;
    background: #e8eef7;
    color: #0f3460;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 10px;
    margin-left: 8px;
    vertical-align: middle;
}

/* ══════════════════════════════════════════════════════════════ */
/*  RESPONSIVO                                                   */
/* ══════════════════════════════════════════════════════════════ */

@media (max-width: 480px) {
    .login-card  { margin: 16px; padding: 30px 24px; }
    .main-content{ padding: 20px 16px; }
    .topbar      { padding: 0 16px; }
    .welcome-card{ padding: 22px 20px; }
    .topbar-nav  { display: none; }
    .data-table th, .data-table td { padding: 8px 8px; }
}
