:root {
    --onlp-primary: #2f6fed;
    --onlp-primary-dark: #1c4fd6;
    --onlp-primary-soft: rgba(47, 111, 237, .10);
    --onlp-success: #16a34a;
    --onlp-success-soft: rgba(22, 163, 74, .12);
    --onlp-warning: #d97706;
    --onlp-warning-soft: rgba(217, 119, 6, .12);
    --onlp-danger: #dc2626;
    --onlp-danger-soft: rgba(220, 38, 38, .12);
    --onlp-info: #0891b2;
    --onlp-info-soft: rgba(8, 145, 178, .12);
    --onlp-purple: #7c3aed;
    --onlp-purple-soft: rgba(124, 58, 237, .12);
    --onlp-bg: #f2f4fa;
    --onlp-surface: #ffffff;
    --onlp-border: #e4e7ee;
    --onlp-text: #1f2430;
    --onlp-text-muted: #6b7280;
    --onlp-sidebar-width: 260px;
    --onlp-topbar-h: 60px;
    --onlp-shadow-sm: 0 2px 10px rgba(31, 41, 66, .06);
    --onlp-shadow-md: 0 10px 28px rgba(31, 41, 66, .10);
    --onlp-shadow-lg: 0 18px 44px rgba(31, 41, 66, .16);
}

body {
    background: linear-gradient(180deg, #f5f7fc 0%, #eef1f8 100%);
    background-attachment: fixed;
    color: var(--onlp-text);
}

.tela-login {
    background: linear-gradient(180deg, #eef1f6 0%, #f7f8fa 100%);
}

.card {
    background-color: var(--onlp-surface);
    border: 1px solid var(--onlp-border);
    border-radius: 1rem;
}

.shadow-sm {
    box-shadow: var(--onlp-shadow-sm) !important;
}

.table > :not(caption) > * > * {
    background-color: transparent;
}

.btn-link {
    line-height: 1;
}

.senha-mask {
    letter-spacing: .1em;
}

/* Botoes com um pouco mais de peso/vida */
.btn {
    border-radius: .6rem;
    font-weight: 500;
    transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--onlp-primary) 0%, var(--onlp-primary-dark) 100%);
    border: none;
    box-shadow: 0 6px 16px rgba(47, 111, 237, .28);
}

.btn-primary:hover, .btn-primary:focus {
    filter: brightness(1.06);
    box-shadow: 0 8px 20px rgba(47, 111, 237, .36);
}

.btn-success {
    box-shadow: 0 6px 16px rgba(22, 163, 74, .22);
}

.btn:active {
    transform: translateY(1px);
}

.btn-sm {
    border-radius: .5rem;
}

/* Badges mais arredondados e com um pouco de presenca */
.badge {
    font-weight: 600;
    letter-spacing: .01em;
    border-radius: .5rem;
    padding: .38em .65em;
}
.badge.rounded-pill {
    border-radius: 50rem;
}
.text-bg-purple {
    background-color: var(--onlp-purple) !important;
    color: #fff !important;
}

/* ===== Cards de indicadores (dashboard) ===== */
.stat-card {
    position: relative;
    overflow: hidden;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.stat-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: var(--stat-cor, var(--onlp-primary));
}

.stat-card:hover {
    transform: translateY(-4px);
    border-color: rgba(47, 111, 237, .25);
    box-shadow: var(--onlp-shadow-md) !important;
}

.stat-icon {
    width: 3rem;
    height: 3rem;
    min-width: 3rem;
    border-radius: .9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .03);
}

.avatar-circle {
    width: 2.3rem;
    height: 2.3rem;
    min-width: 2.3rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .85rem;
    color: #fff;
    background: linear-gradient(135deg, var(--onlp-primary) 0%, var(--onlp-purple) 100%);
    box-shadow: 0 4px 10px rgba(47, 111, 237, .3);
    flex-shrink: 0;
}

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

/* Linhas/cards clicaveis (ex.: abrir cliente em popup) */
.linha-clicavel,
.card-clicavel {
    cursor: pointer;
    transition: background-color .12s ease, transform .12s ease, box-shadow .12s ease;
}
.linha-clicavel:hover {
    background-color: var(--onlp-primary-soft) !important;
}
.card-clicavel:hover {
    transform: translateY(-3px);
    box-shadow: var(--onlp-shadow-md) !important;
    border-color: rgba(47, 111, 237, .25) !important;
}

/* Tabelas com um pouco mais de vida */
.table {
    --bs-table-hover-bg: var(--onlp-primary-soft);
}
.table thead th {
    text-transform: uppercase;
    font-size: .72rem;
    letter-spacing: .04em;
    color: var(--onlp-text-muted);
    border-bottom-width: 1px;
    background-color: #fafbfd;
}
.table tbody tr {
    transition: background-color .12s ease;
}

/* Cartoes de lista no mobile (ex.: Testes gerados) */
.lista-cards .item-card {
    border: 1px solid var(--onlp-border);
    border-radius: 1rem;
    background: var(--onlp-surface);
    box-shadow: var(--onlp-shadow-sm);
    padding: .9rem 1rem;
    transition: transform .12s ease, box-shadow .12s ease;
}
.lista-cards .item-card:active {
    transform: scale(.99);
}

/* Deixa a tabela utilizavel no celular */
@media (max-width: 576px) {
    .table td, .table th {
        white-space: nowrap;
    }
}

/* ===== Menu lateral ===== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--onlp-sidebar-width);
    background-color: var(--onlp-surface);
    border-right: 1px solid var(--onlp-border);
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: var(--onlp-shadow-lg);
}

.sidebar.show {
    transform: translateX(0);
}

.sidebar-brand {
    height: var(--onlp-topbar-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.1rem;
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--onlp-primary) 0%, var(--onlp-purple) 100%);
}

.sidebar-brand-icon {
    width: 34px;
    height: 34px;
    object-fit: contain;
    flex-shrink: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .18);
    padding: 3px;
}

.sidebar-brand-text {
    font-weight: 700;
    font-size: 1.05rem;
    color: #fff;
    white-space: nowrap;
}

.sidebar-brand #fecharSidebar {
    filter: invert(1) grayscale(1) brightness(2);
}

.sidebar-nav {
    flex-grow: 1;
    overflow-y: auto;
    padding: .9rem .6rem;
}

.sidebar-nav .nav-link,
.sidebar-nav .nav-group-toggle {
    display: flex;
    align-items: center;
    gap: .6rem;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    color: #454b57;
    padding: .6rem .75rem;
    border-radius: .65rem;
    font-size: .92rem;
    margin-bottom: .2rem;
    transition: background-color .15s ease, color .15s ease, transform .1s ease;
}

.sidebar-nav .nav-link i:first-child,
.sidebar-nav .nav-group-toggle i:first-child {
    width: 1.1rem;
    text-align: center;
    font-size: 1.05rem;
    color: #9aa1ad;
    transition: color .15s ease;
}

.sidebar-nav .nav-link:hover,
.sidebar-nav .nav-group-toggle:hover {
    background-color: #f1f3f9;
    color: var(--onlp-text);
    transform: translateX(2px);
}

.sidebar-nav .nav-link.active {
    background: linear-gradient(135deg, var(--onlp-primary-soft) 0%, rgba(124, 58, 237, .10) 100%);
    color: var(--onlp-primary);
    font-weight: 600;
    box-shadow: inset 3px 0 0 var(--onlp-primary);
}

.sidebar-nav .nav-link.active i:first-child {
    color: var(--onlp-primary);
}

.sidebar-nav .nav-group-toggle.active {
    color: var(--onlp-text);
    font-weight: 600;
}

.sidebar-nav .chevron {
    margin-left: auto;
    font-size: .75rem;
    color: #9aa1ad;
    transition: transform .2s ease;
}

.sidebar-nav .nav-group-toggle[aria-expanded="true"] .chevron {
    transform: rotate(180deg);
}

.sidebar-nav .nav-subgroup {
    padding-left: 1.7rem;
    margin-bottom: .25rem;
}

.sidebar-nav .nav-subgroup .nav-link {
    font-size: .87rem;
    padding-top: .5rem;
    padding-bottom: .5rem;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 18, 25, .45);
    backdrop-filter: blur(1px);
    z-index: 1030;
}

.sidebar-backdrop.show {
    display: block;
}

.content-wrapper {
    min-height: 100vh;
}

.topbar {
    height: var(--onlp-topbar-h);
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 0 1rem;
    background-color: rgba(255, 255, 255, .85);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--onlp-border);
    position: sticky;
    top: 0;
    z-index: 1020;
}

@media (min-width: 992px) {
    .sidebar {
        transform: translateX(0);
        box-shadow: none;
    }
    .sidebar-brand #fecharSidebar {
        display: none;
    }
    .content-wrapper {
        margin-left: var(--onlp-sidebar-width);
    }
}

/* Telas pequenas: cartoes mais compactos e toques maiores */
@media (max-width: 576px) {
    main.container-fluid {
        padding-left: .75rem !important;
        padding-right: .75rem !important;
    }
    .btn {
        min-height: 40px;
    }
    .stat-card .card-body {
        padding: .9rem !important;
    }
    .stat-icon {
        width: 2.5rem;
        height: 2.5rem;
        min-width: 2.5rem;
        font-size: 1.15rem;
    }
}

/* Modal de detalhe do cliente (abre em popup a partir das listas) */
#modalCliente .modal-content {
    border: none;
    border-radius: 1.1rem;
    box-shadow: var(--onlp-shadow-lg);
}
#modalCliente .modal-body {
    max-height: 78vh;
    overflow-y: auto;
}

/* Modo privacidade: borra senha/telefone/e-mail na tela inteira (util pra
   compartilhar tela ou gravar sem expor dado de cliente). Passar o mouse por
   cima de um campo especifico espia ele sem desligar o modo todo. */
body.privacidade-ativa .dado-sensivel {
    filter: blur(5px);
    transition: filter .15s ease;
}
body.privacidade-ativa .dado-sensivel:hover {
    filter: none;
}
#btnPrivacidade.active {
    background-color: var(--onlp-primary-soft);
    color: var(--onlp-primary);
    border-color: var(--onlp-primary);
}

/* Botao flutuante "Gerar teste manual" (ver layouts/app.php + modalTesteManual) */
.btn-flutuante {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: .45rem;
    padding: .75rem 1.3rem;
    font-size: 1rem;
    letter-spacing: .02em;
    z-index: 1035;
}
.btn-flutuante i {
    font-size: 1.2rem;
}
@media (max-width: 576px) {
    .btn-flutuante {
        right: 1rem;
        bottom: 1rem;
        padding: .7rem 1.1rem;
        font-size: .92rem;
    }
}

#modalTesteManual .dado-linha { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .5rem 0; border-bottom: 1px solid var(--onlp-border); }
#modalTesteManual .dado-linha:last-child { border-bottom: none; }
#modalTesteManual .dado-valor { display: flex; align-items: center; gap: .4rem; min-width: 0; }
#modalTesteManual .dado-valor span { overflow-wrap: anywhere; }
#modalTesteManual .instrucao-texto { white-space: pre-line; }
#modalTesteManual .passo-manual { display: none; }
#modalTesteManual .passo-manual.ativo { display: block; }
