/* ===================================================================
   Agnospay - Global Stylesheet
   Paleta e tipografia inspiradas no template Dastone (Mannatthemes)
   TODO o CSS do sistema deve viver aqui. Nenhum cshtml deve conter
   <style> ou estilos inline.
=================================================================== */

:root {
    /* Azul exato do "pay" na logo oficial (agnospay.png) — diferente do --ap-primary
       (indigo do design system), usado só pra reproduzir a marca fielmente. */
    --ap-brand-blue: #0070ff;

    /* Paleta principal (inspirada no Dastone) */
    --ap-primary: #5369f8;
    --ap-primary-dark: #3f51e0;
    --ap-primary-light: #eef0ff;
    --ap-secondary: #6c757d;
    --ap-success: #0acf97;
    --ap-success-light: #e3faf2;
    --ap-warning: #ffbc00;
    --ap-warning-light: #fff8e6;
    --ap-danger: #fa5c7c;
    --ap-danger-light: #ffeaee;
    --ap-info: #39afd1;
    --ap-info-light: #e7f7fb;
    --ap-dark: #313a46;
    /* Superfícies */
    --ap-body-bg: #f4f6fb;
    --ap-card-bg: #ffffff;
    --ap-sidebar-bg: #2a3142;
    --ap-sidebar-bg-2: #313a4d;
    --ap-sidebar-text: #97a3b9;
    --ap-sidebar-text-active: #ffffff;
    --ap-topbar-bg: #ffffff;
    --ap-border: #e9ecf2;
    /* Texto */
    --ap-text-main: #313a46;
    --ap-text-muted: #8590a5;
    /* Layout */
    --ap-sidebar-width: 250px;
    --ap-sidebar-width-collapsed: 70px;
    --ap-topbar-height: 70px;
    --ap-radius: .5rem;
    --ap-radius-lg: .75rem;
    --ap-shadow: 0 2px 6px rgba(48,53,86,.08);
    --ap-shadow-md: 0 4px 14px rgba(48,53,86,.10);
    --ap-transition: .25s ease;
}

* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    font-family: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--ap-body-bg);
    color: var(--ap-text-main);
    font-size: .9375rem;
    margin: 0;
}

h1, h2, h3, h4, h5, h6, .ap-font-display {
    font-family: "Poppins","Nunito",sans-serif;
    color: var(--ap-text-main);
    font-weight: 600;
}

a {
    color: var(--ap-primary);
    text-decoration: none;
}

    a:hover {
        color: var(--ap-primary-dark);
    }

.text-muted-ap {
    color: var(--ap-text-muted) !important;
}

/* ===================================================================
   LOADING GLOBAL (transições entre telas)
=================================================================== */
#ap-global-loader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(244,246,251,.85);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: .75rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity .2s ease, visibility .2s ease;
}

    #ap-global-loader.show {
        opacity: 1;
        visibility: visible;
    }

.ap-spinner {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    border: 4px solid var(--ap-primary-light);
    border-top-color: var(--ap-primary);
    animation: ap-spin 0.8s linear infinite;
}

.ap-loader-label {
    font-size: .8125rem;
    font-weight: 600;
    color: var(--ap-text-muted);
    letter-spacing: .04em;
    text-transform: uppercase;
}

@keyframes ap-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===================================================================
   APP SHELL
=================================================================== */
.ap-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ---------- SIDEBAR ---------- */
.ap-sidebar {
    width: var(--ap-sidebar-width);
    background: linear-gradient(180deg, var(--ap-sidebar-bg) 0%, var(--ap-sidebar-bg-2) 100%);
    flex-shrink: 0;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1030;
    display: flex;
    flex-direction: column;
    transition: width var(--ap-transition);
}

/* Suprime a transição de largura/margem só na 1ª pintura da página (ver script inline
   logo no início do <aside>, _Layout.cshtml) — evita um "encolher" rápido e indesejado
   quando o estado recolhido já vem salvo do localStorage. */
.ap-sidebar.ap-no-transition,
.ap-sidebar.ap-no-transition ~ .ap-content-wrapper {
    transition: none !important;
}

    .ap-sidebar.collapsed {
        width: var(--ap-sidebar-width-collapsed);
    }

.ap-sidebar-brand {
    height: var(--ap-topbar-height);
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: 0 1.25rem;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255,255,255,.06);
}

    .ap-sidebar-brand .ap-logo-mark {
        width: 34px;
        height: 34px;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }

        .ap-sidebar-brand .ap-logo-mark img {
            width: 100%;
            height: 100%;
            object-fit: contain;
        }

    .ap-sidebar-brand-text {
        min-width: 0;
        overflow: hidden;
    }

    .ap-sidebar-brand .ap-logo-text {
        color: #fff;
        font-family: "Poppins",sans-serif;
        font-weight: 800;
        font-size: 1.1rem;
        white-space: nowrap;
        overflow: hidden;
    }

        .ap-sidebar-brand .ap-logo-text .ap-logo-text-accent {
            color: var(--ap-brand-blue);
        }

    .ap-sidebar-brand .ap-sidebar-company {
        color: var(--ap-sidebar-text);
        font-size: .72rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

.ap-sidebar.collapsed .ap-logo-text,
.ap-sidebar.collapsed .ap-sidebar-company {
    display: none;
}

.ap-sidebar-menu {
    list-style: none;
    margin: 0;
    padding: 1rem .75rem 1.5rem;
    overflow-y: auto;
    flex: 1;
}

    .ap-sidebar-menu .ap-menu-title {
        color: #5b6679;
        font-size: .72rem;
        text-transform: uppercase;
        letter-spacing: .08em;
        font-weight: 700;
        padding: .75rem .75rem .35rem;
    }

.ap-sidebar.collapsed .ap-menu-title {
    display: none;
}

.ap-menu-link {
    display: flex;
    align-items: center;
    gap: .85rem;
    padding: .65rem .75rem;
    border-radius: var(--ap-radius);
    color: var(--ap-sidebar-text);
    font-weight: 600;
    font-size: .875rem;
    margin-bottom: .15rem;
    transition: background var(--ap-transition), color var(--ap-transition);
    white-space: nowrap;
}

    .ap-menu-link i {
        font-size: 1.1rem;
        width: 20px;
        text-align: center;
        flex-shrink: 0;
    }

    .ap-menu-link:hover {
        background: rgba(255,255,255,.06);
        color: var(--ap-sidebar-text-active);
    }

    .ap-menu-link.active {
        background: var(--ap-primary);
        color: #fff;
        box-shadow: 0 4px 10px rgba(83,105,248,.35);
    }

.ap-sidebar.collapsed .ap-menu-link span {
    display: none;
}

/* ---------- MAIN CONTENT AREA ---------- */
.ap-content-wrapper {
    margin-left: var(--ap-sidebar-width);
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    transition: margin-left var(--ap-transition);
}

.ap-sidebar.collapsed ~ .ap-content-wrapper {
    margin-left: var(--ap-sidebar-width-collapsed);
}

/* ---------- TOPBAR ---------- */
.ap-topbar {
    height: var(--ap-topbar-height);
    background: var(--ap-topbar-bg);
    border-bottom: 1px solid var(--ap-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.ap-topbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.ap-topbar-right {
    display: flex;
    align-items: center;
    gap: 1.1rem;
}

.ap-burger {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: var(--ap-body-bg);
    color: var(--ap-text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background var(--ap-transition);
}

    .ap-burger:hover {
        background: var(--ap-border);
    }

/* user menu (canto esquerdo conforme solicitado) */
.ap-user-menu {
    position: relative;
}

.ap-user-toggle {
    display: flex;
    align-items: center;
    gap: .6rem;
    cursor: pointer;
    border: none;
    background: transparent;
    padding: .25rem .5rem;
    border-radius: var(--ap-radius);
}

    .ap-user-toggle:hover {
        background: var(--ap-body-bg);
    }

.ap-user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--ap-primary-light);
    color: var(--ap-primary-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}

.ap-user-info {
    text-align: left;
    line-height: 1.1;
}

.ap-user-name {
    font-size: .85rem;
    font-weight: 700;
    color: var(--ap-text-main);
    display: block;
}

.ap-user-role {
    font-size: .72rem;
    color: var(--ap-text-muted);
}

.ap-dropdown-panel {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    min-width: 220px;
    background: #fff;
    border-radius: var(--ap-radius-lg);
    box-shadow: var(--ap-shadow-md);
    border: 1px solid var(--ap-border);
    padding: .5rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: all .18s ease;
    z-index: 1050;
}

.ap-user-menu.show .ap-dropdown-panel,
.ap-notif.show .ap-dropdown-panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.ap-dropdown-item {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .55rem .65rem;
    border-radius: .4rem;
    color: var(--ap-text-main);
    font-size: .85rem;
    font-weight: 600;
}

    .ap-dropdown-item:hover {
        background: var(--ap-body-bg);
        color: var(--ap-primary);
    }

    .ap-dropdown-item i {
        width: 18px;
        text-align: center;
        color: var(--ap-text-muted);
    }

.ap-dropdown-divider {
    height: 1px;
    background: var(--ap-border);
    margin: .4rem 0;
}

/* notification bell */
.ap-notif {
    position: relative;
}

.ap-notif-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--ap-body-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    color: var(--ap-text-main);
}

    .ap-notif-btn:hover {
        background: var(--ap-border);
    }

.ap-notif-dot {
    position: absolute;
    top: 6px;
    right: 7px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--ap-danger);
    border: 2px solid #fff;
}

/* badge de modo simulador (topbar) */
.ap-integracao-badge {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    background: var(--ap-warning-light);
    color: #8a6100;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    font-family: 'Poppins', sans-serif;
    letter-spacing: 0.3px;
    margin-right: 6px;
    white-space: nowrap;
    text-decoration: none;
    transition: background var(--ap-transition);
}

    .ap-integracao-badge:hover {
        background: var(--ap-warning);
        color: #fff;
    }

.ap-simulador-badge {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    background: #7c5cbf;
    color: #fff;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    font-family: 'Poppins', sans-serif;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    margin-right: 6px;
    animation: ap-sim-pulse 2.5s ease-in-out infinite;
    white-space: nowrap;
}

@keyframes ap-sim-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.65; }
}

.ap-impersonation-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: #f59f00;
    color: #2a1e00;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    font-family: 'Poppins', sans-serif;
    margin-right: 10px;
    white-space: nowrap;
}

    .ap-impersonation-badge a {
        color: inherit;
        text-decoration: underline;
        font-weight: 700;
    }

.ap-notif-panel {
    width: 420px;
    right: 0;
    left: auto;
    padding: 0;
    overflow: hidden;
}

.ap-notif-head {
    padding: 1rem 1.1rem;
    border-bottom: 1px solid var(--ap-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

    .ap-notif-head strong {
        font-size: .9rem;
    }

    .ap-notif-head span {
        font-size: .75rem;
        color: var(--ap-primary);
        font-weight: 700;
        cursor: pointer;
    }

.ap-notif-list {
    max-height: 320px;
    overflow-y: auto;
    overflow-x: hidden;
}

.ap-notif-row {
    display: flex;
    gap: .75rem;
    padding: .8rem 1.1rem;
    border-bottom: 1px solid var(--ap-border);
}

    .ap-notif-row:last-child {
        border-bottom: none;
    }

.ap-notif-icon {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1rem;
}

    .ap-notif-icon.is-success {
        background: var(--ap-success-light);
        color: var(--ap-success);
    }

    .ap-notif-icon.is-warning {
        background: var(--ap-warning-light);
        color: #c98e00;
    }

    .ap-notif-icon.is-danger {
        background: var(--ap-danger-light);
        color: var(--ap-danger);
    }

.ap-notif-text {
    min-width: 0;
    flex: 1;
}

.ap-notif-text p {
    margin: 0;
    font-size: .82rem;
    font-weight: 600;
    color: var(--ap-text-main);
    word-break: break-word;
    overflow-wrap: break-word;
}

.ap-notif-text span {
    font-size: .74rem;
    color: var(--ap-text-muted);
    word-break: break-word;
    overflow-wrap: break-word;
}

.ap-notif-footer {
    text-align: center;
    padding: .7rem;
    border-top: 1px solid var(--ap-border);
}

    .ap-notif-footer a {
        font-size: .8rem;
        font-weight: 700;
    }

/* ---------- PAGE CONTENT ---------- */
.ap-page {
    padding: 1.5rem;
    flex: 1;
}

.ap-page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: .75rem;
    margin-bottom: 1.5rem;
}

    .ap-page-header h4 {
        margin: 0 0 .2rem;
        font-size: 1.25rem;
    }

.ap-breadcrumb {
    list-style: none;
    display: flex;
    gap: .4rem;
    padding: 0;
    margin: 0;
    font-size: .8rem;
    color: var(--ap-text-muted);
}

    .ap-breadcrumb li:not(:last-child)::after {
        content: "/";
        margin-left: .4rem;
        color: #c7cedd;
    }

    .ap-breadcrumb li.active {
        color: var(--ap-primary);
        font-weight: 700;
    }

/* ===================================================================
   CARDS
=================================================================== */
.ap-card {
    background: var(--ap-card-bg);
    border-radius: var(--ap-radius-lg);
    border: 1px solid var(--ap-border);
    box-shadow: var(--ap-shadow);
    margin-bottom: 1.5rem;
}

.ap-card-body {
    padding: 1.35rem;
}

.ap-card-header {
    padding: 1.1rem 1.35rem;
    border-bottom: 1px solid var(--ap-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    flex-wrap: wrap;
}

    .ap-card-header h5 {
        margin: 0;
        font-size: 1rem;
    }

/* KPI summary cards (dashboard) */
.ap-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4,1fr);
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

@media (max-width:1199px) {
    .ap-kpi-grid {
        grid-template-columns: repeat(2,1fr);
    }
}

@media (max-width:575px) {
    .ap-kpi-grid {
        grid-template-columns: 1fr;
    }
}

.ap-kpi-card {
    background: var(--ap-card-bg);
    border-radius: var(--ap-radius-lg);
    border: 1px solid var(--ap-border);
    box-shadow: var(--ap-shadow);
    padding: 1.25rem 1.35rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    position: relative;
    overflow: hidden;
}

.ap-kpi-icon {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.ap-kpi-card.is-warning .ap-kpi-icon {
    background: var(--ap-warning-light);
    color: #c98e00;
}

.ap-kpi-card.is-success .ap-kpi-icon {
    background: var(--ap-success-light);
    color: var(--ap-success);
}

.ap-kpi-card.is-danger .ap-kpi-icon {
    background: var(--ap-danger-light);
    color: var(--ap-danger);
}

.ap-kpi-card.is-info .ap-kpi-icon {
    background: var(--ap-info-light);
    color: var(--ap-info);
}

.ap-kpi-value {
    font-size: 1.6rem;
    font-weight: 700;
    font-family: "Poppins",sans-serif;
    line-height: 1.1;
}

.ap-kpi-label {
    font-size: .8rem;
    color: var(--ap-text-muted);
    font-weight: 600;
}

.ap-kpi-card.is-warning .ap-kpi-value {
    color: #c98e00;
}

.ap-kpi-card.is-success .ap-kpi-value {
    color: var(--ap-success);
}

.ap-kpi-card.is-danger .ap-kpi-value {
    color: var(--ap-danger);
}

.ap-kpi-card.is-info .ap-kpi-value {
    color: var(--ap-info);
}

/* ---- Paleta azul pastel (uso específico no Dashboard) ----
   Mantém apenas tons de azul, sem o significado semântico de
   sucesso/erro/alerta usado nas badges de status do restante do sistema. */
.ap-kpi-card.is-blue-1 .ap-kpi-icon {
    background: #e8f1ff;
    color: #3b82f6;
}

.ap-kpi-card.is-blue-1 .ap-kpi-value {
    color: #3b82f6;
}

.ap-kpi-card.is-blue-2 .ap-kpi-icon {
    background: #e3f7fc;
    color: #0ea5c4;
}

.ap-kpi-card.is-blue-2 .ap-kpi-value {
    color: #0ea5c4;
}

.ap-kpi-card.is-blue-3 .ap-kpi-icon {
    background: var(--ap-primary-light);
    color: var(--ap-primary);
}

.ap-kpi-card.is-blue-3 .ap-kpi-value {
    color: var(--ap-primary);
}

.ap-kpi-card.is-blue-4 .ap-kpi-icon {
    background: #e6eef9;
    color: #2f5f9e;
}

.ap-kpi-card.is-blue-4 .ap-kpi-value {
    color: #2f5f9e;
}

/* Charts row */
.ap-chart-row {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 1.25rem;
}

@media (max-width:991px) {
    .ap-chart-row {
        grid-template-columns: 1fr;
    }
}

.ap-chart-box {
    position: relative;
    height: 320px;
}

/* ===================================================================
   FILTER BAR (lista de transações / centros de custo)
=================================================================== */
.ap-filter-bar {
    background: var(--ap-card-bg);
    border: 1px solid var(--ap-border);
    border-radius: var(--ap-radius-lg);
    box-shadow: var(--ap-shadow);
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    flex-wrap: wrap;
}

.ap-filter-field {
    display: flex;
    flex-direction: column;
    gap: .3rem;
}

    .ap-filter-field label {
        font-size: .72rem;
        font-weight: 700;
        color: var(--ap-text-muted);
        text-transform: lowercase;
        letter-spacing: .03em;
    }

        .ap-filter-field label::first-letter {
            text-transform: uppercase;
        }

.ap-filter-actions {
    display: flex;
    gap: .5rem;
    margin-left: auto;
    align-items: flex-end;
}

/* Sem isso, um <select> cresce até caber a opção mais longa (nome de CC/aprovador),
   estourando a largura da barra e empurrando os botões Filtrar/Limpar pra linha de
   baixo em telas de notebook (~1366px). Trava a largura e deixa o texto truncar. */
.ap-filter-field .ap-select {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* view switch (lista / kanban) */
.ap-view-switch {
    display: flex;
    background: var(--ap-body-bg);
    border-radius: var(--ap-radius);
    padding: .25rem;
    gap: .2rem;
}

    .ap-view-switch button {
        border: none;
        background: transparent;
        padding: .45rem .9rem;
        border-radius: .4rem;
        font-size: .8rem;
        font-weight: 700;
        color: var(--ap-text-muted);
        display: flex;
        align-items: center;
        gap: .4rem;
        cursor: pointer;
        transition: all var(--ap-transition);
    }

        .ap-view-switch button.active {
            background: #fff;
            color: var(--ap-primary);
            box-shadow: var(--ap-shadow);
        }

/* ===================================================================
   FORM CONTROLS (genéricos, usados em filtros e modais)
=================================================================== */
.ap-input, .ap-select {
    border: 1px solid var(--ap-border);
    background: var(--ap-body-bg);
    border-radius: var(--ap-radius);
    padding: .55rem .8rem;
    font-size: .85rem;
    color: var(--ap-text-main);
    min-width: 170px;
    transition: border-color var(--ap-transition);
}

    .ap-input:focus, .ap-select:focus {
        outline: none;
        border-color: var(--ap-primary);
        background: #fff;
    }

.ap-input-uppercase {
    text-transform: uppercase;
}

.ap-form-group {
    margin-bottom: 1.1rem;
}

    .ap-form-group label {
        display: block;
        font-size: .78rem;
        font-weight: 700;
        color: var(--ap-text-muted);
        margin-bottom: .35rem;
        text-transform: lowercase;
        letter-spacing: .03em;
    }

        .ap-form-group label::first-letter {
            text-transform: uppercase;
        }

    .ap-form-group label.ap-toggle {
        display: inline-flex;
        margin-bottom: 0;
    }

    .ap-form-group .ap-input, .ap-form-group .ap-select, .ap-form-group textarea.ap-input {
        width: 100%;
        min-width: 0;
    }

.ap-form-row {
    display: grid;
    grid-template-columns: repeat(2,1fr);
    gap: 1.1rem;
}

@media (max-width:575px) {
    .ap-form-row {
        grid-template-columns: 1fr;
    }
}

/* Linha de limite de uso (Produtos/PlanoDet.cshtml) — nome + valor + botão remover. A
   coluna do botão tem um <label>&nbsp;</label> igual às outras (ver ap-limite-remove-group),
   pra alinhar com a base dos inputs através do fluxo normal, sem precisar de align-items. */
.ap-limite-row {
    display: grid;
    grid-template-columns: 2fr 1fr auto;
    gap: 1.1rem;
    margin-bottom: 1rem;
}

.ap-limite-remove-group {
    display: flex;
    flex-direction: column;
}

@media (max-width:575px) {
    .ap-limite-row {
        grid-template-columns: 1fr;
    }
}

/* Campo composto (ex.: quantidade + unidade) dentro de um único .ap-form-group —
   diferente de .ap-form-row, que é pra parear dois .ap-form-group lado a lado. */
.ap-inline-group {
    display: flex;
    gap: .5rem;
}

.ap-input-narrow {
    max-width: 90px;
    flex: 0 0 auto;
}

.ap-field-static {
    background: var(--ap-body-bg);
    border-radius: var(--ap-radius);
    padding: .55rem .8rem;
    font-size: .85rem;
    font-weight: 600;
    color: var(--ap-text-main);
    min-height: 2.4rem;
    display: flex;
    align-items: center;
}

/* ===================================================================
   BUTTONS
=================================================================== */
.ap-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    border: none;
    border-radius: var(--ap-radius);
    padding: .6rem 1.15rem;
    font-size: .85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--ap-transition);
    line-height: 1.2;
}

.ap-btn-primary {
    background: var(--ap-primary);
    color: #fff;
}

    .ap-btn-primary:hover {
        background: var(--ap-primary-dark);
    }

.ap-btn-light {
    background: var(--ap-body-bg);
    color: var(--ap-text-main);
}

    .ap-btn-light:hover {
        background: var(--ap-border);
    }

.ap-btn-outline {
    background: transparent;
    border: 1px solid var(--ap-border);
    color: var(--ap-text-main);
}

    .ap-btn-outline:hover {
        border-color: var(--ap-primary);
        color: var(--ap-primary);
    }

.ap-btn-danger {
    background: var(--ap-danger-light);
    color: var(--ap-danger);
}

    .ap-btn-danger:hover {
        background: var(--ap-danger);
        color: #fff;
    }

.ap-btn-success {
    background: var(--ap-success-light);
    color: var(--ap-success);
}

    .ap-btn-success:hover {
        background: var(--ap-success);
        color: #fff;
    }

.ap-btn-icon {
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: 50%;
}

.ap-btn-sm {
    padding: .4rem .8rem;
    font-size: .78rem;
}

.ap-btn.is-disabled,
.ap-btn:disabled {
    opacity: .6;
    pointer-events: none;
    cursor: default;
}

/* ===================================================================
   BADGES / STATUS
=================================================================== */
.ap-badge {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-size: .72rem;
    font-weight: 700;
    padding: .3rem .65rem;
    border-radius: 30px;
    text-transform: capitalize;
}

    .ap-badge::before {
        content: "";
        width: 6px;
        height: 6px;
        border-radius: 50%;
        background: currentColor;
    }

    .ap-badge.st-pendente {
        background: var(--ap-warning-light);
        color: #c98e00;
    }

    .ap-badge.st-aprovada {
        background: var(--ap-success-light);
        color: var(--ap-success);
    }

    .ap-badge.st-reprovada {
        background: var(--ap-danger-light);
        color: var(--ap-danger);
    }

    .ap-badge.st-atencao {
        background: var(--ap-info-light);
        color: var(--ap-info);
    }

    .ap-badge.st-ativo {
        background: var(--ap-success-light);
        color: var(--ap-success);
    }

    .ap-badge.st-inativo {
        background: #eef0f4;
        color: var(--ap-text-muted);
    }

    /* Não é uma das 4 chaves de status (pendente/aprovada/reprovada/atencao) — marca informativa
       de que o rateio foi resolvido pela alçada automaticamente, sem voto de aprovador. Cor própria
       (azul) para não ser confundida visualmente com um voto real de "Aprovada" (verde). */
    .ap-badge.st-automatica {
        background: var(--ap-primary-light);
        color: var(--ap-primary-dark);
    }

/* ===================================================================
   DATATABLE
=================================================================== */
.ap-table-wrap {
    overflow-x: auto;
}

/* Estado vazio padrão do DataTables (language.zeroRecords/emptyTable), ver site.js */
.ap-table-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .5rem;
    padding: 2.5rem 1rem;
    color: var(--ap-text-muted);
}

    .ap-table-empty .mdi {
        font-size: 2.5rem;
        opacity: .5;
    }

    .ap-table-empty span {
        font-size: .9rem;
    }

table.ap-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

    table.ap-table thead th {
        background: var(--ap-body-bg);
        color: var(--ap-text-muted);
        font-size: .72rem;
        text-transform: uppercase;
        letter-spacing: .04em;
        font-weight: 700;
        padding: .85rem 1rem;
        border-bottom: 1px solid var(--ap-border);
        white-space: nowrap;
    }

        table.ap-table thead th:first-child {
            border-radius: .5rem 0 0 0;
        }

        table.ap-table thead th:last-child {
            border-radius: 0 .5rem 0 0;
        }

    table.ap-table tbody td {
        padding: .85rem 1rem;
        border-bottom: 1px solid var(--ap-border);
        font-size: .85rem;
        vertical-align: middle;
    }

    table.ap-table tbody tr:hover {
        background: var(--ap-body-bg);
    }

    table.ap-table tbody tr:last-child td {
        border-bottom: none;
    }

.ap-row-actions {
    display: flex;
    gap: .4rem;
}

/* DataTables (jQuery plugin) overrides to match identity */
div.dataTables_wrapper .dataTables_filter input,
div.dataTables_wrapper .dataTables_length select {
    border: 1px solid var(--ap-border);
    border-radius: var(--ap-radius);
    padding: .4rem .7rem;
    margin-left: .5rem;
}

div.dataTables_wrapper .dataTables_paginate .paginate_button {
    border-radius: var(--ap-radius) !important;
    margin-left: .25rem !important;
}

    div.dataTables_wrapper .dataTables_paginate .paginate_button.current {
        background: var(--ap-primary) !important;
        border-color: var(--ap-primary) !important;
        color: #fff !important;
    }

/* ===================================================================
   KANBAN (view-only — sem drag&drop)
=================================================================== */
.ap-kanban {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.1rem;
    align-items: start;
}

@media (max-width:1199px) {
    .ap-kanban {
        grid-template-columns: repeat(2,1fr);
    }
}

@media (max-width:575px) {
    .ap-kanban {
        grid-template-columns: 1fr;
    }
}

.ap-kanban-col {
    background: #eef1f8;
    border-radius: var(--ap-radius-lg);
    padding: .9rem;
    min-height: 120px;
}

.ap-kanban-col-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: .85rem;
    padding: 0 .25rem;
}

    .ap-kanban-col-head .ap-kanban-title {
        font-size: .82rem;
        font-weight: 700;
        display: flex;
        align-items: center;
        gap: .5rem;
    }

        .ap-kanban-col-head .ap-kanban-title::before {
            content: "";
            width: 9px;
            height: 9px;
            border-radius: 50%;
            background: currentColor;
        }

.ap-kanban-col[data-status="pendente"] .ap-kanban-title {
    color: #c98e00;
}

.ap-kanban-col[data-status="aprovada"] .ap-kanban-title {
    color: var(--ap-success);
}

.ap-kanban-col[data-status="reprovada"] .ap-kanban-title {
    color: var(--ap-danger);
}

.ap-kanban-col[data-status="atencao"] .ap-kanban-title {
    color: var(--ap-info);
}

/* Kanban de Clientes (Solarys Corp) — colunas por fase do pipeline (EStatusClienteCRM) */
.ap-kanban-col[data-status="prospect"] .ap-kanban-title {
    color: var(--ap-info);
}

.ap-kanban-col[data-status="lead"] .ap-kanban-title {
    color: #c98e00;
}

.ap-kanban-col[data-status="assinante"] .ap-kanban-title {
    color: var(--ap-success);
}

.ap-kanban-count {
    background: #fff;
    border-radius: 20px;
    font-size: .72rem;
    font-weight: 700;
    padding: .1rem .55rem;
    color: var(--ap-text-muted);
}

.ap-kanban-card {
    background: #fff;
    border-radius: var(--ap-radius);
    padding: .9rem 1rem;
    margin-bottom: .75rem;
    box-shadow: var(--ap-shadow);
    cursor: pointer; /* abre modal, mas não arrasta */
    user-select: none;
    transition: transform var(--ap-transition), box-shadow var(--ap-transition);
}

    .ap-kanban-card:hover {
        transform: translateY(-2px);
        box-shadow: var(--ap-shadow-md);
    }

.ap-kanban-card.is-escalado {
    border: 1px solid var(--ap-warning);
}

.ap-kanban-card.is-automatica {
    border: 1px solid var(--ap-primary);
}

.ap-escalado-tag,
.ap-auto-tag {
    margin-top: .35rem;
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    font-size: .7rem;
    font-weight: 700;
    border-radius: 20px;
    padding: .15rem .55rem;
}

    .ap-escalado-tag i,
    .ap-auto-tag i {
        font-size: .85rem;
    }

.ap-escalado-tag {
    color: #c98e00;
    background: var(--ap-warning-light);
    border: 1px solid var(--ap-warning);
}

.ap-auto-tag {
    color: var(--ap-primary-dark);
    background: var(--ap-primary-light);
    border: 1px solid var(--ap-primary);
}

.ap-kanban-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: .5rem;
    margin-bottom: .5rem;
}

.ap-kanban-card-id {
    font-size: .7rem;
    color: var(--ap-text-muted);
    font-weight: 700;
}

.ap-kanban-card-fornecedor {
    font-size: .88rem;
    font-weight: 700;
    margin: 0 0 .2rem;
}

.ap-kanban-card-desc {
    font-size: .78rem;
    color: var(--ap-text-muted);
    margin: 0 0 .65rem;
}

.ap-kanban-card-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ap-kanban-card-valor {
    font-weight: 700;
    font-family: "Poppins",sans-serif;
    font-size: .92rem;
}

.ap-kanban-card-venc {
    font-size: .72rem;
    color: var(--ap-text-muted);
    display: flex;
    align-items: center;
    gap: .3rem;
}

/* ===================================================================
   MODAL (header padrão + conteúdo injetado)
=================================================================== */
.ap-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(31,35,55,.55);
    z-index: 1080;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

    .ap-modal-backdrop.show {
        display: flex;
    }

/* 2º nível de modal empilhado (ver CS.openModal2 em site.js) — fica acima do
   modal principal (1080) e abaixo do modal de confirmação (1090), que deve
   continuar por cima de qualquer coisa. */
.ap-modal-backdrop.ap-modal-backdrop-nested {
    z-index: 1085;
}

.ap-modal-box {
    background: var(--ap-card-bg);
    border-radius: var(--ap-radius-lg);
    width: 100%;
    max-width: 760px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(20,24,45,.35);
    animation: ap-modal-in .2s ease;
}

    .ap-modal-box.ap-modal-lg {
        max-width: 960px;
    }

    .ap-modal-box.ap-modal-xl {
        max-width: 1180px;
    }

    .ap-modal-box.ap-modal-xxl {
        max-width: 1380px;
    }

    .ap-modal-box.ap-modal-sm {
        max-width: 480px;
    }

@keyframes ap-modal-in {
    from {
        opacity: 0;
        transform: translateY(14px) scale(.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.ap-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.1rem 1.4rem;
    border-bottom: 1px solid var(--ap-border);
    flex-shrink: 0;
}

    .ap-modal-header .ap-modal-title-wrap {
        display: flex;
        align-items: center;
        gap: .75rem;
    }

    .ap-modal-header .ap-modal-icon {
        width: 42px;
        height: 42px;
        border-radius: 50%;
        background: var(--ap-primary-light);
        color: var(--ap-primary);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.1rem;
        flex-shrink: 0;
    }

    .ap-modal-header h5 {
        margin: 0;
        font-size: 1.05rem;
    }

    .ap-modal-header small {
        color: var(--ap-text-muted);
        font-size: .78rem;
    }

.ap-modal-close {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: var(--ap-body-bg);
    color: var(--ap-text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

    .ap-modal-close:hover {
        background: var(--ap-danger-light);
        color: var(--ap-danger);
    }

.ap-modal-body {
    padding: 1.4rem;
    overflow-y: auto;
    flex: 1;
}

.ap-modal-footer {
    padding: 1rem 1.4rem;
    border-top: 1px solid var(--ap-border);
    display: flex;
    justify-content: flex-end;
    gap: .6rem;
    flex-shrink: 0;
}

/* Empurra um botão (ex.: "Excluir") pra ponta oposta do rodapé, mantendo
   Fechar/Salvar agrupados do lado direito. */
.ap-modal-footer-left {
    margin-right: auto;
}

/* ===================================================================
   FRAGMENTO DE MODAL COM <form> (inclusão/edição)
   Garante que cabeçalho fique fixo, o corpo role e o rodapé fique
   sempre visível, mesmo quando o <form> envolve body + footer.
   Use no elemento raiz do fragmento injetado no modal:
     <div class="ap-modal-fragment">
        @await Html.PartialAsync("_ModalHeader", ...)
        <form>
           <div class="ap-modal-body">...</div>
           <div class="ap-modal-footer">...</div>
        </form>
     </div>
=================================================================== */
.ap-modal-fragment {
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

    .ap-modal-fragment form {
        display: flex;
        flex-direction: column;
        flex: 1;
        min-height: 0; /* permite que o filho .ap-modal-body role corretamente */
    }

/* Conteúdo rolável de fragmentos que não usam .ap-modal-body diretamente
   (ex.: Alcada/Det.cshtml, Aprovador/Det.cshtml, onde o topo + abas + cards
   ficam dentro de um wrapper próprio em vez do padrão header/body/footer simples). */
.ap-alcada-scroll, .ap-modal-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-top: 1.4rem;
}

/* Bloco de leitura (detalhe somente visualização) */
.ap-detail-section {
    margin-bottom: 1.4rem;
}

    .ap-detail-section:last-child {
        margin-bottom: 0;
    }

.ap-detail-section-title {
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--ap-text-muted);
    margin-bottom: .75rem;
    display: flex;
    align-items: center;
    gap: .5rem;
}

    .ap-detail-section-title::after {
        content: "";
        flex: 1;
        height: 1px;
        background: var(--ap-border);
    }

.ap-detail-grid {
    display: grid;
    grid-template-columns: repeat(3,1fr);
    gap: 1rem;
}

@media (max-width:767px) {
    .ap-detail-grid {
        grid-template-columns: repeat(2,1fr);
    }
}

@media (max-width:575px) {
    .ap-detail-grid {
        grid-template-columns: 1fr;
    }
}

.ap-detail-item label {
    display: block;
    font-size: .7rem;
    color: var(--ap-text-muted);
    font-weight: 700;
    text-transform: lowercase;
    letter-spacing: .03em;
    margin-bottom: .25rem;
}

    .ap-detail-item label::first-letter {
        text-transform: uppercase;
    }

.ap-detail-item span {
    font-size: .9rem;
    font-weight: 600;
    color: var(--ap-text-main);
}

.ap-detail-item.full {
    grid-column: 1/-1;
}

/* timeline de aprovação (transacaoDet) */
.ap-approval-timeline {
    list-style: none;
    margin: 0;
    padding: 0;
}

    .ap-approval-timeline li {
        display: flex;
        gap: .9rem;
        padding-bottom: 1.1rem;
        position: relative;
    }

        .ap-approval-timeline li::before {
            content: "";
            position: absolute;
            left: 13px;
            top: 30px;
            bottom: 0;
            width: 2px;
            background: var(--ap-border);
        }

        .ap-approval-timeline li:last-child::before {
            display: none;
        }

.ap-approval-step-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .8rem;
    flex-shrink: 0;
    z-index: 1;
}

    .ap-approval-step-icon.is-ok {
        background: var(--ap-success);
        color: #fff;
    }

    .ap-approval-step-icon.is-pending {
        background: var(--ap-warning);
        color: #fff;
    }

    .ap-approval-step-icon.is-rejected {
        background: var(--ap-danger);
        color: #fff;
    }

.ap-approval-step-body p {
    margin: 0;
    font-size: .85rem;
    font-weight: 700;
}

.ap-approval-step-body span {
    font-size: .76rem;
    color: var(--ap-text-muted);
}

/* ===================================================================
   INTEGRAÇÕES (ContaAzul / Omie)
=================================================================== */
.ap-integration-card {
    display: flex;
    align-items: center;
    gap: 1.1rem;
    padding: 1.25rem;
    border: 1px solid var(--ap-border);
    border-radius: var(--ap-radius-lg);
    margin-bottom: 1.1rem;
}

.ap-integration-logo {
    width: 56px;
    height: 56px;
    border-radius: var(--ap-radius);
    background: var(--ap-body-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-family: "Poppins",sans-serif;
    flex-shrink: 0;
}

    .ap-integration-logo.is-contaazul {
        background: #0050ff;
        color: #fff;
    }

    .ap-integration-logo.is-omie {
        background: #3dd598;
        color: #fff;
    }

    .ap-integration-logo.is-simulador {
        background: #7c5cbf;
        color: #fff;
    }

.ap-integration-info {
    flex: 1;
    min-width: 0;
}

    .ap-integration-info h6 {
        margin: 0 0 .2rem;
        font-size: .95rem;
    }

    .ap-integration-info span {
        font-size: .78rem;
        color: var(--ap-text-muted);
    }

.ap-integration-actions {
    display: flex;
    gap: .5rem;
    align-items: center;
}

.ap-integration-date {
    font-size: .78rem;
    color: var(--ap-text-muted);
    white-space: nowrap;
}

/* Status da conexão dentro do modal de Token (separado das credenciais) */
.ap-connection-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    background: var(--ap-body-bg);
    border-radius: var(--ap-radius);
    padding: 1rem 1.1rem;
    margin-top: 1.1rem;
}

.ap-connection-status-info {
    display: flex;
    flex-direction: column;
    gap: .3rem;
}

.ap-connection-status.ap-mb-1 {
    margin-bottom: 1.1rem;
}

/* ===================================================================
   MODAL DETALHADO DE TRANSAÇÃO (rich view — Dados/Valores/Resumo)
=================================================================== */
.ap-trans-modal {
    background: var(--ap-body-bg);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

.ap-trans-scroll {
    overflow-y: auto;
    flex: 1;
}

.ap-trans-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.4rem 1.5rem 1.1rem;
    flex-wrap: wrap;
}

.ap-trans-header-left h3 {
    margin: 0 0 .55rem;
    font-size: 1.4rem;
}

.ap-trans-header-actions {
    display: flex;
    gap: .6rem;
    flex-shrink: 0;
}

.ap-trans-hero {
    background: var(--ap-card-bg);
    border: 1px solid var(--ap-border);
    border-left: 4px solid var(--ap-primary);
    border-radius: var(--ap-radius-lg);
    box-shadow: var(--ap-shadow);
    margin: 0 1.5rem 1.25rem;
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.ap-trans-hero-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--ap-primary-light);
    color: var(--ap-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.7rem;
    flex-shrink: 0;
}

.ap-trans-hero-main {
    flex: 1;
    min-width: 200px;
}

    .ap-trans-hero-main h4 {
        margin: 0 0 .2rem;
        font-size: 1.15rem;
    }

.ap-trans-hero-desc {
    margin: 0 0 .6rem;
    font-size: .95rem;
    color: var(--ap-text-main);
    font-weight: 500;
    line-height: 1.4;
}

.ap-trans-hero-row {
    display: flex;
    gap: 2.5rem;
    flex-wrap: wrap;
}

.ap-trans-hero-field label {
    display: block;
    font-size: .7rem;
    font-weight: 700;
    color: var(--ap-text-muted);
    text-transform: lowercase;
    letter-spacing: .03em;
    margin-bottom: .2rem;
}

    .ap-trans-hero-field label::first-letter {
        text-transform: uppercase;
    }

.ap-trans-hero-field span {
    font-size: .92rem;
    font-weight: 700;
}

    .ap-trans-hero-field span.ap-link-color {
        color: var(--ap-primary);
    }

.ap-trans-hero-divider {
    width: 1px;
    align-self: stretch;
    background: var(--ap-border);
}

.ap-trans-hero-valor label {
    display: block;
    font-size: .75rem;
    color: var(--ap-text-muted);
    margin-bottom: .25rem;
}

.ap-trans-hero-valor span {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--ap-primary);
    font-family: "Poppins",sans-serif;
}

.ap-trans-hero-status {
    text-align: right;
    flex-shrink: 0;
}

    .ap-trans-hero-status .ap-trans-status-title {
        font-size: .7rem;
        font-weight: 700;
        color: var(--ap-text-muted);
        text-transform: uppercase;
        letter-spacing: .04em;
        margin-bottom: .5rem;
    }

    .ap-trans-hero-status small {
        display: block;
        margin-top: .45rem;
        font-size: .74rem;
        color: var(--ap-text-muted);
    }

.ap-trans-cols {
    display: grid;
    grid-template-columns: 1.35fr 1.15fr 1fr;
    gap: 1.1rem;
    padding: 0 1.5rem 1.25rem;
}

@media (max-width: 1100px) {
    .ap-trans-cols {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 720px) {
    .ap-trans-cols {
        grid-template-columns: 1fr;
    }
}

.ap-trans-cols-2 {
    grid-template-columns: 1fr 1fr;
}

@media (max-width: 720px) {
    .ap-trans-cols-2 {
        grid-template-columns: 1fr;
    }
}

.ap-trans-block {
    background: var(--ap-card-bg);
    border: 1px solid var(--ap-border);
    border-radius: var(--ap-radius-lg);
    box-shadow: var(--ap-shadow);
    padding: 1.1rem 1.25rem;
}

.ap-trans-block-title {
    display: flex;
    align-items: center;
    gap: .55rem;
    font-size: .82rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .03em;
    margin-bottom: 1rem;
}

    .ap-trans-block-title i {
        width: 30px;
        height: 30px;
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1rem;
        background: var(--ap-primary-light);
        color: var(--ap-primary);
    }

.ap-trans-block.is-financeiro .ap-trans-block-title i {
    background: var(--ap-success-light);
    color: var(--ap-success);
}

.ap-trans-block.is-resumo .ap-trans-block-title i {
    background: var(--ap-info-light);
    color: var(--ap-info);
}

.ap-trans-block.is-descricao .ap-trans-block-title i {
    background: var(--ap-warning-light);
    color: #c98e00;
}

.ap-trans-block.is-timeline .ap-trans-block-title i {
    background: var(--ap-primary-light);
    color: var(--ap-primary);
}

.ap-trans-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .55rem 0;
    border-bottom: 1px solid var(--ap-border);
    font-size: .84rem;
}

    .ap-trans-row:last-child {
        border-bottom: none;
    }

.ap-trans-row-label {
    display: flex;
    align-items: center;
    gap: .5rem;
    color: var(--ap-text-muted);
    font-weight: 600;
}

    .ap-trans-row-label i {
        font-size: 1rem;
        color: #b6bece;
        flex-shrink: 0;
    }

.ap-trans-row-value {
    font-weight: 700;
    text-align: right;
    color: var(--ap-text-main);
    overflow-wrap: anywhere;
    word-break: break-word;
    max-width: 62%;
}

    .ap-trans-row-value.ap-link-color {
        color: var(--ap-primary);
    }

.ap-trans-row.is-clickable {
    cursor: pointer;
}

    .ap-trans-row.is-clickable .ap-trans-row-value::after {
        content: "\F0142";
        font-family: "Material Design Icons";
        margin-left: .3rem;
        color: #b6bece;
        font-size: .85rem;
    }

.ap-trans-row.is-highlight .ap-trans-row-value {
    color: var(--ap-primary);
    font-size: .95rem;
}

.ap-trans-badge-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .55rem 0;
    border-bottom: 1px solid var(--ap-border);
}

.ap-trans-descricao-box {
    background: var(--ap-body-bg);
    border-radius: var(--ap-radius);
    padding: 1rem;
    min-height: 90px;
    max-height: 260px;
    overflow-y: auto;
    font-size: .85rem;
    color: var(--ap-text-main);
}

/* Aprovadores (substitui o card de descrição quando há mais de um aprovador) */
.ap-aprovadores-box {
    max-height: 260px;
    overflow-y: auto;
    padding-right: .25rem;
}

.ap-aprovador-tag {
    display: flex;
    align-items: center;
    gap: .65rem;
    background: var(--ap-body-bg);
    border-radius: var(--ap-radius);
    padding: .65rem .85rem;
    margin-bottom: .6rem;
}

    .ap-aprovador-tag:last-child {
        margin-bottom: 0;
    }

.ap-aprovador-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--ap-primary-light);
    color: var(--ap-primary-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .8rem;
    flex-shrink: 0;
}

.ap-aprovador-info {
    flex: 1;
    min-width: 0;
}

.ap-aprovador-nome {
    font-size: .84rem;
    font-weight: 700;
    color: var(--ap-text-main);
    margin: 0 0 .25rem;
}

.ap-aprovador-meta {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
    align-items: center;
}

.ap-aprovador-chip {
    font-size: .7rem;
    font-weight: 700;
    color: var(--ap-text-muted);
    background: #fff;
    border: 1px solid var(--ap-border);
    border-radius: 20px;
    padding: .15rem .55rem;
    display: inline-flex;
    align-items: center;
    gap: .3rem;
}

    .ap-aprovador-chip i {
        font-size: .85rem;
    }

    .ap-aprovador-chip.is-escalado {
        background: var(--ap-warning-light);
        color: #c98e00;
        border-color: var(--ap-warning);
    }

    .ap-aprovador-chip.is-automatica {
        background: var(--ap-primary-light);
        color: var(--ap-primary-dark);
        border-color: var(--ap-primary);
    }

.ap-aprovador-tag.is-escalado {
    border: 1px solid var(--ap-warning);
    background: var(--ap-warning-light);
}

.ap-aprovador-tag.is-automatica {
    border: 1px solid var(--ap-primary);
    background: var(--ap-primary-light);
}

.ap-aprovador-status {
    flex-shrink: 0;
}

.ap-trans-info-box {
    margin-top: 1.1rem;
    background: var(--ap-primary-light);
    border-radius: var(--ap-radius-lg);
    padding: 1rem 1.2rem;
    display: flex;
    gap: .75rem;
}

    .ap-trans-info-box i {
        color: var(--ap-primary);
        font-size: 1.2rem;
        flex-shrink: 0;
    }

    .ap-trans-info-box p {
        margin: 0 0 .2rem;
        font-weight: 700;
        font-size: .85rem;
    }

    .ap-trans-info-box span {
        font-size: .8rem;
        color: var(--ap-text-main);
        opacity: .85;
    }

/* timeline (reaproveita estilo, ajustado para bolinhas coloridas) */
.ap-trans-timeline-wrap {
    max-height: 260px;
    overflow-y: auto;
    padding-right: .25rem;
}

.ap-trans-timeline {
    list-style: none;
    margin: 0;
    padding: 0;
}

    .ap-trans-timeline li {
        display: flex;
        gap: .85rem;
        padding-bottom: 1.15rem;
        position: relative;
    }

        .ap-trans-timeline li::before {
            content: "";
            position: absolute;
            left: 6px;
            top: 18px;
            bottom: 0;
            width: 2px;
            background: var(--ap-border);
        }

        .ap-trans-timeline li:last-child::before {
            display: none;
        }

.ap-trans-timeline-dot {
    width: 13px;
    height: 13px;
    border-radius: 50%;
    margin-top: 3px;
    flex-shrink: 0;
    z-index: 1;
}

    .ap-trans-timeline-dot.is-done,
    .ap-trans-timeline-dot.is-aprovada {
        background: var(--ap-success);
    }

    .ap-trans-timeline-dot.is-active,
    .ap-trans-timeline-dot.is-pendente {
        background: var(--ap-primary);
    }

    .ap-trans-timeline-dot.is-pending {
        background: #cfd5e2;
    }

    .ap-trans-timeline-dot.is-reprovada {
        background: var(--ap-danger);
    }

    .ap-trans-timeline-dot.is-atencao {
        background: var(--ap-warning);
    }

.ap-trans-timeline-body p {
    margin: 0;
    font-size: .85rem;
    font-weight: 700;
}

.ap-trans-timeline-body span {
    font-size: .78rem;
    color: var(--ap-text-muted);
}

/* ===================================================================
   TOASTR — customização visual para seguir a identidade do Agnospay
=================================================================== */
#toast-container > div {
    border-radius: var(--ap-radius-lg) !important;
    box-shadow: var(--ap-shadow-md) !important;
    opacity: 1 !important;
    font-family: "Nunito",sans-serif !important;
    padding: 14px 16px 14px 50px !important;
    background-position: 16px center !important;
    background-size: 20px !important;
}

#toast-container > .toast-success {
    background-color: var(--ap-success) !important;
}

#toast-container > .toast-error {
    background-color: var(--ap-danger) !important;
}

#toast-container > .toast-info {
    background-color: var(--ap-info) !important;
}

#toast-container > .toast-warning {
    background-color: var(--ap-warning) !important;
    color: #5c4400 !important;
}

#toast-container > div .toast-title {
    font-weight: 800 !important;
    font-size: .88rem !important;
    margin-bottom: .15rem !important;
}

#toast-container > div .toast-message {
    font-size: .83rem !important;
}

.toast-progress {
    opacity: .5 !important;
}

/* ===================================================================
   MODAL GLOBAL DE CONFIRMAÇÃO — usado em inclusões, alterações, exclusões
=================================================================== */
.ap-confirm-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(31,35,55,.6);
    z-index: 1090; /* acima do modal de detalhe */
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

    .ap-confirm-backdrop.show {
        display: flex;
    }

.ap-confirm-box {
    background: var(--ap-card-bg);
    border-radius: var(--ap-radius-lg);
    width: 100%;
    max-width: 400px;
    padding: 1.75rem;
    text-align: center;
    box-shadow: 0 20px 60px rgba(20,24,45,.35);
    animation: ap-modal-in .2s ease;
}

.ap-confirm-icon {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    background: var(--ap-primary-light);
    color: var(--ap-primary);
}

    .ap-confirm-icon.is-danger {
        background: var(--ap-danger-light);
        color: var(--ap-danger);
    }

    .ap-confirm-icon.is-success {
        background: var(--ap-success-light);
        color: var(--ap-success);
    }

.ap-confirm-box h5 {
    margin: 0 0 .5rem;
    font-size: 1.1rem;
}

.ap-confirm-box p {
    margin: 0 0 1.5rem;
    font-size: .87rem;
    color: var(--ap-text-muted);
}

.ap-confirm-actions {
    display: flex;
    gap: .65rem;
    justify-content: center;
}

    .ap-confirm-actions .ap-btn {
        flex: 1;
    }

/* ===================================================================
   TOGGLE SWITCH (ex.: "Alçada Ativa", "Permitir Aprovação Automática")
=================================================================== */
.ap-toggle {
    display: inline-flex;
    align-items: center;
    gap: .6rem;
    cursor: pointer;
    user-select: none;
}

    .ap-toggle input {
        position: absolute;
        opacity: 0;
        width: 0;
        height: 0;
    }

.ap-toggle-track {
    width: 42px;
    height: 24px;
    border-radius: 30px;
    background: #d7dce6;
    position: relative;
    flex-shrink: 0;
    transition: background var(--ap-transition);
}

    .ap-toggle-track::before {
        content: "";
        position: absolute;
        top: 3px;
        left: 3px;
        width: 18px;
        height: 18px;
        border-radius: 50%;
        background: #fff;
        box-shadow: 0 1px 3px rgba(0,0,0,.25);
        transition: transform var(--ap-transition);
    }

.ap-toggle input:checked + .ap-toggle-track {
    background: var(--ap-primary);
}

    .ap-toggle input:checked + .ap-toggle-track::before {
        transform: translateX(18px);
    }

.ap-toggle-label {
    font-size: .85rem;
    font-weight: 600;
    color: var(--ap-text-main);
}

.ap-toggle.is-disabled {
    opacity: .55;
    cursor: not-allowed;
}

/* ===================================================================
   ABAS (tabs) — ex.: "Regras da Alçada" / "Métricas"
=================================================================== */
.ap-tabs {
    display: flex;
    gap: .25rem;
    border-bottom: 1px solid var(--ap-border);
    padding: 0 1.4rem;
}

.ap-tab-link {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .85rem 1.1rem;
    font-size: .85rem;
    font-weight: 700;
    color: var(--ap-text-muted);
    border: none;
    background: transparent;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color var(--ap-transition), border-color var(--ap-transition);
}

    .ap-tab-link:hover {
        color: var(--ap-text-main);
    }

    .ap-tab-link.active {
        color: var(--ap-primary);
        border-bottom-color: var(--ap-primary);
    }

.ap-tab-panel {
    display: none;
}

    .ap-tab-panel.active {
        display: block;
    }

/* Wrapper opcional pra evitar que o modal mude de altura ao trocar de aba —
   sem isso, cada .ap-tab-panel só existe no fluxo quando está .active
   (display:none/block), então o modal encolhe/cresce conforme o conteúdo da
   aba atual. Com display:grid + todas as abas na mesma célula (grid-area
   1/1), a altura do grid vira a do MAIOR painel, e a troca de aba passa a
   ser só visibility — a altura do modal fica estável. Envolver os
   .ap-tab-panel de uma tela com <div class="ap-tab-content"> pra usar. */
.ap-tab-content {
    display: grid;
}

    .ap-tab-content > .ap-tab-panel {
        grid-area: 1 / 1;
        display: block;
        visibility: hidden;
        pointer-events: none;
    }

    .ap-tab-content > .ap-tab-panel.active {
        visibility: visible;
        pointer-events: auto;
    }

/* ===================================================================
   ALÇADA — layout de duas colunas (Regras / Aprovadores)
=================================================================== */
.ap-alcada-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
    background: var(--ap-card-bg);
    border: 1px solid var(--ap-border);
    border-radius: var(--ap-radius-lg);
    box-shadow: var(--ap-shadow);
    padding: 1.1rem 1.4rem;
    margin: 0 1.4rem 1.1rem;
}

    .ap-alcada-top .ap-form-group {
        margin-bottom: 0;
        min-width: 380px;
    }

.ap-alcada-cols {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: 1.1rem;
    padding: 1.25rem 1.4rem 1.4rem;
}

    .ap-alcada-cols.ap-cols-1 {
        grid-template-columns: 1fr;
    }

    .ap-alcada-cols.ap-cols-equal {
        grid-template-columns: 1fr 1fr;
    }

@media (max-width: 860px) {
    .ap-alcada-cols.ap-cols-equal {
        grid-template-columns: 1fr;
    }
}

/* ===================================================================
   PAINÉIS DE CONFIGURAÇÃO (Configuracao/Det.cshtml)
   Título + subtítulo à esquerda, controle de edição à direita.
=================================================================== */
.ap-config-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 1.05rem 1.25rem;
    border-bottom: 1px solid var(--ap-border);
}

    .ap-config-item:last-child {
        border-bottom: none;
    }

.ap-config-info {
    flex: 1;
    min-width: 0;
}

.ap-config-title {
    font-size: .86rem;
    font-weight: 700;
    margin: 0 0 .25rem;
    color: var(--ap-text-main);
}

.ap-config-subtitle {
    font-size: .78rem;
    color: var(--ap-text-muted);
    line-height: 1.4;
}

.ap-config-control {
    flex-shrink: 0;
    min-width: 150px;
}

    .ap-config-control .ap-select, .ap-config-control .ap-input {
        min-width: 150px;
    }

/* ===================================================================
   MEU PERFIL — avatar grande e cabeçalho do card de dados pessoais
=================================================================== */
.ap-profile-header {
    display: flex;
    align-items: center;
    gap: 1.1rem;
    margin-bottom: 1.4rem;
}

.ap-profile-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--ap-primary-light);
    color: var(--ap-primary-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.6rem;
    flex-shrink: 0;
}

.ap-profile-header h5 {
    margin: 0 0 .2rem;
    font-size: 1.05rem;
}

.ap-profile-header span {
    font-size: .82rem;
    color: var(--ap-text-muted);
}

@media (max-width: 860px) {
    .ap-alcada-cols {
        grid-template-columns: 1fr;
    }
}

.ap-alcada-block {
    background: var(--ap-card-bg);
    border: 1px solid var(--ap-border);
    border-radius: var(--ap-radius-lg);
    box-shadow: var(--ap-shadow);
    overflow: hidden;
}

.ap-alcada-block-head {
    padding: .9rem 1.25rem;
    background: var(--ap-body-bg);
    border-bottom: 1px solid var(--ap-border);
    font-size: .85rem;
    font-weight: 800;
}

/* Variante do cabeçalho de bloco com um botão de ação (ex.: "Adicionar contato")
   alinhado à direita do título. */
.ap-alcada-block-head-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .6rem;
}

.ap-alcada-block-body {
    padding: 1.25rem;
}

/* ── Linha de configuração de canal (Configurações do Sistema) ────────────── */
.ap-config-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .85rem 0;
    border-bottom: 1px solid var(--ap-border);
}

.ap-config-row:last-child {
    border-bottom: none;
}

.ap-config-row-label {
    flex: 1;
}

.ap-config-row-label strong {
    display: flex;
    align-items: center;
    gap: .4rem;
    font-size: 14px;
    color: var(--ap-text);
    margin-bottom: 3px;
}

.ap-config-row-label small {
    font-size: 12px;
    color: var(--ap-text-muted);
    line-height: 1.4;
}

.ap-config-row-input {
    display: flex;
    align-items: center;
    gap: .4rem;
    flex-shrink: 0;
}

.ap-config-row-input .ap-input {
    width: 90px;
    text-align: center;
}

.ap-input-unit {
    font-size: 12px;
    color: var(--ap-text-muted);
    white-space: nowrap;
}

/* ── Toggle switch (Configurações) ───────────────────────────────────── */
.ap-config-row-toggle .ap-toggle {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 24px;
    flex-shrink: 0;
}
.ap-config-row-toggle .ap-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}
.ap-config-row-toggle .ap-toggle-track {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #cdd4dc;
    border-radius: 24px;
    transition: background .2s;
}
.ap-config-row-toggle .ap-toggle-track::before {
    content: "";
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform .2s;
}
.ap-config-row-toggle .ap-toggle input:checked + .ap-toggle-track { background: var(--ap-primary); }
.ap-config-row-toggle .ap-toggle input:checked + .ap-toggle-track::before { transform: translateX(18px); }

.ap-config-row-toggle { flex-shrink: 0; }

.ap-config-row-icon {
    width: 32px;
    text-align: center;
    font-size: 20px;
    color: var(--ap-primary);
    flex-shrink: 0;
}

.ap-config-row-actions { flex-shrink: 0; }

.ap-btn-sm {
    padding: 5px 12px;
    font-size: 12px;
}

.ap-approvers-list {
    max-height: 340px;
    overflow-y: auto;
}

.ap-approver-item {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .7rem 1.25rem;
    border-bottom: 1px solid var(--ap-border);
    cursor: pointer;
}

    .ap-approver-item:last-child {
        border-bottom: none;
    }

    .ap-approver-item:hover {
        background: var(--ap-body-bg);
    }

    .ap-approver-item input[type="checkbox"] {
        width: 18px;
        height: 18px;
        accent-color: var(--ap-primary);
        cursor: pointer;
        flex-shrink: 0;
    }

    .ap-approver-item span {
        font-size: .85rem;
        font-weight: 600;
        color: var(--ap-text-main);
    }

.ap-approvers-counter {
    padding: .7rem 1.25rem;
    border-top: 1px solid var(--ap-border);
    font-size: .78rem;
    color: var(--ap-text-muted);
    background: var(--ap-body-bg);
}

    .ap-approvers-counter strong {
        color: var(--ap-primary);
    }

.ap-form-group.is-invalid .ap-input,
.ap-form-group.is-invalid .ap-select {
    border-color: var(--ap-danger);
    background: var(--ap-danger-light);
}

.ap-field-error {
    font-size: .72rem;
    color: var(--ap-danger);
    font-weight: 700;
    margin-top: .3rem;
    display: none;
}

.ap-form-group.is-invalid .ap-field-error {
    display: block;
}

/* ===================================================================
   CANAIS DE APROVAÇÃO (Aprovador/Det.cshtml) — e-mail, WhatsApp, Telegram
=================================================================== */
.ap-channel-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--ap-border);
    flex-wrap: wrap;
}

    .ap-channel-item:last-child {
        border-bottom: none;
    }

.ap-channel-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
    background: var(--ap-primary-light);
    color: var(--ap-primary);
}

    .ap-channel-icon.is-whatsapp {
        background: var(--ap-success-light);
        color: var(--ap-success);
    }

    .ap-channel-icon.is-telegram {
        background: var(--ap-info-light);
        color: var(--ap-info);
    }

.ap-channel-info {
    flex: 1;
    min-width: 200px;
}

.ap-channel-label {
    font-size: .85rem;
    font-weight: 700;
    margin: 0 0 .35rem;
}

.ap-channel-info .ap-input {
    width: 100%;
    max-width: 420px;
}

.ap-channel-actions {
    display: flex;
    align-items: center;
    gap: .65rem;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.ap-channel-badge-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .2rem;
}

.ap-channel-validated-date {
    font-size: .7rem;
    color: #6c757d;
    white-space: nowrap;
}

.ap-channel-code-row {
    display: flex;
    gap: .5rem;
    align-items: center;
    margin-top: .65rem;
    flex-basis: 100%;
}

    .ap-channel-code-row .ap-input {
        max-width: 160px;
    }

/* ===================================================================
   LOG DE AUDITORIA — caixa para exibir dados (JSON) antes/depois
=================================================================== */
.ap-log-json-box {
    background: var(--ap-body-bg);
    border-radius: var(--ap-radius);
    padding: 1rem;
    max-height: 220px;
    overflow-y: auto;
    font-family: "Courier New", monospace;
    font-size: .78rem;
    color: var(--ap-text-main);
    white-space: pre-wrap;
    word-break: break-word;
}

/* ===================================================================
   LOGIN (inspirado no fluxo ContaAzul)
=================================================================== */
.ap-login-screen {
    min-height: 100vh;
    display: flex;
    background: var(--ap-body-bg);
}

.ap-login-aside {
    flex: 1.1;
    background: linear-gradient(135deg, var(--ap-primary) 0%, #2f3bc7 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 4rem 4.5rem;
    position: relative;
    overflow: hidden;
}

    .ap-login-aside::before {
        content: "";
        position: absolute;
        width: 420px;
        height: 420px;
        border-radius: 50%;
        background: rgba(255,255,255,.07);
        top: -120px;
        right: -120px;
    }

    .ap-login-aside::after {
        content: "";
        position: absolute;
        width: 280px;
        height: 280px;
        border-radius: 50%;
        background: rgba(255,255,255,.06);
        bottom: -90px;
        left: -60px;
    }

    .ap-login-aside .ap-logo-mark {
        width: 46px;
        height: 46px;
        border-radius: 12px;
        background: rgba(255,255,255,.15);
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 800;
        font-size: 1.3rem;
        margin-bottom: 2rem;
    }

        .ap-login-aside .ap-logo-mark img {
            width: 28px;
            height: auto;
        }

    .ap-login-aside h2 {
        color: #fff;
        font-size: 2rem;
        max-width: 420px;
        margin-bottom: 1rem;
        position: relative;
    }

    .ap-login-aside p {
        color: rgba(255,255,255,.8);
        max-width: 380px;
        font-size: .95rem;
        position: relative;
    }

.ap-login-feature {
    display: flex;
    align-items: center;
    gap: .7rem;
    margin-top: 1.6rem;
    font-size: .85rem;
    color: rgba(255,255,255,.92);
    position: relative;
}

    .ap-login-feature i {
        font-size: 1.1rem;
    }

.ap-login-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem;
}

.ap-login-form-box {
    width: 100%;
    max-width: 400px;
}

    .ap-login-form-box .ap-login-logo {
        height: 34px;
        width: auto;
        margin-bottom: 2rem;
    }

    .ap-login-form-box h3 {
        font-size: 1.5rem;
        margin-bottom: .3rem;
    }

    .ap-login-form-box .ap-sub {
        color: var(--ap-text-muted);
        font-size: .9rem;
        margin-bottom: 1.8rem;
    }

.ap-btn-contaazul {
    width: 100%;
    background: #0050ff;
    color: #fff;
    padding: .8rem 1rem;
    border-radius: var(--ap-radius);
    border: none;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .6rem;
    cursor: pointer;
    margin-bottom: 1rem;
    transition: background var(--ap-transition);
}

    .ap-btn-contaazul:hover {
        background: #0040cc;
    }

.ap-login-divider {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin: 1.4rem 0;
    color: var(--ap-text-muted);
    font-size: .78rem;
}

    .ap-login-divider::before, .ap-login-divider::after {
        content: "";
        flex: 1;
        height: 1px;
        background: var(--ap-border);
    }

.ap-login-form-box .ap-input {
    width: 100%;
    min-width: 0;
    margin-bottom: 1rem;
}

.ap-login-form-box label {
    font-size: .78rem;
    font-weight: 700;
    color: var(--ap-text-muted);
    margin-bottom: .35rem;
    display: block;
    text-transform: lowercase;
    letter-spacing: .03em;
}

    .ap-login-form-box label::first-letter {
        text-transform: uppercase;
    }

.ap-login-form-box .ap-btn-primary {
    width: 100%;
    padding: .75rem;
}

.ap-login-foot {
    text-align: center;
    margin-top: 1.6rem;
    font-size: .82rem;
    color: var(--ap-text-muted);
}

/* Tela de seleção de empresa (impersonation do usuário corporativo) —
   reaproveita .ap-login-form-box, só alarga pro combo de empresas. */
.ap-empresa-select-box {
    max-width: 480px;
}

.ap-empresa-select-box .ap-select {
    margin-bottom: 1rem;
}

@media (max-width: 991px) {
    .ap-login-aside {
        display: none;
    }
}

/* ===================================================================
   RESPONSIVE / SIDEBAR MOBILE
=================================================================== */
@media (max-width: 991px) {
    .ap-sidebar {
        transform: translateX(-100%);
        width: var(--ap-sidebar-width);
    }

        .ap-sidebar.mobile-open {
            transform: translateX(0);
        }

    .ap-content-wrapper {
        margin-left: 0 !important;
    }

    .ap-kpi-grid {
        grid-template-columns: repeat(2,1fr);
    }
}

/* scrollbar discreto */
.ap-sidebar-menu::-webkit-scrollbar, .ap-notif-list::-webkit-scrollbar, .ap-modal-body::-webkit-scrollbar, .ap-limit-list::-webkit-scrollbar, .ap-aprovadores-box::-webkit-scrollbar, .ap-trans-timeline-wrap::-webkit-scrollbar {
    width: 6px;
}

.ap-sidebar-menu::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,.12);
    border-radius: 4px;
}

.ap-notif-list::-webkit-scrollbar-thumb, .ap-modal-body::-webkit-scrollbar-thumb, .ap-limit-list::-webkit-scrollbar-thumb, .ap-aprovadores-box::-webkit-scrollbar-thumb, .ap-trans-timeline-wrap::-webkit-scrollbar-thumb {
    background: var(--ap-border);
    border-radius: 4px;
}

.ap-helper-text {
    font-size: .76rem;
    color: var(--ap-text-muted);
    margin-top: .3rem;
}

.ap-required::after {
    content: " *";
    color: var(--ap-danger);
}

.is-hidden {
    display: none !important;
}

.ap-mt-1 {
    margin-top: 1rem;
}

/* ===================================================================
   DASHBOARD — KPI CARDS VARIANTE VIOLET (desempenho / financeiro)
=================================================================== */
.ap-kpi-card.is-violet .ap-kpi-icon {
    background: #ede9ff;
    color: #7c3aed;
}
.ap-kpi-card.is-violet .ap-kpi-value {
    color: #7c3aed;
}
.ap-kpi-card.is-cyan .ap-kpi-icon {
    background: #d0f5f5;
    color: #0891b2;
}
.ap-kpi-card.is-cyan .ap-kpi-value {
    color: #0891b2;
}

.ap-kpi-sub {
    font-size: .7rem;
    color: var(--ap-text-muted);
    margin-top: .1rem;
    font-style: italic;
}

/* ===================================================================
   DASHBOARD — LINHAS DE GRÁFICO COM COLUNAS IGUAIS E COM MARGEM
=================================================================== */
.ap-chart-row-equal {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}
@media (max-width:991px) {
    .ap-chart-row-equal { grid-template-columns: 1fr; }
}
.ap-chart-row-mb {
    margin-bottom: 1.25rem;
}
.ap-chart-box-lg {
    position: relative;
    height: 260px;
}

/* ===================================================================
   DASHBOARD — RANKING DE APROVADORES
=================================================================== */
.ap-rank-list {
    display: flex;
    flex-direction: column;
    gap: .75rem;
}
.ap-rank-item {
    display: flex;
    align-items: center;
    gap: .65rem;
}
.ap-rank-pos {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--ap-primary-light);
    color: var(--ap-primary);
    font-size: .68rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.ap-rank-name {
    flex: 1;
    font-size: .83rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ap-rank-bar-wrap {
    flex: 1.2;
    background: #eef0f5;
    border-radius: 999px;
    height: 6px;
    overflow: hidden;
}
.ap-rank-bar {
    height: 100%;
    border-radius: 999px;
    background: var(--ap-primary);
    transition: width .4s ease;
}
.ap-rank-bar.is-slow {
    background: #0ea5c4;
}
.ap-rank-value {
    font-size: .8rem;
    font-weight: 700;
    color: var(--ap-primary);
    white-space: nowrap;
    min-width: 52px;
    text-align: right;
}
.ap-rank-value.is-slow {
    color: #0891b2;
}

/* ===================================================================
   DASHBOARD — LANÇAMENTOS CRÍTICOS (SLA VENCIDO)
=================================================================== */
.ap-pending-list {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}
.ap-pending-item {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .55rem .8rem;
    background: var(--ap-body-bg);
    border-radius: var(--ap-radius);
    border-left: 3px solid var(--ap-primary);
}
.ap-pending-item.is-urgent {
    border-left-color: #0ea5c4;
}
.ap-pending-info {
    flex: 1;
    min-width: 0;
}
.ap-pending-name {
    font-size: .83rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ap-pending-meta {
    font-size: .72rem;
    color: var(--ap-text-muted);
}
.ap-pending-right {
    text-align: right;
    flex-shrink: 0;
}
.ap-pending-amount {
    display: block;
    font-size: .85rem;
    font-weight: 700;
    color: var(--ap-text);
}
.ap-pending-age {
    display: block;
    font-size: .7rem;
    font-weight: 600;
    color: #0891b2;
}

/* ===================================================================
   DASHBOARD — KPI CARDS MINIMALISTAS
=================================================================== */
.ap-kpi-stat {
    background: var(--ap-card-bg);
    border: 1px solid var(--ap-border);
    border-radius: var(--ap-radius-lg);
    box-shadow: var(--ap-shadow);
    padding: 1.2rem 1.4rem 1.15rem;
    position: relative;
    overflow: hidden;
}

.ap-kpi-stat-label {
    font-size: .7rem;
    font-weight: 600;
    color: var(--ap-text-muted);
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: .45rem;
}

.ap-kpi-stat-value {
    font-size: 2.4rem;
    font-weight: 700;
    font-family: "Poppins", sans-serif;
    line-height: 1;
}

.ap-kpi-stat-icon {
    position: absolute;
    top: 1rem;
    right: 1.1rem;
    font-size: 1.7rem;
    opacity: .15;
}

.ap-kpi-stat.is-pending  .ap-kpi-stat-value,
.ap-kpi-stat.is-pending  .ap-kpi-stat-icon  { color: #3b82f6; }

.ap-kpi-stat.is-approved .ap-kpi-stat-value,
.ap-kpi-stat.is-approved .ap-kpi-stat-icon  { color: var(--ap-primary); }

.ap-kpi-stat.is-rejected .ap-kpi-stat-value,
.ap-kpi-stat.is-rejected .ap-kpi-stat-icon  { color: #2f5f9e; }

.ap-kpi-stat.is-attention .ap-kpi-stat-value,
.ap-kpi-stat.is-attention .ap-kpi-stat-icon { color: #0ea5c4; }

/* Dashboard — grid de cards (barra maior + donut menor [+ limites diários] [+ SLA]
   [+ atividade recente]). Limites Diários e SLA só aparecem condicionalmente (ver
   Index.cshtml), então os cards de baixo usam classes explícitas em vez de :nth-child
   — a posição deles no DOM muda dependendo do que está visível. */
.ap-dash-charts {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 1.25rem;
    margin-top: .25rem;
}

/* Quando há 3+ cards (limites diários e/ou SLA visíveis), expande para 3 colunas */
.ap-dash-charts:has(> :nth-child(3)) {
    grid-template-columns: 1.5fr 1fr 1fr;
}

/* SLA sempre na coluna larga (1.5fr) — mesma largura do card "Transações por mês",
   cai naturalmente numa nova linha assim que a coluna 1 da linha anterior já está ocupada. */
.ap-dash-card-sla {
    grid-column: 1;
}

/* Atividade Recente ocupa as duas colunas estreitas restantes ao lado do SLA. */
.ap-dash-card-wide {
    grid-column: span 2;
}

@media (max-width: 1199px) {
    .ap-dash-charts:has(> :nth-child(3)) { grid-template-columns: 1.5fr 1fr; }
    .ap-dash-charts:has(> :nth-child(3)) > :nth-child(3) { grid-column: 1 / -1; }
}

@media (max-width: 991px) {
    .ap-dash-charts { grid-template-columns: 1fr; }
}

/* Caixa de gráfico compacta para o dashboard minimalista */
.ap-chart-box-sm {
    position: relative;
    height: 220px;
}

/* Subtítulo de período no header dos cards de gráfico */
.ap-dash-period {
    font-size: .73rem;
    color: var(--ap-text-muted);
    font-weight: 500;
}

/* ── Métricas de SLA por aprovador ─────────────────────────────────────── */
.ap-sla-section {
    margin-top: 1.5rem;
}

.ap-sla-mini-kpis {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.ap-sla-mini-kpi {
    flex: 1;
    min-width: 150px;
    background: var(--ap-surface);
    border: 1px solid var(--ap-border);
    border-radius: 8px;
    padding: .9rem 1.1rem;
    text-align: center;
}

.ap-sla-mini-kpi .ap-sla-mini-value {
    font-size: 24px;
    font-weight: 700;
    line-height: 1.1;
    color: var(--ap-primary);
}

.ap-sla-mini-kpi.is-warn  .ap-sla-mini-value { color: #f7b731; }
.ap-sla-mini-kpi.is-alert .ap-sla-mini-value { color: #e8400c; }

.ap-sla-mini-kpi .ap-sla-mini-label {
    font-size: 11px;
    color: var(--ap-text-muted);
    margin-top: 4px;
    line-height: 1.3;
}

.ap-sla-empty {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--ap-text-muted);
    font-size: 14px;
}

.ap-sla-empty i {
    display: block;
    font-size: 32px;
    margin-bottom: .5rem;
    opacity: .4;
}

.ap-sla-controls {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
}

.ap-sla-select {
    height: 34px;
    padding: 0 .75rem;
    font-size: 13px;
    min-width: 180px;
    max-width: 260px;
}

/* ── Limites diários: lista de linhas com barra de progresso ── */
.ap-limit-list {
    display: flex;
    flex-direction: column;
    gap: .9rem;
    max-height: 320px;
    overflow-y: auto;
    padding-right: .5rem;
}

.ap-limit-item {
    display: flex;
    flex-direction: column;
    gap: .35rem;
}

.ap-limit-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
}

.ap-limit-name {
    font-size: .82rem;
    font-weight: 600;
    color: var(--ap-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 55%;
}

.ap-limit-right {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-shrink: 0;
}

.ap-limit-values {
    font-size: .78rem;
    color: var(--ap-text-muted);
}

.ap-limit-values strong {
    color: var(--ap-text);
    font-weight: 600;
}

.ap-limit-sep {
    margin: 0 .2rem;
    opacity: .45;
}

.ap-limit-badge {
    font-size: .72rem;
    font-weight: 700;
    padding: .15rem .55rem;
    border-radius: 20px;
    background: rgba(83,105,248,.12);
    color: #5369f8;
    min-width: 3rem;
    text-align: center;
}

.ap-limit-badge.is-warn {
    background: rgba(255,165,0,.13);
    color: #e08000;
}

.ap-limit-badge.is-over {
    background: rgba(220,53,69,.13);
    color: #dc3545;
}

.ap-limit-track {
    position: relative;
    height: 8px;
    background: #eef0f7;
    border-radius: 8px;
    overflow: visible;
}

.ap-limit-fill {
    height: 100%;
    border-radius: 8px;
    background: linear-gradient(90deg, #5369f8 0%, #7b8ff8 100%);
    transition: width .4s ease;
    max-width: 100%;
}

.ap-limit-fill.is-over {
    background: linear-gradient(90deg, #dc3545 0%, #e8707b 100%);
    max-width: 100%;
}

.ap-limit-over-msg {
    font-size: .72rem;
    color: #dc3545;
    display: flex;
    align-items: center;
    gap: .3rem;
    margin-top: .05rem;
}

.ap-limit-over-msg .mdi {
    font-size: .85rem;
}

/* ===================================================================
   SUBMENU DA SIDEBAR
   =================================================================== */
.ap-menu-toggle {
    cursor: pointer;
}
.ap-menu-arrow {
    margin-left: auto;
    font-size: .9rem;
    flex-shrink: 0;
    transition: transform var(--ap-transition);
}
.ap-menu-has-sub.open > .ap-menu-toggle .ap-menu-arrow {
    transform: rotate(180deg);
}
.ap-submenu {
    list-style: none;
    padding: 0;
    overflow: hidden;
    max-height: 0;
    transition: max-height .3s ease;
}
.ap-menu-has-sub.open > .ap-submenu {
    max-height: 300px;
}
.ap-submenu-link {
    font-size: .82rem;
    padding: .5rem .75rem .5rem 2rem;
}
.ap-submenu-link i {
    font-size: .95rem;
}
.ap-sidebar.collapsed .ap-submenu {
    display: none;
}

/* ===================================================================
   PÁGINA DE VALIDAÇÃO DE CANAL (/Validacao/Canal)
   =================================================================== */
.ap-validation-wrap {
    display: flex;
    justify-content: center;
    padding: 2rem 1rem;
}
.ap-validation-card {
    width: 100%;
    max-width: 480px;
    padding: 2.5rem 2rem;
    text-align: center;
}
.ap-validation-icon {
    font-size: 3rem;
    color: var(--ap-primary);
    display: block;
    margin-bottom: .75rem;
}
.ap-validation-title {
    font-family: 'Poppins', sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--ap-text);
    margin: 0 0 .5rem;
}
.ap-validation-desc {
    font-size: .9rem;
    color: var(--ap-text-muted);
    margin: 0 0 1.75rem;
    line-height: 1.6;
}
.ap-validation-input-group {
    text-align: left;
    margin-bottom: 1.25rem;
}
.ap-validation-input {
    font-size: 1.5rem;
    letter-spacing: .35rem;
    text-align: center;
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
}
.ap-validation-footer {
    margin-top: 1.5rem;
}
.ap-btn-full {
    width: 100%;
    justify-content: center;
}
.ap-validation-result {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: .5rem 0;
}
.ap-validation-ok .ap-validation-icon {
    color: #22c55e;
}
.ap-alert {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .75rem 1rem;
    border-radius: var(--ap-radius);
    font-size: .85rem;
    margin-bottom: 1rem;
    text-align: left;
}
.ap-alert-danger {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

/* ===================== INPUT COM BOTÃO OLHO (reveal) ===================== */
.ap-input-reveal-wrap {
    position: relative;
}

    .ap-input-reveal-wrap .ap-input {
        padding-right: 2.4rem;
    }

/* No login, .ap-login-form-box .ap-input tem margin-bottom própria (os modais não têm).
   Essa margem, mesmo "colapsando" visualmente pra fora do wrapper, ainda é considerada por
   alguns navegadores no cálculo do top:50% do botão (containing block relative), empurrando
   o ícone pro rodapé da caixa. Solução: tira a margem do input e recoloca no wrapper — assim
   o containing block do botão fica com a altura exata do input, sem ambiguidade. */
.ap-login-form-box .ap-input-reveal-wrap {
    margin-bottom: 1rem;
}

    .ap-login-form-box .ap-input-reveal-wrap .ap-input {
        margin-bottom: 0;
    }

.ap-input-reveal-btn {
    position: absolute;
    top: 50%;
    right: .55rem;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: var(--ap-text-muted);
    font-size: 1.1rem;
    line-height: 1;
    display: flex;
    align-items: center;
}

    .ap-input-reveal-btn:hover {
        color: var(--ap-primary);
    }
