/*
 * EngPoint UI 3.0
 * Camada visual compartilhada por todo o portal.
 * Mantém o Bootstrap como base e concentra aqui os ajustes de produto.
 */
@font-face{font-family:Roboto;src:url('../fonts/roboto-regular.woff2') format('woff2');font-weight:400;font-style:normal;font-display:swap}
@font-face{font-family:Roboto;src:url('../fonts/roboto-medium.woff2') format('woff2');font-weight:500 600;font-style:normal;font-display:swap}
@font-face{font-family:Roboto;src:url('../fonts/roboto-bold.woff2') format('woff2');font-weight:700 900;font-style:normal;font-display:swap}

:root{
    --ep-ink:#111827;
    --ep-ink-2:#374151;
    --ep-muted:#6b7280;
    --ep-faint:#9ca3af;
    --ep-paper:#f5f7fa;
    --ep-surface:#fff;
    --ep-line:#e5e9f0;
    --ep-line-soft:#edf0f5;
    --ep-primary:#2563eb;
    --ep-primary-dark:#1d4ed8;
    --ep-primary-soft:#eff4ff;
    --ep-success:#15803d;
    --ep-success-soft:#e9f7ee;
    --ep-warning:#b45309;
    --ep-warning-soft:#fef4e4;
    --ep-danger:#b91c1c;
    --ep-danger-soft:#fdedec;
    --ep-radius:12px;
    --ep-radius-lg:16px;
    --ep-shadow:0 1px 2px rgba(15,23,42,.05),0 8px 28px rgba(15,23,42,.035);
    --ep-sidebar:248px;
    --ep-topbar:68px;
    --bs-primary:#2563eb;
    --bs-primary-rgb:37,99,235;
    --bs-body-font-family:Roboto,-apple-system,BlinkMacSystemFont,"Segoe UI",Arial,sans-serif;
}

html{background:var(--ep-paper);scroll-behavior:smooth}
body{
    min-width:320px;
    background:var(--ep-paper)!important;
    color:var(--ep-ink);
    font-family:Roboto,-apple-system,BlinkMacSystemFont,"Segoe UI",Arial,sans-serif!important;
    font-size:14px;
    -webkit-font-smoothing:antialiased;
    text-rendering:optimizeLegibility;
}
button,input,select,textarea{font:inherit}
a{text-underline-offset:3px}
:focus-visible{outline:3px solid rgba(37,99,235,.22)!important;outline-offset:2px}

/* Estrutura principal */
#layout-wrapper{min-height:100vh}
.main-content{margin-left:var(--ep-sidebar)!important;min-height:100vh;overflow:visible}
.page-content{padding:calc(var(--ep-topbar) + 26px) 28px 84px!important;min-height:calc(100vh - 60px)}
.container-fluid{max-width:1640px;margin:0 auto}
.footer{left:var(--ep-sidebar)!important;background:transparent!important;border:0!important;color:var(--ep-muted);font-size:12px;padding:16px 28px!important;height:auto!important}

/* Cabeçalho */
#page-topbar{
    height:var(--ep-topbar)!important;
    left:var(--ep-sidebar)!important;
    border-bottom:1px solid var(--ep-line);
    background:rgba(255,255,255,.96)!important;
    box-shadow:none!important;
    backdrop-filter:blur(12px);
}
.navbar-header{height:var(--ep-topbar)!important;padding:0 24px!important;gap:16px}
.ep-mobile-brand{display:none;align-items:center;gap:9px;color:var(--ep-ink);text-decoration:none;font-weight:800;font-size:17px}
.ep-mobile-brand img{width:auto;height:32px;max-width:130px;object-fit:contain}
.ep-topbar-context{min-width:0;display:flex;flex-direction:column;line-height:1.2}
.ep-topbar-context strong{font-size:14px;color:var(--ep-ink)}
.ep-topbar-context span{font-size:11px;color:var(--ep-muted);margin-top:3px}
.ep-topbar-actions{margin-left:auto;display:flex;align-items:center;gap:8px}
.ep-top-icon{
    width:40px;height:40px;display:grid;place-items:center;border:1px solid transparent;
    border-radius:10px;background:transparent;color:var(--ep-ink-2);position:relative
}
.ep-top-icon:hover,.ep-top-icon[aria-expanded="true"]{background:var(--ep-primary-soft);color:var(--ep-primary);border-color:#dbe7ff}
.ep-top-icon .ep-ping{position:absolute;top:8px;right:8px;width:8px;height:8px;border-radius:50%;background:#e15252;border:2px solid #fff}
.ep-profile-button{display:flex;align-items:center;gap:10px;border:0;background:transparent;padding:4px 7px 4px 4px;border-radius:11px;min-width:0}
.ep-profile-button:hover,.ep-profile-button[aria-expanded="true"]{background:var(--ep-line-soft)}
.ep-avatar{width:36px;height:36px;border-radius:50%;display:grid;place-items:center;overflow:hidden;background:var(--ep-primary);color:#fff;font-size:12px;font-weight:800;flex:none}
.ep-avatar img{width:100%;height:100%;object-fit:cover}
.ep-profile-copy{text-align:left;line-height:1.15;min-width:0}
.ep-profile-copy strong{display:block;max-width:180px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:13px;color:var(--ep-ink)}
.ep-profile-copy span{display:block;color:var(--ep-muted);font-size:11px;margin-top:3px}
.ep-topbar-menu{width:min(360px,calc(100vw - 24px));padding:8px;border:1px solid var(--ep-line);border-radius:14px;box-shadow:0 20px 55px rgba(15,23,42,.16)}
.ep-dropdown-head{padding:12px;border-bottom:1px solid var(--ep-line-soft);margin-bottom:5px}
.ep-dropdown-head strong{display:block;color:var(--ep-ink)}
.ep-dropdown-head span{display:block;margin-top:3px;color:var(--ep-muted);font-size:12px;overflow-wrap:anywhere}
.ep-dropdown-item{display:flex;align-items:center;gap:11px;border-radius:9px;padding:10px 11px!important;color:var(--ep-ink-2)!important;font-weight:500}
.ep-dropdown-item:hover{background:var(--ep-primary-soft)!important;color:var(--ep-primary)!important}
.ep-dropdown-item i{width:18px;text-align:center;color:var(--ep-faint)}
.ep-notification-list{max-height:340px;overflow:auto}
.ep-notification{display:flex;gap:11px;padding:11px;border-radius:10px;text-decoration:none;color:var(--ep-ink-2)}
.ep-notification:hover{background:var(--ep-paper);color:var(--ep-ink)}
.ep-notification-icon{width:34px;height:34px;flex:none;border-radius:9px;background:var(--ep-primary-soft);color:var(--ep-primary);display:grid;place-items:center}
.ep-notification-copy{min-width:0;font-size:12px;line-height:1.4}
.ep-notification-copy strong{display:block;font-size:12.5px;color:var(--ep-ink);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ep-notification-copy time{display:block;margin-top:3px;color:var(--ep-muted);font-size:10.5px}

/* Navegação lateral */
.sidebar-left{
    position:fixed!important;inset:0 auto 0 0!important;width:var(--ep-sidebar)!important;
    background:var(--ep-surface)!important;border-right:1px solid var(--ep-line)!important;
    box-shadow:none!important;z-index:1003!important;padding:0 14px 16px
}
.ep-sidebar-brand{height:var(--ep-topbar);display:flex;align-items:center;padding:0 8px;border-bottom:1px solid var(--ep-line-soft);margin-bottom:12px}
.ep-sidebar-brand a{display:flex;align-items:center;text-decoration:none;min-width:0}
.ep-sidebar-brand img{height:39px;width:auto;max-width:172px;object-fit:contain}
.ep-nav-label{padding:13px 11px 6px;color:var(--ep-faint);font-size:10px;font-weight:700;letter-spacing:.09em;text-transform:uppercase}
#sidebar-menu{padding:0!important}
#sidebar-menu .left-menu{padding:0;margin:0;display:flex;flex-direction:column;gap:3px}
#sidebar-menu .left-menu>li{margin:0!important}
#sidebar-menu .left-menu>li>a{
    min-height:42px;display:flex!important;align-items:center;gap:12px;padding:10px 11px!important;
    border-radius:9px;color:var(--ep-ink-2)!important;font-size:13.5px;font-weight:500!important;
    text-decoration:none;position:relative;transition:background .15s ease,color .15s ease
}
#sidebar-menu .left-menu>li>a i{width:18px;margin:0!important;color:var(--ep-faint)!important;font-size:16px!important;text-align:center}
#sidebar-menu .left-menu>li>a:hover{background:var(--ep-line-soft)!important;color:var(--ep-ink)!important}
#sidebar-menu .left-menu>li>a.active,#sidebar-menu .left-menu>li.mm-active>a{
    background:var(--ep-primary-soft)!important;color:var(--ep-primary)!important;font-weight:700!important
}
#sidebar-menu .left-menu>li>a.active i,#sidebar-menu .left-menu>li.mm-active>a i{color:var(--ep-primary)!important}
#sidebar-menu .left-menu>li>a.active:before,#sidebar-menu .left-menu>li.mm-active>a:before{content:"";position:absolute;left:-14px;top:9px;bottom:9px;width:3px;border-radius:0 3px 3px 0;background:var(--ep-primary)}
.ep-sidebar-bottom{position:absolute;left:14px;right:14px;bottom:14px;padding-top:12px;border-top:1px solid var(--ep-line-soft)}
.ep-sidebar-user{display:flex;align-items:center;gap:10px;padding:8px;border-radius:10px;text-decoration:none;color:var(--ep-ink)}
.ep-sidebar-user:hover{background:var(--ep-line-soft);color:var(--ep-ink)}
.ep-sidebar-user-copy{min-width:0;line-height:1.2}
.ep-sidebar-user-copy strong{display:block;font-size:12.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ep-sidebar-user-copy span{display:block;margin-top:3px;font-size:10.5px;color:var(--ep-muted)}
.ep-sidebar-scroll{height:calc(100vh - 150px);overflow:auto;padding-bottom:90px;scrollbar-width:thin}

/* Barra de acesso como cliente */
.ep-impersonation-bar{position:fixed;top:var(--ep-topbar);left:var(--ep-sidebar);right:0;z-index:1001;min-height:42px;background:#fff7ed;border-bottom:1px solid #fed7aa;color:#9a3412;display:flex;align-items:center;justify-content:center;gap:12px;padding:7px 18px;font-size:12.5px;font-weight:600}
.ep-impersonation-bar form{margin:0!important;width:auto!important}
.ep-impersonation-bar button{border:1px solid #fdba74;border-radius:8px;background:#fff;color:#9a3412;padding:5px 9px;font-weight:700}
body.ep-is-impersonating .page-content{padding-top:calc(var(--ep-topbar) + 66px)!important}

/* Componentes globais */
h1,h2,h3,h4,h5,h6{font-family:inherit;color:var(--ep-ink);letter-spacing:-.012em}
.card,.ep-card,.ep-table-card,.ep-filter-card,.ep-stat-card,.accordion-item{
    border-color:var(--ep-line)!important;box-shadow:var(--ep-shadow)!important
}
.card{border-radius:var(--ep-radius-lg)!important}
.card-header{background:#fff;border-color:var(--ep-line-soft);padding:17px 20px}
.card-body{padding:20px}
.modal-content{border:1px solid var(--ep-line)!important;border-radius:16px!important;box-shadow:0 26px 80px rgba(15,23,42,.22)!important}
.modal-header{padding:18px 20px!important;border-color:var(--ep-line)!important}
.modal-body{padding:20px!important}
.modal-footer{padding:15px 20px!important;border-color:var(--ep-line)!important}
.dropdown-menu{border-color:var(--ep-line);border-radius:12px;box-shadow:0 18px 48px rgba(15,23,42,.14)}
.dropdown-item{border-radius:8px}
.btn{min-height:38px;border-radius:9px;font-weight:600;display:inline-flex;align-items:center;justify-content:center;gap:6px;box-shadow:none!important}
.btn-sm{min-height:32px;border-radius:8px}
.btn-primary{background:var(--ep-primary);border-color:var(--ep-primary)}
.btn-primary:hover,.btn-primary:focus{background:var(--ep-primary-dark);border-color:var(--ep-primary-dark)}
.btn-outline-primary{border-color:#b9cef9;color:var(--ep-primary)}
.btn-outline-primary:hover{background:var(--ep-primary-soft);border-color:#91b2f7;color:var(--ep-primary-dark)}
.form-label,label{color:var(--ep-ink-2);font-weight:600}
.form-control,.form-select,input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),textarea,select{
    border-color:#d8dee8;border-radius:9px;min-height:42px;background-color:#fff;color:var(--ep-ink);box-shadow:none!important
}
.form-control:focus,.form-select:focus,input:focus,textarea:focus,select:focus{border-color:#8db0f7!important;box-shadow:0 0 0 3px rgba(37,99,235,.11)!important;outline:0}
.form-control::placeholder,input::placeholder,textarea::placeholder{color:var(--ep-faint)}
.table-responsive,.ep-table-responsive{border-radius:12px;scrollbar-width:thin}
.table{--bs-table-bg:transparent;color:var(--ep-ink-2)}
.table>:not(caption)>*>*{border-color:var(--ep-line-soft);padding:13px 12px}
.table thead th{background:#f8fafc;color:var(--ep-muted);font-size:11px;font-weight:700;letter-spacing:.055em;text-transform:uppercase;white-space:nowrap}
.table tbody tr{transition:background .12s ease}
.table tbody tr:hover{background:#fafcff}
.badge{font-weight:700;letter-spacing:.02em}
.alert{border-radius:11px;border-width:1px}
.pagination .page-link{border-color:var(--ep-line);color:var(--ep-ink-2);min-width:36px;text-align:center}
.pagination .active>.page-link{background:var(--ep-primary);border-color:var(--ep-primary)}
.ep-page-header{border-radius:var(--ep-radius-lg)!important;border:1px solid var(--ep-line)!important;background:#fff!important;box-shadow:var(--ep-shadow)!important}
.ep-page-title{font-size:25px!important;font-weight:700!important;letter-spacing:-.025em!important;color:var(--ep-ink)!important;text-transform:none!important}
.ep-page-subtitle{color:var(--ep-muted)!important;font-weight:400!important}
.ep-stat-number{font-variant-numeric:tabular-nums}

/* Integrações legadas com a mesma linguagem visual */
.select2-container{width:100%!important}
.select2-container .select2-selection--single,.select2-container .select2-selection--multiple{min-height:42px;border:1px solid #d8dee8!important;border-radius:9px!important;background:#fff!important}
.select2-container .select2-selection--single .select2-selection__rendered{line-height:40px!important;padding-left:12px!important;color:var(--ep-ink)!important}
.select2-container .select2-selection--single .select2-selection__arrow{height:40px!important;right:6px!important}
.select2-container--open .select2-selection{border-color:#8db0f7!important;box-shadow:0 0 0 3px rgba(37,99,235,.11)!important}
.select2-dropdown{border:1px solid var(--ep-line)!important;border-radius:10px!important;box-shadow:0 16px 44px rgba(15,23,42,.14)!important;overflow:hidden}
.select2-results__option{padding:9px 12px!important}
.select2-container--default .select2-results__option--highlighted[aria-selected]{background:var(--ep-primary)!important}
.swal2-popup{border:1px solid var(--ep-line)!important;border-radius:16px!important;box-shadow:0 24px 70px rgba(15,23,42,.2)!important;font-family:inherit!important}
.swal2-confirm{background:var(--ep-primary)!important;border-radius:9px!important}
.swal2-cancel{border-radius:9px!important}

/* Menu inferior do aplicativo */
.ep-mobile-nav{display:none}
.ep-sidebar-backdrop{display:none}

/* Estados vazios e feedback */
.ep-empty-state{padding:36px 20px!important;color:var(--ep-muted)!important;text-align:center}
.ep-empty-state i{color:var(--ep-faint)!important}
.ep-skeleton{background:linear-gradient(90deg,#f1f3f6 25%,#f8fafc 37%,#f1f3f6 63%);background-size:400% 100%;animation:ep-shimmer 1.4s ease infinite;border-radius:8px}
@keyframes ep-shimmer{0%{background-position:100% 0}100%{background-position:0 0}}

/* Tabelas em cards no celular */
@media (max-width:767.98px){
    body{padding-bottom:76px}
    .main-content{margin-left:0!important}
    .page-content{padding:calc(var(--ep-topbar) + 14px) 14px 92px!important}
    .container-fluid{padding-left:0!important;padding-right:0!important}
    .footer{display:none!important}
    #page-topbar{left:0!important;height:62px!important;--ep-topbar:62px}
    .navbar-header{height:62px!important;padding:0 14px!important}
    .ep-mobile-brand{display:flex}
    .ep-topbar-context{display:none}
    .ep-profile-copy{display:none}
    .ep-profile-button{padding:2px}
    .ep-avatar{width:35px;height:35px}
    .ep-top-icon{width:37px;height:37px}
    .sidebar-left{transform:translateX(-102%);transition:transform .22s ease;width:min(310px,86vw)!important;box-shadow:16px 0 44px rgba(15,23,42,.18)!important}
    body.sidebar-enable{overflow:hidden}
    .ep-sidebar-backdrop{position:fixed;display:block;inset:0;border:0;padding:0;background:rgba(15,23,42,.4);z-index:1002;opacity:0;visibility:hidden;pointer-events:none;transition:opacity .2s ease,visibility .2s ease}
    body.sidebar-enable .ep-sidebar-backdrop{opacity:1;visibility:visible;pointer-events:auto}
    body.sidebar-enable .sidebar-left{transform:translateX(0)}
    .ep-sidebar-brand{height:62px}
    .ep-mobile-nav{position:fixed;display:grid;grid-template-columns:repeat(5,1fr);left:0;right:0;bottom:0;height:72px;background:rgba(255,255,255,.98);border-top:1px solid var(--ep-line);z-index:1000;padding:7px max(6px,env(safe-area-inset-right)) max(7px,env(safe-area-inset-bottom)) max(6px,env(safe-area-inset-left));box-shadow:0 -8px 24px rgba(15,23,42,.05);backdrop-filter:blur(12px)}
    .ep-mobile-nav a,.ep-mobile-nav button{display:flex;flex-direction:column;align-items:center;justify-content:flex-start;gap:4px;border:0;background:transparent;color:var(--ep-faint);font-size:9.5px;font-weight:600;text-decoration:none;padding:3px 2px;min-width:0}
    .ep-mobile-nav i{font-size:18px;height:21px;display:grid;place-items:center}
    .ep-mobile-nav .active{color:var(--ep-primary)}
    .ep-mobile-fab{position:relative}
    .ep-mobile-fab span{position:absolute;top:-25px;width:48px;height:48px;border-radius:50%;display:grid;place-items:center;background:var(--ep-primary);color:#fff;box-shadow:0 9px 22px rgba(37,99,235,.35);border:4px solid #fff}
    .ep-mobile-fab small{margin-top:25px;font-size:9.5px}
    .ep-impersonation-bar{top:62px;left:0;justify-content:space-between;font-size:11px;padding:6px 10px}
    body.ep-is-impersonating .page-content{padding-top:118px!important}
    .ep-page-header{padding:18px!important;margin-bottom:14px!important}
    .ep-page-title{font-size:21px!important}
    .ep-page-subtitle{font-size:12px!important;line-height:1.45}
    .ep-header-actions{width:100%;display:grid!important;grid-template-columns:1fr!important;gap:8px!important}
    .ep-header-actions .btn,.ep-header-actions>a{width:100%!important;min-height:44px}
    .row.g-3{--bs-gutter-x:.75rem;--bs-gutter-y:.75rem}
    .card-body{padding:16px}
    .modal-dialog{margin:8px;min-height:calc(100% - 16px)}
    .modal-dialog-centered{align-items:flex-end}
    .modal-content{max-height:calc(100vh - 16px);border-radius:18px 18px 12px 12px!important}
    .modal-body{overflow:auto;padding:16px!important}
    .modal-header,.modal-footer{padding:15px 16px!important}
    .modal-footer{display:grid;grid-template-columns:1fr 1fr;gap:8px}
    .modal-footer>*{margin:0!important;width:100%}
    .btn{min-height:42px}
    .form-control,.form-select,input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),textarea,select{min-height:46px;font-size:16px!important}
    .ep-filter-card{padding:14px!important}
    .ep-stat-card{border-radius:14px!important;padding:14px!important;min-height:104px}
    .ep-stats-grid>[class*="col-"]{width:50%}
    .ep-stat-number{font-size:24px!important}
    .ep-stat-title{font-size:10px!important;text-transform:uppercase;letter-spacing:.045em}
    .ep-stat-meta{font-size:10.5px!important;line-height:1.35}
    .ep-stat-icon{width:36px!important;height:36px!important;font-size:15px!important}
    table.ep-mobile-cards,table.ep-mobile-cards tbody,table.ep-mobile-cards tr,table.ep-mobile-cards td{display:block;width:100%}
    table.ep-mobile-cards thead{display:none}
    table.ep-mobile-cards tbody{display:grid;gap:10px;padding:0}
    table.ep-mobile-cards tr{border:1px solid var(--ep-line);border-radius:14px;background:#fff;box-shadow:0 1px 2px rgba(15,23,42,.04);padding:8px 12px}
    table.ep-mobile-cards tr[style*="display: none"]{display:none!important}
    table.ep-mobile-cards td{border:0!important;padding:7px 0!important;min-height:28px;overflow-wrap:anywhere}
    table.ep-mobile-cards td:before{content:attr(data-label);display:block;margin-bottom:3px;color:var(--ep-muted);font-size:9.5px;font-weight:700;letter-spacing:.055em;text-transform:uppercase}
    table.ep-mobile-cards td:first-child{display:inline-block;width:auto;color:var(--ep-primary);font-size:11px}
    table.ep-mobile-cards td:last-child{padding-top:10px!important;border-top:1px solid var(--ep-line-soft)!important}
    table.ep-mobile-cards td:last-child .dropdown,table.ep-mobile-cards td:last-child .btn{width:100%}
    table.ep-mobile-cards td:last-child .dropdown-toggle{justify-content:center}
    .ep-table-responsive{overflow:visible!important}
}

@media (max-width:420px){
    .ep-stats-grid>[class*="col-"]{width:100%}
    .ep-stat-card{min-height:96px}
    .ep-mobile-brand img{max-width:112px;height:30px}
    .ep-topbar-actions{gap:4px}
}

@media (min-width:768px) and (max-width:1199.98px){
    :root{--ep-sidebar:224px}
    .page-content{padding-left:20px!important;padding-right:20px!important}
}

@media print{
    .sidebar-left,#page-topbar,.ep-mobile-nav,.footer,.ep-impersonation-bar{display:none!important}
    .main-content{margin:0!important}
    .page-content{padding:0!important}
    body{background:#fff!important}
    .card,.ep-card,.ep-table-card,.ep-filter-card,.ep-stat-card{box-shadow:none!important}
}
