/* Portal do Cliente TechHelp — mesmo visual do login e do painel do ERP.
   Sem dependências externas (a CSP só permite arquivos do próprio domínio). */

:root {
    --azul: #007bff;
    --azul-escuro: #0056b3;
    --texto: #2c3e50;
    --cinza: #6c757d;
    --borda: #ddd;
    --erro: #dc3545;
    --sucesso: #198754;
    --aviso-fundo: #fff3cd;
    --aviso-texto: #856404;
    --suporte: #0052cc;
    --fiscal: #9b59b6;
    --financeiro: #43a047;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: var(--texto);
    line-height: 1.45;
}

a { color: var(--azul); }
a:hover { color: var(--azul-escuro); }

/* ---------- Telas de acesso (login do ERP) ---------- */
body.pagina-acesso {
    background: #f2f2f2;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}

.caixa {
    background: #fff;
    padding: 36px 32px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, .1);
    width: 100%;
    max-width: 420px;
    text-align: center;
}
.caixa-larga { max-width: 880px; }
.caixa p, .caixa form { text-align: left; }

.logo { max-width: 180px; margin-bottom: 12px; }
.titulo { font-size: 20px; margin: 0 0 20px; font-weight: 600; }

.duas-colunas {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    text-align: left;
}
.coluna h2 { font-size: 18px; margin: 0 0 12px; color: var(--suporte); }
.coluna + .coluna { border-left: 1px solid #eee; padding-left: 32px; }

@media (max-width: 720px) {
    .duas-colunas { grid-template-columns: 1fr; gap: 24px; }
    .coluna + .coluna { border-left: none; padding-left: 0; border-top: 1px solid #eee; padding-top: 24px; }
    .caixa { padding: 28px 20px; }
}

label { display: block; font-size: 14px; font-weight: 600; margin-top: 10px; }
input {
    width: 100%;
    padding: 12px;
    margin: 6px 0 4px;
    border: 1px solid var(--borda);
    border-radius: 6px;
    font-size: 16px;
    font-family: inherit;
}
input:focus { outline: 2px solid var(--azul); outline-offset: 1px; border-color: var(--azul); }

.campo-oculto { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.botao {
    display: inline-block;
    padding: 12px 18px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
    font-weight: bold;
    text-decoration: none;
    text-align: center;
    font-family: inherit;
    transition: background .2s;
}
.botao-primario { background: var(--azul); color: #fff; width: 100%; margin-top: 14px; }
.botao-primario:hover { background: var(--azul-escuro); color: #fff; }
.botao-secundario { background: #e9ecef; color: var(--texto); }
.botao-secundario:hover { background: #dde1e5; color: var(--texto); }
.botao-sair { background: var(--erro); color: #fff; }
.botao-sair:hover { background: #b02a37; }
.botao:disabled { opacity: .5; cursor: not-allowed; }

.nota { font-size: 13px; color: var(--cinza); }

.alerta { padding: 10px 12px; border-radius: 6px; margin: 8px 0; font-size: 14px; text-align: left; }
.alerta-erro { background: #f8d7da; color: #842029; }
.alerta-sucesso { background: #d1e7dd; color: #0f5132; }
.alerta-aviso { background: var(--aviso-fundo); color: var(--aviso-texto); }

.regras-senha { font-size: 13px; color: var(--cinza); padding-left: 18px; margin: 10px 0 0; text-align: left; }
.medidor { height: 6px; border-radius: 3px; background: #eee; margin-top: 2px; overflow: hidden; }
.medidor::after { content: ""; display: block; height: 100%; width: 0; transition: width .2s; }
.medidor.forca-1::after { width: 25%; background: var(--erro); }
.medidor.forca-2::after { width: 50%; background: #fd7e14; }
.medidor.forca-3::after { width: 75%; background: #ffc107; }
.medidor.forca-4::after { width: 100%; background: var(--sucesso); }

/* ---------- Termos ---------- */
.termos-texto {
    text-align: left;
    border: 1px solid var(--borda);
    border-radius: 8px;
    padding: 16px;
    height: 50vh;
    overflow-y: auto;
    background: #fafafa;
    font-size: 14px;
}
.termos-acoes { display: flex; gap: 12px; justify-content: flex-end; margin-top: 12px; }
.termos-acoes .botao { width: auto; margin-top: 0; min-width: 160px; }
@media (max-width: 520px) {
    .termos-acoes { flex-direction: column-reverse; }
    .termos-acoes .botao { width: 100%; }
}

/* ---------- Área logada (painel do ERP) ---------- */
body.pagina-painel { background: #f0f2f5; min-height: 100vh; }

.cabecalho {
    background: #fff;
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 14px 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .06);
    flex-wrap: wrap;
}
.cabecalho-logo { height: 48px; }
.cabecalho-info { flex: 1; font-size: 14px; min-width: 220px; }
.cabecalho-acoes { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.cabecalho-acoes .botao { padding: 9px 14px; font-size: 13px; }
.form-inline { display: inline; margin: 0; }

.conteudo { max-width: 1100px; margin: 0 auto; padding: 24px 16px; }
.painel-caixa { background: #fff; border-radius: 12px; padding: 24px; box-shadow: 0 4px 15px rgba(0, 0, 0, .06); }
.painel-caixa h1 { font-size: 20px; margin-top: 0; }
.painel-estreito { max-width: 460px; margin: 0 auto; }

.tabela { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 12px; }
.tabela th, .tabela td { padding: 10px 8px; border-bottom: 1px solid #eee; text-align: left; }
.tabela th { color: var(--cinza); font-weight: 600; }

.lista-empresas { display: grid; gap: 10px; }
.empresa-opcao {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    width: 100%;
    padding: 16px;
    border: 1px solid var(--borda);
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    font: inherit;
    text-align: left;
}
.empresa-opcao:hover { border-color: var(--azul); background: #f5f9ff; }
.empresa-nome { font-weight: 600; }
.empresa-cnpj { color: var(--cinza); }

.grade-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; }
.card-mod {
    background: #fff;
    border-radius: 12px;
    border-top: 6px solid var(--cinza);
    box-shadow: 0 4px 15px rgba(0, 0, 0, .06);
    padding: 28px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--texto);
    transition: transform .15s, box-shadow .15s;
}
a.card-mod:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(0, 0, 0, .1); color: var(--texto); }
.card-suporte { border-top-color: var(--suporte); }
.card-fiscal { border-top-color: var(--fiscal); }
.card-financeiro { border-top-color: var(--financeiro); }
.card-icone { font-size: 40px; }
.card-titulo { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: #2c3e50; }
.card-nota { font-size: 12px; color: var(--cinza); }
.card-inativo { opacity: .65; }

/* ---------- Listagens (Financeiro / Fiscal / Suporte) ---------- */
.filtros { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 16px; }
.filtros > div { min-width: 150px; }
.filtros input, .filtros select {
    width: 100%; padding: 9px; margin: 4px 0 0; border: 1px solid var(--borda); border-radius: 6px; font: inherit;
}
.filtros label { margin-top: 0; }
.filtros-botao .botao { margin-top: 0; width: auto; padding: 10px 22px; }

.totais { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 18px; }
.total { border-radius: 8px; padding: 10px 12px; background: #f8f9fa; border-left: 4px solid var(--cinza); display: flex; flex-direction: column; }
.total-rotulo { font-size: 12px; text-transform: uppercase; color: var(--cinza); font-weight: 600; }
.total-valor { font-size: 17px; font-weight: 700; }
.total-qtd { font-size: 12px; color: var(--cinza); }
.total-aberto { border-left-color: var(--azul); }
.total-vencido { border-left-color: var(--erro); }
.total-pago { border-left-color: var(--sucesso); }
.total-protesto { border-left-color: #6f42c1; }
.total-baixado { border-left-color: #adb5bd; }

.tabela-rolagem { overflow-x: auto; }
.tabela td.num, .tabela th.num { text-align: right; white-space: nowrap; }
.tabela td.acoes { white-space: nowrap; }
.botao-pequeno { padding: 6px 10px; font-size: 12px; margin: 2px 0; }
.botao-inativo { opacity: .4; cursor: not-allowed; }

.selo { display: inline-block; padding: 3px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; white-space: nowrap; background: #e9ecef; }
.selo-aberto { background: #cfe2ff; color: #084298; }
.selo-vencido { background: #f8d7da; color: #842029; }
.selo-pago { background: #d1e7dd; color: #0f5132; }
.selo-protesto { background: #e2d9f3; color: #432874; }
.selo-baixado { background: #e9ecef; color: #495057; }
.selo-cancelada { background: #f8d7da; color: #842029; }

/* Empresa do grupo que emitiu o documento (1 Solutions, 2 Locações, 3 Comércio, 4 Connect) */
.selo-empresa { background: #eef2f7; color: #2c3e50; border: 1px solid #d5dde8; }
.selo-empresa-1 { background: #e7f0ff; color: #0b4fb3; border-color: #b9d2ff; }
.selo-empresa-2 { background: #fff4e5; color: #8a4b00; border-color: #ffd8a8; }
.selo-empresa-3 { background: #f1f3f5; color: #495057; border-color: #dee2e6; }
.selo-empresa-4 { background: #e9f7ef; color: #146c43; border-color: #b7e4c7; }

/* Bloqueio financeiro */
.faixa-bloqueio {
    margin: 20px 0; padding: 16px; border-radius: 10px; background: #dc3545; color: #fff;
    font-weight: 800; text-align: center; letter-spacing: .5px; font-size: 16px;
}

/* Suporte */
.titulo-acoes { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.botao-auto { width: auto; margin-top: 0; }
.painel-medio { max-width: 720px; margin: 0 auto; }
select, textarea {
    width: 100%; padding: 10px; margin: 6px 0 4px; border: 1px solid var(--borda); border-radius: 6px;
    font-size: 15px; font-family: inherit; background: #fff;
}
textarea { resize: vertical; }
.dados { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 14px; }
.dados dt { font-weight: 600; color: var(--cinza); }
.dados dd { margin: 0; }
.texto-chamado { background: #fafafa; border: 1px solid #eee; border-radius: 8px; padding: 12px; font-size: 14px; }
.linha-tempo { list-style: none; padding: 0; margin: 0; border-left: 3px solid var(--suporte); }
.linha-tempo li { padding: 4px 0 14px 16px; position: relative; font-size: 14px; }
.linha-tempo li::before { content: ""; position: absolute; left: -7px; top: 8px; width: 11px; height: 11px; border-radius: 50%; background: var(--suporte); }
.linha-tempo-data { display: block; font-size: 12px; color: var(--cinza); font-weight: 600; margin-bottom: 2px; }

/* Subcards do Fiscal */
.subcards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 18px; }
.subcard {
    display: flex; flex-direction: column; gap: 4px; padding: 14px; border-radius: 10px;
    border: 1px solid var(--borda); border-top: 4px solid var(--fiscal); background: #fff;
    text-decoration: none; color: var(--texto);
}
a.subcard:hover { border-color: var(--fiscal); color: var(--texto); }
.subcard-ativo { background: #f6effa; border-color: var(--fiscal); }
.subcard-inativo { opacity: .5; border-top-color: #ced4da; }
.subcard-icone { font-size: 24px; }
.subcard-titulo { font-weight: 700; font-size: 13px; }
.subcard-qtd { font-size: 12px; color: var(--cinza); }
.subtitulo { font-size: 17px; margin: 8px 0; }
.tabela td.descricao { max-width: 320px; font-size: 13px; color: #555; }
