/* Vetor Cofre. Cores da marca Vetor (ver vetor-supply/docs/MARCA.md):
   navy para a moldura, azul só para ação. */
:root {
  --navy: #0F1E3D;
  --azul: #2563EB;
  --azul-forte: #1d4fd7;
  --fundo: #f4f6fb;
  --superficie: #ffffff;
  --superficie-2: #f0f2f7;
  --texto: #111827;
  --suave: #5b6476;
  --borda: #dce2ee;
  --perigo: #b42318;
  --perigo-fundo: #fdecea;
  --ok: #12653a;
  --ok-fundo: #e8f5ee;
  --atencao: #8a5a06;
  --atencao-fundo: #fdf1dc;
  --sombra: 0 1px 2px rgba(15, 30, 61, .06), 0 4px 16px rgba(15, 30, 61, .06);
  --raio: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fundo: #0b0f1a;
    --superficie: #131a2b;
    --superficie-2: #1b2436;
    --texto: #e6e9f0;
    --suave: #9aa5b8;
    --borda: #26304a;
    --azul: #4f7cf5;
    --azul-forte: #6d8bff;
    --perigo: #f2867b;
    --perigo-fundo: #3d1414;
    --ok: #6ee7a8;
    --ok-fundo: #10331f;
    --atencao: #f5c451;
    --atencao-fundo: #3a2c0c;
    --sombra: 0 1px 2px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--fundo);
  color: var(--texto);
  min-height: 100vh;
}
h1 { font-size: 1.4rem; margin: .4rem 0; }
h2 { font-size: 1.2rem; margin: 0 0 .5rem; }
h3 { font-size: 1rem; margin: 1.8rem 0 .6rem; }
a { color: var(--azul); }
.suave { color: var(--suave); }
.oculto { display: none; }
.icone { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- botões ---------- */
.botao {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  font: inherit; font-weight: 600; border-radius: 8px; padding: .55rem 1rem; cursor: pointer;
  border: 1px solid transparent; transition: background .15s, border-color .15s;
}
.botao:disabled { opacity: .6; cursor: wait; }
.botao:focus-visible, .botao-icone:focus-visible, .aba:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .nome-item:focus-visible, .link:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--azul) 45%, transparent); outline-offset: 2px;
}
.primario { background: var(--azul); color: #fff; }
.primario:hover:not(:disabled) { background: var(--azul-forte); }
.secundario { background: var(--superficie); color: var(--texto); border-color: var(--borda); }
.secundario:hover:not(:disabled) { border-color: var(--suave); }
.fantasma { background: transparent; color: inherit; }
.fantasma:hover { background: color-mix(in srgb, currentColor 10%, transparent); }
.perigo { background: var(--perigo-fundo); color: var(--perigo); border-color: color-mix(in srgb, var(--perigo) 30%, transparent); }
.pequeno { padding: .3rem .7rem; font-size: .85rem; }
.largo { width: 100%; }
.botao-icone {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 7px; flex: none;
  border: 1px solid transparent; background: transparent; color: var(--suave); cursor: pointer; font-size: 1.3rem;
}
.botao-icone:hover { background: var(--superficie-2); color: var(--texto); }
.link { background: none; border: 0; color: var(--azul); font: inherit; cursor: pointer; padding: .3rem 0; }

/* ---------- formulários ---------- */
.form { display: flex; flex-direction: column; gap: 1rem; }
.campo { display: flex; flex-direction: column; gap: .3rem; }
.campo label { font-weight: 600; font-size: .9rem; }
input, select, textarea {
  font: inherit; color: var(--texto); background: var(--superficie); border: 1px solid var(--borda);
  border-radius: 8px; padding: .55rem .7rem; width: 100%;
}
input:disabled { background: var(--superficie-2); color: var(--suave); }
textarea { resize: vertical; }
.codigo { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: .15em; font-size: 1.15rem; }
.codigo.curto { max-width: 9rem; text-transform: uppercase; }
.check { display: flex; gap: .5rem; align-items: flex-start; font-size: .9rem; }
.check input { width: auto; margin-top: .25rem; }
.erro-form { background: var(--perigo-fundo); color: var(--perigo); border-radius: 8px; padding: .6rem .8rem; margin: 0; }
.info-form { background: var(--ok-fundo); color: var(--ok); border-radius: 8px; padding: .6rem .8rem; margin: 0; }
.regras { margin: -.4rem 0 0; padding-left: 1.2rem; color: var(--atencao); font-size: .88rem; }
.regras:empty { display: none; }
.linha-botoes { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .4rem; }
.acoes { display: flex; gap: .6rem; justify-content: flex-end; flex-wrap: wrap; margin-top: .5rem; }
.form.em-linha { flex-direction: row; flex-wrap: wrap; align-items: flex-end; }
.form.em-linha .campo { flex: 1 1 200px; }

/* ---------- login ---------- */
.centro { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem 16px; background: linear-gradient(160deg, var(--navy) 0 38%, var(--fundo) 38%); }
.cartao { background: var(--superficie); border: 1px solid var(--borda); border-radius: var(--raio); box-shadow: var(--sombra); padding: 1rem 1.1rem; }
.cartao-login { width: min(440px, 100%); padding: 1.8rem; }
.marca-login { display: flex; gap: .7rem; align-items: center; margin-bottom: .8rem; }
.marca-login div { display: flex; flex-direction: column; line-height: 1.2; }
.marca-login span { color: var(--suave); font-size: .85rem; }
.recuperacao { border: 2px dashed var(--borda); border-radius: var(--raio); padding: 1rem; text-align: center; }
.recuperacao code { display: block; font: 600 1.05rem/1.9 ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: .06em; word-spacing: .4em; }
.recuperacao p { margin: .2rem 0; font-size: .85rem; }
.alerta { background: var(--atencao-fundo); color: var(--atencao); border-radius: 8px; padding: .7rem .9rem; font-size: .9rem; }

/* ---------- moldura ---------- */
.topo { background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 5; }
.topo-dentro { max-width: 1200px; margin: 0 auto; padding: .5rem 16px; display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.marca { display: flex; align-items: center; gap: .5rem; font-weight: 700; font-size: 1.05rem; }
.abas { display: flex; gap: .2rem; flex: 1; overflow-x: auto; }
.aba { background: transparent; border: 0; color: #c9d3ea; font: inherit; font-weight: 600; padding: .5rem .8rem; border-radius: 7px; cursor: pointer; white-space: nowrap; display: inline-flex; gap: .4rem; align-items: center; }
.aba:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.aba.ativa { color: #fff; background: rgba(255, 255, 255, .14); }
.selo { background: #f59e0b; color: #1f1300; border-radius: 99px; font-size: .75rem; padding: 0 .45rem; }
.quem { display: flex; align-items: center; gap: .5rem; }
.quem-nome { color: #c9d3ea; font-size: .9rem; }
.conteudo { max-width: 1200px; margin: 0 auto; padding: 1.2rem 16px 3rem; }

/* ---------- lista de senhas ---------- */
.pesquisa { position: relative; display: block; margin-bottom: .8rem; }
.pesquisa input {
  font-size: 1.1rem; padding: .85rem 1rem .85rem 3rem; border: 2px solid var(--borda); border-radius: 12px;
  box-shadow: var(--sombra);
}
.pesquisa input:focus { border-color: var(--azul); outline: none; box-shadow: 0 0 0 4px color-mix(in srgb, var(--azul) 18%, transparent); }
.pesquisa .lupa { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); color: var(--suave); display: flex; pointer-events: none; }
.pesquisa .lupa .icone { width: 22px; height: 22px; }
.barra { display: flex; gap: .7rem; flex-wrap: wrap; align-items: center; margin-bottom: .6rem; }
.barra select { width: auto; min-width: 200px; flex: 0 1 240px; }
.busca { flex: 1 1 280px; }
.barra-acoes { display: flex; gap: .5rem; margin-left: auto; }
.segmentos { display: inline-flex; border: 1px solid var(--borda); border-radius: 8px; overflow: hidden; background: var(--superficie); }
.segmentos button { border: 0; background: transparent; font: inherit; padding: .5rem .8rem; cursor: pointer; color: var(--suave); }
.segmentos button.ativo { background: var(--azul); color: #fff; }
.resumo { margin: .2rem 0 .6rem; font-size: .9rem; color: var(--suave); display: flex; gap: 1rem; align-items: center; }
.resumo .link { font-size: .9rem; }
.lista { background: var(--superficie); border: 1px solid var(--borda); border-radius: var(--raio); box-shadow: var(--sombra); overflow: hidden; }
.linha {
  display: grid; grid-template-columns: minmax(180px, 2fr) 1fr 1fr minmax(150px, 1.4fr) minmax(170px, 1.3fr) auto;
  gap: .8rem; align-items: center; padding: .55rem 1rem; border-top: 1px solid var(--borda);
}
.linha > span { min-width: 0; }
.linha.cabecalho { border-top: 0; background: var(--superficie-2); font-size: .8rem; font-weight: 700; color: var(--suave); text-transform: uppercase; letter-spacing: .03em; }
.linha:not(.cabecalho):hover { background: color-mix(in srgb, var(--azul) 4%, var(--superficie)); }
.linha.ilegivel { color: var(--perigo); }
.c-portal { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.nome-item { background: none; border: 0; padding: 0; font: inherit; font-weight: 600; color: var(--texto); cursor: pointer; text-align: left; }
.nome-item:hover { color: var(--azul); text-decoration: underline; }
.abrir { color: var(--suave); display: inline-flex; }
.abrir:hover { color: var(--azul); }
.c-login, .c-senha { display: flex; align-items: center; gap: .15rem; }
.quebra { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Nome comprido (ex.: lista de empresas separadas por "|") ocupa no máximo
   duas linhas; o texto inteiro aparece no passar do mouse e em Detalhes. */
.corta { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
.c-portal .nome-item { min-width: 0; }
.barra select { text-overflow: ellipsis; }
.mascara { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: .05em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mascara.revelada { background: var(--atencao-fundo); color: var(--texto); border-radius: 4px; padding: 0 .3rem; user-select: all; white-space: normal; overflow-wrap: anywhere; }
.etiqueta { display: inline-flex; align-items: center; gap: .25rem; font-size: .72rem; font-weight: 700; border-radius: 99px; padding: .05rem .5rem; background: var(--superficie-2); color: var(--suave); }
.etiqueta .icone { width: 12px; height: 12px; }
.etiqueta-ativo { background: var(--ok-fundo); color: var(--ok); }
.etiqueta-pendente { background: var(--atencao-fundo); color: var(--atencao); }
.etiqueta-desativado { background: var(--superficie-2); color: var(--suave); }
.vazio { padding: 2.5rem 1rem; text-align: center; color: var(--suave); }
.registro .linha { grid-template-columns: 130px 160px 1fr 130px; }
.registro .linha.atencao { background: var(--atencao-fundo); }

/* ---------- cartões ---------- */
.cartoes { display: grid; gap: .7rem; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.cartoes .cartao { display: flex; flex-direction: column; gap: .4rem; align-items: flex-start; }
.pessoa > div:first-child { display: flex; flex-direction: column; }
.pessoa-info { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; font-size: .85rem; }
.pessoa.status-desativado { opacity: .6; }

/* ---------- modal ---------- */
.modal { border: 0; border-radius: 14px; padding: 0; width: min(620px, calc(100vw - 32px)); max-height: calc(100vh - 48px); background: var(--superficie); color: var(--texto); box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
.modal::backdrop { background: rgba(11, 15, 26, .55); }
.modal-topo { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1rem 1.2rem .6rem; border-bottom: 1px solid var(--borda); position: sticky; top: 0; background: var(--superficie); }
.modal-topo h2 { margin: 0; overflow-wrap: anywhere; }
.modal-corpo { padding: 1rem 1.2rem 1.3rem; }
.detalhe { display: grid; grid-template-columns: 150px 1fr; gap: .45rem .8rem; margin: 1rem 0; }
.detalhe dt { color: var(--suave); font-weight: 600; font-size: .9rem; }
.detalhe dd { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.historico { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .6rem; }
.historico li { border: 1px solid var(--borda); border-radius: 8px; padding: .6rem .8rem; }
.historico-topo { display: flex; justify-content: space-between; gap: .6rem; flex-wrap: wrap; }
.historico p { margin: .3rem 0 0; font-size: .88rem; }
.historico code { display: inline-block; margin-top: .4rem; background: var(--atencao-fundo); padding: .1rem .4rem; border-radius: 4px; user-select: all; overflow-wrap: anywhere; }
.historico code.oculto { display: none; }

/* ---------- avisos ---------- */
.avisos { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: .5rem; z-index: 50; width: min(480px, calc(100vw - 32px)); }
.aviso { padding: .7rem 1rem; border-radius: 8px; box-shadow: var(--sombra); font-weight: 600; }
.aviso-ok { background: var(--navy); color: #fff; }
.aviso-erro { background: var(--perigo); color: #fff; }

/* ---------- celular ---------- */
@media (max-width: 760px) {
  .linha, .registro .linha { grid-template-columns: 1fr; gap: .25rem; padding: .8rem 1rem; }
  .linha.cabecalho { display: none; }
  .linha > span[data-rotulo]:not(.c-portal)::before { content: attr(data-rotulo) ": "; color: var(--suave); font-size: .8rem; margin-right: .3rem; }
  .c-mais { justify-self: start; }
  .barra-acoes { margin-left: 0; width: 100%; }
  .barra-acoes .botao { flex: 1; }
  .quem-nome { display: none; }
  .detalhe { grid-template-columns: 1fr; }
  .detalhe dd { margin-bottom: .4rem; }
}

/* ---------- impressão: só a chave de recuperação ---------- */
@media print {
  body * { visibility: hidden; }
  .recuperacao, .recuperacao * { visibility: visible; color: #000; }
  .recuperacao { position: absolute; top: 2cm; left: 1.5cm; right: 1.5cm; border-color: #000; }
}
