/* =============================================================================================
   portal.css — o portal do cliente Ticvero (/cliente, dentro da Admin)
   copied from site/ at 2026-10-03; site/ is the source of truth for tokens
   (copiado de site/ em 2026-10-03; o site/ é a fonte da verdade dos tokens). As secções 0–17 são as do
   site/src/assets/site.css, com os mesmos números e os mesmos nomes de classes (assim as próximas cópias são fáceis):
   0 tipos de letra, 1 tokens, 2 base, 3 layout, 4 papel rasgado, 5 cabeçalho, 6 rodapé, 7 botões, 8 componentes,
   11 o talão, 14 folha, 15 tabela, 17 formulários.
   Depois delas, só o que é do portal («P.»): só tokens, nenhuma cor solta, nenhuma transição nem animação.
   Os url("fonts/…") continuam certos: este ficheiro está em /portal/ e os tipos de letra em /portal/fonts/.
   ============================================================================================= */

/* ---------------------------------------------------------------------------------------------
   0. Tipos de letra, servidos pelo próprio site (o navegador não se liga a nenhum serviço externo)
   Space Grotesk (títulos, texto, UI) e JetBrains Mono (etiquetas, códigos, talões), ambas OFL.
   Fontes variáveis (peso 400–700); só os blocos latin e latin-ext, com os unicode-range do Google Fonts.
   --------------------------------------------------------------------------------------------- */
/* Space Grotesk: latin-ext */
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/space-grotesk-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* Space Grotesk: latin */
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/space-grotesk-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* JetBrains Mono: latin-ext */
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/jetbrains-mono-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* JetBrains Mono: latin */
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/jetbrains-mono-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------------------------------------------------------------------------------------------
   1. Tokens
   1a. Cores do tema. Claro por omissão (também sem script); escuro com <html data-theme="dark">
       (script no <head> do layout). .theme-dark repõe o escuro numa ilha (bloco CTA), também no claro.
   --------------------------------------------------------------------------------------------- */
:root[data-theme="dark"],
.theme-dark {
  --bg: #090B0F;
  --bg-2: #0E1117;
  --surface: #12161D;
  --surface-2: #171C24;
  --ink: #EEF1F5;
  --text: #9CA5B1;
  --muted: #858E9A;          /* #6B7480 do handoff dava 3,9:1 sobre --surface; este dá ≥ 5:1 */
  --line: #1D232C;
  --line-2: #29303B;
  --cy: #3DD5E3;             /* cor de marca: fundos, pontos, linhas, botões */
  --cy-ink: #3DD5E3;         /* ciano usado como TEXTO */
  --cy-soft: rgba(61, 213, 227, 0.10);
  --cy-glow: rgba(61, 213, 227, 0.35);
  --on-cy: #06191C;
  --red: #FF6B6B;
  --red-soft: rgba(255, 107, 107, 0.10);
  --off: #262C36;
  --dot: rgba(61, 213, 227, 0.14);
  /* logo (4a) */
  --mk-tile: #12141A;
  --mk-border: #262C36;
  --mk-off: #2C303A;
  --mk-on: #3DD5E3;
  --mk-period: #3DD5E3;
  /* sombras */
  --shadow-panel: 0 40px 80px -30px rgba(0, 0, 0, 0.6);
  --shadow-cta: 0 10px 30px -8px var(--cy-glow);
  --shadow-menu: 0 24px 48px -16px rgba(0, 0, 0, 0.6);
  --shadow-high: drop-shadow(0 24px 32px rgba(0, 0, 0, 0.45)) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.35));
  --shadow-low: drop-shadow(0 14px 22px rgba(0, 0, 0, 0.35)) drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
  --shadow-high-box: 0 24px 32px rgba(0, 0, 0, 0.45), 0 2px 4px rgba(0, 0, 0, 0.35);
  --shadow-low-box: 0 14px 22px rgba(0, 0, 0, 0.35), 0 1px 2px rgba(0, 0, 0, 0.3);
  color-scheme: dark;
}

:root {
  --bg: #F5F7F9;
  --bg-2: #EDF0F3;
  --surface: #FFFFFF;
  --surface-2: #F7F9FB;
  --ink: #0B0E13;
  --text: #4A525D;
  --muted: #646C77;          /* #6E7681 do handoff dava 4,3:1 sobre --bg-2 */
  --line: #E2E6EB;
  --line-2: #CFD5DC;
  --cy: #1FB7C6;
  --cy-ink: #06737E;         /* #077C88 do handoff dava 4,3:1 sobre --bg-2; este dá 4,9:1 */
  --cy-soft: rgba(31, 183, 198, 0.10);
  --cy-glow: rgba(31, 183, 198, 0.25);
  --on-cy: #06191C;          /* texto sobre --cy (#1FB7C6): o branco dava 2,4:1; este dá 8:1 */
  --red: #C9302C;
  --red-soft: rgba(201, 48, 44, 0.08);
  --off: #DDE2E8;
  --dot: rgba(11, 14, 19, 0.07);
  /* logo (4c) */
  --mk-tile: transparent;
  --mk-border: transparent;
  --mk-off: #D3D9DF;
  --mk-on: #077C88;
  --mk-period: #077C88;
  --shadow-panel: 0 30px 60px -24px rgba(8, 12, 20, 0.22);
  --shadow-menu: 0 24px 48px -16px rgba(8, 12, 20, 0.18);
  --shadow-high: drop-shadow(0 22px 26px rgba(34, 33, 42, 0.16)) drop-shadow(0 2px 3px rgba(34, 33, 42, 0.20));
  --shadow-low: drop-shadow(0 14px 18px rgba(34, 33, 42, 0.13)) drop-shadow(0 1px 2px rgba(34, 33, 42, 0.18));
  --shadow-high-box: 0 22px 26px rgba(34, 33, 42, 0.16), 0 2px 3px rgba(34, 33, 42, 0.20);
  --shadow-low-box: 0 14px 18px rgba(34, 33, 42, 0.13), 0 1px 2px rgba(34, 33, 42, 0.18);
  color-scheme: light;
}

/* 1b. Papel (talões, folhas impressas): igual nos dois temas. Dentro do papel, os tokens do tema
       passam a ser os da impressão, para o CSS das páginas continuar a usar --ink, --c-ink, etc. */
:root {
  --paper: #FBFBF8;
  --print-ink: #22212A;
  --print-text: #3F4047;
  --print-faded: #6E6C75;
  --print-perf: #8F8D96;
  --print-cy: #077C88;       /* o ciano escuro: legível sobre papel (5,1:1) */
  --print-red: #B3261E;
  --print-band: rgba(31, 183, 198, 0.13);
  --scan: #3DD5E3;
  --paper-shade:
    linear-gradient(90deg, rgba(34, 33, 42, 0.04), rgba(34, 33, 42, 0) 8%, rgba(34, 33, 42, 0) 92%, rgba(34, 33, 42, 0.035)),
    linear-gradient(180deg, #FDFDFB, #F6F7F4 58%, #FAFAF8);
}

.paper,
.receipt__paper,
.receipt__stamp,
.slip__paper {
  --bg: var(--paper);
  --bg-2: #F1F1EC;
  --surface: var(--paper);
  --surface-2: #F4F4F0;
  --ink: var(--print-ink);
  --text: var(--print-text);
  --muted: var(--print-faded);
  --line: rgba(34, 33, 42, 0.14);
  --line-2: var(--print-perf);
  --cy: var(--print-cy);
  --cy-ink: var(--print-cy);
  --cy-soft: var(--print-band);
  --on-cy: #FFFFFF;
  --red: var(--print-red);
  color-scheme: light;
}

/* 1c. Bloco de código: sempre escuro, também no tema claro (valores fixos do handoff) */
:root {
  --code-bg: #06080B;
  --code-border: #29303B;
  --code-line: #1A1F27;
  --code-tab: #131820;
  --code-ink: #EEF1F5;
  --code-text: #C5CED9;
  --code-muted: #858E9A;
  --code-key: #7FB8F0;
  --code-str: #E6C07B;
  --code-true: #3DD5E3;
  --code-false: #FF6B6B;
  /* bloco CTA final: sempre escuro */
  --cta-bg: #090B0F;
  --cta-glow: rgba(61, 213, 227, 0.22);
  --cta-dot: rgba(61, 213, 227, 0.16);
  --cta-shadow: 0 10px 40px -6px rgba(61, 213, 227, 0.5);
}

/* 1d. Aliases dos nomes antigos (o CSS das páginas ainda os usa). Declarados também no papel e nas
       ilhas escuras, para seguirem os tokens desse sítio. */
:root,
.theme-dark,
.paper,
.receipt__paper,
.receipt__stamp,
.slip__paper {
  --c-counter: var(--bg);
  --c-paper: var(--paper);
  --c-ink: var(--ink);
  --c-text: var(--text);
  --c-faded: var(--muted);
  --c-perf: var(--line-2);
  --c-stamp: var(--cy-ink);
  --c-stamp-hover: var(--cy);
  --c-reject: var(--red);
  --c-white: var(--on-cy);
  --c-band: var(--cy-soft);
  --c-flash: var(--cy-soft);
}

/* 1e. Forma, tipos, escala, espaço, layout */
:root {
  --r-sm: 6px;
  --r-ctl: 9px;
  --r-btn: 11px;
  --r-card: 16px;
  --r-panel: 20px;
  --r-cta: 24px;
  --r-pill: 999px;

  --font-ui: 'Space Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;
  --font-print: var(--font-mono);

  /* Escala (handoff 1.4) */
  --fs-display: clamp(2.875rem, 6.4vw, 5.25rem);      /* h1: 46 → 84 */
  --lh-display: 0.98;
  --ls-display: -0.05em;
  --fs-title: clamp(2.125rem, 4.4vw, 3.5rem);         /* h2: 34 → 56 */
  --lh-title: 1.02;
  --ls-title: -0.045em;
  --fs-highlight: clamp(1.875rem, 3.6vw, 2.875rem);   /* CTA final: 30 → 46 */
  --lh-highlight: 1.05;
  --fs-sub: clamp(1.25rem, 1.15rem + 0.4vw, 1.5rem);  /* h3: 20 → 24 */
  --lh-sub: 1.18;
  --fs-lead: clamp(1.0625rem, 1rem + 0.2vw, 1.125rem); /* entrada: 17 → 18 */
  --lh-lead: 1.6;
  --fs-body: 1rem;                                    /* 16 */
  --lh-body: 1.55;
  --fs-small: 0.9375rem;                              /* 15: texto dos cartões */
  --fs-label: 0.75rem;                                /* 12: etiquetas mono */
  --fs-code: 0.78125rem;                              /* 12,5: blocos de código */

  /* Espaçamento */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;
  --sp-8: 64px;
  --sp-9: 96px;
  --sp-10: 128px;
  --section: 120px;
  --space-section: clamp(4.5rem, 3.2rem + 5vw, 7.5rem);        /* entre secções: 72 → 120 */
  --space-section-tight: clamp(3rem, 2.2rem + 3vw, 5rem);       /* quando continua o assunto: 48 → 80 */
  --space-title: 16px;                                          /* título → parágrafo */
  --space-object: clamp(2rem, 1.4rem + 2.4vw, 3.5rem);          /* texto → objeto: 32 → 56 */
  --space-object-sm: clamp(2rem, 1.7rem + 1.2vw, 3rem);         /* texto → objeto: 32 → 48 */

  /* Layout */
  --content: 1240px;
  --measure: 620px;
  --gutter: 24px;
  --col-gap: 24px;
}

@media (max-width: 600px) {
  :root {
    --gutter: 16px;
    --col-gap: 16px;
  }
}

/* 1f. Portal: os tokens novos do portal do cliente (D38). As marcas dos gráficos e dos estados têm ≥ 3:1 nos dois temas:
       --cy sobre branco dava ≈ 2,4:1 e --line-2 ≈ 1,4:1, por isso o aprovado é --cy-ink e a revisão --muted. */
:root {
  --fs-app-title: clamp(1.875rem, 1.3rem + 1.8vw, 2.75rem);   /* h1 de uma página da aplicação: 30 → 44 (o --fs-display do site é grande demais) */
  --fs-app-h2: clamp(1.125rem, 1rem + 0.4vw, 1.375rem);        /* títulos de secção: 18 → 22 */
  --fs-kpi: clamp(1.75rem, 1.3rem + 1.4vw, 2.5rem);            /* números dos mosaicos: 28 → 40, mono, tabulares */
  --portal-header-h: 68px;
  --chart-approved: var(--cy-ink);   /* ≈ 5,6:1 sobre branco; = --cy (#3DD5E3) no escuro */
  --chart-review: var(--muted);      /* ≈ 5,3:1 no claro, ≈ 5,5:1 no escuro */
  --chart-rejected: var(--red);
  --status-contested: var(--ink);
  --hatch-contested: repeating-linear-gradient(135deg, var(--ink) 0 2px, transparent 2px 5px);
  --meter-on: var(--cy-ink);
  --meter-off: var(--off);           /* decorativo: a palavra ao lado do medidor diz o nível */
  --scrim: rgba(6, 8, 11, 0.66);      /* por trás de um diálogo e do visor da fotografia (os dois temas) */
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 88px;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: clip;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* rede de segurança contra o scroll horizontal no telemóvel (palavras longas em de/fr) */
  overflow-wrap: break-word;
}

:where(h1, h2, h3, h4, p, ul, ol, dl, dd, figure, blockquote, pre) {
  margin: 0;
}

:where(ul, ol)[class],
:where(ul, ol)[role="list"] {
  list-style: none;
  padding: 0;
}

:where(img, svg, video) {
  display: block;
  max-width: 100%;
}

:where(img) {
  height: auto;
}

:where(button, input, select, textarea) {
  font: inherit;
  color: inherit;
}

:where(strong, b) {
  font-weight: 600;
}

/* Código em linha (num texto do JSON): mono, um pouco mais pequeno que o texto à volta */
:where(:not(pre) > code) {
  font-family: var(--font-mono);
  font-size: 0.9em;
  font-weight: 500;
}

[hidden] {
  display: none;
}

a {
  color: var(--ink);
  text-decoration-color: var(--cy);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 4px;
}

a:hover {
  color: var(--cy-ink);
}

:focus-visible {
  outline: 2px solid var(--cy);
  outline-offset: 3px;
}

::selection {
  background: var(--cy-glow);
  color: var(--ink);
}

/* Títulos: a escala do handoff; as classes .t-* dão o mesmo aspeto a outros elementos */
:where(h1),
.t-display {
  font-size: var(--fs-display);
  line-height: var(--lh-display);
  font-weight: 700;
  letter-spacing: var(--ls-display);
  color: var(--ink);
  text-wrap: balance;
}

:where(h2),
.t-title {
  font-size: var(--fs-title);
  line-height: var(--lh-title);
  font-weight: 700;
  letter-spacing: var(--ls-title);
  color: var(--ink);
  text-wrap: balance;
}

:where(h3),
.t-sub {
  font-size: var(--fs-sub);
  line-height: var(--lh-sub);
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--ink);
  text-wrap: pretty;
}

.t-highlight {
  font-size: clamp(1.5rem, 1.25rem + 1vw, 2rem);
  line-height: 1.12;
  font-weight: 700;
  letter-spacing: -0.035em;
  color: var(--ink);
  text-wrap: balance;
}

.t-lead {
  max-width: var(--measure);
  font-size: var(--fs-lead);
  line-height: var(--lh-lead);
  color: var(--text);
  text-wrap: pretty;
}

.t-text {
  max-width: var(--measure);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--text);
  text-wrap: pretty;
}

.t-lead strong,
.t-text strong {
  color: var(--ink);
}

.accent {
  color: var(--cy-ink);
}

@media (max-width: 600px) {
  :where(h1, h2),
  .t-display,
  .t-title {
    -webkit-hyphens: auto;
    hyphens: auto;
  }
}

/* ---------------------------------------------------------------------------------------------
   3. Layout: contentor, secções, grelha de 12 colunas
   --------------------------------------------------------------------------------------------- */
.container {
  width: min(100% - 2 * var(--gutter), var(--content));
  margin-inline: auto;
}

.section {
  padding-top: var(--space-section);
}

.section--tight {
  padding-top: var(--space-section-tight);
}

/* 12 colunas em todas as larguras. Em ≤ 900 px quase tudo passa a grid-column: 1 / -1. */
.grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--col-gap);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  z-index: 100;
  top: 8px;
  left: var(--gutter);
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: var(--r-ctl);
  background: var(--cy);
  color: var(--on-cy);
  font-weight: 600;
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

.site-main {
  flex: 1 0 auto;
  padding-bottom: var(--space-section);
}

.site-main:focus {
  outline: none;
}

/* O primeiro bloco de cada página: brilho ciano + pontos, com uma linha por baixo */
.dotgrid {
  background-image: radial-gradient(circle, var(--dot) 1.2px, transparent 1.6px);
  background-size: 22px 22px;
}

.glow {
  background-image: radial-gradient(circle at 70% 40%, var(--cy-soft), transparent 55%);
}

.glow.dotgrid,
.page-intro {
  background-image:
    radial-gradient(circle at 70% 40%, var(--cy-soft), transparent 55%),
    radial-gradient(circle, var(--dot) 1.2px, transparent 1.6px);
  background-size: 100% 100%, 22px 22px;
}

.page-intro {
  padding-block: clamp(56px, 3rem + 4vw, 96px);
  border-bottom: 1px solid var(--line);
}

/* ---------------------------------------------------------------------------------------------
   4. Papel rasgado: serrilhado em CSS que se adapta à largura (só talões e tiras de papel)
   --------------------------------------------------------------------------------------------- */
.torn-top,
.torn-bottom,
.torn-y,
.torn-x {
  --tooth: 12px;
  --depth: 4px;
}

.torn-top {
  -webkit-mask:
    conic-gradient(from 123deg at 50% 0, #000 114deg, #0000 0) 0 0 / var(--tooth) var(--depth) round no-repeat,
    linear-gradient(#000 0 0) 0 calc(var(--depth) - 0.5px) / 100% 100% no-repeat;
  mask:
    conic-gradient(from 123deg at 50% 0, #000 114deg, #0000 0) 0 0 / var(--tooth) var(--depth) round no-repeat,
    linear-gradient(#000 0 0) 0 calc(var(--depth) - 0.5px) / 100% 100% no-repeat;
}

.torn-bottom {
  -webkit-mask:
    conic-gradient(from -57deg at 50% 100%, #000 114deg, #0000 0) 0 100% / var(--tooth) var(--depth) round no-repeat,
    linear-gradient(#000 0 0) 0 0 / 100% calc(100% - var(--depth) + 0.5px) no-repeat;
  mask:
    conic-gradient(from -57deg at 50% 100%, #000 114deg, #0000 0) 0 100% / var(--tooth) var(--depth) round no-repeat,
    linear-gradient(#000 0 0) 0 0 / 100% calc(100% - var(--depth) + 0.5px) no-repeat;
}

.torn-y,
.receipt__paper,
.slip__paper {
  -webkit-mask:
    conic-gradient(from 123deg at 50% 0, #000 114deg, #0000 0) 0 0 / var(--tooth) var(--depth) round no-repeat,
    conic-gradient(from -57deg at 50% 100%, #000 114deg, #0000 0) 0 100% / var(--tooth) var(--depth) round no-repeat,
    linear-gradient(#000 0 0) 0 calc(var(--depth) - 0.5px) / 100% calc(100% - 2 * var(--depth) + 1px) no-repeat;
  mask:
    conic-gradient(from 123deg at 50% 0, #000 114deg, #0000 0) 0 0 / var(--tooth) var(--depth) round no-repeat,
    conic-gradient(from -57deg at 50% 100%, #000 114deg, #0000 0) 0 100% / var(--tooth) var(--depth) round no-repeat,
    linear-gradient(#000 0 0) 0 calc(var(--depth) - 0.5px) / 100% calc(100% - 2 * var(--depth) + 1px) no-repeat;
}

.torn-x {
  -webkit-mask:
    conic-gradient(from 33deg at 0 50%, #000 114deg, #0000 0) 0 0 / var(--depth) var(--tooth) no-repeat round,
    conic-gradient(from 213deg at 100% 50%, #000 114deg, #0000 0) 100% 0 / var(--depth) var(--tooth) no-repeat round,
    linear-gradient(#000 0 0) calc(var(--depth) - 0.5px) 0 / calc(100% - 2 * var(--depth) + 1px) 100% no-repeat;
  mask:
    conic-gradient(from 33deg at 0 50%, #000 114deg, #0000 0) 0 0 / var(--depth) var(--tooth) no-repeat round,
    conic-gradient(from 213deg at 100% 50%, #000 114deg, #0000 0) 100% 0 / var(--depth) var(--tooth) no-repeat round,
    linear-gradient(#000 0 0) calc(var(--depth) - 0.5px) 0 / calc(100% - 2 * var(--depth) + 1px) 100% no-repeat;
}

.torn--wide {
  --tooth: 18px;
  --depth: 6px;
}

.shadow-high {
  filter: var(--shadow-high);
}

.shadow-low {
  filter: var(--shadow-low);
}

/* ---------------------------------------------------------------------------------------------
   5. Cabeçalho (fixo no topo, translúcido). ≥ 1280: uma linha; 901–1279: a navegação numa 2.ª
      linha; ≤ 900: menu <details> com o botão de tema ao lado; ≤ 600: o botão vai para o menu.
   --------------------------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  flex: none;
  border-bottom: 1px solid var(--line);
  background: color-mix(in oklab, var(--bg) 78%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.site-header__bar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px 24px;
  min-height: 68px;
}

/* O logo: símbolo em pontos (padrão 0000 / 0001 / 1010 / 0100) + nome minúsculo com o ponto final */
.brand {
  display: flex;
  flex: none;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  margin-right: auto;
  color: var(--ink);
  text-decoration: none;
}

.brand:hover {
  color: var(--ink);
}

.brand__mark {
  display: grid;
  flex: none;
  grid-template-columns: repeat(4, 4px);
  gap: 3px;
  align-content: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--mk-border);
  border-radius: 8px;
  background: var(--mk-tile);
}

.brand__mark i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--mk-off);
}

.brand__mark i.on {
  background: var(--mk-on);
}

.brand__name {
  font: 700 22px/1 var(--font-ui);
  letter-spacing: -0.035em;
  color: var(--ink);
  white-space: nowrap;
}

.brand__dot {
  color: var(--mk-period);
}

.site-nav {
  min-width: 0;
}

.site-nav__list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
}

.site-nav__link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 12px;
  border-radius: var(--r-ctl);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

.site-nav__link:hover,
.site-nav__link[aria-current="page"] {
  color: var(--ink);
}

.site-nav__link[aria-current="page"] {
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
}

.site-header__tools {
  display: flex;
  flex: none;
  align-items: center;
  gap: 8px;
}

/* Seletor de língua compacto: o código atual (mono) abre a lista das cinco */
.lang-menu {
  position: relative;
}

.lang-menu__button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 8px;
  border-radius: var(--r-ctl);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  text-transform: uppercase;
  list-style: none;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

.lang-menu__button::-webkit-details-marker {
  display: none;
}

.lang-menu__button::after {
  content: "";
  width: 6px;
  height: 6px;
  margin-top: -3px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
}

.lang-menu__button:hover,
.lang-menu[open] .lang-menu__button {
  color: var(--ink);
}

.lang-menu__list {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  min-width: 168px;
  padding: 6px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-ctl);
  background: var(--surface);
  box-shadow: var(--shadow-menu);
}

.lang-menu__link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 40px;
  padding: 0 10px;
  border-radius: var(--r-sm);
  color: var(--text);
  font-size: 14px;
  text-decoration: none;
}

.lang-menu__link:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.lang-menu__link[aria-current="page"] {
  color: var(--ink);
  font-weight: 600;
}

.lang-menu__code {
  width: 22px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  font-weight: 400;
}

.lang-menu__link[aria-current="page"] .lang-menu__code {
  color: var(--cy-ink);
}

/* Botão de tema: ☀ no escuro, ☾ no claro. Só aparece com script (sem script não faria nada). */
.theme-toggle {
  display: none;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line-2);
  border-radius: var(--r-ctl);
  background: transparent;
  color: var(--ink);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}

.js .theme-toggle {
  display: inline-flex;
}

.theme-toggle:hover {
  border-color: var(--cy);
}

.theme-toggle__sun,
:root[data-theme="dark"] .theme-toggle__moon {
  display: none;
}

:root[data-theme="dark"] .theme-toggle__sun {
  display: inline;
}

/* ≥ 1280 px: tudo numa linha (marca | navegação | língua, tema, botão) */
@media (min-width: 1280px) {
  .site-nav {
    margin-right: 8px;
  }
}

/* 901–1279 px: marca | ferramentas na 1.ª linha; a navegação na 2.ª */
@media (min-width: 901px) and (max-width: 1279px) {
  .site-header__bar {
    flex-wrap: wrap;
    padding-top: 12px;
  }

  .site-nav {
    order: 1;
    flex: 1 0 100%;
    margin: 0 0 6px -12px;
  }
}

/* O menu do telemóvel e do tablet: <details> nativo, sem script */
.menu {
  display: none;
}

.menu__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 44px;
  min-height: 44px;
  padding: 0 14px 0 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-ctl);
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  list-style: none;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

.menu__button::-webkit-details-marker {
  display: none;
}

.menu__icon {
  flex: none;
  width: 20px;
  height: 20px;
}

.menu__icon--close,
.menu__label--close,
.menu[open] .menu__icon--open,
.menu[open] .menu__label--open {
  display: none;
}

.menu[open] .menu__icon--close {
  display: block;
}

.menu[open] .menu__label--close {
  display: inline;
}

.menu__panel {
  position: absolute;
  top: calc(100% + 1px);
  left: calc(-1 * var(--gutter));
  right: calc(-1 * var(--gutter));
  max-height: calc(100vh - 68px);
  max-height: calc(100dvh - 68px);
  overflow-y: auto;
  padding: 8px var(--gutter) 32px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  box-shadow: var(--shadow-menu);
}

.menu__link {
  display: flex;
  align-items: center;
  min-height: 52px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-size: var(--fs-lead);
  font-weight: 500;
  text-decoration: none;
}

.menu__link[aria-current="page"] {
  color: var(--cy-ink);
}

/* .menu à frente: o margin: 0 do .btn (secção 7) ganharia a .menu__cta sozinha */
.menu .menu__cta {
  margin-top: 24px;
}

.menu__langs {
  margin-top: 24px;
}

.menu__langs-label {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
}

.menu__langs-list {
  display: flex;
  flex-wrap: wrap;
  column-gap: 20px;
}

.menu__lang {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--text);
  text-decoration: none;
}

.menu__lang[aria-current="page"] {
  color: var(--ink);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--cy);
  text-decoration-thickness: 2px;
  text-underline-offset: 6px;
}

@media (max-width: 900px) {
  .site-header__bar {
    min-height: 64px;
    gap: 8px;
  }

  .site-nav,
  .lang-menu {
    display: none;
  }

  .menu {
    display: block;
  }

  .theme-toggle {
    width: 44px;
    height: 44px;
  }
}

/* Ecrãs muito estreitos (360 px): o nome encolhe em vez de empurrar o menu para fora */
@media (max-width: 400px) {
  .brand {
    gap: 10px;
  }

  .brand__name {
    font-size: 20px;
  }
}

/* .menu / .site-header à frente: estas regras têm de ganhar a .btn e .btn--lg (secção 7) */
@media (min-width: 601px) {
  .menu .menu__cta {
    display: none;
  }
}

@media (max-width: 600px) {
  .site-header .site-header__cta {
    display: none;
  }
}

/* ---------------------------------------------------------------------------------------------
   6. Rodapé (do §6 do site só o rodapé: o bloco CTA final não existe no portal)
   --------------------------------------------------------------------------------------------- */
.site-footer {
  flex: none;
  border-top: 1px solid var(--line);
}

.site-footer__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  padding-block: 28px;
  color: var(--text);
  font-size: 14px;
}

.site-footer__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
}

.site-footer__brand {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.035em;
  color: var(--ink);
}

.site-footer__legal {
  color: var(--muted);
}

.site-footer__privacy {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--text);
}

.site-footer__list {
  display: flex;
  flex-wrap: wrap;
  column-gap: 20px;
}

.site-footer__link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--text);
  text-decoration: none;
}

.site-footer__link:hover,
.site-footer__link[aria-current="page"] {
  color: var(--ink);
}

@media (max-width: 600px) {
  .site-footer__bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .site-footer__list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 16px;
  }
}

/* ---------------------------------------------------------------------------------------------
   7. Botões e ligação secundária
   --------------------------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  margin: 0;
  padding: 0 24px;
  border: 0;
  border-radius: var(--r-btn);
  background: var(--cy);
  color: var(--on-cy);
  font-family: var(--font-ui);
  font-size: var(--fs-body);
  line-height: 1.25;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 0 0 1px var(--cy), var(--shadow-cta);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.btn::after {
  content: "→" / "";
}

.btn:hover {
  color: var(--on-cy);
  filter: brightness(1.08);
}

.btn:disabled {
  cursor: progress;
  opacity: 0.7;
}

.btn--secondary {
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--ink);
  font-weight: 500;
  box-shadow: none;
}

.btn--secondary::after {
  content: none;
}

.btn--secondary:hover {
  border-color: var(--cy);
  color: var(--ink);
  filter: none;
}

.btn__code {
  color: var(--cy-ink);
  font-family: var(--font-mono);
  font-size: 13px;
}

.btn--sm {
  min-height: 38px;
  padding: 0 16px;
  border-radius: var(--r-ctl);
  font-size: 14px;
  box-shadow: none;
}

.btn--sm::after {
  content: none;
}

.btn--lg {
  min-height: 56px;
  padding: 0 28px;
  border-radius: calc(var(--r-btn) + 1px);
  font-size: 17px;
}

@media (max-width: 600px) {
  .btn--lg {
    display: flex;
    width: 100%;
    padding: 12px 24px;
    white-space: normal;
  }
}

.link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--ink);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: var(--cy);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 5px;
}

.link:hover {
  color: var(--cy-ink);
}

/* ---------------------------------------------------------------------------------------------
   8. Componentes partilhados do handoff: etiqueta, chip, badge, cartão, estado
   --------------------------------------------------------------------------------------------- */
/* «// processo»: etiqueta de secção */
.eyebrow {
  display: block;
  color: var(--cy-ink);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  line-height: 1.5;
  font-weight: 400;
  letter-spacing: 0;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  line-height: 1.5;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  line-height: 1.5;
}

.badge::before {
  content: "";
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cy);
  box-shadow: 0 0 10px var(--cy-glow);
}

.card {
  position: relative;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface);
}

.card :where(p) {
  font-size: var(--fs-small);
  color: var(--text);
}

/* Cartão com barra de estado no topo, com brilho. A cor do estado é --signal (ciano por omissão;
   .card--rejected = vermelho); os textos do cartão que levam a cor do estado usam var(--signal). */
.card--signal {
  --signal: var(--cy-ink);
  overflow: hidden;
}

.card--signal::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--signal);
  box-shadow: 0 0 18px var(--signal);
}

.card--rejected {
  --signal: var(--red);
}

/* Estado em linha: mono 12/700 maiúsculo com um ponto antes. Os glifos antigos (svg) escondem-se. */
.status {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  color: var(--cy-ink);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  line-height: 1.5;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.status::before {
  content: "";
  flex: none;
  align-self: center;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.status__glyph {
  display: none;
}

/* Um estado escrito para o carimbo em duas linhas (fr: «En cours de / vérification») fica numa linha só */
.status .stamp__line2 {
  display: inline;
  margin: 0;
  font-size: inherit;
  letter-spacing: inherit;
}

.status .stamp__line2 + .stamp__line2::before {
  content: " ";
}

.status--approved,
.status--partial {
  color: var(--cy-ink);
}

.status--review,
.status--on-counter.status--review {
  color: var(--muted);
}

.status--rejected {
  color: var(--red);
}

/* ---------------------------------------------------------------------------------------------
   11. O talão (papel térmico, claro nos dois temas). Três camadas: .receipt (posição, rotação;
       pinos e carimbo vivem aqui) > .receipt__shadow (sombra) > .receipt__paper (o papel).
   --------------------------------------------------------------------------------------------- */
.receipt {
  --receipt-w: 302px;
  position: relative;
  width: min(var(--receipt-w), 100%);
  margin-inline: auto;
  transform: rotate(var(--receipt-tilt, 0deg));
}

.receipt--tilt {
  --receipt-tilt: -0.6deg;
}

.receipt__shadow {
  filter: var(--shadow-low);
}

.receipt--hero .receipt__shadow {
  filter: var(--shadow-high);
}

.receipt__paper {
  --tooth: 12px;
  --depth: 4px;
  position: relative;
  overflow: hidden;
  padding: 26px 18px 22px;
  background: var(--paper-shade);
  color: var(--print-ink);
  font-family: var(--font-print);
  font-size: 11px;
  line-height: 19px;
  font-weight: 400;
  white-space: nowrap;
}

.receipt__store {
  text-align: center;
  font-size: 12px;
  font-weight: 700;
}

.receipt__c {
  text-align: center;
}

.receipt__faded {
  color: var(--print-faded);
}

.receipt__row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.receipt__qty {
  display: inline-block;
  width: 22px;
}

.receipt__indent {
  padding-left: 22px;
}

.receipt__total {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 13.5px;
  line-height: 22px;
  font-weight: 700;
}

.receipt__rule {
  margin: 8px 0;
  border-top: 1px dashed var(--print-perf);
}

.receipt__space {
  height: 10px;
}

.receipt__space--sm {
  height: 6px;
}

.receipt__space--lg {
  height: 14px;
}

.receipt__vat {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  color: var(--print-faded);
}

.receipt__vat > :nth-child(3n + 2) {
  text-align: center;
}

.receipt__vat > :nth-child(3n) {
  text-align: right;
}

.receipt__qr {
  display: flex;
  justify-content: center;
}

.receipt__qr img {
  width: 108px;
  height: 108px;
}

/* Faixa de linha lida: ciano suave atrás do texto. Nunca à volta de uma linha desbotada. */
.receipt__band {
  position: relative;
  z-index: 0;
}

.receipt__band::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -3px -10px;
  background: var(--print-band);
}

.receipt__band--qr::before {
  inset: -4px -10px;
}

/* Carimbo sobre o talão: posição pela página (--stamp-x, --stamp-y) a partir do canto do talão */
.receipt__stamp {
  position: absolute;
  z-index: 2;
  left: var(--stamp-x, 0px);
  top: var(--stamp-y, 0px);
  width: max-content;
}

.receipt__stamp--center {
  left: 50%;
  translate: -50% 0;
}

div.receipt__stamp {
  display: flex;
}

/* ---------------------------------------------------------------------------------------------
   14. Folha (tabelas, formulário, texto longo): um cartão do tema. .paper faz dela papel impresso.
   --------------------------------------------------------------------------------------------- */
.sheet {
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface);
}

.sheet.paper {
  border: 0;
  border-radius: 3px;
  background: var(--paper);
  box-shadow: var(--shadow-low-box);
}

.sheet--pad {
  padding: clamp(20px, 1rem + 1.6vw, 36px);
}

/* ---------------------------------------------------------------------------------------------
   15. Tabela (com <caption> visível e th scope)
   --------------------------------------------------------------------------------------------- */
.table {
  width: 100%;
  border-collapse: collapse;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.table caption {
  caption-side: top;
  padding: 0 0 16px;
  text-align: left;
  font-size: 17px;
  line-height: 1.4;
  font-weight: 600;
  color: var(--ink);
}

.table th,
.table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.table td {
  color: var(--text);
}

.table thead th {
  padding-block: 10px;
  border-bottom: 1px solid var(--line-2);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  font-weight: 400;
}

.table tbody th {
  font-weight: 600;
}

.table :is(th, td):first-child {
  padding-left: 0;
}

.table :is(th, td):last-child {
  padding-right: 0;
}

.table tbody tr:last-child > * {
  border-bottom: 0;
}

.table .num {
  text-align: right;
}

@media (max-width: 600px) {
  .table--stack thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .table--stack tr {
    display: block;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
  }

  .table--stack tbody tr:last-child {
    border-bottom: 0;
  }

  .table--stack th,
  .table--stack td {
    display: block;
    padding: 0;
    border: 0;
  }

  .table--stack td + td,
  .table--stack th + td {
    margin-top: 8px;
  }

  .table--stack td[data-label]::before {
    content: attr(data-label);
    display: block;
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: var(--fs-label);
  }

  .table--stack .num {
    text-align: left;
  }
}

@media (max-width: 900px) {
  .table--stack-md thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .table--stack-md tr {
    display: block;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
  }

  .table--stack-md tbody tr:last-child {
    border-bottom: 0;
  }

  .table--stack-md th,
  .table--stack-md td {
    display: block;
    padding: 0;
    border: 0;
  }

  .table--stack-md td + td,
  .table--stack-md th + td {
    margin-top: 8px;
  }

  .table--stack-md td[data-label]::before {
    content: attr(data-label);
    display: block;
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: var(--fs-label);
  }

  .table--stack-md .num {
    text-align: left;
  }
}

/* ---------------------------------------------------------------------------------------------
   17. Campos de formulário e mensagens
   --------------------------------------------------------------------------------------------- */
.field__label {
  display: block;
  color: var(--ink);
  font-weight: 600;
}

.field__optional {
  color: var(--muted);
  font-weight: 400;
}

.field__help {
  margin-top: 4px;
  color: var(--text);
  font-size: var(--fs-small);
}

.field__input {
  display: block;
  width: 100%;
  height: 48px;
  margin: 8px 0 0;
  padding: 0 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-ctl);
  background: var(--bg-2);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
}

.field__input:hover {
  border-color: var(--muted);
}

.field__input:focus-visible {
  border-color: var(--cy);
  outline-offset: 1px;
}

textarea.field__input {
  height: auto;
  min-height: 144px;
  padding: 12px 14px;
  resize: vertical;
}

select.field__input {
  padding-right: 36px;
}

.field__input[aria-invalid="true"] {
  border: 2px solid var(--red);
  padding-inline: 13px;
}

.field__error {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 8px;
  color: var(--red);
  font-weight: 600;
}

.field__error[hidden] {
  display: none;
}

.field__error-icon {
  flex: none;
  width: 20px;
  height: 20px;
  margin-top: 2px;
}

.fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.fieldset__legend {
  padding: 0;
  color: var(--ink);
  font-weight: 600;
}

.check {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  color: var(--ink);
  cursor: pointer;
}

.check--top {
  align-items: flex-start;
}

.check__input {
  flex: none;
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--cy);
}

.check--top .check__input {
  margin-top: 2px;
}

/* A mensagem que site.js mostra no lugar do envio (nunca finge que enviou) */
.notice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--cy);
  border-radius: var(--r-ctl);
  background: var(--cy-soft);
  color: var(--ink);
}

.notice[hidden] {
  display: none;
}

.notice:focus {
  outline: none;
}

.notice:focus-visible {
  outline: 2px solid var(--cy);
  outline-offset: 3px;
}

.notice__icon {
  flex: none;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  color: var(--cy-ink);
}

/* =============================================================================================
   P. Portal do cliente — só daqui para baixo é do portal. Só tokens (nenhuma cor solta), nada de
      transições nem animações, os pontos de quebra do site (900 px e 600 px).
   ============================================================================================= */

/* ---------------------------------------------------------------------------------------------
   P1. A moldura: o conteúdo, o cabeçalho (marca, «portal do cliente», língua, tema, «Sair») e os
       componentes do site que o portal usa dentro de outros (etiqueta num cartão, estados)
   --------------------------------------------------------------------------------------------- */
.portal-main {
  display: flex;
  flex: 1 0 auto;
  flex-direction: column;
}

.portal-main:focus {
  outline: none;
}

/* «portal do cliente» ao lado do nome, dentro da ligação da marca */
.portal-header__chip {
  white-space: nowrap;
}

/* A língua (oito): no cabeçalho um <details> com o código da língua atual (PT, FR…) e, dentro, um formulário (POST com
   antiforgery) com um botão por língua, o nome nela própria; no menu do telemóvel (páginas Blazor) o mesmo formulário sem o
   <details>, a grelha dos códigos. O botão da língua atual tem aria-pressed. */
.portal-lang {
  position: relative;
  margin: 0;
}

.portal-lang__summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 10px 0 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-ctl);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  font-weight: 700;
  line-height: 1;
  list-style: none;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

.portal-lang__summary::-webkit-details-marker {
  display: none;
}

.portal-lang__summary::after {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  margin-top: -3px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
}

.portal-lang__summary:hover,
.portal-lang[open] .portal-lang__summary {
  border-color: var(--cy);
}

.portal-lang__panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  width: max-content;
  min-width: 180px;
  max-width: min(280px, calc(100vw - 2 * var(--gutter)));
  padding: 6px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-ctl);
  background: var(--surface);
  box-shadow: var(--shadow-menu);
}

.portal-lang__form {
  margin: 0;
}

.portal-lang__group {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-ctl);
}

/* Dentro do <details>: uma lista, cada língua com o nome inteiro */
.portal-lang__form--list .portal-lang__group {
  display: grid;
  padding: 0;
  border: 0;
}

.portal-lang__form--list .portal-lang__btn {
  justify-content: flex-start;
  width: 100%;
  min-height: 40px;
  padding: 0 10px;
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 14px;
}

.portal-lang__form--list .portal-lang__btn:hover {
  background: var(--surface-2);
}

/* A língua atual na lista: o fundo do painel já é --surface (o do botão carregado) e o contorno --line ficava a 1,15:1 — uma barra
   --cy-ink (≥ 3:1 nos dois temas; o --cy claro dava 2,4:1). Depois do «hover», para a barra ficar ao passar o rato */
.portal-lang__form--list .portal-lang__btn[aria-pressed="true"] {
  background: var(--cy-soft);
  box-shadow: inset 3px 0 0 var(--cy-ink);
}

/* No menu: os oito códigos numa grelha de quatro colunas */
.portal-lang--menu .portal-lang__group {
  display: grid;
  grid-template-columns: repeat(4, minmax(34px, 1fr));
}

.portal-lang__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  min-height: 30px;
  margin: 0;
  padding: 0 8px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  line-height: 1;
  cursor: pointer;
}

.portal-lang__btn:hover {
  color: var(--ink);
}

.portal-lang__btn[aria-pressed="true"] {
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
  box-shadow: inset 0 0 0 1px var(--line);
}

/* «Sair»: um formulário (POST com antiforgery). No telemóvel fica só o ícone (o nome continua para o leitor de ecrã). */
.portal-logout {
  margin: 0;
}

.portal-logout__icon {
  display: none;
  flex: none;
  width: 18px;
  height: 18px;
}

/* Uma etiqueta «// palavra» dentro de um cartão: o .card :where(p) do site não lhe muda o tipo nem a cor */
.card .eyebrow {
  color: var(--cy-ink);
  font-size: var(--fs-label);
}

/* Estados (§10.4): a forma do ponto também diz o estado, nunca só a cor. Aprovado parcialmente: meio ponto. */
.status--partial::before {
  background: linear-gradient(90deg, currentColor 50%, transparent 50%);
  box-shadow: inset 0 0 0 1.5px currentColor;
}

/* O símbolo da marca em grande (os pontos 0000 / 0001 / 1010 / 0100): decorativo, só os pontos acesos brilham */
.portal-mark {
  --mark-dot: 10px;
  --mark-gap: 7px;
  display: grid;
  flex: none;
  grid-template-columns: repeat(4, var(--mark-dot));
  gap: var(--mark-gap);
}

.portal-mark i {
  width: var(--mark-dot);
  height: var(--mark-dot);
  border-radius: 50%;
  background: var(--mk-off);
}

.portal-mark i.on {
  background: var(--mk-on);
  box-shadow: 0 0 14px var(--cy-glow);
}

/* ≤ 900 px: alvos de toque de 44 px (o botão do tema do site já passa a 44; «Sair» no cabeçalho das páginas MVC era 38) */
@media (max-width: 900px) {
  .portal-lang__group {
    padding: 0;
  }

  .portal-lang__summary,
  .portal-lang__btn {
    min-width: 44px;
    min-height: 44px;
  }

  /* A lista do <details> (as páginas MVC, que a mostram até 900 px): 40 px no computador, 44 no toque */
  .portal-lang__form--list .portal-lang__btn {
    min-height: 44px;
  }

  .portal-logout__btn {
    min-height: 44px;
  }
}

/* ≤ 600 px: a marca, a língua, o tema e «Sair» numa linha de 360 px — a etiqueta sai e «Sair» fica só com o ícone */
@media (max-width: 600px) {
  .portal-header__chip {
    display: none;
  }

  .portal-logout__btn {
    width: 44px;
    min-height: 44px;
    padding: 0;
  }

  .portal-logout__icon {
    display: block;
  }

  .portal-logout__label {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

/* ---------------------------------------------------------------------------------------------
   P2. Entrar e definir a palavra-passe: a ilha escura (pontos e brilho, como o bloco CTA do site)
       e o cartão com o h1. ≥ 901 px: duas colunas; ≤ 900 px: só o cartão (a ilha não aparece, por
       isso o único h1 da página está sempre no cartão).
   --------------------------------------------------------------------------------------------- */
.portal-auth-page {
  display: flex;
  flex: 1 0 auto;
  flex-direction: column;
}

.portal-auth {
  display: grid;
  flex: 1 0 auto;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
  gap: var(--col-gap);
  padding-block: clamp(24px, 1rem + 2vw, 48px);
}

/* A ilha: sempre escura (.theme-dark repõe os tokens do escuro, também no tema claro) */
.portal-hero {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: var(--sp-6);
  min-height: 520px;
  padding: clamp(32px, 1rem + 2.6vw, 56px);
  overflow: hidden;
  border: 1px solid var(--line-2);
  border-radius: var(--r-panel);
  background-color: var(--cta-bg);
  background-image:
    radial-gradient(circle at 88% 10%, var(--cta-glow), transparent 46%),
    radial-gradient(circle, var(--cta-dot) 1.2px, transparent 1.6px);
  background-size: 100% 100%, 22px 22px;
  color: var(--ink);
}

.portal-hero__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-4);
}

.portal-hero__body {
  align-self: center;
}

/* A frase grande (um <p>: o h1 da página é o título do cartão) — a escala do título do bloco CTA do site */
.portal-hero__title {
  font-size: var(--fs-highlight);
  line-height: var(--lh-highlight);
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--ink);
  text-wrap: balance;
}

.portal-hero__title .accent {
  display: block;
}

.portal-hero__lead {
  max-width: 40ch;
  margin-top: var(--sp-5);
  color: var(--text);
  font-size: var(--fs-lead);
  line-height: var(--lh-lead);
  text-wrap: pretty;
}

/* Os estados que o cliente vai ver (estáticos): a mesma etiqueta e o mesmo ponto das páginas do portal */
.portal-hero__states {
  display: grid;
  grid-template-columns: repeat(2, max-content);
  gap: 14px 32px;
  margin: 0;
  padding-top: var(--sp-5);
  border-top: 1px solid var(--line-2);
}

.portal-auth__panel {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

.portal-auth__card {
  width: min(100%, 440px);
  padding: clamp(24px, 1rem + 1.6vw, 40px);
  border-radius: var(--r-panel);
  box-shadow: var(--shadow-panel);
}

.portal-auth__title {
  margin-top: var(--sp-2);
  font-size: var(--fs-app-title);
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.portal-auth__lead {
  margin-top: var(--sp-3);
  color: var(--text);
  font-size: var(--fs-body);
  text-wrap: pretty;
}

.portal-auth__card .notice {
  margin-top: var(--sp-5);
}

.portal-auth__actions {
  margin-top: var(--sp-6);
}

/* Os campos: um por linha, o erro por cima do botão (como no esquema), o botão a toda a largura */
.portal-form {
  display: grid;
  gap: var(--sp-5);
  margin-top: var(--sp-6);
}

.portal-form .check {
  margin-top: calc(-1 * var(--sp-3));
}

.portal-form .field__error {
  margin-top: 0;
}

.portal-form__messages {
  display: grid;
  gap: 2px;
}

.portal-form .btn {
  width: 100%;
}

.portal-auth__help {
  margin-top: var(--sp-5);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--line);
  color: var(--text);
  font-size: var(--fs-small);
  text-wrap: pretty;
}

@media (max-width: 900px) {
  /* Sem a ilha: os pontos e o brilho da marca passam para o fundo da página */
  .portal-auth-page {
    background-image:
      radial-gradient(circle at 75% 15%, var(--cy-soft), transparent 55%),
      radial-gradient(circle, var(--dot) 1.2px, transparent 1.6px);
    background-size: 100% 100%, 22px 22px;
  }

  .portal-auth {
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
  }

  .portal-hero {
    display: none;
  }
}

@media (max-width: 600px) {
  .portal-auth__card {
    padding: 24px 20px;
  }
}

/* ---------------------------------------------------------------------------------------------
   P3. A página com sessão (mudar a palavra-passe) e o «não encontrado»: o .page-intro do site,
       compacto, com o h1 da aplicação
   --------------------------------------------------------------------------------------------- */
.portal-intro {
  padding-block: clamp(32px, 1.5rem + 3vw, 64px);
}

.portal-intro__title {
  margin-top: var(--sp-2);
  font-size: var(--fs-app-title);
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.portal-intro__lead {
  margin-top: var(--sp-4);
}

.portal-intro__actions {
  margin-top: var(--sp-6);
}

/* O «não encontrado» enche a página até ao rodapé (e a linha do rodapé chega) */
.portal-intro--fill {
  display: flex;
  flex: 1 0 auto;
  align-items: center;
  border-bottom: 0;
}

.portal-back {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-bottom: var(--sp-2);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}

.portal-back:hover {
  color: var(--ink);
}

.portal-section {
  padding-block: var(--sp-7) var(--space-section-tight);
}

.portal-panel {
  width: min(100%, 520px);
  padding: clamp(24px, 1rem + 1.6vw, 40px);
}

.portal-panel .portal-form {
  margin-top: 0;
}

.portal-panel .notice {
  margin-bottom: var(--sp-5);
}

/* ---------------------------------------------------------------------------------------------
   P4. A moldura das páginas Blazor: a navegação ao lado da marca, a conta, o menu do telemóvel, a
       faixa da pré-visualização, o «sem acesso», o rodapé, a ligação caída e o erro do circuito
   --------------------------------------------------------------------------------------------- */
.portal-header .brand {
  margin-right: 0;
}

.portal-nav {
  margin-right: auto;
  margin-left: var(--sp-5);
}

/* Sem navegação (sem acesso, sem tenant): as ferramentas vão para a direita */
.portal-header .site-header__tools {
  margin-left: auto;
}

.portal-nav .site-nav__link[aria-current="page"] {
  color: var(--ink);
}

/* A conta: um <details> nativo (o portal.js fecha-o ao clicar fora e com Esc) */
.portal-account {
  position: relative;
}

.portal-account__button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  max-width: 240px;
  padding: 0 12px 0 10px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-ctl);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  list-style: none;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

.portal-account__button::-webkit-details-marker {
  display: none;
}

.portal-account__button::after {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  margin: -3px 0 0 2px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
}

.portal-account__button:hover,
.portal-account[open] .portal-account__button {
  border-color: var(--cy);
}

.portal-account__icon {
  flex: none;
  width: 18px;
  height: 18px;
  color: var(--muted);
}

.portal-account__email {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portal-account__panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  display: grid;
  gap: 4px;
  width: max-content;
  min-width: 240px;
  max-width: min(320px, calc(100vw - 2 * var(--gutter)));
  padding: 8px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-ctl);
  background: var(--surface);
  box-shadow: var(--shadow-menu);
}

.portal-account__who {
  overflow: hidden;
  padding: 6px 10px 8px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portal-account__link {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 0 10px;
  border-radius: var(--r-sm);
  color: var(--ink);
  font-size: 14px;
  text-decoration: none;
}

.portal-account__link:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.portal-account__logout .portal-logout__btn {
  width: 100%;
  justify-content: flex-start;
}

/* O menu do telemóvel (até 900 px): a navegação, a língua e a conta */
.portal-menu__list {
  margin: 0;
}

.portal-menu__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  min-height: 60px;
  border-bottom: 1px solid var(--line);
}

.portal-menu__account {
  padding-top: 16px;
}

.portal-menu__who {
  overflow: hidden;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portal-menu__logout {
  margin-top: 20px;
}

.portal-menu__logout .portal-logout__btn {
  width: 100%;
  min-height: 48px;
}

@media (min-width: 901px) {
  .portal-menu {
    display: none;
  }
}

/* Até 900 px a língua do cabeçalho Blazor vai para o menu (a cópia do menu fica); a das páginas MVC (login, palavra-passe,
   404), que não têm menu, fica sempre no cabeçalho */
@media (max-width: 900px) {
  .portal-header .brand {
    margin-right: auto;
  }

  .portal-nav,
  .portal-account,
  .portal-lang--bar {
    display: none;
  }
}

/* No telemóvel o «Sair» do menu volta a ter o nome (só o do cabeçalho do login fica com o ícone) */
@media (max-width: 600px) {
  .portal-menu .portal-logout__btn {
    width: 100%;
    padding: 0 16px;
  }

  .portal-menu .portal-logout__icon {
    display: none;
  }

  .portal-menu .portal-logout__label {
    position: static;
    width: auto;
    height: auto;
    margin: 0;
    overflow: visible;
    clip: auto;
    clip-path: none;
    white-space: normal;
  }
}

/* A faixa da pré-visualização do SuperAdmin: o que o cliente vê */
.portal-preview {
  border-bottom: 1px solid var(--line);
  background: var(--cy-soft);
  color: var(--cy-ink);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
}

.portal-preview__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 24px;
  min-height: 40px;
  padding-block: 6px;
}

.portal-preview__link {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  color: var(--cy-ink);
  text-decoration: underline;
  text-decoration-color: currentColor;
}

.portal-preview__link:hover {
  color: var(--ink);
}

/* Sem acesso / sem tenant: um bloco só, a meio da página */
.portal-blocked {
  max-width: 760px;
}

.portal-denied__text {
  margin-top: var(--sp-4);
}

.portal-denied__logout {
  margin-top: var(--sp-6);
}

.portal-denied__logout .portal-logout__btn {
  min-height: 44px;
}

.portal-intro__title--sentence {
  font-size: var(--fs-app-h2);
  line-height: 1.3;
  letter-spacing: -0.02em;
}

/* A ligação ao servidor caiu: um aviso em baixo, a meio (as classes vêm do blazor.web.js) */
.portal-reconnect {
  display: none;
}

.portal-reconnect.components-reconnect-show,
.portal-reconnect.components-reconnect-retrying,
.portal-reconnect.components-reconnect-paused,
.portal-reconnect.components-reconnect-failed,
.portal-reconnect.components-reconnect-rejected,
.portal-reconnect.components-reconnect-resume-failed {
  position: fixed;
  z-index: 70;
  right: var(--gutter);
  bottom: calc(var(--gutter) + env(safe-area-inset-bottom));
  left: var(--gutter);
  display: flex;
  justify-content: center;
  pointer-events: none;
}

.portal-reconnect__box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  max-width: 560px;
  padding: 14px 16px 14px 20px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-card);
  background: var(--surface);
  box-shadow: var(--shadow-menu);
  color: var(--ink);
  font-size: var(--fs-small);
  pointer-events: auto;
}

.portal-reconnect__text {
  flex: 1 1 220px;
}

.portal-reconnect__text--failed,
.components-reconnect-failed .portal-reconnect__text--lost,
.components-reconnect-rejected .portal-reconnect__text--lost,
.components-reconnect-resume-failed .portal-reconnect__text--lost {
  display: none;
}

.components-reconnect-failed .portal-reconnect__text--failed,
.components-reconnect-rejected .portal-reconnect__text--failed,
.components-reconnect-resume-failed .portal-reconnect__text--failed {
  display: block;
}

/* Um erro do circuito (D39): escondido; o blazor.web.js mostra-o (display: block) — uma faixa em baixo */
.portal-error-ui {
  display: none;
  position: fixed;
  z-index: 80;
  right: 0;
  bottom: 0;
  left: 0;
  padding-bottom: env(safe-area-inset-bottom);
  border-top: 1px solid var(--red);
  background: var(--surface);
  box-shadow: var(--shadow-menu);
  color: var(--ink);
}

.portal-error-ui__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  padding-block: 12px;
}

.portal-error-ui__text {
  font-weight: 500;
}

/* A carregar: blocos quietos (sem movimento), do tamanho do que vem */
.portal-loading {
  display: grid;
  gap: var(--sp-5);
  padding-block: var(--sp-7);
}

.portal-skeleton {
  border-radius: var(--r-card);
  background: var(--bg-2);
}

.portal-skeleton--title {
  width: min(100%, 420px);
  height: 48px;
}

.portal-skeleton--tiles {
  height: 132px;
}

.portal-skeleton--block {
  height: 320px;
}

.portal-skeleton--window {
  height: 560px;
  border-radius: var(--r-panel);
}

/* ---------------------------------------------------------------------------------------------
   P5. O topo de cada página (o .page-intro do site, compacto), o estado «ao vivo» e os filtros em
       chips (o período; os estados com as contagens)
   --------------------------------------------------------------------------------------------- */
.portal-page {
  padding-block: var(--sp-6) var(--space-section-tight);
}

.portal-intro__top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
}

.portal-intro .portal-chips {
  margin-top: var(--sp-5);
}

.portal-intro--dash .portal-intro__title,
.portal-intro--receipt .portal-intro__title {
  margin-top: var(--sp-3);
}

/* Um talão: o topo mais baixo (a janela da decisão é o que interessa) */
.portal-intro--receipt {
  padding-block: clamp(24px, 1rem + 1.6vw, 44px);
}

/* «ao vivo · atualizado às 14:03»: o .badge do site (o ponto ciano com brilho, quieto) */
.portal-live {
  white-space: nowrap;
}

.portal-live__error {
  margin-top: var(--sp-3);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
}

.portal-chips__list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
}

.portal-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
}

.portal-chip:hover {
  border-color: var(--muted);
  color: var(--ink);
}

.portal-chip[aria-current="true"] {
  border-color: var(--cy);
  background: var(--cy-soft);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--cy);
}

/* Os estados da lista: o ponto do estado (a mesma forma das etiquetas) e a contagem */
.portal-chip__label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.portal-chip--approved .portal-chip__label::before,
.portal-chip--review .portal-chip__label::before,
.portal-chip--rejected .portal-chip__label::before,
.portal-chip--contested .portal-chip__label::before {
  content: "";
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--chart-approved);
}

.portal-chip--review .portal-chip__label::before {
  background: var(--chart-review);
}

.portal-chip--rejected .portal-chip__label::before {
  background: var(--chart-rejected);
}

.portal-chip--contested .portal-chip__label::before {
  background: transparent;
  box-shadow: inset 0 0 0 1.5px var(--status-contested);
}

.portal-chip__count {
  color: var(--ink);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.portal-muted {
  color: var(--text);
  font-size: var(--fs-small);
}

/* Até 600 px os chips do período ficam numa só linha que desliza (a página nunca desliza para o lado) */
@media (max-width: 600px) {
  .portal-chips--period {
    margin-inline: calc(-1 * var(--gutter));
    overflow-x: auto;
    scrollbar-width: none;
  }

  .portal-chips--period::-webkit-scrollbar {
    display: none;
  }

  .portal-chips--period .portal-chips__list {
    flex-wrap: nowrap;
    width: max-content;
    padding-inline: var(--gutter);
  }
}

/* ---------------------------------------------------------------------------------------------
   P6. O painel: os mosaicos (.card--signal), a barra de proporção, o gráfico, as listas com barras
       e os cartões das secções
   --------------------------------------------------------------------------------------------- */
.portal-dash {
  display: grid;
  gap: var(--sp-5);
}

.portal-kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--sp-4);
}

.portal-kpi {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding: 20px 20px 18px;
  color: var(--ink);
  text-decoration: none;
}

.portal-kpi:hover {
  border-color: var(--line-2);
  color: var(--ink);
}

.portal-kpi__label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* O ponto da etiqueta tem a forma do estado (cheio; anel no contestado); «Recebidos» não tem */
.portal-kpi__label::before {
  content: "";
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--signal);
}

.portal-kpi--neutral .portal-kpi__label::before {
  display: none;
}

.portal-kpi--contested .portal-kpi__label::before {
  background: transparent;
  box-shadow: inset 0 0 0 1.5px var(--signal);
}

.portal-kpi__value {
  margin-top: 6px;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: var(--fs-kpi);
  line-height: 1.05;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.portal-kpi__sub {
  min-height: 1.45em;
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
}

/* D38: as cores dos estados com ≥ 3:1; só o ciano e o vermelho brilham */
.portal-kpi--neutral {
  --signal: var(--ink);
}

.portal-kpi--approved {
  --signal: var(--chart-approved);
}

.portal-kpi--review {
  --signal: var(--chart-review);
}

.portal-kpi--rejected {
  --signal: var(--chart-rejected);
}

.portal-kpi--contested {
  --signal: var(--status-contested);
}

.portal-kpi--neutral::before,
.portal-kpi--review::before {
  box-shadow: none;
}

.portal-kpi--contested::before {
  height: 3px;
  background: var(--hatch-contested);
  box-shadow: none;
}

/* A barra de proporção: aprovados | em revisão | rejeitados | contestados, 2 px entre os segmentos */
.portal-split {
  display: grid;
  gap: 14px;
}

.portal-split__bar {
  display: flex;
  gap: 2px;
  height: 10px;
  overflow: hidden;
  border-radius: var(--r-pill);
}

.portal-split__seg {
  flex-basis: 0;
  min-width: 4px;
}

.portal-split__seg--approved {
  background: var(--chart-approved);
}

.portal-split__seg--review {
  background: var(--chart-review);
}

.portal-split__seg--rejected {
  background: var(--chart-rejected);
}

/* Com poucos contestados, 4 px de tracejado pareciam um defeito: pelo menos 10 px */
.portal-split__seg--contested {
  min-width: 10px;
  background: var(--hatch-contested);
  box-shadow: inset 0 0 0 1px var(--ink);
}

.portal-split__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 28px;
  margin: 0;
}

.portal-split__item {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
}

.portal-split__count {
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Os cartões das secções do painel: «// etiqueta» (o h2) e o conteúdo */
.portal-card {
  min-width: 0;
  padding: clamp(20px, 1rem + 0.8vw, 28px);
}

.portal-card__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 24px;
  margin-bottom: var(--sp-5);
}

.portal-card__title {
  margin-top: 4px;
  font-size: var(--fs-app-h2);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

h2.portal-card__label {
  margin-bottom: var(--sp-4);
}

.portal-card__more {
  margin-top: var(--sp-3);
}

.portal-more::after {
  content: "→" / "";
  margin-left: 8px;
}

.portal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-5);
  align-items: start;
}

/* A legenda do gráfico: um quadrado de cada cor */
.portal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin: 0;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
}

.portal-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.portal-legend__item::before {
  content: "";
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--chart-approved);
}

.portal-legend__item--review::before {
  background: var(--chart-review);
}

.portal-legend__item--rejected::before {
  background: var(--chart-rejected);
}

/* O gráfico: o eixo (HTML) | as colunas (SVG, estica na largura) e as datas (HTML) por baixo */
.portal-chart {
  margin: 0;
}

.portal-chart__plot {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 10px;
}

.portal-chart__plot--narrow {
  display: none;
}

.portal-chart__axis {
  position: relative;
  min-width: 2.2em;
  height: 180px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.portal-chart__tick {
  position: absolute;
  right: 0;
  translate: 0 -50%;
}

.portal-chart__svg {
  width: 100%;
  height: 180px;
  overflow: visible;
}

.portal-chart__grid {
  stroke: var(--line);
  stroke-width: 1;
}

.portal-chart__base {
  stroke: var(--line-2);
  stroke-width: 1;
}

.portal-chart__hit {
  fill: transparent;
}

.portal-chart__col:hover .portal-chart__hit {
  fill: var(--cy-soft);
}

/* Um contorno da cor do cartão separa os segmentos de cada coluna (aprovados, em revisão e rejeitados tocavam-se) */
.portal-chart__bar {
  stroke: var(--surface);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.portal-chart__bar--approved {
  fill: var(--chart-approved);
}

.portal-chart__bar--review {
  fill: var(--chart-review);
}

.portal-chart__bar--rejected {
  fill: var(--chart-rejected);
}

.portal-chart__zero {
  fill: var(--line-2);
}

.portal-chart__today {
  fill: none;
  stroke: var(--cy-ink);
  stroke-width: 1;
}

.portal-chart__labels {
  display: grid;
  grid-column: 2;
  margin-top: 8px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.2;
}

.portal-chart__label {
  grid-row: 1;
  justify-self: center;
  white-space: nowrap;
}

/* As listas com barras (a do relatório do site): o nome e o número, a barra de 6 px por baixo */
.portal-bars {
  display: grid;
  gap: 14px;
  margin: 0;
}

.portal-bars__item {
  --fill: var(--chart-approved);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  column-gap: 16px;
  row-gap: 6px;
}

.portal-bars--rejected .portal-bars__item {
  --fill: var(--chart-rejected);
}

.portal-bars__item::after {
  content: "";
  grid-column: 1 / -1;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(var(--fill), var(--fill)) 0 0 / var(--w, 0%) 100% no-repeat, var(--line);
}

.portal-bars__label {
  min-width: 0;
  color: var(--ink);
  font-size: var(--fs-small);
  line-height: 1.35;
}

.portal-bars__num {
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.portal-bars__sub {
  grid-column: 1 / -1;
  grid-row: 3;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
}

/* Os últimos talões, compactos, dentro do cartão (sem a moldura nem as margens da folha: a tabela alinha com o título do
   cartão). Dois nomes de classe: ganha às margens de .portal-rows, que vêm depois e também no telemóvel. */
.portal-rows.portal-rows--compact {
  padding: 0;
  border: 0;
  background: none;
}

.portal-rows--compact .portal-rows__table {
  margin-top: -10px;
}

@media (max-width: 1100px) {
  .portal-kpis {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .portal-kpi {
    grid-column: span 2;
  }

  .portal-kpi--rejected,
  .portal-kpi--contested {
    grid-column: span 3;
  }
}

@media (max-width: 900px) {
  .portal-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 600px) {
  .portal-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .portal-kpi,
  .portal-kpi--rejected,
  .portal-kpi--contested {
    grid-column: auto;
    padding: 16px 14px 14px;
  }

  /* «Recebidos» a toda a largura, depois Aprovados | Rejeitados e Em revisão | Contestados */
  .portal-kpi--neutral {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    order: 0;
  }

  .portal-kpi--neutral .portal-kpi__value {
    grid-row: 1;
    grid-column: 2;
    margin-top: 0;
  }

  .portal-kpi--neutral .portal-kpi__sub {
    display: none;
  }

  .portal-kpi--approved {
    order: 1;
  }

  .portal-kpi--rejected {
    order: 2;
  }

  .portal-kpi--review {
    order: 3;
  }

  .portal-kpi--contested {
    order: 4;
  }

  .portal-chart__plot--wide {
    display: none;
  }

  .portal-chart--narrowable .portal-chart__plot--narrow {
    display: grid;
  }

  .portal-chart:not(.portal-chart--narrowable) .portal-chart__plot--wide {
    display: grid;
  }
}

/* ---------------------------------------------------------------------------------------------
   P7. Os talões: os filtros, a tabela (a linha inteira é a ligação; no telemóvel, cartões), as
       páginas e «nenhum talão com estes filtros»
   --------------------------------------------------------------------------------------------- */
.portal-list {
  display: grid;
  gap: var(--sp-5);
}

.portal-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 16px;
  margin: 0;
}

.portal-filter__field {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  flex: 0 1 172px;
  min-width: 0;
}

.portal-filter__field--search {
  flex: 1 1 260px;
}

.portal-filter__label {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
}

.portal-filter__input {
  min-width: 0;
  height: 44px;
  margin: 0;
  background: var(--surface);
}

.portal-filter__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  min-height: 44px;
}

.portal-filter__apply {
  min-height: 44px;
}

.portal-filter__clear {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--text);
  font-size: 14px;
}

.portal-filter__clear:hover {
  color: var(--ink);
}

/* A tabela: na folha do site, com margens; a linha inteira leva ao talão */
.portal-rows {
  padding: 4px clamp(16px, 1rem + 0.6vw, 24px);
}

.portal-rows__row {
  position: relative;
}

.portal-rows__row:hover > td {
  background: var(--surface-2);
}

.portal-rows__when {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 13px;
  white-space: nowrap;
}

.portal-rows__ref {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
}

.portal-rows__link {
  color: var(--ink);
  text-decoration: none;
}

.portal-rows__link::after {
  content: "";
  position: absolute;
  inset: 0;
}

.portal-rows__link:hover {
  color: var(--cy-ink);
}

.portal-rows__link:focus-visible {
  outline: none;
}

.portal-rows__link:focus-visible::after {
  outline: 2px solid var(--cy);
  outline-offset: -2px;
  border-radius: var(--r-sm);
}

.portal-rows__store {
  color: var(--ink);
}

.portal-rows__total {
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 13px;
  white-space: nowrap;
}

.portal-rows__state {
  display: grid;
  justify-items: start;
  gap: 4px;
}

.portal-rows__note {
  color: var(--muted);
  font-size: 13px;
}

.portal-rows .table td,
.portal-rows .table th {
  vertical-align: middle;
}

/* As páginas */
.portal-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.portal-pager__link {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-ctl);
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}

a.portal-pager__link:hover {
  border-color: var(--cy);
  color: var(--ink);
}

span.portal-pager__link {
  border-color: var(--line);
  color: var(--muted);
}

.portal-pager__range {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  font-variant-numeric: tabular-nums;
}

.portal-nothing {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
}

.portal-nothing__text {
  color: var(--ink);
  font-size: var(--fs-body);
}

/* No telemóvel cada talão é um cartão: a referência e o estado | a loja | a data e o total */
@media (max-width: 600px) {
  .portal-rows {
    padding: 4px 16px;
  }

  .portal-rows .table--stack tr.portal-rows__row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px 12px;
    padding: 14px 0;
  }

  .portal-rows .table--stack td + td {
    margin-top: 0;
  }

  .portal-rows .table--stack td[data-label]::before {
    content: none;
  }

  .portal-rows__row > td {
    background: none;
  }

  .portal-rows__ref {
    grid-row: 1;
    grid-column: 1;
  }

  .portal-rows__status {
    grid-row: 1;
    grid-column: 2;
    text-align: right;
  }

  .portal-rows__state {
    justify-items: end;
  }

  .portal-rows__store {
    grid-row: 2;
    grid-column: 1 / -1;
    color: var(--text);
  }

  .portal-rows__when {
    grid-row: 3;
    grid-column: 1;
  }

  .portal-rows .table--stack .portal-rows__total {
    grid-row: 3;
    grid-column: 2;
    text-align: right;
  }

  .portal-rows--compact .portal-rows__when {
    grid-row: 2;
  }

  .portal-filter__field {
    flex: 1 1 calc(50% - 8px);
  }

  .portal-filter__field--search {
    flex-basis: 100%;
  }

  .portal-filter__actions {
    flex: 1 1 100%;
  }

  .portal-pager__range {
    order: -1;
    flex: 1 1 100%;
    text-align: center;
  }

  .portal-pager__link {
    flex: 1 1 0;
    justify-content: center;
  }
}

/* ---------------------------------------------------------------------------------------------
   P8. Um talão: a janela da decisão do site (brands.css, «.portal-decision*»): a barra, a fotografia
       e os factos | a decisão, os produtos e o que foi lido; o veredicto; a confiança na razão; o
       papel das linhas lidas; o histórico das contestações; a barra de baixo do telemóvel
   --------------------------------------------------------------------------------------------- */
.portal-receipt__notice {
  margin-bottom: var(--sp-5);
}

.portal-decision {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line-2);
  border-radius: var(--r-panel);
  background: var(--surface);
  box-shadow: var(--shadow-panel);
  color: var(--text);
}

.portal-decision__bar {
  display: flex;
  align-items: center;
  gap: 12px 16px;
  min-height: 52px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
}

.portal-decision__dots {
  display: flex;
  flex: none;
  gap: 6px;
}

.portal-decision__dots span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--off);
}

.portal-decision__where {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 14px;
  min-width: 0;
  margin-right: auto;
}

.portal-decision__store {
  color: var(--ink);
  font-size: var(--fs-small);
  font-weight: 600;
}

.portal-decision__ref,
.portal-decision__when {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  white-space: nowrap;
}

.portal-decision__body {
  display: grid;
  grid-template-columns: minmax(0, 340px) minmax(0, 1fr);
}

.portal-decision__col--image {
  min-width: 0;
  border-right: 1px solid var(--line);
}

/* A imagem enviada sobre a grelha de pontos pequena */
.portal-decision__image {
  padding: 24px 22px 18px;
  background-image: radial-gradient(circle, var(--dot) 1px, transparent 1.4px);
  background-size: 14px 14px;
}

.portal-decision__col--main {
  min-width: 0;
  padding: 4px 28px 8px;
}

.portal-decision__block {
  padding-block: 22px;
}

.portal-decision__block + .portal-decision__block {
  border-top: 1px solid var(--line);
}

.portal-decision__heading {
  margin-bottom: 14px;
}

.portal-decision__block--decision .status--lg {
  margin-bottom: 10px;
}

.portal-decision__disputed {
  margin-bottom: 8px;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 13px;
}

.portal-decision__reason {
  max-width: var(--measure);
  color: var(--ink);
  font-size: var(--fs-lead);
  line-height: 1.5;
  text-wrap: pretty;
}

.portal-decision__note {
  max-width: var(--measure);
  margin-top: 10px;
  padding-left: 12px;
  border-left: 2px solid var(--line-2);
  color: var(--text);
  font-size: var(--fs-small);
  text-wrap: pretty;
}

/* O veredicto: a barra do resultado (ciano aprovado, vermelho rejeitado, neutra no resto) */
.portal-decision__verdict {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 20px;
  padding: 14px 28px;
  border-top: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--ink);
}

.portal-decision__verdict--approved {
  background: var(--cy-soft);
  color: var(--cy-ink);
}

.portal-decision__verdict--rejected {
  background: var(--red-soft);
  color: var(--red);
}

.portal-decision__state {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.portal-decision__state::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.portal-decision__state--approved::before,
.portal-decision__state--partial::before,
.portal-decision__state--rejected::before {
  box-shadow: 0 0 12px currentColor;
}

.portal-decision__state--partial::before {
  background: linear-gradient(90deg, currentColor 50%, transparent 50%);
  box-shadow: inset 0 0 0 1.5px currentColor, 0 0 12px currentColor;
}

.portal-decision__state--review {
  color: var(--muted);
}

.portal-decision__state--contested {
  color: var(--status-contested);
}

.portal-decision__state--contested::before {
  background: transparent;
  box-shadow: inset 0 0 0 1.5px currentColor;
}

.portal-decision__count {
  color: var(--text);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
}

.portal-decision__verdict--rejected .portal-decision__count {
  color: var(--ink);
}

.portal-decision__action {
  margin-left: auto;
}

.portal-decision__unavailable {
  max-width: 420px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
  text-align: right;
  text-wrap: pretty;
}

/* Os factos do talão, por baixo da fotografia */
.portal-facts {
  margin: 0;
  padding: 10px 22px 18px;
  border-top: 1px solid var(--line);
}

.portal-facts > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 16px;
  padding-block: 8px;
  border-bottom: 1px dashed var(--line);
}

.portal-facts > div:last-child {
  border-bottom: 0;
}

.portal-facts dt {
  flex: none;
  color: var(--muted);
  font-size: 13px;
}

.portal-facts dd {
  min-width: 0;
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* A confiança na razão: três segmentos e «alta (99%)» */
.portal-confidence {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}

.portal-confidence__label {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
}

.portal-meter {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  font-weight: 700;
}

.portal-meter__steps {
  display: inline-flex;
  gap: 3px;
}

.portal-meter__steps i {
  width: 18px;
  height: 6px;
  border-radius: 3px;
  background: var(--meter-off);
}

.portal-meter__steps i.on {
  background: var(--meter-on);
}

/* Os produtos (o painel de decisão do site): o nome, o estado, o código, a linha do talão ou o porquê */
.portal-products {
  margin: 0;
  border-top: 1px solid var(--line-2);
}

.portal-product {
  padding-block: 12px;
  border-bottom: 1px solid var(--line);
}

.portal-product:last-child {
  border-bottom: 0;
}

.portal-product__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 16px;
}

.portal-product__name {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.35;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-wrap: pretty;
}

.portal-product__name--code {
  font-family: var(--font-mono);
  font-size: 15px;
}

.portal-product__row .status {
  flex: none;
}

.portal-product__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 14px;
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.portal-product__code {
  font-family: var(--font-mono);
  font-size: var(--fs-label);
}

.portal-product__line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 16px;
  margin-top: 6px;
}

.portal-product__print {
  min-width: 0;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--bg-2);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.portal-product__price {
  flex: none;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.portal-product__why {
  margin-top: 4px;
  color: var(--text);
  font-size: var(--fs-small);
  text-wrap: pretty;
}

/* O que foi lido: o papel térmico (claro nos dois temas, só tinta), sem rotação */
.portal-paper {
  --receipt-w: 380px;
  margin-inline: 0;
}

.portal-paper__sheet {
  padding: 22px 18px 20px;
  font-size: 12px;
  line-height: 20px;
  white-space: normal;
}

.portal-paper__lines {
  display: grid;
  gap: 4px;
  margin: 0;
}

.portal-paper__line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 12px;
  margin-inline: -8px;
  padding: 1px 8px;
}

.portal-paper__line--match {
  background: var(--print-band);
  box-shadow: inset 3px 0 var(--print-cy);
}

.portal-paper__text {
  min-width: 0;
  overflow-wrap: anywhere;
}

.portal-paper__amount {
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.portal-paper__meta,
.portal-paper__code {
  grid-column: 1 / -1;
  color: var(--print-faded);
  overflow-wrap: anywhere;
}

/* Numa linha destacada (o fundo ciano), o código e o desconto na tinta do texto: desbotados ficavam a 4,36:1 */
.portal-paper__line--match .portal-paper__code,
.portal-paper__line--match .portal-paper__meta {
  color: var(--print-text);
}

.portal-paper__total {
  margin: 0;
}

/* As contestações: uma linha do tempo, da mais recente para a mais antiga */
.portal-contests {
  margin-top: var(--sp-7);
}

.portal-contests__heading {
  margin-bottom: var(--sp-4);
}

.portal-timeline {
  position: relative;
  display: grid;
  gap: var(--sp-5);
  margin: 0;
  padding-left: 28px;
}

.portal-timeline::before {
  content: "";
  position: absolute;
  top: 6px;
  bottom: 6px;
  left: 4px;
  width: 1px;
  background: var(--line-2);
}

.portal-timeline__item {
  position: relative;
  max-width: 820px;
}

.portal-timeline__item::before {
  content: "";
  position: absolute;
  top: 6px;
  left: -28px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--bg);
  box-shadow: inset 0 0 0 1.5px var(--status-contested);
}

.portal-timeline__item--contest-accepted::before {
  box-shadow: inset 0 0 0 1.5px var(--cy-ink);
}

.portal-timeline__item--contest-refused::before {
  box-shadow: inset 0 0 0 1.5px var(--text);
}

.portal-timeline__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 14px;
}

.portal-timeline__meta {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  overflow-wrap: anywhere;
}

.portal-timeline__category {
  margin-top: 6px;
  color: var(--ink);
  font-weight: 600;
}

.portal-timeline__quote {
  margin-top: 4px;
  color: var(--text);
  font-size: 15px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.portal-timeline__reply {
  margin: 12px 0 0 16px;
  padding: 2px 0 2px 14px;
  border-left: 2px solid var(--line-2);
}

.portal-timeline__item--contest-accepted .portal-timeline__reply {
  border-left-color: var(--cy);
}

.portal-timeline__reply-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 12px;
}

.portal-timeline__reply-by {
  color: var(--cy-ink);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  font-weight: 700;
}

.portal-timeline__reply-text {
  margin-top: 4px;
  color: var(--ink);
  font-size: 15px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* A barra de baixo do telemóvel com «Contestar este talão» (só até 600 px) */
.portal-sticky-action {
  display: none;
}

/* Até 900 px: uma coluna, pela ordem do §9.4 — a decisão, a fotografia, os factos, os produtos, o que foi lido. Só até 600 px,
   o tablet abria o talão na fotografia e a decisão ficava por baixo dela. As colunas deixam de ter caixa (display: contents):
   as margens da coluna principal passam para os blocos. */
@media (max-width: 900px) {
  .portal-decision__body {
    display: flex;
    flex-direction: column;
  }

  .portal-decision__col {
    display: contents;
  }

  .portal-decision__block {
    padding: 22px 28px;
  }

  .portal-decision__block--decision {
    order: 1;
  }

  .portal-decision__image {
    order: 2;
    display: flex;
    justify-content: center;
    border-top: 1px solid var(--line);
  }

  /* Só a fotografia: o visor (.portal-lightbox, fixo e a ocupar o ecrã) também é filho deste bloco, e com «> *» abria com
     360 px de largura num tablet */
  .portal-decision__image > .portal-photo {
    width: min(100%, 360px);
  }

  .portal-facts {
    order: 3;
    padding: 10px 28px 18px;
  }

  .portal-decision__block--products {
    order: 4;
    border-top: 1px solid var(--line);
  }

  .portal-decision__block--read {
    order: 5;
    border-top: 1px solid var(--line);
  }
}

/* Até 600 px: as margens do telemóvel */
@media (max-width: 600px) {
  .portal-decision__bar {
    padding: 10px 16px;
  }

  .portal-decision__ref {
    display: none;
  }

  .portal-decision__block {
    padding: 20px 16px;
  }

  .portal-decision__image {
    padding: 20px 16px 14px;
  }

  .portal-facts {
    padding: 6px 16px 14px;
  }

  .portal-decision__verdict {
    padding: 14px 16px;
  }

  .portal-decision__action {
    flex: 1 1 100%;
    margin-left: 0;
  }

  .portal-decision__unavailable {
    max-width: none;
    text-align: left;
  }

  .portal-paper {
    --receipt-w: 100%;
  }

  .portal-receipt--action .portal-contest-open {
    display: none;
  }

  /* O lugar da barra no fim da página (a linha, 12 + 52 + 12 px e a margem do iPhone): com a página no fim, a barra fica
     por baixo do rodapé em vez de tapar a política de privacidade */
  .portal-body:has(.portal-sticky-action) {
    padding-bottom: calc(1px + 12px + 52px + 12px + env(safe-area-inset-bottom));
  }

  .portal-sticky-action {
    position: fixed;
    z-index: 25;
    right: 0;
    bottom: 0;
    left: 0;
    display: block;
    padding: 12px var(--gutter) calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: color-mix(in oklab, var(--bg) 88%, transparent);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
  }

  .portal-sticky-action__btn {
    width: 100%;
  }
}

/* ---------------------------------------------------------------------------------------------
   P9. A fotografia do talão e o visor (ampliar, rodar, abrir o original)
   --------------------------------------------------------------------------------------------- */
.portal-photo {
  display: grid;
  justify-items: center;
  gap: 12px;
}

.portal-photo__open {
  display: block;
  max-width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  cursor: zoom-in;
}

.portal-photo__img {
  width: auto;
  max-width: 100%;
  max-height: 520px;
  border-radius: var(--r-sm);
  background: var(--paper);
  box-shadow: var(--shadow-low-box);
}

.portal-photo__hint,
.portal-photo__note {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.6;
  text-align: center;
}

.portal-photo--empty {
  min-height: 220px;
  align-content: center;
}

.portal-photo__mark {
  --mark-dot: 8px;
  --mark-gap: 6px;
}

.portal-photo__pdf {
  width: 100%;
  height: 460px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--paper);
}

.portal-photo__action {
  margin: 0 0 0 8px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  text-decoration: underline;
  text-decoration-color: var(--cy);
  cursor: pointer;
}

.portal-photo--file {
  min-height: 160px;
  align-content: center;
}

.portal-lightbox {
  position: fixed;
  z-index: 90;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--scrim);
  overscroll-behavior: contain;
}

.portal-lightbox__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: max(10px, env(safe-area-inset-top)) var(--gutter) 10px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

.portal-lightbox__zoom {
  min-width: 52px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  text-align: center;
}

.portal-lightbox__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 38px;
  min-height: 38px;
  margin: 0;
  padding: 0 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-ctl);
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}

.portal-lightbox__btn:hover {
  border-color: var(--cy);
  color: var(--ink);
}

.portal-lightbox__btn--close {
  margin-left: auto;
}

.portal-lightbox__stage {
  display: flex;
  flex: 1 1 auto;
  align-items: safe center;
  justify-content: safe center;
  overflow: auto;
  padding: 16px;
  overscroll-behavior: contain;
}

/* O zoom muda a altura a sério (não um transform): o visor ganha scroll */
.portal-lightbox__img {
  width: auto;
  max-width: none;
  height: calc((100vh - 110px) * var(--z, 1));
  background: var(--paper);
  cursor: zoom-in;
}

.portal-lightbox__pdf {
  width: 96vw;
  height: calc(100vh - 110px);
  border: 0;
  background: var(--paper);
}

html:has(.portal-lightbox),
body:has(.portal-lightbox) {
  overflow: hidden;
}

@media (max-width: 600px) {
  .portal-photo__img {
    max-height: 60vh;
  }

  .portal-photo__pdf,
  .portal-photo__action--desk {
    display: none;
  }

  .portal-lightbox__img {
    width: calc((100vw - 32px) * var(--z, 1));
    height: auto;
  }

  .portal-lightbox__pdf {
    width: 100%;
    height: calc(100dvh - 140px);
  }
}

/* ---------------------------------------------------------------------------------------------
   P10. Contestar: o <dialog> nativo (no telemóvel, uma folha de ecrã inteiro com os botões em baixo)
   --------------------------------------------------------------------------------------------- */
.portal-dialog {
  width: min(560px, 100% - 2 * var(--gutter));
  max-height: calc(100dvh - 48px);
  margin: auto;
  padding: 0;
  overflow: auto;
  border: 1px solid var(--line-2);
  border-radius: var(--r-panel);
  background: var(--surface);
  box-shadow: var(--shadow-panel);
  color: var(--ink);
}

.portal-dialog::backdrop {
  background: var(--scrim);
}

/* Com o diálogo aberto a página por baixo não desliza */
html:has(.portal-dialog[open]) {
  overflow: hidden;
}

.portal-dialog__panel {
  --dialog-pad: clamp(22px, 1rem + 1.2vw, 32px);
  display: flex;
  flex-direction: column;
  padding: var(--dialog-pad) var(--dialog-pad) 0;
}

.portal-dialog__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.portal-dialog__close {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin: -6px -6px 0 0;
  padding: 0;
  border: 1px solid var(--line-2);
  border-radius: var(--r-ctl);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

.portal-dialog__close:hover {
  border-color: var(--cy);
}

.portal-dialog__close svg {
  width: 18px;
  height: 18px;
}

.portal-dialog__title {
  margin-top: var(--sp-2);
  font-size: clamp(1.375rem, 1.2rem + 0.6vw, 1.75rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.portal-dialog__lead {
  margin-top: var(--sp-3);
  color: var(--text);
  font-size: var(--fs-small);
  text-wrap: pretty;
}

.portal-dialog__body {
  display: grid;
  gap: var(--sp-5);
  margin-top: var(--sp-5);
}

.portal-dialog__reasons {
  display: grid;
  gap: 2px;
}

.portal-dialog__reasons .fieldset__legend {
  margin-bottom: 6px;
}

.portal-dialog__hints {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 16px;
}

.portal-dialog__counter {
  margin-top: 4px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  font-variant-numeric: tabular-nums;
}

.portal-dialog__body .field__error {
  margin-top: 0;
}

/* Os botões ficam sempre à vista, colados ao fundo do diálogo (em todas as larguras): num portátil baixo (1366×657) com os
   cinco motivos, «Enviar contestação» ficava fora do ecrã */
.portal-dialog__actions {
  position: sticky;
  bottom: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
  margin: var(--sp-6) calc(-1 * var(--dialog-pad)) 0;
  padding: 16px var(--dialog-pad);
  border-top: 1px solid var(--line);
  background: var(--surface);
}

@media (max-width: 600px) {
  .portal-dialog {
    width: 100%;
    max-width: none;
    height: 100dvh;
    max-height: none;
    margin: 0;
    border: 0;
    border-radius: 0;
  }

  .portal-dialog__panel {
    --dialog-pad: var(--gutter);
    min-height: 100%;
    padding: max(18px, env(safe-area-inset-top)) var(--dialog-pad) 0;
  }

  .portal-dialog__body {
    flex: 1 0 auto;
  }

  .portal-dialog__actions {
    flex-wrap: nowrap;
    margin-top: var(--sp-5);
    padding: 12px var(--dialog-pad) calc(12px + env(safe-area-inset-bottom));
  }

  /* Podem encolher abaixo da largura do nome e partir em duas linhas: «Einspruch einreichen» e «Envoyer la contestation»
     empurravam «Abbrechen»/«Annuler» para fora do ecrã pela esquerda a 360 px (sem scroll que lá chegue) */
  .portal-dialog__actions .btn {
    min-width: 0;
    padding-inline: 16px;
    white-space: normal;
  }

  .portal-dialog__actions .portal-dialog__submit {
    flex: 1 1 auto;
  }
}

/* ---------------------------------------------------------------------------------------------
   P11. Os estados que só o portal tem (§10.4): contestado (anel escuro), contestação aceite (anel
        ciano), recusada (anel cinzento — nunca vermelho); o estado grande da decisão; os vazios e os
        erros; alvos de toque de 44 px até 900 px
   --------------------------------------------------------------------------------------------- */
.status--contested,
.status--contest-accepted,
.status--contest-refused {
  color: var(--status-contested);
}

.status--contest-accepted {
  color: var(--cy-ink);
}

.status--contest-refused {
  color: var(--text);
}

.status--contested::before,
.status--contest-accepted::before,
.status--contest-refused::before {
  background: transparent;
  box-shadow: inset 0 0 0 1.5px currentColor;
}

.status--lg {
  gap: 10px;
  font-size: 14px;
}

.status--lg::before {
  width: 9px;
  height: 9px;
}

.status--lg.status--approved::before,
.status--lg.status--rejected::before {
  box-shadow: 0 0 12px currentColor;
}

/* O estado vazio: o símbolo da marca em pontos grandes, um título e uma frase */
.portal-empty {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 24px 40px;
  padding: clamp(40px, 2rem + 3vw, 72px) 24px;
  text-align: left;
}

.portal-empty__mark {
  --mark-dot: 10px;
  --mark-gap: 6px;
}

.portal-empty__body {
  max-width: 440px;
}

.portal-empty .portal-empty__title {
  color: var(--ink);
  font-size: 18px;
  line-height: 1.35;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.portal-empty .portal-empty__text {
  margin-top: 6px;
  color: var(--text);
  font-size: var(--fs-small);
}

/* Uma página que não carregou: o texto genérico e «Tentar outra vez» */
.portal-error {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  border-color: var(--red);
}

.portal-error__icon {
  flex: none;
  width: 22px;
  height: 22px;
  color: var(--red);
}

.portal-error .portal-error__text {
  flex: 1 1 240px;
  color: var(--ink);
  font-size: var(--fs-body);
  font-weight: 500;
}

@media (max-width: 900px) {
  .portal-chip,
  .portal-pager__link,
  .portal-lightbox__btn,
  .portal-error__retry,
  .portal-decision__action .btn--sm {
    min-height: 44px;
  }

  .portal-dialog__close {
    width: 44px;
    height: 44px;
  }

  .portal-preview__link {
    min-height: 44px;
  }

  /* «−» e «+» do visor eram 38 px de largura */
  .portal-lightbox__btn {
    min-width: 44px;
  }
}

/* ---------------------------------------------------------------------------------------------
   P12. As campanhas da marca (spec-campanhas.md, §15.4–§15.5, etapa 2b): a lista (a folha e a tabela dos talões), a página de
        uma campanha (o resumo e as secções) e os componentes partilhados do editor — as classes cmp- de
        Components/Campaigns, aqui com o aspeto do portal (o site.css dá-lhes o da Admin). Só tokens e nada a mexer; a amostra
        da cor da marca e o logótipo ficam no papel (a página pública é clara nos dois temas); alvos de 44 px até 900 px.
   --------------------------------------------------------------------------------------------- */
.portal-cmp {
  display: grid;
  gap: var(--sp-5);
}

/* Dentro da grelha, um cartão nunca se estica além da página (uma tabela ou um endereço comprido) */
.portal-cmp-overview,
.portal-cmp-section {
  min-width: 0;
}

/* A nova campanha: só dois campos, sem a largura toda */
.portal-cmp-new {
  max-width: 880px;
}

.portal-intro--campaign {
  padding-block: clamp(24px, 1rem + 1.6vw, 44px);
}

.portal-cmp-head .portal-intro__title {
  min-width: 0;
}

.portal-cmp-published {
  max-width: var(--measure);
  margin-top: var(--sp-3);
}

/* A lista: na folha do site, como os talões; a linha inteira leva à campanha (o nome é a ligação; um ::after cobre a linha) */
.portal-cmp-rows {
  padding: 4px clamp(16px, 1rem + 0.6vw, 24px);
}

.portal-cmp-row {
  position: relative;
}

.portal-cmp-row:hover > td {
  background: var(--surface-2);
}

.portal-cmp-table td,
.portal-cmp-table th {
  vertical-align: middle;
}

.portal-cmp-row__link {
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}

.portal-cmp-row__link::after {
  content: "";
  position: absolute;
  inset: 0;
}

.portal-cmp-row__link:hover {
  color: var(--cy-ink);
}

.portal-cmp-row__link:focus-visible {
  outline: none;
}

.portal-cmp-row__link:focus-visible::after {
  outline: 2px solid var(--cy);
  outline-offset: -2px;
  border-radius: var(--r-sm);
}

.portal-cmp-row__slug {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.portal-cmp-row__period,
.portal-cmp-row__num {
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* O resumo de uma campanha: os números (mono, como os mosaicos do painel, sem a barra) e os factos */
.portal-cmp-kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: var(--sp-3);
  margin: 0;
}

.portal-cmp-kpi {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  background: var(--surface-2);
}

.portal-cmp-kpi dt {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.portal-cmp-kpi dd {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: clamp(1.25rem, 1.1rem + 0.6vw, 1.625rem);
  line-height: 1.1;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.portal-cmp-facts {
  margin: var(--sp-5) 0 0;
}

.portal-cmp-facts > div {
  display: grid;
  grid-template-columns: minmax(140px, 200px) minmax(0, 1fr);
  gap: 4px 24px;
  align-items: baseline;
  padding-block: 10px;
  border-top: 1px dashed var(--line);
}

.portal-cmp-facts dt {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
}

.portal-cmp-facts dd {
  min-width: 0;
  margin: 0;
  color: var(--ink);
  font-size: var(--fs-small);
  overflow-wrap: anywhere;
}

.portal-cmp-facts__link {
  overflow-wrap: anywhere;
}

.portal-cmp-facts__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0 24px;
}

.portal-cmp-facts__note {
  display: block;
  color: var(--text);
}

.portal-cmp-facts .link {
  min-height: 32px;
}

.portal-cmp-done {
  margin-top: var(--sp-4);
}

/* A secção aberta: o título (o nome da secção e «Guardado ✓»), o aviso de conflito e o formulário */
.portal-cmp-section__title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 16px;
  margin: 0 0 var(--sp-5);
}

.portal-cmp-saved {
  color: var(--cy-ink);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.portal-cmp-conflict {
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-5);
}

/* As mensagens da campanha: a ligação para o registo das mensagens enviadas, debaixo dos modelos */
.portal-cmp-msglink {
  margin: var(--sp-5) 0 0;
  font-size: var(--fs-small);
}

/* As secções: os botões das secções, como os chips do portal (a atual com o contorno ciano; as falhas da lista de
   verificação a vermelho) */
.cmp-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cmp-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  margin: 0;
  padding: 0 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
}

.cmp-tab:hover {
  border-color: var(--muted);
  color: var(--ink);
}

.cmp-tab-current,
.cmp-tab-current:hover {
  border-color: var(--cy);
  background: var(--cy-soft);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--cy);
}

.cmp-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--r-pill);
  background: var(--red-soft);
  color: var(--red);
  font-weight: 700;
}

/* Os formulários: as etiquetas mono dos filtros, os campos do site (no tom da superfície), as ajudas e os erros */
.cmp-form {
  display: grid;
  gap: var(--sp-4);
  min-width: 0;
}

.cmp-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--sp-4);
}

.cmp-field {
  display: grid;
  gap: 6px;
  min-width: min(100%, 13rem);
}

.cmp-grow {
  flex: 1 1 18rem;
}

.cmp-label {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
}

.cmp-input {
  display: block;
  width: 100%;
  min-height: 44px;
  margin: 0;
  padding: 0 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-ctl);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
}

.cmp-input:hover {
  border-color: var(--muted);
}

.cmp-input:focus-visible {
  border-color: var(--cy);
  outline-offset: 1px;
}

.cmp-input:disabled {
  border-color: var(--line);
  background: var(--bg-2);
  color: var(--text);
  cursor: not-allowed;
}

.cmp-input[aria-invalid="true"] {
  border: 2px solid var(--red);
  padding-inline: 11px;
}

select.cmp-input {
  padding-right: 32px;
}

.cmp-text {
  min-height: 96px;
  padding: 10px 12px;
  resize: vertical;
}

.cmp-num {
  max-width: 9rem;
}

.cmp-hex {
  max-width: 8rem;
  font-family: var(--font-mono);
}

.cmp-color {
  width: 56px;
  height: 44px;
  padding: 2px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-ctl);
  background: var(--surface);
  cursor: pointer;
}

.cmp-file {
  max-width: 100%;
  color: var(--text);
  font-size: var(--fs-small);
}

.cmp-file::file-selector-button {
  min-height: 40px;
  margin-right: 12px;
  padding: 0 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-ctl);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}

.cmp-file::file-selector-button:hover {
  border-color: var(--cy);
}

.cmp-prefixed {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cmp-prefix {
  flex: none;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 13px;
}

.cmp-hint {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
}

.cmp-errors {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  color: var(--red);
  font-size: var(--fs-small);
  font-weight: 600;
}

.cmp-error {
  margin: 0;
  color: var(--red);
  font-size: var(--fs-small);
  font-weight: 600;
}

/* Um aviso que não impede (o endereço de teste, o contraste da cor): o .notice do site */
.cmp-warn {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--cy);
  border-radius: var(--r-ctl);
  background: var(--cy-soft);
  color: var(--ink);
  font-size: var(--fs-small);
}

.cmp-empty {
  margin: 0;
  color: var(--text);
  font-size: var(--fs-small);
}

.cmp-group {
  display: grid;
  gap: 10px;
  min-width: 0;
  margin: 0;
  padding: 16px 18px 18px;
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
}

.cmp-group > legend {
  padding: 0 6px;
  color: var(--ink);
  font-size: var(--fs-small);
  font-weight: 600;
}

.cmp-check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  color: var(--ink);
  font-size: var(--fs-small);
  cursor: pointer;
}

.cmp-check input {
  flex: none;
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--cy);
}

.cmp-check.cmp-strong {
  font-weight: 600;
}

.cmp-check.cmp-off {
  color: var(--muted);
  cursor: default;
}

.cmp-check.cmp-stale {
  color: var(--red);
}

.cmp-subtitle {
  margin: var(--sp-6) 0 var(--sp-3);
  font-size: var(--fs-app-h2);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.cmp-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Os botões: o secundário pequeno do site; gravar é o ciano; terminar e apagar, o contorno vermelho */
.cmp-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.cmp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  margin: 0;
  padding: 0 16px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-ctl);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
}

.cmp-btn:hover {
  border-color: var(--cy);
}

.cmp-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.cmp-btn-primary {
  border-color: var(--cy);
  background: var(--cy);
  color: var(--on-cy);
  font-weight: 600;
}

.cmp-btn-primary:hover {
  filter: brightness(1.08);
}

.cmp-btn-danger {
  border-color: var(--red);
  color: var(--red);
  font-weight: 600;
}

.cmp-btn-danger:hover {
  border-color: var(--red);
  background: var(--red-soft);
}

.cmp-btn-small {
  min-height: 34px;
  padding: 0 10px;
  font-size: 13px;
}

.cmp-link {
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font-size: var(--fs-small);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: var(--cy);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 4px;
  cursor: pointer;
}

.cmp-link:hover {
  color: var(--cy-ink);
}

.cmp-confirm {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.cmp-confirm-q {
  color: var(--red);
  font-size: var(--fs-small);
  font-weight: 600;
}

.cmp-state-actions {
  margin-top: var(--sp-4);
}

/* Os produtos: a tabela do site, a pesquisa no catálogo e os resultados, «Acrescentar ao catálogo» */
.cmp-table {
  width: 100%;
  border-collapse: collapse;
  color: var(--ink);
}

.cmp-table th,
.cmp-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: var(--fs-small);
}

.cmp-table thead th {
  padding-block: 8px;
  border-bottom-color: var(--line-2);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  font-weight: 400;
}

.cmp-table :is(th, td):first-child {
  padding-left: 0;
}

.cmp-table :is(th, td):last-child {
  padding-right: 0;
}

td.cmp-row-actions,
span.cmp-row-actions {
  white-space: nowrap;
}

.cmp-row-actions > button + button {
  margin-left: 6px;
}

.cmp-products .cmp-input {
  min-width: 9rem;
}

.cmp-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.cmp-stores {
  gap: 2px;
}

.cmp-search {
  display: grid;
  gap: 8px;
}

.cmp-results > li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  background: var(--surface-2);
  font-size: var(--fs-small);
}

.cmp-details > summary {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  color: var(--ink);
  font-size: var(--fs-small);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--cy);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 4px;
  cursor: pointer;
}

.cmp-details[open] > summary {
  margin-bottom: 12px;
}

.cmp-details > .cmp-row,
.cmp-details > .cmp-actions,
.cmp-details > .cmp-errors {
  margin-top: 12px;
}

/* Os campos do participante: um cartão por campo, com a barra ciano quando é pedido */
.cmp-fields {
  gap: 12px;
}

.cmp-field-card {
  display: grid;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  background: var(--surface);
}

.cmp-field-card.cmp-on {
  border-color: var(--line-2);
  box-shadow: inset 3px 0 var(--cy);
}

/* «Obrigatório», «Quando» e as opções numa linha: as caixas alinham pelo fundo do campo «Quando» */
.cmp-field-card > .cmp-row {
  align-items: flex-end;
}

.cmp-field-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* A aparência: o logótipo, a imagem de topo e a amostra da cor no papel (a página pública é clara nos dois temas) */
.cmp-logo-preview {
  display: block;
  max-width: 320px;
  max-height: 80px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  background: var(--paper);
}

.cmp-hero-preview {
  display: block;
  max-width: 100%;
  max-height: 220px;
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
}

.cmp-sample {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  background: var(--paper);
}

.cmp-sample-title {
  color: var(--cmp-brand-ink);
  font-size: 18px;
  font-weight: 700;
}

.cmp-sample-button {
  display: inline-block;
  padding: 8px 18px;
  border: 1px solid var(--cmp-brand-border);
  border-radius: var(--r-ctl);
  background: var(--cmp-brand);
  color: var(--cmp-on-brand);
  font-weight: 700;
}

/* Publicar: a lista de verificação (✓ ciano, ✗ vermelho; o texto diz também «certo» ou «por corrigir») */
.cmp-checklist {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.cmp-checklist > li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  color: var(--text);
  font-size: var(--fs-small);
}

.cmp-mark {
  flex: none;
  width: 1.1em;
  font-family: var(--font-mono);
  font-weight: 700;
}

.cmp-pass .cmp-mark {
  color: var(--cy-ink);
}

.cmp-fail {
  color: var(--ink);
}

.cmp-fail .cmp-mark {
  color: var(--red);
}

/* As mensagens (etapa 5): os marcadores, um modelo por tipo, o resultado do teste e a pré-visualização do email — no papel (o
   email é claro nos dois temas), com a cor da marca só no botão e no nome */
.cmp-templates .cmp-group {
  gap: 16px;
}

.cmp-tpl-placeholders {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  gap: 6px 24px;
  margin: 12px 0 0;
}

.cmp-tpl-placeholder {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  color: var(--text);
  font-size: 13px;
}

.cmp-tpl-placeholder > dt,
.cmp-tpl-placeholder > dd {
  margin: 0;
}

.cmp-tpl-placeholder code {
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 12px;
}

.cmp-tpl {
  display: grid;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
}

.cmp-tpl:first-of-type {
  padding-top: 0;
  border-top: 0;
}

.cmp-tpl-title {
  margin: 0;
  color: var(--ink);
  font-size: var(--fs-small);
  font-weight: 600;
}

.cmp-tpl-result {
  margin: 0;
  color: var(--cy-ink);
  font-size: var(--fs-small);
  font-weight: 600;
}

.cmp-mail {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  background: var(--surface-2);
}

.cmp-mail-meta {
  display: grid;
  gap: 4px;
}

.cmp-mail-title {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.cmp-mail-subject {
  margin: 0;
  color: var(--ink);
  font-size: var(--fs-small);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.cmp-mail-paper {
  --ink: var(--print-ink);
  --text: var(--print-text);
  --muted: var(--print-faded);
  max-width: 600px;
  padding: 20px 24px;
  border: 1px solid var(--print-perf);
  border-radius: var(--r-ctl);
  background: var(--paper);
  color: var(--print-ink);
  color-scheme: light;
}

.cmp-mail-head {
  margin-bottom: 16px;
}

.cmp-mail-logo {
  display: block;
  width: auto;
  max-width: 240px;
  height: 48px;
}

.cmp-mail-brand {
  margin: 0;
  color: var(--cmp-brand-ink);
  font-size: 18px;
  font-weight: 700;
}

.cmp-mail-body > p {
  margin: 0 0 14px;
  font-size: 15px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.cmp-mail-button {
  display: inline-block;
  padding: 8px 16px;
  border: 1px solid var(--cmp-brand-border);
  border-radius: var(--r-sm);
  background: var(--cmp-brand);
  color: var(--cmp-on-brand);
  font-weight: 700;
}

.cmp-mail-link {
  color: var(--cmp-brand-ink);
  text-decoration: underline;
  word-break: break-all;
}

.cmp-mail-foot {
  margin: 16px 0 0;
  padding-top: 12px;
  border-top: 1px dashed var(--print-perf);
  color: var(--print-faded);
  font-size: 13px;
  line-height: 1.5;
}

.cmp-mail-text {
  max-height: 22rem;
  margin: 0;
  padding: 12px 14px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* O registo das mensagens (/cliente/mensagens): os filtros, a tabela como a das campanhas (as datas e os números em mono) e a
   participação por baixo do nome da campanha */
.portal-cmp-msg-lead {
  max-width: var(--measure);
  margin-top: var(--sp-3);
}

.portal-cmp-msg-filter__campaign {
  flex: 0 1 260px;
}

.portal-cmp-msg-table td,
.portal-cmp-msg-table th {
  vertical-align: middle;
}

.portal-cmp-msg-row__when,
.portal-cmp-msg-row__num {
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.portal-cmp-msg-row__name {
  display: block;
  color: var(--ink);
  font-weight: 600;
}

.portal-cmp-msg-row__ref,
.portal-cmp-msg-row__channel {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
}

.portal-cmp-msg-row__ref {
  display: block;
  margin-top: 2px;
}

.portal-cmp-msg-row__to {
  font-family: var(--font-mono);
  font-size: 13px;
  overflow-wrap: anywhere;
}

/* Até 900 px: os números em três colunas; a lista em cartões (o nome, o estado e o período a toda a largura, os números em
   duas colunas); alvos de toque de 44 px */
@media (max-width: 900px) {
  .portal-cmp-kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .portal-cmp-table.table--stack-md tr.portal-cmp-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 16px;
    padding: 16px 0;
  }

  .portal-cmp-table.table--stack-md td + td {
    margin-top: 0;
  }

  .portal-cmp-row__name,
  .portal-cmp-row__state,
  .portal-cmp-row__period {
    grid-column: 1 / -1;
  }

  .portal-cmp-table td.portal-cmp-row__name[data-label]::before {
    content: none;
  }

  .portal-cmp-row > td {
    background: none;
  }

  .cmp-btn,
  .cmp-tab,
  .cmp-check,
  .cmp-details > summary {
    min-height: 44px;
  }

  .cmp-btn-small {
    min-width: 44px;
  }

  .portal-cmp-msg-table.table--stack-md tr.portal-cmp-msg-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 16px;
    padding: 16px 0;
  }

  .portal-cmp-msg-row__campaign {
    grid-column: 1 / -1;
  }
}

/* Até 600 px: uma coluna; as secções numa linha que desliza (a página nunca desliza para o lado); a tabela dos produtos em
   cartões */
@media (max-width: 600px) {
  .portal-cmp-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .portal-cmp-facts > div {
    grid-template-columns: minmax(0, 1fr);
  }

  .cmp-tabs {
    flex-wrap: nowrap;
    margin-inline: calc(-1 * var(--gutter));
    padding-inline: var(--gutter);
    overflow-x: auto;
    scrollbar-width: none;
  }

  .cmp-tabs::-webkit-scrollbar {
    display: none;
  }

  .cmp-tab {
    flex: none;
  }

  .cmp-row {
    flex-direction: column;
    align-items: stretch;
  }

  .cmp-field,
  .cmp-grow {
    flex: 1 1 auto;
    min-width: 0;
  }

  .cmp-num,
  .cmp-hex {
    max-width: none;
  }

  .cmp-group {
    padding: 12px 14px 14px;
  }

  .cmp-actions > .cmp-btn {
    flex: 1 1 auto;
  }

  table.cmp-table,
  table.cmp-table tbody {
    display: block;
  }

  table.cmp-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  table.cmp-table tr {
    display: block;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
  }

  table.cmp-table td {
    display: block;
    padding: 4px 0;
    border: 0;
  }

  table.cmp-table td[data-label]::before {
    content: attr(data-label);
    display: block;
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: var(--fs-label);
  }

  td.cmp-row-actions {
    display: flex;
    gap: 8px;
  }

  .cmp-row-actions > button + button {
    margin-left: 0;
  }

  .cmp-results > li {
    flex-direction: column;
    align-items: stretch;
  }

  .cmp-checklist > li {
    display: grid;
    grid-template-columns: 1.1em minmax(0, 1fr);
    column-gap: 10px;
  }

  .cmp-checklist > li > .cmp-link {
    grid-column: 2;
    justify-self: start;
    min-height: 44px;
  }

  .cmp-sample {
    flex-direction: column;
    align-items: flex-start;
  }

  .cmp-logo-preview {
    max-width: 100%;
  }

  .cmp-confirm {
    display: flex;
    width: 100%;
  }

  .cmp-confirm > .cmp-confirm-q {
    flex: 1 1 100%;
  }

  .cmp-confirm > button {
    flex: 1 1 0;
  }

  .cmp-tpl-placeholders {
    grid-template-columns: minmax(0, 1fr);
  }

  .cmp-mail {
    padding: 10px;
  }

  .cmp-mail-paper {
    padding: 16px 14px;
  }

  .portal-cmp-msg-filter__campaign {
    flex: 1 1 100%;
  }
}

/* As participações e os pagamentos (etapa 7): as três páginas de uma campanha (resumo, participações, pagamentos), os filtros, a
   tabela (no telemóvel, cartões), as etiquetas dos estados (ciano: aprovada ou paga; vermelho: não aprovada ou recusada; neutra: o
   resto), o detalhe em blocos e as perguntas com o motivo. Só tokens, claro e escuro; alvos de 44 px até 900 px. */
.cmp-area-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cmp-area-link {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  text-decoration: none;
  white-space: nowrap;
}

.cmp-area-link:hover {
  border-color: var(--muted);
  color: var(--ink);
}

.cmp-area-link:focus-visible {
  outline: 2px solid var(--cy);
  outline-offset: 2px;
}

.cmp-area-link.cmp-area-current,
.cmp-area-link.cmp-area-current:hover {
  border-color: var(--cy);
  background: var(--cy-soft);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--cy);
}

.portal-cmp-readonly,
.portal-cmp-logfailed {
  margin: 0;
}

.portal-cmp-logfailed {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
}

.portal-cmp-parts,
.portal-cmp-detail,
.portal-cmp-payouts {
  min-width: 0;
}

.cmp-parts,
.cmp-payouts,
.cmp-detail {
  display: grid;
  gap: var(--sp-4);
  min-width: 0;
}

.cmp-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 14px;
}

.cmp-filters .cmp-field {
  min-width: 9rem;
}

.cmp-filters .cmp-grow {
  flex: 1 1 16rem;
}

.cmp-filter-actions {
  padding-bottom: 2px;
}

.cmp-filters-hint {
  flex: 1 0 100%;
  margin: -4px 0 0;
}

.cmp-parts-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 14px;
  margin: 0;
  color: var(--ink);
  font-size: var(--fs-small);
}

.cmp-done {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--cy);
  border-radius: var(--r-ctl);
  background: var(--cy-soft);
  color: var(--ink);
  font-size: var(--fs-small);
}

.cmp-parts-actions {
  min-height: 0;
}

.cmp-reason-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.cmp-reason-box > .cmp-input {
  flex: 1 1 16rem;
  width: auto;
}

.cmp-table-wrap {
  overflow-x: auto;
}

.cmp-col-select {
  width: 2.4rem;
}

.cmp-check-input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--cy);
}

.cmp-table .cmp-num-col {
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.cmp-part-row > td,
.cmp-payout-row > td {
  vertical-align: top;
}

.cmp-part-ref {
  white-space: nowrap;
}

.cmp-ref-link {
  color: var(--ink);
  font-family: var(--font-mono);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--line-2);
  text-underline-offset: 3px;
}

.cmp-ref-link:hover {
  color: var(--cy-ink);
  text-decoration-color: currentColor;
}

.cmp-part-email {
  white-space: nowrap;
}

.cmp-part-name {
  min-width: 7rem;
}

.cmp-part-items {
  min-width: 9.5rem;
}

.cmp-chip {
  display: inline-flex;
  align-items: center;
  padding: 1px 10px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  font-weight: 700;
  line-height: 1.6;
  white-space: nowrap;
}

.cmp-chip.cmp-chip--ok {
  border-color: var(--cy);
  background: var(--cy-soft);
  color: var(--cy-ink);
}

.cmp-chip.cmp-chip--no {
  border-color: var(--red);
  background: var(--red-soft);
  color: var(--red);
}

.cmp-chip.cmp-chip--wait {
  color: var(--ink);
}

.cmp-chip.cmp-chip--off {
  color: var(--muted);
}

.cmp-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 var(--sp-3);
}

.cmp-pager {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cmp-pager-where {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
}

.cmp-detail-block {
  min-width: 0;
  padding-top: var(--sp-4);
  border-top: 1px solid var(--line);
}

.cmp-detail-block:first-of-type {
  padding-top: 0;
  border-top: 0;
}

.cmp-detail-title {
  margin: 0 0 var(--sp-3);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.cmp-kv {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: 10px 22px;
  margin: 0;
}

.cmp-kv > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.cmp-kv dt {
  color: var(--muted);
  font-size: 13px;
}

.cmp-kv dd {
  margin: 0;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.cmp-field-value {
  font-weight: 600;
}

.cmp-part-products > li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  background: var(--surface-2);
}

.cmp-part-product-name {
  color: var(--ink);
  font-weight: 600;
}

.cmp-part-product-code {
  margin-left: 6px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
}

.cmp-amount {
  margin: var(--sp-3) 0 0;
  color: var(--ink);
}

.cmp-payout-facts {
  gap: 4px;
  color: var(--ink);
  font-size: var(--fs-small);
}

.cmp-payout-note {
  display: block;
  margin-top: 4px;
}

.cmp-messages-table td {
  white-space: nowrap;
}

.cmp-detail-actions .cmp-actions {
  margin-bottom: var(--sp-2);
}

.cmp-payout-states {
  margin: 0;
}

.cmp-parts-table,
.cmp-payouts-table {
  min-width: 0;
}

/* O apagamento dos dados (etapa 8): o aviso por cima das páginas de uma campanha e os pedidos do participante (exportar, apagar) */
.cmp-erasure {
  margin: 0 0 var(--sp-4);
}

.cmp-detail-requests .cmp-actions {
  margin-bottom: var(--sp-2);
}

.cmp-erase-box {
  flex-direction: column;
  align-items: flex-start;
  max-width: 48rem;
}

.cmp-erase-box > .cmp-warn {
  width: 100%;
}

.cmp-erase-explain {
  color: var(--ink);
  font-size: var(--fs-small);
}

@media (max-width: 900px) {
  .cmp-area-nav {
    flex-wrap: nowrap;
  }

  .cmp-area-link {
    flex: 1 1 0;
    justify-content: center;
    min-height: 44px;
    padding: 0 8px;
  }

  .cmp-filters {
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
  }

  .cmp-filters .cmp-field,
  .cmp-filters .cmp-grow {
    flex: 1 1 auto;
    min-width: 0;
  }

  .cmp-filters-hint {
    flex: none;
    order: 1;
    margin: -6px 0 0;
  }

  .cmp-filters > .cmp-filter-actions {
    order: 2;
  }

  .cmp-filter-actions > .cmp-btn,
  .cmp-parts-actions > .cmp-btn,
  .cmp-pager > .cmp-btn {
    flex: 1 1 auto;
    min-height: 44px;
  }

  .cmp-reason-box > .cmp-input {
    flex: 1 1 100%;
  }

  .cmp-check-input {
    width: 22px;
    height: 22px;
  }

  /* Os estados do pagamento quebram a linha (todos à vista), sem o recuo das abas do editor (que vão de lado a lado). */
  .cmp-payout-states {
    flex-wrap: wrap;
    margin-inline: 0;
    padding-inline: 0;
    overflow-x: visible;
  }

  .cmp-parts-table tbody td.cmp-part-email {
    overflow-wrap: anywhere;
  }

  .cmp-pager {
    justify-content: space-between;
  }

  /* A tabela das participações e a dos pagamentos em cartões (a etiqueta de cada célula por cima do valor) */
  .cmp-parts-table,
  .cmp-parts-table tbody,
  .cmp-payouts-table,
  .cmp-payouts-table tbody,
  .cmp-messages-table,
  .cmp-messages-table tbody {
    display: block;
  }

  .cmp-parts-table thead,
  .cmp-payouts-table thead,
  .cmp-messages-table thead {
    display: none;
  }

  .cmp-parts-table tbody tr,
  .cmp-payouts-table tbody tr,
  .cmp-messages-table tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 6px 14px;
    margin-bottom: 10px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--r-ctl);
    background: var(--surface);
  }

  .cmp-parts-table tbody td,
  .cmp-payouts-table tbody td,
  .cmp-messages-table tbody td {
    display: block;
    min-width: 0;
    padding: 0;
    border: 0;
    white-space: normal;
  }

  .cmp-parts-table tbody td[data-label]::before,
  .cmp-payouts-table tbody td[data-label]::before,
  .cmp-messages-table tbody td[data-label]::before {
    content: attr(data-label);
    display: block;
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: var(--fs-label);
  }

  .cmp-parts-table tbody td.cmp-col-select,
  .cmp-payouts-table tbody td.cmp-col-select {
    grid-column: 1 / -1;
  }

  .cmp-parts-table tbody td.cmp-part-ref,
  .cmp-payouts-table tbody td.cmp-part-ref {
    grid-column: 1 / -1;
  }

  .cmp-table .cmp-num-col {
    text-align: left;
  }

  .cmp-kv {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 600px) {
  .cmp-parts-table tbody tr,
  .cmp-payouts-table tbody tr {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------------------------------------------------------------------------------------------
   P13. Os relatórios mensais (itens 4–6): a folha com os meses — o mês (e «mês em curso») e as
        ligações PDF e Excel (lado a lado; no telemóvel, uma por cima da outra); a nota por baixo
   --------------------------------------------------------------------------------------------- */
.portal-reports__sheet {
  padding: 4px clamp(16px, 1rem + 0.6vw, 24px);
}

.portal-reports__table th,
.portal-reports__table td {
  vertical-align: middle;
}

.portal-reports__month {
  color: var(--ink);
}

.portal-reports__current {
  display: inline-flex;
  align-items: center;
  margin-left: 10px;
  padding: 2px 8px;
  border: 1px solid var(--cy);
  border-radius: var(--r-pill);
  background: var(--cy-soft);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  font-weight: 400;
  line-height: 1.5;
  white-space: nowrap;
  vertical-align: middle;
}

/* A coluna das ligações encolhe ao que precisa, à direita (dois nomes de classe: ganha ao «text-align: left» de .table) */
.portal-reports__table .portal-reports__files-head,
.portal-reports__table .portal-reports__files {
  width: 1%;
  text-align: right;
  white-space: nowrap;
}

.portal-reports__links {
  display: inline-flex;
  gap: 8px;
  vertical-align: middle;
}

.portal-reports__file {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-ctl);
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}

.portal-reports__file:hover {
  border-color: var(--cy);
  color: var(--ink);
}

.portal-reports__icon {
  flex: none;
  width: 16px;
  height: 16px;
  color: var(--cy-ink);
}

.portal-reports__note {
  max-width: var(--measure);
  margin-top: var(--sp-4);
}

/* ≤ 900 px: alvos de toque de 44 px, como o resto do portal (§10.4) */
@media (max-width: 900px) {
  .portal-reports__file {
    min-height: 44px;
  }
}

/* No telemóvel: «mês em curso» por baixo do mês, e as duas ligações uma por cima da outra, da mesma largura (lado a lado não
   cabiam ao lado de «Październik 2026» e de «month in progress» a 360 px) */
@media (max-width: 600px) {
  .portal-reports__sheet {
    padding: 4px 16px;
  }

  .portal-reports__current {
    display: flex;
    width: max-content;
    margin: 6px 0 0;
  }

  .portal-reports__links {
    display: grid;
    gap: 6px;
  }

  .portal-reports__file {
    padding: 0 12px;
  }
}

/* Faixa do staging (Environment__Name=STAGING): nunca aparece na produção. */
.env-banner { background: var(--red); color: var(--c-white); text-align: center; font-weight: 600; font-size: var(--fs-small); padding: 5px 12px; position: sticky; top: 0; z-index: 2000; }
