*{box-sizing:border-box}

body{
    margin:0;
    font-family:'Segoe UI',Arial,sans-serif;
    background:#f5f6fa;
    color:#1f2933;
}

.header{
    width:86%;
    margin:0 auto 18px;

    background:#ffffff;

    border-radius:0;
    box-shadow:0 4px 15px rgba(0,0,0,.12);

    padding:12px 20px;

    display:flex;
    justify-content:center;
    align-items:center;

    min-height:110px;
}

.logo{
    margin:0;
    padding:0;
    line-height:1;
}

.logo-img{
    width:280px;
    max-width:100%;
    height:auto;
    display:block;
}

.header h1{
    margin:0;
    font-weight:300;
    letter-spacing:16px;
    font-size:30px;
    line-height:1.1;
    color:#0f2f66;
}


.footer{
    width:86%;
    margin: 28px auto 0;
    background:#1f2428;
    color:white;
    text-align:center;
    padding:28px;
    letter-spacing:5px;
    box-shadow:0 -4px 12px rgba(0,0,0,.18);
}

.footer span{
    color:#ffcc00;
    font-weight:bold;
}

.topbar{
    width:86%;
    margin:auto;
    background:white;
    border:1px solid #ddd;
    border-radius:5px;
    padding:13px 16px;
    font-size:13px;

    display:flex;
    justify-content:space-between;
    align-items:center;
}

.logout{
    color:#dc3545;
    border:1px solid #dc3545;
    padding:8px 14px;
    text-decoration:none;
    border-radius:4px;

    display:flex;
    align-items:center;
    justify-content:center;

    min-width:60px;
    height:36px;
}
.navbar{
    width:86%;
    margin:14px auto 0;
    background:#d19136;
    padding:17px 25px;
    border-radius:4px 4px 0 0;
    position:sticky;
    top:0;
    z-index:1000;
    box-shadow:0 4px 12px rgba(0,0,0,.12);
    overflow:visible;
}

.navbar > a{
    color:white;
    margin-right:28px;
    text-decoration:none;
    font-weight:600;
    font-size:14px;
    padding:8px 10px;
    border-radius:4px;
}

.navbar > a:hover,
.navbar > a.active{
    background:rgba(255,255,255,.18);
}

.nav-dropdown{
    position:relative;
    display:inline-block;
    overflow:visible;
}

.nav-dropdown-btn{
    border:none;
    background:none;
    cursor:pointer;
    padding:8px 10px;
    color:#fff;
    font-weight:800;
    font-size:14px;
    border-radius:4px;
}

.nav-dropdown-btn:hover,
.nav-dropdown-btn.active{
    background:rgba(255,255,255,.18);
}

.nav-dropdown-menu{
    display:none;
    position:absolute;
    top:100%;
    left:0;
    min-width:240px;
    background:#fff;
    border-radius:14px;
    box-shadow:0 10px 30px rgba(0,0,0,.16);
    z-index:99999;
    padding:8px 0;
    overflow:visible;
}

.nav-dropdown:hover > .nav-dropdown-menu{
    display:block;
}

.nav-dropdown-menu > a,
.nav-submenu-title{
    display:block;
    padding:12px 16px;
    color:#334155;
    text-decoration:none;
    font-weight:700;
    font-size:14px;
    white-space:nowrap;
    margin:0;
}

.nav-dropdown-menu > a:hover,
.nav-submenu-title:hover{
    background:#f8fafc;
    color:#d19136;
}

.nav-submenu{
    position:relative;
    overflow:visible;
}

.nav-submenu-menu{
    display:none;
    position:absolute;
    left:100%;
    top:0;
    min-width:260px;
    background:#fff;
    border-radius:12px;
    box-shadow:0 8px 25px rgba(0,0,0,.16);
    z-index:100000;
    padding:8px 0;
    overflow:visible;
}

.nav-submenu:hover > .nav-submenu-menu{
    display:block;
}

.nav-submenu-menu a{
    display:block;
    padding:12px 16px;
    color:#334155;
    text-decoration:none;
    font-weight:700;
    font-size:14px;
    white-space:nowrap;
    margin:0;
}

.nav-submenu-menu a:hover{
    background:#f1f5f9;
    color:#d19136;
}

.container{
    width:86%;
    margin:0 auto;
    flex:1;
}


.empresa-bar{
    width:100%;
    margin:0 0 18px 0;
    background:white;
    border:1px solid #eee;
    border-top:3px solid #c98225;
    border-radius:0 0 8px 8px;
    padding:14px 20px;
    display:flex;
    justify-content:space-between;
    align-items:center;
    position:sticky;
    top:56px;
    z-index:999;
}


.empresa-bar select{
    padding:8px 12px;
    border:1px solid #ccc;
    border-radius:5px;
}
.filtros-form{
    display:flex;
    align-items:end;
    gap:14px;
    flex-wrap:wrap;
}

.filtro-item{
    display:flex;
    flex-direction:column;
    gap:5px;
}

.filtro-item label{
    font-size:12px;
    font-weight:700;
    color:#555;
}

.filtro-item select{
    min-width:150px;
    padding:8px 10px;
    border:1px solid #ccc;
    border-radius:5px;
}

.btn-filtrar{
    height:36px;
    padding:0 18px;
    border:0;
    border-radius:5px;
    background:#d19136;
    color:white;
    font-weight:700;
    cursor:pointer;
}

.btn-filtrar:hover{
    background:#b87925;
}
.btn-mini{
    padding:6px 10px;
    border:0;
    border-radius:6px;
    background:#d19136;
    color:white;
    font-weight:700;
    cursor:pointer;
}

.btn-mini:hover{
    background:#b87925;
}

.purple-bg {
    background: #ede9fe;
    color: #6d28d9;
}

.purple-text {
    color: #6d28d9;
}

.kpi-subtitle {
    font-size: 11px;
    color: #6b7280;
    margin-top: 4px;
}

.cliente-kpis{
    display:grid;
    grid-template-columns:repeat(3,1fr);
    gap:14px;
    margin-bottom:18px;
}

.mini-kpi{
    background:#f8fafc;
    border:1px solid #e5e7eb;
    border-radius:10px;
    padding:14px;
}

.mini-kpi span{
    display:block;
    font-size:12px;
    color:#64748b;
    margin-bottom:6px;
}

.mini-kpi b{
    font-size:18px;
}

@media(max-width:768px){
    .cliente-kpis{
        grid-template-columns:1fr;
    }
}

.kpi-grid{
    display:grid;
    grid-template-columns:repeat(5,minmax(0,1fr));
    gap:14px;
    margin-bottom:18px;
}

.card{
    background:white;
    border:1px solid #eee;
    border-radius:9px;
    box-shadow:0 2px 8px rgba(0,0,0,.08);
    padding:22px;
}

.kpi-card{
    display:flex;
    gap:12px;
    align-items:center;
    min-width:0;
}

.kpi-icon{
    width:50px;
    height:50px;
    min-width:50px;
    border-radius:50%;
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:22px;
}
.kpi-variacao{
    margin-top:6px;
    font-size:13px;
    font-weight:700;
}

.kpi-variacao.up{
    color:#16a34a;
}

.kpi-variacao.down{
    color:#dc2626;
}
.green-bg{background:#e4f6ea;color:#22a052}
.blue-bg{background:#e8f3ff;color:#2477e8}
.orange-bg{background:#fff1dd;color:#e99000}
.red-bg{background:#ffe3e3;color:#d93636}

.green-text{color:#16a34a}
.blue-text{color:#2563eb}
.orange-text{color:#ea8a00}
.red-text{color:#dc2626}

.kpi-title{
    font-size:12px;
    font-weight:700;
    text-transform:uppercase;
}

.kpi-value{
    font-size:18px;
    font-weight:800;
    margin-top:6px;
}

.kpi-resumo-btn{
    margin-left:18px;
    padding:5px 12px;
    font-size:12px;
    border-radius:999px;
    border:none;
    background:#eef2ff;
    color:#4338ca;
    cursor:pointer;
}

.top-charts{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:18px;
    margin-bottom:18px;
}

.chart-wrap{
    position:relative;
    width:100%;
    height:260px;
}

.panel-title{
    font-size:16px;
    font-weight:700;
    margin-bottom:18px;
}

.top-title{
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:12px;
    flex-wrap:wrap;
}

.top-filter-buttons{
    display:flex;
    gap:6px;
    flex-wrap:wrap;
}

.top-filter-buttons a{
    padding:6px 10px;
    border-radius:6px;
    border:1px solid #d19136;
    color:#b87925;
    text-decoration:none;
    font-size:12px;
    font-weight:700;
}

.top-filter-buttons a.active{
    background:#d19136;
    color:white;
}

.modal-bg{
    display:none;
    position:fixed;
    inset:0;
    background:rgba(0,0,0,.45);
    z-index:5000;
    align-items:center;
    justify-content:center;
}

.modal-card{
    width:min(1200px, 94vw);
    max-height:85vh;
    background:white;
    border-radius:12px;
    box-shadow:0 20px 45px rgba(0,0,0,.25);
    display:flex;
    flex-direction:column;
}

.modal-body{
    padding:20px 22px;
    overflow:auto;
}

.modal-body table{
    width:100%;
    border-collapse:collapse;
}

.modal-body th{
    position:sticky;
    top:0;
    z-index:2;
    background:#f8f1e8;
}

.modal-header{
    display:flex;
    justify-content:space-between;
    align-items:center;
    padding:18px 22px;
    border-bottom:1px solid #eee;
}

.modal-header button{
    border:0;
    background:#dc2626;
    color:white;
    width:34px;
    height:34px;
    border-radius:50%;
    font-size:22px;
    cursor:pointer;
}


.modal-body th,
.modal-body td{
    padding:10px;
    border-bottom:1px solid #eee;
    font-size:13px;
}
.modal-resumo{
    margin-bottom:12px;
    font-size:14px;
}

.modal-search{
    width:100%;
    padding:10px 12px;
    margin-bottom:14px;
    border:1px solid #ccc;
    border-radius:6px;
}
.modal-paginacao{
    display:flex;
    justify-content:center;
    align-items:center;
    gap:14px;
    margin-top:16px;
}

.modal-paginacao button{
    padding:8px 14px;
    border:1px solid #d19136;
    background:white;
    color:#d19136;
    border-radius:6px;
    cursor:pointer;
    font-weight:700;
}

.modal-paginacao button:disabled{
    opacity:.4;
    cursor:not-allowed;
}
.tables-grid{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:18px;
    margin-bottom:30px;
}

table{
    width:100%;
    border-collapse:collapse;
    font-size:13px;
}

th{
    background:#fff0f0;
    text-align:left;
    padding:12px;
}

td{
    padding:12px;
    border-bottom:1px solid #eee;
}

.badge{
    background:#ffe4e4;
    color:#e03333;
    padding:5px 9px;
    border-radius:20px;
    font-weight:700;
}

@media(max-width:1400px){
    .kpi-grid{
        grid-template-columns:repeat(5,minmax(0,1fr));
    }
}

@media(max-width:1200px){
    .kpi-grid{
        grid-template-columns:repeat(2,1fr);
    }

    .top-charts{
        grid-template-columns:1fr;
    }

    .tables-grid{
        grid-template-columns:1fr;
    }
}

@media(max-width:768px){

    .header{
        width:96%;
        min-height:135px;
        padding:18px 15px;
    }

    .logo{
        font-size:42px;
        margin-bottom:18px;
    }

    
}


/* =========================
   IMPORTAÇÕES
========================= */

.import-form{
    margin-top:20px;
}

.form-row{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:20px;
    margin-bottom:20px;
}

.form-group{
    display:flex;
    flex-direction:column;
}

.form-group label{
    margin-bottom:8px;
    font-size:14px;
    font-weight:700;
    color:#444;
}

.form-group select,
.form-group input[type="file"]{
    padding:12px;
    border:1px solid #ddd;
    border-radius:8px;
    background:#fff;
}

.import-info{
    margin:20px 0;
    padding:14px 16px;
    background:#fff8e8;
    border:1px solid #f1d9a7;
    border-radius:10px;
    font-size:13px;
    line-height:1.6;
    color:#7a5a00;
}

.alert-success{
    padding:14px 16px;
    background:#eaf8ef;
    border:1px solid #b7e3c4;
    color:#166534;
    border-radius:10px;
    margin-bottom:18px;
}

.alert-error{
    padding:14px 16px;
    background:#fff0f0;
    border:1px solid #f2b6b6;
    color:#991b1b;
    border-radius:10px;
    margin-bottom:18px;
}

@media(max-width:768px){

    .form-row{
        grid-template-columns:1fr;
    }

}

/* =========================
   MODAL BADGES
========================= */

.valor-pago{
    color:#15803d;
    font-weight:700;
}

.valor-aberto{
    color:#dc2626;
    font-weight:700;
}

.valor-principal{
    font-weight:800;
    color:#b45309;
}

.estado-badge{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    padding:6px 10px;
    border-radius:999px;
    font-size:12px;
    font-weight:700;
}

.estado-pago{
    background:#dcfce7;
    color:#166534;
}

.estado-aberto{
    background:#fee2e2;
    color:#991b1b;
}

.estado-parcial{
    background:#fef3c7;
    color:#92400e;
}

.doc-badge{
    display:inline-block;
    padding:4px 8px;
    border-radius:6px;
    background:#f3f4f6;
    color:#374151;
    font-size:11px;
    font-weight:700;
    margin-right:6px;
}

.btn-link-entidade {
    border: none;
    background: transparent;
    padding: 0;
    color: #2563eb;
    font-weight: 700;
    cursor: pointer;
    text-decoration: underline;
}

.badge-cliente {
    background: #dcfce7;
    color: #166534;
}

.badge-fornecedor {
    background: #fee2e2;
    color: #991b1b;
}
.empresa-badge{
    display:inline-flex;
    align-items:center;
    justify-content:center;

    min-width:90px;

    padding:6px 10px;

    border-radius:8px;

    font-size:11px;
    font-weight:700;

    color:white;
}

/* EMPRESA 1 */

.empresa-1{
    background:#2563eb;
}

/* EMPRESA 2 */

.empresa-2{
    background:#16a34a;
}

/* EMPRESA 3 */

.empresa-3{
    background:#dc2626;
}

/* DEFAULT */

.empresa-default{
    background:#6b7280;
}

.modal-liquidacao-card {
    max-width: 520px;
}

.liquidacao-box {
    display: grid;
    gap: 14px;
}

.liquidacao-info {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.liquidacao-info-card {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 12px;
}

.liquidacao-info-card small {
    display: block;
    color: #6b7280;
    margin-bottom: 4px;
}

.liquidacao-info-card b {
    font-size: 16px;
}

.liquidacao-input {
    display: grid;
    gap: 6px;
}

.liquidacao-input label {
    font-weight: 700;
}

.liquidacao-input input,
.liquidacao-input textarea {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    padding: 11px 12px;
    font-size: 15px;
}

.liquidacao-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn-liquidar-total {
    background: #111827;
    color: white;
}

#modalLiquidacao {
    z-index: 9999;
}

#modalFaturasCliente {
    z-index: 9000;
}

#modalDetalhe {
    z-index: 8000;
}