/* Login Gabinete Kim. Design system do Hub (Missão): tokens e receitas de
   design-system-hub-portatil.md, traduzidos de Tailwind para CSS puro, porque as
   telas não têm build nem JavaScript (a CSP bloqueia script).
   Claro é o padrão. O escuro segue o sistema da pessoa (prefers-color-scheme) e
   também aceita data-theme="dark" no <html>, como no Hub. */

/* Fontes hospedadas no próprio login, como no RADAR (static-public/fonts.css). */
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 300; font-display: swap; src: url("/fontes/poppins-300.ttf") format("truetype"); }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fontes/poppins-400.ttf") format("truetype"); }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 600; font-display: swap; src: url("/fontes/poppins-600.ttf") format("truetype"); }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 700; font-display: swap; src: url("/fontes/poppins-700.ttf") format("truetype"); }
@font-face { font-family: "Roboto"; font-style: normal; font-weight: 300; font-display: swap; src: url("/fontes/roboto-300.ttf") format("truetype"); }
@font-face { font-family: "Roboto"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fontes/roboto-400.ttf") format("truetype"); }
@font-face { font-family: "Roboto"; font-style: normal; font-weight: 600; font-display: swap; src: url("/fontes/roboto-600.ttf") format("truetype"); }
@font-face { font-family: "Roboto"; font-style: normal; font-weight: 700; font-display: swap; src: url("/fontes/roboto-700.ttf") format("truetype"); }

:root,
[data-theme="light"] {
  --missao-primary: #fcbe26;
  --missao-header: oklch(0.09 0 0);

  --background: #f7f8fa;
  --background-paper: oklch(1 0 0);
  --background-surface: #eef1f4;
  --background-muted: #f3f5f7;
  --background-text: oklch(0.175 0 0);
  --border: #e3e7ec;
  --muted-foreground: #5b6472;
  --ring: #b57d0f;
  --link: #9c680b;
  --surface-selected: color-mix(in oklch, var(--missao-primary) 14%, var(--background-paper));
  --text-secondary: #475467;

  --state-info-bg: #eef4ff; --state-info-border: #b2ccff; --state-info-text: #175cd3;
  --state-warning-bg: #ffeedc; --state-warning-border: #fed9a7; --state-warning-text: #6d4f08;
  --state-danger-bg: #fbeeed; --state-danger-border: #f7d5d3; --state-danger-text: #a83b2e;
  --state-success-bg: #eefdf7; --state-success-border: #8bf0cf; --state-success-text: #006551;

  --action-primary-foreground: oklch(0.175 0 0);
  --danger-solid: #a83b2e;
  --danger-solid-hover: #6e241b;
  --primary-500: #fcbe26;

  --elevation-card: 0 1px 2px -1px rgb(17 17 17 / 0.08), 0 2px 6px -1px rgb(17 17 17 / 0.08);
  --elevation-raised: 0 2px 4px -1px rgb(17 17 17 / 0.1), 0 6px 14px -2px rgb(17 17 17 / 0.12);

  --font-sans: "Roboto", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Poppins", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", Consolas, Menlo, monospace;
  --radius-sm: 4px; --radius-md: 6px; --radius-lg: 8px; --radius-xl: 12px;
  color-scheme: light;
}

/* Escuro: os mesmos valores em dois lugares (sistema da pessoa e data-theme). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --missao-header: oklch(1 0 0);
    --background: oklch(0.09 0 0);
    --background-paper: oklch(0.145 0 0);
    --background-surface: oklch(0.205 0 0);
    --background-muted: oklch(0.18 0 0);
    --background-text: oklch(0.985 0 0);
    --border: oklch(0.25 0 0);
    --muted-foreground: oklch(0.68 0 0);
    --ring: var(--missao-primary);
    --link: var(--missao-primary);
    --surface-selected: color-mix(in oklch, var(--missao-primary) 16%, var(--background-paper));
    --text-secondary: oklch(0.78 0 0);
    --state-info-bg: #102a56; --state-info-border: #194185; --state-info-text: #84adff;
    --state-warning-bg: #190f00; --state-warning-border: #6d4f08; --state-warning-text: #fed9a7;
    --state-danger-bg: #250704; --state-danger-border: #a83b2e; --state-danger-text: #f7d5d3;
    --state-success-bg: #00150f; --state-success-border: #006551; --state-success-text: #00fed0;
    --danger-solid: #a83b2e;
    --danger-solid-hover: #6e241b;
    --elevation-card: 0 1px 2px -1px rgb(0 0 0 / 0.5), 0 2px 6px -1px rgb(0 0 0 / 0.5);
    --elevation-raised: 0 2px 6px -1px rgb(0 0 0 / 0.6), 0 8px 18px -4px rgb(0 0 0 / 0.6);
    color-scheme: dark;
  }
}
[data-theme="dark"] {
  --missao-header: oklch(1 0 0);
  --background: oklch(0.09 0 0);
  --background-paper: oklch(0.145 0 0);
  --background-surface: oklch(0.205 0 0);
  --background-muted: oklch(0.18 0 0);
  --background-text: oklch(0.985 0 0);
  --border: oklch(0.25 0 0);
  --muted-foreground: oklch(0.68 0 0);
  --ring: var(--missao-primary);
  --link: var(--missao-primary);
  --surface-selected: color-mix(in oklch, var(--missao-primary) 16%, var(--background-paper));
  --text-secondary: oklch(0.78 0 0);
  --state-info-bg: #102a56; --state-info-border: #194185; --state-info-text: #84adff;
  --state-warning-bg: #190f00; --state-warning-border: #6d4f08; --state-warning-text: #fed9a7;
  --state-danger-bg: #250704; --state-danger-border: #a83b2e; --state-danger-text: #f7d5d3;
  --state-success-bg: #00150f; --state-success-border: #006551; --state-success-text: #00fed0;
  --danger-solid: #a83b2e;
  --danger-solid-hover: #6e241b;
  --elevation-card: 0 1px 2px -1px rgb(0 0 0 / 0.5), 0 2px 6px -1px rgb(0 0 0 / 0.5);
  --elevation-raised: 0 2px 6px -1px rgb(0 0 0 / 0.6), 0 8px 18px -4px rgb(0 0 0 / 0.6);
  color-scheme: dark;
}

/* Base */
* { box-sizing: border-box; }
html, body {
  margin: 0; background: var(--background); color: var(--background-text);
  font-family: var(--font-sans); font-size: 14px; line-height: 1.5; -webkit-text-size-adjust: 100%;
}
h1, h2, h3 { font-family: var(--font-display); color: var(--missao-header); margin: 0; }
h1 { font-size: 30px; font-weight: 700; line-height: 1.2; letter-spacing: -0.025em; }
h2 { font-size: 18px; font-weight: 600; line-height: 1.4; }
h3 { font-size: 15px; font-weight: 600; line-height: 1.4; }
p { margin: 0; font-size: 14px; }
a { color: var(--link); font-weight: 500; text-underline-offset: 4px; }
*:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: var(--radius-sm); }
form { margin: 0; }
strong { color: var(--background-text); font-weight: 600; }

/* Rótulo e campo (Input) */
label { display: grid; gap: 6px; font-size: 14px; font-weight: 500; color: var(--background-text); min-width: 0; }
input, select {
  font: inherit; font-size: 14px; height: 36px; width: 100%; min-width: 0;
  padding: 4px 10px; border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--background-paper); color: var(--background-text);
  transition: border-color .15s;
}
input::placeholder { color: var(--muted-foreground); }
input:focus-visible, select:focus-visible { border-color: var(--primary-500); border-radius: var(--radius-lg); }
input:disabled, select:disabled { cursor: not-allowed; opacity: .5; }
input[aria-invalid="true"] { border-color: var(--state-danger-text); }

/* Botão: default (principal), ghost = secundário do Hub, danger = destrutivo */
.btn {
  font: inherit; font-size: 14px; font-weight: 600; line-height: 1.25;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 10px; white-space: nowrap; flex-shrink: 0;
  border: 1px solid transparent; border-radius: var(--radius-lg);
  background: var(--missao-primary); color: var(--action-primary-foreground);
  cursor: pointer; user-select: none; text-align: center; text-decoration: none;
  transition: background-color .15s, color .15s;
}
.btn:hover { background: color-mix(in oklch, var(--missao-primary) 90%, transparent); }
.btn:focus-visible { outline: 3px solid color-mix(in oklch, var(--ring) 50%, transparent); outline-offset: 0; border-color: var(--ring); border-radius: var(--radius-lg); }
.btn:disabled { pointer-events: none; opacity: .5; }
.btn.ghost { background: var(--background-surface); color: var(--background-text); font-weight: 500; }
.btn.ghost:hover { background: color-mix(in oklch, var(--background-surface) 80%, transparent); }
.btn.danger { background: var(--danger-solid); color: #fff; font-weight: 500; }
.btn.danger:hover { background: var(--danger-solid-hover); }
.btn.sm { height: 32px; padding: 0 10px; font-size: 13px; }
.btn.full { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.btn-row > * { flex: 1 1 140px; }
.btn-row .btn { width: 100%; }
.linkish {
  font: inherit; font-weight: 500; background: none; border: 0; padding: 0;
  color: var(--link); cursor: pointer; text-decoration: none; text-underline-offset: 4px;
}
.linkish:hover { text-decoration: underline; }

/* Selo (Badge) */
.pill {
  display: inline-flex; align-items: center; gap: 4px; width: fit-content; flex-shrink: 0;
  padding: 2px 4px; border: 1px solid transparent; border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 500; line-height: 1.33; white-space: nowrap;
}
.pill.superadmin { background: var(--missao-primary); color: var(--action-primary-foreground); }
.pill.coordenador { background: var(--state-info-bg); color: var(--state-info-text); }
.pill.editor { background: var(--background-muted); color: var(--background-text); border-color: var(--border); }

/* Texto */
.eyebrow { color: var(--muted-foreground); font-weight: 700; font-size: 12px; line-height: 1; letter-spacing: .1em; text-transform: uppercase; }
.muted { color: var(--muted-foreground); }
.tiny { font-size: 12px; color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); overflow-wrap: anywhere; }

/* Avisos (estados) */
.alert { border: 1px solid; border-radius: var(--radius-lg); padding: 10px 12px; font-size: 14px; }
.alert strong { color: inherit; }
.alert.err { background: var(--state-danger-bg); border-color: var(--state-danger-border); color: var(--state-danger-text); }
.alert.ok { background: var(--state-success-bg); border-color: var(--state-success-border); color: var(--state-success-text); }
.alert.info { background: var(--state-info-bg); border-color: var(--state-info-border); color: var(--state-info-text); }
.alert.warn { background: var(--state-warning-bg); border-color: var(--state-warning-border); color: var(--state-warning-text); }

/* Header */
.topo {
  position: sticky; top: 0; z-index: 40;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px;
  min-height: 56px; padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in oklch, var(--background-paper) 85%, transparent);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
@media (min-width: 1024px) { .topo { padding: 8px 24px; } }
.marca { display: flex; align-items: center; gap: 10px; min-width: 0; color: inherit; text-decoration: none; }
.marca-ponto { width: 12px; height: 12px; border-radius: 999px; background: var(--missao-primary); flex: none; }
.marca-nome { display: block; font-family: var(--font-display); font-weight: 600; color: var(--missao-header); font-size: 16px; line-height: 1.1; }
.marca small { display: block; font-size: 12px; color: var(--muted-foreground); line-height: 1.3; }

/* Menu do header: itens do menu do Hub */
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a {
  position: relative; display: flex; align-items: center; height: 36px; padding: 0 10px;
  border-radius: var(--radius-md); color: var(--muted-foreground); font-weight: 400; font-size: 14px;
  text-decoration: none; transition: background-color .15s, color .15s;
}
.nav a:hover { background: color-mix(in oklch, var(--missao-primary) 10%, transparent); color: var(--background-text); }
.nav a[aria-current="page"] { background: color-mix(in oklch, var(--missao-primary) 15%, transparent); color: var(--background-text); font-weight: 600; }
.nav a[aria-current="page"]::before {
  content: ""; position: absolute; left: 6px; right: 6px; bottom: 2px; height: 3px;
  border-radius: 999px; background: var(--missao-primary);
}
.quem { font-size: 12px; color: var(--muted-foreground); overflow-wrap: anywhere; }
.topo .sair { margin: 0; }

/* Conteúdo */
main { display: grid; justify-items: center; align-content: start; padding: 24px 16px; }
@media (min-width: 768px) { main { padding: 40px 24px; } }
.col { width: 100%; max-width: 440px; display: grid; gap: 16px; }
.col.larga { max-width: 960px; }

/* Card */
.card {
  display: grid; gap: 16px; min-width: 0; padding: 24px;
  border: 1px solid var(--border); border-radius: var(--radius-xl);
  background: var(--background-paper); box-shadow: var(--elevation-card);
}
.card > h1 + .muted, .card > .eyebrow + h1 { margin-top: -8px; }

/* Pedido de acesso do Claude */
.par { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; color: var(--muted-foreground); }
.chip { display: grid; padding: 8px 12px; border-radius: var(--radius-lg); background: var(--background-surface); color: var(--background-text); font-weight: 600; }
.chip small { font-weight: 400; color: var(--muted-foreground); font-family: var(--font-mono); font-size: 12px; }
.chip.forte { background: var(--surface-selected); box-shadow: inset 0 0 0 1px var(--missao-primary); }
dl.fatos { display: grid; margin: 0; border-top: 1px solid var(--border); }
dl.fatos div { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 0; border-bottom: 1px solid var(--border); }
dl.fatos dt { color: var(--muted-foreground); font-size: 12px; }
dl.fatos dd { margin: 0; color: var(--background-text); text-align: right; overflow-wrap: anywhere; }

/* Listas (pessoas, acessos, conexões): linhas de tabela do Hub */
.lista { list-style: none; margin: 0; padding: 0; display: grid; border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.lista li {
  display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap;
  padding: 12px 16px; transition: background-color .15s;
}
.lista li + li { border-top: 1px solid var(--border); }
.lista li:hover { background: var(--background-muted); }
.lista .info { display: grid; min-width: 0; }
.lista .info strong { overflow-wrap: anywhere; }
.acoes { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.acoes form { display: flex; gap: 6px; align-items: center; }
.acoes select { width: auto; height: 32px; padding: 2px 8px; }
.motivo { font-size: 12px; color: var(--muted-foreground); }
.grade { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); align-items: end; }

/* Filtro por sistema: abas do Hub, sublinhado amarelo, sem pílula */
.filtro { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--border); }
.filtro a {
  margin-bottom: -1px; padding: 8px 16px; border-bottom: 2px solid transparent;
  color: var(--muted-foreground); font-size: 14px; font-weight: 400; text-decoration: none;
  transition: color .15s;
}
.filtro a:hover { color: var(--background-text); }
.filtro a[aria-current="page"] { border-bottom-color: var(--missao-primary); color: var(--background-text); font-weight: 600; }

.pilha { display: grid; gap: 16px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
