/* ==========================================================================
   Painel da curadoria — CSS próprio (Fase L, direção "A + B")
   --------------------------------------------------------------------------
   POR QUÊ CSS próprio e não Pico: quase tudo que estava torto vinha dos
   padrões do Pico (botão de largura total, menu em linha, tabela sem
   alinhamento). Customizar por cima seriam dois CSS brigando. Aqui cada
   regra é nossa e tem um motivo.

   Como ler este arquivo:
     1. Fontes            5. Botões
     2. Tokens (:root)    6. Formulários
     3. Base              7. Tabelas
     4. Layout            8. Componentes (cartão, pílula, etc.)
                          9. Telas específicas (fotos, slides)
   Regra de ouro: cor, espaço, raio e sombra SEMPRE pelos tokens (var(--...)).
   Nada de "#abc" ou "13px" solto no meio — é isso que mantém tudo simétrico.
   ========================================================================== */


/* 1. Fontes ------------------------------------------------------------------
   Servidas do próprio app (sem CDN). Inter: só 400 e 600 estão empacotadas,
   então "negrito" aqui é sempre 600. Instrument Serif itálico: só títulos.
   font-display: swap → o texto aparece na hora com a fonte do sistema e troca
   quando a nossa carrega (nunca tela em branco esperando fonte). */
@font-face { font-family: "Inter"; font-weight: 400; font-display: swap; src: url(/static/fonts/inter-400.woff2) format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 600; font-display: swap; src: url(/static/fonts/inter-600.woff2) format("woff2"); }
@font-face { font-family: "Instrument Serif"; font-style: italic; font-display: swap; src: url(/static/fonts/instrument-serif-400-italic.woff2) format("woff2"); }


/* 2. Tokens -----------------------------------------------------------------
   A identidade do PRODUTO é neutra (off-white quente + grafite). A única cor
   que muda por conta é --accent: o base.html a define a partir de
   brand_settings (na Gabi, terracota). Os tons claros do destaque são
   derivados com color-mix(), então trocar uma cor troca o conjunto todo. */
:root {
  /* superfícies */
  --bg:          #FAF8F5;   /* fundo da página */
  --surface:     #FFFFFF;   /* cartões, campos */
  --surface-2:   #F4F0EA;   /* realce leve: hover de linha, código */
  --line:        #ECE6DC;   /* linhas finas, bordas de cartão */
  --line-strong: #DCD3C6;   /* borda de campo e botão secundário */

  /* texto (contraste conferido contra --bg: ink 16:1, ink-2 9:1, muted 5,3:1 → AA) */
  --ink:   #1D1B18;
  --ink-2: #4A453F;
  --muted: #6F675D;

  /* destaque da conta (sobrescrito no base.html) e derivados */
  --accent:      #3A3631;
  --accent-ink:  #FFFFFF;                                         /* texto sobre o destaque */
  --accent-soft: color-mix(in srgb, var(--accent) 9%, #FFFFFF);   /* fundo de pílula/ativo */
  --accent-line: color-mix(in srgb, var(--accent) 30%, #FFFFFF);  /* borda/sublinhado */
  --accent-hover: color-mix(in srgb, var(--accent) 86%, #000000);

  /* estados (fixos do produto, não mudam por conta) */
  --ok:        #3F5A33;  --ok-soft:     #EFF5EA;
  --warn:      #7A5B1E;  --warn-soft:   #F7F0E1;
  --danger:    #A1302A;  --danger-soft: #FBEDEB;

  /* escala de espaço: múltiplos de 4 px. Use só estes. */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 64px;

  /* raios e sombras */
  --r-sm: 4px; --r: 8px; --r-lg: 12px; --r-pill: 999px;
  --shadow-1: 0 1px 2px rgba(29, 27, 24, .05);
  --shadow-2: 0 12px 32px -16px rgba(29, 27, 24, .22);

  /* tipografia */
  --font-body:    "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Instrument Serif", Georgia, serif;
  --font-mono:    ui-monospace, "SFMono-Regular", Consolas, monospace;
  --text-xs: 12px; --text-sm: 13px; --text: 15px; --text-lg: 17px;

  /* layout */
  --container: 1180px;
  --gutter: var(--s-5);
  --field-h: 42px;     /* altura única de campo e botão: tudo alinha na mesma linha */
}

/* Celular: margens laterais de 16 px (padrão iOS/Android). */
@media (max-width: 720px) {
  :root { --gutter: var(--s-4); }
}


/* 3. Base ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }   /* iPhone não aumenta fonte sozinho ao girar */

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 var(--text)/1.55 var(--font-body);
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;   /* números com largura igual: colunas alinham */
}

h1, h2, h3, h4, h5 { margin: 0 0 var(--s-3); line-height: 1.2; font-weight: 600; color: var(--ink); }
/* Título de página: o itálico serifado é a "assinatura" da direção Editorial. */
h1, h2 { font-family: var(--font-display); font-style: italic; font-weight: 400; letter-spacing: -.01em; }
h1 { font-size: 44px; line-height: 1.05; }
h2 { font-size: 40px; line-height: 1.05; }
h3 { font-size: 20px; }
h4 { font-size: var(--text-lg); letter-spacing: -.01em; }
@media (max-width: 720px) { h1 { font-size: 36px; } h2 { font-size: 32px; } }

p { margin: 0 0 var(--s-4); }
small { font-size: var(--text-sm); color: var(--muted); }
strong, b { font-weight: 600; }

a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--accent-line);
    text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--accent); text-decoration-color: var(--accent); }

img { max-width: 100%; }

code { font: 12.5px/1.4 var(--font-mono); background: var(--surface-2); color: var(--ink-2);
       padding: 2px 6px; border-radius: var(--r-sm); }

blockquote { margin: 0 0 var(--s-4); padding: var(--s-1) 0 var(--s-1) var(--s-4);
             border-left: 2px solid var(--accent);
             font: italic 400 22px/1.3 var(--font-display); color: var(--ink); }

mark { background: var(--accent-soft); color: var(--accent); padding: 2px 8px;
       border-radius: var(--r-pill); font-size: var(--text-xs); font-weight: 600; }

hr { border: 0; border-top: 1px solid var(--line); margin: var(--s-5) 0; }

/* Foco de teclado sempre visível (acessibilidade). :focus-visible = só
   aparece navegando por teclado, não ao tocar/clicar. */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Lista de dados "rótulo → valor" (detalhe do achado). No desktop, duas
   colunas alinhadas; no celular, rótulo em cima do valor. */
dl { display: grid; grid-template-columns: minmax(120px, max-content) 1fr;
     gap: var(--s-2) var(--s-5); margin: 0 0 var(--s-5); }
dt { color: var(--muted); font-size: var(--text-sm); padding-top: 1px; }
dd { margin: 0; min-width: 0; }
@media (max-width: 480px) { dl { grid-template-columns: 1fr; gap: 0; } dd { margin-bottom: var(--s-3); } }


/* 4. Layout ---------------------------------------------------------------- */
.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 var(--gutter); }


/* .grid: colunas que se ajustam sozinhas. Cada coluna tem no mínimo 200 px;
   se não couber, desce para a linha de baixo (no celular vira 1 coluna). */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        column-gap: var(--s-4); row-gap: 0; align-items: end; }
/* row-gap 0: cada <label> já traz margin-bottom; somar os dois dava espaço
   duplo quando a grade vira 1 coluna no celular. Campo solto na grade (sem
   label) ganha a mesma margem, para o ritmo vertical ficar igual. */
.grid > select, .grid > input { margin: 0 0 var(--s-4); }
article > .grid, main > .grid { align-items: start; }

/* hgroup = título da página + linha de contexto embaixo. */
hgroup { margin-bottom: var(--s-5); }
hgroup > :first-child { margin-bottom: var(--s-2); }
hgroup p { color: var(--muted); margin: 0; }

/* Estrutura do app (L2) ------------------------------------------------------
   Computador (≥ 900 px): menu lateral fixo à esquerda + conteúdo.
   Celular/tablet (< 900 px): barra do topo (marca + conta) e barra inferior
   com os 4 destinos e o "+" no centro — onde o polegar alcança.
   POR QUÊ 900 px e não 720: o menu lateral ocupa 248 px; abaixo de ~900 o
   conteúdo ficaria espremido (tablet em pé também usa a barra inferior). */
.app { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.page { width: 100%; max-width: 1120px; padding: var(--s-6) var(--s-7) var(--s-8); }

.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
           padding: var(--s-5) var(--s-4); border-right: 1px solid var(--line); background: var(--bg); }
.sidebar-brand { font: italic 400 27px/1.05 var(--font-display); color: var(--ink); text-decoration: none;
                 padding: 0 var(--s-2); }
.sidebar-brand:hover { color: var(--ink); }
.sidebar-sub { font-size: 10.5px; letter-spacing: .18em; text-transform: uppercase; color: var(--muted);
               margin: var(--s-2) 0 var(--s-5); padding: 0 var(--s-2); }
.sidebar-new { width: 100%; margin-bottom: var(--s-5); }
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar-nav a { display: flex; align-items: center; gap: var(--s-3); padding: 9px var(--s-3); border-radius: var(--r);
                 color: var(--ink-2); text-decoration: none; font-size: 14.5px; }
.sidebar-nav a:hover { background: var(--surface-2); color: var(--ink); }
.sidebar-nav a[aria-current=page] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.sidebar-user { margin-top: auto; display: flex; align-items: center; gap: var(--s-3);
                padding: var(--s-3) var(--s-2) 0; border-top: 1px solid var(--line); }
.sidebar-user-name { flex: 1; min-width: 0; font-size: var(--text-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user form { margin: 0; }

.avatar { width: 32px; height: 32px; border-radius: 50%; flex: none; display: grid; place-items: center;
          background: var(--accent); color: var(--accent-ink); font-weight: 600; font-size: var(--text-sm); }

/* Botão só com ícone (ex.: sair). Quadrado, do tamanho do botão discreto. */
.outline.secondary.icon-only { width: 32px; padding: 0; }

.topbar, .tabbar { display: none; }   /* só aparecem no celular */

@media (max-width: 899px) {
  .app { display: block; }
  .sidebar { display: none; }
  .page { padding: var(--s-4) var(--gutter) calc(96px + env(safe-area-inset-bottom)); }

  .topbar { display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 20;
            min-height: 56px; padding: env(safe-area-inset-top) var(--gutter) 0;
            background: color-mix(in srgb, var(--bg) 92%, transparent);
            -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
  .topbar-brand { font: italic 400 23px/1 var(--font-display); color: var(--ink); text-decoration: none; }

  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
            justify-content: space-around; align-items: center;
            padding: 6px var(--s-2) calc(6px + env(safe-area-inset-bottom));
            background: var(--surface); border-top: 1px solid var(--line);
            box-shadow: 0 -8px 24px -18px rgba(29, 27, 24, .25); }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0;
              font-size: 10.5px; color: var(--muted); text-decoration: none; min-width: 0; }
  .tabbar a[aria-current=page] { color: var(--accent); font-weight: 600; }
  .tabbar .tabbar-new { flex: none; width: 52px; height: 52px; margin: -22px var(--s-1) 0; padding: 0; justify-content: center;
                        border-radius: 50%; background: var(--accent); color: var(--accent-ink);
                        box-shadow: 0 10px 20px -8px color-mix(in srgb, var(--accent) 70%, transparent), 0 0 0 4px var(--surface); }
  .tabbar .tabbar-new[aria-current=page] { color: var(--accent-ink); }
}

/* Menu da conta no celular (<details>): o painel abre abaixo do avatar. */
.account-menu { position: relative; }
.account-menu summary { list-style: none; cursor: pointer; }
.account-menu summary::-webkit-details-marker { display: none; }
.account-menu-panel { position: absolute; right: 0; top: calc(100% + var(--s-2)); width: 240px; z-index: 30;
                      padding: var(--s-4); background: var(--surface); border: 1px solid var(--line);
                      border-radius: var(--r-lg); box-shadow: var(--shadow-2); }
.account-menu-panel p { margin-bottom: var(--s-3); line-height: 1.4; }
.account-menu-panel form { margin: 0; }
.account-menu-panel button { width: 100%; }

/* Cabeçalho padrão de página (L2): voltar (opcional) · título · linha de
   contexto · ação principal à direita. No celular a ação desce para baixo
   do título e ocupa a largura toda (alvo de toque grande). */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-4);
             flex-wrap: wrap; margin-bottom: var(--s-6); }
.page-head h1 { margin: 0; overflow-wrap: anywhere; }
.page-head-text { min-width: 0; flex: 1 1 320px; }
.page-head-meta { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s-2) var(--s-3);
                  margin: var(--s-3) 0 0; color: var(--muted); font-size: 14px; }
.page-head-actions { display: flex; gap: var(--s-2); flex-wrap: wrap; }
.page-head-actions form { margin: 0; }
.back { display: inline-flex; align-items: center; gap: 2px; margin: 0 0 var(--s-3) -4px;
        font-size: var(--text-sm); color: var(--muted); text-decoration: none; }
.back:hover { color: var(--ink); }
.sep { color: var(--line-strong); }   /* ponto "·" entre itens da linha de contexto */
@media (max-width: 899px) {
  .page-head { margin-bottom: var(--s-5); }
  .page-head-actions { width: 100%; }
  .page-head-actions > * { flex: 1; }
  .page-head-actions button, .page-head-actions [role=button] { width: 100%; }
  .hide-mobile { display: none; }
}

/* Aviso em faixa (erro de login; no L4, os "salvo!" das ações). */
.alert { padding: var(--s-3) var(--s-4); border-radius: var(--r); font-size: 14px; margin-bottom: var(--s-4); }
.alert-erro { background: var(--danger-soft); color: var(--danger); }
.alert-info { background: var(--warn-soft); color: var(--warn); }
/* Parte "suave" de um título (ex.: o nome da edição depois do número). */
.h-soft { color: var(--muted); }
.btn-block { width: 100%; }


/* Tela de login --------------------------------------------------------------
   Computador: metade escura com a frase da curadoria + metade com o formulário.
   Celular: só o formulário. */
body.auth { min-height: 100vh; }
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.login-art { background: var(--ink); color: #F3EEE4; padding: var(--s-7); display: flex; flex-direction: column; }
.login-kicker { font-size: var(--text-xs); letter-spacing: .2em; text-transform: uppercase; color: #B9AE9D; margin: 0; }
.login-quote { font: italic 400 clamp(44px, 5vw, 72px)/1.02 var(--font-display); margin: auto 0 var(--s-5); max-width: 12ch; }
.login-foot { color: #B9AE9D; margin: 0; max-width: 34ch; }
.login-form { display: grid; place-items: center; padding: var(--s-6) var(--gutter); }
.login-box { width: 100%; max-width: 360px; }
.login-brand { display: none; font: italic 400 26px/1 var(--font-display); margin-bottom: var(--s-6); }
.login-box h1 { margin-bottom: var(--s-2); }
.login-lead { color: var(--muted); margin-bottom: var(--s-5); }
@media (max-width: 899px) {
  .login { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .login-form { align-items: start; padding-top: 16vh; }
  .login-brand { display: block; }
}


/* 5. Botões ---------------------------------------------------------------
   Três níveis, para a tela sempre deixar claro qual é a ação principal:
     principal  → <button> / role=button   (cheio, cor da conta)
     secundário → .secondary               (branco com borda)
     discreto   → .outline.secondary       (sem fundo; ações pequenas: ↑ ↓ ✕)
   Largura: só o necessário (o Pico esticava todos na linha inteira). */
button, [role=button], input[type=submit] {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  height: var(--field-h); padding: 0 var(--s-4);
  font: 600 14px/1 var(--font-body); white-space: nowrap;
  color: var(--accent-ink); background: var(--accent);
  border: 1px solid var(--accent); border-radius: var(--r);
  text-decoration: none; cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s;
}
button:hover, [role=button]:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink); }

.secondary, .outline {
  background: var(--surface); color: var(--ink); border-color: var(--line-strong); box-shadow: var(--shadow-1);
}
.secondary:hover, .outline:hover { background: var(--surface-2); color: var(--ink); border-color: var(--line-strong); }

.outline.secondary {
  height: 32px; padding: 0 var(--s-3); font-size: var(--text-sm);
  background: transparent; border-color: transparent; box-shadow: none; color: var(--ink-2);
}
.outline.secondary:hover { background: var(--surface-2); border-color: var(--line); color: var(--ink); }

button:disabled, button[disabled] { opacity: .45; cursor: not-allowed; pointer-events: none; }


/* 6. Formulários ----------------------------------------------------------
   Os templates usam <label>Texto <input></label>. O rótulo fica em cima,
   pequeno e firme; o campo embaixo, com altura única (--field-h) para tudo
   alinhar em grade. Fonte do campo = 16 px: abaixo disso o iPhone dá zoom
   sozinho na tela ao tocar no campo (e não volta). */
form { margin: 0 0 var(--s-4); }
label { display: block; margin-bottom: var(--s-4); font-size: var(--text-sm); font-weight: 600; color: var(--ink-2); }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }

/* :where() zera a "força" (especificidade) do seletor: assim regras de
   contexto, como .grid > input, vencem sem precisar de !important. */
input:where(:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=hidden])),
select, textarea {
  display: block; width: 100%; margin-top: 6px;
  height: var(--field-h); padding: 0 var(--s-3);
  font: 400 16px/1.4 var(--font-body); color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r);
  transition: border-color .15s, box-shadow .15s;
  appearance: none; -webkit-appearance: none;
}
textarea { height: auto; min-height: 120px; padding: var(--s-3); line-height: 1.55; resize: vertical; }
input::placeholder, textarea::placeholder { color: #8C8377; }   /* 3,7:1 no branco: legível, mas claramente "exemplo" */
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
/* select sem a seta do sistema (cada navegador desenha uma): seta nossa em SVG. */
select {
  padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236F675D' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
/* Data: o ícone de calendário do Chrome fica num tom suave. */
input[type=date]::-webkit-calendar-picker-indicator { opacity: .55; cursor: pointer; }

/* Upload: o botão "Escolher arquivo" do navegador vira um botão secundário. */
input[type=file] { font: 400 var(--text-sm) var(--font-body); color: var(--muted); max-width: 100%; margin: 0 0 var(--s-3); }
input[type=file]::file-selector-button {
  height: 36px; padding: 0 var(--s-3); margin-right: var(--s-3);
  font: 600 var(--text-sm) var(--font-body); color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r); cursor: pointer;
}

/* Botão dentro de uma .grid de campos: desce para alinhar com os campos
   (que têm o rótulo em cima). */
.grid > button, .grid > [role=button] { margin-bottom: var(--s-4); }

/* Texto de ajuda logo abaixo de um campo. */
label + small, input + small { display: block; margin: calc(-1 * var(--s-3)) 0 var(--s-4); }


/* 7. Tabelas --------------------------------------------------------------
   Cabeçalho discreto (pequeno, maiúsculo), linhas finas, números à direita
   (classe .num). No celular a TABELA rola de lado dentro dela mesma, e não a
   página inteira — antes a tela de Desempenho ficava com 975 px num celular
   de 390. (No L3 as listas principais viram cartões no celular.) */
table { width: 100%; border-collapse: collapse; margin-bottom: var(--s-5); font-size: 14px; }
th { text-align: left; font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
     color: var(--muted); padding: var(--s-2) var(--s-3) var(--s-3); border-bottom: 1px solid var(--line-strong);
     white-space: nowrap; }
td { padding: var(--s-3); border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
th.num, td.num { text-align: right; }
td form { margin: 0; }
@media (max-width: 720px) {
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  th, td { white-space: nowrap; }
}


/* 8. Componentes ----------------------------------------------------------- */

/* Cartão: <article>. Fundo branco sobre o off-white, borda fina, sombra quase
   imperceptível. Título do cartão = <h4>. */
article {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-1); padding: var(--s-5); margin: 0 0 var(--s-5);
}
article > h4:first-child { margin-bottom: var(--s-4); }
article table:last-child, article form:last-child, article p:last-child { margin-bottom: 0; }
@media (max-width: 720px) { article { padding: var(--s-4) var(--s-4) var(--s-5); } }

/* Mensagem de erro (texto solto ou cartão inteiro). */
.erro { color: var(--danger); }
article.erro { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 25%, #FFFFFF); }
article.erro ul { margin: 0; padding-left: var(--s-4); }

/* Pílula de status. Cores por significado:
     neutro  → rascunho, montando        (ainda em preparo)
     destaque→ aprovado(a)               (pronto, aguardando)
     verde   → publicado(a), confirmada  (feito / dinheiro de verdade)
     areia   → estimada                  (ainda pode mudar) */
.status {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px;
  border-radius: var(--r-pill); font-size: var(--text-xs); font-weight: 600; line-height: 1;
  background: var(--surface-2); color: var(--ink-2); white-space: nowrap;
}
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.status::first-letter { text-transform: uppercase; }
.status-aprovado, .status-aprovada { background: var(--accent-soft); color: var(--accent); }
.status-publicado, .status-publicada, .status-confirmada { background: var(--ok-soft); color: var(--ok); }
.status-estimada { background: var(--warn-soft); color: var(--warn); }

/* Miniatura quadrada nas listas. max-width: none: sem isso, numa tabela
   apertada (celular) a regra img { max-width: 100% } encolhia a coluna da
   foto até zero e a miniatura sumia. */
.thumb { max-width: none; width: 44px; height: 44px; object-fit: cover; border-radius: var(--r); display: block; background: var(--surface-2); }

.trunc { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }


/* 9. Telas específicas ------------------------------------------------------ */

/* Fotos do achado (grade 4:5, igual ao post). */
.fotos { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: var(--s-4); margin-bottom: var(--s-5); }
.fotos figure { margin: 0; }
.fotos img { width: 100%; aspect-ratio: 4/5; object-fit: cover; border-radius: var(--r); display: block; }
.fotos figcaption { display: flex; flex-direction: column; gap: var(--s-2); margin-top: var(--s-2); }
.fotos figcaption form { margin: 0; }
.fotos figcaption select { margin-top: 0; height: 36px; font-size: 14px; }
.fotos figcaption button { width: 100%; }
.focal-wrap { position: relative; cursor: crosshair; }
.focal-wrap img { aspect-ratio: auto; }   /* miniatura na proporção real, senão o clique mente */
.focal-dot { position: absolute; width: 16px; height: 16px; border-radius: 50%; background: #FFFFFF;
             border: 3px solid var(--accent); box-shadow: 0 1px 4px rgba(0,0,0,.35);
             transform: translate(-50%, -50%); pointer-events: none; }

/* Slides da arte gerada. */
.slides { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: var(--s-4); margin: var(--s-4) 0 var(--s-5); }
.slides figure { margin: 0; }
.slides img { width: 100%; aspect-ratio: 4/5; object-fit: cover; border-radius: var(--r); border: 1px solid var(--line); display: block; }
.slides figcaption { font-size: var(--text-xs); color: var(--muted); margin-top: var(--s-2); }


/* 10. Listas, filtros e resumos (L3) ---------------------------------------- */

.dim { color: var(--muted); }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Abas de filtro (Todos · Rascunho · …). Sublinhado na aba ativa, como
   índice de revista. No celular rolam de lado se não couberem. */
.tabs { display: flex; gap: var(--s-5); border-bottom: 1px solid var(--line); margin-bottom: var(--s-2);
        overflow-x: auto; scrollbar-width: none; }
.tabs a { flex: none; padding: 0 0 var(--s-3); font-size: 14px; color: var(--muted); text-decoration: none;
          display: inline-flex; align-items: center; gap: 6px; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current=page] { color: var(--ink); font-weight: 600; box-shadow: inset 0 -2px 0 var(--ink); }
.tabs-count { font-size: 11.5px; font-weight: 600; color: var(--muted); background: var(--surface-2);
              border-radius: var(--r-pill); padding: 1px 7px; }
@media (max-width: 899px) { .tabs { gap: var(--s-4); } .tabs a { font-size: 13.5px; } }

/* Linhas clicáveis (.rows > a.row). Cada lista define suas colunas em
   --cols; o cabeçalho (.rows-head) usa as mesmas colunas, então tudo alinha. */
.rows { margin-bottom: var(--s-6); }
.rows-head, .row { display: grid; grid-template-columns: var(--cols); align-items: center; gap: var(--s-4); }
.rows-head { padding: var(--s-3) var(--s-3); font-size: 11.5px; font-weight: 600; letter-spacing: .06em;
             text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--line-strong); }
.row { padding: var(--s-3); border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none;
       border-radius: 0; transition: background-color .12s; }
.row:hover { background: var(--surface); color: var(--ink); }
.row-img { width: 44px; height: 55px; border-radius: var(--r-sm); object-fit: cover; display: block; background: var(--surface-2); }
.row-img-empty { display: grid; place-items: center; font-size: 9.5px; line-height: 1.1; text-align: center;
                 color: var(--muted); border: 1px dashed var(--line-strong); background: transparent; }
.row-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { font-size: var(--text-sm); color: var(--muted); display: none; }
.row-col { color: var(--ink-2); font-size: 14px; }

.rows-achados { --cols: 44px minmax(0, 1fr) 120px 110px 120px 56px; }

@media (max-width: 899px) {
  /* Celular: só foto · título+subtítulo · status. O cabeçalho some. */
  .rows-head { display: none; }
  .rows-achados { --cols: 52px minmax(0, 1fr) auto; }
  .row { padding: var(--s-3) 0; gap: var(--s-3); }
  .row:hover { background: transparent; }
  .row-img { width: 52px; height: 65px; }
  .row-sub { display: block; }
}

/* Lista vazia: frase amigável + ação. */
.empty { text-align: center; padding: var(--s-7) var(--s-4); border: 1px dashed var(--line-strong);
         border-radius: var(--r-lg); margin-bottom: var(--s-5); }
.empty-title { font: italic 400 26px/1.2 var(--font-display); margin-bottom: var(--s-2); }
.empty-text { color: var(--muted); max-width: 42ch; margin: 0 auto var(--s-4); }
.empty-text:last-child { margin-bottom: 0; }

/* Cartões de número (resumo). Grade que se ajusta: 4 no computador, 2 no celular. */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: var(--s-3); margin-bottom: var(--s-6); }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s-4);
       display: flex; flex-direction: column; gap: var(--s-1); box-shadow: var(--shadow-1); min-width: 0; }
.kpi-label { font-size: var(--text-sm); color: var(--muted); }
.kpi-value { font-size: 26px; font-weight: 600; letter-spacing: -.02em; line-height: 1.15; white-space: nowrap; }
.kpi-note { font-size: var(--text-xs); color: var(--muted); }
@media (max-width: 899px) {
  .kpis { grid-template-columns: 1fr 1fr; gap: var(--s-2); margin-bottom: var(--s-5); }
  .kpi { padding: var(--s-3); }
  .kpi-value { font-size: 20px; }
}

/* Cartão com cabeçalho: título à esquerda, ações à direita. */
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3);
             flex-wrap: wrap; margin-bottom: var(--s-4); }
.card-head h4 { margin: 0; }
.card-head-actions { display: flex; gap: var(--s-2); flex-wrap: wrap; }
.card-head-actions form { margin: 0; }
.card-help { color: var(--muted); font-size: 14px; margin: calc(-1 * var(--s-2)) 0 var(--s-4); max-width: 70ch; }

/* Linha de ações no rodapé de um formulário: alinhadas à direita no computador. */
.form-actions { display: flex; justify-content: flex-end; align-items: center; gap: var(--s-3); flex-wrap: wrap; margin-top: var(--s-2); }
.form-actions a:not([role=button]) { color: var(--muted); font-size: 14px; }
@media (max-width: 899px) {
  .form-actions { flex-direction: column-reverse; align-items: stretch; }
  .form-actions button { width: 100%; }
  .form-actions a:not([role=button]) { text-align: center; padding: var(--s-2); }
}

/* Grade de formulário com 2 colunas (1 no celular); .span-2 ocupa a linha toda. */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; column-gap: var(--s-4); }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 720px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-grid-4 { grid-template-columns: 1fr 1fr; }
}
.hint { display: block; font-weight: 400; color: var(--muted); font-size: var(--text-xs); margin-top: 6px; }


/* 11. Telas (L3) -------------------------------------------------------------- */

/* Utilidades */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
                   overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.show-mobile { display: none; }
@media (max-width: 899px) { .show-mobile { display: inline; } }
.meta-line { font-size: var(--text-sm); color: var(--muted); margin: 0; }
.hint-inline { font-weight: 400; color: var(--muted); }
.footnote { font-size: var(--text-sm); color: var(--muted); margin-top: var(--s-4); }
.row-sub-always { display: block; }

/* Título de seção (fora de cartão): itálico serifado menor, mesma família dos títulos de página. */
.section-title { font: italic 400 28px/1.15 var(--font-display); margin: var(--s-7) 0 var(--s-4); }
@media (max-width: 899px) { .section-title { font-size: 24px; margin-top: var(--s-6); } }

/* Formulário estreito (Novo achado): linhas longas demais cansam a leitura. */
.form-narrow { max-width: 760px; }

/* Bloco secundário dentro de um cartão (ex.: "Adicionar parada"), separado por linha fina. */
.subform { border-top: 1px solid var(--line); margin-top: var(--s-5); padding-top: var(--s-4); }
.subform-title { font-size: var(--text-sm); font-weight: 600; color: var(--ink-2); margin-bottom: var(--s-3); }
.inline-form { display: flex; gap: var(--s-2); align-items: center; }
.inline-form select { margin: 0; flex: 1; min-width: 0; }
@media (max-width: 480px) { .inline-form { flex-direction: column; align-items: stretch; } }

/* Recolhível (<details>): "Lançar nova coleta", "Histórico". Sem JS. */
.disclosure { border-top: 1px solid var(--line); padding-top: var(--s-3); margin-top: var(--s-4); }
.disclosure > summary { cursor: pointer; list-style: none; font-weight: 600; font-size: 14px; color: var(--ink-2);
                        display: flex; align-items: center; gap: var(--s-2); padding: var(--s-1) 0; }
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary::before { content: ""; width: 7px; height: 7px; border-right: 1.8px solid currentColor;
                                border-bottom: 1.8px solid currentColor; transform: rotate(-45deg); transition: transform .15s; margin-right: 4px; }
.disclosure[open] > summary::before { transform: rotate(45deg); }
.disclosure[open] > summary { margin-bottom: var(--s-4); }
/* Variante "cartão": o recolhível é ele mesmo um cartão (Comissões). */
.disclosure-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
                   box-shadow: var(--shadow-1); padding: var(--s-4) var(--s-5); margin: 0 0 var(--s-5); }
.disclosure-card > summary { font-size: var(--text-lg); color: var(--ink); }

/* Painel suspenso preso a um botão (<details class="popover">): "Nova edição". */
.popover { position: relative; }
.popover > summary { list-style: none; }
.popover > summary::-webkit-details-marker { display: none; }
.popover-panel { position: absolute; right: 0; top: calc(100% + var(--s-2)); z-index: 15; width: 320px;
                 background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
                 box-shadow: var(--shadow-2); padding: var(--s-4); margin: 0; }
@media (max-width: 899px) { .popover { width: 100%; } .popover-panel { left: 0; right: 0; width: auto; } }

/* Cartão de "próximo passo" (Aprovar, Publicar): texto à esquerda, botão à direita. */
.next-step { display: flex; align-items: center; justify-content: space-between; gap: var(--s-5);
             border-color: var(--accent-line); background: color-mix(in srgb, var(--accent-soft) 55%, var(--surface)); }
.next-step h4 { margin-bottom: var(--s-2); }
.next-step .card-help { margin: 0; }
.next-step form { margin: 0; flex: none; }
@media (max-width: 720px) { .next-step { flex-direction: column; align-items: stretch; } .next-step button { width: 100%; } }

/* Passo a passo da edição (1 Montar → 4 Medir). */
.steps { list-style: none; margin: 0 0 var(--s-5); padding: 0; display: flex; gap: var(--s-2); counter-reset: none; }
.steps li { flex: 1; display: flex; align-items: center; gap: var(--s-2); padding-top: var(--s-3);
            border-top: 2px solid var(--line-strong); color: var(--muted); font-size: var(--text-sm); min-width: 0; }
.steps li.done { border-top-color: var(--ink-2); color: var(--ink-2); }
.steps li.current { border-top-color: var(--accent); color: var(--ink); font-weight: 600; }
.steps-dot { width: 22px; height: 22px; flex: none; border-radius: 50%; display: grid; place-items: center;
             font-size: 11.5px; font-weight: 600; border: 1px solid var(--line-strong); background: var(--surface); }
.steps li.done .steps-dot { background: var(--ink-2); border-color: var(--ink-2); color: #FFFFFF; }
.steps li.current .steps-dot { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.steps-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 560px) { .steps li:not(.current) .steps-name { display: none; } }

/* Linhas: variações de cada lista ----------------------------------------- */
.row-static:hover { background: transparent; }
.row-number { font: italic 400 30px/1 var(--font-display); color: var(--ink); }
.row-number-sm { font-size: 22px; color: var(--muted); text-align: center; }
a.row-title { color: var(--ink); text-decoration: none; }
a.row-title:hover { color: var(--accent); }
.row-actions { display: flex; gap: 2px; justify-content: flex-end; }
.row-actions form { margin: 0; }
.row-money { font-weight: 600; white-space: nowrap; }
.row-link { min-width: 0; display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.row-link-url { font-size: var(--text-xs); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }

.rows-edicoes    { --cols: 48px minmax(0, 1fr) 90px 120px 110px; }
.rows-paradas    { --cols: 28px minmax(0, 1fr) 80px 90px; margin-bottom: var(--s-3); }
.rows-ed-achados { --cols: 28px 44px minmax(0, 1fr) minmax(0, 220px); margin-bottom: 0; }
.rows-ed-achados.is-editable { --cols: 28px 44px minmax(0, 1fr) minmax(0, 220px) 112px; }
.rows-comissoes  { --cols: 120px minmax(0, 1fr) 70px 70px 110px 120px 96px; }
.rows-paradas .row:last-child, .rows-ed-achados .row:last-child { border-bottom: 0; }
.stops-day { font-size: 11.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent);
             margin: var(--s-4) 0 0; }

@media (max-width: 899px) {
  .rows-edicoes    { --cols: 40px minmax(0, 1fr) auto; }
  .rows-paradas    { --cols: 20px minmax(0, 1fr) auto; }
  .rows-paradas .row > :nth-child(3) { display: none; }   /* nº de fotos some no celular */
  .rows-ed-achados, .rows-ed-achados.is-editable { --cols: 20px 44px minmax(0, 1fr); }
  .rows-ed-achados .row-link { grid-column: 3; }          /* etiqueta desce para baixo do título */
  .rows-ed-achados .row-actions { grid-column: 1 / -1; justify-content: flex-start; padding-left: 64px; margin-top: -4px; }
  .rows-ed-achados .row-img { width: 44px; height: 55px; }
  .rows-comissoes  { --cols: minmax(0, 1fr) auto; }
  /* Celular: linha 1 = achado · valor; linha 2 = status · Confirmar. */
  .rows-comissoes .row-main    { grid-column: 1; grid-row: 1; }
  .rows-comissoes .row-money   { grid-column: 2; grid-row: 1; align-self: start; }
  .rows-comissoes .row-status  { grid-column: 1; grid-row: 2; justify-self: start; }
  .rows-comissoes .row-actions { grid-column: 2; grid-row: 2; }
  .rows-comissoes .row { row-gap: var(--s-2); }
}

/* Detalhe do achado: fotos (larga) + dados (estreita). */
.detail-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: var(--s-5); align-items: start; }
.detail-grid > article { margin-bottom: 0; }
.detail-grid { margin-bottom: var(--s-5); }
@media (max-width: 1100px) { .detail-grid { grid-template-columns: 1fr; } }

.photo-badge { position: absolute; left: var(--s-2); top: var(--s-2); }
.focal-wrap { border-radius: var(--r); overflow: hidden; }
.photo-adjust { display: flex; gap: var(--s-2); }
.photo-adjust select { flex: 1; min-width: 0; }
.photo-adjust button { height: 36px; padding: 0 var(--s-3); font-size: var(--text-sm); width: auto !important; }
.fotos figcaption .outline.secondary { justify-content: flex-start; padding: 0 var(--s-1); }

/* Área de envio de foto: o <label> inteiro é clicável (abre câmera/galeria). */
.upload-form { display: flex; gap: var(--s-3); align-items: stretch; margin: 0; }
.upload { flex: 1; margin: 0; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto;
          column-gap: var(--s-3); align-items: center; padding: var(--s-3) var(--s-4); cursor: pointer;
          border: 1.5px dashed var(--line-strong); border-radius: var(--r); background: var(--bg); transition: border-color .15s, background-color .15s; }
.upload:hover, .upload:focus-within { border-color: var(--accent); background: var(--accent-soft); }
.upload-icon { grid-row: 1 / 3; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
               background: var(--surface); color: var(--accent); border: 1px solid var(--line); }
.upload-text { font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-hint { font-size: var(--text-xs); font-weight: 400; color: var(--muted); }
.upload-ok { border-style: solid; border-color: var(--accent); }
.upload-form > button { height: auto; }
@media (max-width: 560px) { .upload-form { flex-direction: column; } .upload-form > button { height: var(--field-h); } }

/* Tabelas densas (Desempenho): dentro de um cartão branco, rolam de lado no celular. */
.table-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
              box-shadow: var(--shadow-1); overflow-x: auto; margin-bottom: var(--s-4); }
.table-card table { margin: 0; }
.table-card th { background: #FCFBF9; padding-top: var(--s-3); }
.table-card th:first-child, .table-card td:first-child { padding-left: var(--s-4); }
.table-card th:last-child, .table-card td:last-child { padding-right: var(--s-4); }
.table-card tbody tr:last-child td { border-bottom: 0; }
.table-card-narrow { max-width: 760px; }
.table-wrap { overflow-x: auto; }
@media (max-width: 720px) { .table-card table, .table-wrap table { display: table; } .table-card th, .table-card td { white-space: nowrap; } }

.kpis-tight { margin-bottom: var(--s-4); }

/* Último campo de um cartão: tira a margem de baixo, senão ela soma com o
   espaçamento interno do cartão e o pé fica mais alto que o topo. */
article > .form-grid:last-child, article > fieldset.form-grid:last-child { margin-bottom: calc(-1 * var(--s-4)); }


/* 12. Acabamento (L4) ---------------------------------------------------------- */

/* Aviso flutuante ("Legenda salva."). Grafite com texto claro: lê bem sobre
   qualquer tela. Entra deslizando de baixo; some sozinho em 3,5 s. */
.toast { position: fixed; left: 50%; bottom: var(--s-6); z-index: 50; max-width: min(92vw, 420px);
         transform: translate(-50%, 12px); opacity: 0; transition: opacity .25s, transform .25s;
         display: flex; align-items: center; gap: var(--s-2);
         padding: var(--s-3) var(--s-4); border-radius: var(--r-lg);
         background: var(--ink); color: #FAF8F5; font-size: 14px; font-weight: 600;
         box-shadow: 0 16px 32px -12px rgba(29, 27, 24, .45); }
.toast::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #9CC28A; flex: none; }
.toast.toast-in { opacity: 1; transform: translate(-50%, 0); }
/* [hidden] precisa vencer o display:flex acima; senão o aviso "escondido"
   continua lá, transparente, por cima dos botões do rodapé. */
.toast[hidden] { display: none; }
@media (min-width: 900px) { .toast { left: calc(50% + 124px); } }   /* centro da área de conteúdo, não da tela */
@media (max-width: 899px) { .toast { bottom: calc(84px + env(safe-area-inset-bottom)); } }

/* Botão travado enquanto envia: cursor de espera em vez de "proibido". */
button[data-travado] { cursor: progress; opacity: .7; }

/* Quem pede menos movimento no sistema (acessibilidade) não vê animações. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* Ao voltar para uma âncora (#arte, #metricas), a seção não fica escondida
   atrás da barra fixa do topo do celular. */
@media (max-width: 899px) { [id] { scroll-margin-top: 72px; } }
