/* Sistema de NFS-e do 2o Tabelionato de Notas de Corinto.
   Mesmas cores, fontes e cantos do site do cartorio (assets/estilo.css dele):
   azul institucional, dourado discreto e papel. Os NOMES das classes sao os
   mesmos do emissor da DS, entao as telas nao precisaram mudar -- so a cor. */
:root {
    --accent:     #12304a;   /* azul institucional */
    --accent-2:   #1b4266;
    --accent-glow:rgba(18,48,74,0.25);
    --dourado:    #b0894f;
    --bg:         #f7f5f0;   /* papel */
    --bg-2:       #ffffff;
    --surface:    #ffffff;
    --surface-2:  #f2efe8;
    --border:     #e3ded4;
    --border-hi:  #b0894f;
    --text:       #1f2937;
    --text-2:     #5b6672;
    --text-3:     #7c8794;
    --ok:         #15803d;
    --ok-fundo:   rgba(21,128,61,0.10);
    --erro:       #b91c1c;
    --erro-fundo: rgba(185,28,28,0.08);
    --aviso:      #8c6c3c;
    --aviso-fundo:#fff6d8;
    --radius:     14px;
    --radius-sm:  9px;
    --shadow:     0 2px 16px rgba(18, 48, 74, 0.08);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

h1, h2 { font-family: 'Lora', Georgia, serif; font-weight: 600; line-height: 1.25; }

.mono { font-family: ui-monospace, Consolas, monospace; }
.hidden { display: none !important; }
.dir { text-align: right; }
a { color: var(--accent-2); }

/* -------------------------------------------------- faixa de horario
   Mesma tarja azul que abre todas as paginas do site. */
.aviso-topo { background: var(--accent); color: #cfe0ef; font-size: 0.85rem; padding: 7px 0; }
.aviso-topo .dentro {
    max-width: 1080px; margin: 0 auto; padding: 0 24px;
    display: flex; flex-wrap: wrap; gap: 6px 24px; justify-content: space-between;
}
.aviso-topo a { color: #fff; text-decoration: none; }

/* ---------------------------------------------------------------- topo */
.topo {
    display: flex; align-items: center; justify-content: space-between;
    gap: 20px; padding: 14px 24px;
    max-width: 1080px; margin: 0 auto;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 10;
}
.topo .marca { display: flex; align-items: center; gap: 14px; text-decoration: none; color: inherit; }
.topo .marca img { height: 46px; width: auto; display: block; }
.topo .marca span { display: block; line-height: 1.25; }
.topo .marca strong {
    font-family: 'Lora', Georgia, serif; font-weight: 600; font-size: 1rem;
    color: var(--accent); display: block;
}
.topo .marca small {
    font-size: 0.72rem; color: var(--text-2);
    text-transform: uppercase; letter-spacing: .08em;
}
.topo nav { display: flex; gap: 2px; flex-wrap: wrap; }
.topo nav a {
    padding: 8px 14px; border-radius: 8px; text-decoration: none;
    color: var(--text-2); font-size: 0.87rem; font-weight: 500;
    transition: all .2s;
}
.topo nav a:hover { color: var(--accent); background: var(--surface-2); }
.topo nav a.ativo { color: #fff; background: var(--accent); }

.faixa-teste {
    margin: 0; padding: 10px 24px; text-align: center; font-weight: 600;
    font-size: 0.85rem; background: var(--aviso-fundo); color: var(--aviso);
    border-bottom: 1px solid var(--border);
}

/* -------------------------------------------------------------- cartao */
.cartao {
    max-width: 560px; margin: 28px auto; padding: 28px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
}
.cartao.largo { max-width: 960px; }

/* Tela de entrar: tarja de horario em cima, cartao no meio, rodape embaixo.
   Precisa ser coluna -- com flex em linha, a tarja e o rodape viravam
   colunas ao lado do cartao. */
.tela-login {
    display: flex; flex-direction: column; min-height: 100vh;
}
.tela-login .cartao {
    max-width: 400px; width: calc(100% - 40px);
    margin: auto; text-align: center;
}
.tela-login .rodape-nota { margin-top: 0; }
.tela-login .logo {
    display: block; width: 240px; max-width: 78%; height: auto;
    margin: 2px auto 22px;
}
.tela-login label { text-align: left; }
.tela-login h1 { font-size: 1.35rem; }

h1 { font-size: 1.5rem; margin-bottom: 20px; }
h2 { font-size: 1.15rem; margin-bottom: 12px; }
.sub { margin: -14px 0 22px; color: var(--text-3); font-size: 0.85rem; }

label {
    display: block; margin: 18px 0 7px; font-size: 0.78rem;
    color: var(--text-3); text-transform: uppercase; letter-spacing: .06em;
    font-weight: 600;
}

input, textarea, select {
    width: 100%; padding: 12px 14px; font-size: 1rem; font-family: inherit;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--bg-2); color: var(--text);
}
input::placeholder, textarea::placeholder { color: var(--text-3); }
/* o Chrome pinta de azul o campo preenchido automaticamente; aqui nao */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--text);
    -webkit-box-shadow: 0 0 0 1000px var(--bg-2) inset;
    caret-color: var(--text);
    transition: background-color 9999s ease-in-out 0s;
}

input:focus, textarea:focus, select:focus {
    outline: none; border-color: var(--border-hi);
    box-shadow: 0 0 0 3px rgba(249,115,22,0.12);
}

button {
    font: inherit; cursor: pointer; color: var(--text);
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 11px 17px; transition: all .2s;
}
button:hover { border-color: var(--border-hi); }
button[type=submit], .principal {
    width: 100%; margin-top: 24px; padding: 15px; border: 0;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff; font-size: 1rem; font-weight: 700;
    box-shadow: 0 6px 24px rgba(249,115,22,0.25);
}
.principal:disabled { opacity: .35; cursor: default; box-shadow: none; }
button.link { border: 0; background: none; color: var(--accent); padding: 5px 9px; }
button.perigo, .perigo { border-color: rgba(248,113,113,0.4); color: var(--erro); }

/* ------------------------------------------------------------- atalhos */
.atalhos { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); }
.atalho {
    display: flex; flex-direction: column; align-items: flex-start; gap: 3px;
    padding: 14px 16px; text-align: left; background: var(--bg-2);
}
.atalho:hover { background: var(--surface-2); border-color: var(--border-hi); }
.atalho strong { font-size: 0.92rem; font-weight: 600; }
.atalho span { font-size: 0.8rem; color: var(--text-3); }
.atalho b { font-size: 1rem; color: var(--accent); font-weight: 700; }

/* -------------------------------------------------------------- busca */
.resultados { display: grid; gap: 5px; margin-top: 7px; }
.resultado {
    display: flex; justify-content: space-between; gap: 12px; align-items: center;
    width: 100%; text-align: left; padding: 11px 14px; background: var(--bg-2);
}
.resultado.novo { border-style: dashed; border-color: var(--border-hi); }
.tag {
    font-size: 0.7rem; color: var(--accent); background: rgba(249,115,22,0.12);
    padding: 3px 9px; border-radius: 20px; white-space: nowrap;
}
.vazio { color: var(--text-3); font-size: 0.87rem; padding: 12px 2px; }

.cliente {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; padding: 14px 16px; margin-top: 8px;
    background: var(--bg-2); border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.cliente .mono { display: block; font-size: 0.8rem; color: var(--text-3); }

/* --------------------------------------------------------------- tipos */
.tipos { display: grid; gap: 9px; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); }
.tipo { padding: 15px 12px; font-size: 0.92rem; background: var(--bg-2); }
.tipo.escolhido {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff; border-color: transparent; font-weight: 600;
}

.sugestoes { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; margin-top: 10px; }
.sugestoes .rotulo { font-size: 0.78rem; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; }
.chip { padding: 6px 13px; font-size: 0.87rem; border-radius: 20px; background: var(--bg-2); }
.chip small { color: var(--text-3); margin-left: 6px; font-size: 0.75rem; }

/* ------------------------------------------------------------ mensagens */
/* diz por que o botao de emitir esta apagado */
.falta {
    margin-top: 10px; text-align: center; font-size: 0.85rem;
    color: var(--aviso);
}

#mensagem { margin-top: 20px; font-size: 0.93rem; }
#mensagem.ok {
    padding: 16px; border-radius: var(--radius-sm);
    background: var(--ok-fundo); color: var(--ok);
    border: 1px solid rgba(34,197,94,0.25);
}
#mensagem.erro {
    padding: 16px; border-radius: var(--radius-sm);
    background: var(--erro-fundo); color: var(--erro);
    border: 1px solid rgba(248,113,113,0.25);
}
.erro { color: var(--erro); }
.aviso {
    padding: 12px 14px; border-radius: var(--radius-sm);
    background: var(--aviso-fundo); color: var(--aviso); font-size: 0.85rem;
    border: 1px solid rgba(251,191,36,0.2);
}
.chave { font-size: 0.8rem; word-break: break-all; opacity: .85; }
.botao-pdf {
    display: inline-block; margin-top: 12px; padding: 10px 18px;
    border-radius: var(--radius-sm); text-decoration: none; font-weight: 600;
    font-size: 0.88rem; color: #fff;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

/* ------------------------------------------------------------- historico */
.filtros { display: flex; flex-wrap: wrap; gap: 9px; align-items: flex-end; }
.filtros input[name=q] { flex: 1 1 250px; }
.filtros label { margin: 0; display: flex; align-items: center; gap: 7px; text-transform: none; letter-spacing: 0; }
.filtros input[type=date] { width: auto; color-scheme: dark; }
.filtros button { margin: 0; }
.resumo { color: var(--text-3); font-size: 0.87rem; margin: 18px 0 10px; }

.lista { width: 100%; border-collapse: collapse; font-size: 0.87rem; }
.lista th {
    text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: .06em;
    color: var(--text-3); font-weight: 600; padding: 9px 10px;
    border-bottom: 1px solid var(--border);
}
.lista td { padding: 11px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.lista tr:hover td { background: rgba(255,255,255,0.02); }
.lista tr.cancelada td { opacity: .45; text-decoration: line-through; }
.lista small { display: block; font-size: 0.75rem; color: var(--text-3); }
.acoes { display: flex; gap: 5px; justify-content: flex-end; }
.mini {
    font-size: 0.75rem; padding: 6px 10px; border-radius: 8px; text-decoration: none;
    border: 1px solid var(--border); color: var(--text-2); background: var(--bg-2);
}
.mini:hover { border-color: var(--border-hi); color: var(--text); }
.selo { font-size: 0.72rem; padding: 4px 10px; border-radius: 20px; white-space: nowrap; }
.selo.ok { background: var(--ok-fundo); color: var(--ok); }
.selo.erro { background: var(--erro-fundo); color: var(--erro); }
.selo.cancelada { background: var(--surface-2); color: var(--text-3); }

dialog {
    border: 1px solid var(--border); border-radius: var(--radius);
    padding: 0; max-width: 470px; background: var(--surface); color: var(--text);
}
dialog::backdrop { background: rgba(0,0,0,.72); backdrop-filter: blur(3px); }
dialog .cartao { margin: 0; border: 0; box-shadow: none; }
.botoes { display: flex; gap: 9px; justify-content: flex-end; margin-top: 22px; }
.botoes button { margin: 0; width: auto; }

@media (max-width: 620px) {
    .topo { padding: 10px 16px; }
    .topo .marca span { display: none; }
    .cartao { margin: 14px; padding: 20px; }
    .lista th:nth-child(4), .lista td:nth-child(4) { display: none; }
    .acoes { flex-wrap: wrap; }
}

/* ------------------------------------------------------------- rodape
   Fecha a pagina com a mesma cor do topo do site, para a tela nao
   terminar no vazio quando a lista de notas e curta. */
.rodape-nota {
    margin-top: 48px; padding: 18px 0;
    background: var(--accent); color: #cfe0ef; font-size: 0.85rem;
}
.rodape-nota .dentro {
    max-width: 1080px; margin: 0 auto; padding: 0 24px;
    display: flex; flex-wrap: wrap; gap: 6px 24px; justify-content: space-between;
}
.rodape-nota a { color: #fff; text-decoration: none; }
.rodape-nota a:hover { text-decoration: underline; }

/* atalhos de periodo do historico */
.periodos { display: flex; flex-wrap: wrap; gap: 7px; margin: 12px 0 0; }
.periodos .chip { text-decoration: none; color: var(--text-2); }
.periodos .chip.escolhido {
    background: var(--accent); color: #fff; border-color: var(--accent);
}

/* campo com botao do lado (buscar CNPJ, buscar CEP) */
.linha-campo { display: flex; gap: 8px; align-items: stretch; }
.linha-campo input { flex: 1 1 auto; margin: 0; }
.linha-campo button { margin: 0; white-space: nowrap; }

/* mini-ficha de cadastrar cliente dentro da tela de emitir */
.ficha-nova {
    margin-top: 12px; padding: 16px;
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.ficha-nova label:first-child { margin-top: 0; }
#abrir-novo { margin-top: 10px; display: inline-block; }

/* titulo com botao de acao do lado direito */
.titulo-com-botao {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; flex-wrap: wrap; margin-bottom: 12px;
}
.titulo-com-botao h2 { margin: 0; }
.titulo-com-botao .principal { margin: 0; width: auto; text-decoration: none; }

/* ------------------------------------------- painel: dados que faltam p/ emitir */
.painel-fundo {
    position: fixed; inset: 0; z-index: 60;
    background: rgba(18, 48, 74, 0.45);
    display: flex; align-items: center; justify-content: center; padding: 16px;
}
.painel-cartao { max-width: 460px; width: 100%; margin: 0; }
.painel-cartao label { display: block; font-size: 0.9rem; font-weight: 600; margin-bottom: 14px; position: relative; }
.painel-cartao label input { display: block; width: 100%; margin-top: 6px; }
.painel-sugestoes {
    position: absolute; left: 0; right: 0; top: 100%;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-sm); box-shadow: var(--shadow);
    max-height: 240px; overflow: auto; z-index: 5;
}
.painel-sugestoes:empty { display: none; }
.painel-opcao {
    display: block; width: 100%; text-align: left;
    padding: 9px 12px; border: 0; background: none; cursor: pointer;
    font: inherit; color: var(--text); font-weight: 400;
}
.painel-opcao:hover { background: var(--surface-2); }
.painel-ok { display: block; color: var(--ok); font-weight: 500; margin-top: 6px; }
.painel-erro { min-height: 1.3em; margin: 0 0 12px; font-size: 0.88rem; }
.painel-botoes { display: flex; justify-content: flex-end; gap: 10px; }

/* ----------------------------------------------- paginas da lista de clientes */
.paginas { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; align-items: center; margin-top: 18px; }
.paginas a, .paginas span { padding: 6px 11px; border: 1px solid var(--border); border-radius: 8px; text-decoration: none; color: var(--text-2); font-size: 0.9rem; background: var(--surface); }
.paginas a.atual { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ------------------------------------------------------- tela de entrar: olho e link */
.tela-login .esqueci, .esqueci { margin: 22px 0 0; text-align: center; font-size: 0.9rem; }
.campo-senha { position: relative; }
.campo-senha input { padding-right: 44px; }
.campo-senha .olho {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
    border: 0; background: none; cursor: pointer; color: var(--text-3); padding: 0;
}
.campo-senha .olho:hover, .campo-senha .olho.ativo { color: var(--accent); }
.campo-senha .olho svg { width: 20px; height: 20px; }
