/* Portal do Grupo — estilos compartilhados */
:root {
  --bg: #f3f2ee;
  --surface: #ffffff;
  --surface-2: #f8f7f4;
  --ink: #142030;
  --text: #1c2633;
  --muted: #5d6877;
  --line: #e2dfd7;
  --line-strong: #cfcbc0;
  --accent: #1f4f8f;
  --accent-ink: #ffffff;
  --accent-soft: #e6edf7;
  --danger: #b4372f;
  --danger-soft: #fbeceb;
  --ok: #2e7d4f;
  --ok-soft: #e6f3eb;
  --warn-soft: #f8efdc;
  --warn: #8a5a0b;
  --hero: #142030;
  --hero-text: #eef1f5;
  --hero-muted: #a9b4c2;
  --shadow: 0 1px 2px rgba(20, 32, 48, .06), 0 4px 14px rgba(20, 32, 48, .05);
  --shadow-hover: 0 2px 4px rgba(20, 32, 48, .08), 0 10px 28px rgba(20, 32, 48, .10);
  --r: 12px;
  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  /* cores das categorias */
  --c0: #1f6f5a; --c0s: #e3f1ec;
  --c1: #4b3fa0; --c1s: #ecebf8;
  --c2: #a25a12; --c2s: #f8eddf;
  --c3: #1f4f8f; --c3s: #e6edf7;
  --c4: #8a2f5c; --c4s: #f6e7ee;
  --c5: #3d6b1c; --c5s: #ebf3e3;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f141a;
    --surface: #161d26;
    --surface-2: #1b232e;
    --ink: #e7ecf2;
    --text: #dfe5ec;
    --muted: #93a0b0;
    --line: #26303d;
    --line-strong: #344152;
    --accent: #7aa7e6;
    --accent-ink: #0d1722;
    --accent-soft: #1c2b40;
    --danger: #f08a82;
    --danger-soft: #3a1f1e;
    --ok: #7fcb9b;
    --ok-soft: #1a3126;
    --warn-soft: #382c14;
    --warn: #e6b866;
    --hero: #121a24;
    --hero-text: #eef1f5;
    --hero-muted: #93a0b0;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-hover: 0 6px 22px rgba(0, 0, 0, .45);
    --c0: #74c7ad; --c0s: #183129;
    --c1: #a99ff0; --c1s: #25223f;
    --c2: #e5a865; --c2s: #362716;
    --c3: #7aa7e6; --c3s: #1c2b40;
    --c4: #e58fb8; --c4s: #3a1f2d;
    --c5: #a7d47f; --c5s: #1f2f15;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
}
h1, h2, h3 { color: var(--ink); margin: 0; line-height: 1.2; text-wrap: balance; }
a { color: var(--accent); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- botões e campos */
.botao {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 8px; border: 1px solid transparent;
  background: var(--accent); color: var(--accent-ink); font: 600 14px/1 var(--font);
  text-decoration: none; cursor: pointer; white-space: nowrap;
}
.botao:hover { filter: brightness(1.08); }
.botao:disabled { opacity: .6; cursor: progress; }
.botao.sec { background: var(--surface); color: var(--text); border-color: var(--line-strong); }
.botao.sec:hover { background: var(--surface-2); filter: none; }
.botao.fantasma { background: transparent; color: var(--text); border-color: transparent; }
.botao.fantasma:hover { background: var(--surface-2); filter: none; }
.botao.perigo { background: var(--danger); color: #fff; }
.botao.peq { height: 32px; padding: 0 12px; font-size: 13px; }
.botao svg { width: 16px; height: 16px; flex: none; }

.campo { display: grid; gap: 6px; }
.campo > span { font-size: 13px; font-weight: 600; color: var(--ink); }
.campo small { color: var(--muted); font-size: 12px; }
input[type=text], input[type=password], input[type=email], input[type=search], input[type=number], select {
  width: 100%; height: 42px; padding: 0 12px; border-radius: 8px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  font: 400 15px var(--font);
}
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.alerta { padding: 10px 12px; border-radius: 8px; font-size: 14px; }
.alerta.erro { background: var(--danger-soft); color: var(--danger); }
.alerta.ok { background: var(--ok-soft); color: var(--ok); }

/* ---------- marca */
.marca { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; min-width: 0; }
.marca-selo {
  width: 38px; height: 38px; border-radius: 9px; flex: none;
  display: grid; place-items: center;
  background: var(--ink); color: var(--bg);
  font: 600 14px/1 var(--mono); letter-spacing: .04em;
}
.marca-nome { font-weight: 600; color: var(--ink); line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.marca-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- login */
.pg-login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(360px, 1fr); }
.login-lado {
  background: var(--hero); color: var(--hero-text);
  padding: 48px clamp(24px, 5vw, 72px);
  display: flex; flex-direction: column; justify-content: space-between; gap: 40px;
  position: relative; overflow: hidden;
}
.login-lado::after {
  content: ""; position: absolute; inset: auto -120px -160px auto; width: 520px; height: 520px;
  border-radius: 50%; border: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 0 0 60px rgba(255,255,255,.025), 0 0 0 140px rgba(255,255,255,.02);
  pointer-events: none;
}
.login-lado .marca-selo { background: var(--hero-text); color: var(--hero); }
.login-lado .marca-nome { color: var(--hero-text); }
.login-lado .marca-sub { color: var(--hero-muted); }
.login-lado h1 { color: var(--hero-text); font-size: clamp(28px, 3.4vw, 42px); font-weight: 600; letter-spacing: -.02em; max-width: 14ch; }
.login-lado p { color: var(--hero-muted); max-width: 44ch; margin: 14px 0 0; }
.login-rodape { font-size: 12px; color: var(--hero-muted); position: relative; z-index: 1; }
.login-form-area { display: grid; place-items: center; padding: 40px 24px; }
.login-form { width: 100%; max-width: 380px; display: grid; gap: 18px; }
.login-form h2 { font-size: 24px; font-weight: 600; letter-spacing: -.01em; }
.login-form .botao { height: 44px; font-size: 15px; }
.senha-wrap { position: relative; }
.senha-wrap input { padding-right: 70px; }
.senha-ver {
  position: absolute; right: 6px; top: 6px; height: 30px; padding: 0 10px; border: 0; border-radius: 6px;
  background: transparent; color: var(--muted); font: 500 12px var(--font); cursor: pointer;
}
.senha-ver:hover { background: var(--surface-2); color: var(--text); }
@media (max-width: 820px) {
  .pg-login { grid-template-columns: 1fr; }
  .login-lado { padding: 28px 16px; gap: 20px; }
  .login-lado h1 { font-size: 26px; }
  .login-lado p, .login-rodape { display: none; }
  .login-form-area { padding: 32px 16px; place-items: start center; }
}

/* ---------- topo das páginas internas */
.topo {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--line);
}
.topo-in {
  max-width: 1200px; margin: 0 auto; padding: 12px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.topo-acoes { display: flex; align-items: center; gap: 6px; }
.usuario-chip { display: flex; align-items: center; gap: 10px; padding: 4px 10px 4px 4px; border-radius: 999px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--accent-soft); color: var(--accent); font: 600 12px/1 var(--font);
}
.usuario-nome { font-size: 13px; font-weight: 600; color: var(--ink); line-height: 1.2; }
.usuario-perfil { font-size: 12px; color: var(--muted); line-height: 1.2; }
.conteudo { max-width: 1200px; margin: 0 auto; padding: 32px 24px 64px; }
@media (max-width: 700px) {
  .topo-in, .conteudo { padding-left: 16px; padding-right: 16px; }
  .usuario-texto, .marca-sub, .rotulo-btn { display: none; }
}

/* ---------- home */
.boas-vindas { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.boas-vindas h1 { font-size: clamp(24px, 3vw, 32px); font-weight: 600; letter-spacing: -.02em; }
.boas-vindas p { margin: 6px 0 0; color: var(--muted); }
.busca { position: relative; width: min(320px, 100%); }
.busca svg { position: absolute; left: 12px; top: 12px; width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.busca input { padding-left: 38px; }

.secao { margin-top: 32px; }
.secao-titulo {
  display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
  font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
.secao-titulo::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.grade { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }

.cartao {
  position: relative; display: flex; flex-direction: column; gap: 14px; min-height: 176px;
  padding: 18px; border-radius: var(--r); border: 1px solid var(--line);
  background: var(--surface); box-shadow: var(--shadow);
  color: inherit; text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
a.cartao:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); border-color: var(--line-strong); }
.cartao h3 { font-size: 16px; font-weight: 600; }
.cartao p { margin: 4px 0 0; font-size: 13.5px; color: var(--muted); }
.cartao-icone { width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center; background: var(--cs); color: var(--cc); }
.cartao-icone svg { width: 22px; height: 22px; }
.cartao-pe { margin-top: auto; display: flex; align-items: center; justify-content: space-between; font-size: 13px; font-weight: 600; color: var(--cc); }
.cartao-pe svg { width: 16px; height: 16px; transition: transform .15s ease; }
a.cartao:hover .cartao-pe svg { transform: translateX(3px); }
.cartao.breve { background: var(--surface-2); box-shadow: none; border-style: dashed; cursor: default; }
.cartao.breve .cartao-icone { filter: grayscale(.6); opacity: .75; }
.cartao.breve .cartao-pe { color: var(--muted); }
.selo { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; letter-spacing: .02em; background: var(--warn-soft); color: var(--warn); }
.cat-0 { --cc: var(--c0); --cs: var(--c0s); }
.cat-1 { --cc: var(--c1); --cs: var(--c1s); }
.cat-2 { --cc: var(--c2); --cs: var(--c2s); }
.cat-3 { --cc: var(--c3); --cs: var(--c3s); }
.cat-4 { --cc: var(--c4); --cs: var(--c4s); }
.cat-5 { --cc: var(--c5); --cs: var(--c5s); }

.vazio {
  padding: 48px 24px; text-align: center; border: 1px dashed var(--line-strong); border-radius: var(--r);
  color: var(--muted); background: var(--surface);
}
.vazio h2 { font-size: 18px; margin-bottom: 6px; }
.carregando { color: var(--muted); padding: 40px 0; }

/* ---------- cartão central (trocar senha) */
.pg-centro { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; }
.painel {
  width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: var(--shadow); padding: 28px; display: grid; gap: 18px;
}
.painel h1 { font-size: 22px; font-weight: 600; }
.painel p { margin: 0; color: var(--muted); font-size: 14px; }
.regras { margin: 0; padding-left: 18px; font-size: 13px; color: var(--muted); }
.regras li.ok { color: var(--ok); }

/* ---------- página de aviso (403/404) */
.pg-aviso { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; }
.aviso { max-width: 460px; text-align: center; display: grid; gap: 12px; justify-items: center; }
.aviso h1 { font-size: 24px; font-weight: 600; }
.aviso p { margin: 0; color: var(--muted); }
.aviso-codigo { font: 500 13px var(--mono); color: var(--muted); letter-spacing: .1em; }
.aviso .botao { margin-top: 8px; }

/* ---------- administração */
.abas { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.aba {
  appearance: none; border: 0; background: none; padding: 10px 14px; margin-bottom: -1px; cursor: pointer;
  font: 600 14px var(--font); color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap;
}
.aba[aria-selected=true] { color: var(--ink); border-bottom-color: var(--accent); }
.barra { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.barra .busca { width: min(280px, 100%); }
.tabela-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; background: var(--surface-2); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
td .sub { font-size: 12px; color: var(--muted); }
td .sub.falta { color: var(--danger); }
.estado { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.estado::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.estado.off { color: var(--muted); }
.estado.off::before { background: var(--line-strong); }
.etiqueta { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.matriz th.perfil-col { text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--ink); text-align: center; min-width: 120px; vertical-align: bottom; }
.matriz th.perfil-col .sub { display: block; font-weight: 400; color: var(--muted); font-size: 11px; }
.matriz td.cel { text-align: center; }
.matriz tbody td:first-child, .matriz thead th:first-child { min-width: 220px; }
.matriz tbody td:first-child .sub { white-space: nowrap; }
.matriz td.cel input { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
.matriz td.cel input:disabled { cursor: not-allowed; }
.matriz tr.grupo td { background: var(--surface-2); font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.nota { font-size: 13px; color: var(--muted); margin: 12px 0 0; }

dialog {
  width: min(480px, calc(100vw - 32px)); border: 1px solid var(--line); border-radius: 16px; padding: 0;
  background: var(--surface); color: var(--text); box-shadow: 0 24px 60px rgba(0, 0, 0, .25);
}
dialog::backdrop { background: rgba(15, 20, 26, .45); }
.dlg { padding: 24px; display: grid; gap: 16px; }
.dlg h2 { font-size: 18px; font-weight: 600; }
.dlg-acoes { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; flex-wrap: wrap; }
.linha-check { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.linha-check input { width: 18px; height: 18px; accent-color: var(--accent); }
.senha-mostrada {
  font: 600 18px var(--mono); letter-spacing: .06em; padding: 12px; border-radius: 8px; text-align: center;
  background: var(--surface-2); border: 1px dashed var(--line-strong); color: var(--ink); user-select: all; word-break: break-all;
}

/* ---------- token de acesso */
.painel-largo { max-width: 560px; }
.pilha { display: grid; gap: 14px; }
.passo { display: flex; gap: 10px; align-items: flex-start; font-weight: 600; color: var(--ink); }
.passo-n { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font: 600 12px/1 var(--mono); }
.qr-box { justify-self: center; padding: 10px; background: #fff; border: 1px solid var(--line); border-radius: 12px; line-height: 0; }
.qr-box svg { max-width: 100%; height: auto; }
.chave-manual summary { cursor: pointer; color: var(--accent); font-size: 14px; }
.chave-manual p { margin: 8px 0; font-size: 13px; }
.chave { display: block; padding: 10px 12px; border-radius: 8px; background: var(--surface-2); border: 1px dashed var(--line-strong); font: 600 15px/1.5 var(--mono); letter-spacing: .06em; word-break: break-all; user-select: all; color: var(--ink); }
.campo-token { font: 600 20px var(--mono) !important; letter-spacing: .25em; text-align: center; }
.codigos { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 18px; margin: 0; padding: 12px 12px 12px 32px; background: var(--surface-2); border: 1px dashed var(--line-strong); border-radius: 10px; font-size: 15px; color: var(--ink); }
.linha-botoes { display: flex; gap: 8px; flex-wrap: wrap; }
.caixa { padding: 16px; border: 1px solid var(--line); border-radius: 12px; }
.caixa h2 { font-size: 16px; font-weight: 600; }
.status-token { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.selo-ok { display: inline-block; padding: 4px 10px; border-radius: 999px; background: var(--ok-soft); color: var(--ok); font-weight: 600; font-size: 13px; }
.alerta.aviso { background: var(--warn-soft); color: var(--warn); }
button.link { appearance: none; border: 0; background: none; padding: 0; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.etiqueta.token { background: var(--ok-soft); color: var(--ok); margin-left: 6px; }
@media (max-width: 480px) { .codigos { grid-template-columns: 1fr; } }
