:root {
    --blue: #1a4d8f;
    --blue-dark: #123a6b;
    --bg: #f4f6f9;
    --card: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --border: #e2e5ea;
    --ok: #1f8a4c;
    --warn: #a56c00;
    --danger: #b3261e;
    --info: #2563eb;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: "Segoe UI", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar { background: var(--blue); color: #fff; }
.topbar-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0.75rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}
.brand { color: #fff; font-weight: 700; font-size: 1.25rem; letter-spacing: 0.5px; }
.brand:hover { text-decoration: none; opacity: 0.9; }
.nav { display: flex; gap: 1rem; flex: 1; flex-wrap: wrap; }
.nav a { color: #dbe6f6; font-size: 0.92rem; padding: 0.35rem 0.1rem; border-bottom: 2px solid transparent; }
.nav a:hover, .nav a.active { color: #fff; border-bottom-color: #fff; text-decoration: none; }
.user-box { display: flex; align-items: center; gap: 0.75rem; font-size: 0.88rem; }
.user-name small { color: #cfe0f5; }
.btn-link { background: none; border: none; color: #dbe6f6; cursor: pointer; font-size: 0.88rem; padding: 0; }
.btn-link:hover { color: #fff; text-decoration: underline; }

.container { max-width: 1100px; margin: 0 auto; padding: 1.5rem 1.25rem; width: 100%; flex: 1; }
.page-title { font-size: 1.4rem; margin: 0 0 1rem; color: var(--blue-dark); }
.subtitle { color: var(--muted); margin-top: -0.75rem; margin-bottom: 1.25rem; }

.footer { background: #eef1f5; color: var(--muted); font-size: 0.82rem; padding: 1rem 0; margin-top: 2rem; border-top: 1px solid var(--border); }

.alert { padding: 0.7rem 1rem; border-radius: 6px; margin-bottom: 1rem; font-size: 0.9rem; }
.alert-success { background: #e6f6ec; color: var(--ok); border: 1px solid #bfe6cd; }
.alert-error { background: #fdecea; color: var(--danger); border: 1px solid #f5c6c2; }
.alert-info { background: #e8f0fd; color: var(--info); border: 1px solid #c6d9f7; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 1.25rem; margin-bottom: 1.25rem; box-shadow: 0 1px 2px rgba(0,0,0,0.03); }
.card h2, .card h3 { margin-top: 0; color: var(--blue-dark); }

.grid { display: grid; gap: 1rem; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 720px) { .grid-3, .grid-2 { grid-template-columns: 1fr; } .topbar-inner { flex-wrap: wrap; } }

.stat { background: var(--card); border: 1px solid var(--border); border-left: 4px solid var(--blue); border-radius: 6px; padding: 1rem; }
.stat .num { font-size: 1.6rem; font-weight: 700; color: var(--blue-dark); }
.stat .label { color: var(--muted); font-size: 0.85rem; }

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { padding: 0.55rem 0.6rem; text-align: left; border-bottom: 1px solid var(--border); }
th { background: #f8f9fb; color: var(--muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; }
tr:hover td { background: #fafbfd; }
.table-wrap { overflow-x: auto; }

/* Pedido da professora (3º bimestre): colunas numéricas (valores em R$,
   percentuais, metragem, contagens) alinhadas à direita, com o rótulo do
   cabeçalho alinhado do mesmo jeito -- facilita comparar valores numa
   coluna, em vez de ficarem "soltos" à esquerda. */
th.col-num, td.col-num { text-align: right; }

.badge { display: inline-block; padding: 0.15rem 0.55rem; border-radius: 999px; font-size: 0.76rem; font-weight: 600; }
.badge-ok { background: #e6f6ec; color: var(--ok); }
.badge-warn { background: #fff4e0; color: var(--warn); }
.badge-danger { background: #fdecea; color: var(--danger); }
.badge-info { background: #e8f0fd; color: var(--info); }
.badge-muted { background: #eee; color: var(--muted); }

label { display: block; font-size: 0.85rem; font-weight: 600; margin: 0.75rem 0 0.25rem; color: #374151; }
input, select, textarea {
    width: 100%; padding: 0.5rem 0.6rem; border: 1px solid var(--border); border-radius: 6px;
    font-size: 0.92rem; font-family: inherit; background: #fff; color: var(--text);
}
textarea { resize: vertical; min-height: 5rem; }
.hint { color: var(--muted); font-size: 0.78rem; margin-top: 0.2rem; }

.btn {
    display: inline-block; background: var(--blue); color: #fff; border: none; padding: 0.55rem 1.1rem;
    border-radius: 6px; font-size: 0.9rem; font-weight: 600; cursor: pointer; margin-top: 1rem;
}
.btn:hover { background: var(--blue-dark); text-decoration: none; }
.btn-sm { padding: 0.3rem 0.65rem; font-size: 0.8rem; margin-top: 0; }
.btn-secondary { background: #fff; color: var(--blue); border: 1px solid var(--blue); }
.btn-secondary:hover { background: #eef3fb; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #8f1e17; }
.actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }

.login-wrap { max-width: 380px; margin: 3.5rem auto; }
.login-wrap .card { text-align: left; }
.login-logo { text-align: center; font-size: 1.6rem; font-weight: 700; color: var(--blue-dark); margin-bottom: 1.5rem; }
.demo-creds { font-size: 0.78rem; color: var(--muted); margin-top: 1.25rem; border-top: 1px dashed var(--border); padding-top: 0.75rem; }

.empty { color: var(--muted); font-style: italic; padding: 1rem 0; }
.tag-priority-alta { color: var(--danger); font-weight: 700; }
.tag-priority-normal { color: var(--text); }
.tag-priority-baixa { color: var(--muted); }

details.faq-item summary { cursor: pointer; font-weight: 600; padding: 0.4rem 0; }
details.faq-item { border-bottom: 1px solid var(--border); padding: 0.3rem 0; }
details.faq-item p { color: #374151; margin: 0.4rem 0 0.8rem; }

.filtro-radio { display: flex; align-items: center; gap: 0.9rem; flex-wrap: wrap; }
.filtro-radio .filtro-opcao { display: flex; align-items: center; gap: 0.3rem; margin: 0; }
.filtro-radio .filtro-opcao input[type="radio"] { width: auto; margin: 0; }
.filtro-radio label.filtro-opcao { display: flex; font-size: 0.9rem; font-weight: 400; margin: 0; color: var(--text); cursor: pointer; }

.breadcrumb { font-size: 0.82rem; color: var(--muted); margin-bottom: 0.75rem; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 0.5rem 0 0.5rem 1rem; border-left: 2px solid var(--border); margin-left: 0.3rem; }
.timeline li strong { color: var(--muted); font-size: 0.82rem; display: block; }

/* Item 8: pop-up (modal) para os formularios de "novo registro", em vez de
   ficarem fixos no topo da pagina. Usa o elemento <dialog> nativo do HTML
   (showModal()/close()), sem nenhuma biblioteca de JS. */
dialog.modal {
    border: none; border-radius: 10px; padding: 0; width: 92%; max-width: 640px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}
dialog.modal::backdrop { background: rgba(17, 24, 39, 0.55); }
dialog.modal .modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1rem 1.25rem; border-bottom: 1px solid var(--border);
}
dialog.modal .modal-header h2 { margin: 0; font-size: 1.1rem; color: var(--blue-dark); }
dialog.modal .modal-close {
    background: none; border: none; font-size: 1.3rem; line-height: 1; cursor: pointer;
    color: var(--muted); padding: 0.2rem 0.4rem;
}
dialog.modal .modal-close:hover { color: var(--text); }
dialog.modal .modal-body { padding: 1.25rem; max-height: 75vh; overflow-y: auto; }

.toolbar-lista {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    flex-wrap: wrap; margin-bottom: 1rem;
}
.toolbar-lista .campo-busca { max-width: 320px; margin: 0; }
.toolbar-lista .campo-busca input { margin: 0; }

/* Destaca a linha da tabela quando chegamos por um link de atalho com
   âncora (ex.: ícone de olho nos "chamados recentes" do painel). */
tr:target { background: #fff4e0; }

/* Ícone de olho (atalho "ver chamado"), desenhado em SVG na cor azul do
   sistema em vez de emoji, para combinar com o resto da interface. */
.icon-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--blue);
    padding: 0.2rem;
    border-radius: 6px;
    line-height: 0;
}
.icon-link:hover {
    color: var(--blue-dark);
    background: #eef3fb;
    text-decoration: none;
}

/* Marcador de campo obrigatório (formulários de cadastro de imóvel e de
   abertura de chamado) -- asterisco na cor de alerta ao lado do label. */
.campo-obrigatorio {
    color: var(--danger);
    font-weight: 700;
}
.legenda-obrigatorio {
    color: var(--muted);
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

/* Informe de Rendimentos (locador/informe.php) -- layout de documento
   oficial: cabeçalho com identificação da imobiliária, título do informe,
   bloco de identificação do beneficiário, texto declaratório e área de
   assinatura. Em tela usa o mesmo estilo de .card do resto do sistema; na
   impressão (@media print abaixo) vira a única coisa visível na página. */
.documento-cabecalho {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.5rem;
    flex-wrap: wrap;
}
.documento-empresa-nome {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--blue-dark);
}
.documento-empresa-detalhe {
    font-size: 0.85rem;
    color: var(--muted);
    margin-top: 0.25rem;
    line-height: 1.5;
}
.documento-titulo {
    text-align: right;
}
.documento-titulo h2 {
    margin: 0;
}
.documento-titulo p {
    margin: 0.15rem 0 0;
    color: var(--muted);
}
.documento-separador {
    border: none;
    border-top: 2px solid var(--blue-dark);
    margin: 1rem 0 1.25rem;
}
.documento-beneficiario {
    margin-bottom: 1.25rem;
}
.documento-beneficiario h3 {
    margin: 0 0 0.5rem;
    font-size: 1rem;
    color: var(--blue-dark);
}
.tabela-identificacao th {
    text-align: left;
    color: var(--muted);
    font-weight: 600;
    padding: 0.15rem 1rem 0.15rem 0;
    width: 8rem;
    vertical-align: top;
}
.tabela-identificacao td {
    padding: 0.15rem 0;
}
.documento-intro {
    text-align: justify;
    margin-bottom: 1rem;
}
.documento-nota {
    font-size: 0.82rem;
    color: var(--muted);
    text-align: justify;
    margin-top: 1.25rem;
    border-top: 1px dashed var(--border);
    padding-top: 0.75rem;
}
.documento-rodape {
    margin-top: 2rem;
    font-size: 0.82rem;
    color: var(--muted);
}
.documento-assinatura {
    margin-top: 2.5rem;
    max-width: 320px;
    text-align: center;
}
.documento-assinatura-linha {
    border-top: 1px solid var(--text);
    margin-bottom: 0.35rem;
}

/* Impressão / "salvar em PDF": esconde toda a interface do sistema (menu,
   cabeçalho azul, filtros, botões) e mostra só o conteúdo do documento
   oficial, para o locador conseguir encaminhar o PDF gerado direto para a
   contabilidade/Receita Federal, sem nada do sistema aparecendo junto. */
@media print {
    @page { margin: 1.5cm 2cm; }
    .topbar, .footer, .no-print, .page-title, .titulo-linha, .ajuda-botoes, dialog { display: none !important; }
    body { display: block; background: #fff; }
    main.container { max-width: none; margin: 0; padding: 0; }
    .documento-oficial {
        border: none;
        box-shadow: none;
        padding: 0;
        margin: 0;
    }
    a[href]::after { content: ""; }
}

/* Paginação e busca no servidor */
.paginacao { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.25rem; margin-top: 0.75rem; font-size: 0.9rem; }
.paginacao-resumo { color: var(--muted, #5b6472); }
.paginacao-tam { margin: 0 0 0 auto; }
.paginacao-tam select { width: auto; margin: 0 0 0 0.35rem; padding: 0.2rem 0.4rem; }
.paginacao-lista { display: flex; flex-wrap: wrap; gap: 0.25rem; list-style: none; margin: 0; padding: 0; }
.paginacao-lista a, .paginacao-lista span { display: inline-block; min-width: 2rem; padding: 0.3rem 0.6rem; text-align: center; border: 1px solid #cfd6e0; border-radius: 6px; text-decoration: none; }
.paginacao-lista a:hover { background: #eef3fb; }
.paginacao-lista .atual { background: #1d4ed8; border-color: #1d4ed8; color: #fff; font-weight: 700; }
.paginacao-lista .desabilitado, .paginacao-lista .reticencias { color: #9aa3b0; border-color: transparent; }
.segmentado { display: inline-flex; border: 1px solid #1d4ed8; border-radius: 8px; overflow: hidden; }
.segmentado a { padding: 0.45rem 1rem; text-decoration: none; color: #1d4ed8; font-weight: 600; background: #fff; }
.segmentado a.ativo { background: #1d4ed8; color: #fff; }
.toolbar-acoes { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ---- Ajuda contextual (4º bimestre): botão "?" (pop-up) e botão "i" (dica ao passar o mouse) ---- */
.titulo-linha { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin: 0 0 1rem; }
.titulo-linha .page-title { margin: 0; }
.ajuda-botoes { display: inline-flex; align-items: center; gap: 0.4rem; }

.btn-ajuda, .btn-dica {
    display: inline-flex; align-items: center; justify-content: center;
    width: 1.75rem; height: 1.75rem; padding: 0; border-radius: 50%;
    font-size: 1rem; font-weight: 700; line-height: 1; font-family: inherit;
    border: 2px solid #1d4ed8; background: #fff; color: #1d4ed8; cursor: pointer;
}
.btn-ajuda:hover, .btn-ajuda:focus-visible { background: #1d4ed8; color: #fff; }
.btn-dica {
    border-color: #5b6472; color: #5b6472; cursor: help; position: relative;
    font-style: italic; font-family: Georgia, "Times New Roman", serif;
}
.btn-dica:hover, .btn-dica:focus-visible { background: #5b6472; color: #fff; }

/* Balão da dica: aparece só enquanto o mouse está sobre o botão "i". */
.btn-dica::after {
    content: attr(data-dica);
    position: absolute; top: calc(100% + 0.5rem); left: 50%; transform: translateX(-50%);
    width: max-content; max-width: 16rem; padding: 0.5rem 0.7rem;
    background: #1f2937; color: #fff; border-radius: 6px;
    font: 400 0.82rem/1.35 system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
    font-style: normal; text-align: left; white-space: normal;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
    opacity: 0; visibility: hidden; transition: opacity 0.12s ease; z-index: 50;
}
.btn-dica::before {
    content: ""; position: absolute; top: calc(100% + 0.1rem); left: 50%; transform: translateX(-50%);
    border: 0.4rem solid transparent; border-bottom-color: #1f2937;
    opacity: 0; visibility: hidden; transition: opacity 0.12s ease; z-index: 50;
}
.btn-dica:hover::after, .btn-dica:focus-visible::after,
.btn-dica:hover::before, .btn-dica:focus-visible::before { opacity: 1; visibility: visible; }

.modal-ajuda { max-width: 32rem; }
.modal-ajuda .ajuda-resumo { margin-top: 0; }
.modal-ajuda .ajuda-passos { margin: 0 0 1rem; padding-left: 1.2rem; }
.modal-ajuda .ajuda-passos li { margin-bottom: 0.45rem; line-height: 1.45; }

@media (max-width: 520px) {
    .btn-dica::after { max-width: 12rem; left: auto; right: 0; transform: none; }
    .btn-dica::before { left: auto; right: 0.35rem; transform: none; }
}
