/* ==========================================================================
   SegLead — identidade visual
   ========================================================================== */
:root {
    --sl-900: #0a1f34;
    --sl-800: #0f2c48;
    --sl-700: #17436c;
    --sl-600: #1f5a8f;
    --sl-accent: #12a97a;
    --sl-accent-dark: #0d8560;
    --sl-hot: #e04b4f;
    --sl-warm: #e8971a;
    --sl-bg: #f4f6fa;
    --sl-surface: #ffffff;
    --sl-line: #e3e9f0;
    --sl-text: #1b2836;
    --sl-muted: #6b7a8c;
    --sl-radius: 14px;
    --sl-shadow: 0 1px 2px rgba(10, 31, 52, .06), 0 8px 24px -12px rgba(10, 31, 52, .18);
}

html {
    font-size: 15px;
    position: relative;
    min-height: 100%;
}

body {
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--sl-bg);
    color: var(--sl-text);
    margin-bottom: 64px;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    letter-spacing: -.015em;
}

a {
    color: var(--sl-600);
}

.text-muted {
    color: var(--sl-muted) !important;
}

/* ---------- marca ---------- */
.marca {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    font-weight: 700;
    letter-spacing: -.02em;
    font-size: 1.22rem;
    color: #fff;
    text-decoration: none;
}

.marca svg {
    flex: none;
}

.marca-lead {
    color: #5fd3a9;
}

.marca-sub {
    display: block;
    font-size: .62rem;
    font-weight: 500;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .5);
    margin-top: -3px;
}

/* ---------- topo ---------- */
.navbar-sl {
    background: var(--sl-900);
    padding-top: .6rem;
    padding-bottom: .6rem;
}

.navbar-sl .nav-link {
    color: rgba(255, 255, 255, .72);
    font-weight: 500;
    padding: .45rem .85rem;
    border-radius: 9px;
}

.navbar-sl .nav-link:hover,
.navbar-sl .nav-link:focus {
    color: #fff;
    background: rgba(255, 255, 255, .08);
}

.navbar-sl .nav-link.ativo {
    color: #fff;
    background: rgba(255, 255, 255, .14);
}

.navbar-sl .navbar-toggler {
    border: 0;
    padding: .25rem .45rem;
    color: rgba(255, 255, 255, .8);
}

.navbar-sl .navbar-toggler:focus {
    box-shadow: none;
}

.navbar-sl .dropdown-menu {
    border: 0;
    box-shadow: var(--sl-shadow);
    border-radius: 12px;
}

/* ---------- blocos ---------- */
.card {
    border-radius: var(--sl-radius);
    box-shadow: var(--sl-shadow);
    border: 1px solid var(--sl-line);
}

.card-header {
    background: var(--sl-surface) !important;
    border-bottom: 1px solid var(--sl-line);
    border-radius: var(--sl-radius) var(--sl-radius) 0 0 !important;
}

.hero {
    background: linear-gradient(130deg, var(--sl-900) 0%, var(--sl-700) 65%, var(--sl-600) 100%);
    color: #fff;
    border: 0;
}

.hero a {
    color: #fff;
}

.hero-numero {
    font-size: clamp(1.6rem, 5vw, 2.35rem);
    font-weight: 700;
    line-height: 1.15;
}

.hero-resumo {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem 1.4rem;
    margin-top: .65rem;
    font-size: 1.02rem;
}

.stat {
    transition: transform .12s ease, box-shadow .12s ease;
}

.stat:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px -14px rgba(10, 31, 52, .35);
}

.stat .stat-valor {
    font-size: 1.7rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--sl-800);
}

.stat .stat-rotulo {
    font-size: .8rem;
    color: var(--sl-muted);
}

/* ---------- selos ---------- */
.badge {
    font-weight: 600;
    padding: .38em .62em;
    border-radius: 7px;
}

.text-bg-danger {
    background: var(--sl-hot) !important;
}

.text-bg-warning {
    background: var(--sl-warm) !important;
    color: #fff !important;
}

.text-bg-success {
    background: var(--sl-accent) !important;
}

/* ---------- tabela ---------- */
.tabela-leads {
    font-size: .93rem;
}

.tabela-leads thead th {
    background: #f8fafc;
    color: var(--sl-muted);
    font-size: .74rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    border-bottom: 1px solid var(--sl-line);
    white-space: nowrap;
}

.tabela-leads td {
    border-color: var(--sl-line);
    vertical-align: middle;
}

.tabela-leads .coluna-objeto {
    min-width: 240px;
    max-width: 380px;
    color: var(--sl-muted);
}

.linha-clicavel {
    cursor: pointer;
}

.linha-clicavel:hover {
    background: #f7fafd;
}

/* ---------- leads em cartão (mobile) ---------- */
.lead-card {
    display: block;
    padding: .9rem 1rem;
    border-bottom: 1px solid var(--sl-line);
    color: inherit;
    text-decoration: none;
}

.lead-card:last-child {
    border-bottom: 0;
}

.lead-card:active {
    background: #f7fafd;
}

.lead-topo {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .5rem;
    margin-bottom: .4rem;
}

.lead-empresa {
    font-weight: 600;
    line-height: 1.3;
}

.lead-objeto {
    font-size: .85rem;
    color: var(--sl-muted);
    margin: .25rem 0 .5rem;
}

.lead-rodape {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: .5rem;
    font-size: .82rem;
    color: var(--sl-muted);
}

.lead-is {
    font-weight: 700;
    color: var(--sl-accent-dark);
    white-space: nowrap;
}

/* ---------- lead: detalhe ---------- */
.dados dt {
    font-weight: 500;
    color: var(--sl-muted);
}

.dados dd {
    margin-bottom: .45rem;
}

.metricas {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.metrica-rotulo {
    font-size: .74rem;
    color: var(--sl-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
}

.metrica-valor {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.1;
}

.trecho {
    background: #fff9ec;
    border-left: 4px solid var(--sl-warm);
    border-radius: 0 10px 10px 0;
    padding: .8rem 1rem;
    font-size: .9rem;
    margin: 0;
    white-space: pre-line;
}

/* ---------- CRM: histórico ---------- */
.sugestao {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: .75rem 1rem;
    background: #eef6ff;
    border: 1px solid #d6e7fa;
    border-radius: 12px;
}

.registro-contato {
    background: #f8fafc;
    border: 1px solid var(--sl-line);
    border-radius: 12px;
    padding: .9rem;
}

details > summary {
    cursor: pointer;
    list-style: none;
    color: var(--sl-600);
}

details > summary::-webkit-details-marker {
    display: none;
}

.timeline {
    list-style: none;
    padding: 0;
    margin: 0;
    position: relative;
}

.timeline::before {
    content: "";
    position: absolute;
    left: 7px;
    top: 6px;
    bottom: 6px;
    width: 2px;
    background: var(--sl-line);
}

.timeline-item {
    position: relative;
    padding: 0 0 1rem 1.75rem;
}

.timeline-item::before {
    content: "";
    position: absolute;
    left: 0;
    top: 5px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid #b7c4d3;
}

.timeline-item.respondeu::before {
    border-color: var(--sl-accent);
    background: #e5f7f0;
}

.mensagem-enviada {
    white-space: pre-line;
    font-size: .85rem;
    background: #f1f5f9;
    border-radius: 10px;
    padding: .6rem .8rem;
    margin-top: .35rem;
}

/* ---------- CRM: funil ---------- */
.funil {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 1rem;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
}

.funil-coluna {
    flex: 1 0 270px;
    max-width: 340px;
    background: #e9eef5;
    border-radius: var(--sl-radius);
    padding: .75rem;
    scroll-snap-align: start;
    min-height: 60vh;
    transition: box-shadow .12s ease, background .12s ease;
}

.funil-coluna.alvo {
    background: #dde8f5;
    box-shadow: inset 0 0 0 2px var(--sl-600);
}

.funil-topo {
    padding: .1rem .25rem .6rem;
}

.funil-cartoes {
    display: flex;
    flex-direction: column;
    gap: .6rem;
}

.funil-card {
    background: #fff;
    border-radius: 12px;
    padding: .7rem .8rem;
    box-shadow: 0 1px 2px rgba(10, 31, 52, .08);
    border: 1px solid var(--sl-line);
    cursor: grab;
}

.funil-card:active {
    cursor: grabbing;
}

.funil-card.arrastando {
    opacity: .45;
}

.funil-empresa {
    display: block;
    font-weight: 600;
    line-height: 1.25;
    color: var(--sl-text);
    text-decoration: none;
}

.funil-empresa:hover {
    color: var(--sl-600);
}

.funil-rodape {
    display: flex;
    justify-content: space-between;
    font-size: .8rem;
    color: var(--sl-muted);
    margin-top: .45rem;
}

/* ---------- formulários e botões ---------- */
.btn {
    border-radius: 9px;
    font-weight: 600;
}

.btn-primary {
    background: var(--sl-700);
    border-color: var(--sl-700);
}

.btn-primary:hover,
.btn-primary:focus {
    background: var(--sl-800);
    border-color: var(--sl-800);
}

.btn-success {
    background: var(--sl-accent);
    border-color: var(--sl-accent);
}

.btn-success:hover {
    background: var(--sl-accent-dark);
    border-color: var(--sl-accent-dark);
}

.form-control, .form-select {
    border-radius: 9px;
    border-color: #d9e1ea;
}

.form-control:focus, .form-select:focus {
    border-color: var(--sl-600);
    box-shadow: 0 0 0 3px rgba(31, 90, 143, .14);
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-check-input:focus {
    box-shadow: 0 0 0 3px rgba(31, 90, 143, .2);
}

.form-check-input:checked {
    background-color: var(--sl-700);
    border-color: var(--sl-700);
}

/* ---------- login ---------- */
.tela-login {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 1rem;
    background: linear-gradient(150deg, var(--sl-900) 0%, var(--sl-700) 55%, var(--sl-600) 100%);
}

.caixa-login {
    width: 100%;
    max-width: 396px;
}

.caixa-login .card {
    border: 0;
    border-radius: 18px;
    box-shadow: 0 24px 60px -28px rgba(0, 0, 0, .6);
}

.caixa-login .marca {
    justify-content: center;
    margin-bottom: 1.4rem;
    font-size: 1.6rem;
}

.caixa-login .form-control {
    padding: .7rem .85rem;
}

.rodape-login {
    text-align: center;
    color: rgba(255, 255, 255, .6);
    font-size: .8rem;
    margin-top: 1.1rem;
}

/* ---------- rodapé ---------- */
.footer {
    position: absolute;
    bottom: 0;
    width: 100%;
    line-height: 64px;
    height: 64px;
    font-size: .85rem;
    background: transparent;
    border-top: 1px solid var(--sl-line) !important;
}

/* ---------- mobile ---------- */
@media (max-width: 991.98px) {
    .metricas {
        gap: 1rem 1.75rem;
    }

    .metrica-valor {
        font-size: 1.25rem;
    }
}

@media (max-width: 767.98px) {
    html {
        font-size: 14.5px;
    }

    body {
        margin-bottom: 96px;
    }

    .card-body {
        padding: 1rem;
    }

    .footer {
        line-height: 1.5;
        height: auto;
        padding: 1rem 0;
    }

    .acoes-mobile .btn,
    .acoes-mobile form,
    .acoes-mobile .form-select {
        width: 100%;
    }
}
