:root {
    --indigo: #01234e;
    --azul-secundario: #063c7f;
    --cobre: #ff6a00;
    --charcoal: #1c2733;
    --slate: #5a6472;
    --verde: #2e9c5b;
    --vermelho: #c2542c;
    --cinza-borda: #e6e9f0;
    --branco: #ffffff;
    --off-white: #f6f7fb;
    --sombra-suave: 0 1px 2px rgba(1,35,78,0.05), 0 10px 24px -14px rgba(1,35,78,0.16);
    --sombra-hover: 0 2px 4px rgba(1,35,78,0.06), 0 16px 32px -14px rgba(1,35,78,0.22);
}

* { box-sizing: border-box; }

html { overflow-x: hidden; }

body {
    margin: 0;
    font-family: 'Inter', -apple-system, "Segoe UI", Arial, sans-serif;
    background: var(--off-white);
    color: var(--charcoal);
    -webkit-font-smoothing: antialiased;
    letter-spacing: -0.1px;
    overflow-x: hidden;
}

.layout { display: flex; min-height: 100vh; }

.menu-lateral {
    width: 224px;
    background: linear-gradient(180deg, var(--indigo) 0%, #011a3a 100%);
    padding: 24px 0;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    align-self: stretch;
    min-height: 100vh;
    overflow-y: auto;
}

.espaco-flexivel { flex: 1 1 auto; }

.marca { padding: 8px 22px 24px; text-align: center; display: block; position: relative; }
.marca::after { content: ''; display: block; width: 60px; height: 2px; background: var(--cobre); margin: 20px auto 0; border-radius: 2px; }
.marca-logo { height: 52px; width: auto; display: inline-block; }

.item-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 22px;
    color: #93a3c4;
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    letter-spacing: 0.1px;
    transition: background 0.15s, color 0.15s;
}
.item-menu.ativo {
    background: var(--cobre);
    color: var(--branco);
    font-weight: 600;
    box-shadow: 0 6px 16px -6px rgba(255,106,0,0.55);
}
.item-menu:not(.ativo):hover { background: rgba(255,255,255,0.06); color: var(--branco); }
.item-menu.sub { padding: 9px 22px 9px 26px; font-size: 12.5px; font-weight: 500; color: #93a3c4; }
.item-menu.sub.ativo { color: var(--branco); }
.item-menu.sub:not(.ativo):hover { color: var(--branco); }
.icone-menu { width: 18px; height: 18px; flex-shrink: 0; }

.menu-configuracoes summary { list-style: none; cursor: pointer; }
.menu-configuracoes summary::-webkit-details-marker { display: none; }
.menu-configuracoes summary .icone-seta { width: 14px; height: 14px; margin-left: auto; transition: transform 0.15s; opacity: 0.7; }
.menu-configuracoes[open] summary .icone-seta { transform: rotate(180deg); }
.menu-configuracoes[open] summary:not(.ativo) { color: #eef1f8; background: rgba(255,255,255,0.05); }

.barra-rodape-menu {
    display: flex;
    gap: 8px;
    padding: 20px 22px 0;
    margin-top: 16px;
}
.identificacao-usuario {
    padding: 12px 22px 4px; text-align: center; font-size: 11.5px; color: #7f8caa;
}
.identificacao-usuario-nome { font-weight: 500; color: #b9c4dd; margin-bottom: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.identificacao-usuario a { color: #7f8caa; text-decoration: underline; }
.identificacao-usuario a:hover { color: #fff; }
.botao-icone-menu {
    width: 40px;
    height: 40px;
    border-radius: 9px;
    background: rgba(255,255,255,0.07);
    color: #c7cfe2;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}
.botao-icone-menu svg { width: 16px; height: 16px; }
.botao-icone-menu:hover { background: rgba(255,255,255,0.16); color: var(--branco); }
.botao-icone-menu.botao-sair { color: #ffb199; }
.botao-icone-menu.botao-sair:hover { background: rgba(255,90,50,0.22); color: #ffd4c4; }

.conteudo { position: relative; flex: 1; padding: 74px 44px 60px; }

.aviso { padding: 12px 16px; border-radius: 10px; margin-bottom: 20px; font-size: 14px; font-weight: 500; }
.aviso-erro { background: #fbe4de; color: var(--vermelho); }
.aviso-sucesso { background: #e2f3e8; color: var(--verde); }

/* --- Tela de login --- */
.pagina-login {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background:
        radial-gradient(circle at 15% 15%, rgba(6,60,127,0.10), transparent 45%),
        radial-gradient(circle at 85% 85%, rgba(255,106,0,0.08), transparent 45%),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cg opacity='0.10'%3E%3Crect x='36' y='14' width='13' height='13' fill='%232f8fd4'/%3E%3Crect x='20' y='24' width='12' height='12' fill='%232578bd'/%3E%3Crect x='35' y='36' width='9' height='9' fill='%231c6aa8'/%3E%3Crect x='20' y='45' width='12' height='12' fill='%2301234e'/%3E%3C/g%3E%3Cg opacity='0.06' transform='translate(150,40) scale(0.7)'%3E%3Crect x='36' y='14' width='13' height='13' fill='%232f8fd4'/%3E%3Crect x='20' y='24' width='12' height='12' fill='%232578bd'/%3E%3Crect x='35' y='36' width='9' height='9' fill='%231c6aa8'/%3E%3Crect x='20' y='45' width='12' height='12' fill='%2301234e'/%3E%3C/g%3E%3Cg opacity='0.08' transform='translate(70,140) scale(0.85)'%3E%3Crect x='36' y='14' width='13' height='13' fill='%232f8fd4'/%3E%3Crect x='20' y='24' width='12' height='12' fill='%232578bd'/%3E%3Crect x='35' y='36' width='9' height='9' fill='%231c6aa8'/%3E%3Crect x='20' y='45' width='12' height='12' fill='%2301234e'/%3E%3C/g%3E%3Cg opacity='0.05' transform='translate(170,160) scale(0.55)'%3E%3Crect x='36' y='14' width='13' height='13' fill='%232f8fd4'/%3E%3Crect x='20' y='24' width='12' height='12' fill='%232578bd'/%3E%3Crect x='35' y='36' width='9' height='9' fill='%231c6aa8'/%3E%3Crect x='20' y='45' width='12' height='12' fill='%2301234e'/%3E%3C/g%3E%3C/svg%3E"),
        var(--off-white);
    background-repeat: repeat;
}
.caixa-login {
    width: 380px;
    max-width: 100%;
    background: var(--branco);
    border-radius: 18px;
    padding: 44px 40px;
    text-align: center;
    box-shadow: var(--sombra-hover);
}
.caixa-login h1 { color: var(--indigo); font-size: 26px; margin: 0 0 4px; }
.logo-login { width: 220px; height: auto; margin-bottom: 14px; }
.caixa-login p.slogan { color: var(--slate); font-size: 12px; font-weight: 500; letter-spacing: 0.5px; margin: 0 0 28px; }

/* --- Configurações --- */
.grade-config { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.cartao-config {
    display: block; text-decoration: none; color: inherit;
    background: var(--branco); border-radius: 14px;
    padding: 22px; box-shadow: var(--sombra-suave);
    transition: box-shadow 0.18s, transform 0.18s;
}
.cartao-config:hover { box-shadow: var(--sombra-hover); transform: translateY(-2px); }
.cartao-config .icone-config { width: 28px; height: 28px; margin-bottom: 10px; }
.cartao-config .titulo-config { font-weight: 500; font-size: 14.5px; color: var(--indigo); }
.cartao-config .desc-config { font-size: 12.5px; color: var(--slate); margin-top: 4px; line-height: 1.4; }

.tag-departamento {
    display: inline-block; padding: 3px 10px; border-radius: 20px;
    background: #eaf0fb; color: var(--azul-secundario); font-size: 11px; font-weight: 500;
}
.tag-sem-departamento { color: var(--slate); font-size: 12px; }
.campo { text-align: left; margin-bottom: 16px; }
.campo label { display: block; font-size: 12px; font-weight: 500; color: var(--slate); margin-bottom: 6px; }
.campo input {
    width: 100%;
    padding: 10px 13px;
    border: 1px solid var(--cinza-borda);
    background: var(--off-white);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.15s, background 0.15s;
}
.campo input:focus { outline: none; border-color: var(--azul-secundario); background: var(--branco); }
.campo select {
    width: 100%;
    padding: 10px 13px;
    border: 1px solid var(--cinza-borda);
    background: var(--off-white);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    color: inherit;
}
.campo select:focus { outline: none; border-color: var(--azul-secundario); background: var(--branco); }
.botao {
    display: inline-block;
    width: 100%;
    padding: 12px;
    background: var(--cobre);
    color: var(--branco);
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    box-shadow: 0 8px 20px -8px rgba(255,106,0,0.55);
    transition: transform 0.12s, box-shadow 0.12s, background 0.12s;
}
.botao:hover { background: #e85f00; transform: translateY(-1px); box-shadow: 0 10px 24px -8px rgba(255,106,0,0.6); }
.botao-secundario { background: var(--indigo); box-shadow: 0 8px 20px -8px rgba(1,35,78,0.4); }
.botao-secundario:hover { background: var(--azul-secundario); }

/* --- Cartões e KPIs --- */
h1.titulo-pagina { font-size: 25px; font-weight: 600; letter-spacing: -0.3px; margin: 0 0 4px; }
p.subtitulo-pagina { color: var(--slate); font-size: 13.5px; font-weight: 500; margin: 0 0 26px; }

.linha-kpis { display: flex; gap: 16px; margin-bottom: 26px; }
.kpi {
    flex: 1;
    background: var(--branco);
    border-radius: 14px;
    padding: 20px 20px 18px;
    box-shadow: var(--sombra-suave);
    border-top: 3px solid var(--cobre);
}
.kpi .titulo { font-size: 10.5px; color: var(--slate); font-weight: 500; letter-spacing: 0.6px; }
.kpi .valor { font-size: 28px; font-weight: 600; margin-top: 8px; letter-spacing: -0.4px; }

.cartao {
    background: var(--branco);
    border-radius: 14px;
    padding: 22px;
    box-shadow: var(--sombra-suave);
}

table { width: 100%; border-collapse: collapse; }
th {
    text-align: left; font-size: 11px; font-weight: 500; color: var(--azul-secundario);
    letter-spacing: 0.4px; padding: 10px 10px; background: #f2f5fb;
}
th:first-child { border-radius: 8px 0 0 8px; }
th:last-child { border-radius: 0 8px 8px 0; }
td { padding: 12px 10px; font-size: 13.5px; border-bottom: 1px solid var(--off-white); }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #fafbfd; }

/* ===================================================
   RESPONSIVO — MENU MOBILE (app interno)
   =================================================== */
.menu-app-checkbox { display: none; }
.topo-mobile { display: none; }

.central-notificacoes { position: fixed; top: 20px; right: 28px; z-index: 50; }
.aba-topo { background:none; border:none; padding:10px 2px 12px; font-size:14px; font-weight:600; color:var(--slate); cursor:pointer; border-bottom:2px solid transparent; margin-bottom:-1px; }
.aba-topo.ativa { color:var(--indigo); border-bottom-color:var(--cobre); }
.overlay-modal { display: none; position: fixed; inset: 0; background: rgba(11,19,32,0.5); z-index: 70; align-items: center; justify-content: center; padding: 20px; }
.caixa-modal { background: var(--branco); border-radius: 14px; padding: 26px 28px; width: 100%; max-width: 460px; max-height: 90vh; overflow-y: auto; box-shadow: var(--sombra-hover); }
.dropdown-menu { display: none; position: absolute; top: calc(100% + 6px); z-index: 30; border-radius: 8px; overflow: hidden; box-shadow: var(--sombra-hover); }
.dropdown-menu.aberto { display: block; }
.notif-checkbox { display: none; }
.overlay-notif { display: none; position: fixed; inset: 0; z-index: 39; }
.notif-checkbox:checked ~ .overlay-notif { display: block; }
.sino-central {
    position: relative; display: flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; border-radius: 10px; background: var(--branco);
    box-shadow: var(--sombra-suave); color: var(--indigo); cursor: pointer;
}
.sino-selo-central {
    position: absolute; top: -4px; right: -4px; background: var(--vermelho); color: var(--branco);
    font-size: 10px; font-weight: 700; min-width: 16px; height: 16px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center; padding: 0 3px;
}
.notif-painel {
    display: none; position: absolute; top: 46px; right: 0; width: 320px; max-height: 380px;
    overflow-y: auto; background: var(--branco); border-radius: 12px; box-shadow: var(--sombra-hover);
    z-index: 41; padding: 8px 0;
}
.notif-checkbox:checked ~ .notif-painel { display: block; }
.notif-painel-titulo { font-size: 12px; font-weight: 700; color: var(--slate); padding: 8px 16px; }
.notif-item {
    display: block; padding: 10px 16px; font-size: 13px; color: var(--charcoal);
    text-decoration: none; border-top: 1px solid var(--off-white);
}
.notif-item:hover { background: var(--off-white); }
.notif-item-urgente { color: var(--vermelho); font-weight: 600; }
.notif-vazio { font-size: 12.5px; color: var(--slate); padding: 4px 16px 10px; }

@media (max-width: 900px) {
    .central-notificacoes { top: 14px; right: 16px; }
}
.overlay-mobile { display: none; }

@media (max-width: 860px) {
    .topo-mobile {
        display: flex; align-items: center; gap: 14px;
        position: fixed; top: 0; left: 0; right: 0; height: 56px;
        background: var(--indigo); padding: 0 16px; z-index: 80;
    }
    .topo-mobile-logo { height: 30px; }
    .sino-notificacao {
        margin-left: auto; position: relative; color: #cdd6ea; text-decoration: none;
        display: flex; align-items: center; padding: 6px;
    }
    .sino-selo {
        position: absolute; top: 0; right: 0; background: var(--cobre); color: #fff;
        font-size: 10px; font-weight: 500; min-width: 16px; height: 16px; border-radius: 8px;
        display: flex; align-items: center; justify-content: center; padding: 0 3px;
    }
    .menu-app-btn { display: flex; flex-direction: column; gap: 4px; cursor: pointer; width: 24px; padding: 6px; }
    .menu-app-btn span { display: block; height: 2px; background: #fff; border-radius: 2px; }

    .layout { flex-direction: column; padding-top: 56px; }
    .menu-lateral {
        position: fixed; top: 0; bottom: 0; left: -260px; width: 224px;
        transition: left 0.25s ease; z-index: 95; overflow-y: auto;
    }
    .menu-app-checkbox:checked ~ .layout .menu-lateral { left: 0; }
    .menu-app-checkbox:checked ~ .overlay-mobile {
        display: block; position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 90;
    }

    .conteudo { padding: 20px 16px 40px; max-width: 100%; }
    .titulo-pagina { font-size: 20px; }

    .linha-kpis { flex-wrap: wrap; }
    .kpi { min-width: 140px; flex: 1 1 calc(50% - 8px); }

    /* tabelas: em vez de espremer, deixa rolar de lado dentro do cartão */
    .cartao { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    table { min-width: 560px; }

    /* formulários com vários campos lado a lado: empilha */
    .campo { min-width: 100% !important; }
}

@media (max-width: 480px) {
    .kpi { flex: 1 1 100%; }
    .conteudo { padding: 16px 12px 40px; }
}

.menu-suspenso-adicionar {
    display: none; position: absolute; top: calc(100% + 6px); right: 0; z-index: 30;
    background: #fff; border-radius: 10px; box-shadow: var(--sombra-hover); min-width: 200px; padding: 6px;
}
.menu-suspenso-adicionar.aberto { display: block; }
.menu-suspenso-adicionar a {
    display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 6px;
    color: var(--indigo); text-decoration: none; font-size: 13.5px; font-weight: 500;
}
.menu-suspenso-adicionar a:hover { background: var(--off-white); }

.abas-cliente { display: flex; gap: 4px; border-bottom: 1px solid var(--cinza-borda); flex-wrap: wrap; }
.aba-cliente-btn {
    background: none; border: none; padding: 11px 16px; font-size: 13.5px; font-weight: 500;
    color: var(--slate); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
    font-family: inherit; display: flex; align-items: center; gap: 6px;
}
.aba-cliente-btn:hover { color: var(--indigo); }
.aba-cliente-btn.ativa { color: var(--indigo); border-bottom-color: var(--cobre); }
.aba-contador {
    background: var(--off-white); color: var(--slate); font-size: 10.5px; font-weight: 500;
    padding: 1px 7px; border-radius: 10px;
}
.aba-cliente-btn.ativa .aba-contador { background: rgba(255,106,0,0.12); color: var(--cobre); }
