/* Fontes no próprio site (a CSP não aceita outras origens), licença OFL em static/fonts/.
   Manrope no texto; Playfair Display nos títulos e números grandes. */
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("../fonts/manrope-latin-wght.938c6e8019b6.woff2") format("woff2");
}
@font-face {
  font-family: "Playfair Display";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("../fonts/playfair-display-latin-wght.ef05b30d6e5c.woff2") format("woff2");
}

/* Tokens de design (especificação, seção 15.3). Cada cor traz a versão clara e a escura
   (light-dark); vale a do sistema, salvo se a pessoa escolheu o modo no menu
   (data-theme, static/js/nav.js). Contraste do texto conferido para WCAG 2.2 AA nos dois. */
:root {
  color-scheme: light dark;
  --bg: light-dark(#eceef3, #0d0d10);
  --surface: light-dark(#ffffff, #18181d);
  --surface-2: light-dark(#f6f6f9, #1f1f25);
  --hover: light-dark(#efeff4, #26262e);
  --text: light-dark(#17171c, #ececf1);
  --muted: light-dark(#5e5e6a, #a6a6b3);
  --border: light-dark(#e3e3ea, #2e2e37);
  --accent: light-dark(#5146e5, #a69eff);
  --accent-hover: light-dark(#4136cc, #bcb6ff);
  --accent-soft: light-dark(#eeedfd, #2a2750);
  --accent-text: light-dark(#ffffff, #15122e);
  /* O menu acompanha o tema: claro no modo diurno, escuro no noturno (pedido do dono do
     produto em 2026-11-04). */
  --rail: light-dark(#ffffff, #050507);
  --rail-text: light-dark(#4b4b57, #b9b9c4);
  --rail-strong: light-dark(#16161a, #ffffff);
  --rail-muted: light-dark(#6b6b77, #9a9aa6);
  --rail-active: light-dark(#eeedfc, #2a2a32);
  --rail-current: light-dark(#5146e5, #a69eff);
  --rail-border: light-dark(#e2e2ea, #26262e);
  --rail-divider: light-dark(rgb(0 0 0 / 8%), rgb(255 255 255 / 10%));
  --rail-shadow: light-dark(rgb(20 20 40 / 14%), rgb(0 0 0 / 35%));
  --focus: #f0a500;
  --ok: light-dark(#1e7a3c, #7bd389);
  --warn: light-dark(#8a5a00, #f2c14e);
  --danger: light-dark(#b3261e, #ff8a80);
  --ok-bg: light-dark(#e6f4ea, #1d2e22);
  --warn-bg: light-dark(#fff4dc, #33290f);
  --danger-bg: light-dark(#fbe9e7, #3a1d1b);
  /* O ponto do selo "em andamento": fixo, para não mudar de sentido com a cor da área. */
  --info: light-dark(#1d4ed8, #93b4fd);
  --shadow-1: light-dark(rgb(20 20 40 / 6%), rgb(0 0 0 / 40%));
  --shadow-2: light-dark(rgb(20 20 40 / 6%), rgb(0 0 0 / 35%));
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px var(--shadow-1), 0 2px 6px var(--shadow-1);
  --shadow: 0 1px 2px var(--shadow-1), 0 10px 30px var(--shadow-2);
  --space: 1rem;
  /* Movimento: sai rápido e assenta devagar. */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Playfair Display", Georgia, "Times New Roman", serif;
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2 { font-family: var(--font-display); font-weight: 600; }
h1 { font-size: 2.25rem; letter-spacing: -0.01em; line-height: 1.15; margin: 0 0 0.4rem; }
h1 + .muted, h1 + p { margin-top: 0; }
h1 + :is(.card, table, form) { margin-top: 1.25rem; }
h2 { font-size: 1.3rem; letter-spacing: 0; margin: 2rem 0 0.75rem; }
/* O h3 e o h4 ficam em Manrope, menores e mais leves que o h2 em Playfair: antes, o negrito do
   navegador fazia o h3 pesar mais que o título acima dele (base visual, critério 2). */
h3, h4 { font-family: var(--font); font-weight: 600; letter-spacing: 0; }
h3 { font-size: 1.05rem; margin: 1.5rem 0 0.5rem; }
h4 { font-size: 1rem; }
.card > h2:first-child, .card h2:first-of-type, .card > h3:first-child { margin-top: 0; }
/* Links sem sublinhado (pedido do dono do produto); o peso maior os distingue do texto
   sem depender só da cor (WCAG 1.4.1). */
a { color: var(--link, var(--accent)); text-decoration: none; font-weight: 600; }
a:not(.button):hover { color: var(--link-hover, var(--accent-hover)); }
p { margin: 0 0 0.75rem; }

/* Foco sempre visível (F-08, WCAG 2.2 AA). */
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.skip { position: absolute; left: -999px; }
.skip:focus { left: var(--space); top: var(--space); background: var(--surface); padding: 0.5rem; z-index: 10; }
/* !important: regra de componente (ex.: `.card-move label { width: 100% }`) não pode
   devolver tamanho ao texto escondido; sem isso, ele empurrava a página para os lados. */
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0 0 0 0) !important; white-space: nowrap !important; border: 0 !important; }
.sprite { display: none; }
/* O atributo `hidden` vence o `display` das classes (botões, grades): os scripts escondem com ele. */
[hidden] { display: none !important; }
/* Novo projeto em etapas (grupo D, critério 5): "Etapa 2 de 3: Questionário", acima da etapa. */
.form-steps-count { margin: 0.75rem 0; color: var(--muted); font-weight: 600; }
/* A criticidade calculada fica grudada embaixo enquanto o questionário está à vista, para mudar
   diante de quem responde; no celular, acima da barra de navegação. */
.criticality-preview {
  position: sticky; bottom: 0.75rem; z-index: 5; margin: 0.5rem 0 0; padding: 0.6rem 0.8rem; border: 1px solid var(--accent);
  border-radius: var(--radius); background: color-mix(in oklab, var(--accent) 12%, var(--surface)); color: var(--text); font-weight: 500; box-shadow: var(--shadow);
}
@media (max-width: 40rem) {
  .criticality-preview { bottom: calc(5.25rem + env(safe-area-inset-bottom, 0px)); }
  /* Só "Média, 5 de 10 pontos": o texto inteiro tinha cinco linhas e tomava a tela. */
  .criticality-preview .preview-more { display: none; }
}
/* O foco nunca fica atrás do quadro (WCAG 2.4.11): a resposta que recebe o foco pelo Tab para
   acima dele. A altura vem do project_form.js, que a mede. */
.form-step:has(.criticality-preview:not([hidden])) input { scroll-margin-bottom: calc(var(--preview-h, 3rem) + 1.25rem); }
.required-now-note { display: inline-block; margin-left: 0.35rem; padding: 0 0.5rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 0.75rem; font-weight: 600; }
.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

/* Estrutura: um menu só, o trilho escuro fixo à esquerda. Com o mouse ou o foco do
   teclado, ele se alarga por cima da página e mostra os nomes. */
.shell { --rail-w: 68px; padding: 1rem 1rem 1rem calc(var(--rail-w) + 2rem); min-height: 100vh; }
.rail {
  position: fixed; z-index: 20; top: 1rem; bottom: 1rem; left: 1rem; width: var(--rail-w);
  display: flex; flex-direction: column; gap: 0.25rem; padding: 12px;
  background: var(--rail); color: var(--rail-text); border: 1px solid var(--rail-border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); overflow: hidden auto; transition: width 0.26s var(--ease-out), box-shadow 0.26s var(--ease-out);
}
/* Letra grande ou janela baixa: o menu rola por dentro, mas sem barra de rolagem, que comia
   17 dos 68 px do trilho, empurrava os ícones e cortava o avatar. A rolagem segue pela roda,
   pelo toque e pelo Tab; uma sombra em cima e embaixo avisa que há mais itens e some no fim
   (as camadas "local" acompanham o conteúdo e cobrem a sombra das bordas). */
.rail {
  scrollbar-width: none;
  background:
    linear-gradient(var(--rail) 40%, transparent) top / 100% 32px no-repeat local,
    linear-gradient(transparent, var(--rail) 60%) bottom / 100% 32px no-repeat local,
    radial-gradient(farthest-side at 50% 0, var(--rail-shadow), transparent) top / 100% 14px no-repeat scroll,
    radial-gradient(farthest-side at 50% 100%, var(--rail-shadow), transparent) bottom / 100% 14px no-repeat scroll,
    var(--rail);
}
.rail::-webkit-scrollbar { display: none; }
.rail:hover, .rail:focus-within { width: 15.5rem; box-shadow: 0 20px 50px var(--rail-shadow); }
/* Os nomes entram depois que a largura começou a abrir, deslizando um pouco; ao fechar, saem
   antes, sem atraso, para não aparecerem cortados. */
.rail .label { opacity: 0; transform: translateX(-6px); white-space: nowrap; transition: opacity 0.12s ease, transform 0.12s ease; }
/* O botão de tema depende do JavaScript; sem ele, vale o tema do sistema. */
html:not(.js) .theme-toggle { display: none !important; }
.rail:hover .label, .rail:focus-within .label { opacity: 1; transform: none; transition: opacity 0.2s ease 0.08s, transform 0.26s var(--ease-out) 0.06s; }
.rail-top { display: flex; align-items: center; gap: 0.25rem; }
.rail-body { display: flex; flex-direction: column; flex: 1; gap: 0.25rem; }
.rail a, .rail button {
  position: relative; display: flex; align-items: center; justify-content: flex-start; gap: 0.85rem; width: 100%; min-height: 44px; padding: 0 12px;
  border: 0; border-radius: 12px; background: none; color: var(--rail-text); font: inherit; text-decoration: none; white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.rail a .icon, .rail button .icon { transition: transform 0.2s var(--ease-out); }
.rail a:hover .icon, .rail button:hover .icon { transform: scale(1.08); }
.rail a:hover, .rail button:hover, .rail a[aria-current] { background: var(--rail-active); color: var(--rail-strong); }
.rail a[aria-current] .icon { color: var(--rail-current); }
.rail .rail-brand { flex: 1; color: var(--rail-strong); font-family: var(--font-display); font-size: 1.15rem; font-weight: 600; }
.rail .rail-brand:hover { background: none; }
.dot { position: absolute; top: 5px; left: 24px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 999px; background: #5146e5; color: #fff; font-size: 0.7rem; font-weight: 600; line-height: 18px; text-align: center; }
.menu-toggle { display: none !important; }
/* Menu da conta (grupo D, D1): o avatar abre, pela Popover API, um menu ao lado do trilho aberto,
   com quem é a pessoa e os itens da conta. Ele fica dentro do trilho no HTML (o trilho continua
   aberto enquanto o mouse ou o foco estão nele); a posição fixa só vale onde o navegador entende
   o popover, e sem suporte o menu aparece no fluxo do trilho, como antes. */
.rail .account-button { padding: 0; gap: 0.75rem; margin: 0.25rem 0 0; border-radius: 999px; text-align: left; }
.account-button > .label { min-width: 0; flex: 1; }
.account-button .who-name { display: block; overflow: hidden; text-overflow: ellipsis; }
.account-menu + nav { margin-top: 0.25rem; padding-top: 0.25rem; border-top: 1px solid var(--rail-divider); }
.account-menu .label { opacity: 1; transform: none; }
.who { display: flex; gap: 0.75rem; align-items: center; padding: 0.25rem 0.25rem 0.75rem; margin-bottom: 0.5rem; border-bottom: 1px solid var(--rail-divider); }
.who-text { min-width: 0; flex: 1; }
.account-menu .who p { white-space: normal; overflow-wrap: anywhere; }
.who p { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-name { color: var(--rail-strong); font-weight: 600; }
.who-mail { font-size: 0.8rem; }
.avatar { width: 44px; height: 44px; flex: none; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, #5146e5, #8b7dff); color: #fff; font-weight: 600; }
/* Margens enxutas para o trilho do PMO (20 itens) caber em 900 px de altura (grupo D, critério 1). */
.nav-label { color: var(--rail-muted); font-size: 0.75rem; margin: 0.5rem 12px 0.25rem; }
.nav-label:first-child { margin-top: 0.25rem; }
.nav-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.nav-list form { margin: 0; }
.rail-account { margin-top: auto; padding-top: 0.25rem; border-top: 1px solid var(--rail-divider); }
@supports selector(:popover-open) {
  .account-menu {
    position: fixed; inset: auto; top: 6rem; left: 17rem; width: 17rem; max-height: calc(100vh - 7rem); overflow-y: auto; margin: 0; padding: 12px;
    background: var(--rail); color: var(--rail-text); border: 1px solid var(--rail-border); border-radius: var(--radius-lg); box-shadow: 0 20px 50px var(--rail-shadow);
  }
  .account-menu:popover-open { animation: menu-in 0.22s var(--ease-out); }
  .account-menu + nav { margin-top: 0; }
  /* Celular e tablet: o menu da conta abre logo abaixo da barra do topo, na largura da tela. */
  @media (max-width: 56rem) {
    .account-menu { top: 4.75rem; left: 0.75rem; right: 0.75rem; width: auto; max-height: calc(100vh - 5.5rem); }
  }
}
/* Troca de página (View Transitions entre documentos): o menu fica parado e só o conteúdo
   troca, a página antiga sumindo e a nova subindo um pouco. Navegador sem suporte troca sem
   animação. Só CSS: nada muda para quem está sem JavaScript. */
@view-transition { navigation: auto; }
.rail { view-transition-name: rail; }
.page { view-transition-name: page; }
::view-transition-old(root), ::view-transition-new(root) { animation: none; }
::view-transition-group(rail), ::view-transition-group(bottom-nav) { animation: none; }
::view-transition-old(page) { animation: page-out 0.14s ease-in both; }
::view-transition-new(page) { animation: page-in 0.32s var(--ease-out) 0.06s both; }
@keyframes page-out { to { opacity: 0; } }
@keyframes page-in { from { opacity: 0; transform: translateY(10px); } }
@keyframes menu-in { from { opacity: 0; transform: translateY(-8px); } }
/* Pelo menu, a página nova abre num círculo que nasce no ícone clicado (`static/js/nav.js`
   põe a classe e o centro): o conteúdo deixa de ter nome próprio e vai junto com a raiz, a
   antiga fica parada por baixo, e o menu continua por cima. */
html.vt-circle .page { view-transition-name: none; }
html.vt-circle::view-transition-old(root) { animation: none; }
html.vt-circle::view-transition-new(root) { animation: circle-in 1.1s var(--ease-out) both; }
@keyframes circle-in {
  from { clip-path: circle(0 at var(--vt-x, 50%) var(--vt-y, 50%)); }
  to { clip-path: circle(var(--vt-r, 150%) at var(--vt-x, 50%) var(--vt-y, 50%)); }
}

@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

.page { background: var(--surface); border: 1px solid var(--border); border-radius: 28px; padding: 2rem 2.25rem 2.5rem; box-shadow: var(--shadow); min-height: calc(100vh - 2rem); }

/* Telas de quem ainda não entrou: só o cartão, centralizado. */
.entrance-page { max-width: 30rem; min-height: 0; margin: 8vh auto 2rem; }
.entrance-brand { display: flex; align-items: center; gap: 0.5rem; font-family: var(--font-display); font-size: 1.2rem; font-weight: 600; margin-bottom: 1.5rem; }
.entrance-brand .theme-toggle { margin-left: auto; font-family: var(--font); }
.entrance-brand .theme-toggle .icon { width: 18px; height: 18px; padding: 0; background: none; color: inherit; }
.entrance-brand > .icon { width: 28px; height: 28px; padding: 5px; border-radius: 9px; background: var(--accent); color: var(--accent-text); box-sizing: content-box; }
.entrance-page h1 { font-size: 1.9rem; }

/* Páginas de erro (403, 404, 500, CSRF): o código grande na cor da área, o que houve e o caminho
   de volta. No cartão da tela de entrar, sem margem própria. */
.error-page { max-width: 36rem; margin: 12vh auto 0; }
.entrance-page .error-page { margin: 0; }
.error-code { margin: 0 0 0.25rem; font-family: var(--font-display); font-size: 4.5rem; font-weight: 600; line-height: 1; color: var(--accent); font-variant-numeric: lining-nums; }
.error-page > p:last-child { margin: 1.5rem 0 0; }

.inline { display: inline; margin: 0; }
button, .button, .helptext a {
  font: inherit; font-weight: 500; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-text);
  padding: 0.5rem 1.15rem; border-radius: 999px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  min-height: 44px; /* alvo de toque confortável no celular */
}
button:hover, .button:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
button.secondary, .button.secondary, .helptext a { background: var(--surface); border-color: var(--border); color: var(--text); }
button.secondary:hover, .button.secondary:hover, .helptext a:hover { background: var(--hover); color: var(--text); }
button.danger, .button.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
button + .button, form > :is(button, .button) + :is(button, .button) { margin-left: 0.5rem; }
/* Links na ajuda de um campo ("Esqueceu sua senha?") também são botões. */
.helptext:has(a) { display: block; margin-top: 0.5rem; }
button.small, .button.small, .helptext a { min-height: 36px; padding: 0.3rem 0.9rem; font-size: 0.9rem; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 1.25rem 1.4rem; margin-bottom: var(--space); box-shadow: var(--shadow-sm); }
.card > :last-child { margin-bottom: 0; }
/* No máximo duas molduras, a página e a seção (base visual, critério 1): dentro da página, a seção
   fica sem sombra, e a tabela dentro da seção, sem borda, raio e fundo próprios. O `:where` deixa
   a regra com o peso de `.card`, para a seção não lida e o cartão escolhido manterem a borda e o
   anel. */
:where(.page) .card { box-shadow: none; }
.card table { border: 0; border-radius: 0; background: none; }
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.actions > h1 { margin: 0 auto 0 0; }
.actions:has(> h1) { margin-bottom: 1.5rem; }
.muted { color: var(--muted); }

/* Indicador de carregando do htmx (ADR-0051): a configuração não deixa o htmx injetar o <style>
   dele, que a CSP bloquearia; as mesmas regras ficam aqui. */
.htmx-indicator { opacity: 0; visibility: hidden; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; visibility: visible; transition: opacity 200ms ease-in; }
@media (prefers-reduced-motion: reduce) {
  .htmx-request .htmx-indicator, .htmx-request.htmx-indicator { transition: none; }
}

.messages { list-style: none; padding: 0; margin: 0 0 var(--space); }
.msg { padding: 0.7rem 1rem; border-radius: var(--radius); margin-bottom: 0.5rem; border: 1px solid var(--border); }
.msg.success { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.msg.error { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
.msg.warning { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
/* O aviso no lugar do htmx (ADR-0051): a região fica na página, vazia, para o leitor de tela
   anunciar o que entrar nela; o botão que só serve sem JavaScript some com o htmx. */
.save-status:empty { display: none; }
.save-status { margin-top: 0.75rem; }
.save-status .msg { margin: 0.4rem 0 0; padding: 0.45rem 0.75rem; font-size: 0.9rem; }
.htmx .autosave-button { display: none; }

.badge { display: inline-block; vertical-align: middle; padding: 0.1rem 0.6rem; border-radius: 999px; font-size: 0.8rem; font-weight: 500; background: var(--hover); color: var(--text); border: 1px solid transparent; }
.badge.sample { background: none; border: 1px dashed var(--border); color: var(--muted); }
/* Selos em quatro famílias, sempre com texto (base visual, critério 5; WCAG 1.4.1). A saúde
   (`.health-chip`) é a única cheia e com semáforo.
   Situação: neutra, com uma marca de tom (`status_tone`, apps/core/ui.py): círculo vazio
   aguardando, cheio azul em andamento, losango âmbar em atenção, cheio verde concluído, traço cinza
   sem conclusão. */
.badge.status { display: inline-flex; align-items: center; vertical-align: middle; gap: 0.4rem; background: var(--surface-2); color: var(--text); border-color: var(--border); }
.badge.status::before { content: ""; flex: none; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--muted); }
.badge.status.waiting::before { background: none; box-shadow: inset 0 0 0 1.5px var(--muted); }
.badge.status.active::before { background: var(--info); }
.badge.status.attention::before { border-radius: 1px; transform: rotate(45deg); background: var(--warn); }
.badge.status.done::before { background: var(--ok); }
.badge.status.ended { color: var(--muted); }
.badge.status.ended::before { height: 2px; border-radius: 1px; background: var(--muted); }
/* Criticidade: contorno, sem as cores da saúde, com três barras; o nível enche as barras. */
/* A barra vazia é a cor do texto em 25%, visível nos dois temas. */
.badge.criticality { display: inline-flex; align-items: center; vertical-align: middle; gap: 0.4rem; background: none; border-color: var(--border); color: var(--text); --bar-off: color-mix(in oklab, currentColor 25%, transparent); }
.badge.criticality::before {
  content: ""; flex: none; width: 13px; height: 0.75em;
  background:
    linear-gradient(var(--bar-1), var(--bar-1)) 0 100% / 3px 45% no-repeat,
    linear-gradient(var(--bar-2), var(--bar-2)) 5px 100% / 3px 72% no-repeat,
    linear-gradient(var(--bar-3), var(--bar-3)) 10px 100% / 3px 100% no-repeat;
}
.badge.criticality.low { --bar-1: currentColor; --bar-2: var(--bar-off); --bar-3: var(--bar-off); }
.badge.criticality.medium { --bar-1: currentColor; --bar-2: currentColor; --bar-3: var(--bar-off); }
.badge.criticality.high { --bar-1: currentColor; --bar-2: currentColor; --bar-3: currentColor; }
/* Alerta (atrasado, revisão vencida, crítico, sem aprovador): contorno na cor do aviso e um "!"
   num círculo. */
.badge.alert { display: inline-flex; align-items: center; vertical-align: middle; gap: 0.35rem; background: none; border-color: currentColor; color: var(--danger); font-weight: 600; }
.badge.alert.warn { color: var(--warn); }
.badge.alert::before { content: "!"; flex: none; display: inline-grid; place-items: center; width: 1.1em; height: 1.1em; border: 1.5px solid currentColor; border-radius: 50%; font-size: 0.8em; font-weight: 700; line-height: 1; }

/* Estado vazio (base visual, critério 6; `core/_empty.html`): desenho leve, frase e, para quem
   pode, o botão da próxima ação. O desenho pega as cores dos tokens, nos dois temas. */
.empty { text-align: center; padding: 2rem 1rem; color: var(--text); }
.empty p { margin: 0.4rem auto; max-width: 32rem; }
.empty p:has(.button) { margin-top: 1rem; }
.empty-art { display: block; width: 7.5rem; height: auto; margin: 0 auto 0.75rem; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.empty-art .line { stroke: var(--border); }
.empty-art .fill { fill: var(--surface-2); }
.empty-art .accent { fill: var(--accent-soft); stroke: var(--accent); }
.empty-art .accent-line { stroke: var(--accent); }
.empty-art .dots { fill: var(--border); }

/* Cabeçalho do projeto com as abas fixas (grupo B, critério 1; `projects/_header.html`). O nome
   tem o mesmo tamanho em todas as páginas do projeto; o `h1` da aba fica abaixo dele. A faixa
   rola dentro de si no celular (sem rolar a página), e o `nav.js` a leva até a aba atual, que
   tem a cor, o peso e o traço de baixo. */
.project-header { margin-bottom: 1.25rem; }
.project-title { font-family: var(--font-display); font-size: 1.9rem; font-weight: 600; letter-spacing: -0.01em; line-height: 1.15; margin: 0 0 0.4rem; }
.project-title a { color: var(--text); font-weight: 600; }
.project-title a:hover { color: var(--accent); }
.project-header .actions { margin: 0 0 0.75rem; }
.project-tabs { min-width: 0; border-bottom: 1px solid var(--border); }
.project-tabs ul {
  position: relative; display: flex; flex-wrap: nowrap; gap: 0.25rem; margin: 0; padding: 0;
  list-style: none; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin;
  overscroll-behavior-x: contain;
}
.project-tabs li { flex: none; }
.project-tabs a {
  display: block; padding: 0.55rem 0.8rem; white-space: nowrap;
  color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent;
}
.project-tabs a:hover { color: var(--text); }
.project-tabs a[aria-current="page"] { color: var(--accent); font-weight: 700; border-bottom-color: var(--accent); }
.project-header ~ h1, .project-header ~ .actions > h1 { font-size: 1.5rem; margin-bottom: 0.4rem; }
/* Resumo no topo da visão geral (grupo B, critério 2; `projects/_summary.html`): uma grade de
   itens, cada um leva à aba. Fica fora de seção (`.card`), então o item é a segunda moldura. No
   celular, duas colunas, e a saúde, com o motivo, ocupa a linha inteira. */
.project-summary { margin: 0 0 1.5rem; }
.project-summary ul { display: grid; grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr)); gap: 0.75rem; margin: 0; padding: 0; list-style: none; }
.project-summary li { min-width: 0; }
.summary-item {
  display: flex; flex-direction: column; gap: 0.3rem; height: 100%; box-sizing: border-box;
  padding: 0.8rem 1rem; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface-2); color: var(--text); text-decoration: none;
}
a.summary-item:hover { border-color: var(--accent); color: var(--text); }
.summary-label { font-size: 0.8rem; font-weight: 600; color: var(--muted); }
.summary-value { font-size: 1.05rem; font-weight: 600; overflow-wrap: anywhere; }
.summary-note { font-size: 0.85rem; color: var(--muted); }
/* Detalhe em duas colunas (grupo B, critério 3): o conteúdo à esquerda e o painel "Propriedades"
   à direita, a partir de 64rem; abaixo, uma coluna. O painel é a seção (`.card`), e os
   formulários dentro dele não são cartões: cada um fica separado por um traço. */
.detail-main { min-width: 0; }
.detail-side .side-form { margin: 0; padding-top: 0.9rem; border-top: 1px solid var(--border); }
.detail-side .side-form + .side-form { margin-top: 0.9rem; }
.detail-side .side-form .field { margin-bottom: 0.6rem; }
.detail-side .side-form > h3:first-of-type { margin-top: 0; }
@media (min-width: 64rem) {
  .detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) 20rem; gap: 0 1.25rem; align-items: start; }
}
@media (max-width: 40rem) {
  .project-summary ul { grid-template-columns: 1fr 1fr; gap: 0.5rem; }
  .summary-item { padding: 0.65rem 0.75rem; }
  .project-summary li.wide { grid-column: 1 / -1; }
}
@media print {
  .project-tabs { display: none; }
}
.notifications { list-style: none; padding: 0; }
/* Notificações por dia, com ícone e tom por tipo (grupo C, critério 4; `notifications/inbox.py`). */
.notice-day { font-size: 1.05rem; margin: 1.5rem 0 0.5rem; color: var(--muted); }
.notice { display: flex; gap: 0.9rem; align-items: flex-start; }
.notice-body { min-width: 0; flex: 1; }
.notice-title { margin: 0 0 0.15rem; font-size: 1rem; }
.notice-icon { flex: none; display: grid; place-items: center; width: 2.25rem; height: 2.25rem; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.notice-icon .icon { width: 18px; height: 18px; }
.notice-icon.active { background: color-mix(in oklab, var(--info) 14%, transparent); color: var(--info); }
.notice-icon.attention { background: var(--warn-bg); color: var(--warn); }
.notice-icon.done { background: var(--ok-bg); color: var(--ok); }
.card.unread { border-left: 4px solid var(--accent); }

/* Formulários */
form .field, form div:has(> label), form fieldset, form > p:has(> label) { margin-bottom: 1rem; }
label, legend { font-weight: 500; display: block; margin-bottom: 0.3rem; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 0.6rem 0.9rem; }
input:not([type]), input[type="text"], input[type="date"], input[type="email"], input[type="password"], input[type="number"],
input[type="search"], input[type="tel"], input[type="url"], input[type="file"], input[type="time"], select, textarea {
  width: 100%; font: inherit; padding: 0.55rem 0.8rem; border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface); color: var(--text); min-height: 44px;
}
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
/* Campo que se vê mas não se edita (ex.: a linha de base no projeto iniciado). */
:is(input, select, textarea):disabled { background: var(--surface-2); color: var(--muted); border-color: var(--border); cursor: not-allowed; }
form p:has(> input[type="checkbox"]) { display: flex; align-items: center; gap: 0.5rem; }
form p:has(> input[type="checkbox"]) label { margin: 0; order: 1; }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; accent-color: var(--accent); }
/* Campos do as_field_group vêm sem invólucro: o espaço sai do campo anterior. */
form :is(input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), select, textarea) + :is(label, button, .actions) { margin-top: 1rem; }
fieldset label { font-weight: 400; display: flex; gap: 0.4rem; align-items: center; }
/* Cada campo vem num invólucro com o tipo (`apps/core/forms_rendering.py`, base visual, V1): no
   máximo 40rem, e a caixa de marcar na frente do rótulo. */
.field { max-width: 40rem; }
.field > fieldset { margin-bottom: 0; }
.field-checkbox { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.5rem; }
.field-checkbox > label { order: 1; margin: 0; }
.field-checkbox > :is(.helptext, .errorlist) { order: 2; flex-basis: 100%; }
.actions > .field { flex: 1 1 12rem; margin-bottom: 0; align-self: start; }
/* Formulários de criar e editar (V2): no máximo 40rem e, a partir de 56rem, os campos curtos dois
   por linha. Texto longo, grupos e tudo o que não é campo ocupam a linha inteira. A grade segue a
   ordem do HTML (sem `dense`), para a ordem do Tab ser a visual. */
.form-grid { max-width: 40rem; }
/* Os formulários do allauth vêm em `<p>` (`form.as_p`), com o mesmo limite. */
form > p:has(> :is(input:not([type="checkbox"]), select, textarea)) { max-width: 40rem; }
/* As linhas de um formset (itens da pauta, fases do modelo) também. */
form fieldset.card { max-width: 40rem; }
/* Um par já agrupado em `.actions` (data e hora, moeda e unidade) segue as colunas da grade. */
.form-grid > .actions > .field { margin-bottom: 1rem; }
@media (min-width: 56rem) {
  .form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1rem; align-items: start; }
  .form-grid > :not(.field) { grid-column: 1 / -1; }
  .form-grid > .actions:has(> .field) { display: grid; grid-template-columns: subgrid; gap: 0 1rem; align-items: start; }
  .form-grid > :is(button, .button) { justify-self: start; }
  .form-grid > .field-textarea, .form-grid > .field-radioselect, .form-grid > .field-checkboxselectmultiple,
  .form-grid > .field-selectmultiple, .form-grid > .field-checkbox, .form-grid > .field-clearablefile,
  .form-grid > .field-file { grid-column: 1 / -1; }
}
.helptext { color: var(--muted); font-size: 0.9rem; }
.errorlist { color: var(--danger); padding-left: 1.1rem; margin: 0.25rem 0; }
.errorlist.nonfield { background: var(--danger-bg); border-radius: var(--radius); padding: 0.6rem 1.6rem; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.5rem 0; }
details summary { cursor: pointer; color: var(--accent); font-size: 0.9rem; }
/* Ação sem volta (encerrar ou cancelar o projeto): no fim da página, fechada, com o vermelho só no
   título; aberta, a borda também fica vermelha. */
.danger-zone { margin-top: 2.5rem; padding: 0.4rem 1.4rem; border: 1px solid var(--border); border-radius: 20px; background: var(--surface); }
.danger-zone > summary { padding: 0.6rem 0; color: var(--danger); font-size: 1rem; font-weight: 600; }
.danger-zone[open] { border-color: var(--danger); padding-bottom: 1.25rem; }

/* Tabelas: contêiner arredondado; viram cartões em telas estreitas (360 px, F-08). */
table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; overflow: hidden; margin-bottom: var(--space); }
td { font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 0.8rem 1rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: var(--surface-2); color: var(--muted); font-size: 0.85rem; font-weight: 500; }
caption { padding: 0.8rem 1rem 0.4rem; text-align: left; font-weight: 600; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface-2); }
/* A linha da fila com corte abre o grupo do que fica abaixo da capacidade (ADR-0040). */
tr.queue-line th { background: var(--warn-bg); color: var(--warn); font-weight: 600; }
dl.fields { display: grid; grid-template-columns: max-content 1fr; gap: 0.5rem 1.5rem; margin: 0 0 var(--space); }
dl.fields dt { color: var(--muted); }
dl.fields dd { margin: 0; white-space: pre-line; }
dl.fields dd.blocks { white-space: normal; }
/* Texto digitado sem espaços (uma URL no título) quebra em vez de empurrar a página para os lados;
   vale para todo título de seção (o de um objetivo estourava a página, vistoria de 2026-11-05). */
h1, h2, h3, h4, dl.fields dd, .button.small, td.long-text, .notifications p { overflow-wrap: anywhere; }

@media (max-width: 40rem) {
  table thead { display: none; }
  table, caption, tbody, tr, td { display: block; width: 100%; }
  /* No celular, a tabela e a seção que a contém deixam as laterais para o texto: em 360 px, a linha
     passa de cerca de 220 para 302 px (base visual, critério 1). As linhas seguem separadas. */
  table { border: 0; border-radius: 0; background: none; }
  caption { padding-inline: 0; }
  .card:where(:has(table)) { border-inline: 0; border-radius: 0; padding: 1rem 0; background: none; }
  tr.queue-line th { display: block; box-sizing: border-box; }
  table.queue td:empty { display: none; }
  caption { box-sizing: border-box; }
  tr { border-bottom: 1px solid var(--border); padding: 0.6rem 0; }
  tbody tr:last-child { border-bottom: none; }
  td { border: none; padding: 0.15rem 0; }
  /* O nome da coluna vai na frente do valor, menor e cinza, sem dois-pontos (base visual, critério 3). */
  td[data-label]::before { content: attr(data-label); margin-right: 0.5rem; color: var(--muted); font-size: 0.85rem; }
  dl.fields { grid-template-columns: 1fr; }
  dl.fields dd { margin-bottom: 0.4rem; }
}

/* Celular e tablet: o trilho vira barra no topo e o menu abre pelo botão, por cima
   da página. Sem JavaScript, o menu fica aberto no fluxo. */
@media (max-width: 56rem) {
  .shell { padding: 0.75rem; }
  .rail { position: static; width: auto; margin-bottom: 0.75rem; padding: 6px 8px; overflow: visible; }
  .js .rail { position: sticky; top: 0.75rem; }
  .rail:hover, .rail:focus-within { width: auto; box-shadow: var(--shadow); }
  .rail .label { opacity: 1; }
  .js .menu-toggle { display: flex !important; flex: none; width: 44px; justify-content: center; padding: 0; }
  .js .rail-body:not(.open) { display: none; }
  .js .rail-body.open { position: absolute; top: calc(100% + 0.5rem); left: 0; right: 0; max-height: calc(100vh - 6rem); overflow-y: auto; padding: 12px; background: var(--rail); border-radius: var(--radius-lg); border: 1px solid var(--rail-border); box-shadow: 0 20px 50px var(--rail-shadow); transform-origin: top; animation: menu-in 0.22s var(--ease-out); }
  .rail .label { transform: none; }
  .page { padding: 1.25rem 1rem 1.5rem; border-radius: var(--radius-lg); min-height: 0; }
  h1 { font-size: 1.8rem; }
}

/* Barra embaixo no celular (grupo D, critério 2): até cinco destinos com alvos de 52 px; o
   "Menu" dela abre o mesmo menu do ☰, que sai do topo. A página guarda espaço embaixo para a
   barra nunca cobrir o último botão. Sem JavaScript, o menu já está aberto no fluxo e o botão
   some. */
.bottom-nav { display: none; view-transition-name: bottom-nav; }
@media (max-width: 40rem) {
  /* A rolagem para acima da barra: sem isso, o controle que recebe o foco pelo Tab fica na
     borda de baixo da janela, atrás dela (WCAG 2.4.11). */
  html { scroll-padding-bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px)); }
  .shell { padding-bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px)); }
  .bottom-nav {
    display: block; position: fixed; z-index: 20; left: 0.5rem; right: 0.5rem; bottom: calc(0.5rem + env(safe-area-inset-bottom, 0px)); padding: 2px;
    background: var(--rail); border: 1px solid var(--rail-border); border-radius: var(--radius-lg); box-shadow: 0 10px 30px var(--rail-shadow);
  }
  .bottom-nav ul { list-style: none; margin: 0; padding: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 2px; }
  .bottom-nav a, .bottom-nav button {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; width: 100%; min-height: 52px; padding: 4px 1px;
    border: 0; border-radius: 12px; background: none; color: var(--rail-text); font: inherit; font-size: 0.65rem; text-decoration: none; white-space: nowrap;
  }
  .bottom-nav a:hover, .bottom-nav button:hover, .bottom-nav a[aria-current], .bottom-nav button[aria-expanded="true"] { background: var(--rail-active); color: var(--rail-strong); }
  .bottom-nav a[aria-current] .icon { color: var(--rail-current); }
  .bottom-nav .bottom-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .bottom-nav .dot { left: calc(50% + 2px); top: 2px; }
  .js .bottom-nav .menu-toggle { display: flex !important; width: 100%; padding: 4px 1px; }
  html:not(.js) .bottom-nav .menu-toggle { display: none !important; }
  .js .rail-top .menu-toggle { display: none !important; }
  .js .rail-body.open { max-height: calc(100vh - 11rem); }
}

/* Saúde: sempre com texto além da cor (WCAG 1.4.1). */
.health { border: 1px solid var(--border); border-left: 6px solid var(--muted); border-radius: var(--radius); padding: 0.8rem 1rem; margin-bottom: var(--space); background: var(--surface); }
.health ul { margin: 0.25rem 0 0; }
.health p { margin: 0; }
.health.green { border-left-color: var(--ok); }
.health.yellow { border-left-color: var(--warn); }
.health.red, .health.outdated { border-left-color: var(--danger); }
.pre { white-space: pre-line; }
.comments { list-style: none; margin: 0 0 var(--space); padding: 0; }
.comments li { padding: 0.6rem 0; border-bottom: 1px solid var(--border); }
.comments li:last-child { border-bottom: none; }
.comments p { margin: 0 0 0.25rem; overflow-wrap: anywhere; }
.mention-list { list-style: none; margin: 0.25rem 0 0; padding: 0.25rem; max-width: 24rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.mention-list li { padding: 0.45rem 0.7rem; border-radius: 8px; cursor: pointer; }
.mention-list li[aria-selected="true"], .mention-list li:hover { background: var(--hover); color: var(--accent); font-weight: 600; }

@media print {
  :root { color-scheme: light; }
  .rail, .bottom-nav, .no-print, .skip, .messages { display: none !important; }
  body { background: #fff; color: #000; }
  .shell { display: block; padding: 0; }
  .page { border: none; box-shadow: none; padding: 0; min-height: 0; }
  .health, .card { break-inside: avoid; box-shadow: none; }
  table thead { display: table-header-group; }
}

/* Listas por GET (grupo C, C1; `core/_list_bar.html` e `core/_pagination.html`): pílulas de
   situação, filtros numa grade e o cabeçalho que ordena. A seta é decorativa: o leitor de tela
   ouve o `aria-sort`. */
.list-bar { margin: 0 0 var(--space); }
.pills ul { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0 0 0.75rem; padding: 0; list-style: none; }
.pills a { display: inline-block; padding: 0.35rem 0.85rem; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text); font-weight: 500; }
.pills a:hover { background: var(--hover); color: var(--text); }
.pills a[aria-current="page"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 700; }
.list-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 0 1rem; align-items: end; }
.list-filters .actions { margin-bottom: var(--space); }
/* Os pedaços que o htmx troca dentro do formulário (ADR-0051): sem caixa própria, para a grade e a
   linha dos botões ficarem como sem eles. */
.list-slot { display: contents; }
/* Celular (grupo D, critério 3): o formulário recolhe em "Filtrar e ordenar" (o `nav.js` fecha a
   caixa, salvo com filtro); acima de 40rem a caixa fica aberta e o resumo some. */
.list-filters-box > summary { display: none; }
@media (max-width: 40rem) {
  .list-filters-box > summary {
    display: inline-flex; align-items: center; gap: 0.4rem; min-height: 44px; margin: 0 0 0.75rem; padding: 0 1rem;
    border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text); font-size: 0.95rem; font-weight: 600;
  }
  .list-filters-box > summary::marker { content: ""; }
  .list-filters-box > summary::-webkit-details-marker { display: none; }
  .list-filters-box > summary::after { content: "▾" / ""; color: var(--muted); }
  .list-filters-box[open] > summary::after { content: "▴" / ""; }
  .list-filters-box[data-filtered] > summary { border-color: var(--accent); color: var(--accent); }
}
th a { color: inherit; font-weight: inherit; }
th a:not(.button):hover { color: var(--text); }
th[aria-sort] a { color: var(--text); font-weight: 600; }
th[aria-sort="ascending"] a::after { content: " ↑" / ""; }
th[aria-sort="descending"] a::after { content: " ↓" / ""; }
.pagination { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; margin: 0 0 var(--space); }

/* Painel (J-09) */
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: 0 1rem; align-items: end; background: var(--surface-2); box-shadow: none; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: var(--space); margin-bottom: var(--space); }
.kpi { margin-bottom: 0; display: flex; flex-direction: column; }
/* Painel em grade 3 × 2 (grupo C, critério 5): duas colunas no tablet, uma no celular. A barra do
   K1 é decorativa (o texto ao lado diz o mesmo) e pega as cores da saúde. */
.kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 64rem) {
  .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 40rem) {
  .kpi-grid { grid-template-columns: minmax(0, 1fr); }
}
.health-bar { display: block; width: 100%; height: 10px; margin: 0.35rem 0 0.4rem; border-radius: 999px; overflow: hidden; }
.health-bar rect { fill: var(--border); }
.health-bar rect.green { fill: var(--ok); }
.health-bar rect.yellow { fill: var(--warn); }
.health-bar rect.red, .health-bar rect.outdated { fill: var(--danger); }
.health-bar rect.no_status { fill: var(--muted); }
.kpi p { margin: 0 0 0.25rem; }
.kpi details { margin-top: auto; padding-top: 0.5rem; }
.kpi-name { color: var(--muted); font-size: 0.9rem; }
.kpi-value { font-family: var(--font-display); font-size: 2.5rem; font-weight: 600; line-height: 1.15; font-variant-numeric: lining-nums; }
.kpi.no-data .kpi-value { color: var(--muted); font-family: var(--font); font-weight: 400; font-size: 1.6rem; }

/* Início (ADR-0046): um quadro por bloco, que leva ao bloco; zero fica apagado. */
.home-kpis { grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); }
.home-kpis a.kpi { color: var(--text); font-weight: 400; gap: 0.15rem; transition: border-color 0.15s, box-shadow 0.15s; }
.home-kpis a.kpi:hover { border-color: var(--accent); box-shadow: var(--shadow-sm), 0 0 0 1px var(--accent); }
.home-kpis .kpi-value { color: var(--accent); }
.home-kpis .kpi.zero .kpi-value { color: var(--muted); }
.home-kpis .kpi .alert { color: var(--danger); font-weight: 600; }
.home-mentions { list-style: none; padding: 0; margin: 0 0 var(--space); }
.home-mentions li { display: flex; gap: 0.75rem; align-items: center; justify-content: space-between; padding: 0.6rem 0; border-top: 1px solid var(--border); }
.home-mentions li:first-child { border-top: 0; padding-top: 0; }
@media (max-width: 40rem) {
  .home-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
  .home-kpis a.kpi { padding: 0.9rem 1rem; }
  .home-kpis .kpi-name { font-size: 0.8rem; }
  .home-kpis .kpi-value { font-size: 2rem; }
  .home-kpis .kpi .muted, .home-kpis .kpi .alert { font-size: 0.8rem; }
}
/* Como usar (/ajuda/): o que a pessoa cria, os níveis, os cartões, os papéis e a matriz. O que é
   da pessoa vem com a borda e o fundo da cor da área; sempre com texto além da cor. */
.guide-lead { font-size: 1.15rem; margin-bottom: 0.4rem; }
.guide-real { background: var(--surface-2); border-radius: var(--radius); padding: 0.6rem 0.8rem; }
.guide-tag, .guide-you { display: inline-block; margin-right: 0.35rem; padding: 0.05rem 0.55rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 0.8rem; font-weight: 600; }
.guide-you { margin: 0 0 0 0.35rem; vertical-align: middle; }
.guide-mine h2 { margin-top: 0; }
.guide-list { list-style: none; padding: 0; margin: 0; }
.guide-list li { display: flex; flex-wrap: wrap; gap: 0.25rem 0.75rem; align-items: center; padding: 0.55rem 0; border-top: 1px solid var(--border); }
.guide-list li:first-child { border-top: 0; padding-top: 0; }
.guide-list li .button { margin-left: auto; }
/* Como usar em sub-páginas (grupo D, critério 4): o índice é uma faixa rolável, como as abas do
   projeto, e a partir de 64rem fica fixo ao lado do conteúdo; "Próxima" leva à parte seguinte. */
.guide-layout { display: grid; gap: 0 2rem; }
.guide-layout > * { min-width: 0; }
.guide-nav { min-width: 0; margin: 0 0 1.25rem; border-bottom: 1px solid var(--border); }
.guide-nav ul {
  position: relative; display: flex; flex-wrap: nowrap; gap: 0.25rem; margin: 0; padding: 0;
  list-style: none; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; overscroll-behavior-x: contain;
}
.guide-nav li { flex: none; }
.guide-nav a { display: block; padding: 0.55rem 0.8rem; white-space: nowrap; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; }
.guide-nav a:hover { color: var(--text); }
.guide-nav a[aria-current="page"] { color: var(--accent); font-weight: 700; border-bottom-color: var(--accent); }
.guide-eyebrow { margin: 0; color: var(--muted); font-size: 0.85rem; font-weight: 600; }
.guide-pager { margin: 1.5rem 0 0; text-align: right; }
.guide-next { font-weight: 600; }
.guide-next::after { content: " →" / ""; }
@media (min-width: 64rem) {
  .guide-layout { grid-template-columns: 14rem minmax(0, 1fr); align-items: start; }
  .guide-nav { position: sticky; top: 1rem; margin: 0; border-bottom: 0; border-left: 1px solid var(--border); }
  .guide-nav ul { flex-direction: column; gap: 0; overflow: visible; }
  .guide-nav a { white-space: normal; padding: 0.45rem 0.9rem; border-bottom: 0; border-left: 2px solid transparent; margin-left: -1px; }
  .guide-nav a[aria-current="page"] { border-left-color: var(--accent); }
}
/* Os níveis vão para a direita, um dentro do outro. */
.guide-levels { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.75rem; }
.guide-levels li { border-left: 3px solid var(--accent); padding: 0.1rem 0 0.1rem 0.9rem; }
.guide-levels li:nth-child(2) { margin-left: 1.25rem; }
.guide-levels li:nth-child(3) { margin-left: 2.5rem; }
.guide-levels li:nth-child(4) { margin-left: 3.75rem; }
.guide-levels li:nth-child(5) { margin-left: 5rem; }
.guide-levels h2 { margin: 0 0 0.2rem; font-size: 1.05rem; }
.guide-levels p { margin: 0 0 0.4rem; }
.guide-place { margin: 1.5rem 0 0.75rem; }
.guide-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); gap: var(--space); margin-bottom: var(--space); }
.guide-grid .card { margin-bottom: 0; overflow-wrap: anywhere; }
.guide-card h3, .role-card h2 { margin: 0 0 0.4rem; font-size: 1.05rem; }
.guide-badge { display: inline-block; margin: 0 0 0.6rem; padding: 0.1rem 0.6rem; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 0.8rem; }
.guide-card.mine, .role-card.mine { border-color: var(--accent); box-shadow: var(--shadow-sm), 0 0 0 1px var(--accent); }
.guide-card.mine .guide-badge { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.guide-facts { margin: 0 0 0.5rem; }
.guide-facts dt { color: var(--muted); font-size: 0.8rem; margin-top: 0.5rem; }
.guide-facts dd { margin: 0.1rem 0 0; }
.guide-steps { margin: 0.5rem 0; padding-left: 1.25rem; }
.guide-steps li { margin-bottom: 0.2rem; }
.guide-matrix { font-size: 0.85rem; }
.guide-matrix th[scope="row"] { color: var(--text); background: var(--surface); font-weight: 500; font-size: 0.85rem; }
.guide-matrix tr.group th { color: var(--text); font-weight: 600; }
/* O --accent-soft (12%) quase some no escuro; a coluna da pessoa leva o dobro. */
.guide-matrix td.mine, .guide-matrix th.mine { background: color-mix(in oklab, var(--accent) 22%, var(--surface)); }
.guide-matrix th.mine { color: var(--text); font-weight: 600; }
/* O cinza do "não" fica em 4,2:1 sobre esse fundo no claro; ali ele usa a cor do texto. */
.guide-matrix td.mine .muted { color: var(--text); }
/* Quem chega pela lista do que cria vê o título do cartão, e não a borda de cima. */
.guide-card { scroll-margin-top: 1rem; }
.guide-denials { padding-left: 1.2rem; }
.guide-denials li { margin-bottom: 0.45rem; }
@media (max-width: 40rem) {
  .guide-levels li:nth-child(2) { margin-left: 0.5rem; }
  .guide-levels li:nth-child(3) { margin-left: 1rem; }
  .guide-levels li:nth-child(4) { margin-left: 1.5rem; }
  .guide-levels li:nth-child(5) { margin-left: 2rem; }
  .guide-list li .button { margin-left: 0; }
  .guide-matrix th { display: block; box-sizing: border-box; }
  .guide-matrix tr.group { padding: 0; }
  .guide-matrix td.mine { font-weight: 600; }
}
/* No celular e no tablet, o menu vira uma barra fixa no topo (cerca de 4 rem). */
@media (max-width: 56rem) {
  .guide-card { scroll-margin-top: 5.5rem; }
}
.health-chip { display: inline-block; vertical-align: middle; padding: 0.1rem 0.6rem; border-radius: 999px; font-size: 0.85rem; font-weight: 600; background: var(--hover); }
.health-chip.green { background: var(--ok-bg); color: var(--ok); }
.health-chip.yellow { background: var(--warn-bg); color: var(--warn); }
.health-chip.red, .health-chip.outdated { background: var(--danger-bg); color: var(--danger); }

/* Quadro de tarefas (J-04): três colunas; abaixo de 56rem, uma embaixo da outra. */
.board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space); align-items: start; margin-bottom: var(--space); }
.board-column { background: var(--surface-2); border: 1px solid var(--border); border-radius: 20px; padding: 0.9rem; }
.board-column h2 { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; margin: 0 0 0.75rem; font-size: 1.15rem; }
.board-column h2 .tally { color: var(--muted); font-family: var(--font); font-size: 0.9rem; font-weight: 500; }
.board-column.over { border-color: var(--warn); }
.limit-warning { background: var(--warn-bg); color: var(--warn); border-radius: var(--radius); padding: 0.5rem 0.75rem; margin: 0 0 0.75rem; font-size: 0.9rem; }
.board-cards { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.6rem; min-height: 4rem; }
.board-cards:not(:has(.task-card))::after { content: "Nenhuma tarefa"; color: var(--muted); font-size: 0.9rem; }
.task-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.75rem 0.9rem; box-shadow: var(--shadow-sm); overflow-wrap: anywhere; }
.task-card dl { display: grid; grid-template-columns: max-content 1fr; gap: 0.1rem 0.75rem; margin: 0.5rem 0; font-size: 0.9rem; }
.task-card dt { color: var(--muted); }
.task-card dd { margin: 0; }
.card-move { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; margin: 0; }
.card-move label { width: 100%; margin: 0; font-size: 0.85rem; }
.card-move select { flex: 1; width: auto; min-width: 0; }
/* A regra geral põe margem entre campo e botão; no cartão eles ficam lado a lado. */
.card-move > button { margin-top: 0 !important; }
.task-card.movable { cursor: grab; }
.task-card.sortable-ghost { opacity: 0.4; }
.task-card.sortable-chosen { box-shadow: var(--shadow); }
.board-message:empty { display: none; }
/* Burndown (N-01): SVG do servidor; cores pelos tokens, claro e escuro. */
.burndown { display: block; width: 100%; max-width: 40rem; height: auto; margin: 0 0 var(--space); }
.burndown .axis { stroke: var(--border); stroke-width: 1; }
.burndown polyline { fill: none; stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.burndown .actual { stroke: var(--accent); }
.burndown .ideal { stroke: var(--muted); stroke-width: 2; stroke-dasharray: 6 6; }
.burndown .label { fill: var(--muted); font: 13px var(--font); }
/* Cronograma (RF-014): SVG do servidor no tamanho natural, que rola dentro do contêiner. */
.gantt-scroll { overflow-x: auto; margin: 0 0 var(--space); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.gantt { display: block; }
.gantt .week { stroke: var(--border); stroke-width: 1; }
.gantt .today { stroke: var(--danger); stroke-width: 2; stroke-dasharray: 4 3; }
.gantt .label { fill: var(--muted); font: 12px var(--font); }
.gantt .name { fill: var(--text); font: 13px var(--font); }
.gantt .bar { fill: var(--accent); }
.gantt .bar.done { fill: var(--ok); }
.gantt .bar.risk { fill: var(--warn-bg); stroke: var(--danger); stroke-width: 2; stroke-dasharray: 4 2; }
.gantt .milestone { fill: var(--text); }
.gantt .milestone.late { fill: var(--danger); }
.gantt .milestone.done { fill: var(--ok); }
.gantt .link { fill: none; stroke: var(--muted); stroke-width: 1.5; }
.gantt .marker { fill: var(--danger); font: 700 13px var(--font); }
.gantt .marker.ok { fill: var(--ok); }
.gantt .cut { fill: var(--accent-text); font: 11px var(--font); }

/* Objetivos (N-02): a barra é o <progress> nativo, sem script; o número real vem ao lado. */
.cycle-choice { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-bottom: 0.5rem; }
.cycle-choice select { width: auto; min-width: 0; max-width: 100%; }
.cycle-choice > button { margin-top: 0 !important; }
.key-result { border-top: 1px solid var(--border); padding-top: 0.75rem; margin-top: 0.75rem; }
.key-result h3 { margin: 0 0 0.25rem; font-size: 1rem; }
.objective .actions > :is(h2, h3) { margin: 0 auto 0 0; }
.objective > .actions { margin-bottom: 0.25rem; }
.key-result p { margin: 0.25rem 0; }
.kr-progress { display: flex; flex-wrap: wrap; gap: 0.25rem 0.6rem; align-items: center; }
.kr-progress progress { width: min(14rem, 100%); height: 0.65rem; accent-color: var(--accent); }
@media (max-width: 56rem) {
  .board { grid-template-columns: 1fr; }
}

/* Calendário (RF-017): grade de sete colunas; até 40rem (celular), uma lista só dos dias com
   itens. Cada item tem forma e texto além da cor (WCAG 1.4.1). */
.calendar-filters { display: flex; flex-wrap: wrap; gap: 0.75rem 1.25rem; align-items: end; margin-bottom: var(--space); }
.calendar-filters > div > label { display: block; }
.calendar-filters select { min-width: 14rem; }
.calendar-filters button { margin-top: 0 !important; }
.calendar-undated { margin-bottom: var(--space); }
.calendar-nav { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: var(--space) 0; }
.calendar-nav h2 { margin: 0 auto 0 0; }
.weekdays, .calendar { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0.35rem; }
.weekdays { margin-bottom: 0.35rem; }
.weekdays li { text-align: center; color: var(--muted); font-size: 0.85rem; font-weight: 600; }
.day { min-height: 6.5rem; min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.4rem; overflow-wrap: anywhere; }
.day.out { background: transparent; border-style: dashed; color: var(--muted); }
.day.today { border: 2px solid var(--accent); }
.day time { display: flex; justify-content: space-between; align-items: center; gap: 0.4rem; margin-bottom: 0.3rem; font-size: 0.9rem; font-weight: 600; }
/* O nome do dia por extenso só se vê no celular; no computador é só para leitor de tela. */
.day-text { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.entries { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.3rem; }
.entries li { font-size: 0.82rem; line-height: 1.3; }
.entry { display: block; border-left: 3px solid var(--accent); padding-left: 0.4rem; font-weight: 500; }
.entry.milestone { border-color: var(--warn); }
.entry.sprint { border-color: var(--ok); }
.entry.done { color: var(--muted); }
.entry .mark { margin-right: 0.3rem; font-size: 0.7rem; }
.entry-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0 0.5rem; padding-left: 0.65rem; color: var(--muted); font-size: 0.75rem; }
.entry-meta:empty { display: none; }
.day .more { display: inline-block; margin-top: 0.3rem; font-size: 0.8rem; }
.day-list li { font-size: 1rem; }
@media (max-width: 40rem) {
  .weekdays { display: none; }
  .calendar { grid-template-columns: 1fr; }
  .day:not(.has-items) { display: none; }
  .day { min-height: 0; }
  .day-num { display: none; }
  .day-text { position: static; width: auto; height: auto; margin: 0; overflow: visible; clip: auto; white-space: normal; }
  .day-text::first-letter { text-transform: uppercase; }
  .calendar-filters select { min-width: 0; width: 100%; }
}

/* Cor e papel de parede por área do menu (design, 2026-11-04; `page_theme` em
   apps/core/context_processors.py). Cada área tem a sua cor principal, com contraste AA nos
   dois temas (texto branco sobre ela no claro; ela sobre a superfície no escuro, e o texto
   escuro sobre ela); botões, links, o item atual do menu e os números seguem a cor. Os tons
   derivados ficam no <body>, onde a cor da área é definida: no :root, eles ficariam presos à
   cor padrão. Política, Importação e Conta, áreas de configuração, usam "tinta" (quase preto no
   claro, quase branco no escuro, 12:1 ou mais com a superfície): o cinza médio de antes deixava o
   botão principal com cara de desabilitado (vistoria de design, 2026-11-05, P4). */
[data-page="inicio"] { --accent: light-dark(#5146e5, #a69eff); }
[data-page="tarefas"] { --accent: light-dark(#6d28d9, #c4b5fd); }
[data-page="projetos"] { --accent: light-dark(#1d4ed8, #93b4fd); }
[data-page="modelos"] { --accent: light-dark(#4d7c0f, #a3d65c); }
[data-page="calendario"] { --accent: light-dark(#0f766e, #5eead4); }
[data-page="painel"] { --accent: light-dark(#3730a3, #a5b4fc); }
[data-page="resumo"] { --accent: light-dark(#b45309, #fcbf62); }
[data-page="aprovacoes"] { --accent: light-dark(#15803d, #86efac); }
[data-page="objetivos"] { --accent: light-dark(#be123c, #fda4af); }
[data-page="demandas"] { --accent: light-dark(#c2410c, #fdba74); }
[data-page="carga"] { --accent: light-dark(#0e7490, #67e8f9); }
[data-page="capacidades"] { --accent: light-dark(#047857, #6ee7b7); }
[data-page="importacao"] { --accent: light-dark(#1e293b, #e2e8f0); }
[data-page="membros"] { --accent: light-dark(#a21caf, #f0abfc); }
[data-page="unidades"] { --accent: light-dark(#0369a1, #7dd3fc); }
[data-page="politica"] { --accent: light-dark(#292524, #e7e5e4); }
[data-page="notificacoes"] { --accent: light-dark(#be185d, #f9a8d4); }
[data-page="conta"] { --accent: light-dark(#27272a, #e4e4e7); }
/* Em tinta, o link no texto ficaria da cor do próprio texto: no conteúdo dessas áreas, ele usa o
   roxo da marca (o do Início). O menu segue com as cores dele. */
:is([data-page="politica"], [data-page="importacao"], [data-page="conta"]) .page { --link: light-dark(#5146e5, #a69eff); --link-hover: light-dark(#4136cc, #bcb6ff); }
body[data-page] {
  --accent-hover: color-mix(in oklab, var(--accent) 82%, var(--text));
  --accent-soft: color-mix(in oklab, var(--accent) 12%, var(--surface));
  --rail-current: var(--accent);
  --rail-active: color-mix(in oklab, var(--accent) 14%, var(--rail));
}

/* O papel de parede é só da div.shell: uma foto por área (static/img/fundos/, créditos em
   docs/CREDITOS-IMAGENS.md), presa à janela, atrás do menu e da página, que seguem lisos. No
   modo noturno, um véu escuro por cima da foto. A camada é um ::before fixo, e não
   `background-attachment: fixed`, que o Safari do celular ignora. */
.shell::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    linear-gradient(light-dark(rgb(255 255 255 / 0%), rgb(8 8 12 / 50%)), light-dark(rgb(255 255 255 / 0%), rgb(8 8 12 / 50%))),
    var(--wallpaper, none) center / cover no-repeat,
    var(--bg);
}
[data-page="inicio"] { --wallpaper: url("../img/fundos/inicio.488382b1f8a0.webp"); }
[data-page="tarefas"] { --wallpaper: url("../img/fundos/tarefas.1be2c526b09b.webp"); }
[data-page="projetos"] { --wallpaper: url("../img/fundos/projetos.8f563b2e7244.webp"); }
[data-page="modelos"] { --wallpaper: url("../img/fundos/modelos.073c9294efd9.webp"); }
[data-page="calendario"] { --wallpaper: url("../img/fundos/calendario.d63f50007dbb.webp"); }
[data-page="painel"] { --wallpaper: url("../img/fundos/painel.5d69a2d8d0ea.webp"); }
[data-page="resumo"] { --wallpaper: url("../img/fundos/resumo.c0bc88bc570e.webp"); }
[data-page="aprovacoes"] { --wallpaper: url("../img/fundos/aprovacoes.c578ffa83c1b.webp"); }
[data-page="objetivos"] { --wallpaper: url("../img/fundos/objetivos.6db508bbd38e.webp"); }
[data-page="demandas"] { --wallpaper: url("../img/fundos/demandas.a8bc419e638d.webp"); }
[data-page="carga"] { --wallpaper: url("../img/fundos/carga.c4ecaaa8a884.webp"); }
[data-page="capacidades"] { --wallpaper: url("../img/fundos/capacidades.fb11a30acbb4.webp"); }
[data-page="importacao"] { --wallpaper: url("../img/fundos/importacao.e37a5e79e604.webp"); }
[data-page="membros"] { --wallpaper: url("../img/fundos/membros.580d94f3c7e5.webp"); }
[data-page="unidades"] { --wallpaper: url("../img/fundos/unidades.7be47037261b.webp"); }
[data-page="politica"] { --wallpaper: url("../img/fundos/politica.0f2203f43c64.webp"); }
[data-page="notificacoes"] { --wallpaper: url("../img/fundos/notificacoes.9da9a5e4aab3.webp"); }
[data-page="conta"] { --wallpaper: url("../img/fundos/conta.97a741e7cbb8.webp"); }
@media print {
  .shell::before { display: none; }
}
